blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
gha_stargazers_count
int32
0
112k
gha_forks_count
int32
0
39.4k
gha_open_issues_count
int32
0
11k
gha_language
stringlengths
1
21
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
cf831621384b90a65a6d7222112f16fcae5c5a83
18,073,222,442,885
ae3502951e4650e544096cdf68ffd46b028ddfc1
/domain/src/main/java/com/cwenhui/domain/repository/UserRepository.java
5a5828c0c0b7cea84d94206f14759f3c3443afe8
[]
no_license
gindoc/YumNote
https://github.com/gindoc/YumNote
dfaf9a64d97afdf1e1220758a24848998c993083
214af51245d453e3dcab24ea55f7cbf45e7037fc
refs/heads/master
2021-01-11T21:07:54.390000
2017-04-22T08:22:59
2017-04-22T08:22:59
79,253,407
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cwenhui.domain.repository; import com.cwenhui.domain.model.response.Response; import rx.Observable; /** * Author: GIndoc on 2017/4/9 21:34 * email : 735506583@qq.com * FOR : */ public interface UserRepository { Observable<Response<String>> login(String userName, String userPassword); }
UTF-8
Java
313
java
UserRepository.java
Java
[ { "context": "e.Response;\n\nimport rx.Observable;\n\n/**\n * Author: GIndoc on 2017/4/9 21:34\n * email : 735506583@qq.com\n * ", "end": 136, "score": 0.9996728301048279, "start": 130, "tag": "USERNAME", "value": "GIndoc" }, { "context": "**\n * Author: GIndoc on 2017/4/9 21:34\n * email : 735506583@qq.com\n * FOR :\n */\npublic interface UserRepository {\n", "end": 182, "score": 0.9999216794967651, "start": 166, "tag": "EMAIL", "value": "735506583@qq.com" } ]
null
[]
package com.cwenhui.domain.repository; import com.cwenhui.domain.model.response.Response; import rx.Observable; /** * Author: GIndoc on 2017/4/9 21:34 * email : <EMAIL> * FOR : */ public interface UserRepository { Observable<Response<String>> login(String userName, String userPassword); }
304
0.734824
0.674121
15
19.866667
22.443609
77
false
false
0
0
0
0
0
0
0.333333
false
false
5
d9b12432f9cbb62f8ba53add2a56c7a74ea793ad
27,633,819,605,217
40f9762f2c0b50fc521e655d2b240c3db6c896ac
/app/src/main/java/com/tributedummy/metbb/dummy3/ConcertFragment.java
506a8e32eef41c0d65e5b2fe5bd50a19ab5753a5
[]
no_license
Mikkelet/TributeAndroid
https://github.com/Mikkelet/TributeAndroid
c1c1f41c4b28b9aa61401a19cf76f4c04144bf6b
774fd36d8ecc3e08125d77966dca15838f67a299
refs/heads/master
2020-04-02T04:39:07.526000
2018-11-27T11:07:48
2018-11-27T11:07:48
154,027,399
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tributedummy.metbb.dummy3; import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ScrollView; import android.widget.Toast; import com.tributedummy.metbb.dummy3.adapters.ConcertPhotosAdapter; import com.tributedummy.metbb.dummy3.adapters.ReviewAdapter; import com.tributedummy.metbb.dummy3.classes.Concert; import com.tributedummy.metbb.dummy3.databinding.FragmentConcertBinding; /** * A simple {@link Fragment} subclass. */ public class ConcertFragment extends Fragment { private Concert concert; FragmentConcertBinding concertBinding; MainActivity mainActivity; public ConcertFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment //v = inflater.inflate(R.layout.fragment_concert, container, false); mainActivity = (MainActivity) getActivity(); concertBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_concert, container, false); concertBinding.setConcert(concert); //concertBinding.concertTextviewArtist.setText(StringUtils.); setupButtonRatingDetails(); setupButtonReviewConcert(); setupButtonArtist(); setupButtonVenue(); setupButtonBack(); setupRecyclerviewPhotos(); setupLinearLayoutReviews(); return concertBinding.getRoot(); } @Override public void onResume() { super.onResume(); mainActivity.setActionBarVisibility(false); //scrolls up concertBinding.concertsScrollview.fullScroll(ScrollView.FOCUS_UP); } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); } // Setups private void setupButtonReviewConcert() { concertBinding.concertButtonReviewconcert.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mainActivity.switchFragment(mainActivity.getReviewConcertFragment(concert),true); } }); } private void setupButtonRatingDetails() { concertBinding.concertButtonRatingdetails.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(mainActivity, "view rating deets", Toast.LENGTH_SHORT).show(); concertBinding.concertExpandableLayout.toggle(); } }); } private void setupButtonArtist() { concertBinding.concertImageviewArtist.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mainActivity.switchFragment(mainActivity.getSolopageFragment(concert.getArtist()),true); } }); } private void setupButtonVenue() { concertBinding.concertImageviewVenue.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mainActivity.switchFragment(mainActivity.getSolopageFragment(concert.getVenue()),true); } }); } private void setupButtonBack() { concertBinding.concertButtonBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mainActivity.onBackPressed(); } }); } private void setupRecyclerviewPhotos() { concertBinding.concertRecycleviewConcerts.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL,false)); ConcertPhotosAdapter adapter = new ConcertPhotosAdapter(getContext(),concert.getPhotos()); concertBinding.concertRecycleviewConcerts.setAdapter(adapter); } private void setupLinearLayoutReviews() { ReviewAdapter reviewAdapter = new ReviewAdapter(getContext(),concert); concertBinding.concertRecycleViewReviews.setLayoutManager(new LinearLayoutManager(getContext())); concertBinding.concertRecycleViewReviews.setAdapter(reviewAdapter); } //getters and setters public void setConcert(Concert concert) { this.concert = concert; } }
UTF-8
Java
4,570
java
ConcertFragment.java
Java
[]
null
[]
package com.tributedummy.metbb.dummy3; import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ScrollView; import android.widget.Toast; import com.tributedummy.metbb.dummy3.adapters.ConcertPhotosAdapter; import com.tributedummy.metbb.dummy3.adapters.ReviewAdapter; import com.tributedummy.metbb.dummy3.classes.Concert; import com.tributedummy.metbb.dummy3.databinding.FragmentConcertBinding; /** * A simple {@link Fragment} subclass. */ public class ConcertFragment extends Fragment { private Concert concert; FragmentConcertBinding concertBinding; MainActivity mainActivity; public ConcertFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment //v = inflater.inflate(R.layout.fragment_concert, container, false); mainActivity = (MainActivity) getActivity(); concertBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_concert, container, false); concertBinding.setConcert(concert); //concertBinding.concertTextviewArtist.setText(StringUtils.); setupButtonRatingDetails(); setupButtonReviewConcert(); setupButtonArtist(); setupButtonVenue(); setupButtonBack(); setupRecyclerviewPhotos(); setupLinearLayoutReviews(); return concertBinding.getRoot(); } @Override public void onResume() { super.onResume(); mainActivity.setActionBarVisibility(false); //scrolls up concertBinding.concertsScrollview.fullScroll(ScrollView.FOCUS_UP); } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); } // Setups private void setupButtonReviewConcert() { concertBinding.concertButtonReviewconcert.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mainActivity.switchFragment(mainActivity.getReviewConcertFragment(concert),true); } }); } private void setupButtonRatingDetails() { concertBinding.concertButtonRatingdetails.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(mainActivity, "view rating deets", Toast.LENGTH_SHORT).show(); concertBinding.concertExpandableLayout.toggle(); } }); } private void setupButtonArtist() { concertBinding.concertImageviewArtist.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mainActivity.switchFragment(mainActivity.getSolopageFragment(concert.getArtist()),true); } }); } private void setupButtonVenue() { concertBinding.concertImageviewVenue.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mainActivity.switchFragment(mainActivity.getSolopageFragment(concert.getVenue()),true); } }); } private void setupButtonBack() { concertBinding.concertButtonBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mainActivity.onBackPressed(); } }); } private void setupRecyclerviewPhotos() { concertBinding.concertRecycleviewConcerts.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL,false)); ConcertPhotosAdapter adapter = new ConcertPhotosAdapter(getContext(),concert.getPhotos()); concertBinding.concertRecycleviewConcerts.setAdapter(adapter); } private void setupLinearLayoutReviews() { ReviewAdapter reviewAdapter = new ReviewAdapter(getContext(),concert); concertBinding.concertRecycleViewReviews.setLayoutManager(new LinearLayoutManager(getContext())); concertBinding.concertRecycleViewReviews.setAdapter(reviewAdapter); } //getters and setters public void setConcert(Concert concert) { this.concert = concert; } }
4,570
0.698249
0.696718
125
35.551998
31.163429
144
false
false
0
0
0
0
0
0
0.552
false
false
5
293c2b61622a0543fa4659c845be142be47e4689
3,453,153,724,061
dcf27d31c21db9d1b26d525afed5c03f1c5d5c29
/science-innovate-admin/src/main/java/com/soldier/modules/business/entity/ProjectFinishEntity.java
eb8423a81fb46c21364d9f7e7c12d91743e71e2f
[ "Apache-2.0" ]
permissive
soldiergit/science-innovate
https://github.com/soldiergit/science-innovate
760d8c460214aac49e9f5c8c4d9c2780cab418d9
0e84d92f7597c7395d860ec7e5f5d02cc3c99c84
refs/heads/master
2023-01-19T12:52:15.831000
2020-12-01T09:50:46
2020-12-01T09:50:46
317,160,726
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.soldier.modules.business.entity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.util.Date; import java.util.List; import lombok.Data; /** * 项目结题表 * @author soldier * @email 583403411@qq.com * @date 2020-08-17 21:02:53 */ @Data @TableName("tb_project_finish") public class ProjectFinishEntity implements Serializable { private static final long serialVersionUID = 1L; /** * */ @TableId private Long pfId; /** * 立项项目id */ private Long pcId; @TableField(exist=false) private ProjectCreateEntity projectCreateEntity; /** * 结题教师id */ private Long teaId; @TableField(exist=false) private TeacherInfoEntity teacherInfoEntity; /** * 结题时间 */ private Date finishTime; /** * 备注 */ private String remarks; /** * 创建时间 */ private Date createTime; /** * 修改时间 */ private Date updateTime; /** * 项目结题人用户id */ @TableField(exist=false) private Long userId; /** * 附件信息 */ @TableField(exist=false) private List<SysAttachEntity> sysAttachEntityList; }
UTF-8
Java
1,254
java
ProjectFinishEntity.java
Java
[ { "context": "ist;\n\nimport lombok.Data;\n\n/**\n * 项目结题表\n * @author soldier\n * @email 583403411@qq.com\n * @date 2020-08-17 21", "end": 336, "score": 0.9995554685592651, "start": 329, "tag": "USERNAME", "value": "soldier" }, { "context": ".Data;\n\n/**\n * 项目结题表\n * @author soldier\n * @email 583403411@qq.com\n * @date 2020-08-17 21:02:53\n */\n@Data\n@TableName", "end": 363, "score": 0.9929425716400146, "start": 347, "tag": "EMAIL", "value": "583403411@qq.com" } ]
null
[]
package com.soldier.modules.business.entity; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.util.Date; import java.util.List; import lombok.Data; /** * 项目结题表 * @author soldier * @email <EMAIL> * @date 2020-08-17 21:02:53 */ @Data @TableName("tb_project_finish") public class ProjectFinishEntity implements Serializable { private static final long serialVersionUID = 1L; /** * */ @TableId private Long pfId; /** * 立项项目id */ private Long pcId; @TableField(exist=false) private ProjectCreateEntity projectCreateEntity; /** * 结题教师id */ private Long teaId; @TableField(exist=false) private TeacherInfoEntity teacherInfoEntity; /** * 结题时间 */ private Date finishTime; /** * 备注 */ private String remarks; /** * 创建时间 */ private Date createTime; /** * 修改时间 */ private Date updateTime; /** * 项目结题人用户id */ @TableField(exist=false) private Long userId; /** * 附件信息 */ @TableField(exist=false) private List<SysAttachEntity> sysAttachEntityList; }
1,245
0.706282
0.685908
76
14.5
16.059511
58
false
false
0
0
0
0
0
0
0.842105
false
false
5
4af2167fdfa0c710c34efd697eecd24ffdc65ac5
94,489,285,417
fddcd2ceab893b3b9383059f748029d701b585d2
/specification/src/main/java/com/gds/zan/spec/UserByNameLike.java
445fecbdc2217498f5f89c4c3718db02709ce4cf
[]
no_license
a514760469/design-pattern
https://github.com/a514760469/design-pattern
8a6c4a475e1b4d167b9c03f3b034302734bf0333
1060c44adbf3127bcb36bb0316b53d552c658afe
refs/heads/master
2022-12-06T02:12:29.624000
2020-05-08T09:33:48
2020-05-08T09:33:48
234,487,244
1
0
null
false
2022-11-24T09:37:52
2020-01-17T06:39:03
2020-05-08T09:34:11
2022-11-24T09:37:49
212
1
0
3
Java
false
false
package com.gds.zan.spec; import com.gds.zan.User; /** * @author zhanglifeng * @since 2020-03-30 11:00 */ public class UserByNameLike extends BaseUserSpecification { private final static String LIKE_FLAG = "%"; private String likeName; public UserByNameLike(String likeName) { this.likeName = likeName; } @Override public boolean isSatisfiedBy(User user) { String name = user.getName(); String str = likeName.replaceAll(LIKE_FLAG, ""); // A% if (likeName.endsWith(LIKE_FLAG) && !likeName.startsWith(LIKE_FLAG)) { return name.startsWith(str); } else if (!likeName.endsWith(LIKE_FLAG) && likeName.startsWith(LIKE_FLAG)) { // %A return name.endsWith(str); } else { // %A% return name.contains(str); } } }
UTF-8
Java
843
java
UserByNameLike.java
Java
[ { "context": "an.spec;\n\nimport com.gds.zan.User;\n\n/**\n * @author zhanglifeng\n * @since 2020-03-30 11:00\n */\npublic class UserB", "end": 79, "score": 0.9611555933952332, "start": 68, "tag": "USERNAME", "value": "zhanglifeng" } ]
null
[]
package com.gds.zan.spec; import com.gds.zan.User; /** * @author zhanglifeng * @since 2020-03-30 11:00 */ public class UserByNameLike extends BaseUserSpecification { private final static String LIKE_FLAG = "%"; private String likeName; public UserByNameLike(String likeName) { this.likeName = likeName; } @Override public boolean isSatisfiedBy(User user) { String name = user.getName(); String str = likeName.replaceAll(LIKE_FLAG, ""); // A% if (likeName.endsWith(LIKE_FLAG) && !likeName.startsWith(LIKE_FLAG)) { return name.startsWith(str); } else if (!likeName.endsWith(LIKE_FLAG) && likeName.startsWith(LIKE_FLAG)) { // %A return name.endsWith(str); } else { // %A% return name.contains(str); } } }
843
0.606168
0.591934
32
25.34375
23.803373
92
false
false
0
0
0
0
0
0
0.34375
false
false
5
b3448f104a5f37f815365f67ca196e2702f3b59a
1,425,929,151,747
2bf610723718baba06838e968bef877bd04e5c59
/src/com/htp/service/BookServiceException.java
19c3019efa87cd7b0d8d0a78c1a1daab21118279
[]
no_license
annakhmialnitskaya/TestDataBaseTask
https://github.com/annakhmialnitskaya/TestDataBaseTask
4c7d60093ede7fabb2c21527a547b4628fe0891f
4090f91169fa521580afe574f3f4ba631c05d80b
refs/heads/master
2021-01-19T17:18:25.955000
2017-02-19T08:15:46
2017-02-19T08:15:46
82,444,653
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.htp.service; public class BookServiceException extends Exception { private static final long serialVersionUID = -4316600533978222571L; public BookServiceException(String message, Throwable cause) { super(message, cause); } }
UTF-8
Java
246
java
BookServiceException.java
Java
[]
null
[]
package com.htp.service; public class BookServiceException extends Exception { private static final long serialVersionUID = -4316600533978222571L; public BookServiceException(String message, Throwable cause) { super(message, cause); } }
246
0.792683
0.715447
11
21.363636
26.178661
68
false
false
0
0
0
0
0
0
0.909091
false
false
5
2fdf7d7de9cb53ef9a2793367f2ddbc67bac6696
2,697,239,505,795
26c424c6e3843ebcd75fced7ead5c1a0ffd04d31
/app/src/main/java/com/researchut/lockscreen/locksreen_research/TouchEventRecorder.java
134a24aee7e441cc36f3d415b059304b28541de1
[]
no_license
asadsm/lockscreen
https://github.com/asadsm/lockscreen
dc4c7b46119f21941d37018f1cddaa42b37ad379
d897307699af42a3342fcee28b9c30018d2dc289
refs/heads/master
2018-03-30T05:14:48.871000
2017-05-05T05:42:00
2017-05-05T05:42:00
87,861,473
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.researchut.lockscreen.locksreen_research; import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; /** * Created by Asad on 4/27/2017. */ public class TouchEventRecorder extends View { public TouchEventRecorder(Context context, AttributeSet attrs) { super(context, attrs); } @Override public boolean onTouchEvent(MotionEvent event) { return super.onTouchEvent(event); } }
UTF-8
Java
495
java
TouchEventRecorder.java
Java
[ { "context": "vent;\nimport android.view.View;\n\n/**\n * Created by Asad on 4/27/2017.\n */\n\npublic class TouchEventRecorde", "end": 203, "score": 0.9984161853790283, "start": 199, "tag": "NAME", "value": "Asad" } ]
null
[]
package com.researchut.lockscreen.locksreen_research; import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; /** * Created by Asad on 4/27/2017. */ public class TouchEventRecorder extends View { public TouchEventRecorder(Context context, AttributeSet attrs) { super(context, attrs); } @Override public boolean onTouchEvent(MotionEvent event) { return super.onTouchEvent(event); } }
495
0.733333
0.719192
22
21.5
20.917044
68
false
false
0
0
0
0
0
0
0.409091
false
false
5
0e58780dae8d21322f705238d9c19d3cb6aaca43
18,957,985,677,289
3cc334d9993794043428591d9f9723829f433165
/src/Logic/geography/MapUtil.java
9e178c1b0999eccfa2e71665c12e61d2101d125f
[]
no_license
jweisburd351/Test1.7
https://github.com/jweisburd351/Test1.7
ce16de0fd61f5ab6b3fd939894ca1528f3b824fe
17fb8c34b1af47955aec0563165d7044567774bf
refs/heads/master
2021-01-10T09:35:33.166000
2015-11-18T20:41:19
2015-11-18T20:41:19
46,446,150
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Logic.geography; import common.EnumRegion; /** * Contains static utility methods associated with maps, regions, etc... involved with gameplay */ public class MapUtil implements MapConstants { /** * Converts a string ID representation of a US region (defined in MapConstants) to it's EnumRegion equivilent * @param id String ID representation of the region * @return the EnumRegion representation of the region */ public static EnumRegion regionIdToEnumRegion(String id) { if (id.equals(CALIFORNIA)) return EnumRegion.CALIFORNIA; else if (id.equals(SOUTHEAST)) return EnumRegion.SOUTHEAST; else if (id.equals(SOUTHERN_PLAINS)) return EnumRegion.SOUTHERN_PLAINS; else if (id.equals(NORTHERN_PLAINS)) return EnumRegion.NORTHERN_PLAINS; else if (id.equals(NORTHERN_CRESCENT)) return EnumRegion.NORTHERN_CRESCENT; else if (id.equals(MOUNTAIN)) return EnumRegion.MOUNTAIN; else if (id.equals(HEARTLAND)) return EnumRegion.HEARTLAND; else return null; } }
UTF-8
Java
1,014
java
MapUtil.java
Java
[]
null
[]
package Logic.geography; import common.EnumRegion; /** * Contains static utility methods associated with maps, regions, etc... involved with gameplay */ public class MapUtil implements MapConstants { /** * Converts a string ID representation of a US region (defined in MapConstants) to it's EnumRegion equivilent * @param id String ID representation of the region * @return the EnumRegion representation of the region */ public static EnumRegion regionIdToEnumRegion(String id) { if (id.equals(CALIFORNIA)) return EnumRegion.CALIFORNIA; else if (id.equals(SOUTHEAST)) return EnumRegion.SOUTHEAST; else if (id.equals(SOUTHERN_PLAINS)) return EnumRegion.SOUTHERN_PLAINS; else if (id.equals(NORTHERN_PLAINS)) return EnumRegion.NORTHERN_PLAINS; else if (id.equals(NORTHERN_CRESCENT)) return EnumRegion.NORTHERN_CRESCENT; else if (id.equals(MOUNTAIN)) return EnumRegion.MOUNTAIN; else if (id.equals(HEARTLAND)) return EnumRegion.HEARTLAND; else return null; } }
1,014
0.750493
0.750493
27
36.555557
33.879234
111
false
false
0
0
0
0
0
0
0.444444
false
false
5
84ae3c02b198e74d685c00061e2c4664cca2804c
11,184,094,853,093
245207d073152660ed32bd43087547634a015901
/src/com/example/matrrixnxn/MatrizNxN.java
4ab6ba5710f8f82122dd0882c56e711982732452
[]
no_license
CesarAdan1/Java-Exercises
https://github.com/CesarAdan1/Java-Exercises
940946eee9d59344b844b75848fff35f6de066b1
ab5fc01e88160267005fa4fb86b307485971d579
refs/heads/master
2023-02-18T01:47:41.986000
2021-01-09T05:34:53
2021-01-09T05:34:53
327,044,662
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.matrrixnxn; import java.lang.reflect.Array; import java.util.Scanner; public class MatrizNxN { int z; static void matrixOrder(int n, int numberOfTimes){ //int in = int z; //int[] appear = new int[]; int val = 0; for (int x = 0; x < n; x++){ for (int y = 0; y < n; y ++){ z = Math.min(Math.min(x, y), Math.min(n - 1 - x, n-1 - y)); if(x < y) System.out.println((n-2 * z)*(n-2*z) - (x-z) - (y-z) + "\t"); else System.out.println((n - 2 * z - 2) * (n - 2 * z - 2) + (x-z) + (y-z) + "\t"); } } if(n == numberOfTimes){ System.out.println("El numero " + numberOfTimes + " aparece " + n); } else{ System.out.println("El número introducido no aparece en la matriz"); } } public static void main(String[] args){ MatrizNxN matrix = new MatrizNxN(); Scanner numInput = new Scanner(System.in); int n; int numberOfTimes; int timesIsShown = 0; System.out.println("Introduce la dimesion de la matriz, tendra lo mismo de columnas y filas"); n = numInput.nextInt(); System.out.println("Ingresa un número"); numberOfTimes = numInput.nextInt(); matrixOrder(n, numberOfTimes); } }
UTF-8
Java
1,362
java
MatrizNxN.java
Java
[]
null
[]
package com.example.matrrixnxn; import java.lang.reflect.Array; import java.util.Scanner; public class MatrizNxN { int z; static void matrixOrder(int n, int numberOfTimes){ //int in = int z; //int[] appear = new int[]; int val = 0; for (int x = 0; x < n; x++){ for (int y = 0; y < n; y ++){ z = Math.min(Math.min(x, y), Math.min(n - 1 - x, n-1 - y)); if(x < y) System.out.println((n-2 * z)*(n-2*z) - (x-z) - (y-z) + "\t"); else System.out.println((n - 2 * z - 2) * (n - 2 * z - 2) + (x-z) + (y-z) + "\t"); } } if(n == numberOfTimes){ System.out.println("El numero " + numberOfTimes + " aparece " + n); } else{ System.out.println("El número introducido no aparece en la matriz"); } } public static void main(String[] args){ MatrizNxN matrix = new MatrizNxN(); Scanner numInput = new Scanner(System.in); int n; int numberOfTimes; int timesIsShown = 0; System.out.println("Introduce la dimesion de la matriz, tendra lo mismo de columnas y filas"); n = numInput.nextInt(); System.out.println("Ingresa un número"); numberOfTimes = numInput.nextInt(); matrixOrder(n, numberOfTimes); } }
1,362
0.518382
0.509559
43
30.627907
27.666639
102
false
false
0
0
0
0
0
0
0.744186
false
false
5
889ede2fbc78854802c388f16e6d1f7a0455b023
19,705,310,002,510
e80eb8959f087f8088532238ef746b375d0fbba3
/src/cn/edu/stu/user/service/UserServiceImpl.java
6eff66e23ca265376913e4f8cd3d9e63679b9b75
[]
no_license
Ezio-ou/STUShopping
https://github.com/Ezio-ou/STUShopping
305974ee798e158a5f63356108eaa20877834b49
2ccbb6f4af39c572fc3eb373b4133531068b7806
refs/heads/master
2021-06-28T09:34:49.723000
2017-09-13T10:12:11
2017-09-13T10:12:11
103,206,722
0
0
null
true
2017-09-12T03:55:28
2017-09-12T01:30:22
2017-09-12T01:30:25
2017-09-11T14:54:27
25,924
0
0
1
Java
null
null
package cn.edu.stu.user.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import cn.edu.stu.user.dao.UserDAO; import cn.edu.stu.user.domain.User; @Service public class UserServiceImpl implements UserService{ @Autowired private UserDAO userDAO; @Override public User login(String loginName, String password) { // TODO Auto-generated method stub return userDAO.selectByLoginNameAndPassword(loginName, password); } @Override public void removeUserById(Integer id) { // TODO Auto-generated method stub userDAO.deleteById(id); } @Override public void modifyUser(User user) { // TODO Auto-generated method stub userDAO.update(user); } @Override public void addUser(User user) { // TODO Auto-generated method stub userDAO.save(user); } @Override public User findUserById(Integer id) { // TODO Auto-generated method stub return userDAO.selectById(id); } }
UTF-8
Java
1,021
java
UserServiceImpl.java
Java
[]
null
[]
package cn.edu.stu.user.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import cn.edu.stu.user.dao.UserDAO; import cn.edu.stu.user.domain.User; @Service public class UserServiceImpl implements UserService{ @Autowired private UserDAO userDAO; @Override public User login(String loginName, String password) { // TODO Auto-generated method stub return userDAO.selectByLoginNameAndPassword(loginName, password); } @Override public void removeUserById(Integer id) { // TODO Auto-generated method stub userDAO.deleteById(id); } @Override public void modifyUser(User user) { // TODO Auto-generated method stub userDAO.update(user); } @Override public void addUser(User user) { // TODO Auto-generated method stub userDAO.save(user); } @Override public User findUserById(Integer id) { // TODO Auto-generated method stub return userDAO.selectById(id); } }
1,021
0.716944
0.716944
45
20.688889
19.240953
67
false
false
0
0
0
0
0
0
1.111111
false
false
5
999c29b3c5dc0da51f1a8460cab7580829fb14c4
19,825,569,050,740
410c3edff13b40190e3ef38aa60a42a4efc4ad67
/base/src/main/java/io/vproxy/vfd/posix/SocketAddressIPv6.java
e75c7dbb173a397efdbd36fa7012107af5d4af25
[ "MIT" ]
permissive
wkgcass/vproxy
https://github.com/wkgcass/vproxy
f3d783531688676932f60f3df57e89ddabf3f720
6c891d43d6b9f2d2980a7d4feee124b054fbfdb5
refs/heads/dev
2023-08-09T04:03:10.839000
2023-07-31T08:28:56
2023-08-04T12:04:11
166,255,932
129
53
MIT
false
2022-09-15T08:35:53
2019-01-17T16:14:58
2022-09-14T12:12:54
2022-09-06T16:00:35
7,421
113
34
4
Java
false
false
package io.vproxy.vfd.posix; import io.vproxy.base.util.Logger; import io.vproxy.vfd.IP; import io.vproxy.vfd.IPPort; public class SocketAddressIPv6 implements VSocketAddress { public final String ip; public final int port; public SocketAddressIPv6(String ip, int port) { this.ip = ip; this.port = port; } @Override public IPPort toIPPort() { byte[] ip = IP.parseIpString(this.ip); if (ip == null) { Logger.shouldNotHappen("parse ipv6 from bytes " + this.ip + " failed"); throw new RuntimeException("parse ip " + this.ip + " failed"); } return new IPPort(IP.from(ip), port); } @Override public String toString() { return "SocketAddressIPv6{" + "ip=" + ip + ", port=" + port + '}'; } }
UTF-8
Java
846
java
SocketAddressIPv6.java
Java
[]
null
[]
package io.vproxy.vfd.posix; import io.vproxy.base.util.Logger; import io.vproxy.vfd.IP; import io.vproxy.vfd.IPPort; public class SocketAddressIPv6 implements VSocketAddress { public final String ip; public final int port; public SocketAddressIPv6(String ip, int port) { this.ip = ip; this.port = port; } @Override public IPPort toIPPort() { byte[] ip = IP.parseIpString(this.ip); if (ip == null) { Logger.shouldNotHappen("parse ipv6 from bytes " + this.ip + " failed"); throw new RuntimeException("parse ip " + this.ip + " failed"); } return new IPPort(IP.from(ip), port); } @Override public String toString() { return "SocketAddressIPv6{" + "ip=" + ip + ", port=" + port + '}'; } }
846
0.57565
0.570922
33
24.636364
20.768301
83
false
false
0
0
0
0
0
0
0.484848
false
false
5
da619e544dbcc557f96b15e32c48fc740a0c997c
8,693,013,863,446
e3d8780aea483b58838228c2c21f7cde13b268cb
/Java/Android_templates/CallBack_Retrofit/app/src/main/java/com/ekc/c4q/callbackretrofit/ProfileActivity.java
9255aad723706bd38a3f93019eecf5e1809d30c7
[]
no_license
RafatKhandaker/Software-Engineering-EagleEye
https://github.com/RafatKhandaker/Software-Engineering-EagleEye
967ea026909a7bb0274e51c952baf97ebf43c749
3368cbd07c462ed876544f04701b1d7586592d05
refs/heads/master
2022-06-21T23:49:45.976000
2022-06-17T13:19:06
2022-06-17T13:19:06
79,091,822
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ekc.c4q.callbackretrofit; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.NavUtils; import android.support.v4.widget.ContentLoadingProgressBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.MenuItem; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.ekc.c4q.callbackretrofit.model.Repository; import com.ekc.c4q.callbackretrofit.network.GitHubClient; import com.google.gson.Gson; import com.squareup.picasso.Picasso; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import static android.view.View.GONE; import static android.view.View.VISIBLE; public class ProfileActivity extends AppCompatActivity { public static final String EXTRA_USER_LOGIN = "LOGIN"; public static final String EXTRA_USER_AVATAR_URL = "AVATAR_URL"; private ImageView photoView; private TextView loginView; private RecyclerView recyclerView; private Gson gson; private GitHubClient gitHubClient; private RepositoryAdapter adapter; private ViewGroup emptyView; private ContentLoadingProgressBar progressView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile); getSupportActionBar().setDisplayHomeAsUpEnabled(true); gson = new Gson(); Intent intent = getIntent(); String login = intent.getStringExtra(EXTRA_USER_LOGIN); String avatarUrl = intent.getStringExtra(EXTRA_USER_AVATAR_URL); photoView = (ImageView) findViewById(R.id.photo); loginView = (TextView) findViewById(R.id.login); emptyView = (ViewGroup) findViewById(android.R.id.empty); recyclerView = (RecyclerView) findViewById(android.R.id.list); progressView = (ContentLoadingProgressBar) findViewById(R.id.progress_bar); Picasso.with(this) .load(avatarUrl) .placeholder(R.drawable.ic_action_github_logo) .resizeDimen(R.dimen.list_detail_image_size, R.dimen.list_detail_image_size) .centerInside() .into(photoView); loginView.setText(login); adapter = new RepositoryAdapter(); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(this)); gitHubClient = GitHubClient.getInstance(); Call<List<Repository>> call = gitHubClient.getRepositories(login); progressView.show(); call.enqueue(new Callback<List<Repository>>() { @Override public void onResponse(Call<List<Repository>> call, Response<List<Repository>> response) { List<Repository> repositories = response.body(); if (repositories == null || repositories.isEmpty()) { emptyView.setVisibility(VISIBLE); progressView.hide(); recyclerView.setVisibility(GONE); } else { emptyView.setVisibility(GONE); progressView.hide(); recyclerView.setVisibility(VISIBLE); adapter.setRepositories(repositories); } } @Override public void onFailure(Call<List<Repository>> call, Throwable t) { progressView.hide(); String errorMessage = ProfileActivity.this.getString(R.string.error_loading_repositories, t.getMessage()); Toast.makeText(ProfileActivity.this, errorMessage, Toast.LENGTH_SHORT).show(); } }); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // Respond to the action bar's Up/Home button case android.R.id.home: Intent upIntent = NavUtils.getParentActivityIntent(this); upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); NavUtils.navigateUpTo(this, upIntent); return true; } return super.onOptionsItemSelected(item); } }
UTF-8
Java
3,986
java
ProfileActivity.java
Java
[]
null
[]
package com.ekc.c4q.callbackretrofit; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.NavUtils; import android.support.v4.widget.ContentLoadingProgressBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.MenuItem; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.ekc.c4q.callbackretrofit.model.Repository; import com.ekc.c4q.callbackretrofit.network.GitHubClient; import com.google.gson.Gson; import com.squareup.picasso.Picasso; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; import static android.view.View.GONE; import static android.view.View.VISIBLE; public class ProfileActivity extends AppCompatActivity { public static final String EXTRA_USER_LOGIN = "LOGIN"; public static final String EXTRA_USER_AVATAR_URL = "AVATAR_URL"; private ImageView photoView; private TextView loginView; private RecyclerView recyclerView; private Gson gson; private GitHubClient gitHubClient; private RepositoryAdapter adapter; private ViewGroup emptyView; private ContentLoadingProgressBar progressView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile); getSupportActionBar().setDisplayHomeAsUpEnabled(true); gson = new Gson(); Intent intent = getIntent(); String login = intent.getStringExtra(EXTRA_USER_LOGIN); String avatarUrl = intent.getStringExtra(EXTRA_USER_AVATAR_URL); photoView = (ImageView) findViewById(R.id.photo); loginView = (TextView) findViewById(R.id.login); emptyView = (ViewGroup) findViewById(android.R.id.empty); recyclerView = (RecyclerView) findViewById(android.R.id.list); progressView = (ContentLoadingProgressBar) findViewById(R.id.progress_bar); Picasso.with(this) .load(avatarUrl) .placeholder(R.drawable.ic_action_github_logo) .resizeDimen(R.dimen.list_detail_image_size, R.dimen.list_detail_image_size) .centerInside() .into(photoView); loginView.setText(login); adapter = new RepositoryAdapter(); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(this)); gitHubClient = GitHubClient.getInstance(); Call<List<Repository>> call = gitHubClient.getRepositories(login); progressView.show(); call.enqueue(new Callback<List<Repository>>() { @Override public void onResponse(Call<List<Repository>> call, Response<List<Repository>> response) { List<Repository> repositories = response.body(); if (repositories == null || repositories.isEmpty()) { emptyView.setVisibility(VISIBLE); progressView.hide(); recyclerView.setVisibility(GONE); } else { emptyView.setVisibility(GONE); progressView.hide(); recyclerView.setVisibility(VISIBLE); adapter.setRepositories(repositories); } } @Override public void onFailure(Call<List<Repository>> call, Throwable t) { progressView.hide(); String errorMessage = ProfileActivity.this.getString(R.string.error_loading_repositories, t.getMessage()); Toast.makeText(ProfileActivity.this, errorMessage, Toast.LENGTH_SHORT).show(); } }); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // Respond to the action bar's Up/Home button case android.R.id.home: Intent upIntent = NavUtils.getParentActivityIntent(this); upIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); NavUtils.navigateUpTo(this, upIntent); return true; } return super.onOptionsItemSelected(item); } }
3,986
0.729303
0.726543
114
33.964912
23.465887
96
false
false
0
0
0
0
0
0
0.692982
false
false
5
626562008137f7ebd17438d4593acb47185d29fd
34,376,918,249,648
18dbb86ff9a139370c361169d94686b0ea65611a
/src/main/java/de/fu_berlin/inf/ag_se/browser/exception/ScriptExecutionException.java
73821309b4808df6416d6b3c64a708eaeb3e1cd0
[ "MIT" ]
permissive
ag-se/swt-browser-improved
https://github.com/ag-se/swt-browser-improved
f40fd8e35ddee2894b7fd729aa00555a0ce16972
4281bbb31a15c0194fde5b1e7fe7b0434b6ddf48
refs/heads/master
2020-12-24T17:35:28.564000
2020-08-31T10:37:54
2020-08-31T10:37:54
30,069,796
0
2
MIT
false
2020-01-09T23:49:21
2015-01-30T11:47:08
2020-01-09T17:23:05
2020-01-09T23:49:20
259,153
0
1
4
Java
false
false
package de.fu_berlin.inf.ag_se.browser.exception; import de.fu_berlin.inf.ag_se.browser.utils.StringUtils; /** * In contract to {@link JavaScriptException} this exception is used for * exception occurring while executing Javascript from Java. */ public class ScriptExecutionException extends RuntimeException { private static final long serialVersionUID = 1L; public ScriptExecutionException(String script, Throwable e) { super("Could not run script: " + StringUtils.shorten(script), e); } public ScriptExecutionException(String script, String message) { super("Could not run script: " + StringUtils.shorten(script) + " because " + message); } }
UTF-8
Java
676
java
ScriptExecutionException.java
Java
[]
null
[]
package de.fu_berlin.inf.ag_se.browser.exception; import de.fu_berlin.inf.ag_se.browser.utils.StringUtils; /** * In contract to {@link JavaScriptException} this exception is used for * exception occurring while executing Javascript from Java. */ public class ScriptExecutionException extends RuntimeException { private static final long serialVersionUID = 1L; public ScriptExecutionException(String script, Throwable e) { super("Could not run script: " + StringUtils.shorten(script), e); } public ScriptExecutionException(String script, String message) { super("Could not run script: " + StringUtils.shorten(script) + " because " + message); } }
676
0.747041
0.745562
21
31.190475
32.535137
94
false
false
0
0
0
0
0
0
0.619048
false
false
5
12753be3344a5d464ec343d4fab96fd1b8eb20be
24,627,342,499,365
522f7d7104a521c05d83f27466fc82abceed4dde
/workspace/spring-drools/src/test/com/cjhv/mvno/drools/test/PartnerRsvOatErpSendScheduleTest.java
9ea3a55807152c01051e0976de69dae28f65dd0e
[]
no_license
jhson175/javaTuturial
https://github.com/jhson175/javaTuturial
9861ba02fedd2ff7c1ab09b513f0607dd4eb2835
4020c6d08ac4adf4e46ad65864f6107257b6ce3e
refs/heads/master
2022-02-06T08:32:22.491000
2020-02-25T08:29:03
2020-02-25T08:29:03
241,542,682
1
0
null
false
2022-02-01T01:01:11
2020-02-19T05:42:44
2020-02-25T08:29:12
2022-02-01T01:01:09
2,810
0
0
11
Java
false
false
package com.cjhv.mvno.drools.test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.cjhv.mvno.drools.schedule.partner.PartnerRsvPayErpSendSchedule; public class PartnerRsvOatErpSendScheduleTest { public static void main( String[] args ) { ApplicationContext appContext = new ClassPathXmlApplicationContext("/job/partner/PartnerRsvPayErpSendSchedule-job.xml"); PartnerRsvPayErpSendSchedule cj = (PartnerRsvPayErpSendSchedule)appContext.getBean("PartnerRsvPayErpSendSchedule"); // AcctInquiryHanaSchedule cj = (AcctInquiryHanaSchedule)appContext.getBean("AcctInquiryHanaScheduleManual"); try{ cj.execute(null,null); }catch (Exception e) { e.printStackTrace(); } } }
UTF-8
Java
838
java
PartnerRsvOatErpSendScheduleTest.java
Java
[]
null
[]
package com.cjhv.mvno.drools.test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.cjhv.mvno.drools.schedule.partner.PartnerRsvPayErpSendSchedule; public class PartnerRsvOatErpSendScheduleTest { public static void main( String[] args ) { ApplicationContext appContext = new ClassPathXmlApplicationContext("/job/partner/PartnerRsvPayErpSendSchedule-job.xml"); PartnerRsvPayErpSendSchedule cj = (PartnerRsvPayErpSendSchedule)appContext.getBean("PartnerRsvPayErpSendSchedule"); // AcctInquiryHanaSchedule cj = (AcctInquiryHanaSchedule)appContext.getBean("AcctInquiryHanaScheduleManual"); try{ cj.execute(null,null); }catch (Exception e) { e.printStackTrace(); } } }
838
0.760143
0.760143
27
30.037037
38.526066
125
false
false
0
0
0
0
0
0
0.962963
false
false
5
d81dc86a99c6d2573f6dbd162ed9c84c2456897c
22,771,916,640,553
08f94f075a048e952416b50f02e63583b54e748e
/5 - Lec/EASIA/src/ge/cu/edu/Autoboxing/Demo1.java
b5c4d5a00e4ec15741da0027e6e41c652e1a2e49
[]
no_license
tgogebashvili/JavaSE
https://github.com/tgogebashvili/JavaSE
2c7f9ec001bf0cdc7d7f59b1f93f05d22880e475
00675ba705cbc2cff3282e9f6a77b252f1c402d6
refs/heads/master
2023-03-17T14:43:40.988000
2018-07-25T08:39:22
2018-07-25T08:39:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ge.cu.edu.Autoboxing; public class Demo1 { public static void main(String[] args) { // intValue() Double d = 51.99; int i = d.intValue(); System.out.println(i); Integer integer = new Integer(12); Double aDouble = new Double("25.4"); printNumber(integer); System.out.println(aDouble + 5); } public static void printNumber(int a) { System.out.println(a); } }
UTF-8
Java
462
java
Demo1.java
Java
[]
null
[]
package ge.cu.edu.Autoboxing; public class Demo1 { public static void main(String[] args) { // intValue() Double d = 51.99; int i = d.intValue(); System.out.println(i); Integer integer = new Integer(12); Double aDouble = new Double("25.4"); printNumber(integer); System.out.println(aDouble + 5); } public static void printNumber(int a) { System.out.println(a); } }
462
0.562771
0.538961
25
17.48
17.071896
44
false
false
0
0
0
0
0
0
0.36
false
false
5
32628300f4d4bbebd78db03f0168b36dab040261
7,945,689,522,103
a8bae9ccd25c4b6506340477a2c178ea46b16627
/Dagger2ForAndroid/QuoteApp/app/src/main/java/com/stcodesapp/quotes_einstein/ui/dialog/DialogManager.java
aaf3b44b3dcbea3aada9271d2667bb9636f12bd9
[]
no_license
Shadat-tonmoy/AndroidLearningProject
https://github.com/Shadat-tonmoy/AndroidLearningProject
5fa9aedd5d1bf945c433af070d029d2f9bc9d6d5
e18d4617518cf70158fed08eb355641dc848a4be
refs/heads/master
2021-07-14T11:49:58.234000
2020-05-27T05:36:43
2020-05-27T05:36:43
150,237,218
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.stcodesapp.quotes_einstein.ui.dialog; import android.app.Activity; import android.support.v4.app.FragmentManager; public class DialogManager { private FragmentManager fragmentManager; private Activity activity; public DialogManager(FragmentManager fragmentManager, Activity activity) { this.fragmentManager = fragmentManager; this.activity = activity; } }
UTF-8
Java
404
java
DialogManager.java
Java
[]
null
[]
package com.stcodesapp.quotes_einstein.ui.dialog; import android.app.Activity; import android.support.v4.app.FragmentManager; public class DialogManager { private FragmentManager fragmentManager; private Activity activity; public DialogManager(FragmentManager fragmentManager, Activity activity) { this.fragmentManager = fragmentManager; this.activity = activity; } }
404
0.764852
0.762376
16
24.25
23.469395
78
false
false
0
0
0
0
0
0
0.5
false
false
5
54345623ab0592420bc6746b62c0673e3d6351ae
30,064,771,101,965
6fa5a388dd3d772ee36c9df0489f51fb4aa4699a
/src/com/project/mess2/DbConector.java
3e04fe706f747a225d21863e8147953379190b7c
[]
no_license
Rabbi50/Mess-Management
https://github.com/Rabbi50/Mess-Management
4d1a331af09671b23418f81d90845a981ceb3c4f
ab191d1b15a23a83c19d2beefa5da49ae8baf420
refs/heads/master
2021-01-23T03:04:28.176000
2018-12-19T15:19:06
2018-12-19T15:19:06
86,044,612
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.project.mess2; import java.sql.*; import javax.swing.*; public class DbConector { static Connection conn=null; public static Connection dbConector(){ try{ Class.forName("org.sqlite.JDBC"); conn=DriverManager.getConnection("jdbc:sqlite:F:\\mess_management\\mess_management.sqlite"); JOptionPane.showMessageDialog(null,"Connection is succsesfull"); return conn; } catch(Exception e){ JOptionPane.showMessageDialog(null,e); return null; } } public void addMemberInformation(String name , String email , String address, String phone , String occuption , String sex) throws SQLException{ try{ String query = "Insert into member(member_name,member_email,member_address,member_phone,member_occuption,sex) values(?,?,?,?,?,?) "; PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1, name); psmt.setString(2,email); psmt.setString(3,address); psmt.setString(4,phone); psmt.setString(5,occuption); psmt.setString(6,sex); int value = psmt.executeUpdate(); if(value==1){ JOptionPane.showMessageDialog(null,"Data Inserted"); } } catch(Exception e){ JOptionPane.showMessageDialog(null,"Please Give Data.Data Not Insert"); } } public void deleteMember(String ID ){ String query = "delete from member where ID= ? "; try { PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1, ID); //psmt.setString(1, ID); int value = psmt.executeUpdate(); if(value==1){ JOptionPane.showMessageDialog(null, "Data Delete"); } else{ JOptionPane.showMessageDialog(null,"Name Not Match.Try Again"); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void deleteMemberFromPayment(String id ){ String query = "delete from payment where member_id= ? "; try { PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1, id); int value = psmt.executeUpdate(); if(value==1){ JOptionPane.showMessageDialog(null, "Data Delete"); } /*else{ JOptionPane.showMessageDialog(null," Not Match.Try Again"); }*/ } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void deleteBazar(String ID ){ String query = "delete from bazar where member_id= ? "; try { PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1, ID); //psmt.setString(1, ID); int value = psmt.executeUpdate(); if(value==1){ JOptionPane.showMessageDialog(null, "Data Delete"); } else{ JOptionPane.showMessageDialog(null,"Name Not Match.Try Again"); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void deleteMeal(String ID ){ String query = "delete from meal where member_id= ? "; try { PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1, ID); //psmt.setString(1, ID); int value = psmt.executeUpdate(); if(value==1){ JOptionPane.showMessageDialog(null, "Data Delete"); } else{ JOptionPane.showMessageDialog(null,"Name Not Match.Try Again"); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void addMemberInformationPayment(String ID,String date,String paid,String budget) throws SQLException{ //String ID = null; try{ /*String query1="select ID from member where member_name=?"; PreparedStatement pst=conn.prepareStatement(query1); pst.setString(1,name); ResultSet rs=pst.executeQuery(); if(rs.next()){ ID=rs.getString("ID"); //id=Integer.parseInt(ID); }*/ String query = "Insert into payment(member_id,payment_month,paid,budget) values(?,?,?,?) "; PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1, ID); psmt.setString(2,date); psmt.setString(3,paid); psmt.setString(4,budget); int value = psmt.executeUpdate(); if(value==1){ JOptionPane.showMessageDialog(null,"Data Inserted"); } } catch(Exception e){ JOptionPane.showMessageDialog(null,"Please Give Value.Data Not Insert"); } } public void addMemberInformationBazar(String ID,String month,String bazarCost,String date) throws SQLException{ //String ID = null; try{ /*String query1="select ID from member where member_name=?"; PreparedStatement pst=conn.prepareStatement(query1); pst.setString(1,name); ResultSet rs=pst.executeQuery(); if(rs.next()){ ID=rs.getString("ID"); //id=Integer.parseInt(ID); }*/ String query = "Insert into bazar(month,member_id,bazar,date) values(?,?,?,?) "; PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1,month); psmt.setString(2,ID); psmt.setString(3,bazarCost); psmt.setString(4,date); int value = psmt.executeUpdate(); if(value==1){ JOptionPane.showMessageDialog(null,"Data Inserted"); } } catch(Exception e){ JOptionPane.showMessageDialog(null,"Please Give Data.Data Not Inserted"); } } public void addMemberInformationMill(String ID,String month,String meal,String date) throws SQLException{ //String ID=null; try{ /*String query1="select ID from member where member_name=?"; PreparedStatement pst=conn.prepareStatement(query1); pst.setString(1,name); ResultSet rs=pst.executeQuery(); if(rs.next()){ ID=rs.getString("ID"); //id=Integer.parseInt(ID); }*/ String query = "Insert into meal(meal_month,member_id,meal,date) values(?,?,?,?) "; PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1,month); psmt.setString(2,ID); psmt.setString(3,meal); psmt.setString(4,date); int value = psmt.executeUpdate(); if(value==1){ JOptionPane.showMessageDialog(null,"Data Inserted"); } } catch(Exception e){ JOptionPane.showMessageDialog(null,"Please Give Data.Data Not Inserted"); } } }
UTF-8
Java
6,306
java
DbConector.java
Java
[]
null
[]
package com.project.mess2; import java.sql.*; import javax.swing.*; public class DbConector { static Connection conn=null; public static Connection dbConector(){ try{ Class.forName("org.sqlite.JDBC"); conn=DriverManager.getConnection("jdbc:sqlite:F:\\mess_management\\mess_management.sqlite"); JOptionPane.showMessageDialog(null,"Connection is succsesfull"); return conn; } catch(Exception e){ JOptionPane.showMessageDialog(null,e); return null; } } public void addMemberInformation(String name , String email , String address, String phone , String occuption , String sex) throws SQLException{ try{ String query = "Insert into member(member_name,member_email,member_address,member_phone,member_occuption,sex) values(?,?,?,?,?,?) "; PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1, name); psmt.setString(2,email); psmt.setString(3,address); psmt.setString(4,phone); psmt.setString(5,occuption); psmt.setString(6,sex); int value = psmt.executeUpdate(); if(value==1){ JOptionPane.showMessageDialog(null,"Data Inserted"); } } catch(Exception e){ JOptionPane.showMessageDialog(null,"Please Give Data.Data Not Insert"); } } public void deleteMember(String ID ){ String query = "delete from member where ID= ? "; try { PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1, ID); //psmt.setString(1, ID); int value = psmt.executeUpdate(); if(value==1){ JOptionPane.showMessageDialog(null, "Data Delete"); } else{ JOptionPane.showMessageDialog(null,"Name Not Match.Try Again"); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void deleteMemberFromPayment(String id ){ String query = "delete from payment where member_id= ? "; try { PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1, id); int value = psmt.executeUpdate(); if(value==1){ JOptionPane.showMessageDialog(null, "Data Delete"); } /*else{ JOptionPane.showMessageDialog(null," Not Match.Try Again"); }*/ } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void deleteBazar(String ID ){ String query = "delete from bazar where member_id= ? "; try { PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1, ID); //psmt.setString(1, ID); int value = psmt.executeUpdate(); if(value==1){ JOptionPane.showMessageDialog(null, "Data Delete"); } else{ JOptionPane.showMessageDialog(null,"Name Not Match.Try Again"); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void deleteMeal(String ID ){ String query = "delete from meal where member_id= ? "; try { PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1, ID); //psmt.setString(1, ID); int value = psmt.executeUpdate(); if(value==1){ JOptionPane.showMessageDialog(null, "Data Delete"); } else{ JOptionPane.showMessageDialog(null,"Name Not Match.Try Again"); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void addMemberInformationPayment(String ID,String date,String paid,String budget) throws SQLException{ //String ID = null; try{ /*String query1="select ID from member where member_name=?"; PreparedStatement pst=conn.prepareStatement(query1); pst.setString(1,name); ResultSet rs=pst.executeQuery(); if(rs.next()){ ID=rs.getString("ID"); //id=Integer.parseInt(ID); }*/ String query = "Insert into payment(member_id,payment_month,paid,budget) values(?,?,?,?) "; PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1, ID); psmt.setString(2,date); psmt.setString(3,paid); psmt.setString(4,budget); int value = psmt.executeUpdate(); if(value==1){ JOptionPane.showMessageDialog(null,"Data Inserted"); } } catch(Exception e){ JOptionPane.showMessageDialog(null,"Please Give Value.Data Not Insert"); } } public void addMemberInformationBazar(String ID,String month,String bazarCost,String date) throws SQLException{ //String ID = null; try{ /*String query1="select ID from member where member_name=?"; PreparedStatement pst=conn.prepareStatement(query1); pst.setString(1,name); ResultSet rs=pst.executeQuery(); if(rs.next()){ ID=rs.getString("ID"); //id=Integer.parseInt(ID); }*/ String query = "Insert into bazar(month,member_id,bazar,date) values(?,?,?,?) "; PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1,month); psmt.setString(2,ID); psmt.setString(3,bazarCost); psmt.setString(4,date); int value = psmt.executeUpdate(); if(value==1){ JOptionPane.showMessageDialog(null,"Data Inserted"); } } catch(Exception e){ JOptionPane.showMessageDialog(null,"Please Give Data.Data Not Inserted"); } } public void addMemberInformationMill(String ID,String month,String meal,String date) throws SQLException{ //String ID=null; try{ /*String query1="select ID from member where member_name=?"; PreparedStatement pst=conn.prepareStatement(query1); pst.setString(1,name); ResultSet rs=pst.executeQuery(); if(rs.next()){ ID=rs.getString("ID"); //id=Integer.parseInt(ID); }*/ String query = "Insert into meal(meal_month,member_id,meal,date) values(?,?,?,?) "; PreparedStatement psmt = conn.prepareStatement(query); psmt.setString(1,month); psmt.setString(2,ID); psmt.setString(3,meal); psmt.setString(4,date); int value = psmt.executeUpdate(); if(value==1){ JOptionPane.showMessageDialog(null,"Data Inserted"); } } catch(Exception e){ JOptionPane.showMessageDialog(null,"Please Give Data.Data Not Inserted"); } } }
6,306
0.647161
0.640343
236
24.65678
26.314363
145
false
false
0
0
0
0
0
0
2.851695
false
false
5
ada4901d45ef5c7c2d94f8ea1867d4962ac4622f
20,624,432,995,910
4ac873867b1510e98430cdb9401cfcedb55f3dcb
/src/main/java/fr/ck/entite/Partenaire.java
2c3604a2d944fac8ba29c9293122ba2d341986bd
[]
no_license
EBuclon/ckillers
https://github.com/EBuclon/ckillers
dfb7e1ec037a6d296b397b5d93100d86d1023634
639ecd0233156e6590feb2cf6761d15768916ef1
refs/heads/master
2021-03-22T16:18:33.850000
2018-05-26T15:57:11
2018-05-26T15:57:11
122,083,063
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fr.ck.entite; /** * Class Partenaire */ public class Partenaire { private Integer idPartenaire; private String nom; private String description; private Inscrit inscrit; /** * Constructeur 1 * @param idPartenaire * @param nom * @param description * @param inscrit */ public Partenaire(Integer idPartenaire, String nom, String description, Inscrit inscrit) { this.idPartenaire = idPartenaire; this.nom = nom; this.description = description; this.inscrit = inscrit; } /** * Constructeur 2 * @param nom * @param description * @param inscrit */ public Partenaire(String nom, String description, Inscrit inscrit) { this.nom = nom; this.description = description; this.inscrit = inscrit; } /** * retourne l'id du partenaire * @return */ public Integer getIdPartenaire() { return idPartenaire; } /** * permet de modifier l'id du partenaire * @param idPartenaire */ public void setIdPartenaire(Integer idPartenaire) { this.idPartenaire = idPartenaire; } /** * permet d'obtenir le nom du partenaire * @return */ public String getNom() { return nom; } /** * permet de modifier le nom du partenaire * @param nom */ public void setNom(String nom) { this.nom = nom; } /** * rertourne la description du partenaire * @return */ public String getDescription() { return description; } /** * permet de modifier la description du partenaire * @param description */ public void setDescription(String description) { this.description = description; } /** * retourne le modérateur qui a ajouté le partenaire * @return */ public Inscrit getInscrit() { return inscrit; } /** * permet de modifier le modérateur qui a ajouté le partenaire * @param inscrit */ public void setInscrit(Inscrit inscrit) { this.inscrit = inscrit; } }
UTF-8
Java
2,258
java
Partenaire.java
Java
[]
null
[]
package fr.ck.entite; /** * Class Partenaire */ public class Partenaire { private Integer idPartenaire; private String nom; private String description; private Inscrit inscrit; /** * Constructeur 1 * @param idPartenaire * @param nom * @param description * @param inscrit */ public Partenaire(Integer idPartenaire, String nom, String description, Inscrit inscrit) { this.idPartenaire = idPartenaire; this.nom = nom; this.description = description; this.inscrit = inscrit; } /** * Constructeur 2 * @param nom * @param description * @param inscrit */ public Partenaire(String nom, String description, Inscrit inscrit) { this.nom = nom; this.description = description; this.inscrit = inscrit; } /** * retourne l'id du partenaire * @return */ public Integer getIdPartenaire() { return idPartenaire; } /** * permet de modifier l'id du partenaire * @param idPartenaire */ public void setIdPartenaire(Integer idPartenaire) { this.idPartenaire = idPartenaire; } /** * permet d'obtenir le nom du partenaire * @return */ public String getNom() { return nom; } /** * permet de modifier le nom du partenaire * @param nom */ public void setNom(String nom) { this.nom = nom; } /** * rertourne la description du partenaire * @return */ public String getDescription() { return description; } /** * permet de modifier la description du partenaire * @param description */ public void setDescription(String description) { this.description = description; } /** * retourne le modérateur qui a ajouté le partenaire * @return */ public Inscrit getInscrit() { return inscrit; } /** * permet de modifier le modérateur qui a ajouté le partenaire * @param inscrit */ public void setInscrit(Inscrit inscrit) { this.inscrit = inscrit; } }
2,258
0.559894
0.559006
101
20.316832
18.209415
94
false
false
0
0
0
0
0
0
0.247525
false
false
5
dca54e26e23a16c3e7dd3cb29fe95aafca834a97
33,165,737,492,420
6b1ea715cb10dee9561907e1408b8087b9662b72
/elasticsearch/src/main/java/com/example/elasticsearch/service/ArticleSearchRepository.java
5677cc8dbde9a88e3221f16676f3c317708b4295
[]
no_license
chen199209/spring-boot-elasticsearch
https://github.com/chen199209/spring-boot-elasticsearch
94c0f2b0581a5b2cc1832332f305d46213a48202
823b715df3c5a89e428c0c2d9bd39c6383a96b38
refs/heads/master
2020-03-26T08:20:55.521000
2018-08-14T09:25:10
2018-08-14T09:25:10
144,697,354
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.elasticsearch.service; import com.example.elasticsearch.entity.Article; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import java.util.List; public interface ArticleSearchRepository extends ElasticsearchRepository<Article, Long> { List<Article> findByTitle(String title); List<Article> findByTitleAndClickCount(String title, Long clickCount); List<Article> findByTitleOrClickCount(String title, Long clickCount); Page<Article> findByContent(String content, Pageable page); Page<Article> findByContentNot(String content, Pageable page); Page<Article> findByContentLike(String content, Pageable page); void deleteByClickCount(Long clickCount); void deleteByClickCountBetween(Long number1,Long number2); void deleteById(Long id); }
UTF-8
Java
927
java
ArticleSearchRepository.java
Java
[]
null
[]
package com.example.elasticsearch.service; import com.example.elasticsearch.entity.Article; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; import java.util.List; public interface ArticleSearchRepository extends ElasticsearchRepository<Article, Long> { List<Article> findByTitle(String title); List<Article> findByTitleAndClickCount(String title, Long clickCount); List<Article> findByTitleOrClickCount(String title, Long clickCount); Page<Article> findByContent(String content, Pageable page); Page<Article> findByContentNot(String content, Pageable page); Page<Article> findByContentLike(String content, Pageable page); void deleteByClickCount(Long clickCount); void deleteByClickCountBetween(Long number1,Long number2); void deleteById(Long id); }
927
0.80151
0.799353
29
30.965517
30.924248
89
false
false
0
0
0
0
0
0
0.758621
false
false
5
820aab316bf05fb5cc66b10a5ac1b153cf883d56
32,195,074,881,524
da5e2cb598b4a790014156e3c42fa523a799bf68
/paintmvc/src/paintmvc/mvc/controller/PaintController.java
1b1faf4c4e37a07d00068e92bab4601fefb59cbc
[]
no_license
nemanja1389/ris
https://github.com/nemanja1389/ris
9802889be67e5495f3129abb44cf3ba2616a2a33
91938fdb77d78fa27e5bbd28d9c5ed75aed5a04f
refs/heads/master
2021-01-04T02:41:40.404000
2016-12-10T14:08:02
2016-12-10T14:08:02
76,114,827
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package paintmvc.mvc.controller; import java.awt.Graphics; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Iterator; import javax.swing.JOptionPane; import javax.swing.JToggleButton; import paintmvc.geometry.Shape; import paintmvc.mvc.model.PaintModel; import paintmvc.mvc.view.PaintView; import paintmvc.mvc.view.PaintFrame; import paintmvc.mvc.view.TestDialog; public class PaintController { private PaintModel model = new PaintModel(); private PaintView view = new PaintView(model); private PaintFrame frame = new PaintFrame(view); public PaintView getView() { return view; } public void setView(PaintView view) { this.view = view; } public PaintModel getModel() { return model; } public void setModel(PaintModel model) { this.model = model; } public PaintController(PaintView view, PaintModel model, PaintFrame frame) { this.model = model; this.view = view; this.frame = frame; this.view.addMotionMouseListen(new MouseMotionAdapterPanelPaint(this.frame.getTextArea())); this.view.addMouseListen(new MouseAdapterPanelPaint(this.frame.getTextArea(), this.model, this.frame)); this.frame.addButtonClick(new ActionListenerClikcDelete(this.model)); } }
UTF-8
Java
1,314
java
PaintController.java
Java
[]
null
[]
package paintmvc.mvc.controller; import java.awt.Graphics; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; import java.util.Iterator; import javax.swing.JOptionPane; import javax.swing.JToggleButton; import paintmvc.geometry.Shape; import paintmvc.mvc.model.PaintModel; import paintmvc.mvc.view.PaintView; import paintmvc.mvc.view.PaintFrame; import paintmvc.mvc.view.TestDialog; public class PaintController { private PaintModel model = new PaintModel(); private PaintView view = new PaintView(model); private PaintFrame frame = new PaintFrame(view); public PaintView getView() { return view; } public void setView(PaintView view) { this.view = view; } public PaintModel getModel() { return model; } public void setModel(PaintModel model) { this.model = model; } public PaintController(PaintView view, PaintModel model, PaintFrame frame) { this.model = model; this.view = view; this.frame = frame; this.view.addMotionMouseListen(new MouseMotionAdapterPanelPaint(this.frame.getTextArea())); this.view.addMouseListen(new MouseAdapterPanelPaint(this.frame.getTextArea(), this.model, this.frame)); this.frame.addButtonClick(new ActionListenerClikcDelete(this.model)); } }
1,314
0.745814
0.745814
50
24.280001
24.364761
105
false
false
0
0
0
0
0
0
1.26
false
false
5
10cfc21246075de6bc0e7de7f8b8d063cbeef258
6,133,213,327,122
70889c7b2d45740d95fa1a814765f084bff53a8f
/src/main/java/com/devops42/progressfit/vista/resources/EjercicioResources.java
e1324e34db9ce95a05023c25fc859995af6c445e
[]
no_license
Leoneider/api-myprogres
https://github.com/Leoneider/api-myprogres
8d1c56749f066854b781c9e4675883a31f566443
bad2467704c4f0c3b812f0554af9b11c12d7f72a
refs/heads/master
2023-01-18T16:03:56.502000
2020-11-25T22:48:22
2020-11-25T22:48:22
316,020,268
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.devops42.progressfit.vista.resources; public class EjercicioResources { }
UTF-8
Java
88
java
EjercicioResources.java
Java
[]
null
[]
package com.devops42.progressfit.vista.resources; public class EjercicioResources { }
88
0.818182
0.795455
5
16.6
20.55821
49
false
false
0
0
0
0
0
0
0.2
false
false
5
dadb8bcace74dc281044e445beedd91b2f25ef9c
14,345,190,810,115
c346952ede321945cd47ebf4490c0b3c18b50852
/src/test/java/c222/easy/BalanceWordFastTest.java
aa9c010a84da9593849ed2d2a8f93af4fab577de
[]
no_license
AnObfuscator/RedditDailyProgrammer
https://github.com/AnObfuscator/RedditDailyProgrammer
561af69078221395b83b9e99a16f0b69fda8b626
99c9d7006286abdc626008eb0cd1a1e1bc23702a
refs/heads/master
2016-09-06T13:09:06.244000
2015-07-31T20:47:36
2015-07-31T20:47:36
40,024,185
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package c222.easy; import org.junit.Assert; import org.junit.Test; public class BalanceWordFastTest { @Test public void test_findBalance_Example1() { String word = "STEAD"; String expected = "S T EAD - 19"; BalanceWordFast balanceWordFast = new BalanceWordFast(word); String fastResult = balanceWordFast.findBalance(); Assert.assertEquals(expected, fastResult); } @Test public void test_findBalance_Example2() { String word = "CONSUBSTANTIATION"; String expected = "CONSUBST A NTIATION - 456"; BalanceWordFast balanceWordFast = new BalanceWordFast(word); String fastResult = balanceWordFast.findBalance(); Assert.assertEquals(expected, fastResult); } @Test public void test_findBalance_Example3() { String word = "WRONGHEADED"; String expected = "WRO N GHEADED - 120"; BalanceWordFast balanceWordFast = new BalanceWordFast(word); String fastResult = balanceWordFast.findBalance(); Assert.assertEquals(expected, fastResult); } @Test public void test_findBalance_Example4() { String word = "UNINTELLIGIBILITY"; String expected = "UNINTELL I GIBILITY - 521"; BalanceWordFast balanceWordFast = new BalanceWordFast(word); String fastResult = balanceWordFast.findBalance(); Assert.assertEquals(expected, fastResult); } @Test public void test_findBalance_Example5() { String word = "SUPERGLUE"; String expected = "SUPERGLUE DOES NOT BALANCE"; BalanceWordFast balanceWordFast = new BalanceWordFast(word); String fastResult = balanceWordFast.findBalance(); Assert.assertEquals(expected, fastResult); } }
UTF-8
Java
1,800
java
BalanceWordFastTest.java
Java
[]
null
[]
package c222.easy; import org.junit.Assert; import org.junit.Test; public class BalanceWordFastTest { @Test public void test_findBalance_Example1() { String word = "STEAD"; String expected = "S T EAD - 19"; BalanceWordFast balanceWordFast = new BalanceWordFast(word); String fastResult = balanceWordFast.findBalance(); Assert.assertEquals(expected, fastResult); } @Test public void test_findBalance_Example2() { String word = "CONSUBSTANTIATION"; String expected = "CONSUBST A NTIATION - 456"; BalanceWordFast balanceWordFast = new BalanceWordFast(word); String fastResult = balanceWordFast.findBalance(); Assert.assertEquals(expected, fastResult); } @Test public void test_findBalance_Example3() { String word = "WRONGHEADED"; String expected = "WRO N GHEADED - 120"; BalanceWordFast balanceWordFast = new BalanceWordFast(word); String fastResult = balanceWordFast.findBalance(); Assert.assertEquals(expected, fastResult); } @Test public void test_findBalance_Example4() { String word = "UNINTELLIGIBILITY"; String expected = "UNINTELL I GIBILITY - 521"; BalanceWordFast balanceWordFast = new BalanceWordFast(word); String fastResult = balanceWordFast.findBalance(); Assert.assertEquals(expected, fastResult); } @Test public void test_findBalance_Example5() { String word = "SUPERGLUE"; String expected = "SUPERGLUE DOES NOT BALANCE"; BalanceWordFast balanceWordFast = new BalanceWordFast(word); String fastResult = balanceWordFast.findBalance(); Assert.assertEquals(expected, fastResult); } }
1,800
0.656111
0.645556
76
22.68421
24.431543
68
false
false
0
0
0
0
0
0
0.434211
false
false
5
ff1894d1a34b159e0d65ddedffd28064610d8252
29,394,756,216,158
475a78f1ba1e79d598924849faab627bf0b4ca7c
/src/main/java/com/poc/Main.java
45bca1c47a46e470fcd68f1f4a361c961d8e0f9b
[]
no_license
expertneo/jacksonorderpoc
https://github.com/expertneo/jacksonorderpoc
9fc0f5f49209b9dc3b5516a14f3cad0df155a13a
0f5096ae78a6ef93d056d76a20213bb474e8b806
refs/heads/master
2023-07-19T09:56:23.698000
2021-09-04T22:02:17
2021-09-04T22:02:17
403,156,764
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2019 - Papp Bence. All Rights Reserved. */ package com.poc; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.TreeMap; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; public class Main { public static void main(String[] args) throws IOException { Path filePath = Path.of("src/main/resources/input.json"); String inputJson = Files.readString(filePath); // FileReader inputJson = new FileReader("src/main/resources/input.json"); //Can't ready it twice out of the box JsonMapper configuredMapper = JsonMapper.builder().nodeFactory(new SortingNodeFactory()).build(); ObjectMapper defaultMapper = new ObjectMapper(); JsonNode configuredJsonNode = configuredMapper.readTree(inputJson); System.out.println("Bare inputJson: " + inputJson); System.out.println("ConfiguredMapper output: " + configuredMapper.writeValueAsString(configuredJsonNode)); JsonNode defaultJsonNode = defaultMapper.readTree(inputJson); System.out.println("Default Mapper output: " + defaultMapper.writeValueAsString(defaultJsonNode)); JsonNode customMappedJsonNode = configuredMapper.valueToTree(defaultJsonNode); System.out.println("Parsed with Default Mapper, Re-serialized with ConfiguredMapper: " + defaultMapper .writeValueAsString(customMappedJsonNode)); } static class SortingNodeFactory extends JsonNodeFactory { @Override public ObjectNode objectNode() { return new ObjectNode(this, new TreeMap<String, JsonNode>()); } } }
UTF-8
Java
1,783
java
Main.java
Java
[ { "context": "/*\n * Copyright (c) 2019 - Papp Bence. All Rights Reserved.\n */\npackage com.poc;\n\nimpor", "end": 37, "score": 0.9998663663864136, "start": 27, "tag": "NAME", "value": "Papp Bence" } ]
null
[]
/* * Copyright (c) 2019 - <NAME>. All Rights Reserved. */ package com.poc; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.TreeMap; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.json.JsonMapper; import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; public class Main { public static void main(String[] args) throws IOException { Path filePath = Path.of("src/main/resources/input.json"); String inputJson = Files.readString(filePath); // FileReader inputJson = new FileReader("src/main/resources/input.json"); //Can't ready it twice out of the box JsonMapper configuredMapper = JsonMapper.builder().nodeFactory(new SortingNodeFactory()).build(); ObjectMapper defaultMapper = new ObjectMapper(); JsonNode configuredJsonNode = configuredMapper.readTree(inputJson); System.out.println("Bare inputJson: " + inputJson); System.out.println("ConfiguredMapper output: " + configuredMapper.writeValueAsString(configuredJsonNode)); JsonNode defaultJsonNode = defaultMapper.readTree(inputJson); System.out.println("Default Mapper output: " + defaultMapper.writeValueAsString(defaultJsonNode)); JsonNode customMappedJsonNode = configuredMapper.valueToTree(defaultJsonNode); System.out.println("Parsed with Default Mapper, Re-serialized with ConfiguredMapper: " + defaultMapper .writeValueAsString(customMappedJsonNode)); } static class SortingNodeFactory extends JsonNodeFactory { @Override public ObjectNode objectNode() { return new ObjectNode(this, new TreeMap<String, JsonNode>()); } } }
1,779
0.765003
0.762759
46
37.760868
35.02433
117
false
false
0
0
0
0
0
0
0.565217
false
false
5
bca65f7b75fb7deb75339bb9df94377c8cc1175d
601,295,462,707
550e12e326ebc577af430c45cb031f24cb8af69b
/src/net/etfbl/travel/beans/KorisniciAdministracijaBean.java
01cbe7ab138f61d1c50c75d53eebdf36b0df7ce5
[]
no_license
nemanja-d/travel
https://github.com/nemanja-d/travel
cdb2d49ed62f878c4e555e8fd7fe74e39510005e
774c1d25903628e3167503b0a14456997630c968
refs/heads/master
2020-03-03T23:03:20.208000
2016-04-27T12:19:34
2016-04-27T12:19:34
53,153,190
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.etfbl.travel.beans; import java.io.Serializable; import java.util.ArrayList; import net.etfbl.travel.dto.Korisnik; public class KorisniciAdministracijaBean implements Serializable { private static final long serialVersionUID = 1L; private ArrayList<Korisnik> lista = new ArrayList<Korisnik>(); public KorisniciAdministracijaBean() { super(); } public ArrayList<Korisnik> getLista() { return lista; } public void setLista(ArrayList<Korisnik> lista) { this.lista = lista; } }
UTF-8
Java
541
java
KorisniciAdministracijaBean.java
Java
[]
null
[]
package net.etfbl.travel.beans; import java.io.Serializable; import java.util.ArrayList; import net.etfbl.travel.dto.Korisnik; public class KorisniciAdministracijaBean implements Serializable { private static final long serialVersionUID = 1L; private ArrayList<Korisnik> lista = new ArrayList<Korisnik>(); public KorisniciAdministracijaBean() { super(); } public ArrayList<Korisnik> getLista() { return lista; } public void setLista(ArrayList<Korisnik> lista) { this.lista = lista; } }
541
0.715342
0.713494
27
18.037037
21.24719
66
false
false
0
0
0
0
0
0
1
false
false
5
6b187cdf61c0e338dd430af78a777abd206510f0
31,336,081,421,722
0864970506c28d1633a2e9b0d0bd4ebd06d819a5
/src/main/java/md/curs/controller/CalcController.java
f37ab9b76a11367786b7e358dff17dabf78af320
[]
no_license
interportal/M4-Calculator
https://github.com/interportal/M4-Calculator
d4108ee6004b9dc406a38ed579803d7cddc86fc7
b507f109383fad30be27c88d3bb1d732b6e62926
refs/heads/master
2020-12-30T14:33:19.384000
2017-05-15T09:34:02
2017-05-15T09:34:02
91,320,007
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package md.curs.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import md.curs.model.Calculator; import md.curs.service.CalcService; @Controller @RequestMapping(value = "/calculator") public class CalcController { @Autowired CalcService calcService; @GetMapping public String index(@ModelAttribute("calculator") Calculator calculator) { return "index"; } @PostMapping public String calculate(@ModelAttribute("calculator") Calculator calcData, Model model) { String result = calcService.calculateResult(calcData); model.addAttribute("result", result); return "index"; } }
UTF-8
Java
966
java
CalcController.java
Java
[]
null
[]
package md.curs.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import md.curs.model.Calculator; import md.curs.service.CalcService; @Controller @RequestMapping(value = "/calculator") public class CalcController { @Autowired CalcService calcService; @GetMapping public String index(@ModelAttribute("calculator") Calculator calculator) { return "index"; } @PostMapping public String calculate(@ModelAttribute("calculator") Calculator calcData, Model model) { String result = calcService.calculateResult(calcData); model.addAttribute("result", result); return "index"; } }
966
0.797101
0.797101
36
25.833334
25.53701
90
false
false
0
0
0
0
0
0
1.194444
false
false
5
4d4a0fb213dd1012d85c717fbbab35211de95cf9
22,960,895,208,490
9d70493d2f1ff9c02640b47983ac6e1dcf5ab4c4
/module_communication/src/main/java/com/wdz/module_communication/main/datasave/sp/SharedPreferenceActivity.java
666f20d7f602c6c4ed6d48a4cce3d48d77de40f7
[]
no_license
mirse/StudyCollection
https://github.com/mirse/StudyCollection
5f3197c2d18a7706e8b5239ab1a8a2e203f728d8
b8ced9fe16d1de24a11a4ef2567637295eb22592
refs/heads/master
2023-08-09T09:56:56.998000
2020-10-20T02:50:34
2020-10-20T02:50:34
197,723,354
1
0
null
false
2019-07-28T07:36:27
2019-07-19T07:23:13
2019-07-28T07:27:11
2019-07-28T07:36:27
573
0
0
0
Java
false
false
package com.wdz.module_communication.main.datasave.sp; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; import com.alibaba.android.arouter.facade.annotation.Route; import com.wdz.common.constant.ARouterConstant; import com.wdz.module_communication.R; import java.util.Iterator; import java.util.Set; @Route(path = ARouterConstant.ACTIVITY_SP) public class SharedPreferenceActivity extends AppCompatActivity { private static final String TAG = "SharedPreferenceActivit"; private SpUtils spUtils; private String key; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_shared_preference); spUtils = new SpUtils(this); initUI(); } private void initUI() { final EditText mEtKey = findViewById(R.id.et_key); final EditText mEtValue = findViewById(R.id.et_value); Button mBtnSave = findViewById(R.id.bt_save); Button mBtnRead = findViewById(R.id.bt_read); Button mBtnClear = findViewById(R.id.bt_clear); mBtnSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { key = mEtKey.getText().toString(); String value = mEtValue.getText().toString(); // if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value)){ spUtils.savePrimaryAddress(String.valueOf(spUtils.getPrimaryAddress().size()+2)); Set<String> primaryAddress = spUtils.getPrimaryAddress(); Log.i(TAG,"length:"+primaryAddress.size()); Iterator<String> iterator = primaryAddress.iterator(); while (iterator.hasNext()){ Log.i(TAG,iterator.next()); } // } } }); mBtnClear.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String value = mEtValue.getText().toString(); mEtKey.setText(""); mEtValue.setText(""); spUtils.deletePrimaryAddress(value); Set<String> primaryAddress = spUtils.getPrimaryAddress(); Log.i(TAG,"length:"+primaryAddress.size()); Iterator<String> iterator = primaryAddress.iterator(); while (iterator.hasNext()){ Log.i(TAG,iterator.next()); } } }); mBtnRead.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String key = mEtKey.getText().toString(); if (!TextUtils.isEmpty(key)){ String value = (String) spUtils.getValue(key, "null"); mEtValue.setText(value); } } }); } }
UTF-8
Java
3,136
java
SharedPreferenceActivity.java
Java
[]
null
[]
package com.wdz.module_communication.main.datasave.sp; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import androidx.appcompat.app.AppCompatActivity; import com.alibaba.android.arouter.facade.annotation.Route; import com.wdz.common.constant.ARouterConstant; import com.wdz.module_communication.R; import java.util.Iterator; import java.util.Set; @Route(path = ARouterConstant.ACTIVITY_SP) public class SharedPreferenceActivity extends AppCompatActivity { private static final String TAG = "SharedPreferenceActivit"; private SpUtils spUtils; private String key; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_shared_preference); spUtils = new SpUtils(this); initUI(); } private void initUI() { final EditText mEtKey = findViewById(R.id.et_key); final EditText mEtValue = findViewById(R.id.et_value); Button mBtnSave = findViewById(R.id.bt_save); Button mBtnRead = findViewById(R.id.bt_read); Button mBtnClear = findViewById(R.id.bt_clear); mBtnSave.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { key = mEtKey.getText().toString(); String value = mEtValue.getText().toString(); // if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value)){ spUtils.savePrimaryAddress(String.valueOf(spUtils.getPrimaryAddress().size()+2)); Set<String> primaryAddress = spUtils.getPrimaryAddress(); Log.i(TAG,"length:"+primaryAddress.size()); Iterator<String> iterator = primaryAddress.iterator(); while (iterator.hasNext()){ Log.i(TAG,iterator.next()); } // } } }); mBtnClear.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String value = mEtValue.getText().toString(); mEtKey.setText(""); mEtValue.setText(""); spUtils.deletePrimaryAddress(value); Set<String> primaryAddress = spUtils.getPrimaryAddress(); Log.i(TAG,"length:"+primaryAddress.size()); Iterator<String> iterator = primaryAddress.iterator(); while (iterator.hasNext()){ Log.i(TAG,iterator.next()); } } }); mBtnRead.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String key = mEtKey.getText().toString(); if (!TextUtils.isEmpty(key)){ String value = (String) spUtils.getValue(key, "null"); mEtValue.setText(value); } } }); } }
3,136
0.59375
0.593431
90
33.844444
25.010181
101
false
false
0
0
0
0
0
0
0.566667
false
false
5
ca325e5558dc117432822c412d59b783a666666e
7,035,156,471,846
2fb4c27c13ac5fb01e2248f42a8bb8ccad23431b
/datawatcher-annotation/src/main/java/club/fdawei/datawatcher/annotation/WatchData.java
e4df878015314676c0ac568054620c088db7e4ee
[ "Apache-2.0" ]
permissive
fangdawei/DataWatcher
https://github.com/fangdawei/DataWatcher
b42b74eac82e4a453680016aae72c03e289fb9e9
1d6fb43f2a17d768706164aae0e3512e31cb5173
refs/heads/master
2020-05-14T18:06:40.950000
2019-08-14T12:16:46
2019-08-14T12:16:46
181,904,848
2
0
null
false
2019-06-20T14:07:17
2019-04-17T14:08:13
2019-05-25T07:39:47
2019-06-20T14:07:16
289
1
0
0
Java
false
false
package club.fdawei.datawatcher.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) public @interface WatchData { Class<?> data(); String field(); int thread() default Thread.CURRENT; boolean notifyWhenBind() default true; final class Thread { public static final int CURRENT = 0; public static final int MAIN = 1; public static final int WORK_THREAD = 2; } }
UTF-8
Java
598
java
WatchData.java
Java
[]
null
[]
package club.fdawei.datawatcher.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.CLASS) @Target(ElementType.METHOD) public @interface WatchData { Class<?> data(); String field(); int thread() default Thread.CURRENT; boolean notifyWhenBind() default true; final class Thread { public static final int CURRENT = 0; public static final int MAIN = 1; public static final int WORK_THREAD = 2; } }
598
0.722408
0.717391
25
22.92
18.141489
48
false
false
0
0
0
0
0
0
0.48
false
false
5
c18a66f364c1a8d01f64557bb212a5e2dde714ab
7,868,380,132,087
3ede176e324ce6cd9820f04906a7e4bd6cbcc32b
/src/main/java/com/capstone/demo/models/TaskStatus.java
49956a98da988afb6fe52ec955d58e1d2f5e33ab
[]
no_license
Capstone-AAR/capstone
https://github.com/Capstone-AAR/capstone
f424ce1ad8c0e5bfeaf060936f4370f70171c656
7b6082960bad8d94952a4d7257c5e4f8d9004312
refs/heads/master
2021-09-03T02:39:56.757000
2018-01-05T00:34:33
2018-01-05T00:34:33
111,125,666
0
0
null
false
2018-01-05T00:34:34
2017-11-17T16:28:19
2017-11-21T20:37:08
2018-01-05T00:34:34
6,657
0
0
0
JavaScript
false
null
package com.capstone.demo.models; ////////////////////////////////////////////////////////// ////////////////////////// Enum ////////////////////////// ////////////////////////////////////////////////////////// public enum TaskStatus { NEW, //default task status REQUEST_APPROVAL, //after kid completes task bt pressing complete button APPROVED, //status after parent approves task }
UTF-8
Java
398
java
TaskStatus.java
Java
[]
null
[]
package com.capstone.demo.models; ////////////////////////////////////////////////////////// ////////////////////////// Enum ////////////////////////// ////////////////////////////////////////////////////////// public enum TaskStatus { NEW, //default task status REQUEST_APPROVAL, //after kid completes task bt pressing complete button APPROVED, //status after parent approves task }
398
0.424623
0.424623
11
35.18182
25.61895
76
false
false
0
0
0
0
92
0.449749
0.363636
false
false
5
2ed6b0b3e8020a8de5ca4a4da6bb10eef39358a8
7,868,380,129,462
c022acd4ebbcf61a252881a8cd19081f995aa6f8
/platform-api/src/main/java/com/cpone/platform/api/dto/bzb/CheckCustomerValidResponse.java
6a027cc4f5fdabdfb66c6c94bfad2b39f4802083
[]
no_license
newSue/platform-parent
https://github.com/newSue/platform-parent
d57e0486b46ee85de5960d711e00e1baabd335b3
7b3d1bf526e1ad9c7cccef21eb60ce33fec8fa32
HEAD
2018-02-08T06:06:30.306000
2017-07-05T16:35:29
2017-07-05T16:35:29
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cpone.platform.api.dto.bzb; import com.fasterxml.jackson.annotation.JsonProperty; import java.io.Serializable; /** * Created by Sitthi on 13 Oct 016. * Response return from bzb mygift api * https://api.buzzebees.com/api/campaign/<campaign>?token=<token> * campaign * token : token from bzbtoken table */ public class CheckCustomerValidResponse implements Serializable { private static final long serialVersionUID = 1L; @JsonProperty(value = "ID") private Integer id; @JsonProperty(value = "Name") private String name; @JsonProperty(value = "ConditionAlert") private String conditionAlert; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getConditionAlert() { return conditionAlert; } public void setConditionAlert(String conditionAlert) { this.conditionAlert = conditionAlert; } }
UTF-8
Java
1,083
java
CheckCustomerValidResponse.java
Java
[ { "context": ";\n\nimport java.io.Serializable;\n\n/**\n * Created by Sitthi on 13 Oct 016.\n * Response return from bzb mygift", "end": 150, "score": 0.6685059070587158, "start": 144, "tag": "USERNAME", "value": "Sitthi" } ]
null
[]
package com.cpone.platform.api.dto.bzb; import com.fasterxml.jackson.annotation.JsonProperty; import java.io.Serializable; /** * Created by Sitthi on 13 Oct 016. * Response return from bzb mygift api * https://api.buzzebees.com/api/campaign/<campaign>?token=<token> * campaign * token : token from bzbtoken table */ public class CheckCustomerValidResponse implements Serializable { private static final long serialVersionUID = 1L; @JsonProperty(value = "ID") private Integer id; @JsonProperty(value = "Name") private String name; @JsonProperty(value = "ConditionAlert") private String conditionAlert; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getConditionAlert() { return conditionAlert; } public void setConditionAlert(String conditionAlert) { this.conditionAlert = conditionAlert; } }
1,083
0.67036
0.66482
49
21.102041
19.633629
66
false
false
0
0
0
0
0
0
0.265306
false
false
5
abaebc6cb07540f463e45c050c4ac4c190b427b1
7,945,689,533,771
c8009f2b3ba32fedb9b42c5bc45ca64df2d440c3
/app/src/main/java/com/pinlesspay/sms/SmsListener.java
fadcf168d661df9905fdb1bb84bdebb106e4edd5
[]
no_license
arun14aug/PP
https://github.com/arun14aug/PP
44687a44f77fb69c19518ba01049fe538d6bbdc6
d084675a1c72f71d090aecedea8251d7d78129c3
refs/heads/master
2021-01-01T16:29:31.475000
2017-09-19T13:52:00
2017-09-19T13:52:00
97,844,878
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pinlesspay.sms; /* * Created by arun.sharma on 19-04-2016. */ public interface SmsListener { public void messageReceived(String messageText); }
UTF-8
Java
169
java
SmsListener.java
Java
[ { "context": "package com.pinlesspay.sms;\n\n/*\n * Created by arun.sharma on 19-04-2016.\n */\npublic interface SmsListener {", "end": 57, "score": 0.8430753946304321, "start": 46, "tag": "USERNAME", "value": "arun.sharma" } ]
null
[]
package com.pinlesspay.sms; /* * Created by arun.sharma on 19-04-2016. */ public interface SmsListener { public void messageReceived(String messageText); }
169
0.710059
0.662722
10
15.9
19.623711
56
false
false
0
0
0
0
0
0
0.2
false
false
5
e4dc3db9d18ed027cdaa7a1460b25cd3024a9137
4,483,945,894,243
8346253b9702790421fa1b247520f94ad278310a
/src/four/hidden/Test.java
0314d1800f29d9d1df3786278cda4e80a8ced5f5
[]
no_license
1793523411/java-review
https://github.com/1793523411/java-review
62f55da1d57c40dfdf8b4951b2e9d0efcbebdff0
c8bb9c03ad1fbf5221bc9cbf1bcfb0eaf914cdb2
refs/heads/master
2022-10-31T21:35:19.821000
2020-06-21T04:27:24
2020-06-21T04:27:24
273,833,583
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package four.hidden; public class Test { public static void main(String[] args) { A1 a1 = new A1(); a1.setx(4); a1.printa(); B1 b1 = new B1(); b1.printb(); b1.printa(); b1.setx(6); // 将继承来的x值设置为6 b1.printb(); b1.printa(); a1.printa(); } } /** * 子类不能继承父类中的静态属性,但可以对父类中的静态属性进行操作。如在上面的例子中,将“int x = 2;”改为“static int x = 2;”,再编译及运行程序,会得到下面的结果 * 4 * super.x= 14 x= 100 * 14 * super.x= 16 x= 100 * 16 * 16 * 在上面的结果中,第一行及最后一行都是语句“a1.printa();”输出的结果,显然类B中的printb()方法修改的是类A中的静态属性x */
UTF-8
Java
829
java
Test.java
Java
[]
null
[]
package four.hidden; public class Test { public static void main(String[] args) { A1 a1 = new A1(); a1.setx(4); a1.printa(); B1 b1 = new B1(); b1.printb(); b1.printa(); b1.setx(6); // 将继承来的x值设置为6 b1.printb(); b1.printa(); a1.printa(); } } /** * 子类不能继承父类中的静态属性,但可以对父类中的静态属性进行操作。如在上面的例子中,将“int x = 2;”改为“static int x = 2;”,再编译及运行程序,会得到下面的结果 * 4 * super.x= 14 x= 100 * 14 * super.x= 16 x= 100 * 16 * 16 * 在上面的结果中,第一行及最后一行都是语句“a1.printa();”输出的结果,显然类B中的printb()方法修改的是类A中的静态属性x */
829
0.542024
0.478559
30
18.433332
20.892876
96
false
false
0
0
0
0
0
0
0.466667
false
false
5
c75b4b343d1b018f9a0f8f86bbbb238a3a204b06
25,065,429,180,868
952789d549bf98b84ffc02cb895f38c95b85e12c
/V_3.x/Meta/branches/deprecated/BMM/src/bi/bmm/wizards/NewBC_page01.java
6e03e1d03578de5ca57f4de72c80a625c89711ba
[]
no_license
emtee40/testingazuan
https://github.com/emtee40/testingazuan
de6342378258fcd4e7cbb3133bb7eed0ebfebeee
f3bd91014e1b43f2538194a5eb4e92081d2ac3ae
refs/heads/master
2020-03-26T08:42:50.873000
2015-01-09T16:17:08
2015-01-09T16:17:08
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** SpagoBI - The Business Intelligence Free Platform Copyright (C) 2005-2008 Engineering Ingegneria Informatica S.p.A. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @Author Marco Cortella **/ package bi.bmm.wizards; import java.util.Vector; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableItem; import bi.bmm.Activator; import bi.bmm.util.DBConnection; public class NewBC_page01 extends WizardPage { private Composite container; private Button[] radios; private DBConnection conn; private boolean tableSelect; private Table tb; public NewBC_page01(boolean tableSelect,DBConnection conn) { super("Create a new BC"); setTitle("BC Creation Mode"); setDescription("This wizard drives you to crate a new Business Class in your BM project," + " please choose a mode to create your BC."); ImageDescriptor image = Activator.getImageDescriptor("icons/wizards/createBC.png"); if (image!=null) setImageDescriptor(image); this.conn=conn; this.tableSelect=tableSelect; this.tb = null; } @Override public void createControl(Composite parent) { container = new Composite(parent, SWT.NULL); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; container.setLayout(gridLayout); //Table chooser if(!tableSelect && conn.Start()){ Label lbl = new Label(container, SWT.NULL); lbl.setText("Select a Table from schema: "); tb = new Table(container, SWT.BORDER); //MC: Aggiunto LayoutData tb.setLayoutData(new GridData( GridData.GRAB_VERTICAL | GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH )); Vector<String[]> v =conn.getTables(); for (int i = 0; i < v.size(); i++){ TableItem ti = new TableItem(tb, SWT.NONE); ti.setText(v.get(i)[0]); } conn.Stop(); } //-------------------------------------------- radios = new Button[2]; Label lb0img = new Label(container, SWT.NULL); lb0img.setText(""); Image imageFast = Activator.getImageDescriptor("icons/wizards/fastBC.png").createImage(); if (imageFast!=null) lb0img.setImage(imageFast); Composite c1 = new Composite(container, SWT.NULL); GridLayout gl1 = new GridLayout(); gl1.numColumns = 1; c1.setLayout(gl1); Label lb1img = new Label(container, SWT.NULL); lb1img.setText(""); Image imageNorm = Activator.getImageDescriptor("icons/wizards/normBC.png").createImage(); if (imageNorm!=null) lb1img.setImage(imageNorm); Composite c2 = new Composite(container, SWT.NULL); GridLayout gl2 = new GridLayout(); gl2.numColumns = 1; c2.setLayout(gl2); final Composite [] composites = new Composite [] {c1, c2}; Listener radioGroup = new Listener () { public void handleEvent (Event event) { for (int i=0; i<composites.length; i++) { Composite composite = composites [i]; Control [] children = composite.getChildren (); for (int j=0; j<children.length; j++) { Control child = children [j]; if (child instanceof Button) { Button button = (Button) child; if ((button.getStyle () & SWT.RADIO) != 0) { button.setSelection (false); } } } } Button button = (Button) event.widget; button.setSelection (true); } }; //-------------------------------------------- radios[0] = new Button(c1, SWT.RADIO); radios[0].setSelection(true); radios[0].setText("Fast Business Class Creation:"); radios[0].setFont(new Font (container.getDisplay(), "Arial", 14, SWT.BOLD & SWT.ITALIC)); radios[0].setBounds(10, 5, 75, 30); radios[0].addListener (SWT.Selection, radioGroup); Label lb0 = new Label(c1, SWT.NULL); lb0.setText("provide you a BC from the selected table quickly.\nBusiness Element will be" + " created automatically.\nYou shall only choose keys or mapping.\n"); //--------------------------------------------- radios[1] = new Button(c2, SWT.RADIO); radios[1].setText("Expert Business Class Creation:"); radios[1].setFont(new Font (container.getDisplay(), "Arial", 14, SWT.BOLD & SWT.ITALIC)); radios[1].setBounds(10, 30, 75, 30); radios[1].addListener (SWT.Selection, radioGroup); Label lb1 = new Label(c2, SWT.NULL); lb1.setText("Create your BC from the selected table choosing\nall mapping parameters as well as Business Elements.\n"); //table listener if(!tableSelect){ tb.addListener(SWT.MouseDown, new Listener () { public void handleEvent (Event event) { Point point = new Point (event.x, event.y); TableItem item = tb.getItem(point); if (item != null) { checkPageComplete(); } } }); } /* .addKeyListener(new KeyListener() { @Override public void keyReleased(KeyEvent e) { if (!text1.getText().equals("") && !text2.getText().equals("")){ setPageComplete(true); } else{ setPageComplete(false); } } @Override public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub } }); */ // Required to avoid an error in the system setControl(container); checkPageComplete(); } private void checkPageComplete() { if(!tableSelect){ if(tb.getSelectionCount()!=0 && radios[0].getSelection()){ setPageComplete(true); } else { if(radios[1].getSelection()){ setPageComplete(true); } else{ setPageComplete(false); } } } else{ setPageComplete(true); } } public boolean getFastMode() { return radios[0].getSelection(); } public String getTableName(){ return tb.getItem(tb.getSelectionIndex()).getText(); } public boolean getTableSelect(){ return tableSelect; } }
UTF-8
Java
7,353
java
NewBC_page01.java
Java
[ { "context": "ifth Floor, Boston, MA 02110-1301 USA\r\n\r\n@Author Marco Cortella\r\n\r\n**/\r\npackage bi.bmm.wizards;\r\n\r\n\r\nimport java.", "end": 866, "score": 0.9998356103897095, "start": 852, "tag": "NAME", "value": "Marco Cortella" } ]
null
[]
/** SpagoBI - The Business Intelligence Free Platform Copyright (C) 2005-2008 Engineering Ingegneria Informatica S.p.A. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @Author <NAME> **/ package bi.bmm.wizards; import java.util.Vector; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableItem; import bi.bmm.Activator; import bi.bmm.util.DBConnection; public class NewBC_page01 extends WizardPage { private Composite container; private Button[] radios; private DBConnection conn; private boolean tableSelect; private Table tb; public NewBC_page01(boolean tableSelect,DBConnection conn) { super("Create a new BC"); setTitle("BC Creation Mode"); setDescription("This wizard drives you to crate a new Business Class in your BM project," + " please choose a mode to create your BC."); ImageDescriptor image = Activator.getImageDescriptor("icons/wizards/createBC.png"); if (image!=null) setImageDescriptor(image); this.conn=conn; this.tableSelect=tableSelect; this.tb = null; } @Override public void createControl(Composite parent) { container = new Composite(parent, SWT.NULL); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; container.setLayout(gridLayout); //Table chooser if(!tableSelect && conn.Start()){ Label lbl = new Label(container, SWT.NULL); lbl.setText("Select a Table from schema: "); tb = new Table(container, SWT.BORDER); //MC: Aggiunto LayoutData tb.setLayoutData(new GridData( GridData.GRAB_VERTICAL | GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH )); Vector<String[]> v =conn.getTables(); for (int i = 0; i < v.size(); i++){ TableItem ti = new TableItem(tb, SWT.NONE); ti.setText(v.get(i)[0]); } conn.Stop(); } //-------------------------------------------- radios = new Button[2]; Label lb0img = new Label(container, SWT.NULL); lb0img.setText(""); Image imageFast = Activator.getImageDescriptor("icons/wizards/fastBC.png").createImage(); if (imageFast!=null) lb0img.setImage(imageFast); Composite c1 = new Composite(container, SWT.NULL); GridLayout gl1 = new GridLayout(); gl1.numColumns = 1; c1.setLayout(gl1); Label lb1img = new Label(container, SWT.NULL); lb1img.setText(""); Image imageNorm = Activator.getImageDescriptor("icons/wizards/normBC.png").createImage(); if (imageNorm!=null) lb1img.setImage(imageNorm); Composite c2 = new Composite(container, SWT.NULL); GridLayout gl2 = new GridLayout(); gl2.numColumns = 1; c2.setLayout(gl2); final Composite [] composites = new Composite [] {c1, c2}; Listener radioGroup = new Listener () { public void handleEvent (Event event) { for (int i=0; i<composites.length; i++) { Composite composite = composites [i]; Control [] children = composite.getChildren (); for (int j=0; j<children.length; j++) { Control child = children [j]; if (child instanceof Button) { Button button = (Button) child; if ((button.getStyle () & SWT.RADIO) != 0) { button.setSelection (false); } } } } Button button = (Button) event.widget; button.setSelection (true); } }; //-------------------------------------------- radios[0] = new Button(c1, SWT.RADIO); radios[0].setSelection(true); radios[0].setText("Fast Business Class Creation:"); radios[0].setFont(new Font (container.getDisplay(), "Arial", 14, SWT.BOLD & SWT.ITALIC)); radios[0].setBounds(10, 5, 75, 30); radios[0].addListener (SWT.Selection, radioGroup); Label lb0 = new Label(c1, SWT.NULL); lb0.setText("provide you a BC from the selected table quickly.\nBusiness Element will be" + " created automatically.\nYou shall only choose keys or mapping.\n"); //--------------------------------------------- radios[1] = new Button(c2, SWT.RADIO); radios[1].setText("Expert Business Class Creation:"); radios[1].setFont(new Font (container.getDisplay(), "Arial", 14, SWT.BOLD & SWT.ITALIC)); radios[1].setBounds(10, 30, 75, 30); radios[1].addListener (SWT.Selection, radioGroup); Label lb1 = new Label(c2, SWT.NULL); lb1.setText("Create your BC from the selected table choosing\nall mapping parameters as well as Business Elements.\n"); //table listener if(!tableSelect){ tb.addListener(SWT.MouseDown, new Listener () { public void handleEvent (Event event) { Point point = new Point (event.x, event.y); TableItem item = tb.getItem(point); if (item != null) { checkPageComplete(); } } }); } /* .addKeyListener(new KeyListener() { @Override public void keyReleased(KeyEvent e) { if (!text1.getText().equals("") && !text2.getText().equals("")){ setPageComplete(true); } else{ setPageComplete(false); } } @Override public void keyPressed(KeyEvent e) { // TODO Auto-generated method stub } }); */ // Required to avoid an error in the system setControl(container); checkPageComplete(); } private void checkPageComplete() { if(!tableSelect){ if(tb.getSelectionCount()!=0 && radios[0].getSelection()){ setPageComplete(true); } else { if(radios[1].getSelection()){ setPageComplete(true); } else{ setPageComplete(false); } } } else{ setPageComplete(true); } } public boolean getFastMode() { return radios[0].getSelection(); } public String getTableName(){ return tb.getItem(tb.getSelectionIndex()).getText(); } public boolean getTableSelect(){ return tableSelect; } }
7,345
0.637291
0.624235
243
28.25926
24.123369
124
false
false
0
0
0
0
0
0
2.333333
false
false
5
86f274c074a362c358c2709fff037417d900e762
13,056,700,620,335
0a1eb9f5fd5f41fa382f3d80d64d277e68f66f14
/examples/health/REEDHOUSESYSTEMS_HEALTH_MESSENG/SRC/MAIN/JAVA/COM/REEDHOUSESYSTEMS/SERVICES/CORE/HEALTH/MESSENGER/REQUEST/MESSAGEREQUEST.JAVA
45827cf2e7fa855ac58fbe34d30e360089d9de13
[ "Apache-2.0" ]
permissive
Nyakonda/teleweaver
https://github.com/Nyakonda/teleweaver
ab15d594b2f16991ca25d1a678103d21203819b6
ce05a4db9e206e7808eda2cc97a0dcf45b71d3da
refs/heads/master
2021-01-22T10:47:39.490000
2017-05-03T08:00:57
2017-05-03T08:00:57
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.reedhousesystems.services.core.health.messenger.request; import javax.validation.constraints.NotNull; import com.reedhousesystems.services.core.health.messenger.model.Message; public class MessageRequest { private String id; @NotNull private String item; @NotNull private String description; public MessageRequest() { } public MessageRequest(Message message) { setId(message.getUuid().toString()); setItem(message.getItem()); setDescription(message.getDescription()); } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getItem() { return item; } public void setItem(String item) { this.item = item; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
UTF-8
Java
864
java
MESSAGEREQUEST.JAVA
Java
[]
null
[]
package com.reedhousesystems.services.core.health.messenger.request; import javax.validation.constraints.NotNull; import com.reedhousesystems.services.core.health.messenger.model.Message; public class MessageRequest { private String id; @NotNull private String item; @NotNull private String description; public MessageRequest() { } public MessageRequest(Message message) { setId(message.getUuid().toString()); setItem(message.getItem()); setDescription(message.getDescription()); } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getItem() { return item; } public void setItem(String item) { this.item = item; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
864
0.728009
0.728009
51
15.960784
18.473043
73
false
false
0
0
0
0
0
0
1.215686
false
false
5
cb89215cd6e959d43c35651b9ab1a3a491082e41
14,224,931,725,412
c1b23a03926012ccee280b3895f100cec61d2407
/topdeep_web_common/server/common-core/src/main/java/topdeep/commonfund/entity/hundsun/I019Output.java
49b75948317173458bc54435f7575f649ec61b63
[]
no_license
zhuangxiaotian/project
https://github.com/zhuangxiaotian/project
a0e548c88f01339993097d99ac68adcba9d11171
d0c96854b3678209c9a25d07c9729c613fe66d38
refs/heads/master
2020-12-05T23:14:27.354000
2016-09-01T07:19:22
2016-09-01T07:19:22
67,108,931
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package topdeep.commonfund.entity.hundsun; import java.io.Serializable; import java.util.*; import common.util.param.PropertyAttribute; /** * 趋势定投避险基金列表(I019) */ public class I019Output extends HundsunBaseOutput implements Serializable { private List<I019OutputDetail> detail = new ArrayList<I019OutputDetail>(); public List<I019OutputDetail> getDetail() { return this.detail; } }
UTF-8
Java
414
java
I019Output.java
Java
[]
null
[]
package topdeep.commonfund.entity.hundsun; import java.io.Serializable; import java.util.*; import common.util.param.PropertyAttribute; /** * 趋势定投避险基金列表(I019) */ public class I019Output extends HundsunBaseOutput implements Serializable { private List<I019OutputDetail> detail = new ArrayList<I019OutputDetail>(); public List<I019OutputDetail> getDetail() { return this.detail; } }
414
0.77665
0.738579
16
23.625
24.801399
75
false
false
0
0
0
0
0
0
0.875
false
false
5
2d754d64b3454006d0301a5362fa4858ed7a8006
24,592,982,780,152
76de4c5ee355e46c6050e8303e2976aeff48bcaf
/POO/SegundoTrimestre/AppMensajeria/src/MensajeriaException.java
1f492ede7daebb41daaee0e9e5d21defa0984f9f
[]
no_license
ProgramacionPolitecnicoMalaga/PPM-Alberto_Gandoy_Florido
https://github.com/ProgramacionPolitecnicoMalaga/PPM-Alberto_Gandoy_Florido
3f2cdb6900acc901535728f90caedd4926cccdf9
357c771299d9c0da92734bf91624e746f48652bb
refs/heads/master
2021-07-16T10:46:05.006000
2020-05-21T16:10:34
2020-05-21T16:10:34
218,488,642
0
1
null
false
2020-10-13T22:10:40
2019-10-30T09:20:02
2020-05-21T16:10:45
2020-10-13T22:10:39
12,742
0
0
8
Java
false
false
public class MensajeriaException extends Exception { public MensajeriaException(String message) { super(message); } public MensajeriaException() { super(); } }
UTF-8
Java
194
java
MensajeriaException.java
Java
[]
null
[]
public class MensajeriaException extends Exception { public MensajeriaException(String message) { super(message); } public MensajeriaException() { super(); } }
194
0.649485
0.649485
10
18.4
19.011576
52
false
false
0
0
0
0
0
0
0.2
false
false
5
6215e2d98e798a124880ad1a6500f80c3bfdc294
28,346,784,207,276
938b1ed4a1ed96e9bf941c1f1bdfcc8bee45e807
/app/src/main/java/com/vechirko/fbsample/data/repository/RepositoryApi.java
ac18a5f0cecd30ef04769ac857d022ef51c4ae35
[]
no_license
VolodyaVechirko/FbSample
https://github.com/VolodyaVechirko/FbSample
7dc62862bb8ded23d5d3bcc666d7768c5e4631b1
6f04cf63629bd4f144948093c468925760c74b23
refs/heads/master
2020-03-19T22:06:05.552000
2018-06-11T20:36:28
2018-06-11T20:36:28
136,959,537
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.vechirko.fbsample.data.repository; import com.vechirko.fbsample.data.ServiceGenerator; import com.vechirko.fbsample.data.model.AlbumModel; import com.vechirko.fbsample.data.model.PostModel; import com.vechirko.fbsample.data.model.UserModel; import com.vechirko.fbsample.data.test.FavouriteAlbum; import com.vechirko.fbsample.data.test.GeneralAlbum; import java.util.Collection; import java.util.Collections; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.schedulers.Schedulers; import io.realm.RealmModel; import static com.vechirko.fbsample.data.repository.ObservableUtils.cast; public class RepositoryApi implements RepositoryInterface<RealmModel> { RequestAPI api; public RepositoryApi() { api = ServiceGenerator.createService(RequestAPI.class); } @Override public <T extends RealmModel> Observable<? extends Collection<T>> getAll(Class<T> clazz) { if (PostModel.class.equals(clazz)) { return cast(api.getPosts(null) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread())); } else if (UserModel.class.equals(clazz)) { return cast(api.getUsers() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread())); } else if (GeneralAlbum.class.equals(clazz)) { return cast(api.getAllAlbums() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread())); } else if (FavouriteAlbum.class.equals(clazz)) { return cast(api.getFavouriteAlbums() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread())); } else { return Observable.error(new IllegalArgumentException("Method 'api:getAll' not implemented for " + clazz)); } } @Override public <T extends RealmModel> Observable<? extends Collection<T>> getAll(Request<T> request) { if (PostModel.class.equals(request.clazz)) { return request.has(PostModel.ID) ? cast(api.getPost(request.getString(PostModel.ID)) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .to(om -> om.map(Collections::singletonList)) ) : request.has(PostModel.USER_ID) ? cast(api.getPosts(request.getString(PostModel.USER_ID)) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) ) : Observable.error(new IllegalArgumentException("post 'id' not provided!")); } else if (UserModel.class.equals(request.clazz)) { return request.has(UserModel.ID) ? cast(api.getUser(request.getString(UserModel.ID)) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .to(umo -> umo.map(Collections::singletonList)) ) : Observable.error(new IllegalArgumentException("user 'id' not provided!")); } else if (AlbumModel.class.equals(request.clazz)) { return request.has(AlbumModel.ID) ? cast(api.getAlbum(request.getString(AlbumModel.ID)) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .to(umo -> umo.map(Collections::singletonList)) ) : request.has(AlbumModel.USER_ID) ? cast(api.getAlbums(request.getString(AlbumModel.USER_ID)) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) ) : Observable.error(new IllegalArgumentException("album 'id' not provided!")); } else { return Observable.error(new IllegalArgumentException("Method 'api:getAll' not implemented for " + request.clazz)); } } @Override public <T extends RealmModel> Request<T> get(Class<T> clazz) { return new Request<T>(this, clazz); } @Override public <T extends RealmModel> Observable<? extends Collection<T>> saveAll(Class<T> clazz, Collection<T> elements) { if (PostModel.class.equals(clazz)) { return cast(elements.isEmpty() ? Observable.just(elements) : Observable.fromIterable(elements) .cast(PostModel.class) .flatMap(p -> api.createPosts(p.toRequestMap())) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .to(om -> om.map(Collections::singletonList)) ); } else { return Observable.error(new IllegalArgumentException("Method 'api:saveAll' not implemented for " + clazz)); } } @Override public <T extends RealmModel> Observable<? extends Collection<T>> removeAll(Class<T> clazz, Collection<T> elements) { if (PostModel.class.equals(clazz)) { return cast(elements.isEmpty() ? Observable.just(elements) : Observable.fromIterable(elements) .cast(PostModel.class) .flatMap(n -> api.deletePost(n.getId()), (post, aVoid) -> post) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .to(om -> om.map(Collections::singletonList)) ); } else { return Observable.error(new IllegalArgumentException("Method 'api:removeAll' not implemented for " + clazz)); } } @Override public <T extends RealmModel> Observable<? extends Collection<T>> removeAll(Class<T> clazz) { return Observable.error(new IllegalArgumentException("Method 'api:removeAll' not implemented for " + clazz)); } }
UTF-8
Java
6,036
java
RepositoryApi.java
Java
[]
null
[]
package com.vechirko.fbsample.data.repository; import com.vechirko.fbsample.data.ServiceGenerator; import com.vechirko.fbsample.data.model.AlbumModel; import com.vechirko.fbsample.data.model.PostModel; import com.vechirko.fbsample.data.model.UserModel; import com.vechirko.fbsample.data.test.FavouriteAlbum; import com.vechirko.fbsample.data.test.GeneralAlbum; import java.util.Collection; import java.util.Collections; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.schedulers.Schedulers; import io.realm.RealmModel; import static com.vechirko.fbsample.data.repository.ObservableUtils.cast; public class RepositoryApi implements RepositoryInterface<RealmModel> { RequestAPI api; public RepositoryApi() { api = ServiceGenerator.createService(RequestAPI.class); } @Override public <T extends RealmModel> Observable<? extends Collection<T>> getAll(Class<T> clazz) { if (PostModel.class.equals(clazz)) { return cast(api.getPosts(null) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread())); } else if (UserModel.class.equals(clazz)) { return cast(api.getUsers() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread())); } else if (GeneralAlbum.class.equals(clazz)) { return cast(api.getAllAlbums() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread())); } else if (FavouriteAlbum.class.equals(clazz)) { return cast(api.getFavouriteAlbums() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread())); } else { return Observable.error(new IllegalArgumentException("Method 'api:getAll' not implemented for " + clazz)); } } @Override public <T extends RealmModel> Observable<? extends Collection<T>> getAll(Request<T> request) { if (PostModel.class.equals(request.clazz)) { return request.has(PostModel.ID) ? cast(api.getPost(request.getString(PostModel.ID)) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .to(om -> om.map(Collections::singletonList)) ) : request.has(PostModel.USER_ID) ? cast(api.getPosts(request.getString(PostModel.USER_ID)) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) ) : Observable.error(new IllegalArgumentException("post 'id' not provided!")); } else if (UserModel.class.equals(request.clazz)) { return request.has(UserModel.ID) ? cast(api.getUser(request.getString(UserModel.ID)) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .to(umo -> umo.map(Collections::singletonList)) ) : Observable.error(new IllegalArgumentException("user 'id' not provided!")); } else if (AlbumModel.class.equals(request.clazz)) { return request.has(AlbumModel.ID) ? cast(api.getAlbum(request.getString(AlbumModel.ID)) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .to(umo -> umo.map(Collections::singletonList)) ) : request.has(AlbumModel.USER_ID) ? cast(api.getAlbums(request.getString(AlbumModel.USER_ID)) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) ) : Observable.error(new IllegalArgumentException("album 'id' not provided!")); } else { return Observable.error(new IllegalArgumentException("Method 'api:getAll' not implemented for " + request.clazz)); } } @Override public <T extends RealmModel> Request<T> get(Class<T> clazz) { return new Request<T>(this, clazz); } @Override public <T extends RealmModel> Observable<? extends Collection<T>> saveAll(Class<T> clazz, Collection<T> elements) { if (PostModel.class.equals(clazz)) { return cast(elements.isEmpty() ? Observable.just(elements) : Observable.fromIterable(elements) .cast(PostModel.class) .flatMap(p -> api.createPosts(p.toRequestMap())) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .to(om -> om.map(Collections::singletonList)) ); } else { return Observable.error(new IllegalArgumentException("Method 'api:saveAll' not implemented for " + clazz)); } } @Override public <T extends RealmModel> Observable<? extends Collection<T>> removeAll(Class<T> clazz, Collection<T> elements) { if (PostModel.class.equals(clazz)) { return cast(elements.isEmpty() ? Observable.just(elements) : Observable.fromIterable(elements) .cast(PostModel.class) .flatMap(n -> api.deletePost(n.getId()), (post, aVoid) -> post) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .to(om -> om.map(Collections::singletonList)) ); } else { return Observable.error(new IllegalArgumentException("Method 'api:removeAll' not implemented for " + clazz)); } } @Override public <T extends RealmModel> Observable<? extends Collection<T>> removeAll(Class<T> clazz) { return Observable.error(new IllegalArgumentException("Method 'api:removeAll' not implemented for " + clazz)); } }
6,036
0.609178
0.609178
131
45.076336
32.891129
126
false
false
0
0
0
0
0
0
0.274809
false
false
5
849fce2443abe1d55c650c6a9842c1f7e78a6d51
20,100,446,980,744
fcde394e84293a7eedce6fe2a65ddc82756def24
/protocol-java/src/main/java/misat11/hybrid/network/java/pabstract/packet/login/client/LoginStartPacket.java
43739eb6900ea3c61dc4d7a13a60b625535168ab
[ "MIT" ]
permissive
Misat11/HybridMC
https://github.com/Misat11/HybridMC
acaee3afd83d1e3084e8ddd1436e4ae7f013d434
1d2109df25b161762c68864954bd7d5af6a25d72
refs/heads/master
2020-04-03T07:23:12.699000
2018-12-04T19:12:38
2018-12-04T19:12:38
155,101,107
10
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package misat11.hybrid.network.java.pabstract.packet.login.client; import misat11.hybrid.network.java.pabstract.packet.IMinecraftPacket; public interface LoginStartPacket extends IMinecraftPacket { public String getUsername(); }
UTF-8
Java
232
java
LoginStartPacket.java
Java
[]
null
[]
package misat11.hybrid.network.java.pabstract.packet.login.client; import misat11.hybrid.network.java.pabstract.packet.IMinecraftPacket; public interface LoginStartPacket extends IMinecraftPacket { public String getUsername(); }
232
0.840517
0.823276
7
32.142857
30.063877
69
false
false
0
0
0
0
0
0
0.571429
false
false
5
68393a76023628f50be95ee6a791eac796d1facd
20,100,446,980,247
2d91e94bb2ff10e7954c9df25d29a22173966308
/src/main/java/com/teste/model/TelefoneRequest.java
62cac05116a8c54122c0b2805f3d20ec4ae2b94e
[]
no_license
fabionvs/teste-spring-gestao-de-clientes
https://github.com/fabionvs/teste-spring-gestao-de-clientes
76f73f6a5833a647121b4d6b2a89c2b2812e2f3e
e1a6500ffbda0eb33070b07f55d8732a117a7a01
refs/heads/master
2023-07-30T13:38:46.200000
2021-09-14T05:07:36
2021-09-14T05:07:36
406,110,695
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.teste.model; import java.io.Serializable; import java.util.List; import javax.persistence.Column; import org.hibernate.mapping.Array; import com.fasterxml.jackson.annotation.JsonIgnore; public class TelefoneRequest { private String numero; private String tipo; public String getNumero() { return numero; } public void setNumero(String numero) { this.numero = numero; } public String getTipo() { return tipo; } public void setTipo(String tipo) { this.tipo = tipo; } }
UTF-8
Java
504
java
TelefoneRequest.java
Java
[]
null
[]
package com.teste.model; import java.io.Serializable; import java.util.List; import javax.persistence.Column; import org.hibernate.mapping.Array; import com.fasterxml.jackson.annotation.JsonIgnore; public class TelefoneRequest { private String numero; private String tipo; public String getNumero() { return numero; } public void setNumero(String numero) { this.numero = numero; } public String getTipo() { return tipo; } public void setTipo(String tipo) { this.tipo = tipo; } }
504
0.744048
0.744048
28
17
14.684783
51
false
false
0
0
0
0
0
0
1.107143
false
false
5
351895e14195e371697f2b0588148e16fe25612d
3,788,161,203,081
483637a73e96739eed27c996d44c9139ce70d766
/ChatApp/src/edu/stevens/cs522/chat/service/ChatApp.java
ec91f6effe7f00b2aefceb2e8a4ddfae78cbc2ed
[]
no_license
ynys/java
https://github.com/ynys/java
a079206bb10d09612dccd3556b2f0ef405a7c859
84f9638b79f95c694fe502af6872529c5e9452c7
refs/heads/master
2018-01-07T10:50:51.558000
2013-04-18T01:21:12
2013-04-18T01:21:12
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/********************************************************************* Chat app: exchange messages with other instances of the app. Copyright (c) 2012 Stevens Institute of Technology **********************************************************************/ package edu.stevens.cs522.chat.service; import java.io.IOException; import java.net.DatagramPacket; import java.net.InetAddress; import java.net.UnknownHostException; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; import android.database.Cursor; import android.os.Bundle; import android.os.IBinder; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager.LoaderCallbacks; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.SimpleCursorAdapter; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.CursorAdapter; import android.widget.EditText; import android.widget.ListView; public class ChatApp extends FragmentActivity implements LoaderCallbacks<Cursor> { final static public String TAG = ChatApp.class.getCanonicalName(); /* * Adapter for displaying received messages. */ // CursorAdapter messageAdapter; SimpleCursorAdapter messageAdapter; /* * Widgets for dest address, message text, send button. */ EditText destHost; EditText destPort; EditText msg; Button send; /* * Service binder. */ private IChatService serviceBinder; /* * TODO: Handle the connection with the service. */ // Added By Sen Yang // Handles the connection between the ChatService and ChatApp activity private ServiceConnection mConnection = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder service) { // Called when the connection is made. serviceBinder = ((ChatService.ChatBinder) service).getService(); } public void onServiceDisconnected(ComponentName className) { // Received when the service unexpectedly disconnects. serviceBinder = null; } }; /* * End Todo */ /* * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); destHost = (EditText) findViewById(R.id.dest_text); destPort = (EditText) findViewById(R.id.port_text); msg = (EditText) findViewById(R.id.message_text); /* * TODO: Messages content provider should be linked to the listview * named "msgList" in the UI: * 1. Build a cursor that projects Messages content. See makeMessageCursor(). * 2. Use a SimpleCursorAdapter to adapt this cursor for msgList listview. * 3. Use messages_row layout for the list of messages */ //Added By Sen Yang String[] to = new String[] { ChatContent.Messages.SENDER, ChatContent.Messages.MESSAGE }; int[] from = new int[] { R.id.messages_sender, R.id.messages_message }; messageAdapter = new SimpleCursorAdapter(this, R.layout.messages_row,null, to, from, 0); ListView view = (ListView) findViewById(R.id.msgList); view.setAdapter(messageAdapter); getSupportLoaderManager().initLoader(0, null, this); /* * End Todo */ send = (Button) findViewById(R.id.send_button); send.setOnClickListener(sendListener); /* * TODO: Start the background service that will receive messages from peers. */ //Added By Sen Yang Intent bindIntent = new Intent(ChatApp.this,ChatService.class); bindService(bindIntent, mConnection, Context.BIND_AUTO_CREATE); this.startService(new Intent(this, ChatService.class)); /* * End Todo */ } /* * TODO: Since the content provider for messages received is now updated on a background * thread, it sends a broadcast to the UI to tell it to update the cursor. The UI * should register a broadcast receiver that will change the cursor for the messages adapter. */ //Added By Sen Yang private BroadcastReceiver updater = new ChatMSGReceiver(); private IntentFilter filter = new IntentFilter(ChatService.NEW_MESSAGE_BROADCAST); @Override public void onResume() { super.onResume(); registerReceiver(updater, filter); } @Override public void onPause() { // Unregister the receiver unregisterReceiver(receiver); super.onPause(); } public class ChatMSGReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { Log.d("Receiver",ChatContent.Messages.SENDER); messageAdapter.changeCursor(makeMessageCursor()); } } /* * End Todo */ protected Cursor makeMessageCursor () { /* * TODO: managedQuery is deprecated, use CursorLoader instead! */ //Added By Sen Yang getSupportLoaderManager().initLoader(0, null, this); Cursor c = new CursorLoader(this, ChatContent.Messages.CONTENT_URI, null, null, null, null).loadInBackground(); return c; } /* * On click listener for the send button */ private OnClickListener sendListener = new OnClickListener() { public void onClick(View v) { postMessage(); } }; /* * Send the message in the msg EditText */ private void postMessage() { try { /* * On the emulator, which does not support WIFI stack, we'll send to * (an AVD alias for) the host loopback interface, with the server * port on the host redirected to the server port on the server AVD. */ InetAddress targetAddr = InetAddress.getByName(destHost.getText().toString()); int targetPort = Integer.parseInt(destPort.getText().toString()); String theNewMessage = msg.getText().toString(); this.sendMessage(targetAddr, targetPort, theNewMessage); } catch (UnknownHostException e) { Log.e(TAG, "Unknown host exception: " + e.getMessage()); } catch (IOException e) { Log.e(TAG, "IO exception: " + e.getMessage()); } msg.setText(""); } /* * Send a UDP packet */ public void sendMessage(InetAddress destAddr, int destPort, String msg) throws IOException { /* * Append client info to the front of the message. */ String sender = getString(R.string.user_name); String latitude = getString(R.string.latitude); String longitude = getString(R.string.longitude); String line = sender + ":" + latitude + ":" + longitude + ":" + msg; byte[] sendData = line.getBytes(); DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, destAddr, destPort); serviceBinder.send(sendPacket); Log.i(TAG, "Sent packet: " + msg); } @Override public void onDestroy() { super.onDestroy(); stopService(new Intent(this, ChatService.class)); } /* * Options menu includes an option to list all peers from whom we have * received communication. */ @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); this.getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); Intent i; switch (item.getItemId()) { case (R.id.show_peers): i = new Intent(this, ShowPeers.class); startActivity(i); return true; } return false; } //Added By Sen Yang public Loader<Cursor> onCreateLoader(int loaderID, Bundle bundle) { return new CursorLoader(this, ChatContent.Messages.CONTENT_URI, null, null, null, null); } //Added By Sen Yang public void onLoadFinished(Loader<Cursor> arg0, Cursor cursor) { this.messageAdapter.changeCursor(cursor); } //Added By Sen Yang public void onLoaderReset(Loader<Cursor> loader) { this.messageAdapter.changeCursor(null); } }
UTF-8
Java
7,888
java
ChatApp.java
Java
[ { "context": "the connection with the service.\n\t */\n\t// Added By Sen Yang\n\t// Handles the connection between the ChatServic", "end": 1846, "score": 0.9988608360290527, "start": 1838, "tag": "NAME", "value": "Sen Yang" }, { "context": "layout for the list of messages\n\t\t */\n\t\t//Added By Sen Yang\n\t\tString[] to = new String[] { ChatContent.Messag", "end": 3057, "score": 0.9996896982192993, "start": 3049, "tag": "NAME", "value": "Sen Yang" }, { "context": "ll receive messages from peers.\n\t\t */\n\t\t//Added By Sen Yang\n\t\tIntent bindIntent = new Intent(ChatApp.this,Cha", "end": 3695, "score": 0.9994449615478516, "start": 3687, "tag": "NAME", "value": "Sen Yang" }, { "context": " cursor for the messages adapter.\n\t */\n\t//Added By Sen Yang\n\tprivate BroadcastReceiver updater = new ChatMSGR", "end": 4214, "score": 0.9997243881225586, "start": 4206, "tag": "NAME", "value": "Sen Yang" }, { "context": "ated, use CursorLoader instead!\n\t\t */\n\t\t//Added By Sen Yang\n\t\tgetSupportLoaderManager().initLoader(0, null, t", "end": 4984, "score": 0.9993836879730225, "start": 4976, "tag": "NAME", "value": "Sen Yang" }, { "context": "\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t//Added By Sen Yang\n\tpublic Loader<Cursor> onCreateLoader(int loaderI", "end": 7455, "score": 0.9988880157470703, "start": 7447, "tag": "NAME", "value": "Sen Yang" }, { "context": "URI, null,\n\t\t\t\t\tnull, null, null);\n\t}\n\n\t//Added By Sen Yang\n\tpublic void onLoadFinished(Loader<Cursor> arg0, ", "end": 7646, "score": 0.9995585083961487, "start": 7638, "tag": "NAME", "value": "Sen Yang" }, { "context": "geAdapter.changeCursor(cursor);\n\t\t\n\t}\n\n\t//Added By Sen Yang\n\tpublic void onLoaderReset(Loader<Cursor> loader)", "end": 7784, "score": 0.9993378520011902, "start": 7776, "tag": "NAME", "value": "Sen Yang" } ]
null
[]
/********************************************************************* Chat app: exchange messages with other instances of the app. Copyright (c) 2012 Stevens Institute of Technology **********************************************************************/ package edu.stevens.cs522.chat.service; import java.io.IOException; import java.net.DatagramPacket; import java.net.InetAddress; import java.net.UnknownHostException; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; import android.database.Cursor; import android.os.Bundle; import android.os.IBinder; import android.support.v4.app.FragmentActivity; import android.support.v4.app.LoaderManager.LoaderCallbacks; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.widget.SimpleCursorAdapter; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.CursorAdapter; import android.widget.EditText; import android.widget.ListView; public class ChatApp extends FragmentActivity implements LoaderCallbacks<Cursor> { final static public String TAG = ChatApp.class.getCanonicalName(); /* * Adapter for displaying received messages. */ // CursorAdapter messageAdapter; SimpleCursorAdapter messageAdapter; /* * Widgets for dest address, message text, send button. */ EditText destHost; EditText destPort; EditText msg; Button send; /* * Service binder. */ private IChatService serviceBinder; /* * TODO: Handle the connection with the service. */ // Added By <NAME> // Handles the connection between the ChatService and ChatApp activity private ServiceConnection mConnection = new ServiceConnection() { public void onServiceConnected(ComponentName className, IBinder service) { // Called when the connection is made. serviceBinder = ((ChatService.ChatBinder) service).getService(); } public void onServiceDisconnected(ComponentName className) { // Received when the service unexpectedly disconnects. serviceBinder = null; } }; /* * End Todo */ /* * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); destHost = (EditText) findViewById(R.id.dest_text); destPort = (EditText) findViewById(R.id.port_text); msg = (EditText) findViewById(R.id.message_text); /* * TODO: Messages content provider should be linked to the listview * named "msgList" in the UI: * 1. Build a cursor that projects Messages content. See makeMessageCursor(). * 2. Use a SimpleCursorAdapter to adapt this cursor for msgList listview. * 3. Use messages_row layout for the list of messages */ //Added By <NAME> String[] to = new String[] { ChatContent.Messages.SENDER, ChatContent.Messages.MESSAGE }; int[] from = new int[] { R.id.messages_sender, R.id.messages_message }; messageAdapter = new SimpleCursorAdapter(this, R.layout.messages_row,null, to, from, 0); ListView view = (ListView) findViewById(R.id.msgList); view.setAdapter(messageAdapter); getSupportLoaderManager().initLoader(0, null, this); /* * End Todo */ send = (Button) findViewById(R.id.send_button); send.setOnClickListener(sendListener); /* * TODO: Start the background service that will receive messages from peers. */ //Added By <NAME> Intent bindIntent = new Intent(ChatApp.this,ChatService.class); bindService(bindIntent, mConnection, Context.BIND_AUTO_CREATE); this.startService(new Intent(this, ChatService.class)); /* * End Todo */ } /* * TODO: Since the content provider for messages received is now updated on a background * thread, it sends a broadcast to the UI to tell it to update the cursor. The UI * should register a broadcast receiver that will change the cursor for the messages adapter. */ //Added By <NAME> private BroadcastReceiver updater = new ChatMSGReceiver(); private IntentFilter filter = new IntentFilter(ChatService.NEW_MESSAGE_BROADCAST); @Override public void onResume() { super.onResume(); registerReceiver(updater, filter); } @Override public void onPause() { // Unregister the receiver unregisterReceiver(receiver); super.onPause(); } public class ChatMSGReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { Log.d("Receiver",ChatContent.Messages.SENDER); messageAdapter.changeCursor(makeMessageCursor()); } } /* * End Todo */ protected Cursor makeMessageCursor () { /* * TODO: managedQuery is deprecated, use CursorLoader instead! */ //Added By <NAME> getSupportLoaderManager().initLoader(0, null, this); Cursor c = new CursorLoader(this, ChatContent.Messages.CONTENT_URI, null, null, null, null).loadInBackground(); return c; } /* * On click listener for the send button */ private OnClickListener sendListener = new OnClickListener() { public void onClick(View v) { postMessage(); } }; /* * Send the message in the msg EditText */ private void postMessage() { try { /* * On the emulator, which does not support WIFI stack, we'll send to * (an AVD alias for) the host loopback interface, with the server * port on the host redirected to the server port on the server AVD. */ InetAddress targetAddr = InetAddress.getByName(destHost.getText().toString()); int targetPort = Integer.parseInt(destPort.getText().toString()); String theNewMessage = msg.getText().toString(); this.sendMessage(targetAddr, targetPort, theNewMessage); } catch (UnknownHostException e) { Log.e(TAG, "Unknown host exception: " + e.getMessage()); } catch (IOException e) { Log.e(TAG, "IO exception: " + e.getMessage()); } msg.setText(""); } /* * Send a UDP packet */ public void sendMessage(InetAddress destAddr, int destPort, String msg) throws IOException { /* * Append client info to the front of the message. */ String sender = getString(R.string.user_name); String latitude = getString(R.string.latitude); String longitude = getString(R.string.longitude); String line = sender + ":" + latitude + ":" + longitude + ":" + msg; byte[] sendData = line.getBytes(); DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, destAddr, destPort); serviceBinder.send(sendPacket); Log.i(TAG, "Sent packet: " + msg); } @Override public void onDestroy() { super.onDestroy(); stopService(new Intent(this, ChatService.class)); } /* * Options menu includes an option to list all peers from whom we have * received communication. */ @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); this.getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); Intent i; switch (item.getItemId()) { case (R.id.show_peers): i = new Intent(this, ShowPeers.class); startActivity(i); return true; } return false; } //Added By <NAME> public Loader<Cursor> onCreateLoader(int loaderID, Bundle bundle) { return new CursorLoader(this, ChatContent.Messages.CONTENT_URI, null, null, null, null); } //Added By <NAME> public void onLoadFinished(Loader<Cursor> arg0, Cursor cursor) { this.messageAdapter.changeCursor(cursor); } //Added By <NAME> public void onLoaderReset(Loader<Cursor> loader) { this.messageAdapter.changeCursor(null); } }
7,872
0.714123
0.711714
288
26.388889
25.30278
94
false
false
0
0
0
0
0
0
1.763889
false
false
5
c069dcdbd8ddca99fce81581a450bf471dad446c
22,230,750,760,536
ea54d27e643d6decd6298f05a5bb1a8e7eca3d72
/src/main/java/module-info.java
b15dbc4b95ef91b592c7087274ef5caec22de00d
[]
no_license
Ealrann/gradleJPMS_testResources
https://github.com/Ealrann/gradleJPMS_testResources
6c39053174f7ec4df2dafac6385ce4366909430c
6d9a86761c192a222c76e5eb6573da657d1c8974
refs/heads/master
2022-04-16T18:37:06.604000
2020-04-10T15:30:12
2020-04-10T15:30:12
254,669,592
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
module test.resources { exports test.resources; }
UTF-8
Java
51
java
module-info.java
Java
[]
null
[]
module test.resources { exports test.resources; }
51
0.764706
0.764706
3
16
10.614455
24
false
false
0
0
0
0
0
0
0.666667
false
false
5
5c1078e9377213e24695c290735f945774343170
29,815,663,003,514
45641e46c76324c6acf63d43e8ff9022a5b15922
/springapp/src/main/java/com/examly/springapp/model/Booking.java
3d6db6d46954f49a3e8041d47c055ad60a016e7d
[]
no_license
neojarvis-testing/f8b7364d-7df3-4b49-8053-43a9c30fd7fc
https://github.com/neojarvis-testing/f8b7364d-7df3-4b49-8053-43a9c30fd7fc
57eb7e3b39e702f5b4588f4d16f4747c31c48bb9
2b96feaa49263457434bac227c06ab9c81d50d66
refs/heads/main
2023-08-22T12:01:42.469000
2021-10-09T07:31:47
2021-10-09T07:31:47
415,058,219
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.examly.springapp.model; import javax.persistence.Entity; import com.examly.springapp.model.Room; import javax.persistence.GeneratedValue; import javax.persistence.Id; import lombok.Getter; import lombok.Setter; @Getter @Setter @Entity(name="Booking") public class Booking { @Id @GeneratedValue int id; int userId; String price; int roomId; String hotelName; String hotelImageURL; String hotelAddress; int adminId; }
UTF-8
Java
479
java
Booking.java
Java
[]
null
[]
package com.examly.springapp.model; import javax.persistence.Entity; import com.examly.springapp.model.Room; import javax.persistence.GeneratedValue; import javax.persistence.Id; import lombok.Getter; import lombok.Setter; @Getter @Setter @Entity(name="Booking") public class Booking { @Id @GeneratedValue int id; int userId; String price; int roomId; String hotelName; String hotelImageURL; String hotelAddress; int adminId; }
479
0.722338
0.722338
33
13.515152
12.658979
40
false
false
0
0
0
0
0
0
0.454545
false
false
5
5b45b6f987a6af07d1672fe47152aab46da30902
19,937,238,222,783
0898ea97040acb71aafc43a740251e5248888010
/Exercicio2/src/Exercicio8.java
992afc413f2762febff65fd3fa295496e148773d
[]
no_license
Deyvisson1993/Exerc-cios
https://github.com/Deyvisson1993/Exerc-cios
53a661971d74591eb5d1fa1a347b4a6b5a287631
0df406396c2a3de58c9df94d4cf60cc4f485a85f
refs/heads/master
2021-01-10T17:07:08.471000
2015-11-16T21:45:44
2015-11-16T21:45:49
46,174,245
0
1
null
false
2015-11-30T10:52:31
2015-11-14T12:45:10
2015-11-14T14:18:56
2015-11-30T10:52:31
11,687
0
1
1
JavaScript
null
null
public class Exercicio8 { public static void main (String[]args){ String jaken_pow = "Papel"; String p1 = "Pedra"; String p2 = "Papel"; String t1 = "Tesoura"; if(p1 == jaken_pow && p2 != jaken_pow && t1 != jaken_pow ){ System.out.println("Deu empate"); }else{ if(p2 == jaken_pow && p1 != jaken_pow && t1 != jaken_pow ){ System.out.println("Papel vence"); }else{ if(t1 == jaken_pow && p1 != jaken_pow && p2 != jaken_pow){ System.out.println("Tesoura vence"); } } } } }
UTF-8
Java
552
java
Exercicio8.java
Java
[ { "context": "gs){\n\t\tString jaken_pow = \"Papel\";\n\t\tString p1 = \"Pedra\";\n\t\tString p2 = \"Papel\";\n\t\tString t1 = \"Tesoura\";", "end": 121, "score": 0.9996723532676697, "start": 116, "tag": "NAME", "value": "Pedra" }, { "context": " = \"Papel\";\n\t\tString p1 = \"Pedra\";\n\t\tString p2 = \"Papel\";\n\t\tString t1 = \"Tesoura\";\n\t\t\n\t\t\n\t\tif(p1 == jaken", "end": 144, "score": 0.9994896054267883, "start": 139, "tag": "NAME", "value": "Papel" }, { "context": " = \"Pedra\";\n\t\tString p2 = \"Papel\";\n\t\tString t1 = \"Tesoura\";\n\t\t\n\t\t\n\t\tif(p1 == jaken_pow && p2 != jaken_pow ", "end": 168, "score": 0.9019135236740112, "start": 162, "tag": "NAME", "value": "Tesour" } ]
null
[]
public class Exercicio8 { public static void main (String[]args){ String jaken_pow = "Papel"; String p1 = "Pedra"; String p2 = "Papel"; String t1 = "Tesoura"; if(p1 == jaken_pow && p2 != jaken_pow && t1 != jaken_pow ){ System.out.println("Deu empate"); }else{ if(p2 == jaken_pow && p1 != jaken_pow && t1 != jaken_pow ){ System.out.println("Papel vence"); }else{ if(t1 == jaken_pow && p1 != jaken_pow && p2 != jaken_pow){ System.out.println("Tesoura vence"); } } } } }
552
0.532609
0.509058
29
17.896551
19.867395
62
false
false
0
0
0
0
0
0
2.655172
false
false
5
1bfe177a67c55cf06e3d824a8849a7c18e4abf5f
28,097,676,078,860
d0d0c50c2dfccdd65586b8795abb729c37b34211
/s2_hackatones-back/src/test/java/co/edu/uniandes/csw/hackatones/test/logic/HackatonInteresLogicTest.java
152dfc79f3867390e5781374a1573f8be3df4556
[ "MIT" ]
permissive
sestupinan/s2_Hackatones_201920
https://github.com/sestupinan/s2_Hackatones_201920
23919bd8c8cea124a5fabbbcd1617d6ef18cb856
2c640931516cac9a94bfc4ee27f98997b2b158f9
refs/heads/master
2022-03-21T01:37:46.806000
2019-12-05T16:57:31
2019-12-05T16:57:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package co.edu.uniandes.csw.hackatones.test.logic; import co.edu.uniandes.csw.hackatones.ejb.HackatonInteresLogic; import co.edu.uniandes.csw.hackatones.ejb.HackatonLogic; import co.edu.uniandes.csw.hackatones.ejb.InteresLogic; import co.edu.uniandes.csw.hackatones.entities.HackatonEntity; import co.edu.uniandes.csw.hackatones.entities.InteresEntity; import co.edu.uniandes.csw.hackatones.exceptions.BusinessLogicException; import co.edu.uniandes.csw.hackatones.persistence.HackatonPersistence; import co.edu.uniandes.csw.hackatones.persistence.InteresPersistence; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.transaction.UserTransaction; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import uk.co.jemos.podam.api.PodamFactory; import uk.co.jemos.podam.api.PodamFactoryImpl; /** * * @author a.pedraza */ @RunWith(Arquillian.class) public class HackatonInteresLogicTest { private PodamFactory factory = new PodamFactoryImpl(); @Inject private HackatonInteresLogic hackatonInteresLogic; @Inject private InteresLogic interesLogic; @PersistenceContext private EntityManager em; @Inject private UserTransaction utx; private HackatonEntity hackaton = new HackatonEntity(); private List<InteresEntity> data = new ArrayList<>(); /** * @return Devuelve el jar que Arquillian va a desplegar en Payara embebido. * El jar contiene las clases, el descriptor de la base de datos y el * archivo beans.xml para resolver la inyección de dependencias. */ @Deployment public static JavaArchive createDeployment() { return ShrinkWrap.create(JavaArchive.class) .addPackage(HackatonEntity.class.getPackage()) .addPackage(InteresEntity.class.getPackage()) .addPackage(HackatonInteresLogic.class.getPackage()) .addPackage(HackatonPersistence.class.getPackage()) .addAsManifestResource("META-INF/persistence.xml", "persistence.xml") .addAsManifestResource("META-INF/beans.xml", "beans.xml"); } /** * Configuración inicial de la prueba. */ @Before public void configTest() { try { utx.begin(); clearData(); insertData(); utx.commit(); } catch (Exception e) { e.printStackTrace(); try { utx.rollback(); } catch (Exception e1) { e1.printStackTrace(); } } } /** * Limpia las tablas que están implicadas en la prueba. */ private void clearData() { em.createQuery("delete from HackatonEntity").executeUpdate(); em.createQuery("delete from InteresEntity").executeUpdate(); } /** * Inserta los datos iniciales para el correcto funcionamiento de las * pruebas. */ private void insertData() { hackaton = factory.manufacturePojo(HackatonEntity.class); hackaton.setId(1L); hackaton.setIntereses(new ArrayList<>()); em.persist(hackaton); for (int i = 0; i < 3; i++) { InteresEntity entity = factory.manufacturePojo(InteresEntity.class); entity.setHackatones(new ArrayList<>()); entity.getHackatones().add(hackaton); em.persist(entity); data.add(entity); hackaton.getIntereses().add(entity); } } /** * Prueba para asociar un autor a un libro. * * * @throws co.edu.uniandes.csw.interesstore.exceptions.BusinessLogicException */ @Test public void addInteresTest() throws BusinessLogicException { InteresEntity newInteres = factory.manufacturePojo(InteresEntity.class); interesLogic.createInteres(newInteres); InteresEntity interesEntity = hackatonInteresLogic.addInteres(hackaton.getId(), newInteres.getId()); Assert.assertNotNull(interesEntity); Assert.assertEquals(interesEntity.getId(), newInteres.getId()); InteresEntity lastInteres = hackatonInteresLogic.getInteres(hackaton.getId(), newInteres.getId()); Assert.assertEquals(lastInteres.getId(), newInteres.getId()); } /** * Prueba para consultar la lista de Interess de un autor. */ @Test public void getInteressTest() { List<InteresEntity> interesEntities = hackatonInteresLogic.getIntereses(hackaton.getId()); Assert.assertEquals(data.size(), interesEntities.size()); for (int i = 0; i < data.size(); i++) { Assert.assertTrue(interesEntities.contains(data.get(0))); } } /** * Prueba para cpnsultar un libro de un autor. * * @throws co.edu.uniandes.csw.interesstore.exceptions.BusinessLogicException */ @Test public void getInteresTest() throws BusinessLogicException { InteresEntity interesEntity = data.get(0); InteresEntity interes = hackatonInteresLogic.getInteres(hackaton.getId(), interesEntity.getId()); Assert.assertNotNull(interes); Assert.assertEquals(interesEntity.getId(), interes.getId()); } /** * Prueba para actualizar los libros de un autor. * * @throws co.edu.uniandes.csw.interesstore.exceptions.BusinessLogicException */ @Test public void replaceInteressTest() throws BusinessLogicException { List<InteresEntity> nuevaLista = new ArrayList<>(); for (int i = 0; i < 3; i++) { InteresEntity entity = factory.manufacturePojo(InteresEntity.class); entity.setHackatones(new ArrayList<>()); entity.getHackatones().add(hackaton); interesLogic.createInteres(entity); nuevaLista.add(entity); } hackatonInteresLogic.replaceIntereses(hackaton.getId(), nuevaLista); List<InteresEntity> interesEntities = hackatonInteresLogic.getIntereses(hackaton.getId()); for (InteresEntity aNuevaLista : nuevaLista) { Assert.assertTrue(interesEntities.contains(aNuevaLista)); } } /** * Prueba desasociar un libro con un autor. * */ @Test public void removeInteresTest() { for (InteresEntity interes : data) { hackatonInteresLogic.removeInteres(hackaton.getId(), interes.getId()); } Assert.assertTrue(hackatonInteresLogic.getIntereses(hackaton.getId()).isEmpty()); } }
UTF-8
Java
7,028
java
HackatonInteresLogicTest.java
Java
[ { "context": "mos.podam.api.PodamFactoryImpl;\n\n/**\n *\n * @author a.pedraza\n */\n@RunWith(Arquillian.class)\npublic class Hacka", "end": 1382, "score": 0.987350583076477, "start": 1373, "tag": "USERNAME", "value": "a.pedraza" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package co.edu.uniandes.csw.hackatones.test.logic; import co.edu.uniandes.csw.hackatones.ejb.HackatonInteresLogic; import co.edu.uniandes.csw.hackatones.ejb.HackatonLogic; import co.edu.uniandes.csw.hackatones.ejb.InteresLogic; import co.edu.uniandes.csw.hackatones.entities.HackatonEntity; import co.edu.uniandes.csw.hackatones.entities.InteresEntity; import co.edu.uniandes.csw.hackatones.exceptions.BusinessLogicException; import co.edu.uniandes.csw.hackatones.persistence.HackatonPersistence; import co.edu.uniandes.csw.hackatones.persistence.InteresPersistence; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.transaction.UserTransaction; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import uk.co.jemos.podam.api.PodamFactory; import uk.co.jemos.podam.api.PodamFactoryImpl; /** * * @author a.pedraza */ @RunWith(Arquillian.class) public class HackatonInteresLogicTest { private PodamFactory factory = new PodamFactoryImpl(); @Inject private HackatonInteresLogic hackatonInteresLogic; @Inject private InteresLogic interesLogic; @PersistenceContext private EntityManager em; @Inject private UserTransaction utx; private HackatonEntity hackaton = new HackatonEntity(); private List<InteresEntity> data = new ArrayList<>(); /** * @return Devuelve el jar que Arquillian va a desplegar en Payara embebido. * El jar contiene las clases, el descriptor de la base de datos y el * archivo beans.xml para resolver la inyección de dependencias. */ @Deployment public static JavaArchive createDeployment() { return ShrinkWrap.create(JavaArchive.class) .addPackage(HackatonEntity.class.getPackage()) .addPackage(InteresEntity.class.getPackage()) .addPackage(HackatonInteresLogic.class.getPackage()) .addPackage(HackatonPersistence.class.getPackage()) .addAsManifestResource("META-INF/persistence.xml", "persistence.xml") .addAsManifestResource("META-INF/beans.xml", "beans.xml"); } /** * Configuración inicial de la prueba. */ @Before public void configTest() { try { utx.begin(); clearData(); insertData(); utx.commit(); } catch (Exception e) { e.printStackTrace(); try { utx.rollback(); } catch (Exception e1) { e1.printStackTrace(); } } } /** * Limpia las tablas que están implicadas en la prueba. */ private void clearData() { em.createQuery("delete from HackatonEntity").executeUpdate(); em.createQuery("delete from InteresEntity").executeUpdate(); } /** * Inserta los datos iniciales para el correcto funcionamiento de las * pruebas. */ private void insertData() { hackaton = factory.manufacturePojo(HackatonEntity.class); hackaton.setId(1L); hackaton.setIntereses(new ArrayList<>()); em.persist(hackaton); for (int i = 0; i < 3; i++) { InteresEntity entity = factory.manufacturePojo(InteresEntity.class); entity.setHackatones(new ArrayList<>()); entity.getHackatones().add(hackaton); em.persist(entity); data.add(entity); hackaton.getIntereses().add(entity); } } /** * Prueba para asociar un autor a un libro. * * * @throws co.edu.uniandes.csw.interesstore.exceptions.BusinessLogicException */ @Test public void addInteresTest() throws BusinessLogicException { InteresEntity newInteres = factory.manufacturePojo(InteresEntity.class); interesLogic.createInteres(newInteres); InteresEntity interesEntity = hackatonInteresLogic.addInteres(hackaton.getId(), newInteres.getId()); Assert.assertNotNull(interesEntity); Assert.assertEquals(interesEntity.getId(), newInteres.getId()); InteresEntity lastInteres = hackatonInteresLogic.getInteres(hackaton.getId(), newInteres.getId()); Assert.assertEquals(lastInteres.getId(), newInteres.getId()); } /** * Prueba para consultar la lista de Interess de un autor. */ @Test public void getInteressTest() { List<InteresEntity> interesEntities = hackatonInteresLogic.getIntereses(hackaton.getId()); Assert.assertEquals(data.size(), interesEntities.size()); for (int i = 0; i < data.size(); i++) { Assert.assertTrue(interesEntities.contains(data.get(0))); } } /** * Prueba para cpnsultar un libro de un autor. * * @throws co.edu.uniandes.csw.interesstore.exceptions.BusinessLogicException */ @Test public void getInteresTest() throws BusinessLogicException { InteresEntity interesEntity = data.get(0); InteresEntity interes = hackatonInteresLogic.getInteres(hackaton.getId(), interesEntity.getId()); Assert.assertNotNull(interes); Assert.assertEquals(interesEntity.getId(), interes.getId()); } /** * Prueba para actualizar los libros de un autor. * * @throws co.edu.uniandes.csw.interesstore.exceptions.BusinessLogicException */ @Test public void replaceInteressTest() throws BusinessLogicException { List<InteresEntity> nuevaLista = new ArrayList<>(); for (int i = 0; i < 3; i++) { InteresEntity entity = factory.manufacturePojo(InteresEntity.class); entity.setHackatones(new ArrayList<>()); entity.getHackatones().add(hackaton); interesLogic.createInteres(entity); nuevaLista.add(entity); } hackatonInteresLogic.replaceIntereses(hackaton.getId(), nuevaLista); List<InteresEntity> interesEntities = hackatonInteresLogic.getIntereses(hackaton.getId()); for (InteresEntity aNuevaLista : nuevaLista) { Assert.assertTrue(interesEntities.contains(aNuevaLista)); } } /** * Prueba desasociar un libro con un autor. * */ @Test public void removeInteresTest() { for (InteresEntity interes : data) { hackatonInteresLogic.removeInteres(hackaton.getId(), interes.getId()); } Assert.assertTrue(hackatonInteresLogic.getIntereses(hackaton.getId()).isEmpty()); } }
7,028
0.67032
0.668897
204
33.436275
28.291044
108
false
false
0
0
0
0
0
0
0.480392
false
false
5
1a6de30bfb77834514aa0e7ad90893a7ed54e63c
738,734,413,199
6dadf3c65faa8196472d839dcadd62660cea5ccf
/_063/SolutionDP.java
fee9c3ef9c55b06555e807b0c2cd69342babbc76
[]
no_license
tankman-hu/studio_lc
https://github.com/tankman-hu/studio_lc
d547da00c69dc66141fc216b86043e82248f7761
c2790bdddf850cd5115d1c692f1ab92c00404677
refs/heads/master
2016-08-03T00:55:11.803000
2016-06-26T19:42:17
2016-06-26T19:42:17
58,677,379
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * @problem: 63. Unique Paths II * @author: Hu, Yue * @date: 2016.6.4 * */ package _063; public class SolutionDP { public int uniquePathsWithObstacles(int[][] obstacleGrid) { int row=obstacleGrid.length; if(row==0) return 0; int col=obstacleGrid[0].length; int[][] rec=new int[row+1][col+1]; rec[0][1]=1; for(int i=1; i<=row; i++){ for(int j=1; j<=col; j++){ if(obstacleGrid[i-1][j-1]==1) rec[i][j]=0; else rec[i][j]=rec[i-1][j]+rec[i][j-1]; } } return rec[row][col]; } public static void main(String[] args){ try{ int row=Integer.parseInt(args[0]); int col=Integer.parseInt(args[1]); if(args.length!=row*col+2) throw new Exception("Not correct number of args."); int[][] grid=new int[row][col]; for(int i=0; i<row; ++i){ for(int j=0; j<col; ++j){ grid[i][j]=Integer.parseInt(args[i*row+j+2]); } } for(int i=0; i<grid.length; i++){ for(int j=0; j<grid[0].length; j++){ System.out.print(grid[i][j]+" "); } System.out.println(); } SolutionDP sol=new SolutionDP(); System.out.println(sol.uniquePathsWithObstacles(grid)); }catch (Exception e){ e.printStackTrace(System.out); } } }
UTF-8
Java
1,551
java
SolutionDP.java
Java
[ { "context": "/*\n * @problem: 63. Unique Paths II \n * @author: Hu, Yue\n * @date: 2016.6.4\n * */\n\npackage _063;\n\npublic c", "end": 56, "score": 0.9983825087547302, "start": 49, "tag": "NAME", "value": "Hu, Yue" } ]
null
[]
/* * @problem: 63. Unique Paths II * @author: <NAME> * @date: 2016.6.4 * */ package _063; public class SolutionDP { public int uniquePathsWithObstacles(int[][] obstacleGrid) { int row=obstacleGrid.length; if(row==0) return 0; int col=obstacleGrid[0].length; int[][] rec=new int[row+1][col+1]; rec[0][1]=1; for(int i=1; i<=row; i++){ for(int j=1; j<=col; j++){ if(obstacleGrid[i-1][j-1]==1) rec[i][j]=0; else rec[i][j]=rec[i-1][j]+rec[i][j-1]; } } return rec[row][col]; } public static void main(String[] args){ try{ int row=Integer.parseInt(args[0]); int col=Integer.parseInt(args[1]); if(args.length!=row*col+2) throw new Exception("Not correct number of args."); int[][] grid=new int[row][col]; for(int i=0; i<row; ++i){ for(int j=0; j<col; ++j){ grid[i][j]=Integer.parseInt(args[i*row+j+2]); } } for(int i=0; i<grid.length; i++){ for(int j=0; j<grid[0].length; j++){ System.out.print(grid[i][j]+" "); } System.out.println(); } SolutionDP sol=new SolutionDP(); System.out.println(sol.uniquePathsWithObstacles(grid)); }catch (Exception e){ e.printStackTrace(System.out); } } }
1,550
0.45519
0.431979
54
27.722221
21.041773
90
false
false
0
0
0
0
0
0
0.592593
false
false
5
823b63cf6157a2b2cb53174a4c4afbd7e1cc3a29
7,361,573,985,256
f65c3d95a05644b82eb64122e85bb2819abea0d8
/accountmanager/src/test/java/org/accountmanager/AccountResourceTest.java
1aabe3866cc50df2dbc66568b55a70e121e6cfe8
[]
no_license
hharacic/quarkus
https://github.com/hharacic/quarkus
b405796f75cd4356732b784ef4ca89c0596e8ace
96509ebbdd6a70180f090f4694b2420f4a78090e
refs/heads/master
2022-12-03T04:45:50.884000
2020-08-25T13:53:39
2020-08-25T13:53:39
290,048,975
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.accountmanager; import static io.restassured.RestAssured.given; import javax.json.Json; import javax.json.JsonObject; import org.junit.jupiter.api.Test; import io.quarkus.test.junit.QuarkusTest; import static org.hamcrest.CoreMatchers.not; /** * Customer Resource Endpoint Tests * * @author Hamdija Haracic * @version v0.1 * @since 20.08.2020 */ @QuarkusTest public class AccountResourceTest { // SUCESS TEST: createAccount @Test void testCreateAccountEndpoint_SUCESS() { JsonObject body = Json.createObjectBuilder() .add("customerId", "1") .add("balance", "100.00") .build(); given() .contentType("application/json") .body(body) .when() .post("/accounts") .then() .statusCode(200); } // ERROR TEST: createAccount @Test void testCreateAccountEndpoint_ERROR() { JsonObject body = Json.createObjectBuilder() .add("customerId", "2") .add("balance", "100.00") .build(); given() .contentType("application/json") .body(body) .when() .post("/accounts") .then() .statusCode(not(200)); } // SUCCESS TEST: listAllAccounts @Test void testListAllAccountsEndpoint_SUCCESS() { given() .when().get("/accounts") .then() .statusCode(200); } // SUCCESS TEST: listCustomerAccounts - One Account found @Test void testListCustomerAccountsEndpoint_SUCCESS() { given() .when().get("/accounts/customeraccounts/1") .then() .statusCode(200); } // SUCCESS TEST: getAccountById - Account Found @Test void testGetAccountByIdEndpoint_SUCCESS() { given() .when().get("/accounts/1") .then() .statusCode(200); } // ERROR TEST: getAccountById - Account Not Found @Test void testGetAccountByIdEndpoint_ERROR() { given() .when().get("/accounts/2") .then() .statusCode(404); } }
UTF-8
Java
2,222
java
AccountResourceTest.java
Java
[ { "context": " * Customer Resource Endpoint Tests\n * \n * @author Hamdija Haracic\n * @version v0.1\n * @since 20.08.2020\n */\n@Quarku", "end": 328, "score": 0.9998490214347839, "start": 313, "tag": "NAME", "value": "Hamdija Haracic" } ]
null
[]
package org.accountmanager; import static io.restassured.RestAssured.given; import javax.json.Json; import javax.json.JsonObject; import org.junit.jupiter.api.Test; import io.quarkus.test.junit.QuarkusTest; import static org.hamcrest.CoreMatchers.not; /** * Customer Resource Endpoint Tests * * @author <NAME> * @version v0.1 * @since 20.08.2020 */ @QuarkusTest public class AccountResourceTest { // SUCESS TEST: createAccount @Test void testCreateAccountEndpoint_SUCESS() { JsonObject body = Json.createObjectBuilder() .add("customerId", "1") .add("balance", "100.00") .build(); given() .contentType("application/json") .body(body) .when() .post("/accounts") .then() .statusCode(200); } // ERROR TEST: createAccount @Test void testCreateAccountEndpoint_ERROR() { JsonObject body = Json.createObjectBuilder() .add("customerId", "2") .add("balance", "100.00") .build(); given() .contentType("application/json") .body(body) .when() .post("/accounts") .then() .statusCode(not(200)); } // SUCCESS TEST: listAllAccounts @Test void testListAllAccountsEndpoint_SUCCESS() { given() .when().get("/accounts") .then() .statusCode(200); } // SUCCESS TEST: listCustomerAccounts - One Account found @Test void testListCustomerAccountsEndpoint_SUCCESS() { given() .when().get("/accounts/customeraccounts/1") .then() .statusCode(200); } // SUCCESS TEST: getAccountById - Account Found @Test void testGetAccountByIdEndpoint_SUCCESS() { given() .when().get("/accounts/1") .then() .statusCode(200); } // ERROR TEST: getAccountById - Account Not Found @Test void testGetAccountByIdEndpoint_ERROR() { given() .when().get("/accounts/2") .then() .statusCode(404); } }
2,213
0.547705
0.528353
93
22.903225
17.1
61
false
false
0
0
0
0
0
0
0.204301
false
false
5
e7d17a2a1de088e501b72e155d4102c15945bd2d
12,446,815,260,913
2320f9bc1cf6589cb61587004df7b05ac7665287
/src/controller/ClientMenuController.java
1c64bda1757a93021addede6ecfd78e804c188ca
[]
no_license
AndreaGuiman/proiectlab
https://github.com/AndreaGuiman/proiectlab
6cd978063d867d32ab6a5cdca3ec2a939ebe90bf
aa4c88cd12a7de19600646937dc91310604a56aa
refs/heads/master
2023-03-04T04:33:10.862000
2021-02-11T17:09:37
2021-02-11T17:09:37
336,496,805
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controller; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.stage.Stage; import model.Books; import model.Clients; import model.Users; import service.BookService; import service.ClientService; import service.UserService; import java.io.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class ClientMenuController { @FXML Button buttonFilter; @FXML Hyperlink hyperlinkClientAccount, hyperlinkLogOut; @FXML Label username; @FXML TableView<Books> tableBooks; @FXML TableColumn<Books, String> bookNameColumn, bookGenreColumn, bookAuthorColumn; @FXML TableColumn<Books, Integer> bookRatingColumn, bookStockColumn; @FXML ChoiceBox<String> authorSelection, genreSelection; public void initialize() throws Exception { Clients clients = getClient(); username.setText(clients.getFirstNameClient() + " " + clients.getLastNameClient()); bookNameColumn.setCellValueFactory(new PropertyValueFactory<>("bookName")); bookAuthorColumn.setCellValueFactory(new PropertyValueFactory<>("authorName")); bookGenreColumn.setCellValueFactory(new PropertyValueFactory<>("bookGenre")); bookRatingColumn.setCellValueFactory(new PropertyValueFactory<>("bookRating")); bookStockColumn.setCellValueFactory(new PropertyValueFactory<>("stoc")); setDefaultTableItems(); BookService bookService = new BookService(); List<Books> booksList = bookService.getAllBooks(); List<String> authorNameList = new ArrayList<>(); List<String> bookGenreList = new ArrayList<>(); // authorNameList.add(""); // bookGenreList.add(""); for(Books booksIterator: booksList) { if (!authorNameList.contains(booksIterator.getAuthorName())) authorNameList.add(booksIterator.getAuthorName()); if(!bookGenreList.contains(booksIterator.getBookGenre())) bookGenreList.add(booksIterator.getBookGenre()); } try{ if(authorNameList.size() != 0){ authorSelection.setItems(FXCollections.observableArrayList(authorNameList)); } }catch (Exception e){ e.printStackTrace(); } try{ if(bookGenreList.size() != 0){ genreSelection.setItems(FXCollections.observableArrayList(bookGenreList)); } }catch (Exception e){ e.printStackTrace(); } // sortByRating(); // sortByRatingReverse(); } public void setDefaultTableItems(){ ObservableList<Books> booksObservableList = FXCollections.observableArrayList(getAllBooks()); tableBooks.setItems(booksObservableList); } public void setTableItems(ObservableList<Books> booksObservableList){ tableBooks.setItems(booksObservableList); } public void filterSearch(){ boolean authorSelected = false, genreSelected = false; BookService bookService = new BookService(); List<Books> booksList = bookService.getAllBooks(); ObservableList<Books> booksObservableList = FXCollections.observableArrayList(); // cand avem o optiune selectata in choice box if(authorSelection.getSelectionModel().getSelectedItem() != null){ authorSelected = true; } if(genreSelection.getSelectionModel().getSelectedItem() != null){ genreSelected = true; } if(authorSelected && genreSelected){ for(Books booksIterator: booksList) { if (booksIterator.getAuthorName().equals(authorSelection.getSelectionModel().getSelectedItem()) && booksIterator.getBookGenre().equals(genreSelection.getSelectionModel().getSelectedItem())) booksObservableList.add(booksIterator); // if(authorSelection.getSelectionModel().getSelectedItem().equals("")){ // if(booksIterator.getBookGenre().equals(genreSelection.getSelectionModel().getSelectedItem())){ // booksObservableList.add(booksIterator); // } // } // if(genreSelection.getSelectionModel().getSelectedItem().equals("")){ // if(booksIterator.getBookGenre().equals(authorSelection.getSelectionModel().getSelectedItem())){ // booksObservableList.add(booksIterator); // } // } // if (authorSelection.getSelectionModel().getSelectedItem().equals("") && // genreSelection.getSelectionModel().getSelectedItem().equals("")) // { // setDefaultTableItems(); // booksObservableList.add(null); // // } // } } if(booksObservableList.size() == 0){ setDefaultTableItems(); throw new IllegalStateException("Nu s-au gasit carti in baza de date!"); } else { setTableItems(booksObservableList); } } if(authorSelected && !genreSelected){ for(Books booksIterator:booksList){ if(booksIterator.getAuthorName().equals(authorSelection.getSelectionModel().getSelectedItem())){ booksObservableList.add(booksIterator); } } if(booksObservableList.size() == 0){ setDefaultTableItems(); throw new IllegalStateException("Nu s-au gasit carti in baza de date!"); } else { setTableItems(booksObservableList); } } if(!authorSelected && genreSelected){ for(Books booksIterator:booksList){ if(booksIterator.getBookGenre().equals(genreSelection.getSelectionModel().getSelectedItem())){ booksObservableList.add(booksIterator); } } if(booksObservableList.size() == 0){ setDefaultTableItems(); throw new IllegalStateException("Nu s-au gasit carti in baza de date!"); } else { setTableItems(booksObservableList); } } if(!authorSelected && !genreSelected){ setDefaultTableItems(); throw new IllegalStateException("Nu au fost completate campurile de filtrare!"); } // System.out.println(booksObservableList); // String authorName = authorSelection.getSelectionModel().getSelectedItem(); // System.out.println(authorName); } public List<Books> getAllBooks(){ BookService bookService = new BookService(); return bookService.getAllBooks(); } public void openBookOption() throws IOException { if(tableBooks.getSelectionModel().getSelectedItem() != null) { try(PrintWriter writer = new PrintWriter(("src/session/BookSession.txt"))){ writer.println(tableBooks.getSelectionModel().getSelectedItem().getBookName()); }catch (Exception e) { e.printStackTrace(); } String bookName = tableBooks.getSelectionModel().getSelectedItem().getBookName(); System.out.println(tableBooks.getSelectionModel().getSelectedItem()); tableBooks.getScene().getWindow().hide(); Parent root = FXMLLoader.load(getClass().getResource("../scene/BookOption.fxml")); Stage bookOption = new Stage(); bookOption.setScene(new Scene(root)); bookOption.setTitle(bookName); bookOption.show(); } } public void goToAccountDetails() throws IOException { hyperlinkClientAccount.getScene().getWindow().hide(); Parent root = FXMLLoader.load(getClass().getResource("../scene/ClientAccount.fxml")); Stage accountDetails = new Stage(); accountDetails.setScene(new Scene(root)); accountDetails.setTitle("ACCOUNT DETAILS"); accountDetails.show(); } public void logOutAction() throws IOException { hyperlinkLogOut.getScene().getWindow().hide(); Parent root = FXMLLoader.load(getClass().getResource("../scene/Login.fxml")); Stage login = new Stage(); login.setScene(new Scene(root)); login.setTitle("LOGIN"); login.show(); } //sortare carti, dupa ratingul cartilor //ascendent public void sortByRating(){ BookService bookService = new BookService(); List<Books> booksList = bookService.getAllBooks(); System.out.println(booksList); Collections.sort(booksList); System.out.println(booksList); } //descendent public void sortByRatingReverse() { BookService bookService = new BookService(); List<Books> booksList = bookService.getAllBooks(); System.out.println(booksList); Collections.sort(booksList); Collections.reverse(booksList); System.out.println(booksList); } public String getUsernameClient(){ String username = null; try(BufferedReader br = new BufferedReader(new FileReader("src/session/Session.txt"))){ String usernameTmp; while((usernameTmp = br.readLine()) != null) username = usernameTmp; }catch (Exception e){ e.printStackTrace(); } return username; } public Clients getClient() throws Exception { String usernameTmp = getUsernameClient(); UserService userService = new UserService(); Users users = userService.findByUsername(usernameTmp); ClientService clientService = new ClientService(); return clientService.findById(users.getIdClient()); } }
UTF-8
Java
10,115
java
ClientMenuController.java
Java
[ { "context": "br.readLine()) != null)\n username = usernameTmp;\n }catch (Exception e){\n e.p", "end": 9662, "score": 0.6354228854179382, "start": 9654, "tag": "USERNAME", "value": "username" }, { "context": "\n Users users = userService.findByUsername(usernameTmp);\n ClientService clientService = new Clien", "end": 9985, "score": 0.8813126683235168, "start": 9974, "tag": "USERNAME", "value": "usernameTmp" } ]
null
[]
package controller; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.*; import javafx.scene.control.cell.PropertyValueFactory; import javafx.stage.Stage; import model.Books; import model.Clients; import model.Users; import service.BookService; import service.ClientService; import service.UserService; import java.io.*; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class ClientMenuController { @FXML Button buttonFilter; @FXML Hyperlink hyperlinkClientAccount, hyperlinkLogOut; @FXML Label username; @FXML TableView<Books> tableBooks; @FXML TableColumn<Books, String> bookNameColumn, bookGenreColumn, bookAuthorColumn; @FXML TableColumn<Books, Integer> bookRatingColumn, bookStockColumn; @FXML ChoiceBox<String> authorSelection, genreSelection; public void initialize() throws Exception { Clients clients = getClient(); username.setText(clients.getFirstNameClient() + " " + clients.getLastNameClient()); bookNameColumn.setCellValueFactory(new PropertyValueFactory<>("bookName")); bookAuthorColumn.setCellValueFactory(new PropertyValueFactory<>("authorName")); bookGenreColumn.setCellValueFactory(new PropertyValueFactory<>("bookGenre")); bookRatingColumn.setCellValueFactory(new PropertyValueFactory<>("bookRating")); bookStockColumn.setCellValueFactory(new PropertyValueFactory<>("stoc")); setDefaultTableItems(); BookService bookService = new BookService(); List<Books> booksList = bookService.getAllBooks(); List<String> authorNameList = new ArrayList<>(); List<String> bookGenreList = new ArrayList<>(); // authorNameList.add(""); // bookGenreList.add(""); for(Books booksIterator: booksList) { if (!authorNameList.contains(booksIterator.getAuthorName())) authorNameList.add(booksIterator.getAuthorName()); if(!bookGenreList.contains(booksIterator.getBookGenre())) bookGenreList.add(booksIterator.getBookGenre()); } try{ if(authorNameList.size() != 0){ authorSelection.setItems(FXCollections.observableArrayList(authorNameList)); } }catch (Exception e){ e.printStackTrace(); } try{ if(bookGenreList.size() != 0){ genreSelection.setItems(FXCollections.observableArrayList(bookGenreList)); } }catch (Exception e){ e.printStackTrace(); } // sortByRating(); // sortByRatingReverse(); } public void setDefaultTableItems(){ ObservableList<Books> booksObservableList = FXCollections.observableArrayList(getAllBooks()); tableBooks.setItems(booksObservableList); } public void setTableItems(ObservableList<Books> booksObservableList){ tableBooks.setItems(booksObservableList); } public void filterSearch(){ boolean authorSelected = false, genreSelected = false; BookService bookService = new BookService(); List<Books> booksList = bookService.getAllBooks(); ObservableList<Books> booksObservableList = FXCollections.observableArrayList(); // cand avem o optiune selectata in choice box if(authorSelection.getSelectionModel().getSelectedItem() != null){ authorSelected = true; } if(genreSelection.getSelectionModel().getSelectedItem() != null){ genreSelected = true; } if(authorSelected && genreSelected){ for(Books booksIterator: booksList) { if (booksIterator.getAuthorName().equals(authorSelection.getSelectionModel().getSelectedItem()) && booksIterator.getBookGenre().equals(genreSelection.getSelectionModel().getSelectedItem())) booksObservableList.add(booksIterator); // if(authorSelection.getSelectionModel().getSelectedItem().equals("")){ // if(booksIterator.getBookGenre().equals(genreSelection.getSelectionModel().getSelectedItem())){ // booksObservableList.add(booksIterator); // } // } // if(genreSelection.getSelectionModel().getSelectedItem().equals("")){ // if(booksIterator.getBookGenre().equals(authorSelection.getSelectionModel().getSelectedItem())){ // booksObservableList.add(booksIterator); // } // } // if (authorSelection.getSelectionModel().getSelectedItem().equals("") && // genreSelection.getSelectionModel().getSelectedItem().equals("")) // { // setDefaultTableItems(); // booksObservableList.add(null); // // } // } } if(booksObservableList.size() == 0){ setDefaultTableItems(); throw new IllegalStateException("Nu s-au gasit carti in baza de date!"); } else { setTableItems(booksObservableList); } } if(authorSelected && !genreSelected){ for(Books booksIterator:booksList){ if(booksIterator.getAuthorName().equals(authorSelection.getSelectionModel().getSelectedItem())){ booksObservableList.add(booksIterator); } } if(booksObservableList.size() == 0){ setDefaultTableItems(); throw new IllegalStateException("Nu s-au gasit carti in baza de date!"); } else { setTableItems(booksObservableList); } } if(!authorSelected && genreSelected){ for(Books booksIterator:booksList){ if(booksIterator.getBookGenre().equals(genreSelection.getSelectionModel().getSelectedItem())){ booksObservableList.add(booksIterator); } } if(booksObservableList.size() == 0){ setDefaultTableItems(); throw new IllegalStateException("Nu s-au gasit carti in baza de date!"); } else { setTableItems(booksObservableList); } } if(!authorSelected && !genreSelected){ setDefaultTableItems(); throw new IllegalStateException("Nu au fost completate campurile de filtrare!"); } // System.out.println(booksObservableList); // String authorName = authorSelection.getSelectionModel().getSelectedItem(); // System.out.println(authorName); } public List<Books> getAllBooks(){ BookService bookService = new BookService(); return bookService.getAllBooks(); } public void openBookOption() throws IOException { if(tableBooks.getSelectionModel().getSelectedItem() != null) { try(PrintWriter writer = new PrintWriter(("src/session/BookSession.txt"))){ writer.println(tableBooks.getSelectionModel().getSelectedItem().getBookName()); }catch (Exception e) { e.printStackTrace(); } String bookName = tableBooks.getSelectionModel().getSelectedItem().getBookName(); System.out.println(tableBooks.getSelectionModel().getSelectedItem()); tableBooks.getScene().getWindow().hide(); Parent root = FXMLLoader.load(getClass().getResource("../scene/BookOption.fxml")); Stage bookOption = new Stage(); bookOption.setScene(new Scene(root)); bookOption.setTitle(bookName); bookOption.show(); } } public void goToAccountDetails() throws IOException { hyperlinkClientAccount.getScene().getWindow().hide(); Parent root = FXMLLoader.load(getClass().getResource("../scene/ClientAccount.fxml")); Stage accountDetails = new Stage(); accountDetails.setScene(new Scene(root)); accountDetails.setTitle("ACCOUNT DETAILS"); accountDetails.show(); } public void logOutAction() throws IOException { hyperlinkLogOut.getScene().getWindow().hide(); Parent root = FXMLLoader.load(getClass().getResource("../scene/Login.fxml")); Stage login = new Stage(); login.setScene(new Scene(root)); login.setTitle("LOGIN"); login.show(); } //sortare carti, dupa ratingul cartilor //ascendent public void sortByRating(){ BookService bookService = new BookService(); List<Books> booksList = bookService.getAllBooks(); System.out.println(booksList); Collections.sort(booksList); System.out.println(booksList); } //descendent public void sortByRatingReverse() { BookService bookService = new BookService(); List<Books> booksList = bookService.getAllBooks(); System.out.println(booksList); Collections.sort(booksList); Collections.reverse(booksList); System.out.println(booksList); } public String getUsernameClient(){ String username = null; try(BufferedReader br = new BufferedReader(new FileReader("src/session/Session.txt"))){ String usernameTmp; while((usernameTmp = br.readLine()) != null) username = usernameTmp; }catch (Exception e){ e.printStackTrace(); } return username; } public Clients getClient() throws Exception { String usernameTmp = getUsernameClient(); UserService userService = new UserService(); Users users = userService.findByUsername(usernameTmp); ClientService clientService = new ClientService(); return clientService.findById(users.getIdClient()); } }
10,115
0.625408
0.624914
263
37.460075
29.045483
117
false
false
0
0
0
0
0
0
0.505703
false
false
5
854218f2cff3a4c3611a0d17ae3fc5dc0d42abeb
22,823,456,246,179
19bb8e34fcc1e64b5ea743decd192dc640a67b0b
/app/src/main/java/io/github/kolacbb/kolaweibo/ui/adapter/BaseSwipeLoadingAdapter.java
d2348c555cfadce48e3a67a963b84670a68cd018
[]
no_license
kolacbb/KolaWeibo
https://github.com/kolacbb/KolaWeibo
85b4631f705d694ccac8cef47fb4000612b32ae3
49fb8fa537eb9544021a52c56f10ca2394d2c250
refs/heads/master
2020-12-31T02:22:48.510000
2017-01-22T10:00:36
2017-01-22T10:00:36
68,525,510
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.github.kolacbb.kolaweibo.ui.adapter; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import java.util.LinkedList; import java.util.List; import io.github.kolacbb.kolaweibo.widget.LoadingView; /** * Created by zhangli on 2016/10/3. */ public abstract class BaseSwipeLoadingAdapter<T> extends RecyclerView.Adapter { private static final int TYPE_LOADING = 0x31; private LinkedList<T> mData = new LinkedList<>(); private boolean mHasLoadingView = true; private LoadingView mLoadingView; @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == TYPE_LOADING) { mLoadingView = new LoadingView(parent.getContext()); RecyclerView.LayoutParams params = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); mLoadingView.setLayoutParams(params); //parent.addView(mLoadingView); return new LoadingVH(mLoadingView); } return onCreateVH(parent, viewType); } public abstract RecyclerView.ViewHolder onCreateVH(ViewGroup parent, int viewType); @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (mHasLoadingView && position == getItemCount() - 1) { return; } onBindVH(holder, position); } public abstract void onBindVH(RecyclerView.ViewHolder holder, int position); public void setData(LinkedList<T> date) { mData = date; } public void addToFront(List<T> list) { mData.addAll(0, list); } public void addToRear(List<T> list) { mData.addAll(list); } public void remove(T t) { mData.remove(t); } public T get(int position) { return mData.get(position); } public List<T> getData() { return mData; } public void setShowLoadingView(boolean show) { mHasLoadingView = show; } public void setLoading(boolean loading) { if (mLoadingView != null) { mLoadingView.setLoading(loading); } } @Override public int getItemViewType(int position) { if (position == getItemCount() - 1) { return TYPE_LOADING; } return super.getItemViewType(position); } @Override public int getItemCount() { return mHasLoadingView ? mData.size() + 1 : mData.size(); } class LoadingVH extends RecyclerView.ViewHolder { //public ContentLoadingProgressBar progressBar; public LoadingVH(View itemView) { super(itemView); //progressBar = (ContentLoadingProgressBar) itemView.findViewById(R.id.loading_bar); } } interface OnItemClickedListener { void onItemClicked(View v, int position); } }
UTF-8
Java
3,031
java
BaseSwipeLoadingAdapter.java
Java
[ { "context": "package io.github.kolacbb.kolaweibo.ui.adapter;\r\n\r\nimport android.support.v", "end": 25, "score": 0.9459209442138672, "start": 18, "tag": "USERNAME", "value": "kolacbb" }, { "context": "List;\r\nimport java.util.List;\r\n\r\nimport io.github.kolacbb.kolaweibo.widget.LoadingView;\r\n\r\n/**\r\n * Created ", "end": 240, "score": 0.9687116146087646, "start": 233, "tag": "USERNAME", "value": "kolacbb" }, { "context": "olaweibo.widget.LoadingView;\r\n\r\n/**\r\n * Created by zhangli on 2016/10/3.\r\n */\r\n\r\npublic abstract class BaseS", "end": 300, "score": 0.9995689392089844, "start": 293, "tag": "USERNAME", "value": "zhangli" } ]
null
[]
package io.github.kolacbb.kolaweibo.ui.adapter; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import java.util.LinkedList; import java.util.List; import io.github.kolacbb.kolaweibo.widget.LoadingView; /** * Created by zhangli on 2016/10/3. */ public abstract class BaseSwipeLoadingAdapter<T> extends RecyclerView.Adapter { private static final int TYPE_LOADING = 0x31; private LinkedList<T> mData = new LinkedList<>(); private boolean mHasLoadingView = true; private LoadingView mLoadingView; @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == TYPE_LOADING) { mLoadingView = new LoadingView(parent.getContext()); RecyclerView.LayoutParams params = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); mLoadingView.setLayoutParams(params); //parent.addView(mLoadingView); return new LoadingVH(mLoadingView); } return onCreateVH(parent, viewType); } public abstract RecyclerView.ViewHolder onCreateVH(ViewGroup parent, int viewType); @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (mHasLoadingView && position == getItemCount() - 1) { return; } onBindVH(holder, position); } public abstract void onBindVH(RecyclerView.ViewHolder holder, int position); public void setData(LinkedList<T> date) { mData = date; } public void addToFront(List<T> list) { mData.addAll(0, list); } public void addToRear(List<T> list) { mData.addAll(list); } public void remove(T t) { mData.remove(t); } public T get(int position) { return mData.get(position); } public List<T> getData() { return mData; } public void setShowLoadingView(boolean show) { mHasLoadingView = show; } public void setLoading(boolean loading) { if (mLoadingView != null) { mLoadingView.setLoading(loading); } } @Override public int getItemViewType(int position) { if (position == getItemCount() - 1) { return TYPE_LOADING; } return super.getItemViewType(position); } @Override public int getItemCount() { return mHasLoadingView ? mData.size() + 1 : mData.size(); } class LoadingVH extends RecyclerView.ViewHolder { //public ContentLoadingProgressBar progressBar; public LoadingVH(View itemView) { super(itemView); //progressBar = (ContentLoadingProgressBar) itemView.findViewById(R.id.loading_bar); } } interface OnItemClickedListener { void onItemClicked(View v, int position); } }
3,031
0.632135
0.627186
106
26.594339
27.121244
151
false
false
0
0
0
0
0
0
0.424528
false
false
5
70d01b2d20c45a59313c1ec59b54f1bd0daaa9b8
3,693,671,909,957
9d0159e31a3f78aba508a0ad3cf4aa128ddc64d3
/src/main/java/net/minecraft/block/BlockStaticLiquid.java
0b02b8837abaec28cf1e5a6430cb569c231c5aa2
[]
no_license
Stawlker/UprizingClient
https://github.com/Stawlker/UprizingClient
0a8cb1da11b1bc0906bb3f145eafa35aac38c96c
c6e721b4e714f3bcabecfdea10efbc9ca59a621a
refs/heads/master
2020-03-18T17:02:55.703000
2019-09-29T23:51:49
2019-09-29T23:51:49
135,002,545
5
6
null
false
2018-06-09T19:05:06
2018-05-26T23:53:33
2018-06-03T19:00:08
2018-06-09T19:05:05
5,411
3
0
0
Java
false
null
package net.minecraft.block; import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.world.World; public class BlockStaticLiquid extends BlockLiquid { protected BlockStaticLiquid(Material p_i45429_1_) { super(p_i45429_1_); this.setTickRandomly(false); if (p_i45429_1_ == Material.lava) { this.setTickRandomly(true); } } public void onNeighborBlockChange(World worldIn, int x, int y, int z, Block neighbor) { super.onNeighborBlockChange(worldIn, x, y, z, neighbor); if (worldIn.getBlock(x, y, z) == this) { this.setNotStationary(worldIn, x, y, z); } } private void setNotStationary(World p_149818_1_, int p_149818_2_, int p_149818_3_, int p_149818_4_) { int var5 = p_149818_1_.getBlockMetadata(p_149818_2_, p_149818_3_, p_149818_4_); p_149818_1_.setBlock(p_149818_2_, p_149818_3_, p_149818_4_, Block.getBlockById(Block.getIdFromBlock(this) - 1), var5, 2); p_149818_1_.scheduleBlockUpdate(p_149818_2_, p_149818_3_, p_149818_4_, Block.getBlockById(Block.getIdFromBlock(this) - 1), this.tickRate(p_149818_1_)); } /** * Ticks the block if it's been scheduled */ public void updateTick(World worldIn, int x, int y, int z, Random random) { if (this.blockMaterial == Material.lava) { int var6 = random.nextInt(3); int var7; for (var7 = 0; var7 < var6; ++var7) { x += random.nextInt(3) - 1; ++y; z += random.nextInt(3) - 1; Block var8 = worldIn.getBlock(x, y, z); if (var8.blockMaterial == Material.air) { if (this.isFlammable(worldIn, x - 1, y, z) || this.isFlammable(worldIn, x + 1, y, z) || this.isFlammable(worldIn, x, y, z - 1) || this.isFlammable(worldIn, x, y, z + 1) || this.isFlammable(worldIn, x, y - 1, z) || this.isFlammable(worldIn, x, y + 1, z)) { worldIn.setBlock(x, y, z, Blocks.fire); return; } } else if (var8.blockMaterial.blocksMovement()) { return; } } if (var6 == 0) { var7 = x; int var10 = z; for (int var9 = 0; var9 < 3; ++var9) { x = var7 + random.nextInt(3) - 1; z = var10 + random.nextInt(3) - 1; if (worldIn.isAirBlock(x, y + 1, z) && this.isFlammable(worldIn, x, y, z)) { worldIn.setBlock(x, y + 1, z, Blocks.fire); } } } } } private boolean isFlammable(World p_149817_1_, int p_149817_2_, int p_149817_3_, int p_149817_4_) { return p_149817_1_.getBlock(p_149817_2_, p_149817_3_, p_149817_4_).getMaterial().getCanBurn(); } }
UTF-8
Java
3,142
java
BlockStaticLiquid.java
Java
[]
null
[]
package net.minecraft.block; import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.world.World; public class BlockStaticLiquid extends BlockLiquid { protected BlockStaticLiquid(Material p_i45429_1_) { super(p_i45429_1_); this.setTickRandomly(false); if (p_i45429_1_ == Material.lava) { this.setTickRandomly(true); } } public void onNeighborBlockChange(World worldIn, int x, int y, int z, Block neighbor) { super.onNeighborBlockChange(worldIn, x, y, z, neighbor); if (worldIn.getBlock(x, y, z) == this) { this.setNotStationary(worldIn, x, y, z); } } private void setNotStationary(World p_149818_1_, int p_149818_2_, int p_149818_3_, int p_149818_4_) { int var5 = p_149818_1_.getBlockMetadata(p_149818_2_, p_149818_3_, p_149818_4_); p_149818_1_.setBlock(p_149818_2_, p_149818_3_, p_149818_4_, Block.getBlockById(Block.getIdFromBlock(this) - 1), var5, 2); p_149818_1_.scheduleBlockUpdate(p_149818_2_, p_149818_3_, p_149818_4_, Block.getBlockById(Block.getIdFromBlock(this) - 1), this.tickRate(p_149818_1_)); } /** * Ticks the block if it's been scheduled */ public void updateTick(World worldIn, int x, int y, int z, Random random) { if (this.blockMaterial == Material.lava) { int var6 = random.nextInt(3); int var7; for (var7 = 0; var7 < var6; ++var7) { x += random.nextInt(3) - 1; ++y; z += random.nextInt(3) - 1; Block var8 = worldIn.getBlock(x, y, z); if (var8.blockMaterial == Material.air) { if (this.isFlammable(worldIn, x - 1, y, z) || this.isFlammable(worldIn, x + 1, y, z) || this.isFlammable(worldIn, x, y, z - 1) || this.isFlammable(worldIn, x, y, z + 1) || this.isFlammable(worldIn, x, y - 1, z) || this.isFlammable(worldIn, x, y + 1, z)) { worldIn.setBlock(x, y, z, Blocks.fire); return; } } else if (var8.blockMaterial.blocksMovement()) { return; } } if (var6 == 0) { var7 = x; int var10 = z; for (int var9 = 0; var9 < 3; ++var9) { x = var7 + random.nextInt(3) - 1; z = var10 + random.nextInt(3) - 1; if (worldIn.isAirBlock(x, y + 1, z) && this.isFlammable(worldIn, x, y, z)) { worldIn.setBlock(x, y + 1, z, Blocks.fire); } } } } } private boolean isFlammable(World p_149817_1_, int p_149817_2_, int p_149817_3_, int p_149817_4_) { return p_149817_1_.getBlock(p_149817_2_, p_149817_3_, p_149817_4_).getMaterial().getCanBurn(); } }
3,142
0.505729
0.429981
93
32.7957
40.324638
273
false
false
0
0
0
0
0
0
1.172043
false
false
5
9bc231630c6a7fc0a871c33c46fa29bf7f3dd326
32,779,190,443,717
24675eba707f1a2f2ff45b4e892d310e1096563f
/4. EAsit4all/easit4all/core/src/main/java/org/easit/core/controllers/facebook/UploadItem.java
57face9934814d118fb131cae1f7a6f2535b8200
[ "BSD-3-Clause" ]
permissive
marcelbdigital/SecurityGateway
https://github.com/marcelbdigital/SecurityGateway
b4b82210c93f513c5f2f8dfe3e8f79ee0b96f96f
afdd0b3b20a75744f4306dffb8faadbfc850354b
refs/heads/master
2021-01-01T05:50:04.939000
2013-11-04T15:39:59
2013-11-04T15:39:59
14,106,143
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.easit.core.controllers.facebook; import org.springframework.web.multipart.commons.CommonsMultipartFile; public class UploadItem { private String caption; private String title; private CommonsMultipartFile fileData; public String getCaption() { return caption; } public void setCaption(String caption) { this.caption = caption; } public CommonsMultipartFile getFileData() { return fileData; } public void setFileData(CommonsMultipartFile fileData) { this.fileData = fileData; } public String getTitle() { // TODO Auto-generated method stub return title; } public void setTitle(String title) { this.title = title; } }
UTF-8
Java
705
java
UploadItem.java
Java
[]
null
[]
package org.easit.core.controllers.facebook; import org.springframework.web.multipart.commons.CommonsMultipartFile; public class UploadItem { private String caption; private String title; private CommonsMultipartFile fileData; public String getCaption() { return caption; } public void setCaption(String caption) { this.caption = caption; } public CommonsMultipartFile getFileData() { return fileData; } public void setFileData(CommonsMultipartFile fileData) { this.fileData = fileData; } public String getTitle() { // TODO Auto-generated method stub return title; } public void setTitle(String title) { this.title = title; } }
705
0.712057
0.712057
36
18.583334
19.137478
70
false
false
0
0
0
0
0
0
0.5
false
false
5
6c1d840ac5588599801b3d5c156208ff5ce5de54
13,322,988,596,534
6cccbbd7c647a7168b55f3c54f0372df81e83620
/userservice/src/main/java/com/yesmywine/user/controller/VipController.java
002b1e5cc4554955f86e16aa8c8e780a6ed13523
[]
no_license
Loeng/yesmywine_ms
https://github.com/Loeng/yesmywine_ms
4dd111edeabefd3a813a7e59837862b660e1085c
207e6d1f352172999649ba324f07aeb68953f9d6
refs/heads/master
2021-10-20T03:56:03.729000
2019-02-25T15:34:25
2019-02-25T15:34:25
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yesmywine.user.controller; import com.yesmywine.base.record.bean.PageModel; import com.yesmywine.user.dao.UserInformationDao; import com.yesmywine.user.entity.UserInformation; import com.yesmywine.user.entity.VipRule; import com.yesmywine.user.service.UserInformationService; import com.yesmywine.user.service.UserLevelService; import com.yesmywine.util.basic.Threads; import com.yesmywine.util.basic.ValueUtil; import com.yesmywine.util.date.DateUtil; import com.yesmywine.util.error.YesmywineException; import org.apache.http.HttpStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.Map; /** * Created by ${shuang} on 2016/12/22. */ @RestController @RequestMapping("/userservice/viplevel") public class VipController { @Autowired private UserLevelService userLevelService; @Autowired private UserInformationService userInformationService; @Autowired private UserInformationDao userInformationDao; @RequestMapping(value = "/task",method = RequestMethod.GET) public String keep() {//保级降级 try { System.out.println("=============================每日凌晨计算用户等级 开始================================"); userLevelService.voluntarily(); System.out.println("=============================每日凌晨计算用户等级 结束================================"); return ValueUtil.toJson("每日凌晨计算用户等级 "+ DateUtil.getNowTime()); } catch (YesmywineException e) { Threads.createExceptionFile("userservice",e.getMessage()); return ValueUtil.toError(e.getCode(),"每日凌晨计算用户等级 "+ DateUtil.getNowTime()+" " +e.getMessage()); } } // @Description 查询列表 @RequestMapping( method = RequestMethod.GET) public String index(@RequestParam Map<String, String> params, Integer pageNo, Integer pageSize,Integer userId,Integer levelId) { if(ValueUtil.isEmpity(levelId)&&ValueUtil.isEmpity(userId)){ if(null!=params.get("all")&&params.get("all").toString().equals("true")){ return ValueUtil.toJson(userInformationService.findAll()); }else if(null!=params.get("all")){ params.remove(params.remove("all").toString()); } PageModel pageModel = new PageModel(pageNo == null ? 1 : pageNo, pageSize == null ? 10 : pageSize); if (null != params.get("showFields")) { pageModel.setFields(params.remove("showFields").toString()); } if (pageNo != null) params.remove(params.remove("pageNo").toString()); if (pageSize != null) params.remove(params.remove("pageSize").toString()); if(userId==null) { params.remove(params.remove("userId").toString()); } if(levelId==null) { params.remove(params.remove("levelId").toString()); } pageModel.addCondition(params); pageModel = userInformationService.findAll(pageModel); return ValueUtil.toJson(pageModel); }else { VipRule vipRule = new VipRule(); vipRule.setId(levelId); UserInformation userInformation = userInformationDao.findByIdAndVipRule(userId,vipRule); return ValueUtil.toJson(HttpStatus.SC_CREATED,userInformation); } } }
UTF-8
Java
3,698
java
VipController.java
Java
[ { "context": "ller;\n\nimport java.util.Map;\n\n/**\n * Created by ${shuang} on 2016/12/22.\n */\n@RestController\n@RequestMappi", "end": 915, "score": 0.9833494424819946, "start": 909, "tag": "USERNAME", "value": "shuang" } ]
null
[]
package com.yesmywine.user.controller; import com.yesmywine.base.record.bean.PageModel; import com.yesmywine.user.dao.UserInformationDao; import com.yesmywine.user.entity.UserInformation; import com.yesmywine.user.entity.VipRule; import com.yesmywine.user.service.UserInformationService; import com.yesmywine.user.service.UserLevelService; import com.yesmywine.util.basic.Threads; import com.yesmywine.util.basic.ValueUtil; import com.yesmywine.util.date.DateUtil; import com.yesmywine.util.error.YesmywineException; import org.apache.http.HttpStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.Map; /** * Created by ${shuang} on 2016/12/22. */ @RestController @RequestMapping("/userservice/viplevel") public class VipController { @Autowired private UserLevelService userLevelService; @Autowired private UserInformationService userInformationService; @Autowired private UserInformationDao userInformationDao; @RequestMapping(value = "/task",method = RequestMethod.GET) public String keep() {//保级降级 try { System.out.println("=============================每日凌晨计算用户等级 开始================================"); userLevelService.voluntarily(); System.out.println("=============================每日凌晨计算用户等级 结束================================"); return ValueUtil.toJson("每日凌晨计算用户等级 "+ DateUtil.getNowTime()); } catch (YesmywineException e) { Threads.createExceptionFile("userservice",e.getMessage()); return ValueUtil.toError(e.getCode(),"每日凌晨计算用户等级 "+ DateUtil.getNowTime()+" " +e.getMessage()); } } // @Description 查询列表 @RequestMapping( method = RequestMethod.GET) public String index(@RequestParam Map<String, String> params, Integer pageNo, Integer pageSize,Integer userId,Integer levelId) { if(ValueUtil.isEmpity(levelId)&&ValueUtil.isEmpity(userId)){ if(null!=params.get("all")&&params.get("all").toString().equals("true")){ return ValueUtil.toJson(userInformationService.findAll()); }else if(null!=params.get("all")){ params.remove(params.remove("all").toString()); } PageModel pageModel = new PageModel(pageNo == null ? 1 : pageNo, pageSize == null ? 10 : pageSize); if (null != params.get("showFields")) { pageModel.setFields(params.remove("showFields").toString()); } if (pageNo != null) params.remove(params.remove("pageNo").toString()); if (pageSize != null) params.remove(params.remove("pageSize").toString()); if(userId==null) { params.remove(params.remove("userId").toString()); } if(levelId==null) { params.remove(params.remove("levelId").toString()); } pageModel.addCondition(params); pageModel = userInformationService.findAll(pageModel); return ValueUtil.toJson(pageModel); }else { VipRule vipRule = new VipRule(); vipRule.setId(levelId); UserInformation userInformation = userInformationDao.findByIdAndVipRule(userId,vipRule); return ValueUtil.toJson(HttpStatus.SC_CREATED,userInformation); } } }
3,698
0.653311
0.65025
83
42.301205
31.386719
132
false
false
0
0
0
0
0
0
0.638554
false
false
5
1f8131295e0f11c2e3cc0832784184e8fd94bddf
34,703,335,786,867
35e4dfb9f6782426e73430a911ec328c38011503
/riot-api-aggregators/src/main/java/ninja/onewaysidewalks/riotapi/urf/matches/shared/MatchRecordedMessage.java
0f81b4c29f35c65369b3a432fbfeed6d2e666803
[]
no_license
Onewaysidewalks/fantasy_nurf
https://github.com/Onewaysidewalks/fantasy_nurf
c4b861f9864f5af00d88c60e65009b726f7a2ae0
e5dfd43db0995b71331f11fe29a395a1001f57f9
refs/heads/master
2020-04-19T09:44:45.003000
2015-04-20T12:05:17
2015-04-20T12:06:40
33,212,579
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ninja.onewaysidewalks.riotapi.urf.matches.shared; import lombok.Data; @Data public class MatchRecordedMessage { private Long matchId; private Long matchCreationMillis; }
UTF-8
Java
188
java
MatchRecordedMessage.java
Java
[]
null
[]
package ninja.onewaysidewalks.riotapi.urf.matches.shared; import lombok.Data; @Data public class MatchRecordedMessage { private Long matchId; private Long matchCreationMillis; }
188
0.792553
0.792553
9
19.888889
19.133707
57
false
false
0
0
0
0
0
0
0.444444
false
false
9
698c1ff7bef8c8e3b79d7c82c0c935ac31e6be9e
34,299,608,871,087
5e6974ddf224090a649c0c2726455a973c9fc739
/phase1-data/src/main/java/edu/gemini/tac/persistence/util/Conversion.java
02d1fb2600ad2787ad613f272acabc2a51c520d9
[]
no_license
shimaomao/itac
https://github.com/shimaomao/itac
12e22b8985ecbddd29238e6440cafeb193aeed53
3ab473e129af1bad14377b3d3ac32e9405599d30
refs/heads/master
2020-06-19T23:30:57.131000
2019-05-17T17:17:50
2019-05-17T17:17:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.gemini.tac.persistence.util; import org.apache.log4j.Logger; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; import java.util.Date; import java.util.GregorianCalendar; public class Conversion { protected static final Logger LOGGER = Logger.getLogger(Conversion.class.getName()); protected Conversion() {} public static final XMLGregorianCalendar dateToXmlGregorian(final Date date) { GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date); try { return DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar); } catch (Exception e) { LOGGER.error("Configuration problem when converting from date[" + date.toString() + "] to XML calendar.", e); throw new RuntimeException("Unable to get instance of datatype xml gregorian calendar for conversion."); } } }
UTF-8
Java
937
java
Conversion.java
Java
[]
null
[]
package edu.gemini.tac.persistence.util; import org.apache.log4j.Logger; import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; import java.util.Date; import java.util.GregorianCalendar; public class Conversion { protected static final Logger LOGGER = Logger.getLogger(Conversion.class.getName()); protected Conversion() {} public static final XMLGregorianCalendar dateToXmlGregorian(final Date date) { GregorianCalendar calendar = new GregorianCalendar(); calendar.setTime(date); try { return DatatypeFactory.newInstance().newXMLGregorianCalendar(calendar); } catch (Exception e) { LOGGER.error("Configuration problem when converting from date[" + date.toString() + "] to XML calendar.", e); throw new RuntimeException("Unable to get instance of datatype xml gregorian calendar for conversion."); } } }
937
0.720384
0.719317
25
36.48
35.67197
121
false
false
0
0
0
0
0
0
0.52
false
false
9
67c48deeaf51e87a7c18e7ce2fe6e579325ad4f7
35,321,811,085,653
b706cc7d5e2daf746e8abfa11d32ca62425b59e5
/framework/src/main/java/com/aaa/olb/automation/framework/LocationKind.java
f17995d0ab39e8158d4d8f319e16b165dee844ec
[]
no_license
sinnkirou/Keyword-Automation
https://github.com/sinnkirou/Keyword-Automation
60ea4c4e711dbc82ba947179f8bb0f2361681d18
4a9c47f74f0006c654aa9b659b8b269f71eaaf36
refs/heads/master
2021-06-07T20:46:43.606000
2020-06-30T07:26:50
2020-06-30T07:26:50
167,325,307
0
0
null
false
2021-06-04T02:01:43
2019-01-24T07:45:30
2020-06-30T07:26:53
2021-06-04T02:01:42
35,820
0
0
2
Java
false
false
package com.aaa.olb.automation.framework; public enum LocationKind { ID, CSS, XPATH, CLASSNAME, TAG, LINKTEXT, PARTIALLINKTEXT, NAME }
UTF-8
Java
137
java
LocationKind.java
Java
[]
null
[]
package com.aaa.olb.automation.framework; public enum LocationKind { ID, CSS, XPATH, CLASSNAME, TAG, LINKTEXT, PARTIALLINKTEXT, NAME }
137
0.773723
0.773723
5
26.4
24.368832
64
false
false
0
0
0
0
0
0
1.8
false
false
9
c26925f96b6b5b1540fa33ab7873b509b70753f7
34,196,529,656,284
a95554ebd82f9a42dad981f7ef628251ea74f430
/ms_core/src/main/java/ru/a_ves/ms_core/model/products/ProductProperties.java
ec9654e983ab4fa7f1d6857fab6c3db1909c1992
[]
no_license
glier/AvesMarket
https://github.com/glier/AvesMarket
0fc3fa8de807399d734bb85af8db940faf8bf20c
03aceb0e3f8530268ef1737b48c247d339918206
refs/heads/master
2023-04-15T19:30:03.492000
2021-04-20T11:08:05
2021-04-20T11:08:05
357,620,315
0
0
null
false
2021-04-20T11:08:06
2021-04-13T16:29:56
2021-04-13T16:30:28
2021-04-20T11:08:05
69
0
0
0
Java
false
false
package ru.a_ves.ms_core.model.products; import lombok.Data; import ru.a_ves.ms_core.model.dictionaries.Characteristic; import ru.a_ves.ms_core.model.products.characteristics.Value; import javax.persistence.*; import java.util.Set; @Data @Entity public class ProductProperties { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @OneToOne private Product product; @OneToOne private Characteristic characteristic; @OneToMany @JoinTable(name = "product_properties_values", joinColumns = @JoinColumn(name = "product_properties_id"), inverseJoinColumns = @JoinColumn(name = "value_id") ) @Column(nullable = false) private Set<Value> values; }
UTF-8
Java
740
java
ProductProperties.java
Java
[]
null
[]
package ru.a_ves.ms_core.model.products; import lombok.Data; import ru.a_ves.ms_core.model.dictionaries.Characteristic; import ru.a_ves.ms_core.model.products.characteristics.Value; import javax.persistence.*; import java.util.Set; @Data @Entity public class ProductProperties { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @OneToOne private Product product; @OneToOne private Characteristic characteristic; @OneToMany @JoinTable(name = "product_properties_values", joinColumns = @JoinColumn(name = "product_properties_id"), inverseJoinColumns = @JoinColumn(name = "value_id") ) @Column(nullable = false) private Set<Value> values; }
740
0.708108
0.708108
30
23.666666
21.758268
70
false
false
0
0
0
0
0
0
0.4
false
false
9
722a1328dd82b872a9ecf3b468ac8d850f358d92
39,092,792,352,300
f81b43cef98ec1ff8db67e1405a39e6ac4b3595e
/src/main/java/be/vdab/personeel/web/LoginController.java
fc70fcf7b00a9b0bea4ad081d0c22104c7e31cc0
[]
no_license
vdab-stijn/personeel
https://github.com/vdab-stijn/personeel
0ad06d219186a9214edbeab20f62d6f0e1c473a9
60bc55c5a70dfbbadd788394e55c18e2d42fe73c
refs/heads/master
2020-04-02T12:46:15.434000
2018-10-31T18:56:35
2018-10-31T18:56:35
154,451,010
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package be.vdab.personeel.web; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping("login") public class LoginController { private static final String VIEW_LOGIN = "login"; @GetMapping public String login() { return VIEW_LOGIN; } }
UTF-8
Java
390
java
LoginController.java
Java
[]
null
[]
package be.vdab.personeel.web; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping("login") public class LoginController { private static final String VIEW_LOGIN = "login"; @GetMapping public String login() { return VIEW_LOGIN; } }
390
0.794872
0.794872
17
21.941177
19.836006
62
false
false
0
0
0
0
0
0
0.764706
false
false
9
7c369be882ea09d4b1466b68ea2c7e91327fa4a4
6,536,940,252,544
c515fffbb3fd0c6f0c42be14cdd61ce208a6c1e9
/src/test/java/com/ajin/study/Anno/AnnoTest.java
d75ae7fe97ee374129c31dbf068179122c586d33
[]
no_license
ChuanJinLiu/study
https://github.com/ChuanJinLiu/study
6cda49ce8647c61deb5bc3e0be218772ece34904
004de114764193a5b2da9e12ecc03ab17ac5b262
refs/heads/master
2020-06-02T07:29:36.549000
2019-06-11T06:29:06
2019-06-11T06:29:06
191,083,850
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ajin.study.Anno; import com.ajin.study.AOP.impl.AOPMethodImp; import com.ajin.study.Annotation.initerface.DogInterface; import com.ajin.study.Annotation.Factory.AnnoFactory; import com.ajin.study.Annotation.enity.Dog; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.BlockJUnit4ClassRunner; /** * @author Japoul * date : 19-6-10 上午11:03 * Description : */ @RunWith(BlockJUnit4ClassRunner.class) public class AnnoTest { @Test public void testValueL() { //获取Dog的代理对象(dog实现的接口) //这里的dog其实是一个model,其类型根据后面给工厂的参数来确定 DogInterface dog = AnnoFactory.getAnimal(new Dog(), new AOPMethodImp()); //通过这里的dog来调用的方法必须是其接口中定义的方法,否则会报错 dog.say(); System.out.println("我的名字是: " + dog.getName()); dog.getProperty(); } }
UTF-8
Java
962
java
AnnoTest.java
Java
[ { "context": "it.runners.BlockJUnit4ClassRunner;\n\n/**\n * @author Japoul\n * date : 19-6-10 上午11:03\n * Description :\n */\n@R", "end": 358, "score": 0.961209237575531, "start": 352, "tag": "USERNAME", "value": "Japoul" } ]
null
[]
package com.ajin.study.Anno; import com.ajin.study.AOP.impl.AOPMethodImp; import com.ajin.study.Annotation.initerface.DogInterface; import com.ajin.study.Annotation.Factory.AnnoFactory; import com.ajin.study.Annotation.enity.Dog; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.BlockJUnit4ClassRunner; /** * @author Japoul * date : 19-6-10 上午11:03 * Description : */ @RunWith(BlockJUnit4ClassRunner.class) public class AnnoTest { @Test public void testValueL() { //获取Dog的代理对象(dog实现的接口) //这里的dog其实是一个model,其类型根据后面给工厂的参数来确定 DogInterface dog = AnnoFactory.getAnimal(new Dog(), new AOPMethodImp()); //通过这里的dog来调用的方法必须是其接口中定义的方法,否则会报错 dog.say(); System.out.println("我的名字是: " + dog.getName()); dog.getProperty(); } }
962
0.710976
0.697561
30
26.333334
20.520451
80
false
false
0
0
0
0
0
0
0.5
false
false
9
618a15496237fc0dc1902d1a5382733f4a874f63
26,336,739,466,251
4708c0465a1822bbb6d07d19e46d0210b1fea429
/variman/branches/try-mfk-realgo-merge/project/hibernate/java/org/realtors/rets/server/config/ConditionRule.java
554493cb8b0b41506f7cd89a83de3c844ea6fe0c
[]
no_license
arjoe/variman
https://github.com/arjoe/variman
d1a91c1d6508130e98d74fc9fb73cc67f5a441c2
4ce64b9f2a5df2ff32b60fb301620918fb4f1b83
refs/heads/master
2017-12-07T23:37:30.806000
2013-07-13T23:30:35
2013-07-13T23:30:35
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Variman RETS Server * * Author: Danny Hurlburt * Copyright (c) 2007, The National Association of REALTORS * Distributed under a BSD-style license. See LICENSE.TXT for details. */ /* */ package org.realtors.rets.server.config; public interface ConditionRule { public String getResourceID(); public void setResourceID(String resourceId); public String getRetsClassName(); public void setRetsClassName(String retsClassName); public String getSqlConstraint(); public void setSqlConstraint(String sqlConstraint); public String getDmqlConstraint(); // TODO: Change this to return DmqlQuery public void setDmqlConstraint(String dmqlConstraint); // TODO: Change this to accept DmqlQuery }
UTF-8
Java
740
java
ConditionRule.java
Java
[ { "context": "/*\n * Variman RETS Server\n *\n * Author: Danny Hurlburt\n * Copyright (c) 2007, The National Association o", "end": 54, "score": 0.9998279213905334, "start": 40, "tag": "NAME", "value": "Danny Hurlburt" } ]
null
[]
/* * Variman RETS Server * * Author: <NAME> * Copyright (c) 2007, The National Association of REALTORS * Distributed under a BSD-style license. See LICENSE.TXT for details. */ /* */ package org.realtors.rets.server.config; public interface ConditionRule { public String getResourceID(); public void setResourceID(String resourceId); public String getRetsClassName(); public void setRetsClassName(String retsClassName); public String getSqlConstraint(); public void setSqlConstraint(String sqlConstraint); public String getDmqlConstraint(); // TODO: Change this to return DmqlQuery public void setDmqlConstraint(String dmqlConstraint); // TODO: Change this to accept DmqlQuery }
732
0.739189
0.733784
31
22.870968
27.913162
98
false
false
0
0
0
0
0
0
0.322581
false
false
9
c4bdeb5b7ef5b549ab4800581ee996ea1f2d3504
26,594,437,541,419
5f63a60fd029b8a74d2b1b4bf6992f5e4c7b429b
/com/planet_ink/coffee_mud/Abilities/Druid/Druid_Krakenform.java
b0193b4b1225ff1ae3b4e58c2260717e3f3070b4
[ "Apache-2.0" ]
permissive
bozimmerman/CoffeeMud
https://github.com/bozimmerman/CoffeeMud
5da8b5b98c25b70554ec9a2a8c0ef97f177dc041
647864922e07572b1f6c863de8f936982f553288
refs/heads/master
2023-09-04T09:17:12.656000
2023-09-02T00:30:19
2023-09-02T00:30:19
5,267,832
179
122
Apache-2.0
false
2023-04-30T11:09:14
2012-08-02T03:22:12
2023-04-29T20:20:37
2023-04-28T17:06:23
179,825
159
91
5
Java
false
false
package com.planet_ink.coffee_mud.Abilities.Druid; import com.planet_ink.coffee_mud.Abilities.StdAbility; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.core.collections.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.util.*; /* Copyright 2020-2023 Bo Zimmerman Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ public class Druid_Krakenform extends StdAbility { @Override public String ID() { return "Druid_Krakenform"; } private final static String localizedName = CMLib.lang().L("Krakenform"); @Override public String name() { return localizedName; } @Override public int classificationCode() { return Ability.ACODE_SKILL | Ability.DOMAIN_SHAPE_SHIFTING; } @Override public int abstractQuality() { return Ability.QUALITY_OK_SELF; } private static final String[] triggerStrings = I(new String[] { "KRAKENFORM" }); @Override public String[] triggerStrings() { return triggerStrings; } @Override protected int canAffectCode() { return Ability.CAN_MOBS; } @Override protected int canTargetCode() { return 0; } @Override public String displayText() { return "(in Kraken form)"; } @Override public void affectPhyStats(final Physical affected, final PhyStats affectableStats) { super.affectPhyStats(affected,affectableStats); affectableStats.setName("a kraken"); affectableStats.setHeight(420); affectableStats.setWeight(5000); } @Override public void affectCharStats(final MOB affected, final CharStats affectableStats) { super.affectCharStats(affected,affectableStats); affectableStats.setRaceName("Kraken"); } protected final static String ammoType="tentacle"; protected NavigableItem ship = null; protected Language krakenSpeak = null; protected NavigableItem getShip() { if(ship == null) { final Physical affected=this.affected; if(affected instanceof MOB) { final MOB mob=(MOB)affected; final Room R=mob.location(); ship=(NavigableItem)CMClass.getItem("GenSailingShip"); ship.basePhyStats().setAbility((int)Math.round(Math.ceil(CMath.div(adjustedLevel(mob,0),15.0)))); ship.recoverPhyStats(); ship.setSavable(false); ship.setAnchorDown(false); ship.setUsesRemaining(100); ship.setMaterial(RawMaterial.RESOURCE_SCALES); if(ship instanceof Container) ((Container)ship).setCapacity(0); if(ship instanceof PrivateProperty) ((PrivateProperty)ship).setOwnerName(mob.Name()); ship.setName("a kraken"); ship.setDisplayText("a kraken is here"); ship.setStat("SPECIAL_NOUN_SHIP", "kraken"); ship.setStat("SPECIAL_VERB_SAIL","swim"); ship.setStat("SPECIAL_VERB_SAILING","swimming"); ship.setStat("SPECIAL_DISABLE_CMDS", "anchor,throw,tender"); ship.setStat("SPECIAL_HEAD_OFFTHEDECK", ""); ((Exit)ship).setDoorsNLocks(false, false, false, false, false, false); if(ship instanceof PrivateProperty) ((PrivateProperty)ship).setOwnerName(mob.Name()); final Area A=ship.getArea(); A.setName("Krakenform_"+mob.Name()); final Room deckR=CMClass.getLocale("ShipDeck"); deckR.setRoomID(A.getNewRoomID(R,-1)); deckR.setArea(A); deckR.bringMobHere(mob, false); final AmmunitionWeapon weap1=(AmmunitionWeapon)CMClass.getWeapon("GenSiegeWeapon"); weap1.setName("a tentacle"); weap1.setAmmoCapacity(1); weap1.setAmmoRemaining(1); weap1.setAmmunitionType(ammoType); weap1.setRanges(0, 3+(super.getXLEVELLevel(mob)/2)); weap1.basePhyStats().setDamage(20); weap1.recoverPhyStats(); CMLib.flags().setGettable(weap1, false); deckR.addItem(weap1); final AmmunitionWeapon weap2=(AmmunitionWeapon)weap1.copyOf(); deckR.addItem(weap2); final int numRooms = (int)Math.round(Math.ceil(CMath.div(mob.phyStats().level(),9)))-1; // this is dumb, but it's the only way to give hit points for(int i=0;i<numRooms;i++) { final Room hpR=CMClass.getLocale("WoodRoom"); hpR.setRoomID(A.getNewRoomID(R,-1)); hpR.setArea(A); } R.addItem(ship); CMLib.map().registerWorldObjectLoaded(A, R, ship); final double hpPct = CMath.div(mob.curState().getHitPoints(), mob.maxState().getHitPoints()); if(ship.subjectToWearAndTear()) ship.setUsesRemaining((int)Math.round(hpPct*100.0)); } } return ship; } @Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost, msg)) return false; if(msg.target() instanceof Room) { final Physical P=affected; if((P instanceof MOB) &&(((MOB)P).location()==msg.target())) msg.setTarget(CMLib.map().roomLocation(getShip())); } else if(msg.source()==affected) { switch(msg.sourceMinor()) { case CMMsg.TYP_SPEAK: { final Room R= CMLib.map().roomLocation(getShip()); if(krakenSpeak == null) { krakenSpeak=(Language)CMClass.getAbility("Krakenspeak"); krakenSpeak.setProficiency(100); krakenSpeak.setMiscText("ALWAYS=true SPOKEN=true"); } if(msg.tool() instanceof Language) msg.setTool(null); krakenSpeak.setAffectedOne(msg.source()); if(krakenSpeak.okMessage(msg.source(), msg)) { krakenSpeak.executeMsg(msg.source(), msg); R.send(msg.source(), msg); } return false; } case CMMsg.TYP_HUH: { if(msg.targetMessage()!=null) { final List<String> cmds=CMParms.parse(msg.targetMessage()); if(cmds.size()==0) return true; final String word=cmds.get(0).toUpperCase(); final int dir=CMLib.directions().getDirectionCode(word); if(dir >= 0) { final NavigableItem ship=getShip(); if(ship != null) { msg.setTargetMessage("SAIL "+word); if(ship.okMessage(myHost, msg)) ship.executeMsg(myHost, msg); msg.setTargetMessage("do nothing"); return false; } } else if(word.equalsIgnoreCase("lower")) return false; } break; } } } return true; } @Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost, msg); if((msg.target()==ship) &&(msg.targetMinor()==CMMsg.TYP_CAUSESINK) &&(affected instanceof MOB)) { final MOB mob=(MOB)affected; if(mob != null) { unInvoke(); // revert them CMLib.combat().postDeath(msg.source(), mob, msg); } } } @Override public void unInvoke() { // undo the affects of this spell if(!(affected instanceof MOB)) return; final MOB mob=(MOB)affected; super.unInvoke(); if((canBeUninvoked())&&(mob.location()!=null)) { if(ship != null) { if(ship.subjectToWearAndTear()) { final double pct=CMath.div(ship.usesRemaining(), 100.0); if(pct < 1.0) mob.curState().setHitPoints((int)CMath.mul(pct,mob.maxState().getHitPoints())); } final Room shipR=CMLib.map().roomLocation(ship); if(shipR != null) { shipR.bringMobHere(mob, true); ship.destroy(); ship=null; } } mob.location().show(mob,null,CMMsg.MSG_OK_VISUAL,L("<S-NAME> revert(s) to @x1 form.",mob.charStats().raceName().toLowerCase())); } } public static boolean isShapeShifted(final MOB mob) { if(mob==null) return false; for(final Enumeration<Ability> a=mob.effects();a.hasMoreElements();) { final Ability A=a.nextElement(); if((A!=null) &&((A instanceof Druid_ShapeShift)||(A instanceof Druid_Krakenform))) return true; } return false; } @Override public int castingQuality(final MOB mob, final Physical target) { if(mob!=null) { if(target instanceof MOB) { if((((MOB)target).isInCombat()) &&(!Druid_ShapeShift.isShapeShifted((MOB)target))) { } } } return super.castingQuality(mob,target); } @Override public boolean tick(final Tickable ticking, final int tickID) { if(!super.tick(ticking, tickID)) return false; final NavigableItem ship=this.getShip(); if(ship != null) { ship.setAnchorDown(false); if(ship.isInCombat()) { final Area A=ship.getArea(); if(A!=null) { for(final Enumeration<Room> r=A.getProperMap();r.hasMoreElements();) { final Room R = r.nextElement(); for(final Enumeration<Item> i=R.items();i.hasMoreElements();) { final Item I=i.nextElement(); if((I instanceof AmmunitionWeapon) &&(ammoType.equalsIgnoreCase(((AmmunitionWeapon)I).ammunitionType())) &&(!CMLib.flags().isGettable(I))) ((AmmunitionWeapon)I).setAmmoRemaining(((AmmunitionWeapon)I).ammunitionCapacity()); } } } } } return true; } @Override public boolean invoke(final MOB mob, final List<String> commands, final Physical givenTarget, final boolean auto, final int asLevel) { MOB targetM=mob; if((auto)&&(givenTarget instanceof MOB)) targetM=(MOB)givenTarget; final Room R=targetM.location(); if(R==null) return false; for(final Enumeration<Ability> a=targetM.personalEffects();a.hasMoreElements();) { final Ability A=a.nextElement(); if((A!=null) &&((A instanceof Druid_ShapeShift)||(A instanceof Druid_Krakenform))) { A.unInvoke(); return true; } } if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficiencyCheck(mob,0,auto); if((!appropriateToMyFactions(mob))&&(!auto)) { if((CMLib.dice().rollPercentage()<50)) { mob.tell(L("Extreme emotions disrupt your change.")); return false; } } if(success) { final CMMsg msg=CMClass.getMsg(mob,null,this,CMMsg.MSG_OK_ACTION,null); if(R.okMessage(mob,msg)) { R.send(mob,msg); R.show(targetM,null,CMMsg.MSG_OK_VISUAL,L("<S-NAME> take(s) on Kraken form.")); final Druid_Krakenform form = (Druid_Krakenform)beneficialAffect(mob,targetM,asLevel,Ability.TICKS_FOREVER); if(form != null) form.getShip(); targetM.recoverCharStats(); targetM.recoverPhyStats(); } } else beneficialWordsFizzle(mob,null,L("<S-NAME> chant(s) to <S-HIM-HERSELF>, but nothing happens.")); // return whether it worked return success; } }
UTF-8
Java
11,679
java
Druid_Krakenform.java
Java
[ { "context": "\nimport java.util.*;\r\n\r\n/*\r\n Copyright 2020-2023 Bo Zimmerman\r\n\r\n Licensed under the Apache License, Version ", "end": 992, "score": 0.9996998906135559, "start": 980, "tag": "NAME", "value": "Bo Zimmerman" } ]
null
[]
package com.planet_ink.coffee_mud.Abilities.Druid; import com.planet_ink.coffee_mud.Abilities.StdAbility; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.core.collections.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.util.*; /* Copyright 2020-2023 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ public class Druid_Krakenform extends StdAbility { @Override public String ID() { return "Druid_Krakenform"; } private final static String localizedName = CMLib.lang().L("Krakenform"); @Override public String name() { return localizedName; } @Override public int classificationCode() { return Ability.ACODE_SKILL | Ability.DOMAIN_SHAPE_SHIFTING; } @Override public int abstractQuality() { return Ability.QUALITY_OK_SELF; } private static final String[] triggerStrings = I(new String[] { "KRAKENFORM" }); @Override public String[] triggerStrings() { return triggerStrings; } @Override protected int canAffectCode() { return Ability.CAN_MOBS; } @Override protected int canTargetCode() { return 0; } @Override public String displayText() { return "(in Kraken form)"; } @Override public void affectPhyStats(final Physical affected, final PhyStats affectableStats) { super.affectPhyStats(affected,affectableStats); affectableStats.setName("a kraken"); affectableStats.setHeight(420); affectableStats.setWeight(5000); } @Override public void affectCharStats(final MOB affected, final CharStats affectableStats) { super.affectCharStats(affected,affectableStats); affectableStats.setRaceName("Kraken"); } protected final static String ammoType="tentacle"; protected NavigableItem ship = null; protected Language krakenSpeak = null; protected NavigableItem getShip() { if(ship == null) { final Physical affected=this.affected; if(affected instanceof MOB) { final MOB mob=(MOB)affected; final Room R=mob.location(); ship=(NavigableItem)CMClass.getItem("GenSailingShip"); ship.basePhyStats().setAbility((int)Math.round(Math.ceil(CMath.div(adjustedLevel(mob,0),15.0)))); ship.recoverPhyStats(); ship.setSavable(false); ship.setAnchorDown(false); ship.setUsesRemaining(100); ship.setMaterial(RawMaterial.RESOURCE_SCALES); if(ship instanceof Container) ((Container)ship).setCapacity(0); if(ship instanceof PrivateProperty) ((PrivateProperty)ship).setOwnerName(mob.Name()); ship.setName("a kraken"); ship.setDisplayText("a kraken is here"); ship.setStat("SPECIAL_NOUN_SHIP", "kraken"); ship.setStat("SPECIAL_VERB_SAIL","swim"); ship.setStat("SPECIAL_VERB_SAILING","swimming"); ship.setStat("SPECIAL_DISABLE_CMDS", "anchor,throw,tender"); ship.setStat("SPECIAL_HEAD_OFFTHEDECK", ""); ((Exit)ship).setDoorsNLocks(false, false, false, false, false, false); if(ship instanceof PrivateProperty) ((PrivateProperty)ship).setOwnerName(mob.Name()); final Area A=ship.getArea(); A.setName("Krakenform_"+mob.Name()); final Room deckR=CMClass.getLocale("ShipDeck"); deckR.setRoomID(A.getNewRoomID(R,-1)); deckR.setArea(A); deckR.bringMobHere(mob, false); final AmmunitionWeapon weap1=(AmmunitionWeapon)CMClass.getWeapon("GenSiegeWeapon"); weap1.setName("a tentacle"); weap1.setAmmoCapacity(1); weap1.setAmmoRemaining(1); weap1.setAmmunitionType(ammoType); weap1.setRanges(0, 3+(super.getXLEVELLevel(mob)/2)); weap1.basePhyStats().setDamage(20); weap1.recoverPhyStats(); CMLib.flags().setGettable(weap1, false); deckR.addItem(weap1); final AmmunitionWeapon weap2=(AmmunitionWeapon)weap1.copyOf(); deckR.addItem(weap2); final int numRooms = (int)Math.round(Math.ceil(CMath.div(mob.phyStats().level(),9)))-1; // this is dumb, but it's the only way to give hit points for(int i=0;i<numRooms;i++) { final Room hpR=CMClass.getLocale("WoodRoom"); hpR.setRoomID(A.getNewRoomID(R,-1)); hpR.setArea(A); } R.addItem(ship); CMLib.map().registerWorldObjectLoaded(A, R, ship); final double hpPct = CMath.div(mob.curState().getHitPoints(), mob.maxState().getHitPoints()); if(ship.subjectToWearAndTear()) ship.setUsesRemaining((int)Math.round(hpPct*100.0)); } } return ship; } @Override public boolean okMessage(final Environmental myHost, final CMMsg msg) { if(!super.okMessage(myHost, msg)) return false; if(msg.target() instanceof Room) { final Physical P=affected; if((P instanceof MOB) &&(((MOB)P).location()==msg.target())) msg.setTarget(CMLib.map().roomLocation(getShip())); } else if(msg.source()==affected) { switch(msg.sourceMinor()) { case CMMsg.TYP_SPEAK: { final Room R= CMLib.map().roomLocation(getShip()); if(krakenSpeak == null) { krakenSpeak=(Language)CMClass.getAbility("Krakenspeak"); krakenSpeak.setProficiency(100); krakenSpeak.setMiscText("ALWAYS=true SPOKEN=true"); } if(msg.tool() instanceof Language) msg.setTool(null); krakenSpeak.setAffectedOne(msg.source()); if(krakenSpeak.okMessage(msg.source(), msg)) { krakenSpeak.executeMsg(msg.source(), msg); R.send(msg.source(), msg); } return false; } case CMMsg.TYP_HUH: { if(msg.targetMessage()!=null) { final List<String> cmds=CMParms.parse(msg.targetMessage()); if(cmds.size()==0) return true; final String word=cmds.get(0).toUpperCase(); final int dir=CMLib.directions().getDirectionCode(word); if(dir >= 0) { final NavigableItem ship=getShip(); if(ship != null) { msg.setTargetMessage("SAIL "+word); if(ship.okMessage(myHost, msg)) ship.executeMsg(myHost, msg); msg.setTargetMessage("do nothing"); return false; } } else if(word.equalsIgnoreCase("lower")) return false; } break; } } } return true; } @Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost, msg); if((msg.target()==ship) &&(msg.targetMinor()==CMMsg.TYP_CAUSESINK) &&(affected instanceof MOB)) { final MOB mob=(MOB)affected; if(mob != null) { unInvoke(); // revert them CMLib.combat().postDeath(msg.source(), mob, msg); } } } @Override public void unInvoke() { // undo the affects of this spell if(!(affected instanceof MOB)) return; final MOB mob=(MOB)affected; super.unInvoke(); if((canBeUninvoked())&&(mob.location()!=null)) { if(ship != null) { if(ship.subjectToWearAndTear()) { final double pct=CMath.div(ship.usesRemaining(), 100.0); if(pct < 1.0) mob.curState().setHitPoints((int)CMath.mul(pct,mob.maxState().getHitPoints())); } final Room shipR=CMLib.map().roomLocation(ship); if(shipR != null) { shipR.bringMobHere(mob, true); ship.destroy(); ship=null; } } mob.location().show(mob,null,CMMsg.MSG_OK_VISUAL,L("<S-NAME> revert(s) to @x1 form.",mob.charStats().raceName().toLowerCase())); } } public static boolean isShapeShifted(final MOB mob) { if(mob==null) return false; for(final Enumeration<Ability> a=mob.effects();a.hasMoreElements();) { final Ability A=a.nextElement(); if((A!=null) &&((A instanceof Druid_ShapeShift)||(A instanceof Druid_Krakenform))) return true; } return false; } @Override public int castingQuality(final MOB mob, final Physical target) { if(mob!=null) { if(target instanceof MOB) { if((((MOB)target).isInCombat()) &&(!Druid_ShapeShift.isShapeShifted((MOB)target))) { } } } return super.castingQuality(mob,target); } @Override public boolean tick(final Tickable ticking, final int tickID) { if(!super.tick(ticking, tickID)) return false; final NavigableItem ship=this.getShip(); if(ship != null) { ship.setAnchorDown(false); if(ship.isInCombat()) { final Area A=ship.getArea(); if(A!=null) { for(final Enumeration<Room> r=A.getProperMap();r.hasMoreElements();) { final Room R = r.nextElement(); for(final Enumeration<Item> i=R.items();i.hasMoreElements();) { final Item I=i.nextElement(); if((I instanceof AmmunitionWeapon) &&(ammoType.equalsIgnoreCase(((AmmunitionWeapon)I).ammunitionType())) &&(!CMLib.flags().isGettable(I))) ((AmmunitionWeapon)I).setAmmoRemaining(((AmmunitionWeapon)I).ammunitionCapacity()); } } } } } return true; } @Override public boolean invoke(final MOB mob, final List<String> commands, final Physical givenTarget, final boolean auto, final int asLevel) { MOB targetM=mob; if((auto)&&(givenTarget instanceof MOB)) targetM=(MOB)givenTarget; final Room R=targetM.location(); if(R==null) return false; for(final Enumeration<Ability> a=targetM.personalEffects();a.hasMoreElements();) { final Ability A=a.nextElement(); if((A!=null) &&((A instanceof Druid_ShapeShift)||(A instanceof Druid_Krakenform))) { A.unInvoke(); return true; } } if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficiencyCheck(mob,0,auto); if((!appropriateToMyFactions(mob))&&(!auto)) { if((CMLib.dice().rollPercentage()<50)) { mob.tell(L("Extreme emotions disrupt your change.")); return false; } } if(success) { final CMMsg msg=CMClass.getMsg(mob,null,this,CMMsg.MSG_OK_ACTION,null); if(R.okMessage(mob,msg)) { R.send(mob,msg); R.show(targetM,null,CMMsg.MSG_OK_VISUAL,L("<S-NAME> take(s) on Kraken form.")); final Druid_Krakenform form = (Druid_Krakenform)beneficialAffect(mob,targetM,asLevel,Ability.TICKS_FOREVER); if(form != null) form.getShip(); targetM.recoverCharStats(); targetM.recoverPhyStats(); } } else beneficialWordsFizzle(mob,null,L("<S-NAME> chant(s) to <S-HIM-HERSELF>, but nothing happens.")); // return whether it worked return success; } }
11,673
0.658104
0.651854
408
26.625
24.988802
133
false
false
0
0
0
0
0
0
3.169118
false
false
9
df7c14ac29ea0bcadb634f72d198ecb8b661dbbf
18,227,841,229,749
0715ea3c019f27b1d07e4652df7dad0811f3bc7d
/src/main/java/com/gjie/netty/handler/SimpleHttpRequestDecoder.java
03983a201e03656517f979a491835d959bdffe53
[]
no_license
GongjieL/netty_server
https://github.com/GongjieL/netty_server
a02adb55da611a3eb3e5b47b0d79937c7c077b08
e363d3f1f63fd891944d87f6751276b1e9fb6e8e
refs/heads/master
2022-06-24T21:30:13.975000
2019-08-23T11:05:15
2019-08-23T11:05:15
203,611,065
3
0
null
false
2022-06-17T02:24:43
2019-08-21T15:17:52
2019-08-30T11:07:10
2022-06-17T02:24:42
26
2
0
1
Java
false
false
package com.gjie.netty.handler; import com.gjie.netty.ConvertDelegater; import com.gjie.netty.cache.impl.UrlMethodCache; import com.gjie.netty.constant.HttpResponseMessageCode; import com.gjie.netty.http.HttpData; import com.gjie.netty.http.HttpDetailContent; import com.gjie.netty.http.NettyHttpHandleData; import com.gjie.netty.http.resp.HttpExceptionResponse; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToMessageDecoder; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpMethod; import java.lang.reflect.Method; import java.util.List; public class SimpleHttpRequestDecoder extends MessageToMessageDecoder<FullHttpRequest> { public void decode(ChannelHandlerContext channelHandlerContext, FullHttpRequest fullHttpRequest, List<Object> list) throws Exception { UrlMethodCache urlMethodCache = new UrlMethodCache(); HttpDetailContent httpDetailContent = urlMethodCache.getData("url", fullHttpRequest.uri()); HttpExceptionResponse checkResponse = check(httpDetailContent, fullHttpRequest); if (checkResponse != null) { list.add(new NettyHttpHandleData(null, null, null, checkResponse)); } else { ByteBuf content = fullHttpRequest.content(); int length = content.readableBytes(); byte[] array = new byte[length]; content.getBytes(content.readerIndex(), array); list.add(new NettyHttpHandleData(fullHttpRequest, convertToObject(httpDetailContent, array), httpDetailContent, null)); } } public Object convertToObject(HttpDetailContent httpDetailContent, byte[] array) { HttpData requestData = httpDetailContent.getRequestData(); if (requestData == null) { return null; } return ConvertDelegater.convertToObject(requestData.getFormatter(), requestData.getType(), new String(array)); } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { super.exceptionCaught(ctx, cause); } private HttpExceptionResponse check(HttpDetailContent httpDetailContent, FullHttpRequest fullHttpRequest) { HttpExceptionResponse httpExceptionResponse = null; if (httpDetailContent == null) { return new HttpExceptionResponse( HttpResponseMessageCode.NO_EXISTS, String.format("%s doesn't exist", fullHttpRequest.uri()), null); } httpExceptionResponse = checkAnnotation(httpDetailContent); if (httpExceptionResponse != null) { return httpExceptionResponse; } return checkRequestMethod(httpDetailContent, fullHttpRequest); } private HttpExceptionResponse checkAnnotation(HttpDetailContent httpDetailContent) { //参数不是0个,没有requestBody Method method = httpDetailContent.getMethod(); HttpData requestData = httpDetailContent.getRequestData(); if (method.getParameterCount() != 0 && requestData == null) { return new HttpExceptionResponse( HttpResponseMessageCode.NO_ANNOTION_REQUESTBODY, String.format("%s has no requestBody annotation", httpDetailContent.getMethod().getName()), null); } //返回值不是void但是没有responsebody HttpData responseData = httpDetailContent.getResponseData(); if (!method.getReturnType().equals(Void.class) && responseData == null) { return new HttpExceptionResponse( HttpResponseMessageCode.NO_ANNOTION_RESPONSEBODY, String.format("%s has no responseBody annotation", httpDetailContent.getMethod().getName()), null); } return null; } private HttpExceptionResponse checkRequestMethod(HttpDetailContent httpDetailContent, FullHttpRequest fullHttpRequest) { ByteBuf content = fullHttpRequest.content(); HttpMethod httpMethod = fullHttpRequest.method(); //校验parent method和自身的method是否相同 if (httpDetailContent.getParentRequestMethod() != null && !httpDetailContent.getParentRequestMethod().equals(httpDetailContent.getNettyRequestMethod())) { return new HttpExceptionResponse( HttpResponseMessageCode.PARENT_SELF_REQUEST_METHOD_NO_MATCH, String.format("%s parent http request method doesn't equal self http request method", httpDetailContent.getUrl()), null); } //校验当前请求方法和默认的方法 if (!httpDetailContent.getNettyRequestMethod().toString().equals(httpMethod.toString())) { return new HttpExceptionResponse( HttpResponseMessageCode.REQUEST_METHOD_ERROR, String.format("%s method should be %s,but now is %s", httpDetailContent.getUrl(), httpDetailContent.getNettyRequestMethod().toString(), httpMethod.toString()), null); } //get无content if (HttpMethod.GET.equals(httpMethod) && content.readableBytes() > 0) { return new HttpExceptionResponse( HttpResponseMessageCode.BAD_REQUEST, String.format("%s is GET request method,it should not have content", httpDetailContent.getUrl()), null); } return null; } }
UTF-8
Java
5,550
java
SimpleHttpRequestDecoder.java
Java
[]
null
[]
package com.gjie.netty.handler; import com.gjie.netty.ConvertDelegater; import com.gjie.netty.cache.impl.UrlMethodCache; import com.gjie.netty.constant.HttpResponseMessageCode; import com.gjie.netty.http.HttpData; import com.gjie.netty.http.HttpDetailContent; import com.gjie.netty.http.NettyHttpHandleData; import com.gjie.netty.http.resp.HttpExceptionResponse; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToMessageDecoder; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpMethod; import java.lang.reflect.Method; import java.util.List; public class SimpleHttpRequestDecoder extends MessageToMessageDecoder<FullHttpRequest> { public void decode(ChannelHandlerContext channelHandlerContext, FullHttpRequest fullHttpRequest, List<Object> list) throws Exception { UrlMethodCache urlMethodCache = new UrlMethodCache(); HttpDetailContent httpDetailContent = urlMethodCache.getData("url", fullHttpRequest.uri()); HttpExceptionResponse checkResponse = check(httpDetailContent, fullHttpRequest); if (checkResponse != null) { list.add(new NettyHttpHandleData(null, null, null, checkResponse)); } else { ByteBuf content = fullHttpRequest.content(); int length = content.readableBytes(); byte[] array = new byte[length]; content.getBytes(content.readerIndex(), array); list.add(new NettyHttpHandleData(fullHttpRequest, convertToObject(httpDetailContent, array), httpDetailContent, null)); } } public Object convertToObject(HttpDetailContent httpDetailContent, byte[] array) { HttpData requestData = httpDetailContent.getRequestData(); if (requestData == null) { return null; } return ConvertDelegater.convertToObject(requestData.getFormatter(), requestData.getType(), new String(array)); } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { super.exceptionCaught(ctx, cause); } private HttpExceptionResponse check(HttpDetailContent httpDetailContent, FullHttpRequest fullHttpRequest) { HttpExceptionResponse httpExceptionResponse = null; if (httpDetailContent == null) { return new HttpExceptionResponse( HttpResponseMessageCode.NO_EXISTS, String.format("%s doesn't exist", fullHttpRequest.uri()), null); } httpExceptionResponse = checkAnnotation(httpDetailContent); if (httpExceptionResponse != null) { return httpExceptionResponse; } return checkRequestMethod(httpDetailContent, fullHttpRequest); } private HttpExceptionResponse checkAnnotation(HttpDetailContent httpDetailContent) { //参数不是0个,没有requestBody Method method = httpDetailContent.getMethod(); HttpData requestData = httpDetailContent.getRequestData(); if (method.getParameterCount() != 0 && requestData == null) { return new HttpExceptionResponse( HttpResponseMessageCode.NO_ANNOTION_REQUESTBODY, String.format("%s has no requestBody annotation", httpDetailContent.getMethod().getName()), null); } //返回值不是void但是没有responsebody HttpData responseData = httpDetailContent.getResponseData(); if (!method.getReturnType().equals(Void.class) && responseData == null) { return new HttpExceptionResponse( HttpResponseMessageCode.NO_ANNOTION_RESPONSEBODY, String.format("%s has no responseBody annotation", httpDetailContent.getMethod().getName()), null); } return null; } private HttpExceptionResponse checkRequestMethod(HttpDetailContent httpDetailContent, FullHttpRequest fullHttpRequest) { ByteBuf content = fullHttpRequest.content(); HttpMethod httpMethod = fullHttpRequest.method(); //校验parent method和自身的method是否相同 if (httpDetailContent.getParentRequestMethod() != null && !httpDetailContent.getParentRequestMethod().equals(httpDetailContent.getNettyRequestMethod())) { return new HttpExceptionResponse( HttpResponseMessageCode.PARENT_SELF_REQUEST_METHOD_NO_MATCH, String.format("%s parent http request method doesn't equal self http request method", httpDetailContent.getUrl()), null); } //校验当前请求方法和默认的方法 if (!httpDetailContent.getNettyRequestMethod().toString().equals(httpMethod.toString())) { return new HttpExceptionResponse( HttpResponseMessageCode.REQUEST_METHOD_ERROR, String.format("%s method should be %s,but now is %s", httpDetailContent.getUrl(), httpDetailContent.getNettyRequestMethod().toString(), httpMethod.toString()), null); } //get无content if (HttpMethod.GET.equals(httpMethod) && content.readableBytes() > 0) { return new HttpExceptionResponse( HttpResponseMessageCode.BAD_REQUEST, String.format("%s is GET request method,it should not have content", httpDetailContent.getUrl()), null); } return null; } }
5,550
0.680571
0.680022
114
46.947369
37.235111
179
false
false
0
0
0
0
0
0
0.763158
false
false
9
d097087cfd66dbb77ea7e96fbbb326cc192d5e55
300,647,729,932
0d399d104cddc690a1f2975c66466a1a2cdaa7b5
/src/dsa/unionFind/QuickUnionFindByPathCompression.java
df94c3bc5fa215e397ca9d5fd90006ad01e24e8c
[]
no_license
pankaj182/Data-Structure-Algorithm
https://github.com/pankaj182/Data-Structure-Algorithm
4efec777e59abc523927055de9984c91b757245b
6eb80077e4c5984a8431ff6ea9e53d792c780aa3
refs/heads/master
2020-05-30T13:14:16.577000
2019-11-25T19:00:11
2019-11-25T19:00:11
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package dsa.unionFind; public class QuickUnionFindByPathCompression implements UnionFind { int size, parent[], rank[]; public QuickUnionFindByPathCompression(int n) { size = n; parent = new int[n]; rank = new int[n]; for (int i = 0; i < n; i++) { parent[i] = i; rank[i] = 0; } } private int root(int u) { while (u != parent[u]) { // only a single line change from union by rank method parent[u] = parent[parent[u]]; // parent[u] = find(parent[u]); u = parent[u]; } return u; } public boolean find(int u, int v) { return root(u) == root(v); } public void union(int u, int v) { int uroot = root(u); int vroot = root(v); if (rank[vroot] < rank[uroot]) { // bada wala is the parent of chhota wala // read it as:parent of vroot is uroot parent[vroot] = uroot; // higher rank wala is parent } else if (rank[vroot] > rank[uroot]) { parent[uroot] = vroot; } else { parent[uroot] = vroot; rank[vroot]++; // rank of parent increases } } }
UTF-8
Java
1,126
java
QuickUnionFindByPathCompression.java
Java
[]
null
[]
package dsa.unionFind; public class QuickUnionFindByPathCompression implements UnionFind { int size, parent[], rank[]; public QuickUnionFindByPathCompression(int n) { size = n; parent = new int[n]; rank = new int[n]; for (int i = 0; i < n; i++) { parent[i] = i; rank[i] = 0; } } private int root(int u) { while (u != parent[u]) { // only a single line change from union by rank method parent[u] = parent[parent[u]]; // parent[u] = find(parent[u]); u = parent[u]; } return u; } public boolean find(int u, int v) { return root(u) == root(v); } public void union(int u, int v) { int uroot = root(u); int vroot = root(v); if (rank[vroot] < rank[uroot]) { // bada wala is the parent of chhota wala // read it as:parent of vroot is uroot parent[vroot] = uroot; // higher rank wala is parent } else if (rank[vroot] > rank[uroot]) { parent[uroot] = vroot; } else { parent[uroot] = vroot; rank[vroot]++; // rank of parent increases } } }
1,126
0.546181
0.544405
44
23.636364
18.122175
67
false
false
0
0
0
0
0
0
0.545455
false
false
9
ba777f7b197e36c829e2cbaf9f9ea124e08de56d
300,647,729,496
7feb64d904451595aa3f38a61319dc30a2dcb763
/app/src/main/java/com/heziz/qixia3/adaper/fdl/FdlStreetListAdapter.java
31c793ad715d4a373478609c50ffe11658993b6a
[]
no_license
songwusheng/qixia3.0
https://github.com/songwusheng/qixia3.0
8192ff6b88ea572e2d7d6d1146dff3ec604dbeeb
168a57c49fd2e7d75669f1d64071266d4a8acf30
refs/heads/master
2022-04-11T23:04:56.114000
2020-03-15T07:59:32
2020-03-15T07:59:32
203,418,541
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.heziz.qixia3.adaper.fdl; import android.content.Context; import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseViewHolder; import com.heziz.qixia3.R; import com.heziz.qixia3.bean.fdl.FdlStreetListBean; import com.heziz.qixia3.bean.yc.YczlxNumBean; import com.heziz.qixia3.utils.NumberUtils; import com.heziz.qixia3.utils.StringUtil; import java.util.List; /** * Created by sws on 2018/5/12. * from: * describe: */ public class FdlStreetListAdapter extends BaseQuickAdapter<FdlStreetListBean,BaseViewHolder> { private Context context; public FdlStreetListAdapter(Context context, List<FdlStreetListBean> list) { super(R.layout.zh_list_fdl_item,list); this.context=context; } @Override protected void convert(BaseViewHolder helper, FdlStreetListBean item) { helper.setText(R.id.tvJd, item.getName()); helper.setText(R.id.tvId, helper.getLayoutPosition()+1+""); helper.setText(R.id.tvPc,item.getTotalRecord()+""); helper.setText(R.id.tvYl,item.getTotalAmount()+""); if(item.getTotalRecord()!=0){ helper.setText(R.id.tvDbl, NumberUtils.getTwoDecimal(item.getQualifiedNumber()*100.0/item.getTotalRecord())+"%"); }else{ helper.setText(R.id.tvDbl,"0"); } //// .setText(R.id.tweetText, item.getText()) //// .setText(R.id.tweetDate, item.getCreatedAt()) //// .setVisible(R.id.tweetRT, item.isRetweet()) //// .linkify(R.id.tweetText); // if (item.get) // Glide.with(mContext).load(R.mipmap.zhihui_fangjian_icon).crossFade().into((ImageView) helper.getView(R.id.ivType)); } }
UTF-8
Java
1,724
java
FdlStreetListAdapter.java
Java
[ { "context": "ngUtil;\n\nimport java.util.List;\n\n/**\n * Created by sws on 2018/5/12.\n * from:\n * describe:\n */\n\npublic c", "end": 435, "score": 0.9996097087860107, "start": 432, "tag": "USERNAME", "value": "sws" } ]
null
[]
package com.heziz.qixia3.adaper.fdl; import android.content.Context; import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseViewHolder; import com.heziz.qixia3.R; import com.heziz.qixia3.bean.fdl.FdlStreetListBean; import com.heziz.qixia3.bean.yc.YczlxNumBean; import com.heziz.qixia3.utils.NumberUtils; import com.heziz.qixia3.utils.StringUtil; import java.util.List; /** * Created by sws on 2018/5/12. * from: * describe: */ public class FdlStreetListAdapter extends BaseQuickAdapter<FdlStreetListBean,BaseViewHolder> { private Context context; public FdlStreetListAdapter(Context context, List<FdlStreetListBean> list) { super(R.layout.zh_list_fdl_item,list); this.context=context; } @Override protected void convert(BaseViewHolder helper, FdlStreetListBean item) { helper.setText(R.id.tvJd, item.getName()); helper.setText(R.id.tvId, helper.getLayoutPosition()+1+""); helper.setText(R.id.tvPc,item.getTotalRecord()+""); helper.setText(R.id.tvYl,item.getTotalAmount()+""); if(item.getTotalRecord()!=0){ helper.setText(R.id.tvDbl, NumberUtils.getTwoDecimal(item.getQualifiedNumber()*100.0/item.getTotalRecord())+"%"); }else{ helper.setText(R.id.tvDbl,"0"); } //// .setText(R.id.tweetText, item.getText()) //// .setText(R.id.tweetDate, item.getCreatedAt()) //// .setVisible(R.id.tweetRT, item.isRetweet()) //// .linkify(R.id.tweetText); // if (item.get) // Glide.with(mContext).load(R.mipmap.zhihui_fangjian_icon).crossFade().into((ImageView) helper.getView(R.id.ivType)); } }
1,724
0.675174
0.663573
47
35.680851
31.394609
125
false
false
0
0
0
0
0
0
0.723404
false
false
9
1112b521ebd4c4159601139ff8d300d8d07519fd
300,647,726,457
126b016e8c22d961a5e8a175e42a7302b73f05b7
/src/main/java/org/tools4j/hoverraft/server/Server.java
c2dbcec57e6063404913885b6476a11c62892a97
[ "MIT" ]
permissive
terzerm/hoover-raft
https://github.com/terzerm/hoover-raft
004d21fd2d7fd0e5045435a8f4016d184dd1121e
188496cc3e811f4f164999f60ef340b96749a42d
refs/heads/master
2020-04-12T05:42:37.261000
2017-01-08T12:37:01
2017-01-08T12:37:01
61,633,193
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * The MIT License (MIT) * * Copyright (c) 2016-2017 hover-raft (tools4j), Marco Terzer * * 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.tools4j.hoverraft.server; import org.tools4j.hoverraft.command.Command; import org.tools4j.hoverraft.command.machine.StateMachine; import org.tools4j.hoverraft.config.ConsensusConfig; import org.tools4j.hoverraft.config.ServerConfig; import org.tools4j.hoverraft.direct.DirectFactory; import org.tools4j.hoverraft.message.Message; import org.tools4j.hoverraft.state.HoverRaftMachine; import org.tools4j.hoverraft.state.PersistentState; import org.tools4j.hoverraft.state.VolatileState; import org.tools4j.hoverraft.timer.Timer; import org.tools4j.hoverraft.timer.TimerEvent; import org.tools4j.hoverraft.transport.Connections; import org.tools4j.hoverraft.transport.ResendStrategy; import java.util.Objects; public final class Server implements ServerContext { private final ServerConfig serverConfig; private final ConsensusConfig consensusConfig; private final HoverRaftMachine hoverRaftMachine; private final StateMachine stateMachine; private final Connections<Message> connections; private final DirectFactory directFactory; private final RoundRobinMessagePoller<Message> serverMessagePoller; private final RoundRobinMessagePoller<Command> sourceMessagePoller; private final Timer timer; public Server(final int serverId, final ConsensusConfig consensusConfig, final PersistentState persistentState, final VolatileState volatileState, final StateMachine stateMachine, final Connections<Message> connections, final DirectFactory directFactory) { this.serverConfig = Objects.requireNonNull(consensusConfig.serverConfigByIdOrNull(serverId), "No server serverConfig found for ID " + serverId); this.consensusConfig = Objects.requireNonNull(consensusConfig); this.hoverRaftMachine = new HoverRaftMachine(Objects.requireNonNull(persistentState), Objects.requireNonNull(volatileState)); this.stateMachine = Objects.requireNonNull(stateMachine); this.connections = Objects.requireNonNull(connections); this.directFactory = Objects.requireNonNull(directFactory); this.serverMessagePoller = RoundRobinMessagePoller.forServerMessages(this, this::handleMessage); this.sourceMessagePoller = RoundRobinMessagePoller.forSourceMessages(this, this::handleCommand); this.timer = new Timer(); } @Override public ServerConfig serverConfig() { return serverConfig; } @Override public ConsensusConfig consensusConfig() { return consensusConfig; } @Override public Connections<Message> connections() { return connections; } @Override public DirectFactory directFactory() { return directFactory; } @Override public StateMachine stateMachine() { return stateMachine; } @Override public void perform() { checkTimeoutElapsed(); serverMessagePoller.pollNextMessage(); sourceMessagePoller.pollNextMessage(); } private void handleCommand(final Command command) { hoverRaftMachine.onEvent(this, command); } private void handleMessage(final Message message) { hoverRaftMachine.onEvent(this, message); } private void checkTimeoutElapsed() { if (timer.hasTimeoutElapsed()) { hoverRaftMachine.onEvent(this, TimerEvent.TIMEOUT); } } @Override public Timer timer() { return timer; } @Override public ResendStrategy resendStrategy() { return ResendStrategy.NOOP;//FIXME use better resend strategy } }
UTF-8
Java
4,854
java
Server.java
Java
[ { "context": "*\n * Copyright (c) 2016-2017 hover-raft (tools4j), Marco Terzer\n *\n * Permission is hereby granted, free of charg", "end": 93, "score": 0.9998712539672852, "start": 81, "tag": "NAME", "value": "Marco Terzer" } ]
null
[]
/** * The MIT License (MIT) * * Copyright (c) 2016-2017 hover-raft (tools4j), <NAME> * * 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.tools4j.hoverraft.server; import org.tools4j.hoverraft.command.Command; import org.tools4j.hoverraft.command.machine.StateMachine; import org.tools4j.hoverraft.config.ConsensusConfig; import org.tools4j.hoverraft.config.ServerConfig; import org.tools4j.hoverraft.direct.DirectFactory; import org.tools4j.hoverraft.message.Message; import org.tools4j.hoverraft.state.HoverRaftMachine; import org.tools4j.hoverraft.state.PersistentState; import org.tools4j.hoverraft.state.VolatileState; import org.tools4j.hoverraft.timer.Timer; import org.tools4j.hoverraft.timer.TimerEvent; import org.tools4j.hoverraft.transport.Connections; import org.tools4j.hoverraft.transport.ResendStrategy; import java.util.Objects; public final class Server implements ServerContext { private final ServerConfig serverConfig; private final ConsensusConfig consensusConfig; private final HoverRaftMachine hoverRaftMachine; private final StateMachine stateMachine; private final Connections<Message> connections; private final DirectFactory directFactory; private final RoundRobinMessagePoller<Message> serverMessagePoller; private final RoundRobinMessagePoller<Command> sourceMessagePoller; private final Timer timer; public Server(final int serverId, final ConsensusConfig consensusConfig, final PersistentState persistentState, final VolatileState volatileState, final StateMachine stateMachine, final Connections<Message> connections, final DirectFactory directFactory) { this.serverConfig = Objects.requireNonNull(consensusConfig.serverConfigByIdOrNull(serverId), "No server serverConfig found for ID " + serverId); this.consensusConfig = Objects.requireNonNull(consensusConfig); this.hoverRaftMachine = new HoverRaftMachine(Objects.requireNonNull(persistentState), Objects.requireNonNull(volatileState)); this.stateMachine = Objects.requireNonNull(stateMachine); this.connections = Objects.requireNonNull(connections); this.directFactory = Objects.requireNonNull(directFactory); this.serverMessagePoller = RoundRobinMessagePoller.forServerMessages(this, this::handleMessage); this.sourceMessagePoller = RoundRobinMessagePoller.forSourceMessages(this, this::handleCommand); this.timer = new Timer(); } @Override public ServerConfig serverConfig() { return serverConfig; } @Override public ConsensusConfig consensusConfig() { return consensusConfig; } @Override public Connections<Message> connections() { return connections; } @Override public DirectFactory directFactory() { return directFactory; } @Override public StateMachine stateMachine() { return stateMachine; } @Override public void perform() { checkTimeoutElapsed(); serverMessagePoller.pollNextMessage(); sourceMessagePoller.pollNextMessage(); } private void handleCommand(final Command command) { hoverRaftMachine.onEvent(this, command); } private void handleMessage(final Message message) { hoverRaftMachine.onEvent(this, message); } private void checkTimeoutElapsed() { if (timer.hasTimeoutElapsed()) { hoverRaftMachine.onEvent(this, TimerEvent.TIMEOUT); } } @Override public Timer timer() { return timer; } @Override public ResendStrategy resendStrategy() { return ResendStrategy.NOOP;//FIXME use better resend strategy } }
4,848
0.733004
0.728265
129
36.627907
29.456068
152
false
false
0
0
0
0
0
0
0.635659
false
false
9
0b9b32ead69bd7a575b25eb1d12d8d6b278d00fc
24,850,680,803,158
812bc297e7cdcc6a816afb8378e99d275ce87624
/app/src/main/java/com/example/smarthomedashboard/fragment/LivingRoomFragment.java
c828be4ce3b041176c3df4228f6f50bb7ed8733f
[]
no_license
baokhanhle123/IoT-Smart-Home-Dashboard
https://github.com/baokhanhle123/IoT-Smart-Home-Dashboard
4915115b5f2244baa242f84f2f7cc2a731a38e9f
e28395a755ef619199d4b8f28ac2eef3bb7d961c
refs/heads/main
2023-08-14T03:12:13.681000
2021-10-07T03:23:22
2021-10-07T03:23:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.smarthomedashboard.Fragment; import android.annotation.SuppressLint; import android.os.Bundle; import androidx.cardview.widget.CardView; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import com.example.smarthomedashboard.MainActivity; import com.example.smarthomedashboard.R; public class LivingRoomFragment extends Fragment { // Declare CardView living_room_light; public LivingRoomFragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public void onResume() { super.onResume(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_living_room, container, false); // Match view living_room_light = view.findViewById(R.id.living_room_light); //Call //setUpLivingRoomLightButton(view); return view; } private void setUpLivingRoomLightButton(View context) { living_room_light.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); } }
UTF-8
Java
1,495
java
LivingRoomFragment.java
Java
[]
null
[]
package com.example.smarthomedashboard.Fragment; import android.annotation.SuppressLint; import android.os.Bundle; import androidx.cardview.widget.CardView; import androidx.fragment.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import com.example.smarthomedashboard.MainActivity; import com.example.smarthomedashboard.R; public class LivingRoomFragment extends Fragment { // Declare CardView living_room_light; public LivingRoomFragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public void onResume() { super.onResume(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_living_room, container, false); // Match view living_room_light = view.findViewById(R.id.living_room_light); //Call //setUpLivingRoomLightButton(view); return view; } private void setUpLivingRoomLightButton(View context) { living_room_light.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); } }
1,495
0.682943
0.682943
60
23.933332
22.971624
86
false
false
0
0
0
0
0
0
0.383333
false
false
9
8d90866b9de543af5ebd66b06aff8b45d65477dc
274,877,937,710
76ac525045f1836f8667afb67b35da3311761eff
/Banking_App/src/com/jspiders/bankingapp/entities/Customer.java
631621ed7e74fed667b45d5fce78697465e33cb1
[]
no_license
MadhuHS/BEC_M47_A12_ClassWork
https://github.com/MadhuHS/BEC_M47_A12_ClassWork
5c14994bdda4343fcee62bd1c8c45df955c7c73c
06803630d28a3c8c17720b913065300afab2876f
refs/heads/master
2023-06-25T23:02:46.731000
2021-07-27T14:13:17
2021-07-27T14:13:17
387,383,748
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jspiders.bankingapp.entities; public class Customer { int accountID; String customerName; String email; String address; String pancard; public Customer(int a,String b,String c,String d,String e) { accountID = a; customerName = b; email = c; address = d; pancard = e; } public void CustomerDetails() { System.out.println(accountID); System.out.println(email); System.out.println(customerName); System.out.println(address); System.out.println(pancard); } }
UTF-8
Java
560
java
Customer.java
Java
[ { "context": "g e)\n {\n \taccountID = a;\n \tcustomerName = b;\n \temail = c;\n \taddress = d;\n \tpancard =", "end": 272, "score": 0.9003553986549377, "start": 271, "tag": "NAME", "value": "b" } ]
null
[]
package com.jspiders.bankingapp.entities; public class Customer { int accountID; String customerName; String email; String address; String pancard; public Customer(int a,String b,String c,String d,String e) { accountID = a; customerName = b; email = c; address = d; pancard = e; } public void CustomerDetails() { System.out.println(accountID); System.out.println(email); System.out.println(customerName); System.out.println(address); System.out.println(pancard); } }
560
0.639286
0.639286
28
19
14.658006
62
false
false
0
0
0
0
0
0
1.214286
false
false
9
7dc332b85d1f6d5988244426539416691f3518c8
30,837,865,211,555
5b9fe5339a689c09edfc37c228bdf4229205809d
/Acme-Demos-2.0/src/test/java/services/InstalmentServiceTest.java
6f5bb8924066693d67425d2fb85c011a90432873
[]
no_license
rrodriguezos/Demos-2.0
https://github.com/rrodriguezos/Demos-2.0
220d46b8ee36766e1340733b56c38217c216ee3c
b0661549c71a1ac00422d745c6dce0ebc2909fa9
refs/heads/master
2021-01-13T02:51:19.357000
2017-01-03T12:03:25
2017-01-03T12:03:25
77,135,594
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package services; import java.util.Calendar; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.transaction.TransactionConfiguration; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import domain.Instalment; import utilities.AbstractTest; import forms.CreateInstalmentsForm; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:spring/datasource.xml", "classpath:spring/config/packages.xml" }) @Transactional @TransactionConfiguration(defaultRollback = true) public class InstalmentServiceTest extends AbstractTest { //BAsed services test--- @Autowired private InstalmentService instalmentService; /* * An actor who is authenticated as an bank must be able to * create an investment regarding an existing demo */ @Test public void testPositiveCreateIntalment(){ CreateInstalmentsForm form; Calendar cal; authenticate("bank1"); form = new CreateInstalmentsForm(); cal = Calendar.getInstance(); cal.set(2016, 12, 04, 12, 00); form.setLoanId(21); form.setNumber(5); form.setDate(cal.getTime()); Assert.isTrue(instalmentService.findByLoan(21).size() == 2); instalmentService.createAndSave(form); Assert.isTrue(instalmentService.findByLoan(21).size() == 7); unauthenticate(); } /* * An actor who is authenticated as an bank must be able to * create an investment regarding an existing demo * * Error: Loan not exist */ @Test(expected = java.lang.IllegalArgumentException.class) public void testNegativeCreateIntalmentLoanNotExist(){ CreateInstalmentsForm form; Calendar cal; authenticate("bank1"); form = new CreateInstalmentsForm(); cal = Calendar.getInstance(); cal.set(2016, 12, 04, 12, 00); form.setLoanId(210000); form.setNumber(5); form.setDate(cal.getTime()); Assert.isTrue(instalmentService.findByLoan(21).size() == 2); instalmentService.createAndSave(form); Assert.isTrue(instalmentService.findByLoan(21).size() == 7); unauthenticate(); } /* * An actor who is authenticated as an bank must be able to * create an investment regarding an existing demo * * Error: Loan not exist */ @Test(expected = java.lang.IllegalArgumentException.class) public void testNegativeCreateIntalmentNumberNegative(){ CreateInstalmentsForm form; Calendar cal; authenticate("bank1"); form = new CreateInstalmentsForm(); cal = Calendar.getInstance(); cal.set(2016, 12, 04, 12, 00); form.setLoanId(21); form.setNumber(-5); form.setDate(cal.getTime()); Assert.isTrue(instalmentService.findByLoan(21).size() == 2); instalmentService.createAndSave(form); Assert.isTrue(instalmentService.findByLoan(21).size() == 7); unauthenticate(); } /* * An actor who is authenticated as an bank must be able to * set an instalment as paid */ @Test public void testPositivePayIntalment(){ Instalment instalment; authenticate("bank1"); instalmentService.pay(77); instalment = instalmentService.findOne(77); Assert.isTrue(!instalment.getPaid().equals(null)); unauthenticate(); } /* * An actor who is authenticated as an bank must be able to * set an instalment as paid * * Error: Banknot logged */ @Test(expected = java.lang.IllegalArgumentException.class) public void testPositivePayIntalmentWithoutBank(){ Instalment instalment; instalmentService.pay(77); instalment = instalmentService.findOne(77); Assert.isTrue(!instalment.getPaid().equals(null)); unauthenticate(); } }
UTF-8
Java
3,988
java
InstalmentServiceTest.java
Java
[]
null
[]
package services; import java.util.Calendar; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.transaction.TransactionConfiguration; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import domain.Instalment; import utilities.AbstractTest; import forms.CreateInstalmentsForm; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:spring/datasource.xml", "classpath:spring/config/packages.xml" }) @Transactional @TransactionConfiguration(defaultRollback = true) public class InstalmentServiceTest extends AbstractTest { //BAsed services test--- @Autowired private InstalmentService instalmentService; /* * An actor who is authenticated as an bank must be able to * create an investment regarding an existing demo */ @Test public void testPositiveCreateIntalment(){ CreateInstalmentsForm form; Calendar cal; authenticate("bank1"); form = new CreateInstalmentsForm(); cal = Calendar.getInstance(); cal.set(2016, 12, 04, 12, 00); form.setLoanId(21); form.setNumber(5); form.setDate(cal.getTime()); Assert.isTrue(instalmentService.findByLoan(21).size() == 2); instalmentService.createAndSave(form); Assert.isTrue(instalmentService.findByLoan(21).size() == 7); unauthenticate(); } /* * An actor who is authenticated as an bank must be able to * create an investment regarding an existing demo * * Error: Loan not exist */ @Test(expected = java.lang.IllegalArgumentException.class) public void testNegativeCreateIntalmentLoanNotExist(){ CreateInstalmentsForm form; Calendar cal; authenticate("bank1"); form = new CreateInstalmentsForm(); cal = Calendar.getInstance(); cal.set(2016, 12, 04, 12, 00); form.setLoanId(210000); form.setNumber(5); form.setDate(cal.getTime()); Assert.isTrue(instalmentService.findByLoan(21).size() == 2); instalmentService.createAndSave(form); Assert.isTrue(instalmentService.findByLoan(21).size() == 7); unauthenticate(); } /* * An actor who is authenticated as an bank must be able to * create an investment regarding an existing demo * * Error: Loan not exist */ @Test(expected = java.lang.IllegalArgumentException.class) public void testNegativeCreateIntalmentNumberNegative(){ CreateInstalmentsForm form; Calendar cal; authenticate("bank1"); form = new CreateInstalmentsForm(); cal = Calendar.getInstance(); cal.set(2016, 12, 04, 12, 00); form.setLoanId(21); form.setNumber(-5); form.setDate(cal.getTime()); Assert.isTrue(instalmentService.findByLoan(21).size() == 2); instalmentService.createAndSave(form); Assert.isTrue(instalmentService.findByLoan(21).size() == 7); unauthenticate(); } /* * An actor who is authenticated as an bank must be able to * set an instalment as paid */ @Test public void testPositivePayIntalment(){ Instalment instalment; authenticate("bank1"); instalmentService.pay(77); instalment = instalmentService.findOne(77); Assert.isTrue(!instalment.getPaid().equals(null)); unauthenticate(); } /* * An actor who is authenticated as an bank must be able to * set an instalment as paid * * Error: Banknot logged */ @Test(expected = java.lang.IllegalArgumentException.class) public void testPositivePayIntalmentWithoutBank(){ Instalment instalment; instalmentService.pay(77); instalment = instalmentService.findOne(77); Assert.isTrue(!instalment.getPaid().equals(null)); unauthenticate(); } }
3,988
0.708626
0.688064
152
24.223684
22.685841
112
false
false
0
0
0
0
0
0
1.842105
false
false
9
2907885499441b0cd9bdb8d5aab8927917275388
21,680,994,929,893
9967cfcacd72683b74c4daa0d4ec8978902ea3cc
/src/main/java/com/stone/bean/Company.java
3e958252828e2c7d7cd696c2826a1864a325d4a1
[]
no_license
Shi-J/SJ_Graduation_Project
https://github.com/Shi-J/SJ_Graduation_Project
3a5d0ecc330a8ed8da4e6ea0443acf9ed6de51ab
838e6e3176486c0070e4ce30db8120eaaac57361
refs/heads/master
2022-12-11T18:19:09.817000
2020-08-31T09:33:20
2020-08-31T09:33:20
291,671,155
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.stone.bean; public class Company { private int id; private String email; private String name; private String website; private String city; private String select_industry_hidden; private String select_scale_hidden; private String temptation; private String principal; private String phone; public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public int getId() { return id; } public String getEmail() { return email; } public String getWebsite() { return website; } public String getSelect_industry_hidden() { return select_industry_hidden; } public String getTemptation() { return temptation; } public String getPrincipal() { return principal; } public void setPrincipal(String principal) { this.principal = principal; } public void setTemptation(String temptation) { this.temptation = temptation; } public String getSelect_scale_hidden() { return select_scale_hidden; } public void setSelect_scale_hidden(String select_scale_hidden) { this.select_scale_hidden = select_scale_hidden; } public void setSelect_industry_hidden(String select_industry_hidden) { this.select_industry_hidden = select_industry_hidden; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public void setWebsite(String website) { this.website = website; } public String getName() { return name; } public void setName(String name) { this.name = name; } public void setEmail(String email) { this.email = email; } public void setId(int id) { this.id = id; } @Override public String toString() { return "Company{" + "id=" + id + ", email='" + email + '\'' + ", name='" + name + '\'' + ", website='" + website + '\'' + ", city='" + city + '\'' + ", select_industry_hidden='" + select_industry_hidden + '\'' + ", select_scale_hidden='" + select_scale_hidden + '\'' + ", temptation='" + temptation + '\'' + ", principal='" + principal + '\'' + ", phone='" + phone + '\'' + '}'; } }
UTF-8
Java
2,543
java
Company.java
Java
[ { "context": "l='\" + email + '\\'' +\n \", name='\" + name + '\\'' +\n \", website='\" + website ", "end": 2107, "score": 0.9890853762626648, "start": 2103, "tag": "NAME", "value": "name" } ]
null
[]
package com.stone.bean; public class Company { private int id; private String email; private String name; private String website; private String city; private String select_industry_hidden; private String select_scale_hidden; private String temptation; private String principal; private String phone; public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public int getId() { return id; } public String getEmail() { return email; } public String getWebsite() { return website; } public String getSelect_industry_hidden() { return select_industry_hidden; } public String getTemptation() { return temptation; } public String getPrincipal() { return principal; } public void setPrincipal(String principal) { this.principal = principal; } public void setTemptation(String temptation) { this.temptation = temptation; } public String getSelect_scale_hidden() { return select_scale_hidden; } public void setSelect_scale_hidden(String select_scale_hidden) { this.select_scale_hidden = select_scale_hidden; } public void setSelect_industry_hidden(String select_industry_hidden) { this.select_industry_hidden = select_industry_hidden; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public void setWebsite(String website) { this.website = website; } public String getName() { return name; } public void setName(String name) { this.name = name; } public void setEmail(String email) { this.email = email; } public void setId(int id) { this.id = id; } @Override public String toString() { return "Company{" + "id=" + id + ", email='" + email + '\'' + ", name='" + name + '\'' + ", website='" + website + '\'' + ", city='" + city + '\'' + ", select_industry_hidden='" + select_industry_hidden + '\'' + ", select_scale_hidden='" + select_scale_hidden + '\'' + ", temptation='" + temptation + '\'' + ", principal='" + principal + '\'' + ", phone='" + phone + '\'' + '}'; } }
2,543
0.545026
0.545026
115
21.113043
19.500174
78
false
false
0
0
0
0
0
0
0.356522
false
false
9
0d0ad57736056966719fef9d732e8bf0a3ba5fe6
11,991,548,718,905
791f642469c318458ab340a20118316deaa4261e
/pandemicOnlineProject/src/Game/Card.java
a1c0cd9145285ba5af1aa86f88de08289e63d490
[]
no_license
solly29/PANDEMIC_project
https://github.com/solly29/PANDEMIC_project
316679aa644f65eb75985fed657daa7ae13c65fa
a5bddc5b6ffaa70c7e66fb7d36e692b026d0dab2
refs/heads/master
2020-07-21T04:40:48.341000
2019-12-12T00:05:02
2019-12-12T00:05:02
206,756,998
1
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package Game; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.Graphics2D; import java.awt.Image; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.io.IOException; import java.util.ArrayList; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ScrollPaneConstants; import Game.Point; import Game.AirplanePanel.AirplaneEvent; import pandemic.Client; //카드의 사용처 //1. 같은 색상 다섯장을 모아 백신을 만들수있다. //2. 카드를 사용하여 능력을 쓸수있다. 일반카드의 경우 해당도시로 이동하고 special카드일 경우 쓰여져있는 텍스트의 기능을 발휘한다. public class Card extends JLabel { // 일반적이 카드다. 카드 사용시 CityName 도시로 이동할수있다. String CityName;// 도시이름 String color;// 도시색깔 빨강,파랑,노랑,검 ControlPanel Controlpanel; String filename;// 불러올 이미지 파일 이름 Point pos = new Point(0, 0);// 현재 그 도시카드의 좌표를 받아온다. 도시카드의 이름으로 알수있다. public Card(ControlPanel Controlpanel, String CityName, String color) { this.Controlpanel = Controlpanel; this.CityName = CityName; this.color = color; pos = Controlpanel.Mainpanel.citys.CityPosition(CityName);// 그 도시의 위치를 받아온다 Image Card = new ImageIcon(Card.class.getResource("../Image/CityCard" + color + ".png")).getImage();// 카드의 일반이미지 Image CardPush = new ImageIcon(Card.class.getResource("../Image/CityCard" + color + "Push.png")).getImage();// 카드눌릴시이미지 BufferedImage BufferedCard = new BufferedImage(Card.getWidth(null), Card.getHeight(null), BufferedImage.TYPE_3BYTE_BGR);// 주의! 이미지에서 바로 getGraphics이 먹히지 않으므로 버퍼드이미지에서 글자를 그린다. // 카드를 합성하기 위해 먼저 버퍼드이미지로 기존 카드 크기만큼 그린뒤 Graphics2D g = (Graphics2D) BufferedCard.getGraphics();// 그 그래픽을 빼온다. g.drawImage(Card, 0, 0, null);// 그 후 거기 카드이미지를 그린다 g.setFont(new Font("굴림", Font.BOLD, 30));// 폰트를 설정하고 g.setColor(Color.BLACK);// 색상을 설정하고 g.drawString(CityName, 7, 41);// 도시의 이름을 카드에 적는다. g.drawString(CityName, 7, 260); // 카드를 위해 올렸을 때의 이미지 BufferedImage BufferedCardPush = new BufferedImage(CardPush.getWidth(null), CardPush.getHeight(null), BufferedImage.TYPE_3BYTE_BGR); Graphics2D gp = (Graphics2D) BufferedCardPush.getGraphics(); gp.drawImage(CardPush, 0, 0, null); gp.setFont(new Font("굴림", Font.BOLD, 30)); gp.setColor(Color.BLACK); gp.drawString(CityName, 7, 41); gp.drawString(CityName, 7, 260); this.setIcon(new ImageIcon(BufferedCard));// 카드(라벨)의 기본 이미지 설정 this.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { setIcon(new ImageIcon(BufferedCardPush));// 마우스가 카드 위에 올라갔을 때 색상이 바뀌게. } public void mouseExited(MouseEvent e) { setIcon(new ImageIcon(BufferedCard));// 마우스가 떼졌을 때 카드의 색상이 원래대로 } public void mousePressed(MouseEvent e) { if (!Client.CardPrint) { try { Controlpanel.Havecard.removeCard(CityName);// 해당카드를 손패에서 제거한다 Controlpanel.Mainpanel.GameOutStream.writeUTF("[이동]" + Client.name + ":" + CityName); // 일반카드의 쓰임새인 이동이다 } catch (IOException e1) { e1.printStackTrace(); } } } }); } public Card(String CityName, String color) {// 특수 카드를 사용하기 위해 만들어진 생성자이다. this.CityName = CityName;// 카드 이름 this.color = color;// 카드 색상 if (color.equals("special")) filename = CityName; else filename = "CityCard" + color; Image Card = new ImageIcon(Card.class.getResource("../Image/" + filename + ".png")).getImage(); BufferedImage BufferedCard = new BufferedImage(Card.getWidth(null), Card.getHeight(null), BufferedImage.TYPE_3BYTE_BGR);// 주의! 이미지에서 바로 getGraphics이 먹히지 않으므로 버퍼드이미지에서 글자를 그린다. Graphics2D g = (Graphics2D) BufferedCard.getGraphics(); g.drawImage(Card, 0, 0, null); g.setFont(new Font("굴림", Font.BOLD, 30)); g.setColor(Color.BLACK); if (!color.equals("special")) { g.drawString(CityName, 7, 41); g.drawString(CityName, 7, 260); } this.setIcon(new ImageIcon(BufferedCard)); } public String getCityName() { return CityName; } public String getColor() { return color; } public Card(String CityName) { this.color = "special"; } } //기존 카드를 상속받는 특수카드들이다. class PeaceNightCard extends Card { // 여기서 CityName은 "평온한 하룻밤". 다음 도시 감연 단계를 생략합니다 public PeaceNightCard(ControlPanel Controlpanel, String CityName) { super(CityName); this.CityName = "평온한 하룻밤"; this.color = "special"; ImageIcon Card = new ImageIcon(Card.class.getResource("../Image/" + CityName + ".png"));// 도시의 일반 이미지 ImageIcon CardPush = new ImageIcon(Card.class.getResource("../Image/" + CityName + "Push.png"));// 커서가위에 올라갔을때 // 이미지 setIcon(Card);// 기본아이콘 설정 this.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { setIcon((CardPush));// 마우스가 카드 위에 올라갔을 때 색상이 바뀌게. } public void mouseExited(MouseEvent e) { setIcon((Card));// 마우스가 떼졌을 때 카드의 색상이 원래대로 } public void mousePressed(MouseEvent e) { // 평온한 하룻밤의 이벤트의 경우 서버에서 처리해준다. if (!Client.CardPrint) { try { Controlpanel.Havecard.removeCard(CityName); Controlpanel.invalidate(); Controlpanel.removeAll(); Controlpanel.add(new BasicSelect(Controlpanel)); Controlpanel.revalidate(); Controlpanel.repaint(); Controlpanel.Mainpanel.GameOutStream.writeUTF("[특수]평온한 하룻밤"); Controlpanel.setBounds(0, 840, 1920, 240); } catch (Exception e1) { // TODO: handle exception e1.printStackTrace(); } } } }); } } class PredictCard extends Card {// 예측 전염카드 덱위에서 6장을 뽑아서 유저가 원하는 순서대로 덱위에 엎을수있다. public PredictCard(ControlPanel Controlpanel, String CityName) { super(CityName); this.CityName = "예측"; this.color = "special"; ImageIcon Card = new ImageIcon(Card.class.getResource("../Image/" + CityName + ".png")); ImageIcon CardPush = new ImageIcon(Card.class.getResource("../Image/" + CityName + "Push.png")); setIcon(Card); this.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { setIcon((CardPush));// 마우스가 카드 위에 올라갔을 때 색상이 바뀌게. } public void mouseExited(MouseEvent e) { setIcon((Card));// 마우스가 떼졌을 때 카드의 색상이 원래대로 } public void mousePressed(MouseEvent e) { // 이것도 서버가 처리해줘야한다 전염카드 덱위에서 6장을 뽑아서 유저가 원하는 순서대로 덱위에 엎을수있다. if (!Client.CardPrint) { try { Controlpanel.Havecard.removeCard(CityName); Controlpanel.Mainpanel.GameOutStream.writeUTF("[예측]사용"); } catch (IOException e1) { e1.printStackTrace(); } } } }); } } class EmergencyAirCard extends Card {// 긴급공중수송 원하는 도시로 이동 가능 ControlPanel Controlpanel; public EmergencyAirCard(ControlPanel Controlpanel, String CityName) { super(CityName); this.Controlpanel = Controlpanel; this.CityName = "긴급공중수송"; this.color = "special"; ImageIcon Card = new ImageIcon(Card.class.getResource("../Image/" + CityName + ".png")); ImageIcon CardPush = new ImageIcon(Card.class.getResource("../Image/" + CityName + "Push.png")); setIcon(Card); this.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { setIcon((CardPush)); } public void mouseExited(MouseEvent e) { setIcon((Card)); } public void mousePressed(MouseEvent e) { // 긴급공중수송의 경우 원하는 지역으로 이동할수있다. if (!Client.CardPrint) { Controlpanel.Havecard.removeCard(CityName);// 긴급공중수송을 삭제하고 Controlpanel.invalidate(); Controlpanel.removeAll(); Controlpanel.add(new EmergencyAirPanel());//내부클래스 EmergencyAirPanel을 불러온다. Controlpanel.revalidate(); Controlpanel.repaint(); } } }); } public class EmergencyAirPanel extends ControlShape { JPanel Scrollin;// 스크롤 안에 넣을 패널 JScrollPane scroll;// 스크롤 ImageIcon button = new ImageIcon(AirplanePanel.class.getResource("../Image/airplane2.png"));// 버튼용 이미지 String CharacterCurrentCity;// 캐릭터의 현재 위치 즉 현재 도시를 나타낸다. public EmergencyAirPanel() { Scrollin = new ControlShape();// 스크롤 안에 이미지를 넣으려니 스크롤이 이미지를 가려서 아예 스크롤안에넣는 패널에 이런 이미지를달았다. Scrollin.setLayout(new FlowLayout(FlowLayout.CENTER, 50, 20)); Scrollin.setPreferredSize(new Dimension(1920, 600));// 스크롤 안 패널 크기 설정 scroll = new JScrollPane(Scrollin);// 스크롤 안에 스크롤인패널을 넣는다. scroll.setPreferredSize(new Dimension(1920,600));// 스크롤도 사이즈를 설정해준다 scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);// 열로는 항상설정 scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);// 행으로는 절대 안설정 setLayout(new BorderLayout()); setPreferredSize(new Dimension(1920, 600)); String[] text = Controlpanel.Mainpanel.citys.returntext();// 시티명은 앞의 한글자는 공백. 총 49개다 JLabel[] lcity = new JLabel[48];// 선택할 도시들의 이름 라벨(버튼역할) CharacterCurrentCity = Controlpanel.Mainpanel.characterList.get(Client.name).getCurrentposition(); // 캐릭터 현재 위치 도시 Font font = new Font("HY헤드라인M", Font.PLAIN, 20);// 폰트 // 캐릭터의 손패와 현재위치한 도시가 같은지 확인 만약 일치하다면 이제 항공기로 플레이어가 어디든 갈수있게 해야한다. for (int j = 0; j < 48; j++) { lcity[j] = new JLabel(text[j + 1], button, JLabel.CENTER);// 라벨에 이미지,텍스트 설정 중앙 lcity[j].setVerticalTextPosition(JLabel.BOTTOM);// 텍스트 설정 lcity[j].addMouseListener(new AirplaneEvent());// 라벨(버튼)에 마우스 액션 추가 lcity[j].setFont(font);// 폰트 설정 lcity[j].setForeground(Color.white);// 글자색 설정 Scrollin.add(lcity[j]); } add(scroll); } // 마우스 어뎁터 class AirplaneEvent extends MouseAdapter { public void mousePressed(MouseEvent e) { if (!Client.CardPrint) {// 만약 현재 유저 턴이라면 JLabel label = (JLabel) e.getSource();// 라벨의 값을 가지고 온다 String Choicecity = label.getText();// 그 라벨의 텍스트 즉 유저가 가고 싶은 도시명을 읽은 후 try { Controlpanel.Mainpanel.GameOutStream.writeUTF("[이동]" + Client.name + ":" + Choicecity); // 게임소켓을 통해 유저가 해당 위치로 이동했다고 알린다. } catch (IOException e1) { e1.printStackTrace(); } } } } } } class GrandOfMoneyCard extends Card {// 정부보조금 // 원하는 위치에 실험실을 지을 수 있다. ControlPanel Controlpanel; public GrandOfMoneyCard(ControlPanel Controlpanel, String CityName) { super(CityName); this.Controlpanel = Controlpanel; this.CityName = "정부보조금"; this.color = "special"; ImageIcon Card = new ImageIcon(Card.class.getResource("../Image/" + CityName + ".png")); ImageIcon CardPush = new ImageIcon(Card.class.getResource("../Image/" + CityName + "Push.png")); setIcon(Card); this.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { setIcon((CardPush));// 마우스가 카드 위에 올라갔을 때 색상이 바뀌게. } public void mouseExited(MouseEvent e) { setIcon((Card));// 마우스가 떼졌을 때 카드의 색상이 원래대로 } public void mousePressed(MouseEvent e) { if (!Client.CardPrint) {// 만약 클라의 턴이라면 Controlpanel.Havecard.removeCard(CityName);// 해당 카드를 제거하고 Controlpanel.invalidate(); Controlpanel.removeAll(); Controlpanel.add(new GrantOfMoneyPanel(Controlpanel));// 정부보조금 패널을 추가한다 Controlpanel.revalidate(); Controlpanel.repaint(); } } }); } class GrantOfMoneyPanel extends ControlShape { ControlPanel Controlpanel; JPanel Scrollin;// 스크롤 안에 넣을 패널 JScrollPane scroll;// 스크롤 ImageIcon button = new ImageIcon(AirplanePanel.class.getResource("../Image/airplane2.png"));// 버튼용 이미지 GrantOfMoneyPanel(ControlPanel Controlpanel) { setLayout(new BorderLayout()); this.Controlpanel = Controlpanel; Scrollin = new ControlShape();// 스크롤 안에 이미지를 넣으려니 스크롤이 이미지를 가려서 아예 스크롤안에넣는 패널에 이런 이미지를달았다. Scrollin.setLayout(new FlowLayout(FlowLayout.CENTER, 50, 20)); Scrollin.setPreferredSize(new Dimension(1920, 600));// 스크롤 안 패널 크기 설정 scroll = new JScrollPane(Scrollin);// 스크롤 안에 스크롤인패널을 넣는다. scroll.setPreferredSize(new Dimension(1920, 600));// 스크롤도 사이즈를 설정해준다 scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);// 열로는 항상설정 scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);// 행으로는 절대 안설정 String[] text = Controlpanel.Mainpanel.citys.returntext(); JLabel[] lcity = new JLabel[48]; Font font = new Font("HY헤드라인M", Font.PLAIN, 20);// 폰트 for (int i = 0; i < 48; i++) { lcity[i] = new JLabel(text[i + 1], button, JLabel.CENTER);// 라벨에 이미지,텍스트 설정 중앙 lcity[i].setVerticalTextPosition(JLabel.BOTTOM);// 텍스트 설정 lcity[i].addMouseListener(new GrantOfMoneyControl()); lcity[i].setFont(font);// 폰트 설정 lcity[i].setForeground(Color.white);// 글자색 설정 Scrollin.add(lcity[i]); } add(scroll); } class GrantOfMoneyControl extends MouseAdapter { public void mousePressed(MouseEvent e) { JLabel label = (JLabel) e.getSource(); String Choicecity = label.getText(); City choice = Controlpanel.Mainpanel.citys.returnCity(Choicecity); try { Controlpanel.Mainpanel.GameOutStream.writeUTF("[건설]" + Client.name + ":" + Choicecity); } catch (IOException e1) { e1.printStackTrace(); } } } } } class PowerUp extends Card {// 파워업 카드 //현재 캐릭터가 위치한 도시 카드를 얻는다. public PowerUp(ControlPanel Controlpanel, String CityName) { super(CityName); this.CityName = "파워업"; this.color = "special"; ImageIcon Card = new ImageIcon(Card.class.getResource("../Image/" + CityName + ".png")); ImageIcon CardPush = new ImageIcon(Card.class.getResource("../Image/" + CityName + "Push.png")); setIcon(Card); this.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { setIcon((CardPush));// 마우스가 카드 위에 올라갔을 때 색상이 바뀌게. } public void mouseExited(MouseEvent e) { setIcon((Card));// 마우스가 떼졌을 때 카드의 색상이 원래대로 } public void mousePressed(MouseEvent e) { if (!Client.CardPrint) { Controlpanel.Havecard.removeCard(CityName); String WillCard = Controlpanel.Mainpanel.characterList.get(Client.name).getCurrentposition(); // WillCard는 현재 유저의 위치 도시이다. String Color = Controlpanel.Mainpanel.citys.returnCity(WillCard).getColor();// 현재 위치 도시의 색을 얻어낸다 Controlpanel.Havecard.insertCard(Controlpanel, WillCard, Color);// 손패에 해당카드를 추가한다 Controlpanel.invalidate(); Controlpanel.removeAll(); Controlpanel.add(new BasicSelect(Controlpanel)); Controlpanel.revalidate(); Controlpanel.repaint(); } } }); } }
UTF-8
Java
17,034
java
Card.java
Java
[]
null
[]
package Game; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.Graphics2D; import java.awt.Image; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.io.IOException; import java.util.ArrayList; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ScrollPaneConstants; import Game.Point; import Game.AirplanePanel.AirplaneEvent; import pandemic.Client; //카드의 사용처 //1. 같은 색상 다섯장을 모아 백신을 만들수있다. //2. 카드를 사용하여 능력을 쓸수있다. 일반카드의 경우 해당도시로 이동하고 special카드일 경우 쓰여져있는 텍스트의 기능을 발휘한다. public class Card extends JLabel { // 일반적이 카드다. 카드 사용시 CityName 도시로 이동할수있다. String CityName;// 도시이름 String color;// 도시색깔 빨강,파랑,노랑,검 ControlPanel Controlpanel; String filename;// 불러올 이미지 파일 이름 Point pos = new Point(0, 0);// 현재 그 도시카드의 좌표를 받아온다. 도시카드의 이름으로 알수있다. public Card(ControlPanel Controlpanel, String CityName, String color) { this.Controlpanel = Controlpanel; this.CityName = CityName; this.color = color; pos = Controlpanel.Mainpanel.citys.CityPosition(CityName);// 그 도시의 위치를 받아온다 Image Card = new ImageIcon(Card.class.getResource("../Image/CityCard" + color + ".png")).getImage();// 카드의 일반이미지 Image CardPush = new ImageIcon(Card.class.getResource("../Image/CityCard" + color + "Push.png")).getImage();// 카드눌릴시이미지 BufferedImage BufferedCard = new BufferedImage(Card.getWidth(null), Card.getHeight(null), BufferedImage.TYPE_3BYTE_BGR);// 주의! 이미지에서 바로 getGraphics이 먹히지 않으므로 버퍼드이미지에서 글자를 그린다. // 카드를 합성하기 위해 먼저 버퍼드이미지로 기존 카드 크기만큼 그린뒤 Graphics2D g = (Graphics2D) BufferedCard.getGraphics();// 그 그래픽을 빼온다. g.drawImage(Card, 0, 0, null);// 그 후 거기 카드이미지를 그린다 g.setFont(new Font("굴림", Font.BOLD, 30));// 폰트를 설정하고 g.setColor(Color.BLACK);// 색상을 설정하고 g.drawString(CityName, 7, 41);// 도시의 이름을 카드에 적는다. g.drawString(CityName, 7, 260); // 카드를 위해 올렸을 때의 이미지 BufferedImage BufferedCardPush = new BufferedImage(CardPush.getWidth(null), CardPush.getHeight(null), BufferedImage.TYPE_3BYTE_BGR); Graphics2D gp = (Graphics2D) BufferedCardPush.getGraphics(); gp.drawImage(CardPush, 0, 0, null); gp.setFont(new Font("굴림", Font.BOLD, 30)); gp.setColor(Color.BLACK); gp.drawString(CityName, 7, 41); gp.drawString(CityName, 7, 260); this.setIcon(new ImageIcon(BufferedCard));// 카드(라벨)의 기본 이미지 설정 this.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { setIcon(new ImageIcon(BufferedCardPush));// 마우스가 카드 위에 올라갔을 때 색상이 바뀌게. } public void mouseExited(MouseEvent e) { setIcon(new ImageIcon(BufferedCard));// 마우스가 떼졌을 때 카드의 색상이 원래대로 } public void mousePressed(MouseEvent e) { if (!Client.CardPrint) { try { Controlpanel.Havecard.removeCard(CityName);// 해당카드를 손패에서 제거한다 Controlpanel.Mainpanel.GameOutStream.writeUTF("[이동]" + Client.name + ":" + CityName); // 일반카드의 쓰임새인 이동이다 } catch (IOException e1) { e1.printStackTrace(); } } } }); } public Card(String CityName, String color) {// 특수 카드를 사용하기 위해 만들어진 생성자이다. this.CityName = CityName;// 카드 이름 this.color = color;// 카드 색상 if (color.equals("special")) filename = CityName; else filename = "CityCard" + color; Image Card = new ImageIcon(Card.class.getResource("../Image/" + filename + ".png")).getImage(); BufferedImage BufferedCard = new BufferedImage(Card.getWidth(null), Card.getHeight(null), BufferedImage.TYPE_3BYTE_BGR);// 주의! 이미지에서 바로 getGraphics이 먹히지 않으므로 버퍼드이미지에서 글자를 그린다. Graphics2D g = (Graphics2D) BufferedCard.getGraphics(); g.drawImage(Card, 0, 0, null); g.setFont(new Font("굴림", Font.BOLD, 30)); g.setColor(Color.BLACK); if (!color.equals("special")) { g.drawString(CityName, 7, 41); g.drawString(CityName, 7, 260); } this.setIcon(new ImageIcon(BufferedCard)); } public String getCityName() { return CityName; } public String getColor() { return color; } public Card(String CityName) { this.color = "special"; } } //기존 카드를 상속받는 특수카드들이다. class PeaceNightCard extends Card { // 여기서 CityName은 "평온한 하룻밤". 다음 도시 감연 단계를 생략합니다 public PeaceNightCard(ControlPanel Controlpanel, String CityName) { super(CityName); this.CityName = "평온한 하룻밤"; this.color = "special"; ImageIcon Card = new ImageIcon(Card.class.getResource("../Image/" + CityName + ".png"));// 도시의 일반 이미지 ImageIcon CardPush = new ImageIcon(Card.class.getResource("../Image/" + CityName + "Push.png"));// 커서가위에 올라갔을때 // 이미지 setIcon(Card);// 기본아이콘 설정 this.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { setIcon((CardPush));// 마우스가 카드 위에 올라갔을 때 색상이 바뀌게. } public void mouseExited(MouseEvent e) { setIcon((Card));// 마우스가 떼졌을 때 카드의 색상이 원래대로 } public void mousePressed(MouseEvent e) { // 평온한 하룻밤의 이벤트의 경우 서버에서 처리해준다. if (!Client.CardPrint) { try { Controlpanel.Havecard.removeCard(CityName); Controlpanel.invalidate(); Controlpanel.removeAll(); Controlpanel.add(new BasicSelect(Controlpanel)); Controlpanel.revalidate(); Controlpanel.repaint(); Controlpanel.Mainpanel.GameOutStream.writeUTF("[특수]평온한 하룻밤"); Controlpanel.setBounds(0, 840, 1920, 240); } catch (Exception e1) { // TODO: handle exception e1.printStackTrace(); } } } }); } } class PredictCard extends Card {// 예측 전염카드 덱위에서 6장을 뽑아서 유저가 원하는 순서대로 덱위에 엎을수있다. public PredictCard(ControlPanel Controlpanel, String CityName) { super(CityName); this.CityName = "예측"; this.color = "special"; ImageIcon Card = new ImageIcon(Card.class.getResource("../Image/" + CityName + ".png")); ImageIcon CardPush = new ImageIcon(Card.class.getResource("../Image/" + CityName + "Push.png")); setIcon(Card); this.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { setIcon((CardPush));// 마우스가 카드 위에 올라갔을 때 색상이 바뀌게. } public void mouseExited(MouseEvent e) { setIcon((Card));// 마우스가 떼졌을 때 카드의 색상이 원래대로 } public void mousePressed(MouseEvent e) { // 이것도 서버가 처리해줘야한다 전염카드 덱위에서 6장을 뽑아서 유저가 원하는 순서대로 덱위에 엎을수있다. if (!Client.CardPrint) { try { Controlpanel.Havecard.removeCard(CityName); Controlpanel.Mainpanel.GameOutStream.writeUTF("[예측]사용"); } catch (IOException e1) { e1.printStackTrace(); } } } }); } } class EmergencyAirCard extends Card {// 긴급공중수송 원하는 도시로 이동 가능 ControlPanel Controlpanel; public EmergencyAirCard(ControlPanel Controlpanel, String CityName) { super(CityName); this.Controlpanel = Controlpanel; this.CityName = "긴급공중수송"; this.color = "special"; ImageIcon Card = new ImageIcon(Card.class.getResource("../Image/" + CityName + ".png")); ImageIcon CardPush = new ImageIcon(Card.class.getResource("../Image/" + CityName + "Push.png")); setIcon(Card); this.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { setIcon((CardPush)); } public void mouseExited(MouseEvent e) { setIcon((Card)); } public void mousePressed(MouseEvent e) { // 긴급공중수송의 경우 원하는 지역으로 이동할수있다. if (!Client.CardPrint) { Controlpanel.Havecard.removeCard(CityName);// 긴급공중수송을 삭제하고 Controlpanel.invalidate(); Controlpanel.removeAll(); Controlpanel.add(new EmergencyAirPanel());//내부클래스 EmergencyAirPanel을 불러온다. Controlpanel.revalidate(); Controlpanel.repaint(); } } }); } public class EmergencyAirPanel extends ControlShape { JPanel Scrollin;// 스크롤 안에 넣을 패널 JScrollPane scroll;// 스크롤 ImageIcon button = new ImageIcon(AirplanePanel.class.getResource("../Image/airplane2.png"));// 버튼용 이미지 String CharacterCurrentCity;// 캐릭터의 현재 위치 즉 현재 도시를 나타낸다. public EmergencyAirPanel() { Scrollin = new ControlShape();// 스크롤 안에 이미지를 넣으려니 스크롤이 이미지를 가려서 아예 스크롤안에넣는 패널에 이런 이미지를달았다. Scrollin.setLayout(new FlowLayout(FlowLayout.CENTER, 50, 20)); Scrollin.setPreferredSize(new Dimension(1920, 600));// 스크롤 안 패널 크기 설정 scroll = new JScrollPane(Scrollin);// 스크롤 안에 스크롤인패널을 넣는다. scroll.setPreferredSize(new Dimension(1920,600));// 스크롤도 사이즈를 설정해준다 scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);// 열로는 항상설정 scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);// 행으로는 절대 안설정 setLayout(new BorderLayout()); setPreferredSize(new Dimension(1920, 600)); String[] text = Controlpanel.Mainpanel.citys.returntext();// 시티명은 앞의 한글자는 공백. 총 49개다 JLabel[] lcity = new JLabel[48];// 선택할 도시들의 이름 라벨(버튼역할) CharacterCurrentCity = Controlpanel.Mainpanel.characterList.get(Client.name).getCurrentposition(); // 캐릭터 현재 위치 도시 Font font = new Font("HY헤드라인M", Font.PLAIN, 20);// 폰트 // 캐릭터의 손패와 현재위치한 도시가 같은지 확인 만약 일치하다면 이제 항공기로 플레이어가 어디든 갈수있게 해야한다. for (int j = 0; j < 48; j++) { lcity[j] = new JLabel(text[j + 1], button, JLabel.CENTER);// 라벨에 이미지,텍스트 설정 중앙 lcity[j].setVerticalTextPosition(JLabel.BOTTOM);// 텍스트 설정 lcity[j].addMouseListener(new AirplaneEvent());// 라벨(버튼)에 마우스 액션 추가 lcity[j].setFont(font);// 폰트 설정 lcity[j].setForeground(Color.white);// 글자색 설정 Scrollin.add(lcity[j]); } add(scroll); } // 마우스 어뎁터 class AirplaneEvent extends MouseAdapter { public void mousePressed(MouseEvent e) { if (!Client.CardPrint) {// 만약 현재 유저 턴이라면 JLabel label = (JLabel) e.getSource();// 라벨의 값을 가지고 온다 String Choicecity = label.getText();// 그 라벨의 텍스트 즉 유저가 가고 싶은 도시명을 읽은 후 try { Controlpanel.Mainpanel.GameOutStream.writeUTF("[이동]" + Client.name + ":" + Choicecity); // 게임소켓을 통해 유저가 해당 위치로 이동했다고 알린다. } catch (IOException e1) { e1.printStackTrace(); } } } } } } class GrandOfMoneyCard extends Card {// 정부보조금 // 원하는 위치에 실험실을 지을 수 있다. ControlPanel Controlpanel; public GrandOfMoneyCard(ControlPanel Controlpanel, String CityName) { super(CityName); this.Controlpanel = Controlpanel; this.CityName = "정부보조금"; this.color = "special"; ImageIcon Card = new ImageIcon(Card.class.getResource("../Image/" + CityName + ".png")); ImageIcon CardPush = new ImageIcon(Card.class.getResource("../Image/" + CityName + "Push.png")); setIcon(Card); this.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { setIcon((CardPush));// 마우스가 카드 위에 올라갔을 때 색상이 바뀌게. } public void mouseExited(MouseEvent e) { setIcon((Card));// 마우스가 떼졌을 때 카드의 색상이 원래대로 } public void mousePressed(MouseEvent e) { if (!Client.CardPrint) {// 만약 클라의 턴이라면 Controlpanel.Havecard.removeCard(CityName);// 해당 카드를 제거하고 Controlpanel.invalidate(); Controlpanel.removeAll(); Controlpanel.add(new GrantOfMoneyPanel(Controlpanel));// 정부보조금 패널을 추가한다 Controlpanel.revalidate(); Controlpanel.repaint(); } } }); } class GrantOfMoneyPanel extends ControlShape { ControlPanel Controlpanel; JPanel Scrollin;// 스크롤 안에 넣을 패널 JScrollPane scroll;// 스크롤 ImageIcon button = new ImageIcon(AirplanePanel.class.getResource("../Image/airplane2.png"));// 버튼용 이미지 GrantOfMoneyPanel(ControlPanel Controlpanel) { setLayout(new BorderLayout()); this.Controlpanel = Controlpanel; Scrollin = new ControlShape();// 스크롤 안에 이미지를 넣으려니 스크롤이 이미지를 가려서 아예 스크롤안에넣는 패널에 이런 이미지를달았다. Scrollin.setLayout(new FlowLayout(FlowLayout.CENTER, 50, 20)); Scrollin.setPreferredSize(new Dimension(1920, 600));// 스크롤 안 패널 크기 설정 scroll = new JScrollPane(Scrollin);// 스크롤 안에 스크롤인패널을 넣는다. scroll.setPreferredSize(new Dimension(1920, 600));// 스크롤도 사이즈를 설정해준다 scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);// 열로는 항상설정 scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);// 행으로는 절대 안설정 String[] text = Controlpanel.Mainpanel.citys.returntext(); JLabel[] lcity = new JLabel[48]; Font font = new Font("HY헤드라인M", Font.PLAIN, 20);// 폰트 for (int i = 0; i < 48; i++) { lcity[i] = new JLabel(text[i + 1], button, JLabel.CENTER);// 라벨에 이미지,텍스트 설정 중앙 lcity[i].setVerticalTextPosition(JLabel.BOTTOM);// 텍스트 설정 lcity[i].addMouseListener(new GrantOfMoneyControl()); lcity[i].setFont(font);// 폰트 설정 lcity[i].setForeground(Color.white);// 글자색 설정 Scrollin.add(lcity[i]); } add(scroll); } class GrantOfMoneyControl extends MouseAdapter { public void mousePressed(MouseEvent e) { JLabel label = (JLabel) e.getSource(); String Choicecity = label.getText(); City choice = Controlpanel.Mainpanel.citys.returnCity(Choicecity); try { Controlpanel.Mainpanel.GameOutStream.writeUTF("[건설]" + Client.name + ":" + Choicecity); } catch (IOException e1) { e1.printStackTrace(); } } } } } class PowerUp extends Card {// 파워업 카드 //현재 캐릭터가 위치한 도시 카드를 얻는다. public PowerUp(ControlPanel Controlpanel, String CityName) { super(CityName); this.CityName = "파워업"; this.color = "special"; ImageIcon Card = new ImageIcon(Card.class.getResource("../Image/" + CityName + ".png")); ImageIcon CardPush = new ImageIcon(Card.class.getResource("../Image/" + CityName + "Push.png")); setIcon(Card); this.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e) { setIcon((CardPush));// 마우스가 카드 위에 올라갔을 때 색상이 바뀌게. } public void mouseExited(MouseEvent e) { setIcon((Card));// 마우스가 떼졌을 때 카드의 색상이 원래대로 } public void mousePressed(MouseEvent e) { if (!Client.CardPrint) { Controlpanel.Havecard.removeCard(CityName); String WillCard = Controlpanel.Mainpanel.characterList.get(Client.name).getCurrentposition(); // WillCard는 현재 유저의 위치 도시이다. String Color = Controlpanel.Mainpanel.citys.returnCity(WillCard).getColor();// 현재 위치 도시의 색을 얻어낸다 Controlpanel.Havecard.insertCard(Controlpanel, WillCard, Color);// 손패에 해당카드를 추가한다 Controlpanel.invalidate(); Controlpanel.removeAll(); Controlpanel.add(new BasicSelect(Controlpanel)); Controlpanel.revalidate(); Controlpanel.repaint(); } } }); } }
17,034
0.693238
0.683831
416
32.985577
28.638241
121
false
false
0
0
0
0
0
0
3.110577
false
false
9
5dc904e02503dfd42fdfd5500daea3ef86b2e4ed
18,202,071,430,594
6079ab643f2d9b069d6d46dbeb0a3d1dde46f835
/EventTracker/Appliction/app/src/main/java/vm/eventtracker/Menu_Items/Help.java
e8187f0a52f8bf25abece23f6bd98722bbb9220d
[]
no_license
vmmirabella/projects
https://github.com/vmmirabella/projects
7a0ea475318b272601b6cfc99954d50ddccda3a1
d9cfdb59d97bfc06de7532fd5f9100503f54475d
refs/heads/master
2023-03-08T21:25:41.128000
2020-06-18T21:46:04
2020-06-18T21:46:04
70,096,244
0
0
null
false
2023-02-22T17:47:30
2016-10-05T20:21:45
2020-06-18T21:46:09
2023-02-22T17:47:30
41,963
0
0
2
C#
false
false
package vm.eventtracker.Menu_Items; import android.content.Intent; import android.content.SharedPreferences; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import vm.eventtracker.R; //inspiration for runOnUiThreads from: // https://stackoverflow.com/questions/11254523/android-runonuithread-explanation public class Help extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { loadTheme(); super.onCreate(savedInstanceState); setContentView(R.layout.activity_help); } //loads the theme as a thread, used before super.onCreate - doesn't work if used after public void loadTheme() { runOnUiThread(new Runnable() { public void run() { try { //inspired by:https://stackoverflow.com/questions/15025369/changing-the-theme-of-an-android-app-using-preferences SharedPreferences prefTheme = getSharedPreferences("Themes", 0); String themeReturned = prefTheme.getString("LightDark", "ThemeDark"); if (themeReturned.equals("ThemeDark")) setTheme(R.style.ThemeDark); else setTheme(R.style.ThemeLight); } catch (final Exception ex) { // Log.i("sortViewEntries", "Exception in thread"); } } }); } //if user goes to settings from Help and then trys to return it will load the theme public void onRestart() { super.onRestart(); finish(); startActivity(getIntent()); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_help, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { Intent intent = new Intent(Help.this, Settings.class); startActivity(intent); return true; } return super.onOptionsItemSelected(item); } }
UTF-8
Java
2,550
java
Help.java
Java
[]
null
[]
package vm.eventtracker.Menu_Items; import android.content.Intent; import android.content.SharedPreferences; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import vm.eventtracker.R; //inspiration for runOnUiThreads from: // https://stackoverflow.com/questions/11254523/android-runonuithread-explanation public class Help extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { loadTheme(); super.onCreate(savedInstanceState); setContentView(R.layout.activity_help); } //loads the theme as a thread, used before super.onCreate - doesn't work if used after public void loadTheme() { runOnUiThread(new Runnable() { public void run() { try { //inspired by:https://stackoverflow.com/questions/15025369/changing-the-theme-of-an-android-app-using-preferences SharedPreferences prefTheme = getSharedPreferences("Themes", 0); String themeReturned = prefTheme.getString("LightDark", "ThemeDark"); if (themeReturned.equals("ThemeDark")) setTheme(R.style.ThemeDark); else setTheme(R.style.ThemeLight); } catch (final Exception ex) { // Log.i("sortViewEntries", "Exception in thread"); } } }); } //if user goes to settings from Help and then trys to return it will load the theme public void onRestart() { super.onRestart(); finish(); startActivity(getIntent()); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_help, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { Intent intent = new Intent(Help.this, Settings.class); startActivity(intent); return true; } return super.onOptionsItemSelected(item); } }
2,550
0.629804
0.622745
72
34.416668
28.181826
133
false
false
0
0
0
0
0
0
0.486111
false
false
9
fdc1b6929de6cd29c7fe07dc252bd737f81fadce
30,322,469,142,951
b5449f03cc90116d294b62f72034fe0b547695c8
/practice-1-draw/src/main/java/com/zonsim/practice_1/practice/Practice6DrawLineView.java
b1e0a8d0a062838d2065ecfd9d5148176a75fbf7
[]
no_license
tangjw/HenCoder-learning
https://github.com/tangjw/HenCoder-learning
3a54b63faed475c20e513c41d7a08d1cc4e28fdf
2572f669570651df122fb724c6aa2442e6895ba2
refs/heads/master
2021-04-12T05:25:49.633000
2018-03-19T15:32:04
2018-03-19T15:32:04
109,374,819
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.zonsim.practice_1.practice; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.View; public class Practice6DrawLineView extends View { public Practice6DrawLineView(Context context) { super(context); } public Practice6DrawLineView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public Practice6DrawLineView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); // 练习内容:使用 canvas.drawLine() 方法画直线 Paint paint = new Paint(); // canvas.drawLine(100,100,500,100,paint); // 0 1 2 3 4 5 6 7 8 9 10 11 float[] points = {100, 100, 100, 300, 800, 400, 500, 500, 200, 150, 700, 900}; // canvas.drawLines(points, paint); canvas.drawLines(points, 1, 8, paint); } }
UTF-8
Java
1,207
java
Practice6DrawLineView.java
Java
[]
null
[]
package com.zonsim.practice_1.practice; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.View; public class Practice6DrawLineView extends View { public Practice6DrawLineView(Context context) { super(context); } public Practice6DrawLineView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public Practice6DrawLineView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); // 练习内容:使用 canvas.drawLine() 方法画直线 Paint paint = new Paint(); // canvas.drawLine(100,100,500,100,paint); // 0 1 2 3 4 5 6 7 8 9 10 11 float[] points = {100, 100, 100, 300, 800, 400, 500, 500, 200, 150, 700, 900}; // canvas.drawLines(points, paint); canvas.drawLines(points, 1, 8, paint); } }
1,207
0.621302
0.562975
43
26.511627
26.027153
99
false
false
0
0
0
0
0
0
0.953488
false
false
9
2beb769dbdb92dec0f90f96d1c992cf0ef8c5517
15,272,903,733,726
51081c226ff386b3c2c249d95dad219c777042b0
/src/rs/lazarpetrov/chess/board/Tile.java
358594e42ecb3fa1aef4426b337aefb7beb4fb10
[]
no_license
LazaP/ChessInJava
https://github.com/LazaP/ChessInJava
e18add7258efa369a6f80b5c3e05d80e70948356
91aa42145955db6f4c967acd72027a70218faf18
refs/heads/master
2017-12-05T01:49:53.189000
2016-11-07T14:45:45
2016-11-07T14:45:45
72,212,925
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package rs.lazarpetrov.chess.board; import rs.lazarpetrov.chess.pieces.Piece; /** * Created by lazap on 28.10.2016.. */ public class Tile { private Piece piece; public Tile(){ piece = null; } public Tile(Piece piece){ this.piece = piece; } /** * Returns true if the tile is occupied with a piece, false otherwise. * @return boolean */ public boolean isOccupied(){ if(piece == null) return false; return true; } /** * Removes piece from this tile. */ public void removePiece(){ this.piece = null; } public Piece getPiece() { return piece; } public void setPiece(Piece piece) { this.piece = piece; } }
UTF-8
Java
763
java
Tile.java
Java
[ { "context": "lazarpetrov.chess.pieces.Piece;\n\n/**\n * Created by lazap on 28.10.2016..\n */\npublic class Tile {\n priva", "end": 103, "score": 0.9996358752250671, "start": 98, "tag": "USERNAME", "value": "lazap" } ]
null
[]
package rs.lazarpetrov.chess.board; import rs.lazarpetrov.chess.pieces.Piece; /** * Created by lazap on 28.10.2016.. */ public class Tile { private Piece piece; public Tile(){ piece = null; } public Tile(Piece piece){ this.piece = piece; } /** * Returns true if the tile is occupied with a piece, false otherwise. * @return boolean */ public boolean isOccupied(){ if(piece == null) return false; return true; } /** * Removes piece from this tile. */ public void removePiece(){ this.piece = null; } public Piece getPiece() { return piece; } public void setPiece(Piece piece) { this.piece = piece; } }
763
0.558322
0.547837
43
16.744186
15.811525
74
false
false
0
0
0
0
0
0
0.255814
false
false
9
b9a591cff7af5b5d463324f657e7e90d12626ad1
6,339,371,765,351
bd1f79f99474bbb1efbdb65d1cf8c7ec157caa01
/cineast-runtime/src/main/java/org/vitrivr/cineast/standalone/run/path/NoContainerProvider.java
103a317128edc2911a2057ac5f27ed28f2ba712f
[ "MIT" ]
permissive
mpas97/cineast
https://github.com/mpas97/cineast
83084d7390ea4ae5fd1c40f44aeef01fac1d0129
82e3df6663ca5c3538ce0d2fe2a9421651b5eecd
refs/heads/dev
2022-12-27T21:15:20.781000
2020-09-14T11:38:32
2020-09-14T11:38:32
255,859,359
0
0
MIT
true
2020-09-22T09:36:19
2020-04-15T08:54:35
2020-09-14T12:06:01
2020-09-22T09:35:21
9,597
0
0
0
Java
false
false
package org.vitrivr.cineast.standalone.run.path; import org.vitrivr.cineast.standalone.run.ExtractionCompleteListener; import org.vitrivr.cineast.standalone.run.ExtractionContainerProvider; import org.vitrivr.cineast.standalone.run.ExtractionItemContainer; import java.util.List; import java.util.Optional; /** * Convenience Method when you don't want to actually provide Elements. * * @author silvan on 19.01.18. */ public class NoContainerProvider implements ExtractionContainerProvider, ExtractionCompleteListener { @Override public void onCompleted(ExtractionItemContainer path) { //Ignore } @Override public void close() { //Ignore } @Override public void addPaths(List<ExtractionItemContainer> pathList) { //Ignore } @Override public boolean isOpen() { return false; } @Override public boolean hasNextAvailable() { return false; } @Override public Optional<ExtractionItemContainer> next() { return Optional.empty(); } }
UTF-8
Java
999
java
NoContainerProvider.java
Java
[ { "context": "t want to actually provide Elements.\n *\n * @author silvan on 19.01.18.\n */\npublic class NoContainerProvider", "end": 406, "score": 0.9896284341812134, "start": 400, "tag": "USERNAME", "value": "silvan" } ]
null
[]
package org.vitrivr.cineast.standalone.run.path; import org.vitrivr.cineast.standalone.run.ExtractionCompleteListener; import org.vitrivr.cineast.standalone.run.ExtractionContainerProvider; import org.vitrivr.cineast.standalone.run.ExtractionItemContainer; import java.util.List; import java.util.Optional; /** * Convenience Method when you don't want to actually provide Elements. * * @author silvan on 19.01.18. */ public class NoContainerProvider implements ExtractionContainerProvider, ExtractionCompleteListener { @Override public void onCompleted(ExtractionItemContainer path) { //Ignore } @Override public void close() { //Ignore } @Override public void addPaths(List<ExtractionItemContainer> pathList) { //Ignore } @Override public boolean isOpen() { return false; } @Override public boolean hasNextAvailable() { return false; } @Override public Optional<ExtractionItemContainer> next() { return Optional.empty(); } }
999
0.747748
0.741742
46
20.717392
25.129805
101
false
false
0
0
0
0
0
0
0.217391
false
false
9
b281ddf65da5d85224fc05f5be350b6931da46b5
6,193,342,877,109
706221ec954d966508aa5a90f2969173466d9023
/cipango-server/src/main/java/org/cipango/server/bio/UdpConnector.java
3a606e35ce3cd5d31e1de307e4a13fb7458acdbb
[ "Apache-2.0" ]
permissive
dbroeglin/cipango
https://github.com/dbroeglin/cipango
c438a8ee2b95714a2f312d084da83f2c508f6d46
4fe778f0b59602160aa82055b1a3c994853d1f07
refs/heads/master
2020-06-04T15:48:46.340000
2011-04-06T21:11:35
2011-04-06T21:11:35
1,339,732
3
1
null
null
null
null
null
null
null
null
null
null
null
null
null
// ======================================================================== // Copyright 2008-2009 NEXCOM Systems // ------------------------------------------------------------------------ // 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.cipango.server.bio; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import javax.servlet.sip.URI; import org.cipango.server.AbstractSipConnector; import org.cipango.server.SipConnection; import org.cipango.server.SipConnector; import org.cipango.server.SipConnectors; import org.cipango.server.SipMessage; import org.cipango.server.SipRequest; import org.cipango.server.SipResponse; import org.cipango.sip.SipHeaders; import org.cipango.sip.SipParser; import org.cipango.sip.URIFactory; import org.cipango.sip.SipParser.EventHandler; import org.cipango.util.HexString; import org.eclipse.jetty.io.Buffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.View; import org.eclipse.jetty.util.log.Log; public class UdpConnector extends AbstractSipConnector { public static final int MAX_UDP_SIZE = 65536; public static final int DEFAULT_PORT = 5060; public static final boolean RELIABLE = false; private DatagramPacket[] _packets; private DatagramSocket _datagramSocket; private InetAddress _localAddr; protected void doStart() throws Exception { _packets = new DatagramPacket[getAcceptors()]; for (int i = 0; i < getAcceptors(); i++) { _packets[i] = new DatagramPacket(new byte[MAX_UDP_SIZE], MAX_UDP_SIZE); } super.doStart(); } protected void doStop() throws Exception { super.doStop(); } public void open() throws IOException { _datagramSocket = newDatagramSocket(); _localAddr = _datagramSocket.getLocalAddress(); } public boolean isOpen() { return _datagramSocket != null && !_datagramSocket.isClosed(); } public int getLocalPort() { if (_datagramSocket==null || _datagramSocket.isClosed()) return -1; return _datagramSocket.getLocalPort(); } public Object getConnection() { return _datagramSocket; } protected DatagramSocket newDatagramSocket() throws IOException { if (getHost() == null) _datagramSocket = new DatagramSocket(getPort()); else _datagramSocket = new DatagramSocket(getPort(), InetAddress.getByName(getHost())); return _datagramSocket; } public void close() { _datagramSocket.close(); } public void accept(int acceptorID) throws IOException, InterruptedException { DatagramPacket p = _packets[acceptorID]; _datagramSocket.receive(p); int length = p.getLength(); if (length == 2 || length == 4) return; byte[] b = new byte[length]; System.arraycopy(p.getData(), 0, b, 0, length); Buffer buffer = new ByteArrayBuffer(b); EventHandler handler = new EventHandler(); SipParser parser = new SipParser(buffer, handler); try { parser.parse(); SipMessage message = handler.getMessage(); message.setConnection(new UdpConnection(p.getAddress(), p.getPort())); /* message.set5uple(getTransportOrdinal(), getAddr(), getPort(), p.getAddress(), p.getPort()); if (message.isRequest()) ((SipRequest) message).setEndpoint(this); */ process(message); } catch (Throwable t) { if (_statsStartedAt != -1) { synchronized (_statsLock) { _nbParseErrors++; } } Log.warn(t); //if (handler.hasException()) //Log.warn(handler.getException()); if (Log.isDebugEnabled()) Log.debug("Buffer content: \r\n" + HexString.toDetailedHexString(buffer.array(), p.getLength())); } } public SipConnection getConnection(InetAddress address, int port) { return new UdpConnection(address, port); } public int getDefaultPort() { return DEFAULT_PORT; } public InetAddress getAddr() { return _localAddr; } public int getTransportOrdinal() { return SipConnectors.UDP_ORDINAL; } public boolean isReliable() { return RELIABLE; } public boolean isSecure() { return false; } public Buffer newBuffer() { return new ByteArrayBuffer(MAX_UDP_SIZE); } public SipConnector getConnector() { return this; } class UdpConnection implements SipConnection { private InetAddress _remoteAddr; private int _remotePort; public UdpConnection(InetAddress remoteAddr, int remotePort) { _remoteAddr = remoteAddr; _remotePort = remotePort; } public SipConnector getConnector() { return UdpConnector.this; } public InetAddress getLocalAddress() { return _localAddr; } public int getLocalPort() { return UdpConnector.this.getPort(); } public InetAddress getRemoteAddress() { return _remoteAddr; } public int getRemotePort() { return _remotePort; } public void write(Buffer buffer) throws IOException { DatagramPacket packet = new DatagramPacket( buffer.array(), buffer.length(), _remoteAddr, _remotePort); _datagramSocket.send(packet); } public boolean isOpen() { return (_datagramSocket != null && !_datagramSocket.isClosed()); } public String toString() { return "udp/" + _remoteAddr.getHostAddress() + ":" + _remotePort; } } class EventHandler extends SipParser.EventHandler { private SipMessage _message; @Override public void startRequest(Buffer method, Buffer uri, Buffer version) throws IOException { try { URI ruri = URIFactory.parseURI(uri.toString()); SipRequest request = new SipRequest(); request.setMethod(method.toString()); request.setRequestURI(ruri); _message = request; } catch (Exception e) { throw new IOException("Parsing error: " + e.getMessage()); } } @Override public void startResponse(Buffer version, int status, Buffer reason) throws IOException { SipResponse response = new SipResponse(); response.setStatus(status, reason.toString()); _message = response; } public SipMessage getMessage() { return _message; } @Override public void header(Buffer name, Buffer value) throws IOException { if (_message == null) throw new IOException("no status line"); if (SipHeaders.getType(name).isList()) { boolean quote = false; int start = value.getIndex(); int end = value.putIndex(); byte[] b = value.array(); //if (value == null) value = _value.asArray(); int startValue = start; int endValue = end; while (end > start && b[end -1] <= ' ') end--; for (int i = start; i < end; i++) { int c = b[i]; if (c == '"') quote = !quote; if (c == ',' && !quote) { endValue = i; while (endValue > start && b[endValue -1] <= ' ') endValue--; while (startValue < endValue && b[startValue] <= ' ') startValue++; //byte[] bValue = asArray(b, startValue, endValue - startValue); Buffer buffer = new View(value, startValue, startValue, endValue, Buffer.READONLY); _message.getFields().addBuffer(name, buffer); //value = new View(value, i + 1, i + 1, end, Buffer.READONLY); startValue = i + 1; } } while (startValue < end && b[startValue] <= ' ') startValue++; value = new View(value, startValue, startValue, end, Buffer.READONLY); //byte[] bValue = asArray(b, startValue, end - startValue); _message.getFields().addBuffer(name, value); //value = new View(value, startValue, startValue, end, Buffer.READONLY); } else { _message.getFields().addBuffer(name, value); //msg.getFields().addBuffer(name, new ByteArrayBuffer(value.asArray())); } } @Override public void content(Buffer buffer) throws IOException { if (buffer.length() > 0) _message.setRawContent(buffer.asArray()); // TODO buffer } } }
UTF-8
Java
9,390
java
UdpConnector.java
Java
[]
null
[]
// ======================================================================== // Copyright 2008-2009 NEXCOM Systems // ------------------------------------------------------------------------ // 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.cipango.server.bio; import java.io.IOException; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; import javax.servlet.sip.URI; import org.cipango.server.AbstractSipConnector; import org.cipango.server.SipConnection; import org.cipango.server.SipConnector; import org.cipango.server.SipConnectors; import org.cipango.server.SipMessage; import org.cipango.server.SipRequest; import org.cipango.server.SipResponse; import org.cipango.sip.SipHeaders; import org.cipango.sip.SipParser; import org.cipango.sip.URIFactory; import org.cipango.sip.SipParser.EventHandler; import org.cipango.util.HexString; import org.eclipse.jetty.io.Buffer; import org.eclipse.jetty.io.ByteArrayBuffer; import org.eclipse.jetty.io.View; import org.eclipse.jetty.util.log.Log; public class UdpConnector extends AbstractSipConnector { public static final int MAX_UDP_SIZE = 65536; public static final int DEFAULT_PORT = 5060; public static final boolean RELIABLE = false; private DatagramPacket[] _packets; private DatagramSocket _datagramSocket; private InetAddress _localAddr; protected void doStart() throws Exception { _packets = new DatagramPacket[getAcceptors()]; for (int i = 0; i < getAcceptors(); i++) { _packets[i] = new DatagramPacket(new byte[MAX_UDP_SIZE], MAX_UDP_SIZE); } super.doStart(); } protected void doStop() throws Exception { super.doStop(); } public void open() throws IOException { _datagramSocket = newDatagramSocket(); _localAddr = _datagramSocket.getLocalAddress(); } public boolean isOpen() { return _datagramSocket != null && !_datagramSocket.isClosed(); } public int getLocalPort() { if (_datagramSocket==null || _datagramSocket.isClosed()) return -1; return _datagramSocket.getLocalPort(); } public Object getConnection() { return _datagramSocket; } protected DatagramSocket newDatagramSocket() throws IOException { if (getHost() == null) _datagramSocket = new DatagramSocket(getPort()); else _datagramSocket = new DatagramSocket(getPort(), InetAddress.getByName(getHost())); return _datagramSocket; } public void close() { _datagramSocket.close(); } public void accept(int acceptorID) throws IOException, InterruptedException { DatagramPacket p = _packets[acceptorID]; _datagramSocket.receive(p); int length = p.getLength(); if (length == 2 || length == 4) return; byte[] b = new byte[length]; System.arraycopy(p.getData(), 0, b, 0, length); Buffer buffer = new ByteArrayBuffer(b); EventHandler handler = new EventHandler(); SipParser parser = new SipParser(buffer, handler); try { parser.parse(); SipMessage message = handler.getMessage(); message.setConnection(new UdpConnection(p.getAddress(), p.getPort())); /* message.set5uple(getTransportOrdinal(), getAddr(), getPort(), p.getAddress(), p.getPort()); if (message.isRequest()) ((SipRequest) message).setEndpoint(this); */ process(message); } catch (Throwable t) { if (_statsStartedAt != -1) { synchronized (_statsLock) { _nbParseErrors++; } } Log.warn(t); //if (handler.hasException()) //Log.warn(handler.getException()); if (Log.isDebugEnabled()) Log.debug("Buffer content: \r\n" + HexString.toDetailedHexString(buffer.array(), p.getLength())); } } public SipConnection getConnection(InetAddress address, int port) { return new UdpConnection(address, port); } public int getDefaultPort() { return DEFAULT_PORT; } public InetAddress getAddr() { return _localAddr; } public int getTransportOrdinal() { return SipConnectors.UDP_ORDINAL; } public boolean isReliable() { return RELIABLE; } public boolean isSecure() { return false; } public Buffer newBuffer() { return new ByteArrayBuffer(MAX_UDP_SIZE); } public SipConnector getConnector() { return this; } class UdpConnection implements SipConnection { private InetAddress _remoteAddr; private int _remotePort; public UdpConnection(InetAddress remoteAddr, int remotePort) { _remoteAddr = remoteAddr; _remotePort = remotePort; } public SipConnector getConnector() { return UdpConnector.this; } public InetAddress getLocalAddress() { return _localAddr; } public int getLocalPort() { return UdpConnector.this.getPort(); } public InetAddress getRemoteAddress() { return _remoteAddr; } public int getRemotePort() { return _remotePort; } public void write(Buffer buffer) throws IOException { DatagramPacket packet = new DatagramPacket( buffer.array(), buffer.length(), _remoteAddr, _remotePort); _datagramSocket.send(packet); } public boolean isOpen() { return (_datagramSocket != null && !_datagramSocket.isClosed()); } public String toString() { return "udp/" + _remoteAddr.getHostAddress() + ":" + _remotePort; } } class EventHandler extends SipParser.EventHandler { private SipMessage _message; @Override public void startRequest(Buffer method, Buffer uri, Buffer version) throws IOException { try { URI ruri = URIFactory.parseURI(uri.toString()); SipRequest request = new SipRequest(); request.setMethod(method.toString()); request.setRequestURI(ruri); _message = request; } catch (Exception e) { throw new IOException("Parsing error: " + e.getMessage()); } } @Override public void startResponse(Buffer version, int status, Buffer reason) throws IOException { SipResponse response = new SipResponse(); response.setStatus(status, reason.toString()); _message = response; } public SipMessage getMessage() { return _message; } @Override public void header(Buffer name, Buffer value) throws IOException { if (_message == null) throw new IOException("no status line"); if (SipHeaders.getType(name).isList()) { boolean quote = false; int start = value.getIndex(); int end = value.putIndex(); byte[] b = value.array(); //if (value == null) value = _value.asArray(); int startValue = start; int endValue = end; while (end > start && b[end -1] <= ' ') end--; for (int i = start; i < end; i++) { int c = b[i]; if (c == '"') quote = !quote; if (c == ',' && !quote) { endValue = i; while (endValue > start && b[endValue -1] <= ' ') endValue--; while (startValue < endValue && b[startValue] <= ' ') startValue++; //byte[] bValue = asArray(b, startValue, endValue - startValue); Buffer buffer = new View(value, startValue, startValue, endValue, Buffer.READONLY); _message.getFields().addBuffer(name, buffer); //value = new View(value, i + 1, i + 1, end, Buffer.READONLY); startValue = i + 1; } } while (startValue < end && b[startValue] <= ' ') startValue++; value = new View(value, startValue, startValue, end, Buffer.READONLY); //byte[] bValue = asArray(b, startValue, end - startValue); _message.getFields().addBuffer(name, value); //value = new View(value, startValue, startValue, end, Buffer.READONLY); } else { _message.getFields().addBuffer(name, value); //msg.getFields().addBuffer(name, new ByteArrayBuffer(value.asArray())); } } @Override public void content(Buffer buffer) throws IOException { if (buffer.length() > 0) _message.setRawContent(buffer.asArray()); // TODO buffer } } }
9,390
0.591374
0.587646
356
24.376404
24.180475
104
false
false
0
0
0
0
72
0.015335
2.101124
false
false
9
684d6c92aaec85287055a374b18374bed28ccc69
29,858,612,691,528
f214b58aebad81e8677ac702fb2f9f041a037fb5
/app/src/main/java/com/allure/designPattern/visit/ExpenditureCapital.java
bb9bb4f1d73df1daae6251cb05defb4e8d126bdc
[]
no_license
Allure0/AndroidDesignPattern
https://github.com/Allure0/AndroidDesignPattern
bd2e68025d09e38fec60dcd56fdcc661fc440224
0c35174f69813c28cb6189dc2a9162562ce2cfc7
refs/heads/master
2021-01-16T17:53:01.101000
2017-09-05T10:40:51
2017-09-05T10:40:51
100,017,938
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.allure.designPattern.visit; /** * 资金支出状况 * Created by Allure on 2017/8/30. */ public class ExpenditureCapital implements Capital { private String status;//订单的标记 支出还是收入 private double price;//金钱 public ExpenditureCapital() { } public ExpenditureCapital(String status, double price) { this.status = status; this.price = price; } @Override public void accept(Visitor visitor) { visitor.readExpenditureCapital(this); } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } }
UTF-8
Java
816
java
ExpenditureCapital.java
Java
[ { "context": ".designPattern.visit;\n\n/**\n * 资金支出状况\n * Created by Allure on 2017/8/30.\n */\n\npublic class ExpenditureCapita", "end": 75, "score": 0.9986763596534729, "start": 69, "tag": "NAME", "value": "Allure" } ]
null
[]
package com.allure.designPattern.visit; /** * 资金支出状况 * Created by Allure on 2017/8/30. */ public class ExpenditureCapital implements Capital { private String status;//订单的标记 支出还是收入 private double price;//金钱 public ExpenditureCapital() { } public ExpenditureCapital(String status, double price) { this.status = status; this.price = price; } @Override public void accept(Visitor visitor) { visitor.readExpenditureCapital(this); } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } }
816
0.624679
0.615681
43
17.093023
17.644835
60
false
false
0
0
0
0
0
0
0.255814
false
false
9
0424832d99a5dd3439bea55a721e5e3a4ce69c4e
26,414,048,931,767
12d40efa831adcdd26b034e34aea22855401a3ff
/src/main/java/cn/feng/thinkInJava/a9_2_泛型/generics/a15_04_00/泛型方法/GenericMethods.java
cf63a4e34684bec7639cb949faa1e2a201e07f41
[]
no_license
OnlyForSearch/fengyuFrame
https://github.com/OnlyForSearch/fengyuFrame
1fde3a3794d8fe6507c9380e6af3d571d2fec7f3
1c3abd9cdc0d0dc86cd5785e68ea57071ff04ecd
refs/heads/master
2019-08-08T22:44:14.721000
2018-01-14T07:48:02
2018-01-14T07:48:02
41,848,784
0
0
null
false
2015-10-26T00:36:00
2015-09-03T08:11:48
2015-09-03T08:24:29
2015-10-26T00:36:00
7,700
0
0
0
Java
null
null
package cn.feng.thinkInJava.a9_2_泛型.generics.a15_04_00.泛型方法; //: generics/GenericMethods.java /** * 泛型方法:是否拥有泛型方法与其所在类是否是泛型没有关系,泛型方法能够独立类存在而产生变化 * 基本指导原则:无论何时只要你能做到,你就应该尽量使用泛型方法,因为它可以使事情更清楚明白, * 另外,对于一个static的方法而言,需要使用泛型能力,就必须使其成为泛型方法 * * @author fengyu * @date 2015年8月9日 */ /**GenericMethods并不是参数化的,尽管这个类和其内部方法可以被同时参数化*/ public class GenericMethods { public static void main(String[] args) { GenericMethods gm = new GenericMethods(); //使用泛型方法时候通常不必指明参数类型,因为编译器会为我们找出具体的类型,这称为类型参数推断(type argumens inference) gm.f(""); //如果调用f()时传入基本类型,自动打包机制就会介入其中,将基本类型的值包装为对应的对象,事实上 //自动打包避免了我们自己不得不编写出来的代码 gm.f(1); gm.f(1.0); gm.f(1.0F); gm.f('c'); gm.f(gm); } //定义泛型方法,只需将泛型参数列表置于返回值之前 public <T> void f(T x) { System.out.println(x.getClass().getName()); } } /* * Output: java.lang.String java.lang.Integer java.lang.Double * java.lang.Float java.lang.Character GenericMethods */// :~
UTF-8
Java
1,550
java
GenericMethods.java
Java
[ { "context": "对于一个static的方法而言,需要使用泛型能力,就必须使其成为泛型方法\n *\n * @author fengyu\n * @date 2015年8月9日\n */\n\n/**GenericMethods并不是参数化的,", "end": 260, "score": 0.9285814166069031, "start": 254, "tag": "USERNAME", "value": "fengyu" } ]
null
[]
package cn.feng.thinkInJava.a9_2_泛型.generics.a15_04_00.泛型方法; //: generics/GenericMethods.java /** * 泛型方法:是否拥有泛型方法与其所在类是否是泛型没有关系,泛型方法能够独立类存在而产生变化 * 基本指导原则:无论何时只要你能做到,你就应该尽量使用泛型方法,因为它可以使事情更清楚明白, * 另外,对于一个static的方法而言,需要使用泛型能力,就必须使其成为泛型方法 * * @author fengyu * @date 2015年8月9日 */ /**GenericMethods并不是参数化的,尽管这个类和其内部方法可以被同时参数化*/ public class GenericMethods { public static void main(String[] args) { GenericMethods gm = new GenericMethods(); //使用泛型方法时候通常不必指明参数类型,因为编译器会为我们找出具体的类型,这称为类型参数推断(type argumens inference) gm.f(""); //如果调用f()时传入基本类型,自动打包机制就会介入其中,将基本类型的值包装为对应的对象,事实上 //自动打包避免了我们自己不得不编写出来的代码 gm.f(1); gm.f(1.0); gm.f(1.0F); gm.f('c'); gm.f(gm); } //定义泛型方法,只需将泛型参数列表置于返回值之前 public <T> void f(T x) { System.out.println(x.getClass().getName()); } } /* * Output: java.lang.String java.lang.Integer java.lang.Double * java.lang.Float java.lang.Character GenericMethods */// :~
1,550
0.661
0.642
36
26.777779
21.803556
80
false
false
0
0
0
0
0
0
0.694444
false
false
9
130d226d8ede770ab8dcaed9469875c6208df3cc
5,025,111,765,647
895beca8191513704cf29a6c5f51f4779e890b43
/src/main/java/com/lawencon/app/dao/impl/jpa/UserDaoImpl.java
d2b0a1ce04887fece43a546c153829ba8605d92f
[]
no_license
Fajar001/springboot-tiketing-order
https://github.com/Fajar001/springboot-tiketing-order
7ce9dd588d89774a5a4fcf04b0642556dc982a01
e0d84dcba3b7af57ed447eeaee6e7dc5689eea38
refs/heads/master
2021-05-23T11:39:30.071000
2020-04-06T15:37:14
2020-04-06T15:37:14
253,269,559
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lawencon.app.dao.impl.jpa; //import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.lawencon.app.dao.UserDao; import com.lawencon.app.model.User; @Repository("user_repo_jpa") public class UserDaoImpl implements UserDao{ // @Autowired // private ParkiranRepo parkirRepo; @Override public User validuser(String user, String pass) throws Exception { // TODO Auto-generated method stub return null; } }
UTF-8
Java
494
java
UserDaoImpl.java
Java
[]
null
[]
package com.lawencon.app.dao.impl.jpa; //import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.lawencon.app.dao.UserDao; import com.lawencon.app.model.User; @Repository("user_repo_jpa") public class UserDaoImpl implements UserDao{ // @Autowired // private ParkiranRepo parkirRepo; @Override public User validuser(String user, String pass) throws Exception { // TODO Auto-generated method stub return null; } }
494
0.781377
0.781377
20
23.700001
21.714281
67
false
false
0
0
0
0
0
0
0.95
false
false
9
4ad624e23a2cc20d6a7800d7433f177b8e835f39
30,580,167,150,290
187aac1a74ff76db3d83b7b56d18171b956f3dba
/oauth2-server/src/main/java/io/github/ygsama/oauth2server/web/impl/CallbackResourceImpl.java
ae897f79eb8c6d9df17065cc8fc2f73bf6803050
[]
no_license
caima123/ipa
https://github.com/caima123/ipa
63c5c7e9dc3998b1b32e22749c24a7b9a0e2758b
d14c5a951661590131b383e3084480e8aa3f76b6
refs/heads/master
2022-07-14T14:26:38.538000
2020-05-19T11:37:01
2020-05-19T11:37:01
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.github.ygsama.oauth2server.web.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import io.github.ygsama.oauth2server.dto.BaseDTO; import io.github.ygsama.oauth2server.dto.UserDTO; import io.github.ygsama.oauth2server.utils.ResultEnum; import io.github.ygsama.oauth2server.web.CallbackResource; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; import java.nio.charset.StandardCharsets; /** * 回调接口 * TODO: 重写spring security 登录接口 * * @author 杨光 */ @Slf4j @RestController public class CallbackResourceImpl implements CallbackResource { /** * 未测试 */ @Override public String getToken(String code) { RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); log.info("获取到的code={},准备获取token ", code); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); MultiValueMap<String, String> params = new LinkedMultiValueMap<>(); params.add("grant_type", "authorization_code"); params.add("code", code); params.add("client_id", "my-client-1"); params.add("redirect_uri", "http://localhost:8088/re"); params.add("scopes", "read"); HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers); ResponseEntity<String> response = restTemplate.postForEntity("http://localhost:8088/oauth/token", requestEntity, String.class); String token = response.getBody(); log.info("token => {}", token); System.out.println("入参:" + JSONObject.toJSONString(params)); return token; } @Override public Object callBackLogin(UserDTO user) { log.info("[登录用户]: ", user); try { RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); headers.add("Authorization", "Basic bXktY2xpZW50LTE6MTIzNDU2Nzg="); MultiValueMap<String, String> params = new LinkedMultiValueMap<>(); params.add("grant_type", "password"); params.add("username", user.getUsername()); params.add("password", user.getPassword()); params.add("client_id", "my-client-1"); params.add("scopes", "all"); HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers); ResponseEntity<String> response = restTemplate.postForEntity("http://localhost:8080/oauth/token", requestEntity, String.class); return JSON.parse(response.getBody()); } catch (Exception e) { return new BaseDTO(ResultEnum.FAIL); } } @Override public Object callBackRefreshToken(String refreshToken) { log.info("[刷新token]: {}", refreshToken); try { RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); headers.add("Authorization", "Basic bXktY2xpZW50LTE6MTIzNDU2Nzg="); MultiValueMap<String, String> params = new LinkedMultiValueMap<>(); params.add("grant_type", "refresh_token"); params.add("refresh_token", JSONObject.parseObject(refreshToken).getString("refreshToken")); HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers); ResponseEntity<String> response = restTemplate.postForEntity("http://localhost:8080/oauth/token", requestEntity, String.class); return JSON.parse(response.getBody()); } catch (Exception e) { return new BaseDTO(ResultEnum.FAIL); } } // @RequestMapping("/token") // public String getToken(@RequestParam String code){ // RestTemplate restTemplate=new RestTemplate(); // restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); // String secret = "123qwe"; // log.info("获取到的code={},准备获取token ",code); // // HttpHeaders headers = new HttpHeaders(); // headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); // // MultiValueMap<String, String> params= new LinkedMultiValueMap<>(); // params.add("grant_type","authorization_code"); // params.add("code",code); // params.add("client_id","my-client-1"); //// params.add("client_secret",secret); // params.add("redirect_uri","http://localhost:8088/re"); // params.add("scopes","read"); // // HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers); // ResponseEntity<String> response = restTemplate.postForEntity("http://localhost:8088/oauth/token", requestEntity, String.class); // String token = response.getBody(); // log.info("token => {}",token); // System.out.println("入参:"+ JSONObject.toJSONString(params)); // // return token; // } }
UTF-8
Java
5,501
java
CallbackResourceImpl.java
Java
[ { "context": "om.alibaba.fastjson.JSONObject;\nimport io.github.ygsama.oauth2server.dto.BaseDTO;\nimport io.github.ygsama", "end": 146, "score": 0.8921114802360535, "start": 141, "tag": "USERNAME", "value": "gsama" }, { "context": "gsama.oauth2server.dto.BaseDTO;\nimport io.github.ygsama.oauth2server.dto.UserDTO;\nimport io.github.ygsama", "end": 196, "score": 0.8730790615081787, "start": 191, "tag": "USERNAME", "value": "gsama" }, { "context": "gsama.oauth2server.dto.UserDTO;\nimport io.github.ygsama.oauth2server.utils.ResultEnum;\nimport io.github.y", "end": 246, "score": 0.8569104671478271, "start": 241, "tag": "USERNAME", "value": "gsama" }, { "context": ".oauth2server.utils.ResultEnum;\nimport io.github.ygsama.oauth2server.web.CallbackResource;\nimport lombok.", "end": 301, "score": 0.557579517364502, "start": 296, "tag": "USERNAME", "value": "gsama" }, { "context": "调接口\n * TODO: 重写spring security 登录接口\n *\n * @author 杨光\n */\n@Slf4j\n@RestController\npublic class CallbackR", "end": 940, "score": 0.999459445476532, "start": 938, "tag": "NAME", "value": "杨光" }, { "context": "ype\", \"password\");\n\t\t\tparams.add(\"username\", user.getUsername());\n\t\t\tparams.add(\"password\", user.getPassword())", "end": 2651, "score": 0.5079401135444641, "start": 2640, "tag": "USERNAME", "value": "getUsername" }, { "context": "e\", user.getUsername());\n\t\t\tparams.add(\"password\", user.getPassword());\n\t\t\tparams.add(\"client_id\", \"my-client-1\");\n\t\t", "end": 2698, "score": 0.9987754821777344, "start": 2682, "tag": "PASSWORD", "value": "user.getPassword" }, { "context": "ndardCharsets.UTF_8));\n// String secret = \"123qwe\";\n// log.info(\"获取到的code={},准备获取token \",cod", "end": 4424, "score": 0.9989091753959656, "start": 4418, "tag": "KEY", "value": "123qwe" } ]
null
[]
package io.github.ygsama.oauth2server.web.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import io.github.ygsama.oauth2server.dto.BaseDTO; import io.github.ygsama.oauth2server.dto.UserDTO; import io.github.ygsama.oauth2server.utils.ResultEnum; import io.github.ygsama.oauth2server.web.CallbackResource; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; import java.nio.charset.StandardCharsets; /** * 回调接口 * TODO: 重写spring security 登录接口 * * @author 杨光 */ @Slf4j @RestController public class CallbackResourceImpl implements CallbackResource { /** * 未测试 */ @Override public String getToken(String code) { RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); log.info("获取到的code={},准备获取token ", code); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); MultiValueMap<String, String> params = new LinkedMultiValueMap<>(); params.add("grant_type", "authorization_code"); params.add("code", code); params.add("client_id", "my-client-1"); params.add("redirect_uri", "http://localhost:8088/re"); params.add("scopes", "read"); HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers); ResponseEntity<String> response = restTemplate.postForEntity("http://localhost:8088/oauth/token", requestEntity, String.class); String token = response.getBody(); log.info("token => {}", token); System.out.println("入参:" + JSONObject.toJSONString(params)); return token; } @Override public Object callBackLogin(UserDTO user) { log.info("[登录用户]: ", user); try { RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); headers.add("Authorization", "Basic bXktY2xpZW50LTE6MTIzNDU2Nzg="); MultiValueMap<String, String> params = new LinkedMultiValueMap<>(); params.add("grant_type", "password"); params.add("username", user.getUsername()); params.add("password", <PASSWORD>()); params.add("client_id", "my-client-1"); params.add("scopes", "all"); HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers); ResponseEntity<String> response = restTemplate.postForEntity("http://localhost:8080/oauth/token", requestEntity, String.class); return JSON.parse(response.getBody()); } catch (Exception e) { return new BaseDTO(ResultEnum.FAIL); } } @Override public Object callBackRefreshToken(String refreshToken) { log.info("[刷新token]: {}", refreshToken); try { RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); headers.add("Authorization", "Basic bXktY2xpZW50LTE6MTIzNDU2Nzg="); MultiValueMap<String, String> params = new LinkedMultiValueMap<>(); params.add("grant_type", "refresh_token"); params.add("refresh_token", JSONObject.parseObject(refreshToken).getString("refreshToken")); HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers); ResponseEntity<String> response = restTemplate.postForEntity("http://localhost:8080/oauth/token", requestEntity, String.class); return JSON.parse(response.getBody()); } catch (Exception e) { return new BaseDTO(ResultEnum.FAIL); } } // @RequestMapping("/token") // public String getToken(@RequestParam String code){ // RestTemplate restTemplate=new RestTemplate(); // restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); // String secret = "123qwe"; // log.info("获取到的code={},准备获取token ",code); // // HttpHeaders headers = new HttpHeaders(); // headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); // // MultiValueMap<String, String> params= new LinkedMultiValueMap<>(); // params.add("grant_type","authorization_code"); // params.add("code",code); // params.add("client_id","my-client-1"); //// params.add("client_secret",secret); // params.add("redirect_uri","http://localhost:8088/re"); // params.add("scopes","read"); // // HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(params, headers); // ResponseEntity<String> response = restTemplate.postForEntity("http://localhost:8088/oauth/token", requestEntity, String.class); // String token = response.getBody(); // log.info("token => {}",token); // System.out.println("入参:"+ JSONObject.toJSONString(params)); // // return token; // } }
5,495
0.730933
0.720591
131
40.335876
32.216019
137
false
false
0
0
0
0
0
0
2.129771
false
false
9
e4b9090c10caa0ce13c2e5845cb3bd049156ea4a
4,252,017,683,507
3375294ceb8317a6c505dc769598bb3099893f58
/src/main/java/com/cooker/zoom/helper/utils/useless/QpidConnectionFactory.java
c20a742594a9adc0c7b2d77bbe58483ecc7ca59e
[ "MIT" ]
permissive
cooker/java_box
https://github.com/cooker/java_box
5f3ac8fee78520ded59728f8ebd3224ad6077e5d
b09bc07ea2abd7d3d61d270fea9b999117662a74
refs/heads/master
2018-09-20T10:52:54.920000
2018-05-24T16:16:48
2018-05-24T16:16:48
114,225,675
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
//package com.cooker.zoom.helper.utils.lower; // //import com.xforceplus.apollo.config.EmailConfig; //import com.xforceplus.apollo.logger.ApolloEmailFactory; //import com.xforceplus.apollo.utils.ErrorUtil; //import org.apache.qpid.client.PooledConnectionFactory; //import org.apache.qpid.url.URLSyntaxException; //import org.slf4j.Logger; //import org.slf4j.LoggerFactory; // //import javax.jms.Connection; // //import static com.xforceplus.apollo.config.InnerMQConfig.getConfig; // ///** // * 版权: 上海云砺信息科技有限公司<br/> // * 创建者: yu.kequn<br/> // * 创建时间: 2017/6/19 16:50<br/> // * 功能描述: QPid连接创建工厂<br/> // * 修改历史:<br/> // * 2017/6/19 16:50 yu.kequn 描述<br/> // */ //public class QpidConnectionFactory { // private final Logger logger = LoggerFactory.getLogger(this.getClass()); // private final static PooledConnectionFactory pool; // private final static PooledConnectionFactory queryPool; // // static { // pool = new PooledConnectionFactory(); // queryPool = new PooledConnectionFactory(); // String url = getConfig().getProperty("connectionfactory.qpidConnectionfactory"); // long timeOut = getConfig().getIntProperty("connection.router.timeout", 3000); // try { // pool.setConnectionURLString(url); // pool.setMaxPoolSize(getConfig().getIntProperty("connection.router.maxpoolsize", 120)); // pool.setConnectionTimeout(timeOut); // queryPool.setConnectionURLString(url); // queryPool.setMaxPoolSize(10); // queryPool.setConnectionTimeout(timeOut); // } catch (URLSyntaxException e) { // ApolloEmailFactory.getFactory().sendEmail("日志收集连接池初始化异常:" + ErrorUtil.getStackMsg(e)); // } // } // // public Connection getQueryConnection(){ // Connection con = null; // try { // con = queryPool.createConnection(); // con.start(); // } catch (Exception e) { // errConn(e); // } // return con; // } // // public Connection getConnection(){ // Connection connection = null; // try { // connection = pool.createConnection();//new XAMQConnection(getConfig().getProperty("connectionfactory.qpidConnectionfactory")); // connection.start(); // } catch (Exception e) { // errConn(e); // } // return connection; // } // // protected void errConn(Exception e){ // logger.error("Qpid连接获取出现异常", e); // ApolloEmailFactory.getFactory().sendEmail( // EmailConfig.getConfig().getProperty("title"), String.format("%s 获取Qpid连接异常,请处理<br/>%s", // "logcollect", ErrorUtil.getStackMsg(e)), EmailConfig.getConfig().getProperty("receivers")); // } // // public void releaseConnection(Connection con){ // if(con != null) // try { // con.close(); // } catch (Exception e) { // logger.error("释放Qpid连接出现异常!"); // ApolloEmailFactory.getFactory().sendEmail( // EmailConfig.getConfig().getProperty("title"), String.format("%s 释放Qpid连接异常,请处理<br/>%s", // "logcollect", ErrorUtil.getStackMsg(e)),EmailConfig.getConfig().getProperty("receivers")); // } // } // //}
UTF-8
Java
3,491
java
QpidConnectionFactory.java
Java
[ { "context": "//\n///**\n// * 版权: 上海云砺信息科技有限公司<br/>\n// * 创建者: yu.kequn<br/>\n// * 创建时间: 2017/6/19 16:50<br/>\n// * ", "end": 532, "score": 0.703770101070404, "start": 531, "tag": "USERNAME", "value": "y" }, { "context": "\n///**\n// * 版权: 上海云砺信息科技有限公司<br/>\n// * 创建者: yu.kequn<br/>\n// * 创建时间: 2017/6/19 16:50<br/>\n// * 功能描述: Q", "end": 539, "score": 0.6766743063926697, "start": 532, "tag": "NAME", "value": "u.kequn" } ]
null
[]
//package com.cooker.zoom.helper.utils.lower; // //import com.xforceplus.apollo.config.EmailConfig; //import com.xforceplus.apollo.logger.ApolloEmailFactory; //import com.xforceplus.apollo.utils.ErrorUtil; //import org.apache.qpid.client.PooledConnectionFactory; //import org.apache.qpid.url.URLSyntaxException; //import org.slf4j.Logger; //import org.slf4j.LoggerFactory; // //import javax.jms.Connection; // //import static com.xforceplus.apollo.config.InnerMQConfig.getConfig; // ///** // * 版权: 上海云砺信息科技有限公司<br/> // * 创建者: yu.kequn<br/> // * 创建时间: 2017/6/19 16:50<br/> // * 功能描述: QPid连接创建工厂<br/> // * 修改历史:<br/> // * 2017/6/19 16:50 yu.kequn 描述<br/> // */ //public class QpidConnectionFactory { // private final Logger logger = LoggerFactory.getLogger(this.getClass()); // private final static PooledConnectionFactory pool; // private final static PooledConnectionFactory queryPool; // // static { // pool = new PooledConnectionFactory(); // queryPool = new PooledConnectionFactory(); // String url = getConfig().getProperty("connectionfactory.qpidConnectionfactory"); // long timeOut = getConfig().getIntProperty("connection.router.timeout", 3000); // try { // pool.setConnectionURLString(url); // pool.setMaxPoolSize(getConfig().getIntProperty("connection.router.maxpoolsize", 120)); // pool.setConnectionTimeout(timeOut); // queryPool.setConnectionURLString(url); // queryPool.setMaxPoolSize(10); // queryPool.setConnectionTimeout(timeOut); // } catch (URLSyntaxException e) { // ApolloEmailFactory.getFactory().sendEmail("日志收集连接池初始化异常:" + ErrorUtil.getStackMsg(e)); // } // } // // public Connection getQueryConnection(){ // Connection con = null; // try { // con = queryPool.createConnection(); // con.start(); // } catch (Exception e) { // errConn(e); // } // return con; // } // // public Connection getConnection(){ // Connection connection = null; // try { // connection = pool.createConnection();//new XAMQConnection(getConfig().getProperty("connectionfactory.qpidConnectionfactory")); // connection.start(); // } catch (Exception e) { // errConn(e); // } // return connection; // } // // protected void errConn(Exception e){ // logger.error("Qpid连接获取出现异常", e); // ApolloEmailFactory.getFactory().sendEmail( // EmailConfig.getConfig().getProperty("title"), String.format("%s 获取Qpid连接异常,请处理<br/>%s", // "logcollect", ErrorUtil.getStackMsg(e)), EmailConfig.getConfig().getProperty("receivers")); // } // // public void releaseConnection(Connection con){ // if(con != null) // try { // con.close(); // } catch (Exception e) { // logger.error("释放Qpid连接出现异常!"); // ApolloEmailFactory.getFactory().sendEmail( // EmailConfig.getConfig().getProperty("title"), String.format("%s 释放Qpid连接异常,请处理<br/>%s", // "logcollect", ErrorUtil.getStackMsg(e)),EmailConfig.getConfig().getProperty("receivers")); // } // } // //}
3,491
0.607843
0.597888
86
37.55814
30.960442
140
false
false
0
0
0
0
0
0
0.593023
false
false
9
134fb79cced577a7cc04e5c72beedbc3bba11e40
13,872,744,427,142
4ae6344e88d7c92b1945cf05997250d5f5be716b
/app/src/main/java/com/example/administrator/bluetooth/RegisterActivity.java
25e235f1c0b75704e997c08379693ff3fb1fddae
[]
no_license
LiZhongshan/Bluetooth
https://github.com/LiZhongshan/Bluetooth
e82d365012e0de79cdc907260f9bbd6fb4d77a74
85109330095d854f7316294cb4885d66ae64a20f
refs/heads/master
2021-01-10T16:57:47.849000
2016-03-15T07:15:42
2016-03-15T07:15:42
51,797,195
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.administrator.bluetooth; import android.app.Activity; import android.app.AlertDialog; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; /** * Created by Administrator on 2016/3/2.注释内容同LoginActivity */ public class RegisterActivity extends Activity { private EditText mUser; private EditText mPassword; private EditText mToPassword; private TextView txt_title; private ImageView show_menu; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.register); mUser = (EditText)findViewById(R.id.login_uesr_edit); mPassword = (EditText)findViewById(R.id.login_passwd_edit); mToPassword = (EditText)findViewById(R.id.login_topasswd_edit); txt_title = (TextView) findViewById(R.id.txt_title); txt_title.setText("注册"); show_menu = (ImageView) findViewById(R.id.show_menu); show_menu.setVisibility(View.GONE); } public void login_mainfriend(View v) { if("1".equals(mUser.getText().toString()) && "1".equals(mPassword.getText().toString()) && "1".equals(mToPassword.getText().toString())){ Intent intent = new Intent(); intent.setClass(RegisterActivity.this,LoginActivity.class); startActivity(intent); } else if("".equals(mUser.getText().toString()) || "".equals(mPassword.getText().toString()) || "".equals(mToPassword.getText().toString())){ new AlertDialog.Builder(RegisterActivity.this) .setIcon(getResources().getDrawable(R.drawable.login_error_icon)) .setTitle("登陆错误") .setMessage("账号或密码不能为空,请重新输入") .create().show(); } else { new AlertDialog.Builder(RegisterActivity.this) .setIcon(getResources().getDrawable(R.drawable.login_error_icon)) .setTitle("登陆错误") .setMessage("账号或密码输入错误,请重新输入") .create().show(); } } public void login_back(View v) { this.finish(); } public void login(View v) { Intent intent = new Intent (RegisterActivity.this,LoginActivity.class); startActivity(intent); } }
UTF-8
Java
2,520
java
RegisterActivity.java
Java
[ { "context": "import android.widget.TextView;\n\n/**\n * Created by Administrator on 2016/3/2.注释内容同LoginActivity\n */\npublic class R", "end": 319, "score": 0.79407799243927, "start": 306, "tag": "USERNAME", "value": "Administrator" } ]
null
[]
package com.example.administrator.bluetooth; import android.app.Activity; import android.app.AlertDialog; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.ImageView; import android.widget.TextView; /** * Created by Administrator on 2016/3/2.注释内容同LoginActivity */ public class RegisterActivity extends Activity { private EditText mUser; private EditText mPassword; private EditText mToPassword; private TextView txt_title; private ImageView show_menu; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.register); mUser = (EditText)findViewById(R.id.login_uesr_edit); mPassword = (EditText)findViewById(R.id.login_passwd_edit); mToPassword = (EditText)findViewById(R.id.login_topasswd_edit); txt_title = (TextView) findViewById(R.id.txt_title); txt_title.setText("注册"); show_menu = (ImageView) findViewById(R.id.show_menu); show_menu.setVisibility(View.GONE); } public void login_mainfriend(View v) { if("1".equals(mUser.getText().toString()) && "1".equals(mPassword.getText().toString()) && "1".equals(mToPassword.getText().toString())){ Intent intent = new Intent(); intent.setClass(RegisterActivity.this,LoginActivity.class); startActivity(intent); } else if("".equals(mUser.getText().toString()) || "".equals(mPassword.getText().toString()) || "".equals(mToPassword.getText().toString())){ new AlertDialog.Builder(RegisterActivity.this) .setIcon(getResources().getDrawable(R.drawable.login_error_icon)) .setTitle("登陆错误") .setMessage("账号或密码不能为空,请重新输入") .create().show(); } else { new AlertDialog.Builder(RegisterActivity.this) .setIcon(getResources().getDrawable(R.drawable.login_error_icon)) .setTitle("登陆错误") .setMessage("账号或密码输入错误,请重新输入") .create().show(); } } public void login_back(View v) { this.finish(); } public void login(View v) { Intent intent = new Intent (RegisterActivity.this,LoginActivity.class); startActivity(intent); } }
2,520
0.637449
0.633745
64
36.96875
29.705307
147
false
false
0
0
0
0
0
0
0.578125
false
false
9
981703449111d74b5d3c20ec42a8b70275c2ec9d
13,872,744,429,606
4a0e1ab0ea677a8016d4a331c3b98db47b9ca9bc
/1248. Count Number of Nice Subarrays:m.java
79c87759677115df24155bd563cc28b392d9ca46
[]
no_license
hakunamatata0314/LeetcodeEveryday
https://github.com/hakunamatata0314/LeetcodeEveryday
bf8fe480db408c95fa34691caaafeab9bb6e14b4
18869a7a6f8a972d2022dc7c45976758ac8a1bef
refs/heads/master
2023-02-24T02:48:25.152000
2021-01-27T17:24:17
2021-01-27T17:24:17
307,229,219
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
// 1248. Count Number of Nice Subarrays/m public int numberOfSubarrays(int[] nums, int k) { LinkedList<Integer> deque = new LinkedList<>(); deque.add(-1); int ans = 0; for(int i = 0; i < nums.length; i++) { if(nums[i] % 2 == 1) deque.add(i); if(deque.size() > k + 1) deque.pop(); if(deque.size() == k + 1) ans += deque.get(1) - deque.get(0); } return ans; }
UTF-8
Java
408
java
1248. Count Number of Nice Subarrays:m.java
Java
[]
null
[]
// 1248. Count Number of Nice Subarrays/m public int numberOfSubarrays(int[] nums, int k) { LinkedList<Integer> deque = new LinkedList<>(); deque.add(-1); int ans = 0; for(int i = 0; i < nums.length; i++) { if(nums[i] % 2 == 1) deque.add(i); if(deque.size() > k + 1) deque.pop(); if(deque.size() == k + 1) ans += deque.get(1) - deque.get(0); } return ans; }
408
0.541667
0.509804
14
28.214285
22.010317
69
false
false
0
0
0
0
0
0
0.714286
false
false
9
496be1c39af8b425006f636f1f2761ec61c40926
8,392,366,156,063
f6539477076aad7a37a18915531f6cae701d0484
/java/tags/gateway-2.0.1/src/test/java/org/nhindirect/gateway/smtp/james/mailet/TrackIncomingNotification_initializationTest.java
7a233769d3a8a18bb6949d5afc1f9878c7610b90
[]
no_license
ssavarala/nhin-d
https://github.com/ssavarala/nhin-d
bf3a4f4773479875972fb52f4b3aae434d7665f8
4208b12ba138d50c25d80849585d4b18dd5df491
refs/heads/master
2020-05-29T11:40:19.748000
2016-09-15T18:45:34
2016-09-15T18:45:34
67,622,081
1
1
null
true
2016-09-07T15:56:12
2016-09-07T15:56:12
2016-07-16T23:25:04
2016-09-07T15:54:34
179,884
0
0
0
null
null
null
package org.nhindirect.gateway.smtp.james.mailet; import java.util.HashMap; import java.util.Map; import org.apache.mailet.MailetConfig; import org.nhindirect.common.tx.impl.DefaultTxDetailParser; import org.nhindirect.gateway.testutils.BaseTestPlan; import junit.framework.TestCase; public class TrackIncomingNotification_initializationTest extends TestCase { abstract class TestPlan extends BaseTestPlan { protected MailetConfig getMailetConfig() throws Exception { Map<String,String> params = new HashMap<String, String>(); params.put(SecurityAndTrustMailetOptions.MONITORING_SERVICE_URL_PARAM, getMonitoringServiceURL()); return new MockMailetConfig(params, "TrackIncomingNotification"); } @Override protected void performInner() throws Exception { TrackIncomingNotification theMailet = new TrackIncomingNotification(); MailetConfig config = getMailetConfig(); theMailet.init(config); doAssertions(theMailet); } protected String getMonitoringServiceURL() { return ""; } protected void doAssertions(TrackIncomingNotification notif) throws Exception { } } public void testInitialization_emptyMonitorURL() throws Exception { new TestPlan() { protected void doAssertions(TrackIncomingNotification notif) throws Exception { assertNotNull(notif.txParser); assertNotNull(notif.txService); assertTrue(notif.txParser instanceof DefaultTxDetailParser); } }.perform(); } public void testInitialization_nullMonitorURL() throws Exception { new TestPlan() { @Override protected String getMonitoringServiceURL() { return null; } protected void doAssertions(TrackIncomingNotification notif) throws Exception { assertNotNull(notif.txParser); assertNotNull(notif.txService); assertTrue(notif.txParser instanceof DefaultTxDetailParser); } }.perform(); } public void testInitialization_valueMonitorURL() throws Exception { new TestPlan() { @Override protected String getMonitoringServiceURL() { return "http://localhost/msg-monitor"; } protected void doAssertions(TrackIncomingNotification notif) throws Exception { assertNotNull(notif.txParser); assertNotNull(notif.txService); assertTrue(notif.txParser instanceof DefaultTxDetailParser); } }.perform(); } }
UTF-8
Java
2,390
java
TrackIncomingNotification_initializationTest.java
Java
[]
null
[]
package org.nhindirect.gateway.smtp.james.mailet; import java.util.HashMap; import java.util.Map; import org.apache.mailet.MailetConfig; import org.nhindirect.common.tx.impl.DefaultTxDetailParser; import org.nhindirect.gateway.testutils.BaseTestPlan; import junit.framework.TestCase; public class TrackIncomingNotification_initializationTest extends TestCase { abstract class TestPlan extends BaseTestPlan { protected MailetConfig getMailetConfig() throws Exception { Map<String,String> params = new HashMap<String, String>(); params.put(SecurityAndTrustMailetOptions.MONITORING_SERVICE_URL_PARAM, getMonitoringServiceURL()); return new MockMailetConfig(params, "TrackIncomingNotification"); } @Override protected void performInner() throws Exception { TrackIncomingNotification theMailet = new TrackIncomingNotification(); MailetConfig config = getMailetConfig(); theMailet.init(config); doAssertions(theMailet); } protected String getMonitoringServiceURL() { return ""; } protected void doAssertions(TrackIncomingNotification notif) throws Exception { } } public void testInitialization_emptyMonitorURL() throws Exception { new TestPlan() { protected void doAssertions(TrackIncomingNotification notif) throws Exception { assertNotNull(notif.txParser); assertNotNull(notif.txService); assertTrue(notif.txParser instanceof DefaultTxDetailParser); } }.perform(); } public void testInitialization_nullMonitorURL() throws Exception { new TestPlan() { @Override protected String getMonitoringServiceURL() { return null; } protected void doAssertions(TrackIncomingNotification notif) throws Exception { assertNotNull(notif.txParser); assertNotNull(notif.txService); assertTrue(notif.txParser instanceof DefaultTxDetailParser); } }.perform(); } public void testInitialization_valueMonitorURL() throws Exception { new TestPlan() { @Override protected String getMonitoringServiceURL() { return "http://localhost/msg-monitor"; } protected void doAssertions(TrackIncomingNotification notif) throws Exception { assertNotNull(notif.txParser); assertNotNull(notif.txService); assertTrue(notif.txParser instanceof DefaultTxDetailParser); } }.perform(); } }
2,390
0.741004
0.741004
103
22.203884
26.212114
101
false
false
0
0
0
0
0
0
2.427185
false
false
9
569849474fd316897732642f8614098d949defac
8,392,366,156,309
c8818da3864251fac72504345cef7d2f788434ab
/src/main/java/nl/tinkoczy/villa/view/bijdrage/BijdrageSchemaEditDialogController.java
4e3a7ba6278447e05b9ae5ba5ebd9acdaf3b2f02
[]
no_license
Erwin72/Villa
https://github.com/Erwin72/Villa
67e60f3d98b29c0c71fedabd702e71a487470e2c
b45be691b40afdb21f1490ad88399718059fa48c
refs/heads/master
2021-06-19T16:45:52.014000
2017-03-30T06:53:29
2017-03-30T06:53:29
77,052,532
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package nl.tinkoczy.villa.view.bijdrage; import java.math.BigDecimal; import javafx.fxml.FXML; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.TextField; import javafx.stage.Stage; import nl.tinkoczy.villa.model.BijdrageFrequentie; import nl.tinkoczy.villa.model.BijdrageRente; import nl.tinkoczy.villa.model.BijdrageSchema; import nl.tinkoczy.villa.service.IBijdrageFrequentieService; import nl.tinkoczy.villa.service.IBijdrageRenteService; import nl.tinkoczy.villa.service.impl.BijdrageFrequentieService; import nl.tinkoczy.villa.service.impl.BijdrageRenteService; public class BijdrageSchemaEditDialogController { @FXML private TextField bijdrageSchemaNaamField; @FXML private TextField bijdrageRentePercentageField; @FXML private TextField bijdrageRenteDagenNaVervaldatumField; private Stage dialogStage; private BijdrageSchema bijdrageSchema; private boolean okClicked = false; private final IBijdrageRenteService bijdrageRenteService = new BijdrageRenteService(); private final IBijdrageFrequentieService bijdrageFrequentieService = new BijdrageFrequentieService(); /** * Initializes the controller class. This method is automatically called * after the fxml file has been loaded. */ @FXML private void initialize() { } /** * Sets the stage of this dialog. * * @param dialogStage */ public void setDialogStage(final Stage dialogStage) { this.dialogStage = dialogStage; } /** * Sets the bijdrageSchema to be edited in the dialog. * * @param bijdrageSchema */ public void setBijdrageSchema(final BijdrageSchema bijdrageSchema) { this.bijdrageSchema = bijdrageSchema; bijdrageSchemaNaamField.setText(bijdrageSchema.getBijdrageSchemaNaam()); if (bijdrageSchema.getBijdrageRenteFk() != null) { BijdrageRente bijdrageRente = bijdrageRenteService .getBijdrageRenteById(bijdrageSchema.getBijdrageRenteFk()); bijdrageRentePercentageField.setText(bijdrageRente.getBijdrageRentePercentage().toString()); bijdrageRenteDagenNaVervaldatumField .setText(Integer.toString(bijdrageRente.getBijdrageRenteNaVervaldatum())); } } /** * Returns true if the user clicked OK, false otherwise. * * @return */ public boolean isOkClicked() { return okClicked; } /** * Called when the user clicks ok. */ @FXML private void handleOk() { if (isInputValid()) { bijdrageSchema.setBijdrageSchemaNaam(bijdrageSchemaNaamField.getText()); BigDecimal bijdrageRentePercentage = new BigDecimal(bijdrageRentePercentageField.getText()); int bijdrageRenteDagenNaVervaldatum = Integer.valueOf(bijdrageRenteDagenNaVervaldatumField.getText()); BijdrageRente bijdrageRente = bijdrageRenteService.getBijdrageRenteByRentePercentageAndNaVervaldatum( bijdrageRentePercentage, bijdrageRenteDagenNaVervaldatum); long bijdrageRenteId; if (bijdrageRente == null) { BijdrageRente newBijdrageRente = new BijdrageRente(null, bijdrageRentePercentage, bijdrageRenteDagenNaVervaldatum); bijdrageRenteId = bijdrageRenteService.saveBijdrageRente(newBijdrageRente); } else { // we do not need to update an existing record of bijdrageRente // bijdrageRenteService.saveOrUpdateBijdrageRente(bijdrageRente); bijdrageRenteId = bijdrageRente.getBijdrageRenteId(); } bijdrageSchema.setBijdrageRenteFk(bijdrageRenteId); BijdrageFrequentie bijdrageFrequentie = bijdrageFrequentieService.getAllBijdrageFrequenties().get(0); bijdrageSchema.setBijdrageFrequentieCode(bijdrageFrequentie.getBijdrageFrequentieCode()); okClicked = true; dialogStage.close(); } } /** * Called when the user clicks cancel. */ @FXML private void handleCancel() { dialogStage.close(); } /** * Validates the user input in the text fields. * * @return true if the input is valid */ private boolean isInputValid() { String errorMessage = ""; if (bijdrageSchemaNaamField.getText() == null || bijdrageSchemaNaamField.getText().length() == 0) { errorMessage += "Geen schemanaam ingevuld!\n"; } if (bijdrageRentePercentageField.getText() == null || bijdrageRentePercentageField.getText().length() == 0) { errorMessage += "Geen rente percentage ingevuld!\n"; } else { // try to parse the rente percentage into an BigDecimal. try { new BigDecimal(bijdrageRentePercentageField.getText()); } catch (NumberFormatException e) { errorMessage += "Geen geldige waarde voor rente percentage ingevuld (moet een decimaal getal zijn)!\n"; } } if (bijdrageRenteDagenNaVervaldatumField.getText() == null || bijdrageRenteDagenNaVervaldatumField.getText().length() == 0) { errorMessage += "Geen dagen na vervaldatum ingevuld!\n"; } else { // try to parse the bijdrageRenteDagenNaVervaldatum into an int. try { Integer.parseInt(bijdrageRenteDagenNaVervaldatumField.getText()); } catch (NumberFormatException e) { errorMessage += "Geen geldige waarde voor dagen na vervaldatum ingevuld (moet een getal zijn)!\n"; } } if (errorMessage.length() == 0) { return true; } else { // Show the error message. Alert alert = new Alert(AlertType.ERROR); alert.initOwner(dialogStage); alert.setTitle("Ongeldige invoer"); alert.setHeaderText("Corrigeer de ongeldige gegevens a.u.b."); alert.setContentText(errorMessage); alert.showAndWait(); return false; } } }
UTF-8
Java
5,573
java
BijdrageSchemaEditDialogController.java
Java
[]
null
[]
package nl.tinkoczy.villa.view.bijdrage; import java.math.BigDecimal; import javafx.fxml.FXML; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.TextField; import javafx.stage.Stage; import nl.tinkoczy.villa.model.BijdrageFrequentie; import nl.tinkoczy.villa.model.BijdrageRente; import nl.tinkoczy.villa.model.BijdrageSchema; import nl.tinkoczy.villa.service.IBijdrageFrequentieService; import nl.tinkoczy.villa.service.IBijdrageRenteService; import nl.tinkoczy.villa.service.impl.BijdrageFrequentieService; import nl.tinkoczy.villa.service.impl.BijdrageRenteService; public class BijdrageSchemaEditDialogController { @FXML private TextField bijdrageSchemaNaamField; @FXML private TextField bijdrageRentePercentageField; @FXML private TextField bijdrageRenteDagenNaVervaldatumField; private Stage dialogStage; private BijdrageSchema bijdrageSchema; private boolean okClicked = false; private final IBijdrageRenteService bijdrageRenteService = new BijdrageRenteService(); private final IBijdrageFrequentieService bijdrageFrequentieService = new BijdrageFrequentieService(); /** * Initializes the controller class. This method is automatically called * after the fxml file has been loaded. */ @FXML private void initialize() { } /** * Sets the stage of this dialog. * * @param dialogStage */ public void setDialogStage(final Stage dialogStage) { this.dialogStage = dialogStage; } /** * Sets the bijdrageSchema to be edited in the dialog. * * @param bijdrageSchema */ public void setBijdrageSchema(final BijdrageSchema bijdrageSchema) { this.bijdrageSchema = bijdrageSchema; bijdrageSchemaNaamField.setText(bijdrageSchema.getBijdrageSchemaNaam()); if (bijdrageSchema.getBijdrageRenteFk() != null) { BijdrageRente bijdrageRente = bijdrageRenteService .getBijdrageRenteById(bijdrageSchema.getBijdrageRenteFk()); bijdrageRentePercentageField.setText(bijdrageRente.getBijdrageRentePercentage().toString()); bijdrageRenteDagenNaVervaldatumField .setText(Integer.toString(bijdrageRente.getBijdrageRenteNaVervaldatum())); } } /** * Returns true if the user clicked OK, false otherwise. * * @return */ public boolean isOkClicked() { return okClicked; } /** * Called when the user clicks ok. */ @FXML private void handleOk() { if (isInputValid()) { bijdrageSchema.setBijdrageSchemaNaam(bijdrageSchemaNaamField.getText()); BigDecimal bijdrageRentePercentage = new BigDecimal(bijdrageRentePercentageField.getText()); int bijdrageRenteDagenNaVervaldatum = Integer.valueOf(bijdrageRenteDagenNaVervaldatumField.getText()); BijdrageRente bijdrageRente = bijdrageRenteService.getBijdrageRenteByRentePercentageAndNaVervaldatum( bijdrageRentePercentage, bijdrageRenteDagenNaVervaldatum); long bijdrageRenteId; if (bijdrageRente == null) { BijdrageRente newBijdrageRente = new BijdrageRente(null, bijdrageRentePercentage, bijdrageRenteDagenNaVervaldatum); bijdrageRenteId = bijdrageRenteService.saveBijdrageRente(newBijdrageRente); } else { // we do not need to update an existing record of bijdrageRente // bijdrageRenteService.saveOrUpdateBijdrageRente(bijdrageRente); bijdrageRenteId = bijdrageRente.getBijdrageRenteId(); } bijdrageSchema.setBijdrageRenteFk(bijdrageRenteId); BijdrageFrequentie bijdrageFrequentie = bijdrageFrequentieService.getAllBijdrageFrequenties().get(0); bijdrageSchema.setBijdrageFrequentieCode(bijdrageFrequentie.getBijdrageFrequentieCode()); okClicked = true; dialogStage.close(); } } /** * Called when the user clicks cancel. */ @FXML private void handleCancel() { dialogStage.close(); } /** * Validates the user input in the text fields. * * @return true if the input is valid */ private boolean isInputValid() { String errorMessage = ""; if (bijdrageSchemaNaamField.getText() == null || bijdrageSchemaNaamField.getText().length() == 0) { errorMessage += "Geen schemanaam ingevuld!\n"; } if (bijdrageRentePercentageField.getText() == null || bijdrageRentePercentageField.getText().length() == 0) { errorMessage += "Geen rente percentage ingevuld!\n"; } else { // try to parse the rente percentage into an BigDecimal. try { new BigDecimal(bijdrageRentePercentageField.getText()); } catch (NumberFormatException e) { errorMessage += "Geen geldige waarde voor rente percentage ingevuld (moet een decimaal getal zijn)!\n"; } } if (bijdrageRenteDagenNaVervaldatumField.getText() == null || bijdrageRenteDagenNaVervaldatumField.getText().length() == 0) { errorMessage += "Geen dagen na vervaldatum ingevuld!\n"; } else { // try to parse the bijdrageRenteDagenNaVervaldatum into an int. try { Integer.parseInt(bijdrageRenteDagenNaVervaldatumField.getText()); } catch (NumberFormatException e) { errorMessage += "Geen geldige waarde voor dagen na vervaldatum ingevuld (moet een getal zijn)!\n"; } } if (errorMessage.length() == 0) { return true; } else { // Show the error message. Alert alert = new Alert(AlertType.ERROR); alert.initOwner(dialogStage); alert.setTitle("Ongeldige invoer"); alert.setHeaderText("Corrigeer de ongeldige gegevens a.u.b."); alert.setContentText(errorMessage); alert.showAndWait(); return false; } } }
5,573
0.73892
0.738023
168
31.172619
30.4189
111
false
false
0
0
0
0
0
0
2.017857
false
false
9
709948973c9317596954da3abadbc0f2484f497f
24,386,824,348,062
bdc1d2a153a097235a56580ce4577ace43c046e2
/nirvana/nirvana.core/src/test/java/com/caiyi/financial/nirvana/core/cassandra/CassandraListeners.java
f4728b2ecfdc8ac4ac3d2a373a78aa2d71afbac2
[]
no_license
gahaitao177/CompanyProject
https://github.com/gahaitao177/CompanyProject
8ffb6da0edb994d49e3bfb7367e68b85194186ba
caca31a321b1a0729ee2897cea3ec1a5ea1322af
refs/heads/master
2021-01-21T09:49:52.006000
2017-08-10T07:37:08
2017-08-10T07:37:08
91,668,269
2
6
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.caiyi.financial.nirvana.core.cassandra; import com.datastax.driver.core.*; import org.junit.Test; /** * Cassandra的三种监听对象 * Created by Mario on 2016/10/9 0009. */ public class CassandraListeners { @Test /** * Host.StateListener * http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Host.StateListener.html */ public void StateListener() { Cluster cluster = null; try { cluster = Cluster.builder() .withClusterName(CassandraConf.CLUSTER_NAME) .addContactPoints(CassandraConf.DB_ADDRESS) .build() .register(new Host.StateListener() { @Override public void onAdd(Host host) { //有新节点添加到集群时触发 System.out.println("onAdd"); } @Override public void onUp(Host host) { //有节点决定启动时触发 System.out.println("onUp"); } @Override public void onDown(Host host) { //有节点决定关闭时触发 System.out.println("onDown"); } @Override public void onRemove(Host host) { //有节点被删除时触发 System.out.println("onRemove"); } @Override public void onRegister(Cluster cluster) { //跟踪器被集群注册,或者集群携带跟踪器启动时触发 System.out.println("onRegister"); } @Override public void onUnregister(Cluster cluster) { //跟踪器被集群注销,或者集群关闭时触发 System.out.println("onUnregister"); } }); cluster.connect(); } catch (Exception e) { e.printStackTrace(); } finally { if (cluster != null) { cluster.close(); } } } @Test /** * LatencyTracker * http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/LatencyTracker.html */ public void LatencyTracker() { Cluster cluster = null; try { cluster = Cluster.builder() .withClusterName(CassandraConf.CLUSTER_NAME) .addContactPoints(CassandraConf.DB_ADDRESS) .build() .register(new LatencyTracker() { @Override public void update(Host host, Statement statement, Exception e, long l) { //每个对Cassandra节点的请求发生之后,都会触发,可以获取操作用时 System.out.println("update"); } @Override public void onRegister(Cluster cluster) { //跟踪器被集群注册,或者集群携带跟踪器启动时触发 System.out.println("onRegister"); } @Override public void onUnregister(Cluster cluster) { //跟踪器被集群注销,或者集群关闭时触发 System.out.println("onUnregister"); } }); cluster.connect(); } catch (Exception e) { e.printStackTrace(); } finally { if (cluster != null) { cluster.close(); } } } @Test /** * SchemaChangeListener * http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/SchemaChangeListener.html */ public void SchemaChangeListener() { Cluster cluster = null; try { cluster = Cluster.builder() .withClusterName(CassandraConf.CLUSTER_NAME) .addContactPoints(CassandraConf.DB_ADDRESS) .build() .register(new SchemaChangeListener() { @Override public void onKeyspaceAdded(KeyspaceMetadata keyspaceMetadata) { //新增keyspace时触发 System.out.println("onKeyspaceAdded"); } @Override public void onKeyspaceRemoved(KeyspaceMetadata keyspaceMetadata) { //删除keyspace时触发 System.out.println("onKeyspaceAdded"); } @Override public void onKeyspaceChanged(KeyspaceMetadata keyspaceMetadata, KeyspaceMetadata keyspaceMetadata1) { //当某个keyspace改变时 System.out.println("onKeyspaceChanged"); } @Override public void onTableAdded(TableMetadata tableMetadata) { //添加表时触发 System.out.println("onTableAdded"); } @Override public void onTableRemoved(TableMetadata tableMetadata) { //删除表时触发 System.out.println("onTableRemoved"); } @Override public void onTableChanged(TableMetadata tableMetadata, TableMetadata tableMetadata1) { //修改表时触发 System.out.println("onTableChanged"); } @Override public void onUserTypeAdded(UserType userType) { //用户自定义类型添加时触发 System.out.println("onUserTypeAdded"); } @Override public void onUserTypeRemoved(UserType userType) { //用户自定义类型移除时触发 System.out.println("onUserTypeAdded"); } @Override public void onUserTypeChanged(UserType userType, UserType userType1) { //用户自定义类型改变时触发 System.out.println("onUserTypeChanged"); } @Override public void onFunctionAdded(FunctionMetadata functionMetadata) { //用户定义函数添加时触发 System.out.println("onFunctionAdded"); } @Override public void onFunctionRemoved(FunctionMetadata functionMetadata) { //用户定义函数移除时触发 System.out.println("onFunctionRemoved"); } @Override public void onFunctionChanged(FunctionMetadata functionMetadata, FunctionMetadata functionMetadata1) { //用户定义函数改变时触发 System.out.println("onFunctionChanged"); } @Override public void onAggregateAdded(AggregateMetadata aggregateMetadata) { //用户定义集合添加时触发 System.out.println("onAggregateAdded"); } @Override public void onAggregateRemoved(AggregateMetadata aggregateMetadata) { //用户定义集合移除时触发 System.out.println("onAggregateRemoved"); } @Override public void onAggregateChanged(AggregateMetadata aggregateMetadata, AggregateMetadata aggregateMetadata1) { //用户定义集合改变时触发 System.out.println("onAggregateChanged"); } @Override public void onMaterializedViewAdded(MaterializedViewMetadata materializedViewMetadata) { //实体化视图添加时触发 System.out.println("onMaterializedViewAdded"); } @Override public void onMaterializedViewRemoved(MaterializedViewMetadata materializedViewMetadata) { //实体化视图移除时触发 System.out.println("onMaterializedViewRemoved"); } @Override public void onMaterializedViewChanged(MaterializedViewMetadata materializedViewMetadata, MaterializedViewMetadata materializedViewMetadata1) { //实体化视图改变时触发 System.out.println("onMaterializedViewChanged"); } @Override public void onRegister(Cluster cluster) { //跟踪器被集群注册,或者集群携带跟踪器启动时触发 System.out.println("onRegister"); } @Override public void onUnregister(Cluster cluster) { //跟踪器被集群注销,或者集群关闭时触发 System.out.println("onUnregister"); } }); cluster.connect(); } catch (Exception e) { e.printStackTrace(); } finally { if (cluster != null) { cluster.close(); } } } }
UTF-8
Java
10,656
java
CassandraListeners.java
Java
[ { "context": "junit.Test;\n\n/**\n * Cassandra的三种监听对象\n * Created by Mario on 2016/10/9 0009.\n */\npublic class CassandraList", "end": 155, "score": 0.9604877233505249, "start": 150, "tag": "NAME", "value": "Mario" } ]
null
[]
package com.caiyi.financial.nirvana.core.cassandra; import com.datastax.driver.core.*; import org.junit.Test; /** * Cassandra的三种监听对象 * Created by Mario on 2016/10/9 0009. */ public class CassandraListeners { @Test /** * Host.StateListener * http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/Host.StateListener.html */ public void StateListener() { Cluster cluster = null; try { cluster = Cluster.builder() .withClusterName(CassandraConf.CLUSTER_NAME) .addContactPoints(CassandraConf.DB_ADDRESS) .build() .register(new Host.StateListener() { @Override public void onAdd(Host host) { //有新节点添加到集群时触发 System.out.println("onAdd"); } @Override public void onUp(Host host) { //有节点决定启动时触发 System.out.println("onUp"); } @Override public void onDown(Host host) { //有节点决定关闭时触发 System.out.println("onDown"); } @Override public void onRemove(Host host) { //有节点被删除时触发 System.out.println("onRemove"); } @Override public void onRegister(Cluster cluster) { //跟踪器被集群注册,或者集群携带跟踪器启动时触发 System.out.println("onRegister"); } @Override public void onUnregister(Cluster cluster) { //跟踪器被集群注销,或者集群关闭时触发 System.out.println("onUnregister"); } }); cluster.connect(); } catch (Exception e) { e.printStackTrace(); } finally { if (cluster != null) { cluster.close(); } } } @Test /** * LatencyTracker * http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/LatencyTracker.html */ public void LatencyTracker() { Cluster cluster = null; try { cluster = Cluster.builder() .withClusterName(CassandraConf.CLUSTER_NAME) .addContactPoints(CassandraConf.DB_ADDRESS) .build() .register(new LatencyTracker() { @Override public void update(Host host, Statement statement, Exception e, long l) { //每个对Cassandra节点的请求发生之后,都会触发,可以获取操作用时 System.out.println("update"); } @Override public void onRegister(Cluster cluster) { //跟踪器被集群注册,或者集群携带跟踪器启动时触发 System.out.println("onRegister"); } @Override public void onUnregister(Cluster cluster) { //跟踪器被集群注销,或者集群关闭时触发 System.out.println("onUnregister"); } }); cluster.connect(); } catch (Exception e) { e.printStackTrace(); } finally { if (cluster != null) { cluster.close(); } } } @Test /** * SchemaChangeListener * http://docs.datastax.com/en/drivers/java/3.0/com/datastax/driver/core/SchemaChangeListener.html */ public void SchemaChangeListener() { Cluster cluster = null; try { cluster = Cluster.builder() .withClusterName(CassandraConf.CLUSTER_NAME) .addContactPoints(CassandraConf.DB_ADDRESS) .build() .register(new SchemaChangeListener() { @Override public void onKeyspaceAdded(KeyspaceMetadata keyspaceMetadata) { //新增keyspace时触发 System.out.println("onKeyspaceAdded"); } @Override public void onKeyspaceRemoved(KeyspaceMetadata keyspaceMetadata) { //删除keyspace时触发 System.out.println("onKeyspaceAdded"); } @Override public void onKeyspaceChanged(KeyspaceMetadata keyspaceMetadata, KeyspaceMetadata keyspaceMetadata1) { //当某个keyspace改变时 System.out.println("onKeyspaceChanged"); } @Override public void onTableAdded(TableMetadata tableMetadata) { //添加表时触发 System.out.println("onTableAdded"); } @Override public void onTableRemoved(TableMetadata tableMetadata) { //删除表时触发 System.out.println("onTableRemoved"); } @Override public void onTableChanged(TableMetadata tableMetadata, TableMetadata tableMetadata1) { //修改表时触发 System.out.println("onTableChanged"); } @Override public void onUserTypeAdded(UserType userType) { //用户自定义类型添加时触发 System.out.println("onUserTypeAdded"); } @Override public void onUserTypeRemoved(UserType userType) { //用户自定义类型移除时触发 System.out.println("onUserTypeAdded"); } @Override public void onUserTypeChanged(UserType userType, UserType userType1) { //用户自定义类型改变时触发 System.out.println("onUserTypeChanged"); } @Override public void onFunctionAdded(FunctionMetadata functionMetadata) { //用户定义函数添加时触发 System.out.println("onFunctionAdded"); } @Override public void onFunctionRemoved(FunctionMetadata functionMetadata) { //用户定义函数移除时触发 System.out.println("onFunctionRemoved"); } @Override public void onFunctionChanged(FunctionMetadata functionMetadata, FunctionMetadata functionMetadata1) { //用户定义函数改变时触发 System.out.println("onFunctionChanged"); } @Override public void onAggregateAdded(AggregateMetadata aggregateMetadata) { //用户定义集合添加时触发 System.out.println("onAggregateAdded"); } @Override public void onAggregateRemoved(AggregateMetadata aggregateMetadata) { //用户定义集合移除时触发 System.out.println("onAggregateRemoved"); } @Override public void onAggregateChanged(AggregateMetadata aggregateMetadata, AggregateMetadata aggregateMetadata1) { //用户定义集合改变时触发 System.out.println("onAggregateChanged"); } @Override public void onMaterializedViewAdded(MaterializedViewMetadata materializedViewMetadata) { //实体化视图添加时触发 System.out.println("onMaterializedViewAdded"); } @Override public void onMaterializedViewRemoved(MaterializedViewMetadata materializedViewMetadata) { //实体化视图移除时触发 System.out.println("onMaterializedViewRemoved"); } @Override public void onMaterializedViewChanged(MaterializedViewMetadata materializedViewMetadata, MaterializedViewMetadata materializedViewMetadata1) { //实体化视图改变时触发 System.out.println("onMaterializedViewChanged"); } @Override public void onRegister(Cluster cluster) { //跟踪器被集群注册,或者集群携带跟踪器启动时触发 System.out.println("onRegister"); } @Override public void onUnregister(Cluster cluster) { //跟踪器被集群注销,或者集群关闭时触发 System.out.println("onUnregister"); } }); cluster.connect(); } catch (Exception e) { e.printStackTrace(); } finally { if (cluster != null) { cluster.close(); } } } }
10,656
0.433837
0.431521
254
38.09449
28.612104
166
false
false
0
0
0
0
0
0
0.220472
false
false
9
6f625c54e0955c173587d9f6bbb2787145b32998
7,009,386,691,595
cc06c03003f364567233a98e218f87fd8c75f254
/school-web/src/main/java/com/okmich/schoolruns/web/admin/bean/settings/EmployeePositionBean.java
d028e078f9dffa688a3fe30f54f0232dcdfac280
[]
no_license
okmich/schoolruns
https://github.com/okmich/schoolruns
c5df8be7b299f91a681c2cb630b3b523cf02ad2e
340967739fd4ee1b66901c19789d14f2461bdd7a
refs/heads/master
2016-09-12T06:11:03.544000
2016-05-10T10:50:15
2016-05-10T10:50:15
54,635,723
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.okmich.schoolruns.web.admin.bean.settings; import com.okmich.schoolruns.common.entity.EmployeePosition; import com.okmich.schoolruns.common.service.CommonService; import com.okmich.schoolruns.web.common.FacesUtil; import com.okmich.schoolruns.web.common.bean.UserLoginSessionBean; import com.okmich.schoolruns.web.common.bean._BaseBean; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedProperty; import javax.faces.bean.ViewScoped; import javax.faces.model.DataModel; import javax.faces.model.ListDataModel; /** * * @author Michael */ @ManagedBean @ViewScoped public class EmployeePositionBean extends _BaseBean { @ManagedProperty("#{commonService}") private CommonService commonService; @ManagedProperty("#{userLoginSessionBean}") private UserLoginSessionBean userLoginSessionBean; private EmployeePosition employeePosition = new EmployeePosition(); private DataModel<EmployeePosition> employeePositionModel; public EmployeePositionBean() { } /** * @return */ public String saveEmployeePosition() { try { getEmployeePosition().setModifiedBy(getUserLoginSessionBean().getUserLogin().getUsername()); EmployeePosition _employeePosition = commonService.saveEmployeePosition(getEmployeePosition()); ((List<EmployeePosition>) employeePositionModel.getWrappedData()).add(_employeePosition); clearForm(); return ""; } catch (Exception ex) { Logger.getLogger(EmployeePositionBean.class.getName()).log(Level.SEVERE, null, ex); FacesUtil.getFacesContext().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, ex.getMessage(), "")); } return ""; } /** * * @return */ public String prepareForCreate() { setEmployeePosition(new EmployeePosition()); setEditMode("CREATE"); return ""; } /** * * @return */ public String prepareForModify() { Logger.getLogger(EmployeePositionBean.class.getName()).log(Level.INFO, "" + getEmployeePosition(), ""); setEditMode("MODIFY"); return ""; } /** * * @return */ public String clearForm() { setEmployeePosition(new EmployeePosition()); setEditMode(null); return ""; } /** * @return the commonService */ public CommonService getCommonService() { return commonService; } /** * @param commonService the commonService to set */ public void setCommonService(CommonService commonService) { this.commonService = commonService; } /** * @return the employeePosition */ public EmployeePosition getEmployeePosition() { return employeePosition; } /** * @param employeePosition the employeePosition to set */ public void setEmployeePosition(EmployeePosition employeePosition) { this.employeePosition = employeePosition; } /** * @return the employeePositionModel */ public DataModel<EmployeePosition> getEmployeePositionModel() { try { employeePositionModel = new ListDataModel<EmployeePosition>( commonService.findEmployeePositions()); } catch (Exception ex) { Logger.getLogger(EmployeePositionBean.class.getName()).log(Level.SEVERE, null, ex); FacesUtil.getFacesContext().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, ex.getMessage(), "")); } return employeePositionModel; } /** * @param employeePositionModel the employeePositionModel to set */ public void setEmployeePositionModel(DataModel<EmployeePosition> employeePositionModel) { this.employeePositionModel = employeePositionModel; } /** * @return the userLoginSessionBean */ public UserLoginSessionBean getUserLoginSessionBean() { return userLoginSessionBean; } /** * @param userLoginSessionBean the userLoginSessionBean to set */ public void setUserLoginSessionBean(UserLoginSessionBean userLoginSessionBean) { this.userLoginSessionBean = userLoginSessionBean; } }
UTF-8
Java
4,526
java
EmployeePositionBean.java
Java
[ { "context": "avax.faces.model.ListDataModel;\n\n/**\n *\n * @author Michael\n */\n@ManagedBean\n@ViewScoped\npublic class Employe", "end": 799, "score": 0.9897106289863586, "start": 792, "tag": "NAME", "value": "Michael" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.okmich.schoolruns.web.admin.bean.settings; import com.okmich.schoolruns.common.entity.EmployeePosition; import com.okmich.schoolruns.common.service.CommonService; import com.okmich.schoolruns.web.common.FacesUtil; import com.okmich.schoolruns.web.common.bean.UserLoginSessionBean; import com.okmich.schoolruns.web.common.bean._BaseBean; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import javax.faces.application.FacesMessage; import javax.faces.bean.ManagedBean; import javax.faces.bean.ManagedProperty; import javax.faces.bean.ViewScoped; import javax.faces.model.DataModel; import javax.faces.model.ListDataModel; /** * * @author Michael */ @ManagedBean @ViewScoped public class EmployeePositionBean extends _BaseBean { @ManagedProperty("#{commonService}") private CommonService commonService; @ManagedProperty("#{userLoginSessionBean}") private UserLoginSessionBean userLoginSessionBean; private EmployeePosition employeePosition = new EmployeePosition(); private DataModel<EmployeePosition> employeePositionModel; public EmployeePositionBean() { } /** * @return */ public String saveEmployeePosition() { try { getEmployeePosition().setModifiedBy(getUserLoginSessionBean().getUserLogin().getUsername()); EmployeePosition _employeePosition = commonService.saveEmployeePosition(getEmployeePosition()); ((List<EmployeePosition>) employeePositionModel.getWrappedData()).add(_employeePosition); clearForm(); return ""; } catch (Exception ex) { Logger.getLogger(EmployeePositionBean.class.getName()).log(Level.SEVERE, null, ex); FacesUtil.getFacesContext().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, ex.getMessage(), "")); } return ""; } /** * * @return */ public String prepareForCreate() { setEmployeePosition(new EmployeePosition()); setEditMode("CREATE"); return ""; } /** * * @return */ public String prepareForModify() { Logger.getLogger(EmployeePositionBean.class.getName()).log(Level.INFO, "" + getEmployeePosition(), ""); setEditMode("MODIFY"); return ""; } /** * * @return */ public String clearForm() { setEmployeePosition(new EmployeePosition()); setEditMode(null); return ""; } /** * @return the commonService */ public CommonService getCommonService() { return commonService; } /** * @param commonService the commonService to set */ public void setCommonService(CommonService commonService) { this.commonService = commonService; } /** * @return the employeePosition */ public EmployeePosition getEmployeePosition() { return employeePosition; } /** * @param employeePosition the employeePosition to set */ public void setEmployeePosition(EmployeePosition employeePosition) { this.employeePosition = employeePosition; } /** * @return the employeePositionModel */ public DataModel<EmployeePosition> getEmployeePositionModel() { try { employeePositionModel = new ListDataModel<EmployeePosition>( commonService.findEmployeePositions()); } catch (Exception ex) { Logger.getLogger(EmployeePositionBean.class.getName()).log(Level.SEVERE, null, ex); FacesUtil.getFacesContext().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, ex.getMessage(), "")); } return employeePositionModel; } /** * @param employeePositionModel the employeePositionModel to set */ public void setEmployeePositionModel(DataModel<EmployeePosition> employeePositionModel) { this.employeePositionModel = employeePositionModel; } /** * @return the userLoginSessionBean */ public UserLoginSessionBean getUserLoginSessionBean() { return userLoginSessionBean; } /** * @param userLoginSessionBean the userLoginSessionBean to set */ public void setUserLoginSessionBean(UserLoginSessionBean userLoginSessionBean) { this.userLoginSessionBean = userLoginSessionBean; } }
4,526
0.671675
0.671675
151
28.973511
27.931549
111
false
false
0
0
0
0
0
0
0.403974
false
false
9
4ca4495d87593937b135d8462d93b43814dbbe47
4,681,514,413,936
e932d199f43fd633c6e5f7459d8c66029e0fec86
/ThreadLearning/Chapter3/ThreadLocal22/src/ThreadLocalExt.java
8857b2286168e9584d1325c272a3f27264edacd4
[]
no_license
ganghanglpc/Learning
https://github.com/ganghanglpc/Learning
734bf76efe25fcef9c4c0b5604d4733591577123
658bea3f544d490585426322dbb05eafc53bf501
refs/heads/master
2020-03-20T19:24:23.385000
2018-06-24T10:58:41
2018-06-24T10:58:41
137,636,411
6
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class ThreadLocalExt extends ThreadLocal { @Override protected Object initialValue() { return "我是默认值 第一次get不再为null"; } }
UTF-8
Java
170
java
ThreadLocalExt.java
Java
[]
null
[]
public class ThreadLocalExt extends ThreadLocal { @Override protected Object initialValue() { return "我是默认值 第一次get不再为null"; } }
170
0.689189
0.689189
6
23.666666
18.135294
49
false
false
0
0
0
0
0
0
0.166667
false
false
9
d9eaaa3f80d13ea6abb9afe497e9276db4942215
27,711,129,064,486
6db39ff7592ba2e8d227de40d5cd79af6d162352
/TakeHome/src/com/sujin/takehome/pojo/DiscountMes.java
67f80944ec4e1d468d754cb40bf1254f5c1cf4ce
[]
no_license
RyanTech/TestTakeHome
https://github.com/RyanTech/TestTakeHome
2d582f62f50c3b896a30f03d37de419d65cb2d3d
82ae45639de4e6d5a131c7fe95b1595ca4eb2415
refs/heads/master
2018-07-11T22:15:23.790000
2013-04-06T12:18:33
2013-04-06T12:18:33
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sujin.takehome.pojo; public class DiscountMes { /* * [{"id":"11", * "title":"\u4ec5880\u4e2a\u62cd\u5e01\uff0c\u5373\u53ef\u4eab\u53d7\u603b\u4ef7\u4f18\u60e0200\u4e07\uff01\u62db\u5546\u81fb\u90b8\uff0c\u90fd\u5e02\u4e3b\u8f74\uff0c\u6df1\u9662\u72ec", * "detail":"<p>\u4ec5880\u4e2a\u62cd\u5e01\uff0c\u5373\u53ef\u4eab\u53d7\u603b\u4ef7\u4f18\u60e0200\u4e07\uff01\u62db\u5546\u81fb\u90b8\uff0c\u90fd\u5e02\u4e3b\u8f74\uff0c\u6df1\u9662\u72ec<\/p><p><img src=\"http:\/\/img14.360buyimg.com\/cms\/g9\/M03\/00\/04\/rBEHaVAsvmQIAAAAAAuhVT7yMjUAAABuABTFLQAC6Ft598.jpg\" \/><\/p><p>&nbsp;<\/p><p><img src=\"http:\/\/img13.360buyimg.com\/cms\/g2\/M00\/06\/1E\/rBEGEFAlH_oIAAAAAAsKS3oXfZAAABXEwGr1o4ACwpj010.jpg\" \/><\/p><p><img src=\"http:\/\/img13.360buyimg.com\/cms\/g9\/M03\/00\/04\/rBEHalAsvgoIAAAAAAhb5dHMzeIAAABtwDQBKYACFv9941.jpg\" \/><\/p><p><img src=\"http:\/\/img13.360buyimg.com\/cms\/g9\/M03\/00\/04\/rBEHalAsvgoIAAAAAAhb5dHMzeIAAABtwDQBKYACFv9941.jpg\" \/><\/p><p><img src=\"http:\/\/img12.360buyimg.com\/cms\/g5\/M02\/1C\/01\/rBEIC1AlICkIAAAAAArWSPCMxQcAAFebgH9TxoACtZg363.jpg\" \/><\/p><p>&nbsp;<\/p>", * "startTime":"1349691784", * "endTime":"1351678987", * "imageId":"285", * "candidate":"0", * "opts":"4", * "status":"0", * "productId":"13", * "creationUserId":"7", * "creationTime":"1349605487", * "isHot":"0", * "isCheck":"0", * "imageUrl":"\/data\/uploads\/2012\/1007\/18\/5071586f46878.png", * "fangyuan":"", * "loupan":"\u62db\u5546\u81fb\u90b8"},{" */ private String id; private String title; private String detail; private String startTime; private String endTime; private String imageId; private String candidate; private String opts; private String status; private String productId; private String creationUserId; private String creationTime; private String isHot; private String isCheck; private String imageUrl; private String fangyuan; private String loupan; private BuildMes lp; private TopBuilding fy; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDetail() { return detail; } public void setDetail(String detail) { this.detail = detail; } public String getStartTime() { return startTime; } public void setStartTime(String startTime) { this.startTime = startTime; } public String getEndTime() { return endTime; } public void setEndTime(String endTime) { this.endTime = endTime; } public String getImageId() { return imageId; } public void setImageId(String imageId) { this.imageId = imageId; } public String getCandidate() { return candidate; } public void setCandidate(String candidate) { this.candidate = candidate; } public String getOpts() { return opts; } public void setOpts(String opts) { this.opts = opts; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getProductId() { return productId; } public void setProductId(String productId) { this.productId = productId; } public String getCreationUserId() { return creationUserId; } public void setCreationUserId(String creationUserId) { this.creationUserId = creationUserId; } public String getCreationTime() { return creationTime; } public void setCreationTime(String creationTime) { this.creationTime = creationTime; } public String getIsHot() { return isHot; } public void setIsHot(String isHot) { this.isHot = isHot; } public String getIsCheck() { return isCheck; } public void setIsCheck(String isCheck) { this.isCheck = isCheck; } public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public String getFangyuan() { return fangyuan; } public void setFangyuan(String fangyuan) { this.fangyuan = fangyuan; } public String getLoupan() { return loupan; } public void setLoupan(String loupan) { this.loupan = loupan; } public BuildMes getLp() { return lp; } public void setLp(BuildMes lp) { this.lp = lp; } public TopBuilding getFy() { return fy; } public void setFy(TopBuilding fy) { this.fy = fy; } }
UTF-8
Java
4,312
java
DiscountMes.java
Java
[]
null
[]
package com.sujin.takehome.pojo; public class DiscountMes { /* * [{"id":"11", * "title":"\u4ec5880\u4e2a\u62cd\u5e01\uff0c\u5373\u53ef\u4eab\u53d7\u603b\u4ef7\u4f18\u60e0200\u4e07\uff01\u62db\u5546\u81fb\u90b8\uff0c\u90fd\u5e02\u4e3b\u8f74\uff0c\u6df1\u9662\u72ec", * "detail":"<p>\u4ec5880\u4e2a\u62cd\u5e01\uff0c\u5373\u53ef\u4eab\u53d7\u603b\u4ef7\u4f18\u60e0200\u4e07\uff01\u62db\u5546\u81fb\u90b8\uff0c\u90fd\u5e02\u4e3b\u8f74\uff0c\u6df1\u9662\u72ec<\/p><p><img src=\"http:\/\/img14.360buyimg.com\/cms\/g9\/M03\/00\/04\/rBEHaVAsvmQIAAAAAAuhVT7yMjUAAABuABTFLQAC6Ft598.jpg\" \/><\/p><p>&nbsp;<\/p><p><img src=\"http:\/\/img13.360buyimg.com\/cms\/g2\/M00\/06\/1E\/rBEGEFAlH_oIAAAAAAsKS3oXfZAAABXEwGr1o4ACwpj010.jpg\" \/><\/p><p><img src=\"http:\/\/img13.360buyimg.com\/cms\/g9\/M03\/00\/04\/rBEHalAsvgoIAAAAAAhb5dHMzeIAAABtwDQBKYACFv9941.jpg\" \/><\/p><p><img src=\"http:\/\/img13.360buyimg.com\/cms\/g9\/M03\/00\/04\/rBEHalAsvgoIAAAAAAhb5dHMzeIAAABtwDQBKYACFv9941.jpg\" \/><\/p><p><img src=\"http:\/\/img12.360buyimg.com\/cms\/g5\/M02\/1C\/01\/rBEIC1AlICkIAAAAAArWSPCMxQcAAFebgH9TxoACtZg363.jpg\" \/><\/p><p>&nbsp;<\/p>", * "startTime":"1349691784", * "endTime":"1351678987", * "imageId":"285", * "candidate":"0", * "opts":"4", * "status":"0", * "productId":"13", * "creationUserId":"7", * "creationTime":"1349605487", * "isHot":"0", * "isCheck":"0", * "imageUrl":"\/data\/uploads\/2012\/1007\/18\/5071586f46878.png", * "fangyuan":"", * "loupan":"\u62db\u5546\u81fb\u90b8"},{" */ private String id; private String title; private String detail; private String startTime; private String endTime; private String imageId; private String candidate; private String opts; private String status; private String productId; private String creationUserId; private String creationTime; private String isHot; private String isCheck; private String imageUrl; private String fangyuan; private String loupan; private BuildMes lp; private TopBuilding fy; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDetail() { return detail; } public void setDetail(String detail) { this.detail = detail; } public String getStartTime() { return startTime; } public void setStartTime(String startTime) { this.startTime = startTime; } public String getEndTime() { return endTime; } public void setEndTime(String endTime) { this.endTime = endTime; } public String getImageId() { return imageId; } public void setImageId(String imageId) { this.imageId = imageId; } public String getCandidate() { return candidate; } public void setCandidate(String candidate) { this.candidate = candidate; } public String getOpts() { return opts; } public void setOpts(String opts) { this.opts = opts; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getProductId() { return productId; } public void setProductId(String productId) { this.productId = productId; } public String getCreationUserId() { return creationUserId; } public void setCreationUserId(String creationUserId) { this.creationUserId = creationUserId; } public String getCreationTime() { return creationTime; } public void setCreationTime(String creationTime) { this.creationTime = creationTime; } public String getIsHot() { return isHot; } public void setIsHot(String isHot) { this.isHot = isHot; } public String getIsCheck() { return isCheck; } public void setIsCheck(String isCheck) { this.isCheck = isCheck; } public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public String getFangyuan() { return fangyuan; } public void setFangyuan(String fangyuan) { this.fangyuan = fangyuan; } public String getLoupan() { return loupan; } public void setLoupan(String loupan) { this.loupan = loupan; } public BuildMes getLp() { return lp; } public void setLp(BuildMes lp) { this.lp = lp; } public TopBuilding getFy() { return fy; } public void setFy(TopBuilding fy) { this.fy = fy; } }
4,312
0.702226
0.631262
161
25.782608
68.789505
861
false
false
0
0
90
0.080705
0
0
1.68323
false
false
9
596cde3f0b40a616e58ceb8b57cf13542ae52c23
25,821,343,389,918
e3d98ca76bfa4e14a1c5c791cd37629734314d98
/src/main/java/com/chr/cache/Cache.java
4afb6c1a61c87db5b62b602e918d284a0ddc8e1c
[]
no_license
zhenglu1989/redis-learning
https://github.com/zhenglu1989/redis-learning
05f040367441e512f540ce694db8ef4eb1a305fd
2afe149d7d3b472e58dbaaa9595d3a78f8d99061
refs/heads/master
2021-01-04T14:10:49.529000
2015-06-29T01:56:16
2015-06-29T01:56:16
35,272,099
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.chr.cache; import java.io.Serializable; import java.util.Set; /** * cache 接口定义 * @author zhenglu * @since 15/5/22 */ public interface Cache { /** * get * @param key * @return */ public Serializable get(String key); /** * 设置 缓存 * @param key * @param value * @return */ public boolean set(String key,Serializable value); /** * 设置cache 设置失效时间,单位为s * @param key * @param value * @param timeout */ public boolean set(String key,Serializable value,long timeout); /** * 移除key * @param key * @return */ public boolean remove(String key); /** * 是否存在key * @param key * @return */ public boolean exists(String key); /** * 清楚所有匹配pattern * 缓存信息 */ public void clear(String pattern); /** * 获取所有匹配pattern的key * @return */ public Set<String> keys(String pattern); }
UTF-8
Java
1,064
java
Cache.java
Java
[ { "context": "mport java.util.Set;\n\n/**\n * cache 接口定义\n * @author zhenglu\n * @since 15/5/22\n */\npublic interface Cache {\n\n ", "end": 112, "score": 0.9993758797645569, "start": 105, "tag": "USERNAME", "value": "zhenglu" } ]
null
[]
package com.chr.cache; import java.io.Serializable; import java.util.Set; /** * cache 接口定义 * @author zhenglu * @since 15/5/22 */ public interface Cache { /** * get * @param key * @return */ public Serializable get(String key); /** * 设置 缓存 * @param key * @param value * @return */ public boolean set(String key,Serializable value); /** * 设置cache 设置失效时间,单位为s * @param key * @param value * @param timeout */ public boolean set(String key,Serializable value,long timeout); /** * 移除key * @param key * @return */ public boolean remove(String key); /** * 是否存在key * @param key * @return */ public boolean exists(String key); /** * 清楚所有匹配pattern * 缓存信息 */ public void clear(String pattern); /** * 获取所有匹配pattern的key * @return */ public Set<String> keys(String pattern); }
1,064
0.535787
0.530675
68
13.382353
13.726348
67
true
false
0
0
0
0
0
0
0.191176
false
false
9
e4b668cdf4cfde1d755e1ccef6d6cd2c0cf4a23f
29,618,094,475,140
1b11fd757212dc4be59d28d84aa8d66a6ef64cc0
/volunteerApp/src/main/java/mum/edu/volunteer/service/VolenteerService.java
05b11ffc71c5d396a7bf6c119e88d0ec7b740129
[]
no_license
feedonat/volenteerProject
https://github.com/feedonat/volenteerProject
b51baa55bbd430c1c7a4c7f5a7f6a67fa752fdef
909c6eaec7fbc64ed0bafed35dbcda257d0d42fe
refs/heads/master
2020-07-30T00:11:48.564000
2016-11-14T08:00:32
2016-11-14T08:00:32
73,652,817
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package mum.edu.volunteer.service; import java.util.List; import mum.edu.volunteer.domain.Volunteer; public interface VolenteerService { public void save(Volunteer project); public List<Volunteer> findAll(); public Volunteer getProjectByvId (int projectId); public Volunteer findByName(String projectName); }
UTF-8
Java
328
java
VolenteerService.java
Java
[]
null
[]
package mum.edu.volunteer.service; import java.util.List; import mum.edu.volunteer.domain.Volunteer; public interface VolenteerService { public void save(Volunteer project); public List<Volunteer> findAll(); public Volunteer getProjectByvId (int projectId); public Volunteer findByName(String projectName); }
328
0.77439
0.77439
12
25.333334
19.049643
50
false
false
0
0
0
0
0
0
0.916667
false
false
9
3919e68cd51f50b224cef37d4ec9f1e65c8c977d
31,009,663,943,468
22933d50138a8806010a6035e7af27eea0aa8fd9
/src/test/java/com/mimacom/junit5/core/ExtensionTest.java
1b924ee9e3c7778636eb01ed4b0608563b050ce6
[]
no_license
frbo42/junit5
https://github.com/frbo42/junit5
700d1d17ace3db8070f431f57df6f302d6e46f98
341dbe7a8f63023dcf899b6023c5e4b439442650
refs/heads/master
2022-06-13T15:23:25.125000
2020-05-07T22:31:15
2020-05-07T22:31:15
262,170,665
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mimacom.junit5.core; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @ExtendWith(EventExtension.class) class ExtensionTest { EventExtension.EventAssert assertEvent; @Test void extensionTest() { new Item().update("newValue"); assertEvent.verifyPublished(DomainEvent.class); } }
UTF-8
Java
364
java
ExtensionTest.java
Java
[]
null
[]
package com.mimacom.junit5.core; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @ExtendWith(EventExtension.class) class ExtensionTest { EventExtension.EventAssert assertEvent; @Test void extensionTest() { new Item().update("newValue"); assertEvent.verifyPublished(DomainEvent.class); } }
364
0.728022
0.725275
17
20.470589
19.15914
55
false
false
0
0
0
0
0
0
0.352941
false
false
9
f3eee835f21dbeb4bb4f6d0d3106a766552b6ad5
29,575,144,856,474
835c55851c6869c98aa40115f890295ca60a6c60
/app/src/main/java/com/example/exercisesqlite/DisplayMhs.java
aca57c36a2843a5710601dea077ebe40494ea6c7
[]
no_license
annisadianamarta/ExerciseSqlite
https://github.com/annisadianamarta/ExerciseSqlite
f2904db32465477bf979404bafe50f2e70854e17
b34efcc555c13ebfcdae50f6161e6d813b3ee1d3
refs/heads/master
2022-04-26T20:05:50.655000
2020-04-21T03:43:18
2020-04-21T03:43:18
257,472,346
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.exercisesqlite; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.database.Cursor; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class DisplayMhs extends AppCompatActivity { int from_Where_I_Am_Coming = 0; private com.example.exercisesqlite.DBHelper mydb ; EditText nama ; EditText phone; EditText email; EditText alamat; int id_To_Update = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_mhs); mydb = new com.example.exercisesqlite.DBHelper(this); nama = (EditText) findViewById(R.id.editUN); email = (EditText) findViewById(R.id.editEmail); phone = (EditText) findViewById(R.id.editPass); alamat = (EditText) findViewById(R.id.editAlamat); Bundle extras = getIntent().getExtras(); if(extras !=null) { int Value = extras.getInt("id"); if(Value>0){ //means this is the view part not the add contact part. Cursor rs = mydb.getData(Value); id_To_Update = Value; rs.moveToFirst(); String nam = rs.getString(rs.getColumnIndex(DBHelper.MHS_COLUMN_NAMA)); String phon = rs.getString(rs.getColumnIndex(DBHelper.MHS_COLUMN_PHONE)); String mail = rs.getString(rs.getColumnIndex(DBHelper.MHS_COLUMN_EMAIL)); String almt = rs.getString(rs.getColumnIndex(DBHelper.MHS_COLUMN_ALAMAT)); if (!rs.isClosed()){ rs.close(); } Button b = (Button)findViewById(R.id.btnok); b.setVisibility(View.INVISIBLE); email.setText((CharSequence)mail); email.setFocusable(false); email.setClickable(false); nama.setText((CharSequence)nam); nama.setFocusable(false); nama.setClickable(false); phone.setText((CharSequence)phon); phone.setFocusable(false); phone.setClickable(false); alamat.setText((CharSequence)almt); alamat.setFocusable(false); alamat.setClickable(false); } } } public void run(View view) { if (nama.getText().toString().equals("")|| phone.getText().toString().equals("")|| email.getText().toString().equals("")|| alamat.getText().toString().equals("")){ Toast.makeText(getApplicationContext(), "Data Harus Diisi Semua !", Toast.LENGTH_LONG).show(); }else { mydb.insertContact(nama.getText().toString(), phone.getText().toString(), email.getText().toString(),alamat.getText().toString()); Toast.makeText(getApplicationContext(), "Insert data Berhasil !", Toast.LENGTH_LONG).show(); Intent i = new Intent(getApplicationContext(), MainActivity.class); startActivity(i); } } }
UTF-8
Java
3,439
java
DisplayMhs.java
Java
[]
null
[]
package com.example.exercisesqlite; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.Intent; import android.database.Cursor; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class DisplayMhs extends AppCompatActivity { int from_Where_I_Am_Coming = 0; private com.example.exercisesqlite.DBHelper mydb ; EditText nama ; EditText phone; EditText email; EditText alamat; int id_To_Update = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_mhs); mydb = new com.example.exercisesqlite.DBHelper(this); nama = (EditText) findViewById(R.id.editUN); email = (EditText) findViewById(R.id.editEmail); phone = (EditText) findViewById(R.id.editPass); alamat = (EditText) findViewById(R.id.editAlamat); Bundle extras = getIntent().getExtras(); if(extras !=null) { int Value = extras.getInt("id"); if(Value>0){ //means this is the view part not the add contact part. Cursor rs = mydb.getData(Value); id_To_Update = Value; rs.moveToFirst(); String nam = rs.getString(rs.getColumnIndex(DBHelper.MHS_COLUMN_NAMA)); String phon = rs.getString(rs.getColumnIndex(DBHelper.MHS_COLUMN_PHONE)); String mail = rs.getString(rs.getColumnIndex(DBHelper.MHS_COLUMN_EMAIL)); String almt = rs.getString(rs.getColumnIndex(DBHelper.MHS_COLUMN_ALAMAT)); if (!rs.isClosed()){ rs.close(); } Button b = (Button)findViewById(R.id.btnok); b.setVisibility(View.INVISIBLE); email.setText((CharSequence)mail); email.setFocusable(false); email.setClickable(false); nama.setText((CharSequence)nam); nama.setFocusable(false); nama.setClickable(false); phone.setText((CharSequence)phon); phone.setFocusable(false); phone.setClickable(false); alamat.setText((CharSequence)almt); alamat.setFocusable(false); alamat.setClickable(false); } } } public void run(View view) { if (nama.getText().toString().equals("")|| phone.getText().toString().equals("")|| email.getText().toString().equals("")|| alamat.getText().toString().equals("")){ Toast.makeText(getApplicationContext(), "Data Harus Diisi Semua !", Toast.LENGTH_LONG).show(); }else { mydb.insertContact(nama.getText().toString(), phone.getText().toString(), email.getText().toString(),alamat.getText().toString()); Toast.makeText(getApplicationContext(), "Insert data Berhasil !", Toast.LENGTH_LONG).show(); Intent i = new Intent(getApplicationContext(), MainActivity.class); startActivity(i); } } }
3,439
0.602791
0.601919
93
35.989246
25.862537
142
false
false
0
0
0
0
0
0
0.763441
false
false
9
7b5001c2abca16f840f89a83ea4a53ec8e615bff
9,569,187,203,896
cf24c6c8c8580754b2d564dac6886003b5074af6
/src/interfaces9/Music4.java
4cf36d3dabd9af3b390a8444ad4abd2542d0349f
[]
no_license
ArturGudiev/ThinkingInJava
https://github.com/ArturGudiev/ThinkingInJava
6fd98642c8fa568d9e1b9dd58e701c2380a780e9
265b5445993a4d52d9c43b4b5ee51ca469f34ccf
refs/heads/master
2021-01-11T16:42:25.755000
2017-01-30T11:52:16
2017-01-30T11:52:16
80,142,082
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package interfaces9; /** * Created by 1 on 11.10.2016. */ import polymorphism8.music.*; abstract class Instrument4{ private int i; public abstract void play(Note n); String what(){ return "Instrument"; } public abstract void adjust(); } class Wind4 extends Instrument4 { public void play(Note n){ System.out.println("interfaces9.Wind4.play() " + n);} String what(){ return "interfaces9.Wind4";} public void adjust(){} } class Percussion4 extends Instrument4 { public void play(Note n){System.out.println("interfaces9.Percussion4.play() " + n);} String what(){ return "interfaces9.Percussion4";} public void adjust(){} } class Stringed4 extends Instrument4 { public void play(Note n){System.out.println("interfaces9.Stringed4.play() " + n);} String what(){ return "Stringed3";} public void adjust(){} } class Brass4 extends Wind4{ public void play(Note n){System.out.println("interfaces9.Brass4.play() " + n);} public void adjust(){System.out.println("interfaces9.Brass4.adjust()");} } class Woodwind4 extends Wind4{ public void play(Note n){System.out.println("interfaces9.Woodwind4.play() " + n);} public String what(){ return "Woodwind3";} } public class Music4 { public static void tune(Instrument4 i){ i.play(Note.MIDDLE_C); } public static void tuneAll(Instrument4[] e){ for(Instrument4 i : e){ tune(i); } } public static void main(String[] args) { Instrument4[] orchestra = { new Wind4(), new Percussion4(), new Stringed4(), new Brass4(), new Woodwind4() }; tuneAll(orchestra); } }
UTF-8
Java
1,797
java
Music4.java
Java
[]
null
[]
package interfaces9; /** * Created by 1 on 11.10.2016. */ import polymorphism8.music.*; abstract class Instrument4{ private int i; public abstract void play(Note n); String what(){ return "Instrument"; } public abstract void adjust(); } class Wind4 extends Instrument4 { public void play(Note n){ System.out.println("interfaces9.Wind4.play() " + n);} String what(){ return "interfaces9.Wind4";} public void adjust(){} } class Percussion4 extends Instrument4 { public void play(Note n){System.out.println("interfaces9.Percussion4.play() " + n);} String what(){ return "interfaces9.Percussion4";} public void adjust(){} } class Stringed4 extends Instrument4 { public void play(Note n){System.out.println("interfaces9.Stringed4.play() " + n);} String what(){ return "Stringed3";} public void adjust(){} } class Brass4 extends Wind4{ public void play(Note n){System.out.println("interfaces9.Brass4.play() " + n);} public void adjust(){System.out.println("interfaces9.Brass4.adjust()");} } class Woodwind4 extends Wind4{ public void play(Note n){System.out.println("interfaces9.Woodwind4.play() " + n);} public String what(){ return "Woodwind3";} } public class Music4 { public static void tune(Instrument4 i){ i.play(Note.MIDDLE_C); } public static void tuneAll(Instrument4[] e){ for(Instrument4 i : e){ tune(i); } } public static void main(String[] args) { Instrument4[] orchestra = { new Wind4(), new Percussion4(), new Stringed4(), new Brass4(), new Woodwind4() }; tuneAll(orchestra); } }
1,797
0.602671
0.574847
62
26.919355
24.391497
88
false
false
0
0
0
0
0
0
0.387097
false
false
9
5e1834d209d1651ece5a507a7909375a0eefcf7f
31,241,592,126,733
c442b380077b8c10b275385c102a4e919ee00f20
/src/main/java/concurrency/executor/lesson11/rejectedhandler/Main.java
686155d016424b49a5a3e2aa26dbe0286c919aa8
[]
no_license
543229143/study
https://github.com/543229143/study
88fda6d1b97a5a1593a222d9e56909ae80049376
503d77f8c7f46e1b1518c7fdda4a0a08cbdab570
refs/heads/master
2021-01-20T04:57:21.165000
2015-02-22T15:14:53
2015-02-22T15:14:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package concurrency.executor.lesson11.rejectedhandler; import java.util.concurrent.Executors; import java.util.concurrent.ThreadPoolExecutor; /** * @author chengnl * @E-mail:chengnengliang@vrvmail.com.cn * @date 2014年12月5日 下午4:36:52 * @version 1.0 * @Description:测试 */ public class Main { public static void main(String[] args) { ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors .newCachedThreadPool(); executor.setRejectedExecutionHandler(new RejectedTaskController()); System.out.printf("Main: Starting.\n"); for (int i = 0; i < 5; i++) { executor.submit(new Task("task" + i)); } System.out.printf("Main: Shutting down the Exceutor.\n"); executor.shutdown(); System.out.printf("Main: Sending another Task.\n"); executor.submit(new Task("RejectedTask")); System.out.printf("Main: End.\n"); } }
UTF-8
Java
886
java
Main.java
Java
[ { "context": ".concurrent.ThreadPoolExecutor;\r\n\r\n/**\r\n * @author chengnl\r\n * @E-mail:chengnengliang@vrvmail.com.cn\r\n * @da", "end": 172, "score": 0.9992926716804504, "start": 165, "tag": "USERNAME", "value": "chengnl" }, { "context": "lExecutor;\r\n\r\n/**\r\n * @author chengnl\r\n * @E-mail:chengnengliang@vrvmail.com.cn\r\n * @date 2014年12月5日 下午4:36:52\r\n * @version 1.0\r\n", "end": 214, "score": 0.9999321103096008, "start": 185, "tag": "EMAIL", "value": "chengnengliang@vrvmail.com.cn" } ]
null
[]
package concurrency.executor.lesson11.rejectedhandler; import java.util.concurrent.Executors; import java.util.concurrent.ThreadPoolExecutor; /** * @author chengnl * @E-mail:<EMAIL> * @date 2014年12月5日 下午4:36:52 * @version 1.0 * @Description:测试 */ public class Main { public static void main(String[] args) { ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors .newCachedThreadPool(); executor.setRejectedExecutionHandler(new RejectedTaskController()); System.out.printf("Main: Starting.\n"); for (int i = 0; i < 5; i++) { executor.submit(new Task("task" + i)); } System.out.printf("Main: Shutting down the Exceutor.\n"); executor.shutdown(); System.out.printf("Main: Sending another Task.\n"); executor.submit(new Task("RejectedTask")); System.out.printf("Main: End.\n"); } }
864
0.694954
0.674312
28
29.142857
20.562994
69
false
false
0
0
0
0
0
0
1.535714
false
false
9
da15366fda85b743fa3c967c40ccb4d1b642e68e
16,286,515,993,391
a671290e392f6766f895f07d0f350c3e678cfdad
/src/fizz/buzz/list/helpers/Helpers.java
db220894505f9833f4524aa4e17dc23391e1842c
[]
no_license
noorShooda/fizz-buzz-list
https://github.com/noorShooda/fizz-buzz-list
b7dc3455a3bc8325678df8ba3bfc180c1cab8845
6bb232ac037eeebad273a4b77a06f5a9261a146a
refs/heads/master
2022-10-08T18:49:22.733000
2020-06-09T22:43:22
2020-06-09T22:43:22
271,124,627
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package fizz.buzz.list.helpers; public class Helpers { public Helpers() { } public Boolean divisibleByThree(int value) { if(value % 3 == 0) { return true; } return false; } public Boolean divisibleByFive(int value) { if(value % 5 == 0) { return true; } return false; } public Boolean divisibleByFifteen(int value) { if(value % 15 == 0) { return true; } return false; } public String convertFizzBuzz(int numberToCheck) { if(divisibleByFifteen(numberToCheck)) { return("FizzBuzz " + numberToCheck); } else if(divisibleByThree(numberToCheck)){ return("Fizz " + numberToCheck); } else if(divisibleByFive(numberToCheck)){ return("Buzz " + numberToCheck); } else{ return(Integer.toString(numberToCheck)); } } }
UTF-8
Java
953
java
Helpers.java
Java
[]
null
[]
package fizz.buzz.list.helpers; public class Helpers { public Helpers() { } public Boolean divisibleByThree(int value) { if(value % 3 == 0) { return true; } return false; } public Boolean divisibleByFive(int value) { if(value % 5 == 0) { return true; } return false; } public Boolean divisibleByFifteen(int value) { if(value % 15 == 0) { return true; } return false; } public String convertFizzBuzz(int numberToCheck) { if(divisibleByFifteen(numberToCheck)) { return("FizzBuzz " + numberToCheck); } else if(divisibleByThree(numberToCheck)){ return("Fizz " + numberToCheck); } else if(divisibleByFive(numberToCheck)){ return("Buzz " + numberToCheck); } else{ return(Integer.toString(numberToCheck)); } } }
953
0.541448
0.534103
39
23.435898
18.107649
54
false
false
0
0
0
0
0
0
0.282051
false
false
9
7fe38dc2c41d3c48b2078c5876fe222278f18408
9,895,604,650,647
0ec9494d780bb818014f2d3c18933d4417040128
/coral-base/coral-common/src/test/java/com/coral/base/common/design/bridge/SquareShape.java
237bc281aee07152ee05eb5d5a9ba3945a346353
[]
no_license
coralloc8/springboot-example
https://github.com/coralloc8/springboot-example
c7e14c3ab0ecac1920365267dc7abb086fcde880
80b80afe4e666c6285f3dd492d436c6f6c03216d
refs/heads/master
2023-02-19T23:54:44.445000
2023-02-13T09:03:40
2023-02-13T09:03:40
274,320,100
1
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.coral.base.common.design.bridge; /** * @author huss * @version 1.0 * @className SquareShape * @description todo * @date 2022/8/1 14:15 */ public class SquareShape extends BaseShape implements Shape { public SquareShape(Color color, ProductionMode mode) { super(color, mode); } @Override public void draw() { super.draw(); System.out.println("形状:立方体"); } }
UTF-8
Java
433
java
SquareShape.java
Java
[ { "context": "m.coral.base.common.design.bridge;\n\n/**\n * @author huss\n * @version 1.0\n * @className SquareShape\n * @des", "end": 65, "score": 0.999582052230835, "start": 61, "tag": "USERNAME", "value": "huss" } ]
null
[]
package com.coral.base.common.design.bridge; /** * @author huss * @version 1.0 * @className SquareShape * @description todo * @date 2022/8/1 14:15 */ public class SquareShape extends BaseShape implements Shape { public SquareShape(Color color, ProductionMode mode) { super(color, mode); } @Override public void draw() { super.draw(); System.out.println("形状:立方体"); } }
433
0.638955
0.610451
21
19.047619
17.940313
61
false
false
0
0
0
0
0
0
0.285714
false
false
9
e84a56d181443707e2c976f3e41dc1a2797666e2
9,895,604,652,605
32c3e10d042f8486a96e90f23b0af6a4812cdd53
/amvpframework/src/main/java/com/bwie/mvpframework/view/ShowLoginView.java
481a0d3de8421d6872cd461df3529aef6ce7002b
[]
no_license
823253467/AAAA
https://github.com/823253467/AAAA
bbf4b9a2b659b22886edb2435dbf82e696bc8b05
a8dd4620d0355026aa4751b194c108461de6445a
refs/heads/master
2021-08-08T13:30:53.681000
2017-11-10T11:54:37
2017-11-10T11:55:04
110,221,164
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bwie.mvpframework.view; import com.bwie.mvpframework.bean.LoginBean; /** * Created by asus on 2017/11/7. */ public interface ShowLoginView { public void showLogin(LoginBean bean); }
UTF-8
Java
203
java
ShowLoginView.java
Java
[ { "context": "ie.mvpframework.bean.LoginBean;\n\n/**\n * Created by asus on 2017/11/7.\n */\n\npublic interface ShowLoginView", "end": 105, "score": 0.9966542720794678, "start": 101, "tag": "USERNAME", "value": "asus" } ]
null
[]
package com.bwie.mvpframework.view; import com.bwie.mvpframework.bean.LoginBean; /** * Created by asus on 2017/11/7. */ public interface ShowLoginView { public void showLogin(LoginBean bean); }
203
0.738916
0.704434
11
17.454546
18.192724
44
false
false
0
0
0
0
0
0
0.272727
false
false
9
d2c40017a929295f719f6e19cb616a000ed07882
28,020,366,640,406
a4f6e4d5f7c7619f2dfa513f519584ed06d77c00
/src/main/java/in/test/app/model/CompactSpot.java
22ab29fd76f5309bd1ab22bf4d60195662e9580c
[]
no_license
sushil4u2/test-park
https://github.com/sushil4u2/test-park
294e09cf7905724dd3d107e9455d530dcd67178d
ed572b03ab484100fbb9f105644b8d035880c857
refs/heads/master
2022-11-30T01:34:43.253000
2020-08-03T09:22:55
2020-08-03T09:22:55
284,656,465
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package in.test.app.model; import in.test.app.parking.enums.ParkingSpotType; public class CompactSpot extends ParkingSpot { public CompactSpot() { super(ParkingSpotType.COMPACT); } }
UTF-8
Java
189
java
CompactSpot.java
Java
[]
null
[]
package in.test.app.model; import in.test.app.parking.enums.ParkingSpotType; public class CompactSpot extends ParkingSpot { public CompactSpot() { super(ParkingSpotType.COMPACT); } }
189
0.777778
0.777778
9
20
18.903263
49
false
false
0
0
0
0
0
0
0.777778
false
false
9
21d6fbd59e85015a89f3cc5b2c73d845bd22b97b
13,065,290,582,235
48a24d3c0cf1df5eafbfd5c4e06f4821bcee48c0
/src/main/java/exceptionmulticatch/converter/BinaryStringConverter.java
4a5d4e78eb3796145524d53d15d9dfa097e322ca
[]
no_license
kim7272/training-solutions
https://github.com/kim7272/training-solutions
75afb2f83eddf5fe1a19bdd2c428ee1711784da0
f8704908456c7af466b71188049d3bc456026426
refs/heads/master
2023-04-01T17:46:18.859000
2021-04-06T06:55:30
2021-04-06T06:55:30
308,690,122
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package exceptionmulticatch.converter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class BinaryStringConverter { public boolean[] binaryStringToBooleanArray(String text) { boolean[] b; if (text == null){ throw new NullPointerException("binaryString null"); } List<Integer> numbers = new ArrayList<>(); String[] array = text.split(""); for (int i = 0; i < array.length; i++) { numbers.add(Integer.parseInt(array[i])); } for (int number : numbers) { if ((number != 0) && (number != 1)) { throw new IllegalArgumentException("binaryString not valid"); } } b = new boolean[numbers.size()]; for (int j = 0; j < numbers.size(); j++) { if (numbers.get(j) == 0) { b[j] = false; } else { b[j] = true; } } return b; } public String booleanArrayToBinaryString(boolean[] values) { List<Integer> numbers = new ArrayList<>(); StringBuilder str = new StringBuilder(); String string; if (values.length == 0) { throw new IllegalArgumentException("Array is empty!"); } for (boolean b : values) { if (b == true) { numbers.add(1); } else { numbers.add(0); } } for (Integer number : numbers) { str.append(number.toString()); } string = str.toString(); return string; } /* public static void main(String[] args) { String binaryString = "011100"; String[] array = binaryString.split(""); List<Integer> numbers = new ArrayList<>(); int number = Integer.parseInt(array[1]); numbers.add(Integer.parseInt(array[1])); System.out.println(numbers.get(0)); } */ }
UTF-8
Java
1,983
java
BinaryStringConverter.java
Java
[]
null
[]
package exceptionmulticatch.converter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class BinaryStringConverter { public boolean[] binaryStringToBooleanArray(String text) { boolean[] b; if (text == null){ throw new NullPointerException("binaryString null"); } List<Integer> numbers = new ArrayList<>(); String[] array = text.split(""); for (int i = 0; i < array.length; i++) { numbers.add(Integer.parseInt(array[i])); } for (int number : numbers) { if ((number != 0) && (number != 1)) { throw new IllegalArgumentException("binaryString not valid"); } } b = new boolean[numbers.size()]; for (int j = 0; j < numbers.size(); j++) { if (numbers.get(j) == 0) { b[j] = false; } else { b[j] = true; } } return b; } public String booleanArrayToBinaryString(boolean[] values) { List<Integer> numbers = new ArrayList<>(); StringBuilder str = new StringBuilder(); String string; if (values.length == 0) { throw new IllegalArgumentException("Array is empty!"); } for (boolean b : values) { if (b == true) { numbers.add(1); } else { numbers.add(0); } } for (Integer number : numbers) { str.append(number.toString()); } string = str.toString(); return string; } /* public static void main(String[] args) { String binaryString = "011100"; String[] array = binaryString.split(""); List<Integer> numbers = new ArrayList<>(); int number = Integer.parseInt(array[1]); numbers.add(Integer.parseInt(array[1])); System.out.println(numbers.get(0)); } */ }
1,983
0.513364
0.504791
68
28.17647
19.8316
77
false
false
0
0
0
0
0
0
0.485294
false
false
9
dd55dc7dc927b944ff14879554fd2b9bbb6dc62c
33,440,615,369,670
b56a854294e17cc2c3bcd1490e80b3de39f2cb5b
/app/src/main/java/com/icogroup/baseprojectdatabinding/ui/activity/MovieDetailActivity.java
ae25693bcb8baa9c6521985e39b551071a226624
[]
no_license
ICOGroup/androidDataBindingBaseProject
https://github.com/ICOGroup/androidDataBindingBaseProject
80c1ba7bfce36a9a96350c7136b3adf0d59d0011
27feacb41756bc28c4badac9aabee5ccf41790dd
refs/heads/master
2021-01-17T17:10:47.654000
2016-10-25T14:26:30
2016-10-25T14:26:30
59,858,454
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.icogroup.baseprojectdatabinding.ui.activity; import android.content.Intent; import android.databinding.DataBindingUtil; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.Toast; import com.icogroup.baseprojectdatabinding.R; import com.icogroup.baseprojectdatabinding.data.model.Movie; import com.icogroup.baseprojectdatabinding.data.routing.BaseRouting; import com.icogroup.baseprojectdatabinding.data.sections.movie.detail.MovieDetailContract; import com.icogroup.baseprojectdatabinding.data.sections.movie.detail.MovieDetailPresenter; import com.icogroup.baseprojectdatabinding.databinding.ActivityMovieDetailBinding; public class MovieDetailActivity extends AppCompatActivity implements MovieDetailContract.View { private MovieDetailPresenter mPresenter; private Movie mMovie; private BaseRouting mBaseRouting; public final static String MOVIE_EXTRA = "movie"; private ActivityMovieDetailBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = DataBindingUtil.setContentView(this, R.layout .activity_movie_detail); Intent intent = getIntent(); Movie movie = new Movie(); if(intent.hasExtra(MOVIE_EXTRA)) movie = intent.getParcelableExtra(MOVIE_EXTRA); mPresenter = new MovieDetailPresenter(this); mMovie = new Movie(); mBaseRouting = new BaseRouting(); binding.setMovie(mMovie); mPresenter.getMovie(movie.getId()); } @Override protected void onDestroy() { mPresenter.onDestroy(); super.onDestroy(); } @Override public void showError(String error) { Toast.makeText(this, error, Toast.LENGTH_SHORT).show(); } @Override public void setMovie(Movie movie) { mMovie.setId(movie.getId()); mMovie.setTitle(movie.getTitle()); mMovie.setActors(movie.getActors()); mMovie.setAwards(movie.getAwards()); mMovie.setDirector(movie.getDirector()); mMovie.setGenre(movie.getGenre()); mMovie.setImdbRating(movie.getImdbRating()); mMovie.setImdbVotes(movie.getImdbVotes()); mMovie.setPlot(movie.getPlot()); mMovie.setPoster(movie.getPoster()); mMovie.setRated(movie.getRated()); mMovie.setReleased(movie.getReleased()); mMovie.setRuntime(movie.getRuntime()); mMovie.setWriter(movie.getWriter()); mMovie.setYear(movie.getYear()); } }
UTF-8
Java
2,580
java
MovieDetailActivity.java
Java
[]
null
[]
package com.icogroup.baseprojectdatabinding.ui.activity; import android.content.Intent; import android.databinding.DataBindingUtil; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.Toast; import com.icogroup.baseprojectdatabinding.R; import com.icogroup.baseprojectdatabinding.data.model.Movie; import com.icogroup.baseprojectdatabinding.data.routing.BaseRouting; import com.icogroup.baseprojectdatabinding.data.sections.movie.detail.MovieDetailContract; import com.icogroup.baseprojectdatabinding.data.sections.movie.detail.MovieDetailPresenter; import com.icogroup.baseprojectdatabinding.databinding.ActivityMovieDetailBinding; public class MovieDetailActivity extends AppCompatActivity implements MovieDetailContract.View { private MovieDetailPresenter mPresenter; private Movie mMovie; private BaseRouting mBaseRouting; public final static String MOVIE_EXTRA = "movie"; private ActivityMovieDetailBinding binding; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = DataBindingUtil.setContentView(this, R.layout .activity_movie_detail); Intent intent = getIntent(); Movie movie = new Movie(); if(intent.hasExtra(MOVIE_EXTRA)) movie = intent.getParcelableExtra(MOVIE_EXTRA); mPresenter = new MovieDetailPresenter(this); mMovie = new Movie(); mBaseRouting = new BaseRouting(); binding.setMovie(mMovie); mPresenter.getMovie(movie.getId()); } @Override protected void onDestroy() { mPresenter.onDestroy(); super.onDestroy(); } @Override public void showError(String error) { Toast.makeText(this, error, Toast.LENGTH_SHORT).show(); } @Override public void setMovie(Movie movie) { mMovie.setId(movie.getId()); mMovie.setTitle(movie.getTitle()); mMovie.setActors(movie.getActors()); mMovie.setAwards(movie.getAwards()); mMovie.setDirector(movie.getDirector()); mMovie.setGenre(movie.getGenre()); mMovie.setImdbRating(movie.getImdbRating()); mMovie.setImdbVotes(movie.getImdbVotes()); mMovie.setPlot(movie.getPlot()); mMovie.setPoster(movie.getPoster()); mMovie.setRated(movie.getRated()); mMovie.setReleased(movie.getReleased()); mMovie.setRuntime(movie.getRuntime()); mMovie.setWriter(movie.getWriter()); mMovie.setYear(movie.getYear()); } }
2,580
0.713566
0.713178
76
32.947369
24.315845
96
false
false
0
0
0
0
0
0
0.631579
false
false
9
5e51893e2e5c9e62c600b3be0b5df67b8736115a
16,217,796,540,238
aa52f57226b1340d97fe8248e9c332f079171cf2
/src/main/java/challenge/redbee/services/UserService.java
cc53ac9b274afa71d8776622a24a7698b6da589f
[]
no_license
facundotesei/weather-api
https://github.com/facundotesei/weather-api
55874564def0611ccacfaf7b3124bd35359f73f4
fe5c15c957e65638cb7c104d8b737f98f5745077
refs/heads/master
2020-04-02T15:53:23.128000
2018-10-31T22:16:45
2018-10-31T22:16:45
154,587,854
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package challenge.redbee.services; import challenge.redbee.domain.User; import java.util.List; public interface UserService { List<User> getAllUsers(); User getUserById(Long id); User getUserByEmail(String mail); User saveUser(User user); User saveOrReturn(User user); User updateUser(Long id, User user); void deleteById(Long id); }
UTF-8
Java
373
java
UserService.java
Java
[]
null
[]
package challenge.redbee.services; import challenge.redbee.domain.User; import java.util.List; public interface UserService { List<User> getAllUsers(); User getUserById(Long id); User getUserByEmail(String mail); User saveUser(User user); User saveOrReturn(User user); User updateUser(Long id, User user); void deleteById(Long id); }
373
0.710456
0.710456
23
15.217391
16.140568
40
false
false
0
0
0
0
0
0
0.478261
false
false
9
b41df4623d032cc4dd654b5d114d46800108d02e
33,689,723,510,212
5e2c743bbac041d9fa117f566b84a4da336aeb7f
/Marta2/app/src/main/java/arias/jenifer/wewant2cook/WeWant2CookActivity.java
bb98b227697e35666e3fb7f25911b09164fc59f8
[]
no_license
jenni-arias/WeWant2Cook
https://github.com/jenni-arias/WeWant2Cook
4af9d14a846fccaaa6ef72f79246cd264b01a978
a64456a18d7380912af85f77f1c31e00b50d0494
refs/heads/master
2021-09-04T06:50:56.465000
2018-01-16T21:47:42
2018-01-16T21:47:42
111,115,672
0
0
null
false
2017-12-11T15:05:24
2017-11-17T14:58:03
2017-11-18T12:20:40
2017-12-11T15:05:23
141
0
0
0
Java
false
null
package arias.jenifer.wewant2cook; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class WeWant2CookActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_we_want_2_cook); } }
UTF-8
Java
355
java
WeWant2CookActivity.java
Java
[ { "context": "package arias.jenifer.wewant2cook;\n\nimport android.support.v7.a", "end": 13, "score": 0.8867040276527405, "start": 8, "tag": "USERNAME", "value": "arias" }, { "context": "package arias.jenifer.wewant2cook;\n\nimport android.support.v7.app.AppCo", "end": 21, "score": 0.9352524280548096, "start": 14, "tag": "USERNAME", "value": "jenifer" } ]
null
[]
package arias.jenifer.wewant2cook; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class WeWant2CookActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_we_want_2_cook); } }
355
0.76338
0.752113
13
26.307692
23.397516
60
false
false
0
0
0
0
0
0
0.384615
false
false
9
38ffd0e2055e43e7c3c960c3b983d9a4e2ab3bff
19,301,583,065,306
bfc676e4200c8b0c88787907cd7aafda2fe5b5ca
/src/main/java/org/thingsplode/synapse/core/MessageHeader.java
a4b8a121f0f76a8f129a61d927af6585ebbd5b33
[ "Apache-2.0" ]
permissive
thingsplode/thingsplode-synapse
https://github.com/thingsplode/thingsplode-synapse
206593d9ab4c9b1a3134c352dbeee7ab142ae471
9dfe7da633c0a2b0f778b8942b419f1b0a5f99a5
refs/heads/master
2016-09-14T08:31:29.993000
2016-05-16T17:10:43
2016-05-16T17:10:43
56,455,125
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2016 Csaba Tamas. * * 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.thingsplode.synapse.core; import java.net.SocketAddress; import java.util.HashMap; import java.util.Map; import java.util.Optional; /** * * @author Csaba Tamas */ public class MessageHeader { protected String msgId; private String protocolVersion; private SocketAddress remoteAddress; private final HashMap<String, String> properties = new HashMap<>(); public MessageHeader() { } public MessageHeader(String msgId) { this.msgId = msgId; } public String getMsgId() { return msgId; } public void setMsgId(String msgId) { this.msgId = msgId; } public String getProtocolVersion() { return protocolVersion; } public void setProtocolVersion(String protocolVersion) { this.protocolVersion = protocolVersion; } public SocketAddress getRemoteAddress() { return remoteAddress; } public void setRemoteAddress(SocketAddress callerAddress) { this.remoteAddress = callerAddress; } public void addProperty(String key, String value) { properties.put(key, value); } public Optional<String> getProperty(String propertyKey) { return Optional.ofNullable(properties.get(propertyKey)); } public HashMap<String, String> getProperties() { return properties; } public void addAllProperties(Iterable<Map.Entry<String, String>> iterable) { if (iterable != null) { iterable.forEach((e) -> properties.put(e.getKey(), e.getValue())); } } @Override public String toString() { return "msgId=" + msgId; } }
UTF-8
Java
2,242
java
MessageHeader.java
Java
[ { "context": "/*\n * Copyright 2016 Csaba Tamas.\n *\n * Licensed under the Apache License, Version", "end": 32, "score": 0.999851405620575, "start": 21, "tag": "NAME", "value": "Csaba Tamas" }, { "context": "Map;\nimport java.util.Optional;\n\n/**\n *\n * @author Csaba Tamas\n */\npublic class MessageHeader {\n\n protected S", "end": 772, "score": 0.9998383522033691, "start": 761, "tag": "NAME", "value": "Csaba Tamas" } ]
null
[]
/* * Copyright 2016 <NAME>. * * 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.thingsplode.synapse.core; import java.net.SocketAddress; import java.util.HashMap; import java.util.Map; import java.util.Optional; /** * * @author <NAME> */ public class MessageHeader { protected String msgId; private String protocolVersion; private SocketAddress remoteAddress; private final HashMap<String, String> properties = new HashMap<>(); public MessageHeader() { } public MessageHeader(String msgId) { this.msgId = msgId; } public String getMsgId() { return msgId; } public void setMsgId(String msgId) { this.msgId = msgId; } public String getProtocolVersion() { return protocolVersion; } public void setProtocolVersion(String protocolVersion) { this.protocolVersion = protocolVersion; } public SocketAddress getRemoteAddress() { return remoteAddress; } public void setRemoteAddress(SocketAddress callerAddress) { this.remoteAddress = callerAddress; } public void addProperty(String key, String value) { properties.put(key, value); } public Optional<String> getProperty(String propertyKey) { return Optional.ofNullable(properties.get(propertyKey)); } public HashMap<String, String> getProperties() { return properties; } public void addAllProperties(Iterable<Map.Entry<String, String>> iterable) { if (iterable != null) { iterable.forEach((e) -> properties.put(e.getKey(), e.getValue())); } } @Override public String toString() { return "msgId=" + msgId; } }
2,232
0.674844
0.671276
87
24.770115
24.192097
80
false
false
0
0
0
0
0
0
0.367816
false
false
9
17e130b380ec7b566b458677486d99fdb7fde50d
34,291,018,903,537
0bba7d28adb9873834dbc9fedc7165bec830fa16
/src/abstraction/MyFamily.java
8605ebe135afcbaf2bed052ca0913d0046e9c198
[]
no_license
renxing18/hw4-3733_Ren-
https://github.com/renxing18/hw4-3733_Ren-
ba6a7f557f299c7adb5b77b67644e3c27878d69f
f5adef6a570fcb1b9b4a8e9c9dfdd3a94c51174b
refs/heads/master
2020-03-26T14:57:26.253000
2018-08-17T21:31:14
2018-08-17T21:31:14
145,014,252
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package abstraction; public class MyFamily extends SundayHome implements Family { public void breakfast() { System.out.println("Egg and Chese"); } public void home() { System.out.println("This is My Home"); } public void parents() { System.out.println("My parents does not live here"); } public void sonsanddaughters() { System.out.println("I dont have any"); } }
UTF-8
Java
414
java
MyFamily.java
Java
[]
null
[]
package abstraction; public class MyFamily extends SundayHome implements Family { public void breakfast() { System.out.println("Egg and Chese"); } public void home() { System.out.println("This is My Home"); } public void parents() { System.out.println("My parents does not live here"); } public void sonsanddaughters() { System.out.println("I dont have any"); } }
414
0.649758
0.649758
33
11.484848
17.434069
60
false
false
0
0
0
0
0
0
1.060606
false
false
9