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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
47c7ab45ae0ba79f1e943dd79a9fa15acf0be6e2
| 11,965,778,920,901 |
c6e67724c789d45f7c9260603ee5d480a03257ed
|
/src/main/java/com/epam/preprod/tereshkevych/shop/db/extractor/CategoryDaoExtractor.java
|
f79a119816a5b24fa8e9e2f228343be45ff02148
|
[] |
no_license
|
vladhaigarden/ApplianceStore
|
https://github.com/vladhaigarden/ApplianceStore
|
f9b6fabe57a6964c2bcf020a1dbfec9f6b673f39
|
67e6967a0222d01ddf4a95aab47cf3d439f44183
|
refs/heads/master
| 2022-06-23T11:49:45.788000 | 2020-01-18T13:58:17 | 2020-01-18T13:58:17 | 234,741,952 | 0 | 0 | null | false | 2022-06-21T02:39:51 | 2020-01-18T13:52:26 | 2020-01-18T19:27:05 | 2022-06-21T02:39:50 | 4,686 | 0 | 0 | 2 |
Java
| false | false |
package com.epam.preprod.tereshkevych.shop.db.extractor;
import com.epam.preprod.tereshkevych.shop.db.entity.Category;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Create category with fields which was obtained from database
*
* @author Vladyslav Tereshkevych
*/
public class CategoryDaoExtractor implements DbExtractor<Category> {
private static final String ENTITY_ID = "id";
private static final String CATEGORY_NAME = "name";
@Override
public Category extract(ResultSet rs) throws SQLException {
Category category = new Category();
category.setId(rs.getLong(ENTITY_ID));
category.setName(rs.getString(CATEGORY_NAME));
return category;
}
}
|
UTF-8
|
Java
| 722 |
java
|
CategoryDaoExtractor.java
|
Java
|
[
{
"context": "lds which was obtained from database\n *\n * @author Vladyslav Tereshkevych\n */\npublic class CategoryDaoExtractor implements ",
"end": 283,
"score": 0.9998646974563599,
"start": 261,
"tag": "NAME",
"value": "Vladyslav Tereshkevych"
}
] | null |
[] |
package com.epam.preprod.tereshkevych.shop.db.extractor;
import com.epam.preprod.tereshkevych.shop.db.entity.Category;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Create category with fields which was obtained from database
*
* @author <NAME>
*/
public class CategoryDaoExtractor implements DbExtractor<Category> {
private static final String ENTITY_ID = "id";
private static final String CATEGORY_NAME = "name";
@Override
public Category extract(ResultSet rs) throws SQLException {
Category category = new Category();
category.setId(rs.getLong(ENTITY_ID));
category.setName(rs.getString(CATEGORY_NAME));
return category;
}
}
| 706 | 0.729917 | 0.729917 | 26 | 26.807692 | 25.145758 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false |
5
|
659424e3b373d6c86f3d5d94ad4b7b3db2a96157
| 36,034,775,621,165 |
a7d385f251f3dba1897fca7e97e297ac15e28ec5
|
/app/src/main/java/com/training/one/activity/ContentActivity.java
|
23010947312de2fbbac5220a2c1eadc9ca4efef2
|
[] |
no_license
|
Meghdad24/BookApp
|
https://github.com/Meghdad24/BookApp
|
beaee765bf21d0bcf6b2c18304db57b5abaa4b26
|
7fdf1345961a14370dc2267224a4c7fb7ba8fd8d
|
refs/heads/master
| 2023-08-25T22:06:55.249000 | 2021-11-06T11:01:24 | 2021-11-06T11:01:24 | 425,185,351 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.training.one.activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.squareup.picasso.Picasso;
import com.training.one.R;
import de.hdodenhof.circleimageview.CircleImageView;
public class ContentActivity extends AppCompatActivity implements View.OnClickListener {
private ImageView backBtn;
private CircleImageView imageTop;
private TextView field, description, name;
private FloatingActionButton likeBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_content);
setupViews();
getAndSetData();
backBtn.setOnClickListener(this);
likeBtn.setOnClickListener(this);
}
private void getAndSetData() {
name.setText(getIntent().getExtras().getString("NAME"));
field.setText(getIntent().getExtras().getString("FIELD"));
description.setText(getIntent().getExtras().getString("DESCRIPTION"));
Picasso.get().load(getIntent().getExtras().getString("IMAGE")).resize(128, 128).into(imageTop);
}
private void setupViews() {
backBtn = findViewById(R.id.content_back_id);
imageTop = findViewById(R.id.content_main_img_id);
field = findViewById(R.id.content_name_def_id);
description = findViewById(R.id.content_definition_id);
name = findViewById(R.id.content_name_id);
likeBtn = findViewById(R.id.content_like_button_id);
}
@Override
public void onClick(View view) {
int viewID = view.getId();
switch (viewID) {
case R.id.content_back_id:
onBackPressed();
break;
case R.id.content_like_button_id:
break;
}
}
}
|
UTF-8
|
Java
| 2,021 |
java
|
ContentActivity.java
|
Java
|
[] | null |
[] |
package com.training.one.activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.squareup.picasso.Picasso;
import com.training.one.R;
import de.hdodenhof.circleimageview.CircleImageView;
public class ContentActivity extends AppCompatActivity implements View.OnClickListener {
private ImageView backBtn;
private CircleImageView imageTop;
private TextView field, description, name;
private FloatingActionButton likeBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_content);
setupViews();
getAndSetData();
backBtn.setOnClickListener(this);
likeBtn.setOnClickListener(this);
}
private void getAndSetData() {
name.setText(getIntent().getExtras().getString("NAME"));
field.setText(getIntent().getExtras().getString("FIELD"));
description.setText(getIntent().getExtras().getString("DESCRIPTION"));
Picasso.get().load(getIntent().getExtras().getString("IMAGE")).resize(128, 128).into(imageTop);
}
private void setupViews() {
backBtn = findViewById(R.id.content_back_id);
imageTop = findViewById(R.id.content_main_img_id);
field = findViewById(R.id.content_name_def_id);
description = findViewById(R.id.content_definition_id);
name = findViewById(R.id.content_name_id);
likeBtn = findViewById(R.id.content_like_button_id);
}
@Override
public void onClick(View view) {
int viewID = view.getId();
switch (viewID) {
case R.id.content_back_id:
onBackPressed();
break;
case R.id.content_like_button_id:
break;
}
}
}
| 2,021 | 0.684315 | 0.681346 | 63 | 31.095238 | 24.735243 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.603175 | false | false |
5
|
7dd0a9e7a8454990ab49176973a59e05f2ee94fc
| 25,486,335,965,125 |
2f9731ac95764217dd340c227fee320b16a25363
|
/src/main/java/org/vasttrafik/wso2/carbon/identity/oauth/authcontext/JWTClaimsRetriever.java
|
321d2cd95eec4264b35cfd676d24a961be2ec784
|
[
"MIT"
] |
permissive
|
vasttrafik/wso2-apim-developer-portal-api-utils
|
https://github.com/vasttrafik/wso2-apim-developer-portal-api-utils
|
14431bd8648228dbb241d5870b2415724e4d1db7
|
203aaeaa46e82328df1215b8ff52193d320c8eaa
|
refs/heads/master
| 2021-01-21T04:59:36.501000 | 2017-07-07T11:38:35 | 2017-07-07T11:38:35 | 45,143,415 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.vasttrafik.wso2.carbon.identity.oauth.authcontext;
import java.util.SortedMap;
//import org.wso2.carbon.user.api.UserStoreException;
//import org.wso2.carbon.user.api.UserStoreManager;
//import org.wso2.carbon.base.MultitenantConstants;
//import org.wso2.carbon.identity.oauth.internal.OAuthComponentServiceHolder;
import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception;
import org.wso2.carbon.identity.oauth2.authcontext.DefaultClaimsRetriever;
import org.vasttrafik.wso2.carbon.identity.api.utils.UserAdminUtils;
public class JWTClaimsRetriever extends DefaultClaimsRetriever {
@Override
public SortedMap<String, String> getClaims(String endUserName, String[] requestedClaims) throws IdentityOAuth2Exception {
// Get the default claims
SortedMap<String, String> claimValues = super.getClaims(endUserName, requestedClaims);
/*try {
// Get a user store manager
UserStoreManager userStoreManager = OAuthComponentServiceHolder.getRealmService()
.getTenantUserRealm(MultitenantConstants.SUPER_TENANT_ID)
.getUserStoreManager();
if (userStoreManager == null)
throw new IdentityOAuth2Exception("Failed to retrieve user store manager");
// Get the user id
int userId = userStoreManager.getUserId(endUserName);
// Put it in the claims map
claimValues.put("http://wso2.org/claims/identity/id", String.valueOf(userId));
// Return result
return claimValues;
}
catch (UserStoreException use) {
throw new IdentityOAuth2Exception("Failed to retrieve user id from user store:" + use.getMessage());
}*/
try {
// Get the user id
int userId = UserAdminUtils.getUserId(endUserName);
// Put it in the claims map
claimValues.put("http://wso2.org/claims/identity/id", String.valueOf(userId));
// Return result
return claimValues;
}
catch (Exception e) {
throw new IdentityOAuth2Exception("Failed to retrieve user id:" + e.getMessage());
}
}
}
|
UTF-8
|
Java
| 2,012 |
java
|
JWTClaimsRetriever.java
|
Java
|
[] | null |
[] |
package org.vasttrafik.wso2.carbon.identity.oauth.authcontext;
import java.util.SortedMap;
//import org.wso2.carbon.user.api.UserStoreException;
//import org.wso2.carbon.user.api.UserStoreManager;
//import org.wso2.carbon.base.MultitenantConstants;
//import org.wso2.carbon.identity.oauth.internal.OAuthComponentServiceHolder;
import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception;
import org.wso2.carbon.identity.oauth2.authcontext.DefaultClaimsRetriever;
import org.vasttrafik.wso2.carbon.identity.api.utils.UserAdminUtils;
public class JWTClaimsRetriever extends DefaultClaimsRetriever {
@Override
public SortedMap<String, String> getClaims(String endUserName, String[] requestedClaims) throws IdentityOAuth2Exception {
// Get the default claims
SortedMap<String, String> claimValues = super.getClaims(endUserName, requestedClaims);
/*try {
// Get a user store manager
UserStoreManager userStoreManager = OAuthComponentServiceHolder.getRealmService()
.getTenantUserRealm(MultitenantConstants.SUPER_TENANT_ID)
.getUserStoreManager();
if (userStoreManager == null)
throw new IdentityOAuth2Exception("Failed to retrieve user store manager");
// Get the user id
int userId = userStoreManager.getUserId(endUserName);
// Put it in the claims map
claimValues.put("http://wso2.org/claims/identity/id", String.valueOf(userId));
// Return result
return claimValues;
}
catch (UserStoreException use) {
throw new IdentityOAuth2Exception("Failed to retrieve user id from user store:" + use.getMessage());
}*/
try {
// Get the user id
int userId = UserAdminUtils.getUserId(endUserName);
// Put it in the claims map
claimValues.put("http://wso2.org/claims/identity/id", String.valueOf(userId));
// Return result
return claimValues;
}
catch (Exception e) {
throw new IdentityOAuth2Exception("Failed to retrieve user id:" + e.getMessage());
}
}
}
| 2,012 | 0.736084 | 0.727634 | 52 | 37.71154 | 32.313568 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.019231 | false | false |
5
|
4cf7886aa4d6ccc44f46a5865cc6d581408238c2
| 10,608,569,238,318 |
a275a942a884f1c24ce68a4df024f969559e4e0f
|
/bam_Step3_Consumer/src/main/java/ru/rofleksey/osgi/step3/consumer/ByeWorld.java
|
6c69de691796fb60ced298d6f19b1da89b26c3e8
|
[] |
no_license
|
rofleksey/OSGiPractice
|
https://github.com/rofleksey/OSGiPractice
|
2802a644c9b1669c4136b80ae6309ef36f6577d2
|
61e85faf4bcf07adf68939f4c1b67ad30b1f0840
|
refs/heads/master
| 2020-04-25T18:08:19.138000 | 2019-02-28T09:29:24 | 2019-02-28T09:29:24 | 170,577,950 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ru.rofleksey.osgi.step3.consumer;
import org.osgi.service.component.annotations.*;
import ru.rofleksey.osgi.step3.provider.HelloWorldService;
@Component
public class ByeWorld {
private HelloWorldService greeter;
@Reference(
service = HelloWorldService.class,
cardinality = ReferenceCardinality.MANDATORY,
policy = ReferencePolicy.DYNAMIC,
unbind = "unsetGreeter"
)
protected void setGreeter(HelloWorldService world) {
greeter = world;
}
@Activate
protected void onActivate() {
greeter.sayHello();
}
protected void unsetGreeter(HelloWorldService world) {
greeter = null;
}
}
|
UTF-8
|
Java
| 700 |
java
|
ByeWorld.java
|
Java
|
[] | null |
[] |
package ru.rofleksey.osgi.step3.consumer;
import org.osgi.service.component.annotations.*;
import ru.rofleksey.osgi.step3.provider.HelloWorldService;
@Component
public class ByeWorld {
private HelloWorldService greeter;
@Reference(
service = HelloWorldService.class,
cardinality = ReferenceCardinality.MANDATORY,
policy = ReferencePolicy.DYNAMIC,
unbind = "unsetGreeter"
)
protected void setGreeter(HelloWorldService world) {
greeter = world;
}
@Activate
protected void onActivate() {
greeter.sayHello();
}
protected void unsetGreeter(HelloWorldService world) {
greeter = null;
}
}
| 700 | 0.671429 | 0.668571 | 29 | 23.137932 | 20.702698 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.344828 | false | false |
5
|
40f1df9eedd52691451e849243f53250c3f8c3b3
| 23,330,262,386,071 |
645ca252a24f8688bc6dfe8540d93c202adf8226
|
/heima_ssm_service/src/main/java/com/itheima/ssm/service/impl/IUserServiceImpl.java
|
dc6aac20014935fc855e67ca0fc66cb90af6af2c
|
[] |
no_license
|
JasonChany/ssm
|
https://github.com/JasonChany/ssm
|
5ab83049a3b707cec6a4b53091b7b9528fa9ad65
|
3f900e431ece287a2a72b632bfdbe164967f5422
|
refs/heads/master
| 2020-05-07T09:10:30.019000 | 2019-04-09T12:35:10 | 2019-04-09T12:35:10 | 180,365,647 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.itheima.ssm.service.impl;
import com.itheima.ssm.dao.IUserDao;
import com.itheima.ssm.domain.Role;
import com.itheima.ssm.domain.UserInfo;
import com.itheima.ssm.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* @Author: Jason
* @Date: 2019/4/4 22:31
* @Description:
*/
@Service("userService")
@Transactional
public class IUserServiceImpl implements IUserService {
@Autowired
private IUserDao iUserDao;
@Autowired
private BCryptPasswordEncoder passwordEncoder;
/**
* 封装成框架能识别的角色对象
* @param roles
* @return
*/
public static List<SimpleGrantedAuthority> getAuthority(List<Role> roles){
List<SimpleGrantedAuthority> authorities=new ArrayList<SimpleGrantedAuthority>();
for (Role role : roles) {
authorities.add(new SimpleGrantedAuthority("ROLE_"+role.getRoleName()));
}
return authorities;
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
//从数据库获取实际存储的用户对象
UserInfo userInfo = iUserDao.findUserByUsername(username);
//给框架返回其能识别的User对象(UserDetails的实现类对象),这个User是框架预定义对象,不是自定义的
User user = new User(userInfo.getUsername(),userInfo.getPassword(),userInfo.getStatus()==0?false:true,true,true,true, getAuthority(userInfo.getRoles()));
return user;
}
@Override
public List<UserInfo> findAll() {
return iUserDao.findAll();
}
@Override
public void save(UserInfo userInfo) {
//存储前将密码进行加密处理
userInfo.setPassword(passwordEncoder.encode(userInfo.getPassword()));
iUserDao.save(userInfo);
}
@Override
public UserInfo findById(String uid) {
return iUserDao.findById(uid);
}
@Override
public List<Role> findOtherRoles(String uid) {
return iUserDao.findOtherRoles(uid);
}
@Override
public void addRoleToUser(String uid, String[] roleIds) {
for (String roleId : roleIds) {
iUserDao.addRoleToUser(uid,roleId);
}
}
}
|
UTF-8
|
Java
| 2,765 |
java
|
IUserServiceImpl.java
|
Java
|
[
{
"context": "ArrayList;\nimport java.util.List;\n\n/**\n * @Author: Jason\n * @Date: 2019/4/4 22:31\n * @Description:\n */\n@Se",
"end": 799,
"score": 0.9932357668876648,
"start": 794,
"tag": "NAME",
"value": "Jason"
}
] | null |
[] |
package com.itheima.ssm.service.impl;
import com.itheima.ssm.dao.IUserDao;
import com.itheima.ssm.domain.Role;
import com.itheima.ssm.domain.UserInfo;
import com.itheima.ssm.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* @Author: Jason
* @Date: 2019/4/4 22:31
* @Description:
*/
@Service("userService")
@Transactional
public class IUserServiceImpl implements IUserService {
@Autowired
private IUserDao iUserDao;
@Autowired
private BCryptPasswordEncoder passwordEncoder;
/**
* 封装成框架能识别的角色对象
* @param roles
* @return
*/
public static List<SimpleGrantedAuthority> getAuthority(List<Role> roles){
List<SimpleGrantedAuthority> authorities=new ArrayList<SimpleGrantedAuthority>();
for (Role role : roles) {
authorities.add(new SimpleGrantedAuthority("ROLE_"+role.getRoleName()));
}
return authorities;
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
//从数据库获取实际存储的用户对象
UserInfo userInfo = iUserDao.findUserByUsername(username);
//给框架返回其能识别的User对象(UserDetails的实现类对象),这个User是框架预定义对象,不是自定义的
User user = new User(userInfo.getUsername(),userInfo.getPassword(),userInfo.getStatus()==0?false:true,true,true,true, getAuthority(userInfo.getRoles()));
return user;
}
@Override
public List<UserInfo> findAll() {
return iUserDao.findAll();
}
@Override
public void save(UserInfo userInfo) {
//存储前将密码进行加密处理
userInfo.setPassword(passwordEncoder.encode(userInfo.getPassword()));
iUserDao.save(userInfo);
}
@Override
public UserInfo findById(String uid) {
return iUserDao.findById(uid);
}
@Override
public List<Role> findOtherRoles(String uid) {
return iUserDao.findOtherRoles(uid);
}
@Override
public void addRoleToUser(String uid, String[] roleIds) {
for (String roleId : roleIds) {
iUserDao.addRoleToUser(uid,roleId);
}
}
}
| 2,765 | 0.722712 | 0.718499 | 82 | 30.841463 | 29.270176 | 161 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.463415 | false | false |
5
|
457b3ddb5255c4dc9ab19ca786413f0a4e6bab1e
| 35,115,652,629,137 |
fc6bb35bc8ed07b742d5a5b1b287cc33f18a7e8d
|
/src/me/jack/ld27/States/HowToPlay.java
|
61f00017e49bcf30abac652a401418bc658fca8c
|
[] |
no_license
|
JPatrickDev/LD27
|
https://github.com/JPatrickDev/LD27
|
2be38e214fd85c3a996cd3653f1cc3c7f12a9cc6
|
32d408aa1d3cf95d64a429944e96f480c15a3384
|
refs/heads/master
| 2016-08-06T04:16:13.615000 | 2013-08-26T00:54:37 | 2013-08-26T00:54:37 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package me.jack.ld27.States;
import me.jack.ld27.LD27Game;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
/**
* Author: Jack
* Date: 26/08/13
*/
public class HowToPlay extends BasicGameState {
@Override
public int getID() {
return 4;
}
@Override
public void init(GameContainer gameContainer, StateBasedGame stateBasedGame) throws SlickException {
}
@Override
public void render(GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics graphics) throws SlickException {
// graphics.setFont(LD27Game.smaller);
graphics.drawString("The aim of rush is to complete each level in as little time as possible.", 5, 50);
graphics.drawString("You get 10 seconds to complete each level + Any time you had left from the last level",5,150);
graphics.drawString("In order to increase your score, you can collect the coins along the way",5,200);
graphics.drawString("But be careful! Sometimes coins can make you go out of your way,\nand you may run out of time.",5,250);
graphics.drawString("WAD to move A = LEFT, D = RIGHT,W to jump.",5,300);
graphics.drawString("To complete a level, get from one Gate to the other!",5,350);
graphics.drawString("You have 3 lives to complete the game. Falling from the level or running out of time",5,400);
graphics.drawString("will remove a life",5,450);
graphics.drawString("Complete all 10 levels to win!",5,500);
}
@Override
public void update(GameContainer gameContainer, StateBasedGame stateBasedGame, int i) throws SlickException {
}
}
|
UTF-8
|
Java
| 1,783 |
java
|
HowToPlay.java
|
Java
|
[
{
"context": "ewdawn.slick.state.StateBasedGame;\n\n/**\n * Author: Jack\n * Date: 26/08/13\n */\npublic class HowToPlay exte",
"end": 290,
"score": 0.9466148614883423,
"start": 286,
"tag": "NAME",
"value": "Jack"
}
] | null |
[] |
package me.jack.ld27.States;
import me.jack.ld27.LD27Game;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
/**
* Author: Jack
* Date: 26/08/13
*/
public class HowToPlay extends BasicGameState {
@Override
public int getID() {
return 4;
}
@Override
public void init(GameContainer gameContainer, StateBasedGame stateBasedGame) throws SlickException {
}
@Override
public void render(GameContainer gameContainer, StateBasedGame stateBasedGame, Graphics graphics) throws SlickException {
// graphics.setFont(LD27Game.smaller);
graphics.drawString("The aim of rush is to complete each level in as little time as possible.", 5, 50);
graphics.drawString("You get 10 seconds to complete each level + Any time you had left from the last level",5,150);
graphics.drawString("In order to increase your score, you can collect the coins along the way",5,200);
graphics.drawString("But be careful! Sometimes coins can make you go out of your way,\nand you may run out of time.",5,250);
graphics.drawString("WAD to move A = LEFT, D = RIGHT,W to jump.",5,300);
graphics.drawString("To complete a level, get from one Gate to the other!",5,350);
graphics.drawString("You have 3 lives to complete the game. Falling from the level or running out of time",5,400);
graphics.drawString("will remove a life",5,450);
graphics.drawString("Complete all 10 levels to win!",5,500);
}
@Override
public void update(GameContainer gameContainer, StateBasedGame stateBasedGame, int i) throws SlickException {
}
}
| 1,783 | 0.718452 | 0.687605 | 43 | 40.465115 | 42.987476 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.069767 | false | false |
5
|
7e26153c57293f5229a538cd37710f5979f9e921
| 34,033,320,872,621 |
c5af4f1980e9e9b1010e670c3e48e71c5508495e
|
/src/vehinhcoban/shape/h2d/CoiXayGio.java
|
675f6d13f10969aac50be77ca7f6f169bc9f3fbf
|
[] |
no_license
|
TranMinhTuan09011999/TECHNICAL_DRAWING_2D_3D
|
https://github.com/TranMinhTuan09011999/TECHNICAL_DRAWING_2D_3D
|
25d6dbd985f7027103b46aae5a82f3651f4319c6
|
6013a8d2556c6402014b68886d7a80c130430096
|
refs/heads/master
| 2023-04-01T09:05:50.899000 | 2021-04-09T15:43:52 | 2021-04-09T15:43:52 | 356,320,740 | 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 vehinhcoban.shape.h2d;
import java.awt.image.BufferedImage;
import vehinhcoban.constant.ColorConstant;
import vehinhcoban.shape.PhepBienDoi2D;
/**
*
* @author 09096
*/
public class CoiXayGio extends Shape{
protected Point diemVe;
protected Point diemMai;
protected Point diemThan;
protected Point diemDauDayDien;
protected Point diemDauDayDienTram;
protected Point diemTramDien1;
protected Point diemTramDien2;
protected Point diemTramDien3;
protected Rectangle tram1;
protected Rectangle tram2;
protected Rectangle tram3;
protected boolean chieu_xoay;
//CANH 1
protected Point diemCanh1;
protected Point diemCanh2;
//CANH 2
protected Point diemCanh3;
protected Point diemCanh4;
//CANH 3
protected Point diemCanh5;
protected Point diemCanh6;
//CANH 4
protected Point diemCanh7;
protected Point diemCanh8;
protected int r_dauQuay = 5;
public CoiXayGio(Point diemVe) {
this.diemVe = diemVe;
this.chieu_xoay = true;
this.diemThan = new Point(diemVe.getX()-6, diemVe.getY()-41);
this.diemDauDayDien= new Point(diemThan.getX()+12, diemThan.getY()+5);
this.diemDauDayDienTram = new Point(diemThan.getX()+12+20, diemThan.getY());
// this.diemDauDayDien = new Point(diemThan.getX()+12, diemThan.getY()+5);
this.diemTramDien1 = diemDauDayDienTram;
this.diemTramDien2 = new Point(diemDauDayDienTram.getX()+10,diemDauDayDienTram.getY());
this.diemTramDien3 = new Point(diemDauDayDienTram.getX()+20,diemDauDayDienTram.getY());
this.tram1 = new Rectangle(diemTramDien1, 10, 20);
this.tram2 = new Rectangle(diemTramDien2, 10, 20);
this.tram3 = new Rectangle(diemTramDien3, 10, 20);
}
public void doCoiXayGio(BufferedImage image, int color){
//dau
Circle dauQuay = new Circle(Point.convert(diemVe.getX(), diemVe.getY()), r_dauQuay*5);
dauQuay.drawShape(image, ColorConstant.BLACK_RGB);
//than
HinhThang than = new HinhThang(getDiemThan(),12,37);
than.drawShape(image, color);
//mai
setDiemMai(new Point(diemVe.getX()-6, diemVe.getY()+r_dauQuay));
HinhTamGiac tamgiac = new HinhTamGiac(12,getDiemMai(),10);
tamgiac.drawShape(image, color);
//DAY DIEN
Line day_dien = new Line(Point.convert(getDiemDauDayDien()), Point.convert(new Point(getDiemDauDayDienTram().getX(), getDiemDauDayDienTram().getY()+5)));
day_dien.drawLineNetDut(image, ColorConstant.BLACK_RGB);
//4 canh
setDiemCanh1(Point.convert(diemVe.getX()+r_dauQuay+23, diemVe.getY()+10));
setDiemCanh2(Point.convert(diemVe.getX()+r_dauQuay+16, diemVe.getY()-10));
setDiemCanh3(Point.convert(diemVe.getX()+10, diemVe.getY()+r_dauQuay+16));
setDiemCanh4(Point.convert(diemVe.getX()-10, diemVe.getY()+r_dauQuay+23));
setDiemCanh5(Point.convert(diemVe.getX()-r_dauQuay-16, diemVe.getY()+10));
setDiemCanh6(Point.convert(diemVe.getX()-r_dauQuay-23, diemVe.getY()-10));
setDiemCanh7(Point.convert(diemVe.getX()+10, diemVe.getY()-r_dauQuay-23));
setDiemCanh8(Point.convert(diemVe.getX()-10, diemVe.getY()-r_dauQuay-16));
}
@Override
public void drawShape(BufferedImage image, int color) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
this.doCoiXayGio(image, color);
}
@Override
void tinhTien(BufferedImage image, int tr_x, int tr_y) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void xoay(BufferedImage image, double theta_user) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
Point diemve_convert= Point.convert(diemVe.getX(),diemVe.getY());
double theta = 0;
if(chieu_xoay==true){
theta = -theta_user;
}else{
theta = theta_user;
}
//canh 1
Point p1_canh1 = PhepBienDoi2D.xoayDiem(getDiemCanh1(), diemve_convert, theta);
setDiemCanh1(p1_canh1);
Line li1_canh1 = new Line(diemve_convert, p1_canh1);
li1_canh1.drawShape(image, ColorConstant.GREEN_RGB);
Point p2_canh1 = PhepBienDoi2D.xoayDiem(getDiemCanh2(), diemve_convert,theta);
setDiemCanh2(p2_canh1);
Line li2_canh1 = new Line(diemve_convert, p2_canh1);
li2_canh1.drawShape(image, ColorConstant.GREEN_RGB);
Line li3_canh1 = new Line(p1_canh1, p2_canh1);
li3_canh1.drawShape(image, ColorConstant.GREEN_RGB);
//canh 2
Point p1_canh2 = PhepBienDoi2D.xoayDiem(getDiemCanh3(), diemve_convert,theta);
setDiemCanh3(p1_canh2);
Line li1_canh2 = new Line(diemve_convert, p1_canh2);
li1_canh2.drawShape(image, ColorConstant.RED_RGB);
Point p2_canh2 = PhepBienDoi2D.xoayDiem(getDiemCanh4(), diemve_convert,theta);
setDiemCanh4(p2_canh2);
Line li2_canh2 = new Line(diemve_convert, p2_canh2);
li2_canh2.drawShape(image, ColorConstant.RED_RGB);
Line li3_canh2 = new Line(p1_canh2, p2_canh2);
li3_canh2.drawShape(image, ColorConstant.RED_RGB);
//canh 3
Point p1_canh3 = PhepBienDoi2D.xoayDiem(getDiemCanh5(), diemve_convert,theta);
setDiemCanh5(p1_canh3);
Line li1_canh3 = new Line(diemve_convert, p1_canh3);
li1_canh3.drawShape(image, ColorConstant.GREEN_RGB);
Point p2_canh3 = PhepBienDoi2D.xoayDiem(getDiemCanh6(), diemve_convert,theta);
setDiemCanh6(p2_canh3);
Line li2_canh3 = new Line(diemve_convert, p2_canh3);
li2_canh3.drawShape(image, ColorConstant.GREEN_RGB);
Line li3_canh3 = new Line(p1_canh3, p2_canh3);
li3_canh3.drawShape(image, ColorConstant.GREEN_RGB);
//
//canh4
Point p1_canh4 = PhepBienDoi2D.xoayDiem(getDiemCanh7(), diemve_convert,theta);
setDiemCanh7(p1_canh4);
Line li1_canh4 = new Line(diemve_convert, p1_canh4);
li1_canh4.drawShape(image, ColorConstant.RED_RGB);
Point p2_canh4 = PhepBienDoi2D.xoayDiem(getDiemCanh8(), diemve_convert,theta);
setDiemCanh8(p2_canh4);
Line li2_canh4 = new Line(diemve_convert, p2_canh4);
li2_canh4.drawShape(image, ColorConstant.RED_RGB);
Line li3_canh4 = new Line(p1_canh4, p2_canh4);
li3_canh4.drawShape(image, ColorConstant.RED_RGB);
}
/**
* @return the diemVe
*/
public Point getDiemVe() {
return diemVe;
}
/**
* @param diemVe the diemVe to set
*/
public void setDiemVe(Point diemVe) {
this.diemVe = diemVe;
}
public Point getDiemCanh1() {
return diemCanh1;
}
public void setDiemCanh1(Point diemCanh1) {
this.diemCanh1 = diemCanh1;
}
public Point getDiemCanh2() {
return diemCanh2;
}
public void setDiemCanh2(Point diemCanh2) {
this.diemCanh2 = diemCanh2;
}
public Point getDiemCanh3() {
return diemCanh3;
}
public void setDiemCanh3(Point diemCanh3) {
this.diemCanh3 = diemCanh3;
}
public Point getDiemCanh4() {
return diemCanh4;
}
public void setDiemCanh4(Point diemCanh4) {
this.diemCanh4 = diemCanh4;
}
public int getR_dauQuay() {
return r_dauQuay;
}
public void setR_dauQuay(int r_dauQuay) {
this.r_dauQuay = r_dauQuay;
}
public Point getDiemCanh5() {
return diemCanh5;
}
public void setDiemCanh5(Point diemCanh5) {
this.diemCanh5 = diemCanh5;
}
public Point getDiemCanh6() {
return diemCanh6;
}
public void setDiemCanh6(Point diemCanh6) {
this.diemCanh6 = diemCanh6;
}
public Point getDiemCanh7() {
return diemCanh7;
}
public void setDiemCanh7(Point diemCanh7) {
this.diemCanh7 = diemCanh7;
}
public Point getDiemCanh8() {
return diemCanh8;
}
public void setDiemCanh8(Point diemCanh8) {
this.diemCanh8 = diemCanh8;
}
public boolean isChieu_xoay() {
return chieu_xoay;
}
public void setChieu_xoay(boolean chieu_xoay) {
this.chieu_xoay = chieu_xoay;
}
public Point getDiemMai() {
return diemMai;
}
public void setDiemMai(Point diemMai) {
this.diemMai = diemMai;
}
public Point getDiemThan() {
return diemThan;
}
public void setDiemThan(Point diemThan) {
this.diemThan = diemThan;
}
public Point getDiemDauDayDien() {
return diemDauDayDien;
}
public void setDiemDauDayDien(Point diemDauDayDien) {
this.diemDauDayDien = diemDauDayDien;
}
public Point getDiemDauDayDienTram() {
return diemDauDayDienTram;
}
public void setDiemDauDayDienTram(Point diemDauDayDienTram) {
this.diemDauDayDienTram = diemDauDayDienTram;
}
public Point getDiemTramDien1() {
return diemTramDien1;
}
public void setDiemTramDien1(Point diemTramDien1) {
this.diemTramDien1 = diemTramDien1;
}
public Point getDiemTramDien2() {
return diemTramDien2;
}
public void setDiemTramDien2(Point diemTramDien2) {
this.diemTramDien2 = diemTramDien2;
}
public Point getDiemTramDien3() {
return diemTramDien3;
}
public void setDiemTramDien3(Point diemTramDien3) {
this.diemTramDien3 = diemTramDien3;
}
public Rectangle getTram1() {
return tram1;
}
public void setTram1(Rectangle tram1) {
this.tram1 = tram1;
}
public Rectangle getTram2() {
return tram2;
}
public void setTram2(Rectangle tram2) {
this.tram2 = tram2;
}
public Rectangle getTram3() {
return tram3;
}
public void setTram3(Rectangle tram3) {
this.tram3 = tram3;
}
}
|
UTF-8
|
Java
| 10,507 |
java
|
CoiXayGio.java
|
Java
|
[
{
"context": "hinhcoban.shape.PhepBienDoi2D;\n\n/**\n *\n * @author 09096\n */\npublic class CoiXayGio extends Shape{\n pro",
"end": 361,
"score": 0.9939786195755005,
"start": 356,
"tag": "USERNAME",
"value": "09096"
}
] | 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 vehinhcoban.shape.h2d;
import java.awt.image.BufferedImage;
import vehinhcoban.constant.ColorConstant;
import vehinhcoban.shape.PhepBienDoi2D;
/**
*
* @author 09096
*/
public class CoiXayGio extends Shape{
protected Point diemVe;
protected Point diemMai;
protected Point diemThan;
protected Point diemDauDayDien;
protected Point diemDauDayDienTram;
protected Point diemTramDien1;
protected Point diemTramDien2;
protected Point diemTramDien3;
protected Rectangle tram1;
protected Rectangle tram2;
protected Rectangle tram3;
protected boolean chieu_xoay;
//CANH 1
protected Point diemCanh1;
protected Point diemCanh2;
//CANH 2
protected Point diemCanh3;
protected Point diemCanh4;
//CANH 3
protected Point diemCanh5;
protected Point diemCanh6;
//CANH 4
protected Point diemCanh7;
protected Point diemCanh8;
protected int r_dauQuay = 5;
public CoiXayGio(Point diemVe) {
this.diemVe = diemVe;
this.chieu_xoay = true;
this.diemThan = new Point(diemVe.getX()-6, diemVe.getY()-41);
this.diemDauDayDien= new Point(diemThan.getX()+12, diemThan.getY()+5);
this.diemDauDayDienTram = new Point(diemThan.getX()+12+20, diemThan.getY());
// this.diemDauDayDien = new Point(diemThan.getX()+12, diemThan.getY()+5);
this.diemTramDien1 = diemDauDayDienTram;
this.diemTramDien2 = new Point(diemDauDayDienTram.getX()+10,diemDauDayDienTram.getY());
this.diemTramDien3 = new Point(diemDauDayDienTram.getX()+20,diemDauDayDienTram.getY());
this.tram1 = new Rectangle(diemTramDien1, 10, 20);
this.tram2 = new Rectangle(diemTramDien2, 10, 20);
this.tram3 = new Rectangle(diemTramDien3, 10, 20);
}
public void doCoiXayGio(BufferedImage image, int color){
//dau
Circle dauQuay = new Circle(Point.convert(diemVe.getX(), diemVe.getY()), r_dauQuay*5);
dauQuay.drawShape(image, ColorConstant.BLACK_RGB);
//than
HinhThang than = new HinhThang(getDiemThan(),12,37);
than.drawShape(image, color);
//mai
setDiemMai(new Point(diemVe.getX()-6, diemVe.getY()+r_dauQuay));
HinhTamGiac tamgiac = new HinhTamGiac(12,getDiemMai(),10);
tamgiac.drawShape(image, color);
//DAY DIEN
Line day_dien = new Line(Point.convert(getDiemDauDayDien()), Point.convert(new Point(getDiemDauDayDienTram().getX(), getDiemDauDayDienTram().getY()+5)));
day_dien.drawLineNetDut(image, ColorConstant.BLACK_RGB);
//4 canh
setDiemCanh1(Point.convert(diemVe.getX()+r_dauQuay+23, diemVe.getY()+10));
setDiemCanh2(Point.convert(diemVe.getX()+r_dauQuay+16, diemVe.getY()-10));
setDiemCanh3(Point.convert(diemVe.getX()+10, diemVe.getY()+r_dauQuay+16));
setDiemCanh4(Point.convert(diemVe.getX()-10, diemVe.getY()+r_dauQuay+23));
setDiemCanh5(Point.convert(diemVe.getX()-r_dauQuay-16, diemVe.getY()+10));
setDiemCanh6(Point.convert(diemVe.getX()-r_dauQuay-23, diemVe.getY()-10));
setDiemCanh7(Point.convert(diemVe.getX()+10, diemVe.getY()-r_dauQuay-23));
setDiemCanh8(Point.convert(diemVe.getX()-10, diemVe.getY()-r_dauQuay-16));
}
@Override
public void drawShape(BufferedImage image, int color) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
this.doCoiXayGio(image, color);
}
@Override
void tinhTien(BufferedImage image, int tr_x, int tr_y) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void xoay(BufferedImage image, double theta_user) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
Point diemve_convert= Point.convert(diemVe.getX(),diemVe.getY());
double theta = 0;
if(chieu_xoay==true){
theta = -theta_user;
}else{
theta = theta_user;
}
//canh 1
Point p1_canh1 = PhepBienDoi2D.xoayDiem(getDiemCanh1(), diemve_convert, theta);
setDiemCanh1(p1_canh1);
Line li1_canh1 = new Line(diemve_convert, p1_canh1);
li1_canh1.drawShape(image, ColorConstant.GREEN_RGB);
Point p2_canh1 = PhepBienDoi2D.xoayDiem(getDiemCanh2(), diemve_convert,theta);
setDiemCanh2(p2_canh1);
Line li2_canh1 = new Line(diemve_convert, p2_canh1);
li2_canh1.drawShape(image, ColorConstant.GREEN_RGB);
Line li3_canh1 = new Line(p1_canh1, p2_canh1);
li3_canh1.drawShape(image, ColorConstant.GREEN_RGB);
//canh 2
Point p1_canh2 = PhepBienDoi2D.xoayDiem(getDiemCanh3(), diemve_convert,theta);
setDiemCanh3(p1_canh2);
Line li1_canh2 = new Line(diemve_convert, p1_canh2);
li1_canh2.drawShape(image, ColorConstant.RED_RGB);
Point p2_canh2 = PhepBienDoi2D.xoayDiem(getDiemCanh4(), diemve_convert,theta);
setDiemCanh4(p2_canh2);
Line li2_canh2 = new Line(diemve_convert, p2_canh2);
li2_canh2.drawShape(image, ColorConstant.RED_RGB);
Line li3_canh2 = new Line(p1_canh2, p2_canh2);
li3_canh2.drawShape(image, ColorConstant.RED_RGB);
//canh 3
Point p1_canh3 = PhepBienDoi2D.xoayDiem(getDiemCanh5(), diemve_convert,theta);
setDiemCanh5(p1_canh3);
Line li1_canh3 = new Line(diemve_convert, p1_canh3);
li1_canh3.drawShape(image, ColorConstant.GREEN_RGB);
Point p2_canh3 = PhepBienDoi2D.xoayDiem(getDiemCanh6(), diemve_convert,theta);
setDiemCanh6(p2_canh3);
Line li2_canh3 = new Line(diemve_convert, p2_canh3);
li2_canh3.drawShape(image, ColorConstant.GREEN_RGB);
Line li3_canh3 = new Line(p1_canh3, p2_canh3);
li3_canh3.drawShape(image, ColorConstant.GREEN_RGB);
//
//canh4
Point p1_canh4 = PhepBienDoi2D.xoayDiem(getDiemCanh7(), diemve_convert,theta);
setDiemCanh7(p1_canh4);
Line li1_canh4 = new Line(diemve_convert, p1_canh4);
li1_canh4.drawShape(image, ColorConstant.RED_RGB);
Point p2_canh4 = PhepBienDoi2D.xoayDiem(getDiemCanh8(), diemve_convert,theta);
setDiemCanh8(p2_canh4);
Line li2_canh4 = new Line(diemve_convert, p2_canh4);
li2_canh4.drawShape(image, ColorConstant.RED_RGB);
Line li3_canh4 = new Line(p1_canh4, p2_canh4);
li3_canh4.drawShape(image, ColorConstant.RED_RGB);
}
/**
* @return the diemVe
*/
public Point getDiemVe() {
return diemVe;
}
/**
* @param diemVe the diemVe to set
*/
public void setDiemVe(Point diemVe) {
this.diemVe = diemVe;
}
public Point getDiemCanh1() {
return diemCanh1;
}
public void setDiemCanh1(Point diemCanh1) {
this.diemCanh1 = diemCanh1;
}
public Point getDiemCanh2() {
return diemCanh2;
}
public void setDiemCanh2(Point diemCanh2) {
this.diemCanh2 = diemCanh2;
}
public Point getDiemCanh3() {
return diemCanh3;
}
public void setDiemCanh3(Point diemCanh3) {
this.diemCanh3 = diemCanh3;
}
public Point getDiemCanh4() {
return diemCanh4;
}
public void setDiemCanh4(Point diemCanh4) {
this.diemCanh4 = diemCanh4;
}
public int getR_dauQuay() {
return r_dauQuay;
}
public void setR_dauQuay(int r_dauQuay) {
this.r_dauQuay = r_dauQuay;
}
public Point getDiemCanh5() {
return diemCanh5;
}
public void setDiemCanh5(Point diemCanh5) {
this.diemCanh5 = diemCanh5;
}
public Point getDiemCanh6() {
return diemCanh6;
}
public void setDiemCanh6(Point diemCanh6) {
this.diemCanh6 = diemCanh6;
}
public Point getDiemCanh7() {
return diemCanh7;
}
public void setDiemCanh7(Point diemCanh7) {
this.diemCanh7 = diemCanh7;
}
public Point getDiemCanh8() {
return diemCanh8;
}
public void setDiemCanh8(Point diemCanh8) {
this.diemCanh8 = diemCanh8;
}
public boolean isChieu_xoay() {
return chieu_xoay;
}
public void setChieu_xoay(boolean chieu_xoay) {
this.chieu_xoay = chieu_xoay;
}
public Point getDiemMai() {
return diemMai;
}
public void setDiemMai(Point diemMai) {
this.diemMai = diemMai;
}
public Point getDiemThan() {
return diemThan;
}
public void setDiemThan(Point diemThan) {
this.diemThan = diemThan;
}
public Point getDiemDauDayDien() {
return diemDauDayDien;
}
public void setDiemDauDayDien(Point diemDauDayDien) {
this.diemDauDayDien = diemDauDayDien;
}
public Point getDiemDauDayDienTram() {
return diemDauDayDienTram;
}
public void setDiemDauDayDienTram(Point diemDauDayDienTram) {
this.diemDauDayDienTram = diemDauDayDienTram;
}
public Point getDiemTramDien1() {
return diemTramDien1;
}
public void setDiemTramDien1(Point diemTramDien1) {
this.diemTramDien1 = diemTramDien1;
}
public Point getDiemTramDien2() {
return diemTramDien2;
}
public void setDiemTramDien2(Point diemTramDien2) {
this.diemTramDien2 = diemTramDien2;
}
public Point getDiemTramDien3() {
return diemTramDien3;
}
public void setDiemTramDien3(Point diemTramDien3) {
this.diemTramDien3 = diemTramDien3;
}
public Rectangle getTram1() {
return tram1;
}
public void setTram1(Rectangle tram1) {
this.tram1 = tram1;
}
public Rectangle getTram2() {
return tram2;
}
public void setTram2(Rectangle tram2) {
this.tram2 = tram2;
}
public Rectangle getTram3() {
return tram3;
}
public void setTram3(Rectangle tram3) {
this.tram3 = tram3;
}
}
| 10,507 | 0.63786 | 0.605406 | 350 | 29.02 | 27.731512 | 161 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.665714 | false | false |
5
|
ca72730b8be39e944406d16c6bb68f3d11766ed9
| 34,033,320,874,106 |
ede46a2d0bb3f06aeea06fe21eb7ee395bb0b1e5
|
/project-module-user/project-module-user-service/src/main/java/project/module/user/utils/SqlDateUtils.java
|
7f905b80e84b653097a0d8fba32eb898e8389c9c
|
[] |
no_license
|
kakaCat/project-module
|
https://github.com/kakaCat/project-module
|
e12b409d9592680fcded3cd9cb1e378e14a59344
|
1a051e600fd778e9d6c089acf4dc43ff4591a010
|
refs/heads/master
| 2022-07-04T04:19:06.684000 | 2019-11-01T02:39:50 | 2019-11-01T02:39:50 | 188,809,447 | 0 | 0 | null | false | 2020-10-13T16:34:26 | 2019-05-27T09:05:17 | 2019-11-01T02:40:00 | 2020-10-13T16:34:25 | 213 | 0 | 0 | 1 |
Java
| false | false |
package project.module.user.utils;
import java.util.Date;
public final class SqlDateUtils {
public static Date getNowDate(){
return new Date();
}
}
|
UTF-8
|
Java
| 168 |
java
|
SqlDateUtils.java
|
Java
|
[] | null |
[] |
package project.module.user.utils;
import java.util.Date;
public final class SqlDateUtils {
public static Date getNowDate(){
return new Date();
}
}
| 168 | 0.678571 | 0.678571 | 11 | 14.272727 | 15.033846 | 36 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.272727 | false | false |
5
|
af730f1d54fdecfafff95bf54bc7082cffcf9d0e
| 1,967,095,079,186 |
835da5a3100b6b8d01d36e518a87485f8428b72b
|
/ts-key-tools/src/main/java/com/lyh/tools/entity/SplashAd.java
|
7cb849677d25042f191185c5593bbf99550778bb
|
[] |
no_license
|
liuyuhua1984/game-tools
|
https://github.com/liuyuhua1984/game-tools
|
ad27fd2b1db3716e1dd5bede9a04885e2e80e5db
|
51f5055de7c612bfc08b87c4576078470b595e53
|
refs/heads/master
| 2022-07-04T19:58:14.075000 | 2022-05-19T01:06:46 | 2022-05-19T01:06:46 | 153,424,984 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.lyh.tools.entity;
import com.alibaba.fastjson.annotation.JSONField;
import java.io.Serializable;
public class SplashAd implements Serializable {
@JSONField(name = "ad_path")
private String adPath;
@JSONField(name = "created_at")
private String createdAt;
@JSONField(name = "deleted_at")
private String deletedAt;
private String href;
private String id;
private String title;
@JSONField(name = "updated_at")
private String updatedAt;
public String getAdPath() {
return this.adPath;
}
public String getCreatedAt() {
return this.createdAt;
}
public String getDeletedAt() {
return this.deletedAt;
}
public String getHref() {
return this.href;
}
public String getId() {
return this.id;
}
public String getTitle() {
return this.title;
}
public String getUpdatedAt() {
return this.updatedAt;
}
public void setAdPath(String paramString) {
this.adPath = paramString;
}
public void setCreatedAt(String paramString) {
this.createdAt = paramString;
}
public void setDeletedAt(String paramString) {
this.deletedAt = paramString;
}
public void setHref(String paramString) {
this.href = paramString;
}
public void setId(String paramString) {
this.id = paramString;
}
public void setTitle(String paramString) {
this.title = paramString;
}
public void setUpdatedAt(String paramString) {
this.updatedAt = paramString;
}
}
/* Location: C:\Users\牛\Desktop\isiyu_1.0.4-dex2jar.jar!\com\monter\tadpole\model\SplashAd.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 1.0.7
*/
|
UTF-8
|
Java
| 1,792 |
java
|
SplashAd.java
|
Java
|
[] | null |
[] |
package com.lyh.tools.entity;
import com.alibaba.fastjson.annotation.JSONField;
import java.io.Serializable;
public class SplashAd implements Serializable {
@JSONField(name = "ad_path")
private String adPath;
@JSONField(name = "created_at")
private String createdAt;
@JSONField(name = "deleted_at")
private String deletedAt;
private String href;
private String id;
private String title;
@JSONField(name = "updated_at")
private String updatedAt;
public String getAdPath() {
return this.adPath;
}
public String getCreatedAt() {
return this.createdAt;
}
public String getDeletedAt() {
return this.deletedAt;
}
public String getHref() {
return this.href;
}
public String getId() {
return this.id;
}
public String getTitle() {
return this.title;
}
public String getUpdatedAt() {
return this.updatedAt;
}
public void setAdPath(String paramString) {
this.adPath = paramString;
}
public void setCreatedAt(String paramString) {
this.createdAt = paramString;
}
public void setDeletedAt(String paramString) {
this.deletedAt = paramString;
}
public void setHref(String paramString) {
this.href = paramString;
}
public void setId(String paramString) {
this.id = paramString;
}
public void setTitle(String paramString) {
this.title = paramString;
}
public void setUpdatedAt(String paramString) {
this.updatedAt = paramString;
}
}
/* Location: C:\Users\牛\Desktop\isiyu_1.0.4-dex2jar.jar!\com\monter\tadpole\model\SplashAd.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 1.0.7
*/
| 1,792 | 0.631844 | 0.625698 | 87 | 19.574713 | 19.468 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.275862 | false | false |
5
|
bdafa90ae984d5466c452fb59061235b9d7c4f0c
| 35,785,667,515,358 |
f59f15d6e54a460db13e1e0b7321949f0a0f1ac7
|
/demdec-commons/src/main/java/it/almavivaitalia/bsn/sh/tagparser/StringTypeDecoder.java
|
55f87ca0726f454c6e7119a64f96297017a170c8
|
[] |
no_license
|
rnicchi/demDec
|
https://github.com/rnicchi/demDec
|
8f4198dcf4eb956c2dd3263bb25060a3c6d00048
|
353b8117952492e935bfcc1fb42a605601838c92
|
refs/heads/master
| 2020-03-07T14:12:34.387000 | 2018-04-01T21:12:43 | 2018-04-01T21:12:43 | 127,521,166 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package it.almavivaitalia.bsn.sh.tagparser;
import it.almavivaitalia.bsn.sh.tagparser.text.TextTypes;
import it.almavivaitalia.bsn.sh.tagparser.text.html.HtmlTextTypes;
import java.util.HashMap;
import java.util.Map;
public class StringTypeDecoder {
private Map<Type , Type> typeMap;
private StringBuffer sb;
private Parser parser;
private Type newLineDestination;
private StringConverter unescaper;
/*LOCM*/
@SuppressWarnings("unused") private static final long serialVersionLOCM = 0L;
@SuppressWarnings("unused") private static final long serialVersionLOCM2 = 1L;
@SuppressWarnings("unused") private static final long serialVersionLOCM3 = 2L;
@SuppressWarnings("unused") private static final long serialVersionLOCM4 = 0L;
@SuppressWarnings("unused") private static final long serialVersionLOCM5 = 1L;
@SuppressWarnings("unused") private static final long serialVersionLOCM6 = 2L;
@SuppressWarnings("unused") private static final long serialVersionLOCM7 = 0L;
@SuppressWarnings("unused") private static final long serialVersionLOCM8 = 1L;
@SuppressWarnings("unused") private static final long serialVersionLOCM9 = 2L;
/*END LOCM*/
public StringTypeDecoder() {
super();
this.parser=new Parser(null);
this.typeMap=new HashMap<Type , Type>();
this.typeMap.put(Types.TYPE_NONE, Types.TYPE_NONE);
}
public StringTypeDecoder(StringConverter unescaper) {
super();
this.parser=new Parser(null);
this.typeMap=new HashMap<Type , Type>();
this.typeMap.put(Types.TYPE_NONE, Types.TYPE_NONE);
this.unescaper=unescaper;
}
public void addMapping(Type source, Type destination){
parser.addType(source);
typeMap.put(source, destination);
}
public void setNewLineMapping(Type newLineSource, Type newLineDestination){
if ((newLineSource==null) || (newLineDestination==null)){
throw new RuntimeException("Null type for newLine are not allowed !!");
}
this.typeMap.put(newLineSource, newLineDestination);
parser.setNewLine(newLineSource);
this.newLineDestination=newLineDestination;
}
private void write(Element element) throws Throwable{
Type elementType = element.getType();
if (elementType.equals(parser.getNewLine())){
sb.append(newLineDestination.getMarkerStart());
}else {
Type type = typeMap.get(elementType);
if (type==null){
throw new Exception("type "+element.getType()+" not mapped !!");
}
sb.append(type.getMarkerStart());
if (element.size()==0){
if (unescaper!=null){
sb.append(unescaper.unescape(element.getText()));
}else {
sb.append(element.getText());
}
}else {
for(int i=0; i<element.size();i++){
write(element.getElementAt(i));
}
}
sb.append(type.getMarkerStop());
}
}
public String decode(String text) throws Throwable{
Element element = parser.parse(text);
sb=new StringBuffer();
write(element);
return sb.toString();
}
public static void main(String[] args){
try {
//String str = "<b><i>italic insi<br>de bold</i></b>normal<em><strong>bold inside italic</strong></em>normal<b>only bold</b><em>only italic</em>";
//Per eventuali prove la stringa da trasformare deve presentare i tag interni, ovvero quelli usati
//nella memorizzazione sul db
String str = "1)<bold-tt><em-tt>italic inside<nl-tt/>2) bold</em-tt></bold-tt>" +
"<p-tt>3)normal<em-tt><bold-tt>bold inside italic</bold-tt></em-tt></p-tt>normal<bold-tt>only bold</bold-tt><em-tt>only italic</em-tt>";
System.out.println(str);
StringTypeDecoder dec = new StringTypeDecoder();
/*
dec.addMapping(HtmlTextTypes.TYPE_BOLD, TextTypes.TYPE_BOLD);
dec.addMapping(HtmlTextTypes.TYPE_BOLD_1, TextTypes.TYPE_BOLD);
dec.addMapping(HtmlTextTypes.TYPE_ITALIC, TextTypes.TYPE_ITALIC);
dec.addMapping(HtmlTextTypes.TYPE_ITALIC_1, TextTypes.TYPE_ITALIC);
dec.addMapping(HtmlTextTypes.TYPE_PARAGRAPH, TextTypes.TYPE_PARAGRAPH);
dec.setNewLineMapping(HtmlTextTypes.TYPE_NEW_LINE, TextTypes.TYPE_NEW_LINE);
*/
dec.addMapping(TextTypes.TYPE_BOLD, HtmlTextTypes.TYPE_BOLD);
dec.addMapping(TextTypes.TYPE_ITALIC, HtmlTextTypes.TYPE_ITALIC);
dec.addMapping(TextTypes.TYPE_PARAGRAPH, HtmlTextTypes.TYPE_PARAGRAPH);
dec.setNewLineMapping(TextTypes.TYPE_NEW_LINE, HtmlTextTypes.TYPE_NEW_LINE);
String standard = dec.decode(str);
System.out.println(standard);
}catch (Throwable th) {
th.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 4,418 |
java
|
StringTypeDecoder.java
|
Java
|
[] | null |
[] |
package it.almavivaitalia.bsn.sh.tagparser;
import it.almavivaitalia.bsn.sh.tagparser.text.TextTypes;
import it.almavivaitalia.bsn.sh.tagparser.text.html.HtmlTextTypes;
import java.util.HashMap;
import java.util.Map;
public class StringTypeDecoder {
private Map<Type , Type> typeMap;
private StringBuffer sb;
private Parser parser;
private Type newLineDestination;
private StringConverter unescaper;
/*LOCM*/
@SuppressWarnings("unused") private static final long serialVersionLOCM = 0L;
@SuppressWarnings("unused") private static final long serialVersionLOCM2 = 1L;
@SuppressWarnings("unused") private static final long serialVersionLOCM3 = 2L;
@SuppressWarnings("unused") private static final long serialVersionLOCM4 = 0L;
@SuppressWarnings("unused") private static final long serialVersionLOCM5 = 1L;
@SuppressWarnings("unused") private static final long serialVersionLOCM6 = 2L;
@SuppressWarnings("unused") private static final long serialVersionLOCM7 = 0L;
@SuppressWarnings("unused") private static final long serialVersionLOCM8 = 1L;
@SuppressWarnings("unused") private static final long serialVersionLOCM9 = 2L;
/*END LOCM*/
public StringTypeDecoder() {
super();
this.parser=new Parser(null);
this.typeMap=new HashMap<Type , Type>();
this.typeMap.put(Types.TYPE_NONE, Types.TYPE_NONE);
}
public StringTypeDecoder(StringConverter unescaper) {
super();
this.parser=new Parser(null);
this.typeMap=new HashMap<Type , Type>();
this.typeMap.put(Types.TYPE_NONE, Types.TYPE_NONE);
this.unescaper=unescaper;
}
public void addMapping(Type source, Type destination){
parser.addType(source);
typeMap.put(source, destination);
}
public void setNewLineMapping(Type newLineSource, Type newLineDestination){
if ((newLineSource==null) || (newLineDestination==null)){
throw new RuntimeException("Null type for newLine are not allowed !!");
}
this.typeMap.put(newLineSource, newLineDestination);
parser.setNewLine(newLineSource);
this.newLineDestination=newLineDestination;
}
private void write(Element element) throws Throwable{
Type elementType = element.getType();
if (elementType.equals(parser.getNewLine())){
sb.append(newLineDestination.getMarkerStart());
}else {
Type type = typeMap.get(elementType);
if (type==null){
throw new Exception("type "+element.getType()+" not mapped !!");
}
sb.append(type.getMarkerStart());
if (element.size()==0){
if (unescaper!=null){
sb.append(unescaper.unescape(element.getText()));
}else {
sb.append(element.getText());
}
}else {
for(int i=0; i<element.size();i++){
write(element.getElementAt(i));
}
}
sb.append(type.getMarkerStop());
}
}
public String decode(String text) throws Throwable{
Element element = parser.parse(text);
sb=new StringBuffer();
write(element);
return sb.toString();
}
public static void main(String[] args){
try {
//String str = "<b><i>italic insi<br>de bold</i></b>normal<em><strong>bold inside italic</strong></em>normal<b>only bold</b><em>only italic</em>";
//Per eventuali prove la stringa da trasformare deve presentare i tag interni, ovvero quelli usati
//nella memorizzazione sul db
String str = "1)<bold-tt><em-tt>italic inside<nl-tt/>2) bold</em-tt></bold-tt>" +
"<p-tt>3)normal<em-tt><bold-tt>bold inside italic</bold-tt></em-tt></p-tt>normal<bold-tt>only bold</bold-tt><em-tt>only italic</em-tt>";
System.out.println(str);
StringTypeDecoder dec = new StringTypeDecoder();
/*
dec.addMapping(HtmlTextTypes.TYPE_BOLD, TextTypes.TYPE_BOLD);
dec.addMapping(HtmlTextTypes.TYPE_BOLD_1, TextTypes.TYPE_BOLD);
dec.addMapping(HtmlTextTypes.TYPE_ITALIC, TextTypes.TYPE_ITALIC);
dec.addMapping(HtmlTextTypes.TYPE_ITALIC_1, TextTypes.TYPE_ITALIC);
dec.addMapping(HtmlTextTypes.TYPE_PARAGRAPH, TextTypes.TYPE_PARAGRAPH);
dec.setNewLineMapping(HtmlTextTypes.TYPE_NEW_LINE, TextTypes.TYPE_NEW_LINE);
*/
dec.addMapping(TextTypes.TYPE_BOLD, HtmlTextTypes.TYPE_BOLD);
dec.addMapping(TextTypes.TYPE_ITALIC, HtmlTextTypes.TYPE_ITALIC);
dec.addMapping(TextTypes.TYPE_PARAGRAPH, HtmlTextTypes.TYPE_PARAGRAPH);
dec.setNewLineMapping(TextTypes.TYPE_NEW_LINE, HtmlTextTypes.TYPE_NEW_LINE);
String standard = dec.decode(str);
System.out.println(standard);
}catch (Throwable th) {
th.printStackTrace();
}
}
}
| 4,418 | 0.727479 | 0.722046 | 128 | 33.515625 | 30.845123 | 149 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.632813 | false | false |
5
|
53ce497038674e8605db425c42931496d0440b31
| 36,069,135,352,388 |
542a38c573a43a8c6f735ede299431a59fd11528
|
/Source/Source-Code/HangingProductStore/src/java/hps/servlet/ScheduleTaskServlet.java
|
498c0dc7e266c3772fb1c5a08bd988664e574cfd
|
[] |
no_license
|
tiendan3108/CP
|
https://github.com/tiendan3108/CP
|
525d5592d3afd87745096d80c1be286fd2073c56
|
42bffda3ee4608466ed6a88a519b3a67a180dc2b
|
refs/heads/master
| 2021-01-23T02:59:59.439000 | 2015-08-24T13:12:22 | 2015-08-24T13:12:22 | 35,491,435 | 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 hps.servlet;
import com.twilio.sdk.TwilioRestException;
import hps.dao.ConsignmentDAO;
import hps.dao.OrderDAO;
import hps.dao.ProductDAO;
import hps.dto.ConsignmentDTO;
import hps.dto.OrderDTO;
import hps.mobile.nofitication.AccountReceiveNofiticationDAO;
import hps.mobile.nofitication.AccountReceiveNotification;
import hps.ultils.JavaUltilities;
import hps.ultils.MessageString;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.List;
import java.util.Timer;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author HoangNHSE61007
*/
public class ScheduleTaskServlet extends HttpServlet implements ServletContextListener {
ScheduledExecutorService service;
@Override
public void contextInitialized(ServletContextEvent sce) {
// Runnable runnable = new Runnable() {
// public void run() {
// System.out.println("start task");
// remindConsignor();
// checkOrder();
// System.out.println("end task");
// }
// };
// service = Executors.newSingleThreadScheduledExecutor();
// service.scheduleAtFixedRate(runnable, 0, 10, TimeUnit.SECONDS);
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
service.shutdownNow();
try {
service.awaitTermination(10, TimeUnit.SECONDS);
} catch (InterruptedException ex) {
Logger.getLogger(ScheduleTaskServlet.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static Timer timer = new Timer(true);
@Override
public void init() {
Runnable runnable = new Runnable() {
@Override
public void run() {
//System.out.println("start task");
remindConsignor();
checkOrder();
sendNofitication();
//System.out.println("end task");
}
};
service = Executors.newSingleThreadScheduledExecutor();
service.scheduleAtFixedRate(runnable, 0, 10, TimeUnit.SECONDS);
//task();
}
@Override
public void destroy() {
service.shutdownNow();
try {
service.awaitTermination(10, TimeUnit.SECONDS);
} catch (InterruptedException ex) {
Logger.getLogger(ScheduleTaskServlet.class.getName()).log(Level.SEVERE, null, ex);
}
super.destroy();
}
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
}
}
// private void task() {
// TimerTask timerTask = new TimerTask() {
// @Override
// public void run() {
// System.out.println("start task");
// remindConsignor();
// checkOrder();
// System.out.println("end task");
// System.out.println(System.nanoTime()/1000);
// }
// };
// //Timer timer = new Timer();
// long delay = 0;
// long intevalPeriod = 10 * 1000;//10 seconds
// //schedules the task to be run in an interval
// timer.scheduleAtFixedRate(timerTask, delay, intevalPeriod);
//
// }
private void checkOrder() {
OrderDAO orderDao = OrderDAO.getInstance();
ProductDAO productDao = ProductDAO.getInstance();
List<OrderDTO> orders = orderDao.checkOrderExpired();
if (orders != null) {
if (orders.size() > 0) {
for (int i = 0; i < orders.size(); i++) {
OrderDTO order = orders.get(i);
orderDao.updateOrderWhenOrderExpired(order.getOrderID());
productDao.updateProductWhenOrderExpired(order.getProductID());
System.out.println("da update");
}
}
}
//System.out.println("12345566");
}
private void remindConsignor() {
ConsignmentDAO dao = ConsignmentDAO.getInstance();
JavaUltilities ulti = new JavaUltilities();
List<ConsignmentDTO> listConsignor = dao.remindConsignor();
if (listConsignor != null) {
if (!listConsignor.isEmpty()) {
for (ConsignmentDTO consignor : listConsignor) {
if (consignor.getPhone() != null && !consignor.getPhone().equals("")) {
String sms = "Mon hang voi ma ki gui " + consignor.getConsigmentID() + " cua ban da qua han ki "
+ "gui. Gia thoa thuan la " + (int) (consignor.getNegotiatedPrice() / 1000) + " ngan dong. Vui long lien he voi chu cua hang de nhan hang hoac gia han ki gui";
try {
ulti.sendSMS(sms, consignor.getPhone());
} catch (TwilioRestException ex) {
Logger.getLogger(ScheduleTaskServlet.class.getName()).log(Level.SEVERE, null, ex);
} catch (Exception e) {
Logger.getLogger(ScheduleTaskServlet.class.getName()).log(Level.SEVERE, null, e);
}
}
if (consignor.getEmail() != null && !consignor.getEmail().equals("")) {
String subject = "[HPS] Hết hạn kí gửi";
String email = "Xin chào " + consignor.getName() + "</br>Món hàng với mã kí gửi "
+ consignor.getConsigmentID() + " đã quá hạn kí gửi. Giá thỏa thuận của món hàng của bạn là " + (int) (consignor.getNegotiatedPrice() / 1000) + " ngàn đồng. Vui lòng liên hệ với chủ cửa hàng"
+ " để nhận hàng hoặc gia hạn kí gửi.</br> Trân trọng</br> HPS System";
ulti.sendEmail(consignor.getEmail(), subject, email);
}
System.out.println("Send dc 1 thang");
}
}
System.out.println("Tong cong co " + listConsignor.size() + " het han");
}
}
private void sendNofitication() {
AccountReceiveNofiticationDAO dao = new AccountReceiveNofiticationDAO();
JavaUltilities lib = new JavaUltilities();
List<AccountReceiveNotification> accounts = dao.getAccount();
Date date = new Date();
int hours = date.getHours();
int minutes = date.getMinutes();
int seconds = date.getSeconds();
if (hours == 6 && minutes == 0) {
for (int i = 1; i <= 9; i++) {
if (seconds == i) {
if (accounts != null) {
for (int j = 0; j < accounts.size(); j++) {
AccountReceiveNotification account = accounts.get(j);
int num = dao.getNumOfProduct(account.getAccountID());
lib.sendNofitiCation(MessageString.titleNofitication, MessageString.contenNofitication(num), account.getGcmID());
}
}
}
}
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
|
UTF-8
|
Java
| 9,764 |
java
|
ScheduleTaskServlet.java
|
Java
|
[
{
"context": "t.http.HttpServletResponse;\r\n\r\n/**\r\n *\r\n * @author HoangNHSE61007\r\n */\r\npublic class ScheduleTaskServlet extends Ht",
"end": 1226,
"score": 0.999683678150177,
"start": 1212,
"tag": "USERNAME",
"value": "HoangNHSE61007"
},
{
"context": "í gửi\";\r\n String email = \"Xin chào \" + consignor.getName() + \"</br>Món hàng với mã",
"end": 6613,
"score": 0.7059777975082397,
"start": 6608,
"tag": "NAME",
"value": "in ch"
}
] | 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 hps.servlet;
import com.twilio.sdk.TwilioRestException;
import hps.dao.ConsignmentDAO;
import hps.dao.OrderDAO;
import hps.dao.ProductDAO;
import hps.dto.ConsignmentDTO;
import hps.dto.OrderDTO;
import hps.mobile.nofitication.AccountReceiveNofiticationDAO;
import hps.mobile.nofitication.AccountReceiveNotification;
import hps.ultils.JavaUltilities;
import hps.ultils.MessageString;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.List;
import java.util.Timer;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author HoangNHSE61007
*/
public class ScheduleTaskServlet extends HttpServlet implements ServletContextListener {
ScheduledExecutorService service;
@Override
public void contextInitialized(ServletContextEvent sce) {
// Runnable runnable = new Runnable() {
// public void run() {
// System.out.println("start task");
// remindConsignor();
// checkOrder();
// System.out.println("end task");
// }
// };
// service = Executors.newSingleThreadScheduledExecutor();
// service.scheduleAtFixedRate(runnable, 0, 10, TimeUnit.SECONDS);
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
service.shutdownNow();
try {
service.awaitTermination(10, TimeUnit.SECONDS);
} catch (InterruptedException ex) {
Logger.getLogger(ScheduleTaskServlet.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static Timer timer = new Timer(true);
@Override
public void init() {
Runnable runnable = new Runnable() {
@Override
public void run() {
//System.out.println("start task");
remindConsignor();
checkOrder();
sendNofitication();
//System.out.println("end task");
}
};
service = Executors.newSingleThreadScheduledExecutor();
service.scheduleAtFixedRate(runnable, 0, 10, TimeUnit.SECONDS);
//task();
}
@Override
public void destroy() {
service.shutdownNow();
try {
service.awaitTermination(10, TimeUnit.SECONDS);
} catch (InterruptedException ex) {
Logger.getLogger(ScheduleTaskServlet.class.getName()).log(Level.SEVERE, null, ex);
}
super.destroy();
}
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
}
}
// private void task() {
// TimerTask timerTask = new TimerTask() {
// @Override
// public void run() {
// System.out.println("start task");
// remindConsignor();
// checkOrder();
// System.out.println("end task");
// System.out.println(System.nanoTime()/1000);
// }
// };
// //Timer timer = new Timer();
// long delay = 0;
// long intevalPeriod = 10 * 1000;//10 seconds
// //schedules the task to be run in an interval
// timer.scheduleAtFixedRate(timerTask, delay, intevalPeriod);
//
// }
private void checkOrder() {
OrderDAO orderDao = OrderDAO.getInstance();
ProductDAO productDao = ProductDAO.getInstance();
List<OrderDTO> orders = orderDao.checkOrderExpired();
if (orders != null) {
if (orders.size() > 0) {
for (int i = 0; i < orders.size(); i++) {
OrderDTO order = orders.get(i);
orderDao.updateOrderWhenOrderExpired(order.getOrderID());
productDao.updateProductWhenOrderExpired(order.getProductID());
System.out.println("da update");
}
}
}
//System.out.println("12345566");
}
private void remindConsignor() {
ConsignmentDAO dao = ConsignmentDAO.getInstance();
JavaUltilities ulti = new JavaUltilities();
List<ConsignmentDTO> listConsignor = dao.remindConsignor();
if (listConsignor != null) {
if (!listConsignor.isEmpty()) {
for (ConsignmentDTO consignor : listConsignor) {
if (consignor.getPhone() != null && !consignor.getPhone().equals("")) {
String sms = "Mon hang voi ma ki gui " + consignor.getConsigmentID() + " cua ban da qua han ki "
+ "gui. Gia thoa thuan la " + (int) (consignor.getNegotiatedPrice() / 1000) + " ngan dong. Vui long lien he voi chu cua hang de nhan hang hoac gia han ki gui";
try {
ulti.sendSMS(sms, consignor.getPhone());
} catch (TwilioRestException ex) {
Logger.getLogger(ScheduleTaskServlet.class.getName()).log(Level.SEVERE, null, ex);
} catch (Exception e) {
Logger.getLogger(ScheduleTaskServlet.class.getName()).log(Level.SEVERE, null, e);
}
}
if (consignor.getEmail() != null && !consignor.getEmail().equals("")) {
String subject = "[HPS] Hết hạn kí gửi";
String email = "X<NAME>ào " + consignor.getName() + "</br>Món hàng với mã kí gửi "
+ consignor.getConsigmentID() + " đã quá hạn kí gửi. Giá thỏa thuận của món hàng của bạn là " + (int) (consignor.getNegotiatedPrice() / 1000) + " ngàn đồng. Vui lòng liên hệ với chủ cửa hàng"
+ " để nhận hàng hoặc gia hạn kí gửi.</br> Trân trọng</br> HPS System";
ulti.sendEmail(consignor.getEmail(), subject, email);
}
System.out.println("Send dc 1 thang");
}
}
System.out.println("Tong cong co " + listConsignor.size() + " het han");
}
}
private void sendNofitication() {
AccountReceiveNofiticationDAO dao = new AccountReceiveNofiticationDAO();
JavaUltilities lib = new JavaUltilities();
List<AccountReceiveNotification> accounts = dao.getAccount();
Date date = new Date();
int hours = date.getHours();
int minutes = date.getMinutes();
int seconds = date.getSeconds();
if (hours == 6 && minutes == 0) {
for (int i = 1; i <= 9; i++) {
if (seconds == i) {
if (accounts != null) {
for (int j = 0; j < accounts.size(); j++) {
AccountReceiveNotification account = accounts.get(j);
int num = dao.getNumOfProduct(account.getAccountID());
lib.sendNofitiCation(MessageString.titleNofitication, MessageString.contenNofitication(num), account.getGcmID());
}
}
}
}
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| 9,765 | 0.576586 | 0.571119 | 244 | 37.733608 | 31.663425 | 223 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.561475 | false | false |
5
|
6d8eb2da387e1a238732aac4fa1d617b87618440
| 32,384,053,455,708 |
3206b44c9758b05aad5d8b13ca82f032f25398b3
|
/core-components/src/main/java/net/techreadiness/persistence/domain/RolePermissionDO.java
|
aaf3cdaf6ab800b8d3eb3890fb829e2d66a93a3c
|
[
"Apache-2.0"
] |
permissive
|
SmarterApp/TechnologyReadinessTool
|
https://github.com/SmarterApp/TechnologyReadinessTool
|
0bd9c7ffc008e307ebd2834aeed160c42de3b7db
|
9cac501050fe849be5348b6a45921ce5c3ae4e00
|
refs/heads/master
| 2020-12-24T14:35:39.754000 | 2020-06-24T22:22:14 | 2020-06-24T22:22:14 | 19,116,210 | 4 | 6 |
Apache-2.0
| false | 2020-06-24T22:21:31 | 2014-04-24T16:47:20 | 2020-06-24T22:20:48 | 2020-06-24T22:21:31 | 2,444 | 8 | 14 | 5 |
Java
| false | false |
package net.techreadiness.persistence.domain;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import net.techreadiness.persistence.AuditedBaseEntity;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* The persistent class for the role_permission database table.
*
*/
@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Table(name = "role_permission")
public class RolePermissionDO extends AuditedBaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "role_permission_id", unique = true, nullable = false)
private Long rolePermissionId;
// bi-directional many-to-one association to PermissionDO
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "permission_id", nullable = false)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private PermissionDO permission;
// bi-directional many-to-one association to RoleDO
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "role_id", nullable = false)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private RoleDO role;
public RolePermissionDO() {
}
public Long getRolePermissionId() {
return rolePermissionId;
}
public void setRolePermissionId(Long rolePermissionId) {
this.rolePermissionId = rolePermissionId;
}
public PermissionDO getPermission() {
return permission;
}
public void setPermission(PermissionDO permission) {
this.permission = permission;
}
public RoleDO getRole() {
return role;
}
public void setRole(RoleDO role) {
this.role = role;
}
}
|
UTF-8
|
Java
| 1,963 |
java
|
RolePermissionDO.java
|
Java
|
[] | null |
[] |
package net.techreadiness.persistence.domain;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import net.techreadiness.persistence.AuditedBaseEntity;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* The persistent class for the role_permission database table.
*
*/
@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Table(name = "role_permission")
public class RolePermissionDO extends AuditedBaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "role_permission_id", unique = true, nullable = false)
private Long rolePermissionId;
// bi-directional many-to-one association to PermissionDO
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "permission_id", nullable = false)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private PermissionDO permission;
// bi-directional many-to-one association to RoleDO
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "role_id", nullable = false)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
private RoleDO role;
public RolePermissionDO() {
}
public Long getRolePermissionId() {
return rolePermissionId;
}
public void setRolePermissionId(Long rolePermissionId) {
this.rolePermissionId = rolePermissionId;
}
public PermissionDO getPermission() {
return permission;
}
public void setPermission(PermissionDO permission) {
this.permission = permission;
}
public RoleDO getRole() {
return role;
}
public void setRole(RoleDO role) {
this.role = role;
}
}
| 1,963 | 0.786042 | 0.785532 | 74 | 25.540541 | 22.669893 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.932432 | false | false |
5
|
da682622d62d9a01b150be33aec6a2f2dd7a4f78
| 7,095,286,009,416 |
b30024661de52420ea4cb160350f7ccfc8ad7eec
|
/PRO-SMV-Admin/src/main/java/com/prosmv/domain/Role.java
|
cbd9e2c99d04cd4192c45861464ef1a59ee491fd
|
[] |
no_license
|
piyushdubeygithub/springSecurity
|
https://github.com/piyushdubeygithub/springSecurity
|
e5e059839b934cd8e07d84e88b44eace981ecc45
|
fae153308aebfaa5889cbab7c39c14c4b607021d
|
refs/heads/master
| 2020-04-28T21:03:19.514000 | 2019-06-23T03:54:39 | 2019-06-23T03:54:39 | 175,566,939 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.prosmv.domain;
import java.io.Serializable;
import java.sql.Timestamp;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
@Entity
public class Role implements Serializable {
/**
*
*/
private static final long serialVersionUID = -4771446373551377728L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String roleName;
@OneToOne
private User createdBy;
@OneToOne
private User updatedBy;
@ManyToOne
private Company company;
public Role(String roleName) {
this.roleName = roleName;
}
public Role() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((company == null) ? 0 : company.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((roleName == null) ? 0 : roleName.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Role other = (Role) obj;
if (company == null) {
if (other.company != null)
return false;
} else if (!company.equals(other.company))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (roleName == null) {
if (other.roleName != null)
return false;
} else if (!roleName.equals(other.roleName))
return false;
return true;
}
@Override
public String toString() {
return "Role [id=" + id + ", roleName=" + roleName + ", company=" + company + "]";
}
public User getCreatedBy() {
return createdBy;
}
public void setCreatedBy(User createdBy) {
this.createdBy = createdBy;
}
public User getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(User updatedBy) {
this.updatedBy = updatedBy;
}
}
|
UTF-8
|
Java
| 2,508 |
java
|
Role.java
|
Java
|
[] | null |
[] |
package com.prosmv.domain;
import java.io.Serializable;
import java.sql.Timestamp;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
@Entity
public class Role implements Serializable {
/**
*
*/
private static final long serialVersionUID = -4771446373551377728L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String roleName;
@OneToOne
private User createdBy;
@OneToOne
private User updatedBy;
@ManyToOne
private Company company;
public Role(String roleName) {
this.roleName = roleName;
}
public Role() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((company == null) ? 0 : company.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((roleName == null) ? 0 : roleName.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Role other = (Role) obj;
if (company == null) {
if (other.company != null)
return false;
} else if (!company.equals(other.company))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (roleName == null) {
if (other.roleName != null)
return false;
} else if (!roleName.equals(other.roleName))
return false;
return true;
}
@Override
public String toString() {
return "Role [id=" + id + ", roleName=" + roleName + ", company=" + company + "]";
}
public User getCreatedBy() {
return createdBy;
}
public void setCreatedBy(User createdBy) {
this.createdBy = createdBy;
}
public User getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(User updatedBy) {
this.updatedBy = updatedBy;
}
}
| 2,508 | 0.680223 | 0.670255 | 126 | 18.904762 | 17.686615 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.539683 | false | false |
5
|
64e2f066edc206315ac8a5de95e38f79466aabb8
| 38,843,684,250,755 |
fd166bf7c8de49624aa5307c3d315931888d0afb
|
/CoreJava/src/com/corejava/oopsConcepts/PassByValueTest.java
|
ca64b02b2ada2b6f8e8d006af36eb6943f1ab8ff
|
[] |
no_license
|
prorah/core-java
|
https://github.com/prorah/core-java
|
a046ebebdbd1bc43630e465c44860c19cf39851f
|
0f4f98a296bc0592c9f83f143306255d80d4af3b
|
refs/heads/master
| 2023-07-19T04:35:38.987000 | 2021-09-10T08:56:25 | 2021-09-10T08:56:25 | 282,232,826 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.corejava.oopsConcepts;
public class PassByValueTest {
public static void main(String[] args) {
Balloon red = new Balloon("red");
Balloon blue = new Balloon("blue");
System.out.println(red.hashCode());
swap(red, blue);
System.out.println("Red Object: " + red.getColor());
System.out.println("Blue Object: " + blue.getColor());
foo(blue);
System.out.println("Blue Object: " + blue.getColor());
}
public static void foo(Balloon o) {
// call to setter works on the object and therefore the state of object
// gets changed
o.setColor("red");
}
// Java is pass by value and therefore object state remains intact
public static void swap(Balloon o1, Balloon o2) {
System.out.println(o1.hashCode());
Balloon temp = o1;
System.out.println(temp.hashCode());
o1 = o2;
o2 = temp;
}
}
|
UTF-8
|
Java
| 829 |
java
|
PassByValueTest.java
|
Java
|
[] | null |
[] |
package com.corejava.oopsConcepts;
public class PassByValueTest {
public static void main(String[] args) {
Balloon red = new Balloon("red");
Balloon blue = new Balloon("blue");
System.out.println(red.hashCode());
swap(red, blue);
System.out.println("Red Object: " + red.getColor());
System.out.println("Blue Object: " + blue.getColor());
foo(blue);
System.out.println("Blue Object: " + blue.getColor());
}
public static void foo(Balloon o) {
// call to setter works on the object and therefore the state of object
// gets changed
o.setColor("red");
}
// Java is pass by value and therefore object state remains intact
public static void swap(Balloon o1, Balloon o2) {
System.out.println(o1.hashCode());
Balloon temp = o1;
System.out.println(temp.hashCode());
o1 = o2;
o2 = temp;
}
}
| 829 | 0.681544 | 0.6731 | 33 | 24.121212 | 21.91963 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.69697 | false | false |
5
|
2b40aa2d66f6c4e19fddfaa6a7f1de7f875ffdf6
| 4,509,715,699,345 |
b88014711fff9a87c818b604c68e2ca589007fdb
|
/royal-cart-springboot/src/main/java/com/moamarkets/utils/MT4Utils.java
|
50aa6781884a277fad2e1e7a598dc7c2fda29768
|
[] |
no_license
|
sihuo-hu/zst
|
https://github.com/sihuo-hu/zst
|
ca9a8d2f70d71d5f518cc5e34004b06f3e29d107
|
7d9d130aa32a7e70ef80067863499ec8a8482ecd
|
refs/heads/master
| 2022-10-26T12:46:47.318000 | 2019-11-22T00:49:11 | 2019-11-22T00:49:11 | 216,949,763 | 0 | 0 | null | false | 2022-10-12T20:32:55 | 2019-10-23T02:22:24 | 2019-11-22T00:49:27 | 2022-10-12T20:32:54 | 1,429 | 0 | 0 | 10 |
Java
| false | false |
//package com.moamarkets.utils;
//
//import java.text.SimpleDateFormat;
//import java.util.Date;
//
//import com.coderallen.mt4.CManagerFactory;
//import com.coderallen.mt4.CManagerInterface;
//import com.coderallen.mt4.ChartInfo;
//import com.coderallen.mt4.MarginLevel;
//import com.coderallen.mt4.RateInfo;
//import com.coderallen.mt4.SWIGTYPE_p_int;
//import com.coderallen.mt4.SWIGTYPE_p_time_t;
//import com.coderallen.mt4.SymbolInfo;
//import com.coderallen.mt4.TradeRecord;
//import com.coderallen.mt4.TradeTransInfo;
//import com.coderallen.mt4.UserRecord;
//import com.coderallen.mt4.XMT4Manager;
//import com.coderallen.mt4.XMT4ManagerConstants;
//import com.moamarkets.common.Constants;
//
///**
// * 写成静态类后在大并发情况下出现MT4拒连情况
// * Created by Allen on 27/05/2017.
// * coder.allen@hotmail.com
// */
//
//public class MT4Utils {
// public CManagerFactory cfactory;
// public CManagerInterface cManagerInterface;
//
// private String ip;
// private int login;
// private String password;
//
// static {
//// System.loadLibrary("mtmanapi64");
//// System.loadLibrary("mt4_connector");
// System.load("C:\\SERVER\\ROOT\\dlls\\mtmanapi64.dll");
// System.load("C:\\SERVER\\ROOT\\dlls\\mt4_connector.dll");
// }
//
//
// public MT4Utils(String ip,int login,String password) throws Exception{
// this.ip = ip;
// this.login = login;
// this.password = password;
//
// this.cfactory = new CManagerFactory();
// this.cManagerInterface = this.cfactory.Create(cfactory.Version());
// connect();//连接
// login();//登陆
//
// }
//
//
// public boolean connect() throws Exception{
// int connResult = cManagerInterface.Connect(ip);
// if(connResult == XMT4ManagerConstants.RET_OK){
// return true;
// }else {
// throw new Exception(cManagerInterface.ErrorDescription(connResult));
// }
// }
//
// public boolean disConnect() throws Exception{
// int connResult = cManagerInterface.Disconnect();
// if(connResult == XMT4ManagerConstants.RET_OK){
// return true;
// }else {
// throw new Exception(cManagerInterface.ErrorDescription(connResult));
// }
// }
//
// public boolean isConnected() throws Exception{
// if (cManagerInterface.IsConnected() == 1){
// return true;
// }
// return false;
// }
//
// public void disConnected() throws Exception{
// if (cManagerInterface.Disconnect() == 1){
//
// }
// }
//
// public boolean login() throws Exception{
// int loginResult = cManagerInterface.Login(login,password);
// if(loginResult == XMT4ManagerConstants.RET_OK){
// return true;
// }else {
// throw new Exception(cManagerInterface.ErrorDescription(loginResult));
// }
// }
//
// /**
// * 获取用户资料
// * @param username
// * @return
// * @throws Exception
// */
// public UserRecord getUserRecordbyUsername(int username) throws Exception{
// SWIGTYPE_p_int logins = XMT4Manager.new_intp();
// XMT4Manager.intp_assign(logins,username);
// SWIGTYPE_p_int total = XMT4Manager.new_intp();
// XMT4Manager.intp_assign(total,1);
// UserRecord result = cManagerInterface.UserRecordsRequest(logins,total);
// XMT4Manager.delete_intp(logins);
// XMT4Manager.delete_intp(total);
// return result;
// }
//
// /**
// * 获取用户扩展属性如余额可用保证金等
// * @param username
// * @return
// * @throws Exception
// */
// public MarginLevel getMarginLevelbyUsername(int username) throws Exception{
// MarginLevel ml = new MarginLevel();
// cManagerInterface.MarginLevelRequest(username,ml);
//
// return ml;
// }
//
//
//
// /**
// * 修改密码
// * @param username
// * @param password
// * @param type
// * @return
// * @throws Exception
// */
// public boolean changePassword(int username,String password,String type) throws Exception {
// int changeResult = cManagerInterface.UserPasswordSet(username,password,type.equals("MASTER") ? 0 : 1,0);
// if(changeResult == XMT4ManagerConstants.RET_OK){
// return true;
// }else {
// throw new Exception(cManagerInterface.ErrorDescription(changeResult));
// }
// }
//
// /**
// * 检查密码
// * @param username
// * @param password
// * @return
// * @throws Exception
// */
// public boolean checkPassword(int username,String password) throws Exception{
// int checkResult = cManagerInterface.UserPasswordCheck(username,password);
// if (checkResult == XMT4ManagerConstants.RET_OK){
// return true;
// }else{
// return false;
// }
// }
//
// /**
// * 执行交易
// * @param tradeTransInfo
// * @return
// * @throws Exception
// */
// public boolean doTrade(TradeTransInfo tradeTransInfo) throws Exception{
// int tradeResult = cManagerInterface.TradeTransaction(tradeTransInfo);
//
// if(tradeResult == XMT4ManagerConstants.RET_OK){
// return true;
// }else {
// throw new Exception(cManagerInterface.ErrorDescription(tradeResult));
// }
// }
//
// /**
// * 获取订单记录
// * @param ticket
// * @return
// * @throws Exception
// */
// public TradeRecord getOrder(int ticket) throws Exception{
// SWIGTYPE_p_int ticketN = XMT4Manager.new_intp();
// XMT4Manager.intp_assign(ticketN,ticket);
// SWIGTYPE_p_int total = XMT4Manager.new_intp();
// XMT4Manager.intp_assign(total,1);
//
// TradeRecord tradeResult = cManagerInterface.TradeRecordsRequest(ticketN,total);
//
// if(tradeResult != null){
// return tradeResult;
// }else {
// throw new Exception("Could not find that TradeRecord");
// }
// }
//
// /**
// * 创建MT4账户
// * @param ur
// * @return
// * @throws Exception
// */
// public boolean createAccount(UserRecord ur) throws Exception {
// int newResult = cManagerInterface.UserRecordNew(ur);
// if (newResult == XMT4ManagerConstants.RET_OK){
// return true;
// }else {
// throw new Exception(cManagerInterface.ErrorDescription(newResult));
// }
// }
//
// /**
// * 更新MT4账户资料
// * @param ur
// * @return
// * @throws Exception
// */
// public boolean updateAccount(UserRecord ur) throws Exception {
// int newResult = cManagerInterface.UserRecordUpdate(ur);
// if (newResult == XMT4ManagerConstants.RET_OK){
// return true;
// }else {
// throw new Exception(cManagerInterface.ErrorDescription(newResult));
// }
// }
//
// /**
// * 获得历史报价
// * @param startTime
// * @param endTime
// * @param period
// * @param symbol
// * @return
// */
// public RateInfo getRateHistory(Date startTime,Date endTime,int period,String symbol) throws Exception {
//
// SWIGTYPE_p_int total = XMT4Manager.new_intp();
// XMT4Manager.intp_assign(total,999);
// //TODO 需要根据时间和间隔刻度计算有多少条-total
// SWIGTYPE_p_time_t timesign = XMT4Manager.new_time_tp();
//
// ChartInfo ci = new ChartInfo();
// SWIGTYPE_p_time_t start = XMT4Manager.new_time_tp();//开始时间
// XMT4Manager.time_tp_assign(start,startTime.getTime() / 1000);
//
// SWIGTYPE_p_time_t end = XMT4Manager.new_time_tp();//结束时间
// XMT4Manager.time_tp_assign(end,endTime.getTime() / 1000);
//
// SWIGTYPE_p_time_t stamp = XMT4Manager.new_time_tp();
// XMT4Manager.time_tp_assign(stamp,0);//时间戳
//
// ci.setPeriod(period);//间隔单位
// ci.setStart(start);
// ci.setEnd(end);
// ci.setSymbol(symbol);//品种
// ci.setTimesign(stamp);
// ci.setMode(XMT4ManagerConstants.CHART_RANGE_LAST);
//
// RateInfo rateResult = cManagerInterface.ChartRequest(ci, timesign, total);
//
// if(rateResult != null){
// return rateResult;
// }else {
// throw new Exception("Could not find that RateResult");
// }
// }
//
//
// public TradeRecord getOpeningOrders(String group) throws Exception {
//
// SWIGTYPE_p_int total = XMT4Manager.new_intp();
// XMT4Manager.intp_assign(total,9999);
// TradeRecord tradeResult = cManagerInterface.AdmTradesRequest(group, 1, total);
//
// if(tradeResult != null){
// return tradeResult;
// }else {
// throw new Exception("Could not find that TradeResult");
// }
// }
//
// /**
// * 获得历史交易记录
// * @param startTime
// * @param endTime
// * @param login
// * @return
// * @throws Exception
// */
// public TradeRecord getTradeHistory(Date startTime,Date endTime,int login) throws Exception {
//
// SWIGTYPE_p_int total = XMT4Manager.new_intp();
// XMT4Manager.intp_assign(total,999);
//
// SWIGTYPE_p_time_t start = XMT4Manager.new_time_tp();//开始时间
// XMT4Manager.time_tp_assign(start,startTime.getTime() / 1000);
//
// SWIGTYPE_p_time_t end = XMT4Manager.new_time_tp();//结束时间
// XMT4Manager.time_tp_assign(end,endTime.getTime() / 1000);
//
// SWIGTYPE_p_time_t stamp = XMT4Manager.new_time_tp();
// XMT4Manager.time_tp_assign(stamp,0);//时间戳
//
// TradeRecord tradeResult = cManagerInterface.TradesUserHistory(login, start, end, total);
//
// if(tradeResult != null){
// return tradeResult;
// }else {
// throw new Exception("Could not find that RateResult");
// }
// }
//
//
// /**
// * 根据品种名称获取品种信息
// * @param symbol
// * @return
// * @throws Exception
// */
// public SymbolInfo getSymbolInfo(String symbol) throws Exception{
// SymbolInfo symbolInfo = new SymbolInfo();
// cManagerInterface.SymbolInfoGet(symbol, symbolInfo);
//
// if(symbolInfo != null){
// return symbolInfo;
// }else {
// throw new Exception("Could not find that SymbolInfo");
// }
// }
//
//
//
//
// public void memFree(Object obj){
// //TODO 需要传递要C++释放内存的指针
// cManagerInterface.MemFree(null);
// }
//
//}
|
UTF-8
|
Java
| 10,538 |
java
|
MT4Utils.java
|
Java
|
[
{
"context": "\n///**\n// * 写成静态类后在大并发情况下出现MT4拒连情况\n// * Created by Allen on 27/05/2017.\n// * coder.allen@hotmail.com\n// */",
"end": 757,
"score": 0.999775230884552,
"start": 752,
"tag": "NAME",
"value": "Allen"
},
{
"context": "现MT4拒连情况\n// * Created by Allen on 27/05/2017.\n// * coder.allen@hotmail.com\n// */\n//\n//public class MT4Utils {\n// public C",
"end": 801,
"score": 0.9999229907989502,
"start": 778,
"tag": "EMAIL",
"value": "coder.allen@hotmail.com"
},
{
"context": " = ip;\n//\t\tthis.login = login;\n//\t\tthis.password = password;\n//\n//\t\tthis.cfactory = new CManagerFactory();\n//",
"end": 1408,
"score": 0.9989488124847412,
"start": 1400,
"tag": "PASSWORD",
"value": "password"
}
] | null |
[] |
//package com.moamarkets.utils;
//
//import java.text.SimpleDateFormat;
//import java.util.Date;
//
//import com.coderallen.mt4.CManagerFactory;
//import com.coderallen.mt4.CManagerInterface;
//import com.coderallen.mt4.ChartInfo;
//import com.coderallen.mt4.MarginLevel;
//import com.coderallen.mt4.RateInfo;
//import com.coderallen.mt4.SWIGTYPE_p_int;
//import com.coderallen.mt4.SWIGTYPE_p_time_t;
//import com.coderallen.mt4.SymbolInfo;
//import com.coderallen.mt4.TradeRecord;
//import com.coderallen.mt4.TradeTransInfo;
//import com.coderallen.mt4.UserRecord;
//import com.coderallen.mt4.XMT4Manager;
//import com.coderallen.mt4.XMT4ManagerConstants;
//import com.moamarkets.common.Constants;
//
///**
// * 写成静态类后在大并发情况下出现MT4拒连情况
// * Created by Allen on 27/05/2017.
// * <EMAIL>
// */
//
//public class MT4Utils {
// public CManagerFactory cfactory;
// public CManagerInterface cManagerInterface;
//
// private String ip;
// private int login;
// private String password;
//
// static {
//// System.loadLibrary("mtmanapi64");
//// System.loadLibrary("mt4_connector");
// System.load("C:\\SERVER\\ROOT\\dlls\\mtmanapi64.dll");
// System.load("C:\\SERVER\\ROOT\\dlls\\mt4_connector.dll");
// }
//
//
// public MT4Utils(String ip,int login,String password) throws Exception{
// this.ip = ip;
// this.login = login;
// this.password = <PASSWORD>;
//
// this.cfactory = new CManagerFactory();
// this.cManagerInterface = this.cfactory.Create(cfactory.Version());
// connect();//连接
// login();//登陆
//
// }
//
//
// public boolean connect() throws Exception{
// int connResult = cManagerInterface.Connect(ip);
// if(connResult == XMT4ManagerConstants.RET_OK){
// return true;
// }else {
// throw new Exception(cManagerInterface.ErrorDescription(connResult));
// }
// }
//
// public boolean disConnect() throws Exception{
// int connResult = cManagerInterface.Disconnect();
// if(connResult == XMT4ManagerConstants.RET_OK){
// return true;
// }else {
// throw new Exception(cManagerInterface.ErrorDescription(connResult));
// }
// }
//
// public boolean isConnected() throws Exception{
// if (cManagerInterface.IsConnected() == 1){
// return true;
// }
// return false;
// }
//
// public void disConnected() throws Exception{
// if (cManagerInterface.Disconnect() == 1){
//
// }
// }
//
// public boolean login() throws Exception{
// int loginResult = cManagerInterface.Login(login,password);
// if(loginResult == XMT4ManagerConstants.RET_OK){
// return true;
// }else {
// throw new Exception(cManagerInterface.ErrorDescription(loginResult));
// }
// }
//
// /**
// * 获取用户资料
// * @param username
// * @return
// * @throws Exception
// */
// public UserRecord getUserRecordbyUsername(int username) throws Exception{
// SWIGTYPE_p_int logins = XMT4Manager.new_intp();
// XMT4Manager.intp_assign(logins,username);
// SWIGTYPE_p_int total = XMT4Manager.new_intp();
// XMT4Manager.intp_assign(total,1);
// UserRecord result = cManagerInterface.UserRecordsRequest(logins,total);
// XMT4Manager.delete_intp(logins);
// XMT4Manager.delete_intp(total);
// return result;
// }
//
// /**
// * 获取用户扩展属性如余额可用保证金等
// * @param username
// * @return
// * @throws Exception
// */
// public MarginLevel getMarginLevelbyUsername(int username) throws Exception{
// MarginLevel ml = new MarginLevel();
// cManagerInterface.MarginLevelRequest(username,ml);
//
// return ml;
// }
//
//
//
// /**
// * 修改密码
// * @param username
// * @param password
// * @param type
// * @return
// * @throws Exception
// */
// public boolean changePassword(int username,String password,String type) throws Exception {
// int changeResult = cManagerInterface.UserPasswordSet(username,password,type.equals("MASTER") ? 0 : 1,0);
// if(changeResult == XMT4ManagerConstants.RET_OK){
// return true;
// }else {
// throw new Exception(cManagerInterface.ErrorDescription(changeResult));
// }
// }
//
// /**
// * 检查密码
// * @param username
// * @param password
// * @return
// * @throws Exception
// */
// public boolean checkPassword(int username,String password) throws Exception{
// int checkResult = cManagerInterface.UserPasswordCheck(username,password);
// if (checkResult == XMT4ManagerConstants.RET_OK){
// return true;
// }else{
// return false;
// }
// }
//
// /**
// * 执行交易
// * @param tradeTransInfo
// * @return
// * @throws Exception
// */
// public boolean doTrade(TradeTransInfo tradeTransInfo) throws Exception{
// int tradeResult = cManagerInterface.TradeTransaction(tradeTransInfo);
//
// if(tradeResult == XMT4ManagerConstants.RET_OK){
// return true;
// }else {
// throw new Exception(cManagerInterface.ErrorDescription(tradeResult));
// }
// }
//
// /**
// * 获取订单记录
// * @param ticket
// * @return
// * @throws Exception
// */
// public TradeRecord getOrder(int ticket) throws Exception{
// SWIGTYPE_p_int ticketN = XMT4Manager.new_intp();
// XMT4Manager.intp_assign(ticketN,ticket);
// SWIGTYPE_p_int total = XMT4Manager.new_intp();
// XMT4Manager.intp_assign(total,1);
//
// TradeRecord tradeResult = cManagerInterface.TradeRecordsRequest(ticketN,total);
//
// if(tradeResult != null){
// return tradeResult;
// }else {
// throw new Exception("Could not find that TradeRecord");
// }
// }
//
// /**
// * 创建MT4账户
// * @param ur
// * @return
// * @throws Exception
// */
// public boolean createAccount(UserRecord ur) throws Exception {
// int newResult = cManagerInterface.UserRecordNew(ur);
// if (newResult == XMT4ManagerConstants.RET_OK){
// return true;
// }else {
// throw new Exception(cManagerInterface.ErrorDescription(newResult));
// }
// }
//
// /**
// * 更新MT4账户资料
// * @param ur
// * @return
// * @throws Exception
// */
// public boolean updateAccount(UserRecord ur) throws Exception {
// int newResult = cManagerInterface.UserRecordUpdate(ur);
// if (newResult == XMT4ManagerConstants.RET_OK){
// return true;
// }else {
// throw new Exception(cManagerInterface.ErrorDescription(newResult));
// }
// }
//
// /**
// * 获得历史报价
// * @param startTime
// * @param endTime
// * @param period
// * @param symbol
// * @return
// */
// public RateInfo getRateHistory(Date startTime,Date endTime,int period,String symbol) throws Exception {
//
// SWIGTYPE_p_int total = XMT4Manager.new_intp();
// XMT4Manager.intp_assign(total,999);
// //TODO 需要根据时间和间隔刻度计算有多少条-total
// SWIGTYPE_p_time_t timesign = XMT4Manager.new_time_tp();
//
// ChartInfo ci = new ChartInfo();
// SWIGTYPE_p_time_t start = XMT4Manager.new_time_tp();//开始时间
// XMT4Manager.time_tp_assign(start,startTime.getTime() / 1000);
//
// SWIGTYPE_p_time_t end = XMT4Manager.new_time_tp();//结束时间
// XMT4Manager.time_tp_assign(end,endTime.getTime() / 1000);
//
// SWIGTYPE_p_time_t stamp = XMT4Manager.new_time_tp();
// XMT4Manager.time_tp_assign(stamp,0);//时间戳
//
// ci.setPeriod(period);//间隔单位
// ci.setStart(start);
// ci.setEnd(end);
// ci.setSymbol(symbol);//品种
// ci.setTimesign(stamp);
// ci.setMode(XMT4ManagerConstants.CHART_RANGE_LAST);
//
// RateInfo rateResult = cManagerInterface.ChartRequest(ci, timesign, total);
//
// if(rateResult != null){
// return rateResult;
// }else {
// throw new Exception("Could not find that RateResult");
// }
// }
//
//
// public TradeRecord getOpeningOrders(String group) throws Exception {
//
// SWIGTYPE_p_int total = XMT4Manager.new_intp();
// XMT4Manager.intp_assign(total,9999);
// TradeRecord tradeResult = cManagerInterface.AdmTradesRequest(group, 1, total);
//
// if(tradeResult != null){
// return tradeResult;
// }else {
// throw new Exception("Could not find that TradeResult");
// }
// }
//
// /**
// * 获得历史交易记录
// * @param startTime
// * @param endTime
// * @param login
// * @return
// * @throws Exception
// */
// public TradeRecord getTradeHistory(Date startTime,Date endTime,int login) throws Exception {
//
// SWIGTYPE_p_int total = XMT4Manager.new_intp();
// XMT4Manager.intp_assign(total,999);
//
// SWIGTYPE_p_time_t start = XMT4Manager.new_time_tp();//开始时间
// XMT4Manager.time_tp_assign(start,startTime.getTime() / 1000);
//
// SWIGTYPE_p_time_t end = XMT4Manager.new_time_tp();//结束时间
// XMT4Manager.time_tp_assign(end,endTime.getTime() / 1000);
//
// SWIGTYPE_p_time_t stamp = XMT4Manager.new_time_tp();
// XMT4Manager.time_tp_assign(stamp,0);//时间戳
//
// TradeRecord tradeResult = cManagerInterface.TradesUserHistory(login, start, end, total);
//
// if(tradeResult != null){
// return tradeResult;
// }else {
// throw new Exception("Could not find that RateResult");
// }
// }
//
//
// /**
// * 根据品种名称获取品种信息
// * @param symbol
// * @return
// * @throws Exception
// */
// public SymbolInfo getSymbolInfo(String symbol) throws Exception{
// SymbolInfo symbolInfo = new SymbolInfo();
// cManagerInterface.SymbolInfoGet(symbol, symbolInfo);
//
// if(symbolInfo != null){
// return symbolInfo;
// }else {
// throw new Exception("Could not find that SymbolInfo");
// }
// }
//
//
//
//
// public void memFree(Object obj){
// //TODO 需要传递要C++释放内存的指针
// cManagerInterface.MemFree(null);
// }
//
//}
| 10,524 | 0.600352 | 0.589789 | 340 | 29.070589 | 25.192453 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
5
|
83d8ac55a5ea700904a40fd69ac4fc65ab566d2b
| 36,661,840,847,027 |
e455b112a11a44e17914f5177328b62c952a8fe3
|
/flood-base/src/main/java/cn/flood/base/mvc/version/VersionMappingAutoConfiguration.java
|
fe24c39fc865e98a9b94a6b876dd0a0d07a04305
|
[
"Apache-2.0"
] |
permissive
|
mmdai/flood-dependencies
|
https://github.com/mmdai/flood-dependencies
|
97035978179228efe740dc8712996a8b5188b51a
|
586fa0db96dcfdd7bbdec064922f213df3250d21
|
refs/heads/master
| 2023-09-02T00:47:29.496000 | 2023-08-01T03:26:23 | 2023-08-01T03:26:23 | 203,513,950 | 5 | 3 |
Apache-2.0
| false | 2023-03-01T09:04:21 | 2019-08-21T05:39:54 | 2022-12-14T23:04:22 | 2023-03-01T09:04:20 | 82,967 | 3 | 2 | 1 |
Java
| false | false |
/**
* Copyright (c) 2018-2028,
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* 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 cn.flood.base.mvc.version;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
import org.springframework.context.annotation.Bean;
/**
* url版本号处理
*
* 参考:https://gitee.com/lianqu1990/spring-boot-starter-version-mapping
*
* @author mmdai
*/
@AutoConfiguration
@ConditionalOnWebApplication
public class VersionMappingAutoConfiguration {
@Bean
public WebMvcRegistrations floodWebMvcRegistrations() {
return new FloodWebMvcRegistrations();
}
}
|
UTF-8
|
Java
| 1,244 |
java
|
VersionMappingAutoConfiguration.java
|
Java
|
[
{
"context": "Bean;\n\n/**\n * url版本号处理\n *\n * 参考:https://gitee.com/lianqu1990/spring-boot-starter-version-mapping\n *\n * @author",
"end": 956,
"score": 0.9995570182800293,
"start": 946,
"tag": "USERNAME",
"value": "lianqu1990"
},
{
"context": "/spring-boot-starter-version-mapping\n *\n * @author mmdai\n */\n@AutoConfiguration\n@ConditionalOnWebApplicati",
"end": 1012,
"score": 0.9996158480644226,
"start": 1007,
"tag": "USERNAME",
"value": "mmdai"
}
] | null |
[] |
/**
* Copyright (c) 2018-2028,
* <p>
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0; you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* <p>
* http://www.gnu.org/licenses/lgpl.html
* <p>
* 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 cn.flood.base.mvc.version;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
import org.springframework.context.annotation.Bean;
/**
* url版本号处理
*
* 参考:https://gitee.com/lianqu1990/spring-boot-starter-version-mapping
*
* @author mmdai
*/
@AutoConfiguration
@ConditionalOnWebApplication
public class VersionMappingAutoConfiguration {
@Bean
public WebMvcRegistrations floodWebMvcRegistrations() {
return new FloodWebMvcRegistrations();
}
}
| 1,244 | 0.779316 | 0.767915 | 36 | 33.111111 | 34.100163 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.305556 | false | false |
5
|
7bf997b1e555becb48b004ddfc58905ef8fd9837
| 36,661,840,846,867 |
b02171e1683e4188a24a1248cfbee8844fc75d4c
|
/asyncflows-apt/src/main/java/org/asyncflows/apt/ProxyGenerator.java
|
ab4806c66c061c4a07ecec4ba06202b76729f0c8
|
[
"MIT"
] |
permissive
|
const/asyncflows
|
https://github.com/const/asyncflows
|
272617d29663e291000ec75cc7eafcd9d1af9989
|
02209793246acad19a17caa47a96e63ff419cecd
|
refs/heads/master
| 2022-06-21T10:23:59.244000 | 2022-05-08T10:35:28 | 2022-05-08T10:35:28 | 147,245,650 | 5 | 0 |
MIT
| false | 2022-06-20T22:48:43 | 2018-09-03T19:32:50 | 2022-05-08T10:37:54 | 2022-06-20T22:48:41 | 1,306 | 4 | 0 | 4 |
Java
| false | false |
/*
* Copyright (c) 2018-2020 Konstantin Plotnikov
*
* 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.asyncflows.apt;
import java.io.PrintWriter;
import java.util.Objects;
/**
* The generator for the proxy.
*/
@SuppressWarnings("squid:S1192")
public final class ProxyGenerator {
private static final String OBJECT = "java.lang.Object";
private static final String VAT = "org.asyncflows.core.vats.Vat";
private static final String IDENT = " ";
private final PrintWriter writer;
private final TypeAnalyser type;
private int identLevel;
private boolean lineStarted;
/**
* The constructor.
*
* @param writer the writer
* @param type the type
*/
public ProxyGenerator(PrintWriter writer, TypeAnalyser type) {
this.writer = writer;
this.type = type;
}
/**
* Generate proxy factory.
*/
public void generate() {
line("package " + type.getPackageName() + ";");
line();
line("/**");
line(" * The asynchronous proxy factory for {@link " + type.getInterfaceQName() + "}.");
line(" */");
line("@javax.annotation.processing.Generated(\"" + AsynchronousProxyProcessor.class.getName() + "\")");
write("public final class " + type.getFactoryName()
+ " implements java.util.function.BiFunction<" + VAT + ", " + OBJECT + ", " + OBJECT
+ ">, org.asyncflows.core.util.AsynchronousService"
).block(() -> {
line("public static final " + type.getFactoryName() + " INSTANCE = new " + type.getFactoryName() + "();");
line();
createProxyJDoc();
write("public static " + type.getProxyTypeParametersWithBounds() + " "
+ type.getInterfaceType() + " createProxy(" + VAT + " vat, "
+ type.getInterfaceType() + " service)").block(() -> {
line("return new " + type.getProxyName()
+ type.getProxyTypeParametersWithoutBounds() + "(vat, service);");
});
line();
createProxyJDoc();
write("public " + type.getProxyTypeParametersWithBounds() + " "
+ type.getInterfaceType() + " export(" + VAT + " vat, "
+ type.getInterfaceType() + " service)").block(() -> {
line("return createProxy(vat, service);");
});
line();
line("@Override");
line("@SuppressWarnings(\"unchecked\")");
write("public " + OBJECT + " apply(" + VAT + " vat, " + OBJECT + " service)").block(() -> {
line("return createProxy(vat, (" + type.getInterfaceQName() + ") service);");
});
line();
generateProxyClass();
});
}
public void createProxyJDoc() {
line("/**");
line(" * Create a proxy.");
line(" *");
line(" * @param vat the vat");
line(" * @param service the service to export");
for (String typeParameter : type.getTypeParameters()) {
line(" * @param <" + typeParameter + "> a type parameter");
}
line(" * @return the exported service");
line(" */");
}
private void generateProxyClass() {
final String typeParametersWithBounds = type.getProxyTypeParametersWithBounds();
line("@javax.annotation.processing.Generated(\"" + AsynchronousProxyProcessor.class.getName() + "\")");
write("private static final class " + type.getProxyName() + typeParametersWithBounds + " implements " + type.getInterfaceType()).block(() -> {
line("private final " + VAT + " vat;");
line("private final " + type.getInterfaceType() + " service;");
line();
write("private " + type.getProxyName() + "(final " + VAT + " vat, final "
+ type.getInterfaceType() + " service)").block(() -> {
line("java.util.Objects.requireNonNull(vat);");
line("java.util.Objects.requireNonNull(service);");
line("this.vat = vat;");
line("this.service = service;");
});
line();
line("@Override");
write("public int hashCode()").block(() ->
line("return System.identityHashCode(service);"));
line();
line("@Override");
write("public boolean equals(" + OBJECT + " o2)").block(() ->
line("return this == o2 "
+ "|| (o2 != null && o2.getClass() == getClass() && (("
+ type.getProxyName() + ")o2).service == this.service);"));
for (TypeAnalyser.MethodInfo method : type.getAllMethods()) {
line();
line("@Override");
write("public " + method.getSignature()).block(() -> {
if (method.isPromise()) {
line("return org.asyncflows.core.CoreFlows.aLater(this.vat, () -> this.service." + method.getInvoke() + ");");
} else if (method.isOneWay()) {
line("org.asyncflows.core.CoreFlows.aOneWay(this.vat, () -> this.service." + method.getInvoke() + ");");
} else {
line("throw new java.lang.UnsupportedOperationException();");
}
});
}
});
}
private ProxyGenerator write(Object value) {
if (!lineStarted) {
lineStarted = true;
for (int i = 0; i < identLevel; i++) {
writer.write(IDENT);
}
}
writer.write(Objects.toString(value));
return this;
}
private void line() {
writer.println();
lineStarted = false;
}
private void line(Object value) {
write(value).line();
}
private void block(Runnable block) {
start();
block.run();
end();
}
private void start() {
line(" {");
identLevel++;
}
private void end() {
identLevel--;
line("}");
}
}
|
UTF-8
|
Java
| 7,214 |
java
|
ProxyGenerator.java
|
Java
|
[
{
"context": "/*\n * Copyright (c) 2018-2020 Konstantin Plotnikov\n *\n * Permission is hereby granted, free of charg",
"end": 50,
"score": 0.9997081756591797,
"start": 30,
"tag": "NAME",
"value": "Konstantin Plotnikov"
}
] | null |
[] |
/*
* Copyright (c) 2018-2020 <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.asyncflows.apt;
import java.io.PrintWriter;
import java.util.Objects;
/**
* The generator for the proxy.
*/
@SuppressWarnings("squid:S1192")
public final class ProxyGenerator {
private static final String OBJECT = "java.lang.Object";
private static final String VAT = "org.asyncflows.core.vats.Vat";
private static final String IDENT = " ";
private final PrintWriter writer;
private final TypeAnalyser type;
private int identLevel;
private boolean lineStarted;
/**
* The constructor.
*
* @param writer the writer
* @param type the type
*/
public ProxyGenerator(PrintWriter writer, TypeAnalyser type) {
this.writer = writer;
this.type = type;
}
/**
* Generate proxy factory.
*/
public void generate() {
line("package " + type.getPackageName() + ";");
line();
line("/**");
line(" * The asynchronous proxy factory for {@link " + type.getInterfaceQName() + "}.");
line(" */");
line("@javax.annotation.processing.Generated(\"" + AsynchronousProxyProcessor.class.getName() + "\")");
write("public final class " + type.getFactoryName()
+ " implements java.util.function.BiFunction<" + VAT + ", " + OBJECT + ", " + OBJECT
+ ">, org.asyncflows.core.util.AsynchronousService"
).block(() -> {
line("public static final " + type.getFactoryName() + " INSTANCE = new " + type.getFactoryName() + "();");
line();
createProxyJDoc();
write("public static " + type.getProxyTypeParametersWithBounds() + " "
+ type.getInterfaceType() + " createProxy(" + VAT + " vat, "
+ type.getInterfaceType() + " service)").block(() -> {
line("return new " + type.getProxyName()
+ type.getProxyTypeParametersWithoutBounds() + "(vat, service);");
});
line();
createProxyJDoc();
write("public " + type.getProxyTypeParametersWithBounds() + " "
+ type.getInterfaceType() + " export(" + VAT + " vat, "
+ type.getInterfaceType() + " service)").block(() -> {
line("return createProxy(vat, service);");
});
line();
line("@Override");
line("@SuppressWarnings(\"unchecked\")");
write("public " + OBJECT + " apply(" + VAT + " vat, " + OBJECT + " service)").block(() -> {
line("return createProxy(vat, (" + type.getInterfaceQName() + ") service);");
});
line();
generateProxyClass();
});
}
public void createProxyJDoc() {
line("/**");
line(" * Create a proxy.");
line(" *");
line(" * @param vat the vat");
line(" * @param service the service to export");
for (String typeParameter : type.getTypeParameters()) {
line(" * @param <" + typeParameter + "> a type parameter");
}
line(" * @return the exported service");
line(" */");
}
private void generateProxyClass() {
final String typeParametersWithBounds = type.getProxyTypeParametersWithBounds();
line("@javax.annotation.processing.Generated(\"" + AsynchronousProxyProcessor.class.getName() + "\")");
write("private static final class " + type.getProxyName() + typeParametersWithBounds + " implements " + type.getInterfaceType()).block(() -> {
line("private final " + VAT + " vat;");
line("private final " + type.getInterfaceType() + " service;");
line();
write("private " + type.getProxyName() + "(final " + VAT + " vat, final "
+ type.getInterfaceType() + " service)").block(() -> {
line("java.util.Objects.requireNonNull(vat);");
line("java.util.Objects.requireNonNull(service);");
line("this.vat = vat;");
line("this.service = service;");
});
line();
line("@Override");
write("public int hashCode()").block(() ->
line("return System.identityHashCode(service);"));
line();
line("@Override");
write("public boolean equals(" + OBJECT + " o2)").block(() ->
line("return this == o2 "
+ "|| (o2 != null && o2.getClass() == getClass() && (("
+ type.getProxyName() + ")o2).service == this.service);"));
for (TypeAnalyser.MethodInfo method : type.getAllMethods()) {
line();
line("@Override");
write("public " + method.getSignature()).block(() -> {
if (method.isPromise()) {
line("return org.asyncflows.core.CoreFlows.aLater(this.vat, () -> this.service." + method.getInvoke() + ");");
} else if (method.isOneWay()) {
line("org.asyncflows.core.CoreFlows.aOneWay(this.vat, () -> this.service." + method.getInvoke() + ");");
} else {
line("throw new java.lang.UnsupportedOperationException();");
}
});
}
});
}
private ProxyGenerator write(Object value) {
if (!lineStarted) {
lineStarted = true;
for (int i = 0; i < identLevel; i++) {
writer.write(IDENT);
}
}
writer.write(Objects.toString(value));
return this;
}
private void line() {
writer.println();
lineStarted = false;
}
private void line(Object value) {
write(value).line();
}
private void block(Runnable block) {
start();
block.run();
end();
}
private void start() {
line(" {");
identLevel++;
}
private void end() {
identLevel--;
line("}");
}
}
| 7,200 | 0.547408 | 0.544913 | 184 | 38.20652 | 31.399092 | 150 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.733696 | false | false |
5
|
5f54c650b8462821726861410d68d5b4b26e4dfe
| 33,002,528,765,808 |
b2bfac7b91b2542228931c10c668ca2f67e86b51
|
/LostNetNoRootFirewall-Decompiled code/com/google/tagmanager/protobuf/Internal.java
|
41233ca90b1c58fe1cfe1c04f0f2fc436d23cfd3
|
[] |
no_license
|
abozanona/fbaAndroid
|
https://github.com/abozanona/fbaAndroid
|
b58be90fc94ceec5170d84133c1e8c4e2be8806f
|
f058eb0317df3e76fd283e285c4dd3dbc354aef5
|
refs/heads/master
| 2021-09-26T22:05:31.517000 | 2018-11-03T07:21:17 | 2018-11-03T07:21:17 | 108,681,428 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.google.tagmanager.protobuf;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.List;
public class Internal {
private static final int DEFAULT_BUFFER_SIZE = 4096;
public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
public static final ByteBuffer EMPTY_BYTE_BUFFER = ByteBuffer.wrap(EMPTY_BYTE_ARRAY);
public interface EnumLite {
int getNumber();
}
public interface EnumLiteMap {
EnumLite findValueByNumber(int i);
}
public static byte[] byteArrayDefaultValue(String str) {
try {
return str.getBytes("ISO-8859-1");
} catch (Throwable e) {
throw new IllegalStateException("Java VM does not support a standard character set.", e);
}
}
public static ByteBuffer byteBufferDefaultValue(String str) {
return ByteBuffer.wrap(byteArrayDefaultValue(str));
}
public static ByteString bytesDefaultValue(String str) {
try {
return ByteString.copyFrom(str.getBytes("ISO-8859-1"));
} catch (Throwable e) {
throw new IllegalStateException("Java VM does not support a standard character set.", e);
}
}
public static ByteBuffer copyByteBuffer(ByteBuffer byteBuffer) {
ByteBuffer duplicate = byteBuffer.duplicate();
duplicate.clear();
ByteBuffer allocate = ByteBuffer.allocate(duplicate.capacity());
allocate.put(duplicate);
allocate.clear();
return allocate;
}
public static boolean equals(List list, List list2) {
if (list.size() != list2.size()) {
return false;
}
for (int i = 0; i < list.size(); i++) {
if (!Arrays.equals((byte[]) list.get(i), (byte[]) list2.get(i))) {
return false;
}
}
return true;
}
public static boolean equalsByteBuffer(ByteBuffer byteBuffer, ByteBuffer byteBuffer2) {
return byteBuffer.capacity() != byteBuffer2.capacity() ? false : byteBuffer.duplicate().clear().equals(byteBuffer2.duplicate().clear());
}
public static boolean equalsByteBuffer(List list, List list2) {
if (list.size() != list2.size()) {
return false;
}
for (int i = 0; i < list.size(); i++) {
if (!equalsByteBuffer((ByteBuffer) list.get(i), (ByteBuffer) list2.get(i))) {
return false;
}
}
return true;
}
public static int hashBoolean(boolean z) {
return z ? 1231 : 1237;
}
public static int hashCode(List list) {
int i = 1;
for (byte[] hashCode : list) {
i = hashCode(hashCode) + (i * 31);
}
return i;
}
public static int hashCode(byte[] bArr) {
return C0239x.m1823a(bArr);
}
public static int hashCodeByteBuffer(ByteBuffer byteBuffer) {
int i = 4096;
if (byteBuffer.hasArray()) {
i = C0239x.m1822a(byteBuffer.capacity(), byteBuffer.array(), byteBuffer.arrayOffset(), byteBuffer.capacity());
return i == 0 ? 1 : i;
} else {
if (byteBuffer.capacity() <= 4096) {
i = byteBuffer.capacity();
}
byte[] bArr = new byte[i];
ByteBuffer duplicate = byteBuffer.duplicate();
duplicate.clear();
int capacity = byteBuffer.capacity();
while (duplicate.remaining() > 0) {
int remaining = duplicate.remaining() <= i ? duplicate.remaining() : i;
duplicate.get(bArr, 0, remaining);
capacity = C0239x.m1822a(capacity, bArr, 0, remaining);
}
return capacity != 0 ? capacity : 1;
}
}
public static int hashCodeByteBuffer(List list) {
int i = 1;
for (ByteBuffer hashCodeByteBuffer : list) {
i = hashCodeByteBuffer(hashCodeByteBuffer) + (i * 31);
}
return i;
}
public static int hashEnum(EnumLite enumLite) {
return enumLite.getNumber();
}
public static int hashEnumList(List list) {
int i = 1;
for (EnumLite hashEnum : list) {
i = hashEnum(hashEnum) + (i * 31);
}
return i;
}
public static int hashLong(long j) {
return (int) ((j >>> 32) ^ j);
}
static boolean isProto1Group(MessageLite messageLite) {
return (messageLite instanceof AbstractMutableMessageLite) && ((AbstractMutableMessageLite) messageLite).isProto1Group();
}
public static boolean isValidUtf8(ByteString byteString) {
return byteString.isValidUtf8();
}
public static boolean isValidUtf8(byte[] bArr) {
return aq.m1816a(bArr);
}
public static MutableMessageLite mergeFrom(MutableMessageLite mutableMessageLite, CodedInputStream codedInputStream) {
if (mutableMessageLite.mergeFrom(codedInputStream)) {
return mutableMessageLite;
}
throw InvalidProtocolBufferException.parseFailure();
}
public static MutableMessageLite mergeFrom(MutableMessageLite mutableMessageLite, CodedInputStream codedInputStream, ExtensionRegistryLite extensionRegistryLite) {
if (mutableMessageLite.mergeFrom(codedInputStream, extensionRegistryLite)) {
return mutableMessageLite;
}
throw InvalidProtocolBufferException.parseFailure();
}
public static MutableMessageLite mergeFrom(MutableMessageLite mutableMessageLite, byte[] bArr) {
if (mutableMessageLite.mergeFrom(bArr)) {
return mutableMessageLite;
}
throw InvalidProtocolBufferException.parseFailure();
}
public static String stringDefaultValue(String str) {
try {
return new String(str.getBytes("ISO-8859-1"), "UTF-8");
} catch (Throwable e) {
throw new IllegalStateException("Java VM does not support a standard character set.", e);
}
}
public static byte[] toByteArray(String str) {
try {
return str.getBytes("UTF-8");
} catch (Throwable e) {
throw new RuntimeException("UTF-8 not supported?", e);
}
}
public static String toStringUtf8(byte[] bArr) {
try {
return new String(bArr, "UTF-8");
} catch (Throwable e) {
throw new RuntimeException("UTF-8 not supported?", e);
}
}
}
|
UTF-8
|
Java
| 6,442 |
java
|
Internal.java
|
Java
|
[] | null |
[] |
package com.google.tagmanager.protobuf;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.List;
public class Internal {
private static final int DEFAULT_BUFFER_SIZE = 4096;
public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
public static final ByteBuffer EMPTY_BYTE_BUFFER = ByteBuffer.wrap(EMPTY_BYTE_ARRAY);
public interface EnumLite {
int getNumber();
}
public interface EnumLiteMap {
EnumLite findValueByNumber(int i);
}
public static byte[] byteArrayDefaultValue(String str) {
try {
return str.getBytes("ISO-8859-1");
} catch (Throwable e) {
throw new IllegalStateException("Java VM does not support a standard character set.", e);
}
}
public static ByteBuffer byteBufferDefaultValue(String str) {
return ByteBuffer.wrap(byteArrayDefaultValue(str));
}
public static ByteString bytesDefaultValue(String str) {
try {
return ByteString.copyFrom(str.getBytes("ISO-8859-1"));
} catch (Throwable e) {
throw new IllegalStateException("Java VM does not support a standard character set.", e);
}
}
public static ByteBuffer copyByteBuffer(ByteBuffer byteBuffer) {
ByteBuffer duplicate = byteBuffer.duplicate();
duplicate.clear();
ByteBuffer allocate = ByteBuffer.allocate(duplicate.capacity());
allocate.put(duplicate);
allocate.clear();
return allocate;
}
public static boolean equals(List list, List list2) {
if (list.size() != list2.size()) {
return false;
}
for (int i = 0; i < list.size(); i++) {
if (!Arrays.equals((byte[]) list.get(i), (byte[]) list2.get(i))) {
return false;
}
}
return true;
}
public static boolean equalsByteBuffer(ByteBuffer byteBuffer, ByteBuffer byteBuffer2) {
return byteBuffer.capacity() != byteBuffer2.capacity() ? false : byteBuffer.duplicate().clear().equals(byteBuffer2.duplicate().clear());
}
public static boolean equalsByteBuffer(List list, List list2) {
if (list.size() != list2.size()) {
return false;
}
for (int i = 0; i < list.size(); i++) {
if (!equalsByteBuffer((ByteBuffer) list.get(i), (ByteBuffer) list2.get(i))) {
return false;
}
}
return true;
}
public static int hashBoolean(boolean z) {
return z ? 1231 : 1237;
}
public static int hashCode(List list) {
int i = 1;
for (byte[] hashCode : list) {
i = hashCode(hashCode) + (i * 31);
}
return i;
}
public static int hashCode(byte[] bArr) {
return C0239x.m1823a(bArr);
}
public static int hashCodeByteBuffer(ByteBuffer byteBuffer) {
int i = 4096;
if (byteBuffer.hasArray()) {
i = C0239x.m1822a(byteBuffer.capacity(), byteBuffer.array(), byteBuffer.arrayOffset(), byteBuffer.capacity());
return i == 0 ? 1 : i;
} else {
if (byteBuffer.capacity() <= 4096) {
i = byteBuffer.capacity();
}
byte[] bArr = new byte[i];
ByteBuffer duplicate = byteBuffer.duplicate();
duplicate.clear();
int capacity = byteBuffer.capacity();
while (duplicate.remaining() > 0) {
int remaining = duplicate.remaining() <= i ? duplicate.remaining() : i;
duplicate.get(bArr, 0, remaining);
capacity = C0239x.m1822a(capacity, bArr, 0, remaining);
}
return capacity != 0 ? capacity : 1;
}
}
public static int hashCodeByteBuffer(List list) {
int i = 1;
for (ByteBuffer hashCodeByteBuffer : list) {
i = hashCodeByteBuffer(hashCodeByteBuffer) + (i * 31);
}
return i;
}
public static int hashEnum(EnumLite enumLite) {
return enumLite.getNumber();
}
public static int hashEnumList(List list) {
int i = 1;
for (EnumLite hashEnum : list) {
i = hashEnum(hashEnum) + (i * 31);
}
return i;
}
public static int hashLong(long j) {
return (int) ((j >>> 32) ^ j);
}
static boolean isProto1Group(MessageLite messageLite) {
return (messageLite instanceof AbstractMutableMessageLite) && ((AbstractMutableMessageLite) messageLite).isProto1Group();
}
public static boolean isValidUtf8(ByteString byteString) {
return byteString.isValidUtf8();
}
public static boolean isValidUtf8(byte[] bArr) {
return aq.m1816a(bArr);
}
public static MutableMessageLite mergeFrom(MutableMessageLite mutableMessageLite, CodedInputStream codedInputStream) {
if (mutableMessageLite.mergeFrom(codedInputStream)) {
return mutableMessageLite;
}
throw InvalidProtocolBufferException.parseFailure();
}
public static MutableMessageLite mergeFrom(MutableMessageLite mutableMessageLite, CodedInputStream codedInputStream, ExtensionRegistryLite extensionRegistryLite) {
if (mutableMessageLite.mergeFrom(codedInputStream, extensionRegistryLite)) {
return mutableMessageLite;
}
throw InvalidProtocolBufferException.parseFailure();
}
public static MutableMessageLite mergeFrom(MutableMessageLite mutableMessageLite, byte[] bArr) {
if (mutableMessageLite.mergeFrom(bArr)) {
return mutableMessageLite;
}
throw InvalidProtocolBufferException.parseFailure();
}
public static String stringDefaultValue(String str) {
try {
return new String(str.getBytes("ISO-8859-1"), "UTF-8");
} catch (Throwable e) {
throw new IllegalStateException("Java VM does not support a standard character set.", e);
}
}
public static byte[] toByteArray(String str) {
try {
return str.getBytes("UTF-8");
} catch (Throwable e) {
throw new RuntimeException("UTF-8 not supported?", e);
}
}
public static String toStringUtf8(byte[] bArr) {
try {
return new String(bArr, "UTF-8");
} catch (Throwable e) {
throw new RuntimeException("UTF-8 not supported?", e);
}
}
}
| 6,442 | 0.603539 | 0.587395 | 195 | 32.035896 | 31.013706 | 167 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.492308 | false | false |
5
|
b02444202b14de2840ebbe82eaa6239a8433e5e8
| 37,915,971,303,240 |
03979a2141da33a7005bf622ff3b3f39aa58d3da
|
/app/src/main/java/com/apprikot/mathurat/controller/utils/ViewUtils.java
|
94ac5527e0681b1be55ca2fcc181e8141ca1dd36
|
[] |
no_license
|
asrulhadi/Al-Mathurat
|
https://github.com/asrulhadi/Al-Mathurat
|
1885e7b71b90d9bfdb4ff1207634747a70d02a10
|
899c3912ef58dc824095cb0b32e084f0756e4e66
|
refs/heads/master
| 2021-05-27T04:30:57.996000 | 2017-09-05T08:36:16 | 2017-09-05T08:36:16 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.apprikot.mathurat.controller.utils;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v4.app.Fragment;
import android.util.TypedValue;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
import com.apprikot.mathurat.R;
public class ViewUtils {
public static void hideKeyboard(EditText... editTexts) {
for (EditText editText : editTexts) {
if (editText == null) {
continue;
}
editText.clearFocus();
InputMethodManager imm = (InputMethodManager) editText.getContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
}
}
public static void showKeyboard(EditText editText) {
if (editText == null) {
return;
}
editText.requestFocus();
InputMethodManager imm = (InputMethodManager) editText.getContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.toggleSoftInputFromWindow(editText.getApplicationWindowToken(), InputMethodManager.SHOW_FORCED, 0);
}
public static void setConditioned(TextView textView, String text, boolean isValid) {
if (isValid) {
textView.setVisibility(View.VISIBLE);
textView.setText(text);
} else {
textView.setVisibility(View.GONE);
}
}
public static void setWithDefault(TextView textView, String text, String defaultText) {
boolean isValid = text != null && !text.trim().isEmpty();
textView.setText(isValid ? text : defaultText);
}
public static int getFullImageWidth(Context context, boolean hasMargins) {
int screenWidth = DimenUtils.getScreenSize(context).x;
int dimenRedId = hasMargins ? R.dimen.margin8 : R.dimen.margin4;
int margins = (int) (context.getResources().getDimension(dimenRedId) * 2);
return screenWidth - margins;
}
/***
* Colorizing Result
***/
private static final int RED = 0, GREEN = 1, BLUE = 2, GRAY = 3;
public static int[] colors;
/***
* New-Instance
***/
public static final String EXTRA_PARCELABLE = "PARCELABLE";
public static final String EXTRA_LONG = "INTEGER";
public static final String EXTRA_LIST_PARCELABLE = "LIST_PARCELABLE";
public static final String EXTRA_AD = "AD";
public static Fragment newInstance(Class fragmentClass, Parcelable parcelable) {
try {
Fragment fragment = (Fragment) fragmentClass.newInstance();
Bundle data = new Bundle();
data.putParcelable(EXTRA_PARCELABLE, parcelable);
fragment.setArguments(data);
return fragment;
} catch (Exception e) {
e.printStackTrace();
}
return new Fragment();
}
// public static Fragment newInstance(Class fragmentClass, Parcelable parcelable, AdRequestEntity adRequestEntity) {
// try {
// Fragment fragment = (Fragment) fragmentClass.newInstance();
// Bundle data = new Bundle();
// data.putParcelable(EXTRA_PARCELABLE, parcelable);
// if (adRequestEntity != null) {
// data.putSerializable(EXTRA_AD, adRequestEntity);
// }
// fragment.setArguments(data);
// return fragment;
// } catch (Exception e) {
// e.printStackTrace();
// }
// return new Fragment();
// }
public static Fragment newInstance(Class fragmentClass, long extraLong) {
try {
Fragment fragment = (Fragment) fragmentClass.newInstance();
Bundle data = new Bundle();
data.putLong(EXTRA_LONG, extraLong);
fragment.setArguments(data);
return fragment;
} catch (Exception e) {
e.printStackTrace();
}
return new Fragment();
}
public static Fragment newInstance(Class fragmentClass, Parcelable parcelable, long extraLong) {
try {
Fragment fragment = (Fragment) fragmentClass.newInstance();
Bundle data = new Bundle();
data.putParcelable(EXTRA_PARCELABLE, parcelable);
data.putLong(EXTRA_LONG, extraLong);
fragment.setArguments(data);
return fragment;
} catch (Exception e) {
e.printStackTrace();
}
return new Fragment();
}
/***
* Tool-Bar
***/
public static int toolbarHeight = -1;
public static int getToolbarHeight(Activity activity) {
if (activity == null) return -1;
if (toolbarHeight == -1) {
TypedValue tv = new TypedValue();
if (activity.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
toolbarHeight = TypedValue.complexToDimensionPixelSize(tv.data, activity.getResources().getDisplayMetrics());
}
}
return toolbarHeight;
}
}
|
UTF-8
|
Java
| 5,141 |
java
|
ViewUtils.java
|
Java
|
[] | null |
[] |
package com.apprikot.mathurat.controller.utils;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v4.app.Fragment;
import android.util.TypedValue;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
import com.apprikot.mathurat.R;
public class ViewUtils {
public static void hideKeyboard(EditText... editTexts) {
for (EditText editText : editTexts) {
if (editText == null) {
continue;
}
editText.clearFocus();
InputMethodManager imm = (InputMethodManager) editText.getContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
}
}
public static void showKeyboard(EditText editText) {
if (editText == null) {
return;
}
editText.requestFocus();
InputMethodManager imm = (InputMethodManager) editText.getContext().getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.toggleSoftInputFromWindow(editText.getApplicationWindowToken(), InputMethodManager.SHOW_FORCED, 0);
}
public static void setConditioned(TextView textView, String text, boolean isValid) {
if (isValid) {
textView.setVisibility(View.VISIBLE);
textView.setText(text);
} else {
textView.setVisibility(View.GONE);
}
}
public static void setWithDefault(TextView textView, String text, String defaultText) {
boolean isValid = text != null && !text.trim().isEmpty();
textView.setText(isValid ? text : defaultText);
}
public static int getFullImageWidth(Context context, boolean hasMargins) {
int screenWidth = DimenUtils.getScreenSize(context).x;
int dimenRedId = hasMargins ? R.dimen.margin8 : R.dimen.margin4;
int margins = (int) (context.getResources().getDimension(dimenRedId) * 2);
return screenWidth - margins;
}
/***
* Colorizing Result
***/
private static final int RED = 0, GREEN = 1, BLUE = 2, GRAY = 3;
public static int[] colors;
/***
* New-Instance
***/
public static final String EXTRA_PARCELABLE = "PARCELABLE";
public static final String EXTRA_LONG = "INTEGER";
public static final String EXTRA_LIST_PARCELABLE = "LIST_PARCELABLE";
public static final String EXTRA_AD = "AD";
public static Fragment newInstance(Class fragmentClass, Parcelable parcelable) {
try {
Fragment fragment = (Fragment) fragmentClass.newInstance();
Bundle data = new Bundle();
data.putParcelable(EXTRA_PARCELABLE, parcelable);
fragment.setArguments(data);
return fragment;
} catch (Exception e) {
e.printStackTrace();
}
return new Fragment();
}
// public static Fragment newInstance(Class fragmentClass, Parcelable parcelable, AdRequestEntity adRequestEntity) {
// try {
// Fragment fragment = (Fragment) fragmentClass.newInstance();
// Bundle data = new Bundle();
// data.putParcelable(EXTRA_PARCELABLE, parcelable);
// if (adRequestEntity != null) {
// data.putSerializable(EXTRA_AD, adRequestEntity);
// }
// fragment.setArguments(data);
// return fragment;
// } catch (Exception e) {
// e.printStackTrace();
// }
// return new Fragment();
// }
public static Fragment newInstance(Class fragmentClass, long extraLong) {
try {
Fragment fragment = (Fragment) fragmentClass.newInstance();
Bundle data = new Bundle();
data.putLong(EXTRA_LONG, extraLong);
fragment.setArguments(data);
return fragment;
} catch (Exception e) {
e.printStackTrace();
}
return new Fragment();
}
public static Fragment newInstance(Class fragmentClass, Parcelable parcelable, long extraLong) {
try {
Fragment fragment = (Fragment) fragmentClass.newInstance();
Bundle data = new Bundle();
data.putParcelable(EXTRA_PARCELABLE, parcelable);
data.putLong(EXTRA_LONG, extraLong);
fragment.setArguments(data);
return fragment;
} catch (Exception e) {
e.printStackTrace();
}
return new Fragment();
}
/***
* Tool-Bar
***/
public static int toolbarHeight = -1;
public static int getToolbarHeight(Activity activity) {
if (activity == null) return -1;
if (toolbarHeight == -1) {
TypedValue tv = new TypedValue();
if (activity.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
toolbarHeight = TypedValue.complexToDimensionPixelSize(tv.data, activity.getResources().getDisplayMetrics());
}
}
return toolbarHeight;
}
}
| 5,141 | 0.624976 | 0.622447 | 146 | 34.21233 | 29.486753 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.657534 | false | false |
5
|
9d01579c878d713e5d65e655bfbde2a49f5303a6
| 35,502,199,704,934 |
388d4ac61ff1a49120433ba6e521223cbeeed8dc
|
/src/main/java/com/m1kes/korath/storage/mysql/core/NITS_AsyncQuery.java
|
58ffb9768c965fca75056be9ecba75301782a1b2
|
[] |
no_license
|
M1kemclain247/Korath-NITS
|
https://github.com/M1kemclain247/Korath-NITS
|
310c8a9b47e353184d7f9a40e2e0fa3420e46c93
|
3538a8a777f7cd44589a34838b8619fe0830dd26
|
refs/heads/master
| 2020-03-20T13:18:36.156000 | 2018-06-15T07:01:12 | 2018-06-15T07:01:12 | 137,452,233 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.m1kes.korath.storage.mysql.core;
import com.m1kes.korath.storage.mysql.NITS_BaseMysql;
import com.m1kes.korath.storage.mysql.objects.NITS_BaseAsyncQuery;
import java.sql.SQLException;
public class NITS_AsyncQuery extends NITS_BaseAsyncQuery {
public NITS_AsyncQuery(NITS_BaseMysql mysql, String query) throws SQLException {
super(mysql, query);
}
public NITS_AsyncQuery(NITS_BaseMysql mysql, String query, int flag) throws SQLException {
super(mysql, query, flag);
}
public NITS_AsyncQuery(NITS_BaseMysql mysql, String query, String[] returnkeys) throws SQLException {
super(mysql, query, returnkeys);
}
}
|
UTF-8
|
Java
| 673 |
java
|
NITS_AsyncQuery.java
|
Java
|
[] | null |
[] |
package com.m1kes.korath.storage.mysql.core;
import com.m1kes.korath.storage.mysql.NITS_BaseMysql;
import com.m1kes.korath.storage.mysql.objects.NITS_BaseAsyncQuery;
import java.sql.SQLException;
public class NITS_AsyncQuery extends NITS_BaseAsyncQuery {
public NITS_AsyncQuery(NITS_BaseMysql mysql, String query) throws SQLException {
super(mysql, query);
}
public NITS_AsyncQuery(NITS_BaseMysql mysql, String query, int flag) throws SQLException {
super(mysql, query, flag);
}
public NITS_AsyncQuery(NITS_BaseMysql mysql, String query, String[] returnkeys) throws SQLException {
super(mysql, query, returnkeys);
}
}
| 673 | 0.738484 | 0.734027 | 22 | 29.59091 | 33.422447 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.772727 | false | false |
5
|
364c79456756c9d4100fbaf126f42fc9a08eddb0
| 11,948,599,069,871 |
7b12f67da8c10785efaebe313547a15543a39c77
|
/jjg-online/src/main/java/com/xdl/jjg/web/service/feign/shop/GoodsSkuQuantityService.java
|
4ae18a6adc2d5794b13584aad9846b56effd2204
|
[] |
no_license
|
liujinguo1994/xdl-jjg
|
https://github.com/liujinguo1994/xdl-jjg
|
071eaa5a8fb566db6b47dbe046daf85dd2b9bcd8
|
051da0a0dba18e6e5021ecb4ef3debca16b01a93
|
refs/heads/master
| 2023-01-06T09:11:30.487000 | 2020-11-06T14:42:45 | 2020-11-06T14:42:45 | 299,525,315 | 1 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.xdl.jjg.web.service.feign.shop;
import com.jjg.shop.model.domain.EsGoodsSkuQuantityDO;
import com.jjg.shop.model.dto.EsGoodsSkuQuantityDTO;
import com.xdl.jjg.response.service.DubboResult;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@FeignClient(value = "jjg-shop")
public interface GoodsSkuQuantityService {
/**
* 库存增加
* @param quantityDTO 库存DTO
* @return
*/
@PostMapping("/insertGoodsSkuQuantity")
DubboResult<EsGoodsSkuQuantityDO> insertGoodsSkuQuantity(@RequestBody List<EsGoodsSkuQuantityDTO> quantityDTO);
/**
* 库存扣减
* @return
*/
@PostMapping("/reduceGoodsSkuQuantity")
DubboResult<EsGoodsSkuQuantityDO> reduceGoodsSkuQuantity(@RequestBody List<EsGoodsSkuQuantityDTO> quantityDTO);
@PostMapping("/reduceGoodsSkuQuantityRedis")
DubboResult<EsGoodsSkuQuantityDO> reduceGoodsSkuQuantityRedis(@RequestBody List<EsGoodsSkuQuantityDTO> quantityDTO);
}
|
UTF-8
|
Java
| 1,115 |
java
|
GoodsSkuQuantityService.java
|
Java
|
[] | null |
[] |
package com.xdl.jjg.web.service.feign.shop;
import com.jjg.shop.model.domain.EsGoodsSkuQuantityDO;
import com.jjg.shop.model.dto.EsGoodsSkuQuantityDTO;
import com.xdl.jjg.response.service.DubboResult;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@FeignClient(value = "jjg-shop")
public interface GoodsSkuQuantityService {
/**
* 库存增加
* @param quantityDTO 库存DTO
* @return
*/
@PostMapping("/insertGoodsSkuQuantity")
DubboResult<EsGoodsSkuQuantityDO> insertGoodsSkuQuantity(@RequestBody List<EsGoodsSkuQuantityDTO> quantityDTO);
/**
* 库存扣减
* @return
*/
@PostMapping("/reduceGoodsSkuQuantity")
DubboResult<EsGoodsSkuQuantityDO> reduceGoodsSkuQuantity(@RequestBody List<EsGoodsSkuQuantityDTO> quantityDTO);
@PostMapping("/reduceGoodsSkuQuantityRedis")
DubboResult<EsGoodsSkuQuantityDO> reduceGoodsSkuQuantityRedis(@RequestBody List<EsGoodsSkuQuantityDTO> quantityDTO);
}
| 1,115 | 0.778995 | 0.778995 | 31 | 34.322582 | 33.89394 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.354839 | false | false |
5
|
40cf65338c9da881d023670148175e09a88fc73a
| 3,281,355,084,172 |
a3df8825cbdf7480ef2416e84f87e85c2b36696d
|
/app/src/main/java/com/example/test/presenter/shop/home/channel/ChannelPresenter.java
|
896403389fc8b5739ceaa5da4df325f4207b486b
|
[] |
no_license
|
zwx0519/Test
|
https://github.com/zwx0519/Test
|
e8bad1b68af1d846075d9f3a006978093db0cdb0
|
51b4f615766beae7f8f7d4acb4df5f1c3bc8831b
|
refs/heads/main
| 2023-02-13T18:34:19.811000 | 2021-01-05T14:02:29 | 2021-01-05T14:02:29 | 320,499,203 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.test.presenter.shop.home.channel;
import com.example.test.base.BasePresenter;
import com.example.test.model.api.Callback;
import com.example.test.model.bean.shop.home.channel.ChannelBean;
import com.example.test.model.bean.shop.home.channel.ChannelTypeBean;
import com.example.test.model.shop.home.channel.ChannelModel;
import com.example.test.view.shop.home.IHome;
import com.example.test.view.shop.home.channel.IChannel;
public class ChannelPresenter extends BasePresenter<IChannel.View> implements IChannel.Presenter {
IChannel.View view;
IChannel.BaseModel model;
public ChannelPresenter(IChannel.View view) {
this.view = view;
this.model=new ChannelModel();
}
@Override
public void getChannel(String id) {
if(view!=null){
this.model.getChannel(id,new Callback() {
@Override
public void fail(String msg) {
view.tips(msg);
}
@Override
public void success(Object o) {
view.getChannelReturn((ChannelBean) o);
}
});
}
}
@Override
public void getChannelType(String id) {
if(view!=null){
this.model.getChannelType(id, new Callback() {
@Override
public void fail(String msg) {
view.tips(msg);
}
@Override
public void success(Object o) {
view.getChannelTypeReturn((ChannelTypeBean) o);
}
});
}
}
}
|
UTF-8
|
Java
| 1,629 |
java
|
ChannelPresenter.java
|
Java
|
[] | null |
[] |
package com.example.test.presenter.shop.home.channel;
import com.example.test.base.BasePresenter;
import com.example.test.model.api.Callback;
import com.example.test.model.bean.shop.home.channel.ChannelBean;
import com.example.test.model.bean.shop.home.channel.ChannelTypeBean;
import com.example.test.model.shop.home.channel.ChannelModel;
import com.example.test.view.shop.home.IHome;
import com.example.test.view.shop.home.channel.IChannel;
public class ChannelPresenter extends BasePresenter<IChannel.View> implements IChannel.Presenter {
IChannel.View view;
IChannel.BaseModel model;
public ChannelPresenter(IChannel.View view) {
this.view = view;
this.model=new ChannelModel();
}
@Override
public void getChannel(String id) {
if(view!=null){
this.model.getChannel(id,new Callback() {
@Override
public void fail(String msg) {
view.tips(msg);
}
@Override
public void success(Object o) {
view.getChannelReturn((ChannelBean) o);
}
});
}
}
@Override
public void getChannelType(String id) {
if(view!=null){
this.model.getChannelType(id, new Callback() {
@Override
public void fail(String msg) {
view.tips(msg);
}
@Override
public void success(Object o) {
view.getChannelTypeReturn((ChannelTypeBean) o);
}
});
}
}
}
| 1,629 | 0.58318 | 0.58318 | 53 | 29.735849 | 22.699141 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.377358 | false | false |
5
|
43c72dd11dad92f53faffd0964b51b194cc0e4a7
| 31,456,340,497,728 |
fce2c48cfc5d6359d1e1d4ce4d7eebaf56cf750e
|
/subprojects/com.toedter.chatty.model/src/test/java/com/toedter/chatty/model/InMemoryChatMessageRepositoryTest.java
|
7334171acb522b2b7335da7ccee284b3c74b7256
|
[
"MIT"
] |
permissive
|
atiqueabbas/chatty
|
https://github.com/atiqueabbas/chatty
|
d0c312f2aedfd3414556f5a4bd6713086b86e77e
|
d4340587170f06ca269e219dc49efa03beaabe9c
|
refs/heads/master
| 2021-06-15T21:35:43.193000 | 2017-03-26T11:17:37 | 2017-03-26T11:17:37 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Copyright (c) 2016 Kai Toedter
* All rights reserved.
* Licensed under MIT License, see http://toedter.mit-license.org/
*/
package com.toedter.chatty.model;
import org.junit.Before;
import org.junit.Test;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.notNullValue;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class InMemoryChatMessageRepositoryTest {
private ChatMessageRepository chatMessageRepository;
private ChatMessage chatMessage1;
private ChatMessage chatMessage2;
private ChatMessage chatMessage3;
@Before
public void before() {
chatMessageRepository = new InMemoryChatMessageRepository();
}
@Test
public void should_create_InMemoryChatMessageRepository_with_default_constructor() {
assertThat(chatMessageRepository, notNullValue());
}
@Test
public void should_create_valid_chatMessage() {
// given
ChatMessage chatMessage = mock(ChatMessage.class);
given(chatMessage.getId()).willReturn(1L);
// when
chatMessageRepository.saveChatMessage(chatMessage);
// then
assertThat(chatMessageRepository.getChatMessageById(1L),is(chatMessage));
}
@Test(expected = IllegalArgumentException.class)
public void should_not_create_null_chatMessage() {
// given
// when
chatMessageRepository.saveChatMessage(null);
// then expect above exception
}
@Test(expected = IllegalArgumentException.class)
public void should_not_create_chatMessage_with_null_id() {
// given
ChatMessage chatMessage = mock(ChatMessage.class);
given(chatMessage.getId()).willReturn(0L);
// when
chatMessageRepository.saveChatMessage(chatMessage);
// then expect above exception
}
@Test(expected = IllegalArgumentException.class)
public void should_not_create_chatMessage_with_empty_id() {
// given
ChatMessage chatMessage = mock(ChatMessage.class);
given(chatMessage.getId()).willReturn(0L);
// when
chatMessageRepository.saveChatMessage(chatMessage);
// then expect above exception
}
@Test(expected = IllegalArgumentException.class)
public void should_not_create_chatMessage_with_existing_id() {
// given
ChatMessage chatMessage1 = mock(ChatMessage.class);
when(chatMessage1.getId()).thenReturn(1L);
chatMessageRepository.saveChatMessage(chatMessage1);
ChatMessage chatMessage2 = mock(ChatMessage.class);
when(chatMessage2.getId()).thenReturn(1L);
// when
chatMessageRepository.saveChatMessage(chatMessage2);
// then expect above exception
}
@Test(expected = IllegalArgumentException.class)
public void should_not_get_chatMessage_by_non_existing_id() {
// given
// when
chatMessageRepository.getChatMessageById(-1);
// then expect above exception
}
@Test(expected = IllegalArgumentException.class)
public void should_not_get_chatMessage_by_invalid_id() {
// given
// when
chatMessageRepository.getChatMessageById(0);
// then expect above exception
}
private void createThreeChatMessageMocks() {
chatMessage1 = mock(ChatMessage.class);
when(chatMessage1.getId()).thenReturn(1L);
chatMessageRepository.saveChatMessage(chatMessage1);
chatMessage2 = mock(ChatMessage.class);
when(chatMessage2.getId()).thenReturn(2L);
chatMessageRepository.saveChatMessage(chatMessage2);
chatMessage3 = mock(ChatMessage.class);
when(chatMessage3.getId()).thenReturn(3L);
chatMessageRepository.saveChatMessage(chatMessage3);
}
@Test
public void should_get_all_chatMessages() {
// given
createThreeChatMessageMocks();
// when
List<ChatMessage> chatMessages = chatMessageRepository.getAll();
// then expect above exception
assertThat(chatMessages, containsInAnyOrder(chatMessage1, chatMessage2, chatMessage3));
}
@Test
public void should_get_chatMessages_by_id() {
// given
createThreeChatMessageMocks();
// when
ChatMessage chatMessage3a = chatMessageRepository.getChatMessageById(3L);
ChatMessage chatMessage2a = chatMessageRepository.getChatMessageById(2L);
ChatMessage chatMessage1a = chatMessageRepository.getChatMessageById(1L);
// then expect above exception
assertThat(chatMessage1a, is(chatMessage1));
assertThat(chatMessage2a, is(chatMessage2));
assertThat(chatMessage3a, is(chatMessage3));
}
@Test
public void should_get_correct_size() {
// given
createThreeChatMessageMocks();
// when
long size = chatMessageRepository.getSize();
// then expect above exception
assertThat(size, is(3L));
}
@Test
public void should_delete_all_chatMessages() {
// given
createThreeChatMessageMocks();
// when
chatMessageRepository.deleteAll();
// then expect above exception
assertThat(chatMessageRepository.getSize(), is(0L));
}
@Test
public void should_delete_chatMessage_by_id() {
// given
createThreeChatMessageMocks();
// when
chatMessageRepository.deleteChatMessageById(2L);
// then
assertThat(chatMessageRepository.getAll(), containsInAnyOrder(chatMessage1, chatMessage3));
}
@Test(expected = IllegalArgumentException.class)
public void should_not_delete_chatMessage_with_non_existing_id() {
// given
createThreeChatMessageMocks();
// when
chatMessageRepository.deleteChatMessageById(5L);
// then expect above exception
}
}
|
UTF-8
|
Java
| 6,101 |
java
|
InMemoryChatMessageRepositoryTest.java
|
Java
|
[
{
"context": "/**\n * Copyright (c) 2016 Kai Toedter\n * All rights reserved.\n * Licensed under MIT Lic",
"end": 37,
"score": 0.9998672604560852,
"start": 26,
"tag": "NAME",
"value": "Kai Toedter"
}
] | null |
[] |
/**
* Copyright (c) 2016 <NAME>
* All rights reserved.
* Licensed under MIT License, see http://toedter.mit-license.org/
*/
package com.toedter.chatty.model;
import org.junit.Before;
import org.junit.Test;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.notNullValue;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class InMemoryChatMessageRepositoryTest {
private ChatMessageRepository chatMessageRepository;
private ChatMessage chatMessage1;
private ChatMessage chatMessage2;
private ChatMessage chatMessage3;
@Before
public void before() {
chatMessageRepository = new InMemoryChatMessageRepository();
}
@Test
public void should_create_InMemoryChatMessageRepository_with_default_constructor() {
assertThat(chatMessageRepository, notNullValue());
}
@Test
public void should_create_valid_chatMessage() {
// given
ChatMessage chatMessage = mock(ChatMessage.class);
given(chatMessage.getId()).willReturn(1L);
// when
chatMessageRepository.saveChatMessage(chatMessage);
// then
assertThat(chatMessageRepository.getChatMessageById(1L),is(chatMessage));
}
@Test(expected = IllegalArgumentException.class)
public void should_not_create_null_chatMessage() {
// given
// when
chatMessageRepository.saveChatMessage(null);
// then expect above exception
}
@Test(expected = IllegalArgumentException.class)
public void should_not_create_chatMessage_with_null_id() {
// given
ChatMessage chatMessage = mock(ChatMessage.class);
given(chatMessage.getId()).willReturn(0L);
// when
chatMessageRepository.saveChatMessage(chatMessage);
// then expect above exception
}
@Test(expected = IllegalArgumentException.class)
public void should_not_create_chatMessage_with_empty_id() {
// given
ChatMessage chatMessage = mock(ChatMessage.class);
given(chatMessage.getId()).willReturn(0L);
// when
chatMessageRepository.saveChatMessage(chatMessage);
// then expect above exception
}
@Test(expected = IllegalArgumentException.class)
public void should_not_create_chatMessage_with_existing_id() {
// given
ChatMessage chatMessage1 = mock(ChatMessage.class);
when(chatMessage1.getId()).thenReturn(1L);
chatMessageRepository.saveChatMessage(chatMessage1);
ChatMessage chatMessage2 = mock(ChatMessage.class);
when(chatMessage2.getId()).thenReturn(1L);
// when
chatMessageRepository.saveChatMessage(chatMessage2);
// then expect above exception
}
@Test(expected = IllegalArgumentException.class)
public void should_not_get_chatMessage_by_non_existing_id() {
// given
// when
chatMessageRepository.getChatMessageById(-1);
// then expect above exception
}
@Test(expected = IllegalArgumentException.class)
public void should_not_get_chatMessage_by_invalid_id() {
// given
// when
chatMessageRepository.getChatMessageById(0);
// then expect above exception
}
private void createThreeChatMessageMocks() {
chatMessage1 = mock(ChatMessage.class);
when(chatMessage1.getId()).thenReturn(1L);
chatMessageRepository.saveChatMessage(chatMessage1);
chatMessage2 = mock(ChatMessage.class);
when(chatMessage2.getId()).thenReturn(2L);
chatMessageRepository.saveChatMessage(chatMessage2);
chatMessage3 = mock(ChatMessage.class);
when(chatMessage3.getId()).thenReturn(3L);
chatMessageRepository.saveChatMessage(chatMessage3);
}
@Test
public void should_get_all_chatMessages() {
// given
createThreeChatMessageMocks();
// when
List<ChatMessage> chatMessages = chatMessageRepository.getAll();
// then expect above exception
assertThat(chatMessages, containsInAnyOrder(chatMessage1, chatMessage2, chatMessage3));
}
@Test
public void should_get_chatMessages_by_id() {
// given
createThreeChatMessageMocks();
// when
ChatMessage chatMessage3a = chatMessageRepository.getChatMessageById(3L);
ChatMessage chatMessage2a = chatMessageRepository.getChatMessageById(2L);
ChatMessage chatMessage1a = chatMessageRepository.getChatMessageById(1L);
// then expect above exception
assertThat(chatMessage1a, is(chatMessage1));
assertThat(chatMessage2a, is(chatMessage2));
assertThat(chatMessage3a, is(chatMessage3));
}
@Test
public void should_get_correct_size() {
// given
createThreeChatMessageMocks();
// when
long size = chatMessageRepository.getSize();
// then expect above exception
assertThat(size, is(3L));
}
@Test
public void should_delete_all_chatMessages() {
// given
createThreeChatMessageMocks();
// when
chatMessageRepository.deleteAll();
// then expect above exception
assertThat(chatMessageRepository.getSize(), is(0L));
}
@Test
public void should_delete_chatMessage_by_id() {
// given
createThreeChatMessageMocks();
// when
chatMessageRepository.deleteChatMessageById(2L);
// then
assertThat(chatMessageRepository.getAll(), containsInAnyOrder(chatMessage1, chatMessage3));
}
@Test(expected = IllegalArgumentException.class)
public void should_not_delete_chatMessage_with_non_existing_id() {
// given
createThreeChatMessageMocks();
// when
chatMessageRepository.deleteChatMessageById(5L);
// then expect above exception
}
}
| 6,096 | 0.677922 | 0.669071 | 208 | 28.33173 | 25.2078 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.379808 | false | false |
5
|
aae3d9d92a8cfc78ca342914ad40cb7b7d3c3b39
| 31,456,340,499,627 |
7566e69e7c56f4051d51069047b63387b1381596
|
/src/com/wojto/tests/calculations/StockPortoflioTest.java
|
b853ab838f98b8c209affa6cf54a6d42a90cc1d2
|
[] |
no_license
|
WojciechWarchol/stock-calculator-prototype
|
https://github.com/WojciechWarchol/stock-calculator-prototype
|
f85bfc5cdcde0e9efa88f2881e317bae7ab2ca93
|
5e60991d32f102bebc8d996388f0eecf7c80ce24
|
refs/heads/master
| 2023-03-19T14:27:00.690000 | 2021-03-21T06:36:30 | 2021-03-21T06:36:30 | 260,883,718 | 1 | 0 | null | false | 2020-05-16T08:51:56 | 2020-05-03T10:37:12 | 2020-05-16T07:37:43 | 2020-05-16T08:51:56 | 16 | 0 | 0 | 0 |
Java
| false | false |
package com.wojto.tests.calculations;
import com.wojto.calculations.StockPortoflio;
import com.wojto.importing.CsvFileImporter;
import com.wojto.importing.CsvFileTransactionParser;
import com.wojto.model.Stock;
import com.wojto.model.Transaction;
import com.wojto.model.TransactionType;
import org.junit.jupiter.api.BeforeAll;
import java.io.File;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
class StockPortoflioTest {
static private List<Transaction> transactionList = new ArrayList<>();
static private StockPortoflio stockPortoflio = new StockPortoflio();
static private Transaction additionalTransaction = new Transaction(LocalDateTime.now(), "STOCK3", "WWA-GPW", TransactionType.BUY, 1, new BigDecimal("10.0"), new BigDecimal("10.0"));
static private Stock STOCK3 = new Stock("STOCK3");
@BeforeAll
static void setUp() {
File file = new File(".\\resources\\Tests\\Test_Transactions_Portfolio.Csv");
CsvFileImporter fileImporter = new CsvFileImporter();
CsvFileTransactionParser transactionParser = new CsvFileTransactionParser();
List<String> transactionStringList = fileImporter.importTransactionsFromFile(file);
for (String transactionString : transactionStringList) {
transactionList.add(transactionParser.createTransactionFromString(transactionString));
}
for (Transaction transaction : transactionList) {
stockPortoflio.addTransaction(transaction);
}
STOCK3.addTransaction(additionalTransaction);
}
@org.junit.jupiter.api.Test
void addTransactionAndGetStockList() {
stockPortoflio.addTransaction(additionalTransaction);
assertEquals(3, stockPortoflio.getStockList().size());
}
@org.junit.jupiter.api.Test
void getStockFromSymbol() {
assertEquals(STOCK3, stockPortoflio.getStockFromSymbol("STOCK3"));
}
@org.junit.jupiter.api.Test
void getStockFromTransaction() {
assertEquals(STOCK3, stockPortoflio.getStockFromTransaction(additionalTransaction));
}
}
|
UTF-8
|
Java
| 2,191 |
java
|
StockPortoflioTest.java
|
Java
|
[] | null |
[] |
package com.wojto.tests.calculations;
import com.wojto.calculations.StockPortoflio;
import com.wojto.importing.CsvFileImporter;
import com.wojto.importing.CsvFileTransactionParser;
import com.wojto.model.Stock;
import com.wojto.model.Transaction;
import com.wojto.model.TransactionType;
import org.junit.jupiter.api.BeforeAll;
import java.io.File;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
class StockPortoflioTest {
static private List<Transaction> transactionList = new ArrayList<>();
static private StockPortoflio stockPortoflio = new StockPortoflio();
static private Transaction additionalTransaction = new Transaction(LocalDateTime.now(), "STOCK3", "WWA-GPW", TransactionType.BUY, 1, new BigDecimal("10.0"), new BigDecimal("10.0"));
static private Stock STOCK3 = new Stock("STOCK3");
@BeforeAll
static void setUp() {
File file = new File(".\\resources\\Tests\\Test_Transactions_Portfolio.Csv");
CsvFileImporter fileImporter = new CsvFileImporter();
CsvFileTransactionParser transactionParser = new CsvFileTransactionParser();
List<String> transactionStringList = fileImporter.importTransactionsFromFile(file);
for (String transactionString : transactionStringList) {
transactionList.add(transactionParser.createTransactionFromString(transactionString));
}
for (Transaction transaction : transactionList) {
stockPortoflio.addTransaction(transaction);
}
STOCK3.addTransaction(additionalTransaction);
}
@org.junit.jupiter.api.Test
void addTransactionAndGetStockList() {
stockPortoflio.addTransaction(additionalTransaction);
assertEquals(3, stockPortoflio.getStockList().size());
}
@org.junit.jupiter.api.Test
void getStockFromSymbol() {
assertEquals(STOCK3, stockPortoflio.getStockFromSymbol("STOCK3"));
}
@org.junit.jupiter.api.Test
void getStockFromTransaction() {
assertEquals(STOCK3, stockPortoflio.getStockFromTransaction(additionalTransaction));
}
}
| 2,191 | 0.746235 | 0.739388 | 58 | 36.793102 | 34.337452 | 185 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.655172 | false | false |
5
|
28392bcf9dba01812eb4963ff0cc42eceea15f7c
| 25,898,652,801,468 |
45a1217ef30be3dfbe158546c4de0368d35557b6
|
/spiralgroup/src/main/java/com/ethanco/spiralgroup/abs/ISpiralItem.java
|
87e04397fad081d1d0c04ec07009452b6d126b5b
|
[] |
no_license
|
EthanCo/SpiralGroup
|
https://github.com/EthanCo/SpiralGroup
|
d0da8c8aa901696ddc2724b747bacef445be0c62
|
70cc1d85084dd179ff325e872709998ee348a814
|
refs/heads/master
| 2020-07-29T00:50:04.821000 | 2017-01-11T09:43:40 | 2017-01-11T09:43:40 | 73,688,006 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ethanco.spiralgroup.abs;
import android.widget.Checkable;
/**
* @Description TODO
* Created by EthanCo on 2016/11/11.
*/
public interface ISpiralItem extends Checkable {
void addOnCheckedChangeListener(OnCheckedChangeListener onCheckedChangeListener);
}
|
UTF-8
|
Java
| 276 |
java
|
ISpiralItem.java
|
Java
|
[
{
"context": "Checkable;\n\n/**\n * @Description TODO\n * Created by EthanCo on 2016/11/11.\n */\n\npublic interface ISpiralItem ",
"end": 118,
"score": 0.9849109649658203,
"start": 111,
"tag": "USERNAME",
"value": "EthanCo"
}
] | null |
[] |
package com.ethanco.spiralgroup.abs;
import android.widget.Checkable;
/**
* @Description TODO
* Created by EthanCo on 2016/11/11.
*/
public interface ISpiralItem extends Checkable {
void addOnCheckedChangeListener(OnCheckedChangeListener onCheckedChangeListener);
}
| 276 | 0.789855 | 0.76087 | 12 | 22 | 25.423086 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false |
5
|
4523d2b94c79127c7fad0ce9b36a47cbd3dd37cd
| 2,327,872,295,158 |
9fb9ff7b21214e75b08d1e93315dc2cfb6b76e3f
|
/app/src/main/java/com/selectmakeathon/app/ui/auth/otp/OtpFragment.java
|
662f0eaf74608c3f462671cf068c3ea2b9ce27f8
|
[
"MIT"
] |
permissive
|
sanilch99/makeathon-2019
|
https://github.com/sanilch99/makeathon-2019
|
3bc4660be95aae8e1000b006e7b2769870fbd9e2
|
bd81aedb21053d7a720751fb2e0cddd8396dbfd3
|
refs/heads/master
| 2020-04-22T10:20:25.571000 | 2019-02-12T09:41:21 | 2019-02-12T09:41:21 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.selectmakeathon.app.ui.auth.otp;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.chaos.view.PinView;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.FirebaseException;
import com.google.firebase.FirebaseTooManyRequestsException;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseAuthInvalidCredentialsException;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.PhoneAuthCredential;
import com.google.firebase.auth.PhoneAuthProvider;
import com.selectmakeathon.app.R;
import com.selectmakeathon.app.ui.auth.AuthActivity;
import com.selectmakeathon.app.util.Constants;
import java.util.concurrent.TimeUnit;
public class OtpFragment extends Fragment {
private static final String TAG = "OTP-Fragment";
private FirebaseAuth mAuth;
String mVerificationId, phoneNumber, otpCode;
PhoneAuthProvider.ForceResendingToken mResendToken;
private Button nextButton, confirmButton;
private TextView phoneNumberTextLabel, otpTextLabel;
private PinView otpPinView;
private EditText phoneNumberEditText;
private View phoneNumberEditTextLayout;
SharedPreferences prefs;
SharedPreferences.Editor prefEditor;
public OtpFragment() {
// Required empty public constructor
}
// TODO: Rename and change types and number of parameters
public static OtpFragment newInstance() {
return new OtpFragment();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_otp, container, false);
nextButton = view.findViewById(R.id.auth_button_otp_next);
confirmButton = view.findViewById(R.id.btn_confirm_otp);
otpPinView = view.findViewById(R.id.pv_otp);
phoneNumberEditText = view.findViewById(R.id.et_phone_number);
phoneNumberTextLabel = view.findViewById(R.id.tv_phone_label);
otpTextLabel = view.findViewById(R.id.tv_otp_label);
phoneNumberEditTextLayout = view.findViewById(R.id.el_phone_number);
mAuth = FirebaseAuth.getInstance();
nextButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
phoneNumber = phoneNumberEditText.getText().toString();
phoneNumber = "+91" + phoneNumber;
verifyPhoneNnumberWithOtp(phoneNumber);
}
});
confirmButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
otpCode = otpPinView.getText().toString();
PhoneAuthCredential credential = PhoneAuthProvider.getCredential(mVerificationId, otpCode);
signInWithPhoneAuthCredential(credential);
} catch (NullPointerException e){
Toast.makeText(getContext(), "Please enter a Valid OTP", Toast.LENGTH_SHORT).show();
}
}
});
prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
prefEditor = prefs.edit();
return view;
}
void goToSignUp(){
((AuthActivity)getActivity()).updateFragment(AuthActivity.AuthFragment.SIGNUP);
}
void switchToOtp(){
nextButton.setVisibility(View.GONE);
phoneNumberTextLabel.setVisibility(View.GONE);
phoneNumberEditText.setVisibility(View.GONE);
phoneNumberEditTextLayout.setVisibility(View.GONE);
confirmButton.setVisibility(View.VISIBLE);
otpTextLabel.setVisibility(View.VISIBLE);
otpPinView.setVisibility(View.VISIBLE);
}
void verifyPhoneNnumberWithOtp(String phoneNumber){
PhoneAuthProvider.getInstance().verifyPhoneNumber(
phoneNumber, // Phone number to verify
60, // Timeout duration
TimeUnit.SECONDS, // Unit of timeout
getActivity(), // Activity (for callback binding)
new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
@Override
public void onVerificationCompleted(PhoneAuthCredential credential) {
// This callback will be invoked in two situations:
// 1 - Instant verification. In some cases the phone number can be instantly
// verified without needing to send or enter a verification code.
// 2 - Auto-retrieval. On some devices Google Play services can automatically
// detect the incoming verification SMS and perform verification without
// user action.
Log.d(TAG, "onVerificationCompleted:" + credential);
signInWithPhoneAuthCredential(credential);
}
@Override
public void onVerificationFailed(FirebaseException e) {
// This callback is invoked in an invalid request for verification is made,
// for instance if the the phone number format is not valid.
Log.w(TAG, "onVerificationFailed", e);
Toast.makeText(getContext(), "Please enter correct Phone Number", Toast.LENGTH_SHORT).show();
if (e instanceof FirebaseAuthInvalidCredentialsException) {
// Invalid request
// ...
} else if (e instanceof FirebaseTooManyRequestsException) {
// The SMS quota for the project has been exceeded
// ...
}
// Show a message and update the UI
// ...
}
@Override
public void onCodeSent(String verificationId,
PhoneAuthProvider.ForceResendingToken token) {
super.onCodeSent(verificationId, token);
Toast.makeText(getActivity(), "Code Sent, Waiting for Verification", Toast.LENGTH_SHORT).show();
// The SMS verification code has been sent to the provided phone number, we
// now need to ask the user to enter the code and then construct a credential
// by combining the code with a verification ID.
Log.d(TAG, "onCodeSent:" + verificationId);
switchToOtp();
// Save verification ID and resending token so we can use them later
mVerificationId = verificationId;
mResendToken = token;
// ...
}
}); // OnVerificationStateChangedCallbacks
}
private void signInWithPhoneAuthCredential(PhoneAuthCredential credential) {
mAuth.signInWithCredential(credential)
.addOnCompleteListener(getActivity(), new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d(TAG, "signInWithCredential:success");
FirebaseUser user = task.getResult().getUser();
proceedWithLogin();
// ...
} else {
// Sign in failed, display a message and update the UI
Log.w(TAG, "signInWithCredential:failure", task.getException());
if (task.getException() instanceof FirebaseAuthInvalidCredentialsException) {
// The verification code entered was invalid
Toast.makeText(getContext(), "The code doesn't match.\nPlease check the code again!", Toast.LENGTH_SHORT).show();
}
}
}
});
}
void proceedWithLogin(){
//Perform next sequence of actions
prefEditor.putString(Constants.PREF_PHONE_NUMBER, phoneNumber).commit();
Toast.makeText(getContext(), "Successfully Authenticated", Toast.LENGTH_SHORT).show();
((AuthActivity)getActivity()).updateFragment(AuthActivity.AuthFragment.SIGNUP);
}
}
|
UTF-8
|
Java
| 9,420 |
java
|
OtpFragment.java
|
Java
|
[] | null |
[] |
package com.selectmakeathon.app.ui.auth.otp;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.preference.PreferenceManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.chaos.view.PinView;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.FirebaseException;
import com.google.firebase.FirebaseTooManyRequestsException;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseAuthInvalidCredentialsException;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.auth.PhoneAuthCredential;
import com.google.firebase.auth.PhoneAuthProvider;
import com.selectmakeathon.app.R;
import com.selectmakeathon.app.ui.auth.AuthActivity;
import com.selectmakeathon.app.util.Constants;
import java.util.concurrent.TimeUnit;
public class OtpFragment extends Fragment {
private static final String TAG = "OTP-Fragment";
private FirebaseAuth mAuth;
String mVerificationId, phoneNumber, otpCode;
PhoneAuthProvider.ForceResendingToken mResendToken;
private Button nextButton, confirmButton;
private TextView phoneNumberTextLabel, otpTextLabel;
private PinView otpPinView;
private EditText phoneNumberEditText;
private View phoneNumberEditTextLayout;
SharedPreferences prefs;
SharedPreferences.Editor prefEditor;
public OtpFragment() {
// Required empty public constructor
}
// TODO: Rename and change types and number of parameters
public static OtpFragment newInstance() {
return new OtpFragment();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_otp, container, false);
nextButton = view.findViewById(R.id.auth_button_otp_next);
confirmButton = view.findViewById(R.id.btn_confirm_otp);
otpPinView = view.findViewById(R.id.pv_otp);
phoneNumberEditText = view.findViewById(R.id.et_phone_number);
phoneNumberTextLabel = view.findViewById(R.id.tv_phone_label);
otpTextLabel = view.findViewById(R.id.tv_otp_label);
phoneNumberEditTextLayout = view.findViewById(R.id.el_phone_number);
mAuth = FirebaseAuth.getInstance();
nextButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
phoneNumber = phoneNumberEditText.getText().toString();
phoneNumber = "+91" + phoneNumber;
verifyPhoneNnumberWithOtp(phoneNumber);
}
});
confirmButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
otpCode = otpPinView.getText().toString();
PhoneAuthCredential credential = PhoneAuthProvider.getCredential(mVerificationId, otpCode);
signInWithPhoneAuthCredential(credential);
} catch (NullPointerException e){
Toast.makeText(getContext(), "Please enter a Valid OTP", Toast.LENGTH_SHORT).show();
}
}
});
prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
prefEditor = prefs.edit();
return view;
}
void goToSignUp(){
((AuthActivity)getActivity()).updateFragment(AuthActivity.AuthFragment.SIGNUP);
}
void switchToOtp(){
nextButton.setVisibility(View.GONE);
phoneNumberTextLabel.setVisibility(View.GONE);
phoneNumberEditText.setVisibility(View.GONE);
phoneNumberEditTextLayout.setVisibility(View.GONE);
confirmButton.setVisibility(View.VISIBLE);
otpTextLabel.setVisibility(View.VISIBLE);
otpPinView.setVisibility(View.VISIBLE);
}
void verifyPhoneNnumberWithOtp(String phoneNumber){
PhoneAuthProvider.getInstance().verifyPhoneNumber(
phoneNumber, // Phone number to verify
60, // Timeout duration
TimeUnit.SECONDS, // Unit of timeout
getActivity(), // Activity (for callback binding)
new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
@Override
public void onVerificationCompleted(PhoneAuthCredential credential) {
// This callback will be invoked in two situations:
// 1 - Instant verification. In some cases the phone number can be instantly
// verified without needing to send or enter a verification code.
// 2 - Auto-retrieval. On some devices Google Play services can automatically
// detect the incoming verification SMS and perform verification without
// user action.
Log.d(TAG, "onVerificationCompleted:" + credential);
signInWithPhoneAuthCredential(credential);
}
@Override
public void onVerificationFailed(FirebaseException e) {
// This callback is invoked in an invalid request for verification is made,
// for instance if the the phone number format is not valid.
Log.w(TAG, "onVerificationFailed", e);
Toast.makeText(getContext(), "Please enter correct Phone Number", Toast.LENGTH_SHORT).show();
if (e instanceof FirebaseAuthInvalidCredentialsException) {
// Invalid request
// ...
} else if (e instanceof FirebaseTooManyRequestsException) {
// The SMS quota for the project has been exceeded
// ...
}
// Show a message and update the UI
// ...
}
@Override
public void onCodeSent(String verificationId,
PhoneAuthProvider.ForceResendingToken token) {
super.onCodeSent(verificationId, token);
Toast.makeText(getActivity(), "Code Sent, Waiting for Verification", Toast.LENGTH_SHORT).show();
// The SMS verification code has been sent to the provided phone number, we
// now need to ask the user to enter the code and then construct a credential
// by combining the code with a verification ID.
Log.d(TAG, "onCodeSent:" + verificationId);
switchToOtp();
// Save verification ID and resending token so we can use them later
mVerificationId = verificationId;
mResendToken = token;
// ...
}
}); // OnVerificationStateChangedCallbacks
}
private void signInWithPhoneAuthCredential(PhoneAuthCredential credential) {
mAuth.signInWithCredential(credential)
.addOnCompleteListener(getActivity(), new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d(TAG, "signInWithCredential:success");
FirebaseUser user = task.getResult().getUser();
proceedWithLogin();
// ...
} else {
// Sign in failed, display a message and update the UI
Log.w(TAG, "signInWithCredential:failure", task.getException());
if (task.getException() instanceof FirebaseAuthInvalidCredentialsException) {
// The verification code entered was invalid
Toast.makeText(getContext(), "The code doesn't match.\nPlease check the code again!", Toast.LENGTH_SHORT).show();
}
}
}
});
}
void proceedWithLogin(){
//Perform next sequence of actions
prefEditor.putString(Constants.PREF_PHONE_NUMBER, phoneNumber).commit();
Toast.makeText(getContext(), "Successfully Authenticated", Toast.LENGTH_SHORT).show();
((AuthActivity)getActivity()).updateFragment(AuthActivity.AuthFragment.SIGNUP);
}
}
| 9,420 | 0.607643 | 0.607006 | 214 | 43.018692 | 31.150518 | 145 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.616822 | false | false |
5
|
e9a46ff24df74557d2bd07f500fb560117928d37
| 17,884,243,833,752 |
258de8e8d556901959831bbdc3878af2d8933997
|
/utopia-service/utopia-campaign/utopia-campaign-api/src/main/java/com/voxlearning/utopia/service/campaign/api/DPCampaignService.java
|
ee700683a755a2a88378c3c3872beac68310d5e9
|
[] |
no_license
|
Explorer1092/vox
|
https://github.com/Explorer1092/vox
|
d40168b44ccd523748647742ec376fdc2b22160f
|
701160b0417e5a3f1b942269b0e7e2fd768f4b8e
|
refs/heads/master
| 2020-05-14T20:13:02.531000 | 2019-04-17T06:54:06 | 2019-04-17T06:54:06 | 181,923,482 | 0 | 4 | null | true | 2019-04-17T15:53:25 | 2019-04-17T15:53:25 | 2019-04-17T07:16:30 | 2019-04-17T07:15:25 | 290,613 | 0 | 0 | 0 | null | false | false |
package com.voxlearning.utopia.service.campaign.api;
import com.voxlearning.alps.annotation.remote.ServiceRetries;
import com.voxlearning.alps.annotation.remote.ServiceTimeout;
import com.voxlearning.alps.annotation.remote.ServiceVersion;
import com.voxlearning.alps.lang.util.MapMessage;
import com.voxlearning.alps.spi.common.IPingable;
import java.util.concurrent.TimeUnit;
/**
* @author Xiaochao.Wei
* @since 2018/3/2
*/
@ServiceVersion(version = "20180302")
@ServiceTimeout(timeout = 30, unit = TimeUnit.SECONDS)
@ServiceRetries
public interface DPCampaignService extends IPingable {
MapMessage addArrangeHomeworkLotteryChance(Long userId, Integer delta);
}
|
UTF-8
|
Java
| 675 |
java
|
DPCampaignService.java
|
Java
|
[
{
"context": "ort java.util.concurrent.TimeUnit;\n\n/**\n * @author Xiaochao.Wei\n * @since 2018/3/2\n */\n\n@ServiceVersion(version =",
"end": 407,
"score": 0.9998227953910828,
"start": 395,
"tag": "NAME",
"value": "Xiaochao.Wei"
}
] | null |
[] |
package com.voxlearning.utopia.service.campaign.api;
import com.voxlearning.alps.annotation.remote.ServiceRetries;
import com.voxlearning.alps.annotation.remote.ServiceTimeout;
import com.voxlearning.alps.annotation.remote.ServiceVersion;
import com.voxlearning.alps.lang.util.MapMessage;
import com.voxlearning.alps.spi.common.IPingable;
import java.util.concurrent.TimeUnit;
/**
* @author Xiaochao.Wei
* @since 2018/3/2
*/
@ServiceVersion(version = "20180302")
@ServiceTimeout(timeout = 30, unit = TimeUnit.SECONDS)
@ServiceRetries
public interface DPCampaignService extends IPingable {
MapMessage addArrangeHomeworkLotteryChance(Long userId, Integer delta);
}
| 675 | 0.81037 | 0.786667 | 22 | 29.681818 | 25.742407 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.454545 | false | false |
5
|
a90988aa1a9441015f1b6319368560d1c04c76e4
| 21,242,908,259,190 |
90db0511a9976e2fa77d70104d345c4a2cab884a
|
/2 Java/exam/1/test2.java
|
8890f6cfd7ab9b465c8f816092b7eb1be4cd18c4
|
[] |
no_license
|
PS-Yang/University
|
https://github.com/PS-Yang/University
|
4055410e5618b0c9bd11b1d725d2b280ce1c7b67
|
72c7951aeb36e521e52b8076eefe98e144aa62b3
|
refs/heads/master
| 2020-04-13T18:36:11.867000 | 2018-12-29T09:27:34 | 2018-12-29T09:27:34 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.*;
import java.util.Scanner;
public class test2 {
public static void main(String[] args)
{
Scanner scn=new Scanner(System.in);
String str;
int count=0;
while(true)
{
System.out.print("輸入n值(1~200)(輸入q離開): ");
str=scn.nextLine(); // 將輸入的文字指定給字串變數str存放
if(str.equals("q")||str.equals("Q"))
break;
else
{
StringTokenizer st = new StringTokenizer(str);
int n=st.countTokens(); //計算Token數
if(n!=1)
{
System.out.println("只能輸入一個數值或q!");
continue;
}
int a []=new int [n];
for(int i=0;i<n;i++)
a[i]=Integer.parseInt(st.nextToken());
if(a[0]>200||a[0]<1)
{
System.out.println("數值介於1~200!!");
continue;
}
double sum=0;
for(int i=0;i<=a[0];i++)
sum=sum+count(i);
System.out.println("g(x)="+sum);
}
}
}
public static double count(int num)
{
int n=num;
if(n==0)
return 1;
else
return (double) (count(n-1)*2)/n;
}
}
|
BIG5
|
Java
| 1,157 |
java
|
test2.java
|
Java
|
[] | null |
[] |
import java.util.*;
import java.util.Scanner;
public class test2 {
public static void main(String[] args)
{
Scanner scn=new Scanner(System.in);
String str;
int count=0;
while(true)
{
System.out.print("輸入n值(1~200)(輸入q離開): ");
str=scn.nextLine(); // 將輸入的文字指定給字串變數str存放
if(str.equals("q")||str.equals("Q"))
break;
else
{
StringTokenizer st = new StringTokenizer(str);
int n=st.countTokens(); //計算Token數
if(n!=1)
{
System.out.println("只能輸入一個數值或q!");
continue;
}
int a []=new int [n];
for(int i=0;i<n;i++)
a[i]=Integer.parseInt(st.nextToken());
if(a[0]>200||a[0]<1)
{
System.out.println("數值介於1~200!!");
continue;
}
double sum=0;
for(int i=0;i<=a[0];i++)
sum=sum+count(i);
System.out.println("g(x)="+sum);
}
}
}
public static double count(int num)
{
int n=num;
if(n==0)
return 1;
else
return (double) (count(n-1)*2)/n;
}
}
| 1,157 | 0.505088 | 0.481961 | 58 | 17.637932 | 16.139156 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.810345 | false | false |
5
|
2eb962b3238f34da9024246b7f3b0b78207d1a54
| 31,619,549,238,869 |
8f3dcf035ae542430b1f760dc47526c44843b353
|
/src/it/uniroma3/model/CarmakerFacade.java
|
8374551ed84abbd0c8c4556863c7c698a62d7a80
|
[] |
no_license
|
zell92/AutoRest
|
https://github.com/zell92/AutoRest
|
10dde34e6026f3d37ce76aec7342b3246571947d
|
56780d0ae0c242b95d860abad57577908067a88e
|
refs/heads/master
| 2020-12-20T17:43:27.556000 | 2016-05-31T18:51:30 | 2016-05-31T18:51:30 | 59,236,635 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package it.uniroma3.model;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.criteria.CriteriaQuery;
@Stateless
public class CarmakerFacade {
@PersistenceContext(unitName = "unit-progetto")
private EntityManager em;
public Carmaker createCarmaker(String name) {
List<Car> cars = new LinkedList<Car>();
Carmaker carmaker = new Carmaker(name,cars);
em.persist(carmaker);
return carmaker;
}
public List<Carmaker> getAllCarmakers() {
CriteriaQuery<Carmaker> cq = em.getCriteriaBuilder().createQuery(Carmaker.class);
cq.select(cq.from(Carmaker.class));
List<Carmaker> carmakers= em.createQuery(cq).getResultList();
return carmakers;
}
public List<Car> getCars(Carmaker carmaker) {
List<Car> cars = this.em.createQuery("SELECT c FROM Car c WHERE c.carmaker.id = :cmId").setParameter("cmId", carmaker.getId()).getResultList();
if(cars.size() == 0)
return null;
else
return cars;
}
public Carmaker getCarmaker(Long id) {
return this.em.find(Carmaker.class, id);
}
private void deleteCarmaker(Carmaker carmaker) {
em.remove(carmaker);
}
public void deleteCarmaker(Long id) {
Carmaker carmaker = em.find(Carmaker.class, id);
deleteCarmaker(carmaker);
}
}
|
UTF-8
|
Java
| 1,426 |
java
|
CarmakerFacade.java
|
Java
|
[] | null |
[] |
package it.uniroma3.model;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.criteria.CriteriaQuery;
@Stateless
public class CarmakerFacade {
@PersistenceContext(unitName = "unit-progetto")
private EntityManager em;
public Carmaker createCarmaker(String name) {
List<Car> cars = new LinkedList<Car>();
Carmaker carmaker = new Carmaker(name,cars);
em.persist(carmaker);
return carmaker;
}
public List<Carmaker> getAllCarmakers() {
CriteriaQuery<Carmaker> cq = em.getCriteriaBuilder().createQuery(Carmaker.class);
cq.select(cq.from(Carmaker.class));
List<Carmaker> carmakers= em.createQuery(cq).getResultList();
return carmakers;
}
public List<Car> getCars(Carmaker carmaker) {
List<Car> cars = this.em.createQuery("SELECT c FROM Car c WHERE c.carmaker.id = :cmId").setParameter("cmId", carmaker.getId()).getResultList();
if(cars.size() == 0)
return null;
else
return cars;
}
public Carmaker getCarmaker(Long id) {
return this.em.find(Carmaker.class, id);
}
private void deleteCarmaker(Carmaker carmaker) {
em.remove(carmaker);
}
public void deleteCarmaker(Long id) {
Carmaker carmaker = em.find(Carmaker.class, id);
deleteCarmaker(carmaker);
}
}
| 1,426 | 0.717391 | 0.715989 | 57 | 24.017544 | 26.50289 | 145 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.298246 | false | false |
5
|
60d77af55d8e2fffa7e56d09b5cbb92a1836d57c
| 21,758,304,346,250 |
0abb7424e937e4babfe5c10913fb51bc360d8839
|
/src/java/com/fanchaojian/controller/EssayController.java
|
995babccd7a6400cebdf6110a36a88b34c61188b
|
[] |
no_license
|
fanchaojian/FanBlog_java
|
https://github.com/fanchaojian/FanBlog_java
|
8d80b72513c527d9b25d56d6b4c6095807b2c297
|
55ba55c77225d20b4702b1df7ff588c420545fb4
|
refs/heads/master
| 2023-01-02T06:33:11.433000 | 2020-10-13T15:36:57 | 2020-10-13T15:36:57 | 302,128,041 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.fanchaojian.controller;
import com.fanchaojian.domain.Essay;
import com.fanchaojian.service.IEssayService;
import com.fanchaojian.utils.JsonResult;
import com.fanchaojian.utils.ResultUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
/**
* 心情随笔控制器
* @author fanchaojian
* @date 2020-9-22 - 18:13
*/
@Controller
@RestController
@RequestMapping("essay")
public class EssayController {
@Autowired
private IEssayService essayService ;
/*查找所有*/ //----blog
@GetMapping("")
public JsonResult findAll(){
return ResultUtils.success(essayService.findAll()) ;
}
/*删除essay*/ //----admin
@PostMapping("baseAdmin/delete")
public JsonResult deleteEssay(Integer id){
if(id == null){
throw new RuntimeException("请指定参数id") ;
}
return ResultUtils.success(essayService.deleteEssay(id)) ;
}
/*添加随笔*/ //----admin
@PostMapping("baseAdmin/save")
public JsonResult saveEssay(String content){
Essay essay = new Essay();
essay.setContent(content);
essay.setCreateDate(new Date());
return ResultUtils.success(essayService.addEssay(essay)) ;
}
}
|
UTF-8
|
Java
| 1,463 |
java
|
EssayController.java
|
Java
|
[
{
"context": "\nimport java.util.List;\n\n/**\n * 心情随笔控制器\n * @author fanchaojian\n * @date 2020-9-22 - 18:13\n */\n@Controller\n@RestC",
"end": 514,
"score": 0.9996058344841003,
"start": 503,
"tag": "USERNAME",
"value": "fanchaojian"
}
] | null |
[] |
package com.fanchaojian.controller;
import com.fanchaojian.domain.Essay;
import com.fanchaojian.service.IEssayService;
import com.fanchaojian.utils.JsonResult;
import com.fanchaojian.utils.ResultUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
/**
* 心情随笔控制器
* @author fanchaojian
* @date 2020-9-22 - 18:13
*/
@Controller
@RestController
@RequestMapping("essay")
public class EssayController {
@Autowired
private IEssayService essayService ;
/*查找所有*/ //----blog
@GetMapping("")
public JsonResult findAll(){
return ResultUtils.success(essayService.findAll()) ;
}
/*删除essay*/ //----admin
@PostMapping("baseAdmin/delete")
public JsonResult deleteEssay(Integer id){
if(id == null){
throw new RuntimeException("请指定参数id") ;
}
return ResultUtils.success(essayService.deleteEssay(id)) ;
}
/*添加随笔*/ //----admin
@PostMapping("baseAdmin/save")
public JsonResult saveEssay(String content){
Essay essay = new Essay();
essay.setContent(content);
essay.setCreateDate(new Date());
return ResultUtils.success(essayService.addEssay(essay)) ;
}
}
| 1,463 | 0.693446 | 0.685694 | 50 | 27.379999 | 19.705725 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.38 | false | false |
5
|
9c05e76844aa21b33f55051044ebb1a38c7366af
| 9,320,079,050,115 |
a6e1693fa7ea080683bea8a3fe3ec365ca6b14b2
|
/Services/src/main/java/com/hemyn/courseService/FindCourseClassServ.java
|
1bda405b9314edae78705c8592d9a8edece4a923
|
[] |
no_license
|
Foreinyel/hemyn-backends
|
https://github.com/Foreinyel/hemyn-backends
|
a0cefb1ebe62938f0ab109b9c6501258609dbee2
|
65d29da56aa50d7e728981dad1b18be2df9907d7
|
refs/heads/master
| 2015-09-26T01:03:28.841000 | 2015-09-01T14:32:10 | 2015-09-01T14:32:10 | 40,750,458 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hemyn.courseService;
import com.hemyn.common.Response;
import com.hemyn.db.CourseClass;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
/**
* Created by shihao on 15/8/24.
*/
public interface FindCourseClassServ {
Response<Page<CourseClass>> findCourseClassByCourseId(final Long courseId, final Pageable pageRequest);
}
|
UTF-8
|
Java
| 386 |
java
|
FindCourseClassServ.java
|
Java
|
[
{
"context": "framework.data.domain.Pageable;\n\n/**\n * Created by shihao on 15/8/24.\n */\npublic interface FindCourseClassS",
"end": 220,
"score": 0.9617907404899597,
"start": 214,
"tag": "USERNAME",
"value": "shihao"
}
] | null |
[] |
package com.hemyn.courseService;
import com.hemyn.common.Response;
import com.hemyn.db.CourseClass;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
/**
* Created by shihao on 15/8/24.
*/
public interface FindCourseClassServ {
Response<Page<CourseClass>> findCourseClassByCourseId(final Long courseId, final Pageable pageRequest);
}
| 386 | 0.797927 | 0.784974 | 13 | 28.692308 | 28.569443 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false |
5
|
1757db4b7ea6fe7e6707c5c05db4f2d13e1e4bb7
| 26,164,940,769,424 |
369270a14e669687b5b506b35895ef385dad11ab
|
/javafx.graphics/javafx/print/PageLayout.java
|
ae29053583310141376abb905299e58d5b71e667
|
[] |
no_license
|
zcc888/Java9Source
|
https://github.com/zcc888/Java9Source
|
39254262bd6751203c2002d9fc020da533f78731
|
7776908d8053678b0b987101a50d68995c65b431
|
refs/heads/master
| 2021-09-10T05:49:56.469000 | 2018-03-20T06:26:03 | 2018-03-20T06:26:03 | 125,970,208 | 3 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package javafx.print;
import static javafx.print.PageOrientation.*;
/**
*
* A PageLayout encapsulates the information needed to
* lay out content. The reported width and height can be
* considered equivalent to the clip enforced by a Window.
* Applications that obtain a PageLayout instance will
* need to inspect the width and height to perform layout and pagination.
* Other information such as orientation and the Paper being used
* and margins outside of this area are not needed for page rendering.
* <p>
* Printers usually have hardware margins where they cannot print.
* A PageLayout instance obtained from a PrinterJob in the context
* of a specific printer will be correctly set up to print over
* the whole of that area. If an application adjusts the printable
* area outside of this bounds, rendering to those areas will be
* clipped by the device.
* <p>
* Within those hardware margins, the application may define any
* printable area it needs. The resulting printable area will
* define the effective dimensions
* of the page available to the application at printing time.
* <p>
* Applying a PageLayout configured based on one printer,
* to a job on a different printer may not work correctly,
* as the second printer may not support the same margins, and may not
* even support the same Paper. In such a case, the PageLayout must
* be validated against the new printer.
* <p>
* A PageLayout is immutable.
*
* @since JavaFX 8.0
*/
public final class PageLayout {
private PageOrientation orient;
private Paper paper;
private double lMargin, rMargin, tMargin, bMargin;
/**
* Create a PageLayout using the specified Paper size and orientation.
* Default margins are 0.75 inch which is 56 points.
* If the paper dimension is smaller than this,
* the margins will be reduced.
* @param paper the paper to use
* @param orient orientation of the layout
* @throws IllegalArgumentException if paper or orient is null.
*/
PageLayout(Paper paper, PageOrientation orient) {
this(paper, orient, 56, 56, 56, 56);
}
/**
* Note that the margins are to be specified as applying after
* the rotation due to the orientation. Thus the left margin
* always defines the x origin of the printable area,
* and the top margin always defines its y origin.
* @param paper the paper to use
* @param orient orientation of the layout
* @param leftMargin the left margin in points.
* @param rightMargin the left margin in points.
* @param topMargin the top margin in points.
* @param bottomMargin the bottom margin in points.
* @throws IllegalArgumentException if the margins exceed the
* corresponding paper dimension, or are negative, or if
* paper or orient is null.
*/
PageLayout(Paper paper, PageOrientation orient,
double leftMargin, double rightMargin,
double topMargin, double bottomMargin) {
if (paper == null || orient == null ||
leftMargin < 0 || rightMargin < 0 ||
topMargin < 0 || bottomMargin < 0) {
throw new IllegalArgumentException("Illegal parameters");
}
if (orient == PORTRAIT || orient == REVERSE_PORTRAIT) {
if (leftMargin+rightMargin > paper.getWidth() ||
topMargin+bottomMargin > paper.getHeight()) {
throw new IllegalArgumentException("Bad margins");
}
} else if (leftMargin+rightMargin > paper.getHeight() ||
topMargin+bottomMargin > paper.getWidth()) {
throw new IllegalArgumentException("Bad margins");
}
this.paper = paper;
this.orient = orient;
this.lMargin = leftMargin;
this.rMargin = rightMargin;
this.tMargin = topMargin;
this.bMargin = bottomMargin;
}
public PageOrientation getPageOrientation() {
return orient;
}
/**
* The paper used.
* @return the Paper used for this <code>PageLayout</code>.
*/
public Paper getPaper() {
return paper;
}
/**
* Returns the width dimension of the printable area of the page,
* in 1/72 of an inch points, taking into account the orientation.
* <p>
* The printable area is width or height reduced by the
* requested margins on each side. If the requested margins
* are smaller than the the hardware margins, rendering may
* be clipped by the device.
* <p>
* Since the returned value accounts for orientation, this means if
* if the orientation is LANDSCAPE or REVERSE_LANDSCAPE, then
* the left and right margins are subtracted from the height of
* the underlying paper, since it is rotated 90 degrees.
* @return printable width in points.
*/
public double getPrintableWidth() {
double pw = 0;
if (orient == PORTRAIT || orient == REVERSE_PORTRAIT) {
pw = paper.getWidth();
} else {
pw = paper.getHeight();
}
pw -= (lMargin+rMargin);
if (pw < 0) {
pw = 0;
}
return pw;
}
/**
* Returns the height dimension of the printable area of the page,
* in 1/72 of an inch, taking into account the orientation.
* <p>
* The printable area is width or height reduced by the
* requested margins on each side. If the requested margins
* are smaller than the the hardware margins, rendering may
* be clipped by the device.
* <p>
* Since the returned value accounts for orientation, this means if
* if the orientation is LANDSCAPE or REVERSE_LANDSCAPE, then
* the top and bottom margins are subtracted from the height of
* the underlying paper, since it is rotated 90 degrees.
* @return printable height in points.
*/
public double getPrintableHeight() {
double ph = 0;
if (orient == PORTRAIT || orient == REVERSE_PORTRAIT) {
ph = paper.getHeight();
} else {
ph = paper.getWidth();
}
ph -= (tMargin+bMargin);
if (ph < 0) {
ph = 0;
}
return ph;
}
/**
* Returns the left margin of the page layout in points.
* This value is in the orientation of the PageLayout.
* @return left margin in points.
*/
public double getLeftMargin() {
return lMargin;
}
/**
* Returns the right margin of the page layout in points.
* This value is in the orientation of the PageLayout.
* @return right margin in points.
*/
public double getRightMargin() {
return rMargin;
}
/**
* Returns the top margin of the page layout in points.
* This value is in the orientation of the PageLayout.
* @return top margin in points.
*/
public double getTopMargin() {
return tMargin;
}
/**
* Returns the bottom margin of the page layout in points.
* This value is in the orientation of the PageLayout.
* @return bottom margin in points.
*/
public double getBottomMargin() {
return bMargin;
}
@Override public boolean equals(Object o) {
if (o instanceof PageLayout) {
PageLayout other = (PageLayout)o;
return
paper.equals(other.paper) &&
orient.equals(other.orient) &&
tMargin == other.tMargin &&
bMargin == other.bMargin &&
rMargin == other.rMargin &&
lMargin == other.lMargin;
} else {
return false;
}
}
@Override public int hashCode() {
return paper.hashCode() + orient.hashCode()+
(int)(tMargin+bMargin+lMargin+rMargin);
}
@Override public String toString() {
return
"Paper="+paper+
" Orient="+orient+
" leftMargin="+lMargin+
" rightMargin="+rMargin+
" topMargin="+tMargin+
" bottomMargin="+bMargin;
}
}
|
UTF-8
|
Java
| 8,309 |
java
|
PageLayout.java
|
Java
|
[] | null |
[] |
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package javafx.print;
import static javafx.print.PageOrientation.*;
/**
*
* A PageLayout encapsulates the information needed to
* lay out content. The reported width and height can be
* considered equivalent to the clip enforced by a Window.
* Applications that obtain a PageLayout instance will
* need to inspect the width and height to perform layout and pagination.
* Other information such as orientation and the Paper being used
* and margins outside of this area are not needed for page rendering.
* <p>
* Printers usually have hardware margins where they cannot print.
* A PageLayout instance obtained from a PrinterJob in the context
* of a specific printer will be correctly set up to print over
* the whole of that area. If an application adjusts the printable
* area outside of this bounds, rendering to those areas will be
* clipped by the device.
* <p>
* Within those hardware margins, the application may define any
* printable area it needs. The resulting printable area will
* define the effective dimensions
* of the page available to the application at printing time.
* <p>
* Applying a PageLayout configured based on one printer,
* to a job on a different printer may not work correctly,
* as the second printer may not support the same margins, and may not
* even support the same Paper. In such a case, the PageLayout must
* be validated against the new printer.
* <p>
* A PageLayout is immutable.
*
* @since JavaFX 8.0
*/
public final class PageLayout {
private PageOrientation orient;
private Paper paper;
private double lMargin, rMargin, tMargin, bMargin;
/**
* Create a PageLayout using the specified Paper size and orientation.
* Default margins are 0.75 inch which is 56 points.
* If the paper dimension is smaller than this,
* the margins will be reduced.
* @param paper the paper to use
* @param orient orientation of the layout
* @throws IllegalArgumentException if paper or orient is null.
*/
PageLayout(Paper paper, PageOrientation orient) {
this(paper, orient, 56, 56, 56, 56);
}
/**
* Note that the margins are to be specified as applying after
* the rotation due to the orientation. Thus the left margin
* always defines the x origin of the printable area,
* and the top margin always defines its y origin.
* @param paper the paper to use
* @param orient orientation of the layout
* @param leftMargin the left margin in points.
* @param rightMargin the left margin in points.
* @param topMargin the top margin in points.
* @param bottomMargin the bottom margin in points.
* @throws IllegalArgumentException if the margins exceed the
* corresponding paper dimension, or are negative, or if
* paper or orient is null.
*/
PageLayout(Paper paper, PageOrientation orient,
double leftMargin, double rightMargin,
double topMargin, double bottomMargin) {
if (paper == null || orient == null ||
leftMargin < 0 || rightMargin < 0 ||
topMargin < 0 || bottomMargin < 0) {
throw new IllegalArgumentException("Illegal parameters");
}
if (orient == PORTRAIT || orient == REVERSE_PORTRAIT) {
if (leftMargin+rightMargin > paper.getWidth() ||
topMargin+bottomMargin > paper.getHeight()) {
throw new IllegalArgumentException("Bad margins");
}
} else if (leftMargin+rightMargin > paper.getHeight() ||
topMargin+bottomMargin > paper.getWidth()) {
throw new IllegalArgumentException("Bad margins");
}
this.paper = paper;
this.orient = orient;
this.lMargin = leftMargin;
this.rMargin = rightMargin;
this.tMargin = topMargin;
this.bMargin = bottomMargin;
}
public PageOrientation getPageOrientation() {
return orient;
}
/**
* The paper used.
* @return the Paper used for this <code>PageLayout</code>.
*/
public Paper getPaper() {
return paper;
}
/**
* Returns the width dimension of the printable area of the page,
* in 1/72 of an inch points, taking into account the orientation.
* <p>
* The printable area is width or height reduced by the
* requested margins on each side. If the requested margins
* are smaller than the the hardware margins, rendering may
* be clipped by the device.
* <p>
* Since the returned value accounts for orientation, this means if
* if the orientation is LANDSCAPE or REVERSE_LANDSCAPE, then
* the left and right margins are subtracted from the height of
* the underlying paper, since it is rotated 90 degrees.
* @return printable width in points.
*/
public double getPrintableWidth() {
double pw = 0;
if (orient == PORTRAIT || orient == REVERSE_PORTRAIT) {
pw = paper.getWidth();
} else {
pw = paper.getHeight();
}
pw -= (lMargin+rMargin);
if (pw < 0) {
pw = 0;
}
return pw;
}
/**
* Returns the height dimension of the printable area of the page,
* in 1/72 of an inch, taking into account the orientation.
* <p>
* The printable area is width or height reduced by the
* requested margins on each side. If the requested margins
* are smaller than the the hardware margins, rendering may
* be clipped by the device.
* <p>
* Since the returned value accounts for orientation, this means if
* if the orientation is LANDSCAPE or REVERSE_LANDSCAPE, then
* the top and bottom margins are subtracted from the height of
* the underlying paper, since it is rotated 90 degrees.
* @return printable height in points.
*/
public double getPrintableHeight() {
double ph = 0;
if (orient == PORTRAIT || orient == REVERSE_PORTRAIT) {
ph = paper.getHeight();
} else {
ph = paper.getWidth();
}
ph -= (tMargin+bMargin);
if (ph < 0) {
ph = 0;
}
return ph;
}
/**
* Returns the left margin of the page layout in points.
* This value is in the orientation of the PageLayout.
* @return left margin in points.
*/
public double getLeftMargin() {
return lMargin;
}
/**
* Returns the right margin of the page layout in points.
* This value is in the orientation of the PageLayout.
* @return right margin in points.
*/
public double getRightMargin() {
return rMargin;
}
/**
* Returns the top margin of the page layout in points.
* This value is in the orientation of the PageLayout.
* @return top margin in points.
*/
public double getTopMargin() {
return tMargin;
}
/**
* Returns the bottom margin of the page layout in points.
* This value is in the orientation of the PageLayout.
* @return bottom margin in points.
*/
public double getBottomMargin() {
return bMargin;
}
@Override public boolean equals(Object o) {
if (o instanceof PageLayout) {
PageLayout other = (PageLayout)o;
return
paper.equals(other.paper) &&
orient.equals(other.orient) &&
tMargin == other.tMargin &&
bMargin == other.bMargin &&
rMargin == other.rMargin &&
lMargin == other.lMargin;
} else {
return false;
}
}
@Override public int hashCode() {
return paper.hashCode() + orient.hashCode()+
(int)(tMargin+bMargin+lMargin+rMargin);
}
@Override public String toString() {
return
"Paper="+paper+
" Orient="+orient+
" leftMargin="+lMargin+
" rightMargin="+rMargin+
" topMargin="+tMargin+
" bottomMargin="+bMargin;
}
}
| 8,309 | 0.623902 | 0.619208 | 258 | 31.205427 | 24.276676 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.368217 | false | false |
5
|
0881654102fe8fb0a0dda06d4d5b319bd853415b
| 12,996,571,058,717 |
18ace9d7501b4653a7fed5c6eebde68dabb9feac
|
/product-commons/src/main/java/com/hundsun/fund/product/commons/utils/Constant.java
|
3832e5e38ae4e10d276cb4ddfa28478374a9afb5
|
[] |
no_license
|
lihuiyao1986/product
|
https://github.com/lihuiyao1986/product
|
4cc0a4ca8024a81ea1e5359bc8ea5abae50d65fa
|
972a9ae49a043a0c4f0ea00b0bf9a38236077caf
|
refs/heads/master
| 2021-01-10T21:29:43.405000 | 2015-05-13T02:23:21 | 2015-05-13T02:23:21 | 34,743,685 | 2 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* @Title: Constant.java
* @Package com.hundsun.fund.product.commons.utils
* @Description: TODO(用一句话描述该文件做什么)
* @author A18ccms A18ccms_gmail_com
* @date 2015年4月29日 下午8:00:34
* @Copyright:Copyright (c)
* @Company:whty李焱生
* @version V1.0
*/
package com.hundsun.fund.product.commons.utils;
/**
*@Description:TODO(这里用一句话描述这个类的作用)
*@Author:李焱生
*@Since:2015年4月29日下午8:00:34
*/
public class Constant {
/**
* http合法性验证秘钥
*/
public static final String SECRETKEY = "0123456789";
/*********************http 请求头参数 Start**********************/
/**
* http请求 User-Agent
*/
public static final String REQUEST_USERAGENT = "useragent";
/**
* 随机数
*/
public static final String REQUEST_RANDOMONCE = "random";
/**
* 版本号
*/
public static final String REQUEST_VERSION = "version";
/**
* 时间戳
*/
public static final String REQUEST_TIMESTAMP = "timestamp";
/**
* 令牌
*/
public static final String REQUEST_TOKEN = "token";
/**
* 客户端唯一标识(手机串号)
*/
public static final String REQUEST_UUID = "uuid";
/**
* 请求URL
*/
public static final String REQUEST_URL = "url";
/**
* 密文
*/
public static final String REQUEST_SIGNATURE = "signature";
/**
* 用户代理
*/
public static final String REQUEST_USER_AGENT = "useragent";
/**
* 来源
*/
public static final String REQUEST_SOURCE = "source";
/** request中的userInfo的key **/
public static final String USER_INFO_KEY_IN_REDIS = "userInfoInRedis";
/** 分页 **/
public static final String IS_PAGING_YES = "1";
/** 不分页 **/
public static final String IS_PAGING_NO = "0";
/** 默认页码 **/
public static final int DEFAULT_PAGENO = 1;
/** 默认每页现实的页码数 **/
public static final int DEFAULT_PAGESIZE = 10;
}
|
UTF-8
|
Java
| 2,199 |
java
|
Constant.java
|
Java
|
[
{
"context": "ils\n * @Description: TODO(用一句话描述该文件做什么)\n * @author A18ccms A18ccms_gmail_com\n * @date 2015年4月29日 下午8:00:34\n ",
"end": 134,
"score": 0.9996910095214844,
"start": 127,
"tag": "USERNAME",
"value": "A18ccms"
},
{
"context": "Description: TODO(用一句话描述该文件做什么)\n * @author A18ccms A18ccms_gmail_com\n * @date 2015年4月29日 下午8:00:34\n * ",
"end": 136,
"score": 0.5092269778251648,
"start": 135,
"tag": "EMAIL",
"value": "A"
},
{
"context": "ption: TODO(用一句话描述该文件做什么)\n * @author A18ccms A18ccms_gmail_com\n * @date 2015年4月29日 下午8:00:34\n * @Copyr",
"end": 142,
"score": 0.5641804933547974,
"start": 140,
"tag": "EMAIL",
"value": "ms"
},
{
"context": "on: TODO(用一句话描述该文件做什么)\n * @author A18ccms A18ccms_gmail_com\n * @date 2015年4月29日 下午8:00:34\n * @Copyright:C",
"end": 148,
"score": 0.6458615660667419,
"start": 143,
"tag": "EMAIL",
"value": "gmail"
},
{
"context": "DO(用一句话描述该文件做什么)\n * @author A18ccms A18ccms_gmail_com\n * @date 2015年4月29日 下午8:00:34\n * @Copyright:Copyr",
"end": 152,
"score": 0.6321051120758057,
"start": 149,
"tag": "EMAIL",
"value": "com"
},
{
"context": "/**\n *@Description:TODO(这里用一句话描述这个类的作用)\n *@Author:李焱生\n *@Since:2015年4月29日下午8:00:34 \n */\npublic class",
"end": 352,
"score": 0.606391429901123,
"start": 351,
"tag": "NAME",
"value": "李"
},
{
"context": "**\n *@Description:TODO(这里用一句话描述这个类的作用)\n *@Author:李焱生\n *@Since:2015年4月29日下午8:00:34 \n */\npublic class C",
"end": 354,
"score": 0.6480516791343689,
"start": 352,
"tag": "USERNAME",
"value": "焱生"
},
{
"context": "lic static final String SECRETKEY = \"0123456789\";\n\n /*********************http 请求头参数 Start****",
"end": 517,
"score": 0.9996498823165894,
"start": 507,
"tag": "KEY",
"value": "0123456789"
}
] | null |
[] |
/**
* @Title: Constant.java
* @Package com.hundsun.fund.product.commons.utils
* @Description: TODO(用一句话描述该文件做什么)
* @author A18ccms A18ccms_<EMAIL>_com
* @date 2015年4月29日 下午8:00:34
* @Copyright:Copyright (c)
* @Company:whty李焱生
* @version V1.0
*/
package com.hundsun.fund.product.commons.utils;
/**
*@Description:TODO(这里用一句话描述这个类的作用)
*@Author:李焱生
*@Since:2015年4月29日下午8:00:34
*/
public class Constant {
/**
* http合法性验证秘钥
*/
public static final String SECRETKEY = "0123456789";
/*********************http 请求头参数 Start**********************/
/**
* http请求 User-Agent
*/
public static final String REQUEST_USERAGENT = "useragent";
/**
* 随机数
*/
public static final String REQUEST_RANDOMONCE = "random";
/**
* 版本号
*/
public static final String REQUEST_VERSION = "version";
/**
* 时间戳
*/
public static final String REQUEST_TIMESTAMP = "timestamp";
/**
* 令牌
*/
public static final String REQUEST_TOKEN = "token";
/**
* 客户端唯一标识(手机串号)
*/
public static final String REQUEST_UUID = "uuid";
/**
* 请求URL
*/
public static final String REQUEST_URL = "url";
/**
* 密文
*/
public static final String REQUEST_SIGNATURE = "signature";
/**
* 用户代理
*/
public static final String REQUEST_USER_AGENT = "useragent";
/**
* 来源
*/
public static final String REQUEST_SOURCE = "source";
/** request中的userInfo的key **/
public static final String USER_INFO_KEY_IN_REDIS = "userInfoInRedis";
/** 分页 **/
public static final String IS_PAGING_YES = "1";
/** 不分页 **/
public static final String IS_PAGING_NO = "0";
/** 默认页码 **/
public static final int DEFAULT_PAGENO = 1;
/** 默认每页现实的页码数 **/
public static final int DEFAULT_PAGESIZE = 10;
}
| 2,201 | 0.548762 | 0.526023 | 82 | 23.134146 | 23.751129 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.207317 | false | false |
5
|
6be8d69d453ff3f81cfd2a1adedd76612088c93e
| 21,285,857,967,962 |
748a7d34e71d093e0fb54adc58878f56deb4b004
|
/bozpower/src/main/java/com/app/bzpower/service/AdminService.java
|
4187fdf300bdfed1fe96001d2e854010ba06ca77
|
[] |
no_license
|
csqGit/lock
|
https://github.com/csqGit/lock
|
22d5edb3e94bfc878dc8345f7aea41d531b7f3f6
|
abc360b874f927b6ce370a10f4c3e496ba690fb4
|
refs/heads/master
| 2020-05-04T04:50:52.918000 | 2019-04-02T02:12:14 | 2019-04-02T02:12:14 | 173,399,527 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.app.bzpower.service;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.app.bzpower.entity.Log;
import com.app.bzpower.entity.PageData;
import com.app.bzpower.entity.Admin;
public interface AdminService {
/**
* 用户注册
*/
void insertAdmin(Admin admin);
/**
* 分页查询
* @param page
* @param maxResult
* @return
*/
List<Admin> selectAdminList(PageData pageData);
Admin selectLogByTelephone(String phone);
/**
* 根据ID查询
* @param id
* @return
*/
Admin selectAdminById(int id);
/**
* 根据用户名查询
* @param AdminName
* @return
*/
List<Admin> selectAdminByName(String adminName);
/**
* 得到总页数
* @return
*/
int selectPages();
/**
* 根据ID删除
* @param id
*/
void deleteAdmin(int id);
/**
* 根据ID更新用户信息
* @param Admin
*/
void updateAdmin(Admin admin);
/*
* 用户登录
*/
Admin AdminLogin(@Param("adminName") String adminName, @Param("password") String password);
}
|
UTF-8
|
Java
| 1,105 |
java
|
AdminService.java
|
Java
|
[] | null |
[] |
package com.app.bzpower.service;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.app.bzpower.entity.Log;
import com.app.bzpower.entity.PageData;
import com.app.bzpower.entity.Admin;
public interface AdminService {
/**
* 用户注册
*/
void insertAdmin(Admin admin);
/**
* 分页查询
* @param page
* @param maxResult
* @return
*/
List<Admin> selectAdminList(PageData pageData);
Admin selectLogByTelephone(String phone);
/**
* 根据ID查询
* @param id
* @return
*/
Admin selectAdminById(int id);
/**
* 根据用户名查询
* @param AdminName
* @return
*/
List<Admin> selectAdminByName(String adminName);
/**
* 得到总页数
* @return
*/
int selectPages();
/**
* 根据ID删除
* @param id
*/
void deleteAdmin(int id);
/**
* 根据ID更新用户信息
* @param Admin
*/
void updateAdmin(Admin admin);
/*
* 用户登录
*/
Admin AdminLogin(@Param("adminName") String adminName, @Param("password") String password);
}
| 1,105 | 0.612683 | 0.612683 | 64 | 14.015625 | 16.640963 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.046875 | false | false |
5
|
5319a2b7687125fe1a8efb24f5ab789fabae7f58
| 32,392,643,347,912 |
a3329a55a8a091bc4d56a17326010da73cc14854
|
/Vezbanje2/src/zadatak8Covek/Vozac.java
|
9fd2756777d1a51bfd1eb52aecd4601bcc558a51
|
[] |
no_license
|
BiljaK/Java-examples
|
https://github.com/BiljaK/Java-examples
|
de322cef7428d20e78a5d5c0332eaca2ba945ddb
|
bc8e1df1bfc3e998ea525ef6f8eb3035398420ff
|
refs/heads/main
| 2023-03-08T13:30:33.184000 | 2021-02-16T21:42:28 | 2021-02-16T21:42:28 | 338,020,882 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package zadatak8Covek;
public class Vozac extends Covek {
private String zanimanje;
public Vozac(String imeIPrezime, String zanimanje) {
super(imeIPrezime);
this.zanimanje = zanimanje;
}
public String getZanimanje() {
return zanimanje;
}
public void setZanimanje(String zanimanje) {
this.zanimanje = zanimanje;
}
public void stampajVozac() {
System.out.println(getImeIPrezime() + " je po zanimanju " + zanimanje);
}
}
//Vozac je covek koji poseduje i zvanje (zanimanje -> sofer).
|
UTF-8
|
Java
| 533 |
java
|
Vozac.java
|
Java
|
[] | null |
[] |
package zadatak8Covek;
public class Vozac extends Covek {
private String zanimanje;
public Vozac(String imeIPrezime, String zanimanje) {
super(imeIPrezime);
this.zanimanje = zanimanje;
}
public String getZanimanje() {
return zanimanje;
}
public void setZanimanje(String zanimanje) {
this.zanimanje = zanimanje;
}
public void stampajVozac() {
System.out.println(getImeIPrezime() + " je po zanimanju " + zanimanje);
}
}
//Vozac je covek koji poseduje i zvanje (zanimanje -> sofer).
| 533 | 0.690432 | 0.688555 | 26 | 18.576923 | 21.060669 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.115385 | false | false |
5
|
695d1266885a781fe09a9d62250f86a77846b94f
| 15,083,925,205,630 |
5c491f7030a283327f5ba2ea2a44ca9e2bb01cb1
|
/src/main/java/leogaming/com/Controller/SimpleController.java
|
c0f9227915f319b6ddb40dfc9179018c08349c0d
|
[] |
no_license
|
ManzyukDmitry/testxml
|
https://github.com/ManzyukDmitry/testxml
|
996db5435364d7eefc0177bd51ca0c5f5a00b1e1
|
0f2550a8df05d259b5031d7bd9809348f95a9672
|
refs/heads/master
| 2016-09-15T10:33:45.255000 | 2016-03-17T09:18:50 | 2016-03-17T09:18:50 | 53,737,390 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package leogaming.com.Controller;
import leogaming.com.ConfigurationLoader;
import leogaming.com.Entity.Account;
import leogaming.com.Entity.Payment;
import leogaming.com.models.MyUniversalApi;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
/**
* Created by AsusX550 on 11.03.2016.
*/
public class SimpleController {
public static void main(String[] args) {
MyUniversalApi universalApi = new MyUniversalApi();
ConfigurationLoader configurationLoader = new ConfigurationLoader("winpay.xml");
Map<String, String> params = new HashMap<String, String>(configurationLoader.getGateParams());
System.out.println(params);
System.out.println(params.get("status-result-path"));
Account account = new Account("Leo", "Test");
Payment payment = new Payment(account);
payment.setAmount(BigDecimal.TEN);
payment.setId(12L);
payment.setServiceId(12L);
payment.setMethod("status");
payment.setAccount(account);
System.out.println("Start ... ");
// universalApi.status(payment);
universalApi.payment(payment);
}
}
|
UTF-8
|
Java
| 1,166 |
java
|
SimpleController.java
|
Java
|
[
{
"context": ".HashMap;\nimport java.util.Map;\n\n/**\n * Created by AsusX550 on 11.03.2016.\n */\n\n\npublic class SimpleControlle",
"end": 300,
"score": 0.9996211528778076,
"start": 292,
"tag": "USERNAME",
"value": "AsusX550"
}
] | null |
[] |
package leogaming.com.Controller;
import leogaming.com.ConfigurationLoader;
import leogaming.com.Entity.Account;
import leogaming.com.Entity.Payment;
import leogaming.com.models.MyUniversalApi;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
/**
* Created by AsusX550 on 11.03.2016.
*/
public class SimpleController {
public static void main(String[] args) {
MyUniversalApi universalApi = new MyUniversalApi();
ConfigurationLoader configurationLoader = new ConfigurationLoader("winpay.xml");
Map<String, String> params = new HashMap<String, String>(configurationLoader.getGateParams());
System.out.println(params);
System.out.println(params.get("status-result-path"));
Account account = new Account("Leo", "Test");
Payment payment = new Payment(account);
payment.setAmount(BigDecimal.TEN);
payment.setId(12L);
payment.setServiceId(12L);
payment.setMethod("status");
payment.setAccount(account);
System.out.println("Start ... ");
// universalApi.status(payment);
universalApi.payment(payment);
}
}
| 1,166 | 0.692967 | 0.680103 | 41 | 27.439024 | 24.684397 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.634146 | false | false |
5
|
40d5f210eac9c4415bd3c25f474b6ad89dce66b1
| 15,616,501,125,178 |
3c72d73c8c75a76cad4128632e58152c7e0a1df9
|
/AlphaMgtAPI/src/com/Alpha/Services/FeedBackServices.java
|
c657f6ce3655cb49d72c30ca814b6df6aaf42e63
|
[] |
no_license
|
xamuel17/Alphaschools
|
https://github.com/xamuel17/Alphaschools
|
02b9654fed900d7de922a35e9d8deac2c76aef72
|
3eb2bbb5f6a382db0cdfefc819b240b8eac1bb43
|
refs/heads/master
| 2022-11-13T22:58:40.621000 | 2020-07-08T13:48:13 | 2020-07-08T13:48:13 | 278,100,838 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.Alpha.Services;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import com.Alpha.Database.DatabaseConnection;
import com.Alpha.Model.FeedbackModel;
import com.Alpha.Model.LecturerInboxModel;
public class FeedBackServices {
private PreparedStatement st=null;
private ResultSet rs= null;
private Connection con;
LecturerInboxModel lecturerInboxModel = new LecturerInboxModel();
public LecturerInboxModel feedback(long dept_id){
try{
DatabaseConnection dc = new DatabaseConnection();
con = dc.getConnection();
String sql = "SELECT * FROM feedback WHERE dept_id=?";
st= con.prepareStatement(sql);
//set params
st.setLong(1, dept_id);
//System.out.print(dc.getConnection());
rs = st.executeQuery();
while(rs.next()){
FeedbackModel fbm = new FeedbackModel();
fbm.setMessageId(rs.getLong("message_id"));
fbm.setDeptID(rs.getInt("dept_id"));
fbm.setLevel(rs.getInt("level"));
fbm.setMatNo(rs.getString("matno"));
fbm.setStudentEmail(rs.getString("student_email"));
fbm.setLecturerEmail(rs.getString("lecturer_email"));
fbm.setSubject(rs.getString("subject"));
fbm.setMessage(rs.getString("message"));
fbm.setDate(rs.getDate("date"));
lecturerInboxModel.setLecturerInbox(fbm);
}
}catch(Exception e){
e.printStackTrace();
}
return lecturerInboxModel;
}
}
|
UTF-8
|
Java
| 1,423 |
java
|
FeedBackServices.java
|
Java
|
[] | null |
[] |
package com.Alpha.Services;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import com.Alpha.Database.DatabaseConnection;
import com.Alpha.Model.FeedbackModel;
import com.Alpha.Model.LecturerInboxModel;
public class FeedBackServices {
private PreparedStatement st=null;
private ResultSet rs= null;
private Connection con;
LecturerInboxModel lecturerInboxModel = new LecturerInboxModel();
public LecturerInboxModel feedback(long dept_id){
try{
DatabaseConnection dc = new DatabaseConnection();
con = dc.getConnection();
String sql = "SELECT * FROM feedback WHERE dept_id=?";
st= con.prepareStatement(sql);
//set params
st.setLong(1, dept_id);
//System.out.print(dc.getConnection());
rs = st.executeQuery();
while(rs.next()){
FeedbackModel fbm = new FeedbackModel();
fbm.setMessageId(rs.getLong("message_id"));
fbm.setDeptID(rs.getInt("dept_id"));
fbm.setLevel(rs.getInt("level"));
fbm.setMatNo(rs.getString("matno"));
fbm.setStudentEmail(rs.getString("student_email"));
fbm.setLecturerEmail(rs.getString("lecturer_email"));
fbm.setSubject(rs.getString("subject"));
fbm.setMessage(rs.getString("message"));
fbm.setDate(rs.getDate("date"));
lecturerInboxModel.setLecturerInbox(fbm);
}
}catch(Exception e){
e.printStackTrace();
}
return lecturerInboxModel;
}
}
| 1,423 | 0.728039 | 0.727337 | 52 | 26.365385 | 18.481831 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.269231 | false | false |
5
|
fa5daff6e35581738186ca8d3d931f297d61a7cb
| 14,972,256,005,928 |
75d5a0ea9f69f4ad3ad8a0b54a48a7cb00dcacde
|
/Projects/PracticeCar/src/Engine.java
|
dcc7eea914e2302ecd8f3e7a784af2915cbe2b74
|
[] |
no_license
|
RobertGYoung/javaPracticeWeek1
|
https://github.com/RobertGYoung/javaPracticeWeek1
|
f91023fe647d2dd20b957312bfd195684652e96d
|
cfb73a916456bb940e747b8a7fd1fca0f31fa312
|
refs/heads/master
| 2022-07-08T21:45:02.580000 | 2020-03-05T21:35:41 | 2020-03-05T21:35:41 | 238,370,676 | 0 | 0 | null | false | 2022-06-21T02:52:38 | 2020-02-05T04:51:42 | 2020-03-05T21:39:30 | 2022-06-21T02:52:37 | 2,386 | 0 | 0 | 5 |
Java
| false | false |
public class Engine extends CarPart{
boolean engineIsRunning = false;
Car thisCar=null;
public Engine(Car Car) {
this.thisCar=Car;
}
public void startEngine() {
System.out.println("You try to start the engine..");
if(engineIsRunning==true) {
System.out.println("The engine makes a terrible sound,the engine is already running!");
}
else if(thisCar.carFuelTank.getFuelLevel()==0) {
System.out.println("THere is no fuel, use the fillTank() on the Fuel Tank0- the car did not start");
}
else
System.out.println("Started successfully");
}
public void function(){
if(engineIsRunning==true) {
System.out.println("Engine:Running");
}
else {
System.out.println("Engine:Off, use the startEngine() method");
}
}
}
|
UTF-8
|
Java
| 736 |
java
|
Engine.java
|
Java
|
[] | null |
[] |
public class Engine extends CarPart{
boolean engineIsRunning = false;
Car thisCar=null;
public Engine(Car Car) {
this.thisCar=Car;
}
public void startEngine() {
System.out.println("You try to start the engine..");
if(engineIsRunning==true) {
System.out.println("The engine makes a terrible sound,the engine is already running!");
}
else if(thisCar.carFuelTank.getFuelLevel()==0) {
System.out.println("THere is no fuel, use the fillTank() on the Fuel Tank0- the car did not start");
}
else
System.out.println("Started successfully");
}
public void function(){
if(engineIsRunning==true) {
System.out.println("Engine:Running");
}
else {
System.out.println("Engine:Off, use the startEngine() method");
}
}
}
| 736 | 0.710598 | 0.70788 | 34 | 20.617647 | 26.077953 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.029412 | false | false |
5
|
6bc07878e92b610c8f75eb68925aebb14ede32a5
| 4,406,636,458,318 |
1714a5ddc9093e292457ed59c68d94be27e3117a
|
/errors/NonassignableException.java
|
99efd950c5d715791cffaf731f0a4abb2f0becd8
|
[
"MIT"
] |
permissive
|
chenhsi/Ambroscum
|
https://github.com/chenhsi/Ambroscum
|
d74598f41af64e1fc8688fd60be9d9a8ecf1f45c
|
76053f6fcd9452771fcd4af8fc5580cc0106144b
|
refs/heads/master
| 2020-05-31T06:43:23.006000 | 2015-01-24T08:25:34 | 2015-01-24T08:25:34 | 13,755,652 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ambroscum.errors;
public class NonassignableException extends AmbroscumError {
public NonassignableException(String message) {
super(message);
}
}
|
UTF-8
|
Java
| 161 |
java
|
NonassignableException.java
|
Java
|
[] | null |
[] |
package ambroscum.errors;
public class NonassignableException extends AmbroscumError {
public NonassignableException(String message) {
super(message);
}
}
| 161 | 0.801242 | 0.801242 | 8 | 19.25 | 21.96446 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.875 | false | false |
5
|
f51015e42ac0db31587404bd2b23f14cb3a8d803
| 7,052,336,315,372 |
4608655abd46487c0a21f8f4da09c12d15fec96f
|
/IT1197 IT Innovation Project/src/Administrator/ui/CUpdateActivities.java
|
6ab7946ede7ddd97698b979616406c5f8e101ea9
|
[] |
no_license
|
Enovyne/NYP-Assignments-Projects
|
https://github.com/Enovyne/NYP-Assignments-Projects
|
c70d881dd23b723f7b88a80473b4b061448cc6db
|
4731602f35635c96c9058e9c878a8508a5fca2c1
|
refs/heads/master
| 2021-01-19T00:58:17.497000 | 2016-07-18T13:05:34 | 2016-07-18T13:05:34 | 63,600,849 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Administrator.ui;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;
import HeritageFinalProject.entity.CActivities;
public class CUpdateActivities extends JPanel {
private JFrame myFrame = null;
private CActivities myAc = null;
private JTextField activity;
private JTextField activityDate;
private JTextField activityTime;
private JTextField activityVenue;
private JTextArea activityDescription;
/**
* Create the panel.
* @param myFrame
*/
public CUpdateActivities(JFrame mf, CActivities aa) {
myFrame = mf;
myAc = aa;
setLayout(null);
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
// If Nimbus is not available, you can set the GUI to another look and feel.
}
JLabel lblTitle = new JLabel("");
lblTitle.setIcon(new ImageIcon(CUpdateActivities.class.getResource("/Administrator/images/UpdateActivity.png")));
lblTitle.setBounds(581, 29, 205, 52);
add(lblTitle);
JLabel lblActivity = new JLabel("");
lblActivity.setIcon(new ImageIcon(CUpdateActivities.class.getResource("/Administrator/images/Activity.png")));
lblActivity.setBounds(137, 116, 158, 63);
add(lblActivity);
JLabel lblDate = new JLabel("");
lblDate.setIcon(new ImageIcon(CUpdateActivities.class.getResource("/Administrator/images/Date.png")));
lblDate.setBounds(137, 200, 150, 63);
add(lblDate);
JLabel lblTime = new JLabel("");
lblTime.setIcon(new ImageIcon(CUpdateActivities.class.getResource("/Administrator/images/Time.png")));
lblTime.setBounds(137, 295, 142, 52);
add(lblTime);
JLabel lblVenue = new JLabel("");
lblVenue.setIcon(new ImageIcon(CUpdateActivities.class.getResource("/Administrator/images/Venue.png")));
lblVenue.setBounds(137, 377, 150, 52);
add(lblVenue);
activity = new JTextField();
activity.setBounds(318, 129, 288, 31);
add(activity);
activity.setColumns(10);
activity.setText(myAc.getActivities());
activityDate = new JTextField();
activityDate.setColumns(10);
activityDate.setBounds(318, 210, 288, 31);
add(activityDate);
activityDate.setText(myAc.getDate());
activityTime = new JTextField();
activityTime.setColumns(10);
activityTime.setBounds(318, 305, 288, 31);
add(activityTime);
String time = myAc.getTime();
activityTime.setText(time);
activityVenue = new JTextField();
activityVenue.setColumns(10);
activityVenue.setBounds(318, 386, 288, 31);
add(activityVenue);
activityVenue.setText(myAc.getVenue());
JButton btnOK = new JButton("OK");
btnOK.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
JOptionPane.showMessageDialog(null, "Activity Successfully Updated.", "Message", JOptionPane.DEFAULT_OPTION);
String activities = activity.getText();
String date = activityDate.getText();
String time = activityTime.getText();
String venue = activityVenue.getText();
String description = activityDescription.getText();
String Activitytime = new String(time);
int id = myAc.getId();
CActivities a1 = new CActivities(id, activities, date, Activitytime, venue, description);
a1.updateActivities();
}
});
btnOK.setIcon(null);
btnOK.setBounds(615, 502, 89, 23);
add(btnOK);
JButton btnCancel = new JButton("Back");
btnCancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
JPanel contentPane = new CActivityDetails(myFrame);
myFrame.getContentPane().removeAll();
myFrame.setContentPane(contentPane);
myFrame.setVisible(true);
}
});
btnCancel.setIcon(null);
btnCancel.setBounds(781, 502, 89, 23);
add(btnCancel);
JLabel label = new JLabel("Description");
label.setFont(new Font("Tahoma", Font.PLAIN, 22));
label.setBounds(842, 93, 123, 25);
add(label);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(656, 129, 381, 293);
add(scrollPane);
activityDescription = new JTextArea();
scrollPane.setViewportView(activityDescription);
activityDescription.setText(myAc.getDescription());
JLabel backgroundImg = new JLabel("New label");
backgroundImg.setIcon(new ImageIcon(CUpdateActivities.class.getResource("/Administrator/images/background_linen.png")));
backgroundImg.setBounds(0, -245, 1386, 1309);
add(backgroundImg);
}
}
|
UTF-8
|
Java
| 4,925 |
java
|
CUpdateActivities.java
|
Java
|
[] | null |
[] |
package Administrator.ui;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;
import HeritageFinalProject.entity.CActivities;
public class CUpdateActivities extends JPanel {
private JFrame myFrame = null;
private CActivities myAc = null;
private JTextField activity;
private JTextField activityDate;
private JTextField activityTime;
private JTextField activityVenue;
private JTextArea activityDescription;
/**
* Create the panel.
* @param myFrame
*/
public CUpdateActivities(JFrame mf, CActivities aa) {
myFrame = mf;
myAc = aa;
setLayout(null);
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
// If Nimbus is not available, you can set the GUI to another look and feel.
}
JLabel lblTitle = new JLabel("");
lblTitle.setIcon(new ImageIcon(CUpdateActivities.class.getResource("/Administrator/images/UpdateActivity.png")));
lblTitle.setBounds(581, 29, 205, 52);
add(lblTitle);
JLabel lblActivity = new JLabel("");
lblActivity.setIcon(new ImageIcon(CUpdateActivities.class.getResource("/Administrator/images/Activity.png")));
lblActivity.setBounds(137, 116, 158, 63);
add(lblActivity);
JLabel lblDate = new JLabel("");
lblDate.setIcon(new ImageIcon(CUpdateActivities.class.getResource("/Administrator/images/Date.png")));
lblDate.setBounds(137, 200, 150, 63);
add(lblDate);
JLabel lblTime = new JLabel("");
lblTime.setIcon(new ImageIcon(CUpdateActivities.class.getResource("/Administrator/images/Time.png")));
lblTime.setBounds(137, 295, 142, 52);
add(lblTime);
JLabel lblVenue = new JLabel("");
lblVenue.setIcon(new ImageIcon(CUpdateActivities.class.getResource("/Administrator/images/Venue.png")));
lblVenue.setBounds(137, 377, 150, 52);
add(lblVenue);
activity = new JTextField();
activity.setBounds(318, 129, 288, 31);
add(activity);
activity.setColumns(10);
activity.setText(myAc.getActivities());
activityDate = new JTextField();
activityDate.setColumns(10);
activityDate.setBounds(318, 210, 288, 31);
add(activityDate);
activityDate.setText(myAc.getDate());
activityTime = new JTextField();
activityTime.setColumns(10);
activityTime.setBounds(318, 305, 288, 31);
add(activityTime);
String time = myAc.getTime();
activityTime.setText(time);
activityVenue = new JTextField();
activityVenue.setColumns(10);
activityVenue.setBounds(318, 386, 288, 31);
add(activityVenue);
activityVenue.setText(myAc.getVenue());
JButton btnOK = new JButton("OK");
btnOK.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
JOptionPane.showMessageDialog(null, "Activity Successfully Updated.", "Message", JOptionPane.DEFAULT_OPTION);
String activities = activity.getText();
String date = activityDate.getText();
String time = activityTime.getText();
String venue = activityVenue.getText();
String description = activityDescription.getText();
String Activitytime = new String(time);
int id = myAc.getId();
CActivities a1 = new CActivities(id, activities, date, Activitytime, venue, description);
a1.updateActivities();
}
});
btnOK.setIcon(null);
btnOK.setBounds(615, 502, 89, 23);
add(btnOK);
JButton btnCancel = new JButton("Back");
btnCancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
JPanel contentPane = new CActivityDetails(myFrame);
myFrame.getContentPane().removeAll();
myFrame.setContentPane(contentPane);
myFrame.setVisible(true);
}
});
btnCancel.setIcon(null);
btnCancel.setBounds(781, 502, 89, 23);
add(btnCancel);
JLabel label = new JLabel("Description");
label.setFont(new Font("Tahoma", Font.PLAIN, 22));
label.setBounds(842, 93, 123, 25);
add(label);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(656, 129, 381, 293);
add(scrollPane);
activityDescription = new JTextArea();
scrollPane.setViewportView(activityDescription);
activityDescription.setText(myAc.getDescription());
JLabel backgroundImg = new JLabel("New label");
backgroundImg.setIcon(new ImageIcon(CUpdateActivities.class.getResource("/Administrator/images/background_linen.png")));
backgroundImg.setBounds(0, -245, 1386, 1309);
add(backgroundImg);
}
}
| 4,925 | 0.721421 | 0.687716 | 160 | 29.78125 | 25.26996 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.8625 | false | false |
5
|
c25193beb830d7139982d0f970f3d0adc3ce9e91
| 14,156,212,250,600 |
566de0d34b3a5412fc7dbfc0e5a46fffc593fdac
|
/INTER3WEB2009/inter3web/src/java/cl/inter3/web/form/ArchivosSecForm.java
|
ebb4f86fd744b7a97ae62cd87034aaab05dd805f
|
[] |
no_license
|
ltamaster/inter3web2009
|
https://github.com/ltamaster/inter3web2009
|
dce46bd792bec4a8260a0093ce3c79067d5af5c2
|
5e3d83485c3fbc5bdc936aa63bfe25587fea69db
|
refs/heads/master
| 2016-06-07T18:09:18.626000 | 2016-05-18T03:23:27 | 2016-05-18T03:23:27 | 34,667,807 | 0 | 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 cl.inter3.web.form;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
/**
*
* @author Jcarlitro
*/
public class ArchivosSecForm extends org.apache.struts.action.ActionForm {
private Integer periodoStar;
private Boolean ejecutaProceso;
private Boolean generarZip;
private Map<Short,String> seleccionaArchivo = new HashMap<Short,String>();
private String method;
public Integer getPeriodoStar() {
return periodoStar;
}
public void setPeriodoStar(Integer periodoStar) {
this.periodoStar = periodoStar;
}
public void setSeleccionaArchivo(Map<Short, String> seleccionaArchivo) {
this.seleccionaArchivo = seleccionaArchivo;
}
public Map<Short, String> getSeleccionaArchivo() {
return seleccionaArchivo;
}
public Boolean isEjecutaProceso() {
return ejecutaProceso;
}
public void setEjecutaProceso(Boolean ejecutaProceso) {
this.ejecutaProceso = ejecutaProceso;
}
public Boolean isGenerarZip() {
return generarZip;
}
public void setGenerarZip(Boolean generarZip) {
this.generarZip = generarZip;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
/**
*
*/
public ArchivosSecForm() {
super();
// TODO Auto-generated constructor stub
}
/**
* This is the action called from the Struts framework.
* @param mapping The ActionMapping used to select this instance.
* @param request The HTTP Request we are processing.
* @return
*/
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
return errors;
}
}
|
UTF-8
|
Java
| 2,218 |
java
|
ArchivosSecForm.java
|
Java
|
[
{
"context": "truts.action.ActionMessage;\r\n\r\n/**\r\n *\r\n * @author Jcarlitro\r\n */\r\npublic class ArchivosSecForm extends org.",
"end": 408,
"score": 0.8755229115486145,
"start": 401,
"tag": "USERNAME",
"value": "Jcarlit"
},
{
"context": "tion.ActionMessage;\r\n\r\n/**\r\n *\r\n * @author Jcarlitro\r\n */\r\npublic class ArchivosSecForm extends org.ap",
"end": 410,
"score": 0.873149573802948,
"start": 408,
"tag": "NAME",
"value": "ro"
}
] | null |
[] |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package cl.inter3.web.form;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
/**
*
* @author Jcarlitro
*/
public class ArchivosSecForm extends org.apache.struts.action.ActionForm {
private Integer periodoStar;
private Boolean ejecutaProceso;
private Boolean generarZip;
private Map<Short,String> seleccionaArchivo = new HashMap<Short,String>();
private String method;
public Integer getPeriodoStar() {
return periodoStar;
}
public void setPeriodoStar(Integer periodoStar) {
this.periodoStar = periodoStar;
}
public void setSeleccionaArchivo(Map<Short, String> seleccionaArchivo) {
this.seleccionaArchivo = seleccionaArchivo;
}
public Map<Short, String> getSeleccionaArchivo() {
return seleccionaArchivo;
}
public Boolean isEjecutaProceso() {
return ejecutaProceso;
}
public void setEjecutaProceso(Boolean ejecutaProceso) {
this.ejecutaProceso = ejecutaProceso;
}
public Boolean isGenerarZip() {
return generarZip;
}
public void setGenerarZip(Boolean generarZip) {
this.generarZip = generarZip;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
/**
*
*/
public ArchivosSecForm() {
super();
// TODO Auto-generated constructor stub
}
/**
* This is the action called from the Struts framework.
* @param mapping The ActionMapping used to select this instance.
* @param request The HTTP Request we are processing.
* @return
*/
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
return errors;
}
}
| 2,218 | 0.642922 | 0.642471 | 92 | 22.108696 | 22.757442 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.347826 | false | false |
5
|
c8bfa0c65f13a74c8b76c6f72bbe28283b076255
| 33,483,565,101,937 |
b10de5c6ee4c3141df51999cf02efa94983f518e
|
/src/main/java/handler/StatementHandler.java
|
53bffccaffa12e1410fc0b8afe83d024c6b1e638
|
[] |
no_license
|
yangjianglove/mybatis-custom
|
https://github.com/yangjianglove/mybatis-custom
|
2d7a3659aaa2ceec000b6fa2348d3e2063330cdc
|
52edd3a2ad890033f300e78b1661eba4c1b615cf
|
refs/heads/master
| 2020-09-05T01:47:58.217000 | 2019-11-06T06:57:15 | 2019-11-06T06:57:15 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package handler;
import statement.BoundSql;
import java.sql.ResultSet;
import java.sql.Statement;
/**
* @author lgq
* @date 2019/10/29
*/
public interface StatementHandler {
/**
* 获取sql陈述对象
* @param sql sql语句
* @return 陈述封装对象
*/
Statement getStatement(String sql);
/**
* 真正执行sql
* @param statement 表达式
* @return 处理结果集
*/
ResultSet doExecute(Statement statement);
/**
* 设置参数
* @param statement sql陈述独享
* @param boundSql 封账sql对象
*/
void setParameter(Statement statement, BoundSql boundSql);
}
|
UTF-8
|
Java
| 662 |
java
|
StatementHandler.java
|
Java
|
[
{
"context": "ultSet;\nimport java.sql.Statement;\n\n/**\n * @author lgq\n * @date 2019/10/29\n */\npublic interface Statemen",
"end": 119,
"score": 0.99961256980896,
"start": 116,
"tag": "USERNAME",
"value": "lgq"
}
] | null |
[] |
package handler;
import statement.BoundSql;
import java.sql.ResultSet;
import java.sql.Statement;
/**
* @author lgq
* @date 2019/10/29
*/
public interface StatementHandler {
/**
* 获取sql陈述对象
* @param sql sql语句
* @return 陈述封装对象
*/
Statement getStatement(String sql);
/**
* 真正执行sql
* @param statement 表达式
* @return 处理结果集
*/
ResultSet doExecute(Statement statement);
/**
* 设置参数
* @param statement sql陈述独享
* @param boundSql 封账sql对象
*/
void setParameter(Statement statement, BoundSql boundSql);
}
| 662 | 0.619454 | 0.605802 | 36 | 15.277778 | 14.812928 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | false | false |
5
|
062ecf9c5f32f70ccdfb1a729a8a92d559d04628
| 60,129,567,208 |
3712b8fc6537e8dd74aa33840ca5e0f4e20c5c59
|
/src/main/java/com/wrh/framework/utils/Calendar.java
|
142ac0bd9e919f29a15b302b86ea4aa43257d492
|
[] |
no_license
|
rumatto/wms-test-cu-project
|
https://github.com/rumatto/wms-test-cu-project
|
9b9c0b879f36bb75ff56853ce3e5ec095a6ef0e2
|
3e52b4588d32f11b199e238d7c25e84878231044
|
refs/heads/master
| 2019-03-20T06:44:09.020000 | 2018-11-26T00:54:10 | 2018-11-26T00:54:10 | 123,871,371 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package main.java.com.wrh.framework.utils;
import org.openqa.selenium.WebElement;
import ru.yandex.qatools.htmlelements.element.HtmlElement;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
public class Calendar extends HtmlElement {
private String dateFormat = "yyyy/MM/dd";
public void selectLastActiveDays(List<WebElement> elements){
elements.get(elements.size() - 1).click();
}
public void selectFirstActiveDays(List<WebElement> elements){
elements.get(0).click();
}
public LocalDate getDateFromString(String dateString) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
return LocalDate.parse(dateString, formatter);
}
public String getStringFromDate(LocalDate date) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
return date.format(formatter);
}
public String getStringFromDate(LocalDate date, String dateFormat) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
return date.format(formatter);
}
public String getStringFromDateTime(LocalDateTime dateTime, String dateFormat) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
return dateTime.format(formatter);
}
public String getToday() {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
return LocalDate.now().format(formatter);
}
public String getToday(String dateFormat) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
return LocalDate.now().format(formatter);
}
public String getTodayDateTime(String dateFormat) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
return LocalDateTime.now().format(formatter);
}
public String getDateInPastInDays(String dateString, int howManyDaysInPast) {
LocalDate date = getDateFromString(dateString);
return getStringFromDate(date.minusDays(howManyDaysInPast));
}
public String getDateInPastInDays(String dateString, int howManyDaysInPast, String dateFormat) {
LocalDate date = getDateFromString(dateString);
return getStringFromDate(date.minusDays(howManyDaysInPast), dateFormat);
}
public String getDateInPastInYears(String dateString, int howManyYearsInPast) {
LocalDate date = getDateFromString(dateString);
return getStringFromDate(date.minusYears(howManyYearsInPast));
}
public String getDateInFutureInDays(String dateString, int howManyDaysInFuture) {
LocalDate date = getDateFromString(dateString);
return getStringFromDate(date.plusDays(howManyDaysInFuture));
}
public String getDateInFutureInDays(String dateString, int howManyDaysInFuture, String dateFormat) {
LocalDate date = getDateFromString(dateString);
return getStringFromDate(date.plusDays(howManyDaysInFuture), dateFormat);
}
public String getCurrentDate() {
LocalDate date = LocalDate.now();
return getStringFromDate(date);
}
public String getCurrentDate(String dateFormat) {
LocalDate date = LocalDate.now();
return getStringFromDate(date, dateFormat);
}
public String setDate(LocalDate date, String dateFormat) {
return getStringFromDate(date, dateFormat);
}
public String getTomorrow() {
return getDateInFutureInDays(getCurrentDate(), 1);
}
public Date getTomorrowsDate(){
return new Date(new Date().getTime() + (1000 * 60 * 60 * 24));
}
public String getYesterday(){
return getDateInPastInDays(getToday(),1);
}
}
|
UTF-8
|
Java
| 3,604 |
java
|
Calendar.java
|
Java
|
[] | null |
[] |
package main.java.com.wrh.framework.utils;
import org.openqa.selenium.WebElement;
import ru.yandex.qatools.htmlelements.element.HtmlElement;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
public class Calendar extends HtmlElement {
private String dateFormat = "yyyy/MM/dd";
public void selectLastActiveDays(List<WebElement> elements){
elements.get(elements.size() - 1).click();
}
public void selectFirstActiveDays(List<WebElement> elements){
elements.get(0).click();
}
public LocalDate getDateFromString(String dateString) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
return LocalDate.parse(dateString, formatter);
}
public String getStringFromDate(LocalDate date) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
return date.format(formatter);
}
public String getStringFromDate(LocalDate date, String dateFormat) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
return date.format(formatter);
}
public String getStringFromDateTime(LocalDateTime dateTime, String dateFormat) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
return dateTime.format(formatter);
}
public String getToday() {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
return LocalDate.now().format(formatter);
}
public String getToday(String dateFormat) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
return LocalDate.now().format(formatter);
}
public String getTodayDateTime(String dateFormat) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(dateFormat);
return LocalDateTime.now().format(formatter);
}
public String getDateInPastInDays(String dateString, int howManyDaysInPast) {
LocalDate date = getDateFromString(dateString);
return getStringFromDate(date.minusDays(howManyDaysInPast));
}
public String getDateInPastInDays(String dateString, int howManyDaysInPast, String dateFormat) {
LocalDate date = getDateFromString(dateString);
return getStringFromDate(date.minusDays(howManyDaysInPast), dateFormat);
}
public String getDateInPastInYears(String dateString, int howManyYearsInPast) {
LocalDate date = getDateFromString(dateString);
return getStringFromDate(date.minusYears(howManyYearsInPast));
}
public String getDateInFutureInDays(String dateString, int howManyDaysInFuture) {
LocalDate date = getDateFromString(dateString);
return getStringFromDate(date.plusDays(howManyDaysInFuture));
}
public String getDateInFutureInDays(String dateString, int howManyDaysInFuture, String dateFormat) {
LocalDate date = getDateFromString(dateString);
return getStringFromDate(date.plusDays(howManyDaysInFuture), dateFormat);
}
public String getCurrentDate() {
LocalDate date = LocalDate.now();
return getStringFromDate(date);
}
public String getCurrentDate(String dateFormat) {
LocalDate date = LocalDate.now();
return getStringFromDate(date, dateFormat);
}
public String setDate(LocalDate date, String dateFormat) {
return getStringFromDate(date, dateFormat);
}
public String getTomorrow() {
return getDateInFutureInDays(getCurrentDate(), 1);
}
public Date getTomorrowsDate(){
return new Date(new Date().getTime() + (1000 * 60 * 60 * 24));
}
public String getYesterday(){
return getDateInPastInDays(getToday(),1);
}
}
| 3,604 | 0.763873 | 0.759989 | 110 | 30.763636 | 28.78981 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.618182 | false | false |
5
|
08d81903b94ea3a809fe61b8cdcb6962e30202aa
| 27,668,179,359,325 |
f17a8f4dd140532ee10730639f86b62683985c58
|
/src/main/java/com/cisco/axl/api/_8/AddAppServerInfoReq.java
|
3fdcca84bba9fc7c299aa0dc9ea94be27dda6eb1
|
[
"Apache-2.0"
] |
permissive
|
alexpekurovsky/cucm-http-api
|
https://github.com/alexpekurovsky/cucm-http-api
|
16f1b2f54cff4dcdc57cf6407c2a40ac8302a82a
|
a1eabf49cc9a05c8293ba07ae97f2fe724a6e24d
|
refs/heads/master
| 2021-01-15T14:19:10.994000 | 2013-04-04T15:32:08 | 2013-04-04T15:32:08 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cisco.axl.api._8;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for AddAppServerInfoReq complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="AddAppServerInfoReq">
* <complexContent>
* <extension base="{http://www.cisco.com/AXL/API/8.0}APIRequest">
* <sequence>
* <element name="appServerInfo" type="{http://www.cisco.com/AXL/API/8.0}XAppServerInfo"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AddAppServerInfoReq", propOrder = {
"appServerInfo"
})
public class AddAppServerInfoReq
extends APIRequest
{
@XmlElement(required = true)
protected XAppServerInfo appServerInfo;
/**
* Gets the value of the appServerInfo property.
*
* @return
* possible object is
* {@link XAppServerInfo }
*
*/
public XAppServerInfo getAppServerInfo() {
return appServerInfo;
}
/**
* Sets the value of the appServerInfo property.
*
* @param value
* allowed object is
* {@link XAppServerInfo }
*
*/
public void setAppServerInfo(XAppServerInfo value) {
this.appServerInfo = value;
}
}
|
UTF-8
|
Java
| 1,557 |
java
|
AddAppServerInfoReq.java
|
Java
|
[] | null |
[] |
package com.cisco.axl.api._8;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for AddAppServerInfoReq complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="AddAppServerInfoReq">
* <complexContent>
* <extension base="{http://www.cisco.com/AXL/API/8.0}APIRequest">
* <sequence>
* <element name="appServerInfo" type="{http://www.cisco.com/AXL/API/8.0}XAppServerInfo"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AddAppServerInfoReq", propOrder = {
"appServerInfo"
})
public class AddAppServerInfoReq
extends APIRequest
{
@XmlElement(required = true)
protected XAppServerInfo appServerInfo;
/**
* Gets the value of the appServerInfo property.
*
* @return
* possible object is
* {@link XAppServerInfo }
*
*/
public XAppServerInfo getAppServerInfo() {
return appServerInfo;
}
/**
* Sets the value of the appServerInfo property.
*
* @param value
* allowed object is
* {@link XAppServerInfo }
*
*/
public void setAppServerInfo(XAppServerInfo value) {
this.appServerInfo = value;
}
}
| 1,557 | 0.64483 | 0.641618 | 63 | 23.698412 | 22.955191 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false |
5
|
d4f532fc7be0beee7dc19ff36d973ff7f9f306a1
| 38,585,986,189,588 |
c22bf202ddccb92846d17ee368a05220c743a95d
|
/Projects/Birthday/app/src/main/java/com/mab/birthday/Surprise1.java
|
33b09cc0086bbd0fec1757e215716387aeb612a8
|
[] |
no_license
|
MonisBana/code_6
|
https://github.com/MonisBana/code_6
|
f953fcceacc014846194ef5460edbbf4473674ae
|
83b0656cc43e1822e2376e67f12e4cd680b9edcf
|
refs/heads/master
| 2021-04-15T16:41:06.408000 | 2018-03-27T19:20:41 | 2018-03-27T19:20:41 | 126,568,012 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mab.birthday;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class Surprise1 extends AppCompatActivity {
private Button mSurprise1Btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_surprise1);
mSurprise1Btn = findViewById(R.id.surpriseBtn);
mSurprise1Btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Surprise1.this,Surprise2.class);
startActivity(intent);
}
});
}
}
|
UTF-8
|
Java
| 782 |
java
|
Surprise1.java
|
Java
|
[] | null |
[] |
package com.mab.birthday;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class Surprise1 extends AppCompatActivity {
private Button mSurprise1Btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_surprise1);
mSurprise1Btn = findViewById(R.id.surpriseBtn);
mSurprise1Btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Surprise1.this,Surprise2.class);
startActivity(intent);
}
});
}
}
| 782 | 0.686701 | 0.676471 | 24 | 31.583334 | 21.134325 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.583333 | false | false |
5
|
1c81fa60739c82279cb9da5172eb25aba2c64b81
| 33,956,011,469,405 |
6d3f4f31b6f6fc034162464204e997dbddcaf854
|
/app/src/main/java/cu/pabloapk/ganga/views/asynctask/ListAnuncioAsyncTask.java
|
d0d5ba72a044c8347d5265952f354cbc9180fd7e
|
[] |
no_license
|
pemiro91/ganga
|
https://github.com/pemiro91/ganga
|
ffc46eef68d14b31548f44229deddb4470980fbe
|
80d0741b74e41578190892aad7697f6457b3f6d0
|
refs/heads/master
| 2020-09-05T10:28:06.624000 | 2019-11-06T19:33:14 | 2019-11-06T19:33:14 | 220,073,902 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cu.pabloapk.ganga.views.asynctask;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
import java.util.Objects;
import cu.pabloapk.ganga.R;
import cu.pabloapk.ganga.models.Anuncio;
import cu.pabloapk.ganga.models.api.ApiGanga;
import cu.pabloapk.ganga.models.api.ApiInterfaceGanga;
import cu.pabloapk.ganga.utils.GangaPreference;
import cu.pabloapk.ganga.utils.GangaUtils;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import static cu.pabloapk.ganga.views.activity.NavigationActivity.fab;
import static cu.pabloapk.ganga.views.activity.NavigationActivity.pestanasinfo;
import static cu.pabloapk.ganga.views.fragment.BuscarAnuncioFragment.ListDataComplete;
import static cu.pabloapk.ganga.views.fragment.BuscarAnuncioFragment.adapter;
import static cu.pabloapk.ganga.views.fragment.BuscarAnuncioFragment.id_reintentar;
import static cu.pabloapk.ganga.views.fragment.BuscarAnuncioFragment.linear_no_connexion;
import static cu.pabloapk.ganga.views.fragment.BuscarAnuncioFragment.listAdapter;
import static cu.pabloapk.ganga.views.fragment.BuscarAnuncioFragment.recyclerView_producto;
import static cu.pabloapk.ganga.views.fragment.BuscarAnuncioFragment.refreshLayout;
public class ListAnuncioAsyncTask extends AsyncTask<Void, Void, Boolean> {
@SuppressLint("StaticFieldLeak")
private Context context;
private GangaPreference preference;
private List<Anuncio.AnuncioObjet> anuncioObjetList;
public ListAnuncioAsyncTask(Context context) {
this.context = context;
preference=new GangaPreference(context);
}
@Override
protected Boolean doInBackground(Void... voids) {
ApiInterfaceGanga apiInterfaceGanga= Objects.requireNonNull(ApiGanga.INSTANCE.getClient()).create(ApiInterfaceGanga.class);
apiInterfaceGanga.getAnuncios().enqueue(new Callback<Anuncio>() {
@Override
public void onResponse(@NonNull Call<Anuncio> call, @NonNull Response<Anuncio> response) {
if (response.isSuccessful()){
refreshLayout.setRefreshing(false);
assert response.body() != null;
anuncioObjetList=response.body().getAnuncioObjetList();
switch (preference.getModeList()){
case 0:
RecyclerView.LayoutManager lManager = new GridLayoutManager(context,2);
recyclerView_producto.setLayoutManager(lManager);
adapter.addAll(anuncioObjetList);
break;
case 1:
RecyclerView.LayoutManager lManagerlist = new LinearLayoutManager(context);
recyclerView_producto.setLayoutManager(lManagerlist);
listAdapter.addAll(anuncioObjetList);
break;
}
}
else {
// Toast.makeText(context,"Name error:"+response.errorBody(),Toast.LENGTH_LONG).show();
Toast.makeText(context,context.getString(R.string.error_conexion),Toast.LENGTH_SHORT).show();
linear_no_connexion.setVisibility(View.VISIBLE);
refreshLayout.setVisibility(View.GONE);
fab.setVisibility(View.GONE);
pestanasinfo.setVisibility(View.GONE);
refreshLayout.setRefreshing(false);
id_reintentar.setOnClickListener(view -> {
if (!GangaUtils.isNetworkAvailable()){
Toast.makeText(context,context.getString(R.string.no_hay),Toast.LENGTH_SHORT).show();
linear_no_connexion.setVisibility(View.VISIBLE);
refreshLayout.setVisibility(View.GONE);
fab.setVisibility(View.GONE);
pestanasinfo.setVisibility(View.GONE);
}else {
refreshLayout.setVisibility(View.VISIBLE);
linear_no_connexion.setVisibility(View.GONE);
fab.setVisibility(View.VISIBLE);
pestanasinfo.setVisibility(View.VISIBLE);
ListDataComplete();
}
});
Log.d("TAG","Name error:"+response.errorBody());
}
}
@Override
public void onFailure(@NonNull Call<Anuncio> call, @NonNull Throwable t) {
Toast.makeText(context,context.getString(R.string.no_hay),Toast.LENGTH_SHORT).show();
linear_no_connexion.setVisibility(View.VISIBLE);
refreshLayout.setVisibility(View.GONE);
fab.setVisibility(View.GONE);
pestanasinfo.setVisibility(View.GONE);
// Toast.makeText(context, "Error "+t.toString(), Toast.LENGTH_SHORT).show();
Log.d("TAG","Response = "+t.toString());
id_reintentar.setOnClickListener(view -> {
if (!GangaUtils.isNetworkAvailable()){
Toast.makeText(context,context.getString(R.string.no_hay),Toast.LENGTH_SHORT).show();
linear_no_connexion.setVisibility(View.VISIBLE);
refreshLayout.setVisibility(View.GONE);
fab.setVisibility(View.GONE);
pestanasinfo.setVisibility(View.GONE);
}else {
refreshLayout.setVisibility(View.VISIBLE);
linear_no_connexion.setVisibility(View.GONE);
fab.setVisibility(View.VISIBLE);
pestanasinfo.setVisibility(View.VISIBLE);
ListDataComplete();
}
});
}
});
return true;
}
@Override
protected void onPostExecute(Boolean aBoolean) {
super.onPostExecute(aBoolean);
refreshLayout.setRefreshing(false);
}
@Override
protected void onCancelled() {
super.onCancelled();
refreshLayout.setRefreshing(false);
}
}
|
UTF-8
|
Java
| 6,631 |
java
|
ListAnuncioAsyncTask.java
|
Java
|
[] | null |
[] |
package cu.pabloapk.ganga.views.asynctask;
import android.annotation.SuppressLint;
import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
import java.util.Objects;
import cu.pabloapk.ganga.R;
import cu.pabloapk.ganga.models.Anuncio;
import cu.pabloapk.ganga.models.api.ApiGanga;
import cu.pabloapk.ganga.models.api.ApiInterfaceGanga;
import cu.pabloapk.ganga.utils.GangaPreference;
import cu.pabloapk.ganga.utils.GangaUtils;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import static cu.pabloapk.ganga.views.activity.NavigationActivity.fab;
import static cu.pabloapk.ganga.views.activity.NavigationActivity.pestanasinfo;
import static cu.pabloapk.ganga.views.fragment.BuscarAnuncioFragment.ListDataComplete;
import static cu.pabloapk.ganga.views.fragment.BuscarAnuncioFragment.adapter;
import static cu.pabloapk.ganga.views.fragment.BuscarAnuncioFragment.id_reintentar;
import static cu.pabloapk.ganga.views.fragment.BuscarAnuncioFragment.linear_no_connexion;
import static cu.pabloapk.ganga.views.fragment.BuscarAnuncioFragment.listAdapter;
import static cu.pabloapk.ganga.views.fragment.BuscarAnuncioFragment.recyclerView_producto;
import static cu.pabloapk.ganga.views.fragment.BuscarAnuncioFragment.refreshLayout;
public class ListAnuncioAsyncTask extends AsyncTask<Void, Void, Boolean> {
@SuppressLint("StaticFieldLeak")
private Context context;
private GangaPreference preference;
private List<Anuncio.AnuncioObjet> anuncioObjetList;
public ListAnuncioAsyncTask(Context context) {
this.context = context;
preference=new GangaPreference(context);
}
@Override
protected Boolean doInBackground(Void... voids) {
ApiInterfaceGanga apiInterfaceGanga= Objects.requireNonNull(ApiGanga.INSTANCE.getClient()).create(ApiInterfaceGanga.class);
apiInterfaceGanga.getAnuncios().enqueue(new Callback<Anuncio>() {
@Override
public void onResponse(@NonNull Call<Anuncio> call, @NonNull Response<Anuncio> response) {
if (response.isSuccessful()){
refreshLayout.setRefreshing(false);
assert response.body() != null;
anuncioObjetList=response.body().getAnuncioObjetList();
switch (preference.getModeList()){
case 0:
RecyclerView.LayoutManager lManager = new GridLayoutManager(context,2);
recyclerView_producto.setLayoutManager(lManager);
adapter.addAll(anuncioObjetList);
break;
case 1:
RecyclerView.LayoutManager lManagerlist = new LinearLayoutManager(context);
recyclerView_producto.setLayoutManager(lManagerlist);
listAdapter.addAll(anuncioObjetList);
break;
}
}
else {
// Toast.makeText(context,"Name error:"+response.errorBody(),Toast.LENGTH_LONG).show();
Toast.makeText(context,context.getString(R.string.error_conexion),Toast.LENGTH_SHORT).show();
linear_no_connexion.setVisibility(View.VISIBLE);
refreshLayout.setVisibility(View.GONE);
fab.setVisibility(View.GONE);
pestanasinfo.setVisibility(View.GONE);
refreshLayout.setRefreshing(false);
id_reintentar.setOnClickListener(view -> {
if (!GangaUtils.isNetworkAvailable()){
Toast.makeText(context,context.getString(R.string.no_hay),Toast.LENGTH_SHORT).show();
linear_no_connexion.setVisibility(View.VISIBLE);
refreshLayout.setVisibility(View.GONE);
fab.setVisibility(View.GONE);
pestanasinfo.setVisibility(View.GONE);
}else {
refreshLayout.setVisibility(View.VISIBLE);
linear_no_connexion.setVisibility(View.GONE);
fab.setVisibility(View.VISIBLE);
pestanasinfo.setVisibility(View.VISIBLE);
ListDataComplete();
}
});
Log.d("TAG","Name error:"+response.errorBody());
}
}
@Override
public void onFailure(@NonNull Call<Anuncio> call, @NonNull Throwable t) {
Toast.makeText(context,context.getString(R.string.no_hay),Toast.LENGTH_SHORT).show();
linear_no_connexion.setVisibility(View.VISIBLE);
refreshLayout.setVisibility(View.GONE);
fab.setVisibility(View.GONE);
pestanasinfo.setVisibility(View.GONE);
// Toast.makeText(context, "Error "+t.toString(), Toast.LENGTH_SHORT).show();
Log.d("TAG","Response = "+t.toString());
id_reintentar.setOnClickListener(view -> {
if (!GangaUtils.isNetworkAvailable()){
Toast.makeText(context,context.getString(R.string.no_hay),Toast.LENGTH_SHORT).show();
linear_no_connexion.setVisibility(View.VISIBLE);
refreshLayout.setVisibility(View.GONE);
fab.setVisibility(View.GONE);
pestanasinfo.setVisibility(View.GONE);
}else {
refreshLayout.setVisibility(View.VISIBLE);
linear_no_connexion.setVisibility(View.GONE);
fab.setVisibility(View.VISIBLE);
pestanasinfo.setVisibility(View.VISIBLE);
ListDataComplete();
}
});
}
});
return true;
}
@Override
protected void onPostExecute(Boolean aBoolean) {
super.onPostExecute(aBoolean);
refreshLayout.setRefreshing(false);
}
@Override
protected void onCancelled() {
super.onCancelled();
refreshLayout.setRefreshing(false);
}
}
| 6,631 | 0.615443 | 0.614538 | 143 | 45.370628 | 29.966339 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.769231 | false | false |
5
|
4a70c6a2b8bf58ff75fd3dcaf33f7c7f700be6c3
| 35,948,876,283,419 |
60d84db72f61519370c4346d2bfeefdbba2819f1
|
/ggserver-core/ggserver-core-common/src/main/java/xzcode/ggserver/core/common/message/response/Response.java
|
ad117aa479123179f5046845f934f5c8efe00e5b
|
[] |
no_license
|
0Wmcc/ggserver
|
https://github.com/0Wmcc/ggserver
|
56ec683a1e29b8f50803bc65fcb3a154c8b08869
|
522ddc8d19b5ccce29ab0c17d30718f1988e45cc
|
refs/heads/master
| 2020-12-04T01:45:33.041000 | 2019-12-28T11:33:43 | 2019-12-28T11:33:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package xzcode.ggserver.core.common.message.response;
import xzcode.ggserver.core.common.session.GGSession;
/**
* 消息响应模型
*
* @author zai 2019-07-28 15:34:08
*/
public class Response {
// 会话对象
private GGSession session;
// 消息体
private Object metadata;
// 发送消息标识
private String action;
// 消息体
private Object message;
public Response(GGSession session, Object metadata, String action, Object message) {
this.session = session;
this.metadata = metadata;
this.action = action;
this.message = message;
}
public Response(Object metadata, String action, Object message) {
this.metadata = metadata;
this.action = action;
this.message = message;
}
public Response(String action, Object message) {
this.action = action;
this.message = message;
}
public String getAction() {
return action;
}
public Object getMessage() {
return message;
}
public GGSession getSession() {
return session;
}
public Object getMetadata() {
return metadata;
}
public void setMetadata(Object metadata) {
this.metadata = metadata;
}
}
|
UTF-8
|
Java
| 1,123 |
java
|
Response.java
|
Java
|
[
{
"context": "n.session.GGSession;\n\n/**\n * 消息响应模型\n * \n * @author zai 2019-07-28 15:34:08\n */\npublic class Response {\n\n",
"end": 142,
"score": 0.9980617761611938,
"start": 139,
"tag": "USERNAME",
"value": "zai"
}
] | null |
[] |
package xzcode.ggserver.core.common.message.response;
import xzcode.ggserver.core.common.session.GGSession;
/**
* 消息响应模型
*
* @author zai 2019-07-28 15:34:08
*/
public class Response {
// 会话对象
private GGSession session;
// 消息体
private Object metadata;
// 发送消息标识
private String action;
// 消息体
private Object message;
public Response(GGSession session, Object metadata, String action, Object message) {
this.session = session;
this.metadata = metadata;
this.action = action;
this.message = message;
}
public Response(Object metadata, String action, Object message) {
this.metadata = metadata;
this.action = action;
this.message = message;
}
public Response(String action, Object message) {
this.action = action;
this.message = message;
}
public String getAction() {
return action;
}
public Object getMessage() {
return message;
}
public GGSession getSession() {
return session;
}
public Object getMetadata() {
return metadata;
}
public void setMetadata(Object metadata) {
this.metadata = metadata;
}
}
| 1,123 | 0.702502 | 0.689527 | 61 | 16.688524 | 18.265385 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.426229 | false | false |
5
|
c6dd85e06edca64d6b62d48f5c65e39a2cc8f737
| 4,509,715,697,516 |
a31f6971501130e198b7699fd7fc8fdddd61413d
|
/src/com/onetrip/app/com_apply/AcomList_ByCityAction.java
|
4a61f855ba3ae5a4fc4c544d76875a99c1d5f452
|
[] |
no_license
|
kimminhow524/onetrip_jsp-team-project
|
https://github.com/kimminhow524/onetrip_jsp-team-project
|
94f63039302aab1f7e6d19c0f0500519ea806318
|
fff395aabb47acd1328667e96759ff8807ba78d7
|
refs/heads/master
| 2022-11-22T09:07:46.821000 | 2020-07-30T12:36:22 | 2020-07-30T12:36:22 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.onetrip.app.com_apply;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.onetrip.action.Action;
import com.onetrip.action.ActionForward;
import com.onetrip.app.com_apply.dao.Com_Apply_DAO;
public class AcomList_ByCityAction implements Action {
@Override
public ActionForward execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
ActionForward forward = new ActionForward();
Com_Apply_DAO acom_dao = new Com_Apply_DAO();
HttpSession session = request.getSession();
int city_num;
System.out.println(request.getParameter("query"));
try {
if(request.getParameter("query")==null) {
city_num=(int)session.getAttribute("search");
}else {
//검색결과가 없을 경우 IndexOfBounds exception 발생
city_num = acom_dao.checkCityNum(request.getParameter("query")).get(0);
session.setAttribute("search", city_num);
}
} catch (Exception e) {
request.setAttribute("boardList",null);
forward.setRedirect(false);
forward.setPath("/app/plan/companionListByCity.jsp");
return forward;
}
String temp = request.getParameter("page");
int page = temp == null ? 1 : Integer.parseInt(temp);
int pageSize=12;
int totalCnt=acom_dao.getSearchListCnt(city_num);
int endRow = page*pageSize;
int startRow = endRow-pageSize+1;
int startPage = ((page - 1) / pageSize) * pageSize + 1;
int endPage = startPage + 9;
int totalPage = (totalCnt - 1) / pageSize + 1;
endPage = endPage > totalPage ? totalPage : endPage;
request.setAttribute("totalPage", totalPage);
request.setAttribute("totalCnt", totalCnt);
request.setAttribute("nowPage", page);
request.setAttribute("startPage", startPage);
request.setAttribute("endPage", endPage);
request.setAttribute("boardList",acom_dao.getAcomByCity(startRow, endRow, city_num));
forward.setRedirect(false);
forward.setPath("/app/plan/companionListByCity.jsp");
return forward;
}
}
|
UTF-8
|
Java
| 2,137 |
java
|
AcomList_ByCityAction.java
|
Java
|
[] | null |
[] |
package com.onetrip.app.com_apply;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.onetrip.action.Action;
import com.onetrip.action.ActionForward;
import com.onetrip.app.com_apply.dao.Com_Apply_DAO;
public class AcomList_ByCityAction implements Action {
@Override
public ActionForward execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
ActionForward forward = new ActionForward();
Com_Apply_DAO acom_dao = new Com_Apply_DAO();
HttpSession session = request.getSession();
int city_num;
System.out.println(request.getParameter("query"));
try {
if(request.getParameter("query")==null) {
city_num=(int)session.getAttribute("search");
}else {
//검색결과가 없을 경우 IndexOfBounds exception 발생
city_num = acom_dao.checkCityNum(request.getParameter("query")).get(0);
session.setAttribute("search", city_num);
}
} catch (Exception e) {
request.setAttribute("boardList",null);
forward.setRedirect(false);
forward.setPath("/app/plan/companionListByCity.jsp");
return forward;
}
String temp = request.getParameter("page");
int page = temp == null ? 1 : Integer.parseInt(temp);
int pageSize=12;
int totalCnt=acom_dao.getSearchListCnt(city_num);
int endRow = page*pageSize;
int startRow = endRow-pageSize+1;
int startPage = ((page - 1) / pageSize) * pageSize + 1;
int endPage = startPage + 9;
int totalPage = (totalCnt - 1) / pageSize + 1;
endPage = endPage > totalPage ? totalPage : endPage;
request.setAttribute("totalPage", totalPage);
request.setAttribute("totalCnt", totalCnt);
request.setAttribute("nowPage", page);
request.setAttribute("startPage", startPage);
request.setAttribute("endPage", endPage);
request.setAttribute("boardList",acom_dao.getAcomByCity(startRow, endRow, city_num));
forward.setRedirect(false);
forward.setPath("/app/plan/companionListByCity.jsp");
return forward;
}
}
| 2,137 | 0.72766 | 0.721986 | 69 | 29.652174 | 24.102333 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.391304 | false | false |
5
|
1a98023d80a976a1173c0fe97d91c0993cd7d81f
| 33,689,723,502,645 |
65398b21f50237154eda4ff6ed22da65df7e2cea
|
/HotelWebSite/src/dbPackage/DBUser.java
|
a10987fc9f1cbb83bd13864bdee75103247e06ba
|
[] |
no_license
|
katrinalander/HotelWebSite
|
https://github.com/katrinalander/HotelWebSite
|
1067c3a58bea6083ebb7dc58f06959a18ed0a553
|
f7c4342176a8386542b7829630efe720a3037a62
|
refs/heads/master
| 2020-12-24T15:58:04.388000 | 2017-06-21T20:42:40 | 2017-06-21T20:42:40 | 14,339,147 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package dbPackage;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
import com.mysql.jdbc.ResultSet;
import com.mysql.jdbc.Statement;
import core.MailNotification;
import core.User;
public class DBUser {
public boolean validLogin(String email, String password) throws Exception{
boolean status = false;
Connection con = ConnectionDB.getInstance().getConnection();
Statement stm = (Statement)con.createStatement();
User user = getUser(email);
if(email.equals(user.getEmail()) && password.equals(user.getPassword())){
System.out.println("You login in");
status = true;
}
// else if(user.getPassword().equals(password)){
// System.out.println("You login in");
// status = true;
// }
else{
System.out.println("You put wrong password");
}
return status;
}
public void insertUser (User user) throws Exception{
Connection con=ConnectionDB.getInstance().getConnection();
PreparedStatement pstm=(PreparedStatement)con.prepareStatement("insert into users(user_name, email, address, phone, password) values(?,?,?,?,?)");
pstm.setString(1, user.getUser_name());
pstm.setString(2, user.getEmail());
pstm.setString(3, user.getAddress());
pstm.setString(4, user.getPhone());
pstm.setString(5, user.getPassword());
pstm.execute();
//-------------------Building message email---------------------------------------------
String email = user.getEmail();
String password = user.getPassword();
String subject = "Create an account on Paradise hotel web site";
String text = "<img src=\"cid:image\">"+
"<h3>This message was generated automatically for "+email+", from <a href=\"http://localhost:8080/HotelWebSite/\" style=\"color:#ff9911\">Paradise.hotel</a></h3>" +
"<h3>Your created account with success on site Paradise hotel. For login to your account please use next:</h3>" +
"<p>E-mail: <b>"+email+"</b></p>" +
"<p>Password: <b>"+password+"</b></p>" +
"<h3>We hope that you will like to use the services of our hotel.</h3>";
MailNotification mn = new MailNotification(email,subject,text);
mn.run();
}//insert user
public String getUserName (String email) throws Exception{
String name =null;
System.out.println("email="+email);
Connection con = ConnectionDB.getInstance().getConnection();
Statement stm = (Statement) con.createStatement();
ResultSet rs = (ResultSet)stm.executeQuery("select * from users where email = '"+email+"'");
while(rs.next()){
name = rs.getString("user_name");
}//while
System.out.println("name from dbuser="+name);
return name;
}
public User getUser(String email){
User user = new User();
try {
Connection con=ConnectionDB.getInstance().getConnection();
Statement stm=(Statement) con.createStatement();
ResultSet rs = (ResultSet) stm.executeQuery("select * from users where email = '"+ email+"'");
while(rs.next() ){
user.setAddress (rs.getString("address"));
user.setUser_name (rs.getString("user_name"));
user.setEmail (rs.getString("email"));
user.setPassword (rs.getString("password"));
user.setPhone (rs.getString("phone"));
}//while
}
catch (Exception e) {
e.printStackTrace();
}//catch
finally{
return user;
}//finally
}//metod getUser by email
public void deleteUser(String email) throws Exception{
Connection con=ConnectionDB.getInstance().getConnection();
PreparedStatement pstm=(PreparedStatement) con.prepareStatement("delete from users where email = '" + email +"'");
pstm.execute();
//----------------Creating message-----------------------------------
String subject ="Your account was delete from Paradise hotel web site";
String text = "<img src=\"cid:image\">"+
"<h5>You delete Your account from <a href=\"http://localhost:8080/HotelWebSite/\" style=\"color:#ff9911\">Paradise hotel web site</a>. Now You can't use our online serveces.</h5>" +
"<h5>We apologize if our service was not so good for You.</h5>";
MailNotification mn = new MailNotification(email,subject,text);
mn.run();
}//delete user
public void updateUser(User user)throws Exception{
Connection con=ConnectionDB.getInstance().getConnection();
PreparedStatement pstm=(PreparedStatement) con.prepareStatement("update users set user_name=?,email=?,address=?,phone=?,password=? " +
"where email='"+user.getEmail()+"'");
pstm.setString(1, user.getUser_name());
pstm.setString(2, user.getEmail());
pstm.setString(3, user.getAddress());
pstm.setString(4, user.getPhone());
pstm.setString(5, user.getPassword());
pstm.execute();
}//update user
}
|
UTF-8
|
Java
| 4,739 |
java
|
DBUser.java
|
Java
|
[
{
"context": "g email = user.getEmail();\r\n\t String password = user.getPassword();\r\n\t String subject = \"Create an account on P",
"end": 1507,
"score": 0.998856246471405,
"start": 1491,
"tag": "PASSWORD",
"value": "user.getPassword"
},
{
"context": "<b>\"+email+\"</b></p>\" +\r\n \t\t\t\t\"<p>Password: <b>\"+password+\"</b></p>\" +\r\n \t\t\t\t\"<h3>We hope that you will li",
"end": 1998,
"score": 0.5396966338157654,
"start": 1990,
"tag": "PASSWORD",
"value": "password"
},
{
"context": "(\"email\"));\r\n\t\t\tuser.setPassword (rs.getString(\"password\"));\r\n\t\t\tuser.setPhone (rs.getString(\"phone\")",
"end": 3182,
"score": 0.8647699952125549,
"start": 3174,
"tag": "PASSWORD",
"value": "password"
}
] | null |
[] |
package dbPackage;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement;
import com.mysql.jdbc.ResultSet;
import com.mysql.jdbc.Statement;
import core.MailNotification;
import core.User;
public class DBUser {
public boolean validLogin(String email, String password) throws Exception{
boolean status = false;
Connection con = ConnectionDB.getInstance().getConnection();
Statement stm = (Statement)con.createStatement();
User user = getUser(email);
if(email.equals(user.getEmail()) && password.equals(user.getPassword())){
System.out.println("You login in");
status = true;
}
// else if(user.getPassword().equals(password)){
// System.out.println("You login in");
// status = true;
// }
else{
System.out.println("You put wrong password");
}
return status;
}
public void insertUser (User user) throws Exception{
Connection con=ConnectionDB.getInstance().getConnection();
PreparedStatement pstm=(PreparedStatement)con.prepareStatement("insert into users(user_name, email, address, phone, password) values(?,?,?,?,?)");
pstm.setString(1, user.getUser_name());
pstm.setString(2, user.getEmail());
pstm.setString(3, user.getAddress());
pstm.setString(4, user.getPhone());
pstm.setString(5, user.getPassword());
pstm.execute();
//-------------------Building message email---------------------------------------------
String email = user.getEmail();
String password = <PASSWORD>();
String subject = "Create an account on Paradise hotel web site";
String text = "<img src=\"cid:image\">"+
"<h3>This message was generated automatically for "+email+", from <a href=\"http://localhost:8080/HotelWebSite/\" style=\"color:#ff9911\">Paradise.hotel</a></h3>" +
"<h3>Your created account with success on site Paradise hotel. For login to your account please use next:</h3>" +
"<p>E-mail: <b>"+email+"</b></p>" +
"<p>Password: <b>"+<PASSWORD>+"</b></p>" +
"<h3>We hope that you will like to use the services of our hotel.</h3>";
MailNotification mn = new MailNotification(email,subject,text);
mn.run();
}//insert user
public String getUserName (String email) throws Exception{
String name =null;
System.out.println("email="+email);
Connection con = ConnectionDB.getInstance().getConnection();
Statement stm = (Statement) con.createStatement();
ResultSet rs = (ResultSet)stm.executeQuery("select * from users where email = '"+email+"'");
while(rs.next()){
name = rs.getString("user_name");
}//while
System.out.println("name from dbuser="+name);
return name;
}
public User getUser(String email){
User user = new User();
try {
Connection con=ConnectionDB.getInstance().getConnection();
Statement stm=(Statement) con.createStatement();
ResultSet rs = (ResultSet) stm.executeQuery("select * from users where email = '"+ email+"'");
while(rs.next() ){
user.setAddress (rs.getString("address"));
user.setUser_name (rs.getString("user_name"));
user.setEmail (rs.getString("email"));
user.setPassword (rs.getString("<PASSWORD>"));
user.setPhone (rs.getString("phone"));
}//while
}
catch (Exception e) {
e.printStackTrace();
}//catch
finally{
return user;
}//finally
}//metod getUser by email
public void deleteUser(String email) throws Exception{
Connection con=ConnectionDB.getInstance().getConnection();
PreparedStatement pstm=(PreparedStatement) con.prepareStatement("delete from users where email = '" + email +"'");
pstm.execute();
//----------------Creating message-----------------------------------
String subject ="Your account was delete from Paradise hotel web site";
String text = "<img src=\"cid:image\">"+
"<h5>You delete Your account from <a href=\"http://localhost:8080/HotelWebSite/\" style=\"color:#ff9911\">Paradise hotel web site</a>. Now You can't use our online serveces.</h5>" +
"<h5>We apologize if our service was not so good for You.</h5>";
MailNotification mn = new MailNotification(email,subject,text);
mn.run();
}//delete user
public void updateUser(User user)throws Exception{
Connection con=ConnectionDB.getInstance().getConnection();
PreparedStatement pstm=(PreparedStatement) con.prepareStatement("update users set user_name=?,email=?,address=?,phone=?,password=? " +
"where email='"+user.getEmail()+"'");
pstm.setString(1, user.getUser_name());
pstm.setString(2, user.getEmail());
pstm.setString(3, user.getAddress());
pstm.setString(4, user.getPhone());
pstm.setString(5, user.getPassword());
pstm.execute();
}//update user
}
| 4,737 | 0.659844 | 0.652247 | 113 | 39.938053 | 34.296799 | 185 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.690265 | false | false |
5
|
9d887eee9af4c0b77258a68487b4faeaf8d90e0a
| 30,288,109,407,298 |
d30ac305d531eda086e40ef4eede88a076544753
|
/JavaMain/src/com/dw/algorithmlib/BinaryTree.java
|
291f1032da0712c58937fa47a56187727ce490f9
|
[
"MIT"
] |
permissive
|
emacslisp/Java
|
https://github.com/emacslisp/Java
|
ab777701f9ae945f210dfe6715a14518f303f85c
|
114a56c3d4b9846cac54e9ef3b9b4cab331df867
|
refs/heads/dev
| 2022-12-21T14:00:45.303000 | 2022-10-15T01:01:07 | 2022-10-15T01:01:07 | 78,067,300 | 0 | 0 |
MIT
| false | 2022-12-10T03:31:55 | 2017-01-05T01:24:08 | 2021-12-08T12:56:25 | 2022-12-10T03:31:54 | 60,308 | 0 | 0 | 6 |
Java
| false | false |
package com.dw.algorithmlib;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
public class BinaryTree {
TreeNode root;
/**
* calc treeHigh which is maxDepth
* @param node
* @return Tree high
*/
public int treeHigh(TreeNode node)
{
if (node == null)
return 0;
else
{
/* compute the depth of each subtree */
int lDepth = treeHigh(node.left);
int rDepth = treeHigh(node.right);
/* use the larger one */
if (lDepth > rDepth)
return (lDepth + 1);
else
return (rDepth + 1);
}
}
/**
* Calculate Number of Tree Element
* @return Number of Tree Element
*/
int size()
{
return size(root);
}
int size(TreeNode node)
{
if (node == null)
return 0;
else
return(size(node.left) + 1 + size(node.right));
}
void mirror()
{
root = mirror(root);
}
TreeNode mirror(TreeNode node)
{
if (node == null)
return node;
/* do the subtrees */
TreeNode left = mirror(node.left);
TreeNode right = mirror(node.right);
/* swap the left and right pointers */
node.left = right;
node.right = left;
return node;
}
void inOrder()
{
inOrder(root);
}
/* Helper function to test mirror(). Given a binary
search tree, print out its data elements in
increasing sorted order.*/
void inOrder(TreeNode node)
{
if (node == null)
return;
inOrder(node.left);
System.out.print(node.val + " ");
inOrder(node.right);
}
boolean isEqual(TreeNode node, TreeNode n) {
if(node == null && n== null) return true;
if(node == null || n== null) return false;
if(node.val != n.val)
return false;
return isEqual(node.left, n.left) && isEqual(node.right, n.right);
}
public boolean isSubtree(TreeNode root, TreeNode subRoot) {
if(root == null) return false;
if(root.val == subRoot.val && isEqual(root, subRoot)) {
return true;
}
return isSubtree(root.right, subRoot) || isSubtree(root.left, subRoot);
}
void deleteTree(TreeNode node)
{
// In Java automatic garbage collection
// happens, so we can simply make root
// null to delete the tree
root = null;
}
/* Wrapper function that deletes the tree and
sets root node as null */
void deleteTreeRef(TreeNode nodeRef)
{
if(nodeRef == null) return;
deleteTreeRef(nodeRef.left);
deleteTreeRef(nodeRef.right);
System.out.println("Deleting node:" + nodeRef.val);
deleteTree(nodeRef);
nodeRef=null;
}
// ===============================
int leftNode(int i) {
return 2*i+1;
}
int rightNode(int i) {
return 2*i+2;
}
/**
* Convert Tree to Array
* @param root - Tree Root Node
* @return List<Integer> - List of Integer
*/
public List<Integer> treeToArray(TreeNode root) {
Queue<TreeNode> q = new LinkedList<>();
q.add(root);
List<Integer> result = new ArrayList<>();
while(q.size() > 0) {
TreeNode p = q.peek();
if(p == null) {
result.add(null);
q.poll();
continue;
}
result.add(p.val);
q.poll();
if(p.left == null && p.right == null) continue;
q.add(p.left);
q.add(p.right);
}
return result;
}
public TreeNode arrayToTree2(Integer[] a) {
Queue<TreeNode> q = new LinkedList<>();
TreeNode head = new TreeNode(a[0].intValue());
q.add(head);
TreeNode cur = null;
int count = 0;
for (int i = 1; i < a.length; i++) {
TreeNode node = null;
if(a[i] != null)
node = new TreeNode(a[i].intValue());
if(count == 0){
cur = q.poll();
}
if(count==0){
count++;
cur.left = node;
}else {
count = 0;
cur.right = node;
}
if(node != null){
q.add(node);
}
}
return head;
}
public TreeNode arrayToTree(Integer[] a) {
// Integer[] a = {6,7,8,2,7,1,3,9,null,1,4,null,null,null,5};
Queue<Integer> q = new LinkedList<>();
q.add(0);
TreeNode head = new TreeNode(a[0].intValue());
HashMap<Integer, TreeNode> map = new HashMap<>();
map.put(0, head);
while(q.size() > 0) {
Integer index = q.poll();
if(a[index] == null) {
continue;
}
if(map.get(index) == null) {
map.put(index, new TreeNode(a[index].intValue()));
}
TreeNode node = map.get(index);
int left = leftNode(index.intValue());
int right = rightNode(index.intValue());
if(left < a.length && a[left] != null) {
map.put(left, new TreeNode(a[left]));
node.left = map.get(left);
q.add(left);
}
if (right < a.length && a[right] != null) {
map.put(right, new TreeNode(a[right]));
node.right = map.get(right);
q.add(right);
}
}
return head;
}
// ============================
public static void main(String[] args) {
// TODO Auto-generated method stub
BinaryTree tree = new BinaryTree();
Integer[] a = {1, 2, 3, 4, null, null, 5};
tree.root = tree.arrayToTree2(a);
List<Integer> list = tree.treeToArray(tree.root);
// Arrays.stream(list.toArray()).map(x -> x).forEach(System.out::println);
for(Integer x : list) {
System.out.print(x);
System.out.print("\t");
}
System.out.print("\n");
System.out.println("Height of tree is : " +
tree.treeHigh(tree.root));
System.out.println("The size of binary tree is : "
+ tree.size());
System.out.println("Inorder traversal of input tree is :");
tree.inOrder();
System.out.println("");
/* convert tree to its mirror */
tree.mirror();
/* print inorder traversal of the minor tree */
System.out.println("Inorder traversal of binary tree is : ");
tree.inOrder();
tree.deleteTreeRef(tree.root);
System.out.println("Tree deleted");
}
}
|
UTF-8
|
Java
| 6,907 |
java
|
BinaryTree.java
|
Java
|
[] | null |
[] |
package com.dw.algorithmlib;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
public class BinaryTree {
TreeNode root;
/**
* calc treeHigh which is maxDepth
* @param node
* @return Tree high
*/
public int treeHigh(TreeNode node)
{
if (node == null)
return 0;
else
{
/* compute the depth of each subtree */
int lDepth = treeHigh(node.left);
int rDepth = treeHigh(node.right);
/* use the larger one */
if (lDepth > rDepth)
return (lDepth + 1);
else
return (rDepth + 1);
}
}
/**
* Calculate Number of Tree Element
* @return Number of Tree Element
*/
int size()
{
return size(root);
}
int size(TreeNode node)
{
if (node == null)
return 0;
else
return(size(node.left) + 1 + size(node.right));
}
void mirror()
{
root = mirror(root);
}
TreeNode mirror(TreeNode node)
{
if (node == null)
return node;
/* do the subtrees */
TreeNode left = mirror(node.left);
TreeNode right = mirror(node.right);
/* swap the left and right pointers */
node.left = right;
node.right = left;
return node;
}
void inOrder()
{
inOrder(root);
}
/* Helper function to test mirror(). Given a binary
search tree, print out its data elements in
increasing sorted order.*/
void inOrder(TreeNode node)
{
if (node == null)
return;
inOrder(node.left);
System.out.print(node.val + " ");
inOrder(node.right);
}
boolean isEqual(TreeNode node, TreeNode n) {
if(node == null && n== null) return true;
if(node == null || n== null) return false;
if(node.val != n.val)
return false;
return isEqual(node.left, n.left) && isEqual(node.right, n.right);
}
public boolean isSubtree(TreeNode root, TreeNode subRoot) {
if(root == null) return false;
if(root.val == subRoot.val && isEqual(root, subRoot)) {
return true;
}
return isSubtree(root.right, subRoot) || isSubtree(root.left, subRoot);
}
void deleteTree(TreeNode node)
{
// In Java automatic garbage collection
// happens, so we can simply make root
// null to delete the tree
root = null;
}
/* Wrapper function that deletes the tree and
sets root node as null */
void deleteTreeRef(TreeNode nodeRef)
{
if(nodeRef == null) return;
deleteTreeRef(nodeRef.left);
deleteTreeRef(nodeRef.right);
System.out.println("Deleting node:" + nodeRef.val);
deleteTree(nodeRef);
nodeRef=null;
}
// ===============================
int leftNode(int i) {
return 2*i+1;
}
int rightNode(int i) {
return 2*i+2;
}
/**
* Convert Tree to Array
* @param root - Tree Root Node
* @return List<Integer> - List of Integer
*/
public List<Integer> treeToArray(TreeNode root) {
Queue<TreeNode> q = new LinkedList<>();
q.add(root);
List<Integer> result = new ArrayList<>();
while(q.size() > 0) {
TreeNode p = q.peek();
if(p == null) {
result.add(null);
q.poll();
continue;
}
result.add(p.val);
q.poll();
if(p.left == null && p.right == null) continue;
q.add(p.left);
q.add(p.right);
}
return result;
}
public TreeNode arrayToTree2(Integer[] a) {
Queue<TreeNode> q = new LinkedList<>();
TreeNode head = new TreeNode(a[0].intValue());
q.add(head);
TreeNode cur = null;
int count = 0;
for (int i = 1; i < a.length; i++) {
TreeNode node = null;
if(a[i] != null)
node = new TreeNode(a[i].intValue());
if(count == 0){
cur = q.poll();
}
if(count==0){
count++;
cur.left = node;
}else {
count = 0;
cur.right = node;
}
if(node != null){
q.add(node);
}
}
return head;
}
public TreeNode arrayToTree(Integer[] a) {
// Integer[] a = {6,7,8,2,7,1,3,9,null,1,4,null,null,null,5};
Queue<Integer> q = new LinkedList<>();
q.add(0);
TreeNode head = new TreeNode(a[0].intValue());
HashMap<Integer, TreeNode> map = new HashMap<>();
map.put(0, head);
while(q.size() > 0) {
Integer index = q.poll();
if(a[index] == null) {
continue;
}
if(map.get(index) == null) {
map.put(index, new TreeNode(a[index].intValue()));
}
TreeNode node = map.get(index);
int left = leftNode(index.intValue());
int right = rightNode(index.intValue());
if(left < a.length && a[left] != null) {
map.put(left, new TreeNode(a[left]));
node.left = map.get(left);
q.add(left);
}
if (right < a.length && a[right] != null) {
map.put(right, new TreeNode(a[right]));
node.right = map.get(right);
q.add(right);
}
}
return head;
}
// ============================
public static void main(String[] args) {
// TODO Auto-generated method stub
BinaryTree tree = new BinaryTree();
Integer[] a = {1, 2, 3, 4, null, null, 5};
tree.root = tree.arrayToTree2(a);
List<Integer> list = tree.treeToArray(tree.root);
// Arrays.stream(list.toArray()).map(x -> x).forEach(System.out::println);
for(Integer x : list) {
System.out.print(x);
System.out.print("\t");
}
System.out.print("\n");
System.out.println("Height of tree is : " +
tree.treeHigh(tree.root));
System.out.println("The size of binary tree is : "
+ tree.size());
System.out.println("Inorder traversal of input tree is :");
tree.inOrder();
System.out.println("");
/* convert tree to its mirror */
tree.mirror();
/* print inorder traversal of the minor tree */
System.out.println("Inorder traversal of binary tree is : ");
tree.inOrder();
tree.deleteTreeRef(tree.root);
System.out.println("Tree deleted");
}
}
| 6,907 | 0.495584 | 0.490083 | 293 | 22.57338 | 17.999022 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.187713 | false | false |
5
|
0ece1123bde0e85a1414a06fe98bf00cab998d1a
| 17,575,006,225,619 |
447520f40e82a060368a0802a391697bc00be96f
|
/apks/playstore_apps/com_idamob_tinkoff_android/source/io/reactivex/d/g/n.java
|
08a3d6d5021586b4956cc67e5e2264040f06bd54
|
[
"Apache-2.0"
] |
permissive
|
iantal/AndroidPermissions
|
https://github.com/iantal/AndroidPermissions
|
7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465
|
d623b732734243590b5f004d167e542e2e2ae249
|
refs/heads/master
| 2023-07-19T01:29:26.689000 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 |
Apache-2.0
| false | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | 2019-09-30T19:01:44 | 2023-07-16T07:41:38 | 1,616,319 | 0 | 0 | 1 | null | false | false |
package io.reactivex.d.g;
import io.reactivex.b.b;
import io.reactivex.b.c;
import io.reactivex.d.a.d;
import io.reactivex.g.a;
import io.reactivex.x;
import io.reactivex.x.c;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public final class n
extends x
{
private static final n b = new n();
n() {}
public static n c()
{
return b;
}
public final b a(Runnable paramRunnable)
{
a.a(paramRunnable).run();
return d.a;
}
public final b a(Runnable paramRunnable, long paramLong, TimeUnit paramTimeUnit)
{
try
{
paramTimeUnit.sleep(paramLong);
a.a(paramRunnable).run();
return d.a;
}
catch (InterruptedException paramRunnable)
{
for (;;)
{
Thread.currentThread().interrupt();
a.a(paramRunnable);
}
}
}
public final x.c a()
{
return new c();
}
static final class a
implements Runnable
{
private final Runnable a;
private final n.c b;
private final long c;
a(Runnable paramRunnable, n.c paramC, long paramLong)
{
this.a = paramRunnable;
this.b = paramC;
this.c = paramLong;
}
public final void run()
{
long l1;
long l2;
if (!this.b.c)
{
l1 = n.c.a(TimeUnit.MILLISECONDS);
if (this.c > l1) {
l2 = this.c;
}
}
try
{
Thread.sleep(l2 - l1);
if (!this.b.c) {
this.a.run();
}
return;
}
catch (InterruptedException localInterruptedException)
{
Thread.currentThread().interrupt();
a.a(localInterruptedException);
}
}
}
static final class b
implements Comparable<b>
{
final Runnable a;
final long b;
final int c;
volatile boolean d;
b(Runnable paramRunnable, Long paramLong, int paramInt)
{
this.a = paramRunnable;
this.b = paramLong.longValue();
this.c = paramInt;
}
}
static final class c
extends x.c
implements b
{
final PriorityBlockingQueue<n.b> a = new PriorityBlockingQueue();
final AtomicInteger b = new AtomicInteger();
volatile boolean c;
private final AtomicInteger d = new AtomicInteger();
c() {}
private b a(Runnable paramRunnable, long paramLong)
{
if (this.c) {
return d.a;
}
paramRunnable = new n.b(paramRunnable, Long.valueOf(paramLong), this.b.incrementAndGet());
this.a.add(paramRunnable);
int i;
if (this.d.getAndIncrement() == 0) {
i = 1;
}
for (;;)
{
if (this.c)
{
this.a.clear();
return d.a;
}
paramRunnable = (n.b)this.a.poll();
if (paramRunnable != null)
{
if (!paramRunnable.d) {
paramRunnable.a.run();
}
}
else
{
i = this.d.addAndGet(-i);
if (i == 0)
{
return d.a;
return c.a(new a(paramRunnable));
}
}
}
}
public final b a(Runnable paramRunnable)
{
return a(paramRunnable, a(TimeUnit.MILLISECONDS));
}
public final b a(Runnable paramRunnable, long paramLong, TimeUnit paramTimeUnit)
{
paramLong = a(TimeUnit.MILLISECONDS) + paramTimeUnit.toMillis(paramLong);
return a(new n.a(paramRunnable, this, paramLong), paramLong);
}
public final void b()
{
this.c = true;
}
public final boolean c()
{
return this.c;
}
final class a
implements Runnable
{
final n.b a;
a(n.b paramB)
{
this.a = paramB;
}
public final void run()
{
this.a.d = true;
n.c.this.a.remove(this.a);
}
}
}
}
|
UTF-8
|
Java
| 3,942 |
java
|
n.java
|
Java
|
[] | null |
[] |
package io.reactivex.d.g;
import io.reactivex.b.b;
import io.reactivex.b.c;
import io.reactivex.d.a.d;
import io.reactivex.g.a;
import io.reactivex.x;
import io.reactivex.x.c;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public final class n
extends x
{
private static final n b = new n();
n() {}
public static n c()
{
return b;
}
public final b a(Runnable paramRunnable)
{
a.a(paramRunnable).run();
return d.a;
}
public final b a(Runnable paramRunnable, long paramLong, TimeUnit paramTimeUnit)
{
try
{
paramTimeUnit.sleep(paramLong);
a.a(paramRunnable).run();
return d.a;
}
catch (InterruptedException paramRunnable)
{
for (;;)
{
Thread.currentThread().interrupt();
a.a(paramRunnable);
}
}
}
public final x.c a()
{
return new c();
}
static final class a
implements Runnable
{
private final Runnable a;
private final n.c b;
private final long c;
a(Runnable paramRunnable, n.c paramC, long paramLong)
{
this.a = paramRunnable;
this.b = paramC;
this.c = paramLong;
}
public final void run()
{
long l1;
long l2;
if (!this.b.c)
{
l1 = n.c.a(TimeUnit.MILLISECONDS);
if (this.c > l1) {
l2 = this.c;
}
}
try
{
Thread.sleep(l2 - l1);
if (!this.b.c) {
this.a.run();
}
return;
}
catch (InterruptedException localInterruptedException)
{
Thread.currentThread().interrupt();
a.a(localInterruptedException);
}
}
}
static final class b
implements Comparable<b>
{
final Runnable a;
final long b;
final int c;
volatile boolean d;
b(Runnable paramRunnable, Long paramLong, int paramInt)
{
this.a = paramRunnable;
this.b = paramLong.longValue();
this.c = paramInt;
}
}
static final class c
extends x.c
implements b
{
final PriorityBlockingQueue<n.b> a = new PriorityBlockingQueue();
final AtomicInteger b = new AtomicInteger();
volatile boolean c;
private final AtomicInteger d = new AtomicInteger();
c() {}
private b a(Runnable paramRunnable, long paramLong)
{
if (this.c) {
return d.a;
}
paramRunnable = new n.b(paramRunnable, Long.valueOf(paramLong), this.b.incrementAndGet());
this.a.add(paramRunnable);
int i;
if (this.d.getAndIncrement() == 0) {
i = 1;
}
for (;;)
{
if (this.c)
{
this.a.clear();
return d.a;
}
paramRunnable = (n.b)this.a.poll();
if (paramRunnable != null)
{
if (!paramRunnable.d) {
paramRunnable.a.run();
}
}
else
{
i = this.d.addAndGet(-i);
if (i == 0)
{
return d.a;
return c.a(new a(paramRunnable));
}
}
}
}
public final b a(Runnable paramRunnable)
{
return a(paramRunnable, a(TimeUnit.MILLISECONDS));
}
public final b a(Runnable paramRunnable, long paramLong, TimeUnit paramTimeUnit)
{
paramLong = a(TimeUnit.MILLISECONDS) + paramTimeUnit.toMillis(paramLong);
return a(new n.a(paramRunnable, this, paramLong), paramLong);
}
public final void b()
{
this.c = true;
}
public final boolean c()
{
return this.c;
}
final class a
implements Runnable
{
final n.b a;
a(n.b paramB)
{
this.a = paramB;
}
public final void run()
{
this.a.d = true;
n.c.this.a.remove(this.a);
}
}
}
}
| 3,942 | 0.54135 | 0.538813 | 197 | 19.010153 | 17.796364 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.436548 | false | false |
5
|
a35db3fd5c27a4b1168d9c458668627aee3ccf3f
| 3,994,319,626,934 |
e2f45ecf6e97194fb3e0e1de7f8ee8e492d40d0d
|
/过/MiZhiTu2.1/src/main/java/com/zhipin/project/mzt/app/domain/Customer.java
|
1e42dd9991ac2aec493fa94d89516ac2b7f69a83
|
[] |
no_license
|
jiahangLee/gitbook
|
https://github.com/jiahangLee/gitbook
|
bbf8cb15d96d1b75740b0bfb8c4f9caab304fbeb
|
f7ac273a48191ad3ef8e12725aef9a748e0d023c
|
refs/heads/master
| 2021-06-05T23:35:57.718000 | 2020-01-09T09:58:16 | 2020-01-09T09:58:16 | 131,944,358 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zhipin.project.mzt.app.domain;
import java.util.Date;
public class Customer {
private Integer id;
private String customerName;
private String customerHead;
private String customerPassword;
private String customerPhone;
private String customerBorn;
private String zsName;
private String customerSex;
private Integer customerAge;
private String censusRegister;
private String address;
private String customerEmail;
private String customerSchool;
private String customerMajor;
private String education;
private String schoolCollega;
private String schoolTime;
private String caitanStatus;
private Date caitanCreatTime;
private String realName;
private String customerCollege;
private String convenientCommunication;
private String customerStatus;
private Integer loginStatus;
private String resource;
private String selfEvaluation;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String getCustomerHead() {
return customerHead;
}
public void setCustomerHead(String customerHead) {
this.customerHead = customerHead;
}
public String getCustomerPassword() {
return customerPassword;
}
public void setCustomerPassword(String customerPassword) {
this.customerPassword = customerPassword;
}
public String getCustomerPhone() {
return customerPhone;
}
public void setCustomerPhone(String customerPhone) {
this.customerPhone = customerPhone;
}
public String getCustomerBorn() {
return customerBorn;
}
public void setCustomerBorn(String customerBorn) {
this.customerBorn = customerBorn;
}
public String getZsName() {
return zsName;
}
public void setZsName(String zsName) {
this.zsName = zsName;
}
public String getCustomerSex() {
return customerSex;
}
public void setCustomerSex(String customerSex) {
this.customerSex = customerSex;
}
public Integer getCustomerAge() {
return customerAge;
}
public void setCustomerAge(Integer customerAge) {
this.customerAge = customerAge;
}
public String getCensusRegister() {
return censusRegister;
}
public void setCensusRegister(String censusRegister) {
this.censusRegister = censusRegister;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCustomerEmail() {
return customerEmail;
}
public void setCustomerEmail(String customerEmail) {
this.customerEmail = customerEmail;
}
public String getCustomerSchool() {
return customerSchool;
}
public void setCustomerSchool(String customerSchool) {
this.customerSchool = customerSchool;
}
public String getCustomerMajor() {
return customerMajor;
}
public void setCustomerMajor(String customerMajor) {
this.customerMajor = customerMajor;
}
public String getEducation() {
return education;
}
public void setEducation(String education) {
this.education = education;
}
public String getSchoolCollega() {
return schoolCollega;
}
public void setSchoolCollega(String schoolCollega) {
this.schoolCollega = schoolCollega;
}
public String getSchoolTime() {
return schoolTime;
}
public void setSchoolTime(String schoolTime) {
this.schoolTime = schoolTime;
}
public String getCaitanStatus() {
return caitanStatus;
}
public void setCaitanStatus(String caitanStatus) {
this.caitanStatus = caitanStatus;
}
public Date getCaitanCreatTime() {
return caitanCreatTime;
}
public void setCaitanCreatTime(Date caitanCreatTime) {
this.caitanCreatTime = caitanCreatTime;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getCustomerCollege() {
return customerCollege;
}
public void setCustomerCollege(String customerCollege) {
this.customerCollege = customerCollege;
}
public String getConvenientCommunication() {
return convenientCommunication;
}
public void setConvenientCommunication(String convenientCommunication) {
this.convenientCommunication = convenientCommunication;
}
public String getCustomerStatus() {
return customerStatus;
}
public void setCustomerStatus(String customerStatus) {
this.customerStatus = customerStatus;
}
public Integer getLoginStatus() {
return loginStatus;
}
public void setLoginStatus(Integer loginStatus) {
this.loginStatus = loginStatus;
}
public String getResource() {
return resource;
}
public void setResource(String resource) {
this.resource = resource;
}
public String getSelfEvaluation() {
return selfEvaluation;
}
public void setSelfEvaluation(String selfEvaluation) {
this.selfEvaluation = selfEvaluation;
}
@Override
public String toString() {
return "Customer{" +
"id=" + id +
", customerName='" + customerName + '\'' +
", customerHead='" + customerHead + '\'' +
", customerPassword='" + customerPassword + '\'' +
", customerPhone='" + customerPhone + '\'' +
", customerBorn='" + customerBorn + '\'' +
", zsName='" + zsName + '\'' +
", customerSex='" + customerSex + '\'' +
", customerAge=" + customerAge +
", censusRegister='" + censusRegister + '\'' +
", address='" + address + '\'' +
", customerEmail='" + customerEmail + '\'' +
", customerSchool='" + customerSchool + '\'' +
", customerMajor='" + customerMajor + '\'' +
", education='" + education + '\'' +
", schoolCollega='" + schoolCollega + '\'' +
", schoolTime='" + schoolTime + '\'' +
", caitanStatus='" + caitanStatus + '\'' +
", caitanCreatTime=" + caitanCreatTime +
", realName='" + realName + '\'' +
", customerCollege='" + customerCollege + '\'' +
", convenientCommunication='" + convenientCommunication + '\'' +
", customerStatus='" + customerStatus + '\'' +
", loginStatus=" + loginStatus +
", resource='" + resource + '\'' +
", selfEvaluation='" + selfEvaluation + '\'' +
'}';
}
}
|
UTF-8
|
Java
| 7,174 |
java
|
Customer.java
|
Java
|
[
{
"context": " \"id=\" + id +\n \", customerName='\" + customerName + '\\'' +\n \", customerHead='\" +",
"end": 5727,
"score": 0.7177587747573853,
"start": 5719,
"tag": "NAME",
"value": "customer"
},
{
"context": " + '\\'' +\n \", customerPassword='\" + customerPassword + '\\'' +\n \", customerPhone",
"end": 5849,
"score": 0.979076623916626,
"start": 5841,
"tag": "PASSWORD",
"value": "customer"
}
] | null |
[] |
package com.zhipin.project.mzt.app.domain;
import java.util.Date;
public class Customer {
private Integer id;
private String customerName;
private String customerHead;
private String customerPassword;
private String customerPhone;
private String customerBorn;
private String zsName;
private String customerSex;
private Integer customerAge;
private String censusRegister;
private String address;
private String customerEmail;
private String customerSchool;
private String customerMajor;
private String education;
private String schoolCollega;
private String schoolTime;
private String caitanStatus;
private Date caitanCreatTime;
private String realName;
private String customerCollege;
private String convenientCommunication;
private String customerStatus;
private Integer loginStatus;
private String resource;
private String selfEvaluation;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String getCustomerHead() {
return customerHead;
}
public void setCustomerHead(String customerHead) {
this.customerHead = customerHead;
}
public String getCustomerPassword() {
return customerPassword;
}
public void setCustomerPassword(String customerPassword) {
this.customerPassword = customerPassword;
}
public String getCustomerPhone() {
return customerPhone;
}
public void setCustomerPhone(String customerPhone) {
this.customerPhone = customerPhone;
}
public String getCustomerBorn() {
return customerBorn;
}
public void setCustomerBorn(String customerBorn) {
this.customerBorn = customerBorn;
}
public String getZsName() {
return zsName;
}
public void setZsName(String zsName) {
this.zsName = zsName;
}
public String getCustomerSex() {
return customerSex;
}
public void setCustomerSex(String customerSex) {
this.customerSex = customerSex;
}
public Integer getCustomerAge() {
return customerAge;
}
public void setCustomerAge(Integer customerAge) {
this.customerAge = customerAge;
}
public String getCensusRegister() {
return censusRegister;
}
public void setCensusRegister(String censusRegister) {
this.censusRegister = censusRegister;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCustomerEmail() {
return customerEmail;
}
public void setCustomerEmail(String customerEmail) {
this.customerEmail = customerEmail;
}
public String getCustomerSchool() {
return customerSchool;
}
public void setCustomerSchool(String customerSchool) {
this.customerSchool = customerSchool;
}
public String getCustomerMajor() {
return customerMajor;
}
public void setCustomerMajor(String customerMajor) {
this.customerMajor = customerMajor;
}
public String getEducation() {
return education;
}
public void setEducation(String education) {
this.education = education;
}
public String getSchoolCollega() {
return schoolCollega;
}
public void setSchoolCollega(String schoolCollega) {
this.schoolCollega = schoolCollega;
}
public String getSchoolTime() {
return schoolTime;
}
public void setSchoolTime(String schoolTime) {
this.schoolTime = schoolTime;
}
public String getCaitanStatus() {
return caitanStatus;
}
public void setCaitanStatus(String caitanStatus) {
this.caitanStatus = caitanStatus;
}
public Date getCaitanCreatTime() {
return caitanCreatTime;
}
public void setCaitanCreatTime(Date caitanCreatTime) {
this.caitanCreatTime = caitanCreatTime;
}
public String getRealName() {
return realName;
}
public void setRealName(String realName) {
this.realName = realName;
}
public String getCustomerCollege() {
return customerCollege;
}
public void setCustomerCollege(String customerCollege) {
this.customerCollege = customerCollege;
}
public String getConvenientCommunication() {
return convenientCommunication;
}
public void setConvenientCommunication(String convenientCommunication) {
this.convenientCommunication = convenientCommunication;
}
public String getCustomerStatus() {
return customerStatus;
}
public void setCustomerStatus(String customerStatus) {
this.customerStatus = customerStatus;
}
public Integer getLoginStatus() {
return loginStatus;
}
public void setLoginStatus(Integer loginStatus) {
this.loginStatus = loginStatus;
}
public String getResource() {
return resource;
}
public void setResource(String resource) {
this.resource = resource;
}
public String getSelfEvaluation() {
return selfEvaluation;
}
public void setSelfEvaluation(String selfEvaluation) {
this.selfEvaluation = selfEvaluation;
}
@Override
public String toString() {
return "Customer{" +
"id=" + id +
", customerName='" + customerName + '\'' +
", customerHead='" + customerHead + '\'' +
", customerPassword='" + <PASSWORD>Password + '\'' +
", customerPhone='" + customerPhone + '\'' +
", customerBorn='" + customerBorn + '\'' +
", zsName='" + zsName + '\'' +
", customerSex='" + customerSex + '\'' +
", customerAge=" + customerAge +
", censusRegister='" + censusRegister + '\'' +
", address='" + address + '\'' +
", customerEmail='" + customerEmail + '\'' +
", customerSchool='" + customerSchool + '\'' +
", customerMajor='" + customerMajor + '\'' +
", education='" + education + '\'' +
", schoolCollega='" + schoolCollega + '\'' +
", schoolTime='" + schoolTime + '\'' +
", caitanStatus='" + caitanStatus + '\'' +
", caitanCreatTime=" + caitanCreatTime +
", realName='" + realName + '\'' +
", customerCollege='" + customerCollege + '\'' +
", convenientCommunication='" + convenientCommunication + '\'' +
", customerStatus='" + customerStatus + '\'' +
", loginStatus=" + loginStatus +
", resource='" + resource + '\'' +
", selfEvaluation='" + selfEvaluation + '\'' +
'}';
}
}
| 7,176 | 0.609284 | 0.609284 | 297 | 23.154882 | 21.405409 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.356902 | false | false |
5
|
e37429e762263db2efa4345f48a6aa4884005eea
| 6,700,149,032,950 |
283d4f87adf81d48a71574d7fa3de89f85f739da
|
/src/main/java/com/zzw/entity/Ebook.java
|
58a5db20fed6cf936776de2fb4945afd064a8c56
|
[] |
no_license
|
zzwanthony/e-book-zzw
|
https://github.com/zzwanthony/e-book-zzw
|
8a8ff4b953b912e365316dac5525bd171f5cf9f1
|
fff39a042b42dc62496c7780ab38b66aa782ef6b
|
refs/heads/master
| 2022-07-01T17:38:26.212000 | 2019-11-11T12:44:46 | 2019-11-11T12:44:46 | 220,978,164 | 1 | 1 | null | false | 2022-06-17T02:39:48 | 2019-11-11T12:37:27 | 2022-01-05T08:32:46 | 2022-06-17T02:39:48 | 78,138 | 1 | 0 | 1 |
TSQL
| false | false |
package com.zzw.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Date;
import java.util.List;
//电子书信息表
@Entity
@Table(indexes = @Index(name = "index_txtSn", columnList = "txtSn", unique = true))
public class Ebook implements Serializable {
@Id
@GeneratedValue
private long eid;//电子书id
private String ename;//书名
private String author;//作者
private String translator;//翻译人
private String txtName;//txt文件名
private String coverName;//封面图片文件名
private long likeNum;//点赞人数
private long collectNum;//收藏人数
private long readerNum;//阅读人数
private Date uploadData;//上传日期
private String introduction;//简介
private String title;//目录
private String chapter;//章节下标
private String nioOffset;//nio流操作时章节头的byte偏移量
private String offset;
private long uid;//上传用户id
private long sid;//分类id
private String txtSn;
private String uname;
public String getUname() {
return uname;
}
public void setUname(String uname) {
this.uname = uname;
}
public long getEid() {
return eid;
}
public void setEid(long eid) {
this.eid = eid;
}
public String getEname() {
return ename;
}
public void setEname(String ename) {
this.ename = ename;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getTranslator() {
return translator;
}
public void setTranslator(String translator) {
this.translator = translator;
}
public String getTxtName() {
return txtName;
}
public void setTxtName(String txtName) {
this.txtName = txtName;
}
public String getCoverName() {
return coverName;
}
public void setCoverName(String coverName) {
this.coverName = coverName;
}
public long getLikeNum() {
return likeNum;
}
public void setLikeNum(long likeNum) {
this.likeNum = likeNum;
}
public long getCollectNum() {
return collectNum;
}
public void setCollectNum(long collectNum) {
this.collectNum = collectNum;
}
public long getReaderNum() {
return readerNum;
}
public void setReaderNum(long readerNum) {
this.readerNum = readerNum;
}
public Date getUploadData() {
return uploadData;
}
public void setUploadData(Date uploadData) {
this.uploadData = uploadData;
}
public String getIntroduction() {
return introduction;
}
public void setIntroduction(String introduction) {
this.introduction = introduction;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getChapter() {
return chapter;
}
public void setChapter(String chapter) {
this.chapter = chapter;
}
public String getNioOffset() {
return nioOffset;
}
public void setNioOffset(String nioOffset) {
this.nioOffset = nioOffset;
}
public Long[] getNioOffsets() {
if (getNioOffset() == null || getNioOffset().isEmpty()) return null;
String[] chapters = getNioOffset().split(",");
Long[] longs = new Long[chapters.length];
for (int i = 0; i < chapters.length; i++) {
longs[i] = new Long(chapters[i]);
}
return longs;
}
public long getUid() {
return uid;
}
public void setUid(long uid) {
this.uid = uid;
}
public long getSid() {
return sid;
}
public void setSid(long sid) {
this.sid = sid;
}
public String getTxtSn() {
return txtSn;
}
public void setTxtSn(String txtSn) {
this.txtSn = txtSn;
}
public String getOffset() {
return offset;
}
public void setOffset(String offset) {
this.offset = offset;
}
//不会被映射到表字段中
@Transient
private Integer[] chapters;
@Transient
private Long[] offsets;
@Transient
private String[] titles;
@Transient
private Long[] nioOffsets;
public String[] getTitles() {
return getTitle().split(",");
}
public void setTitles(String[] titles) {
this.titles = titles;
}
public Integer[] getChapters() {
String[] chapters = getChapter().split(",");
Integer[] integers = new Integer[chapters.length];
for (int i = 0; i < chapters.length; i++) {
integers[i] = new Integer(chapters[i]);
}
return integers;
}
public Long[] getOffsets() {
if (getOffset() == null || getOffset().isEmpty()) return null;
String[] chapters = getOffset().split(",");
Long[] longs = new Long[chapters.length];
for (int i = 0; i < chapters.length; i++) {
longs[i] = new Long(chapters[i]);
}
return longs;
}
public void addChapter(List chapter, List offset, List title, List nioOffset) {
StringBuffer sb = new StringBuffer();
for (Object cha : chapter) {
sb.append(cha + ",");
}
sb.deleteCharAt(sb.length() - 1);
String str1 = sb.toString();
sb.delete(0, sb.length());
if (offset != null) {
for (Object off : offset) {
sb.append(off + ",");
}
sb.deleteCharAt(sb.length() - 1);
}
String str2 = sb.toString();
sb.delete(0, sb.length());
for (Object tit : title) {
sb.append(tit + ",");
}
sb.deleteCharAt(sb.length() - 1);
String str3 = sb.toString();
sb.delete(0, sb.length());
if (nioOffset != null) {
for (Object nio : nioOffset) {
sb.append(nio + ",");
}
sb.deleteCharAt(sb.length() - 1);
}
String str4 = sb.toString();
if (this.chapter == null) {
this.chapter = str1;
this.offset = str2;
this.title = str3;
this.nioOffset = str4;
} else {
this.chapter += str1;
this.offset += str2;
this.title += str3;
this.nioOffset += str4;
}
}
public void pathChapters(Integer[] chapters, Long[] offsets, String[] titles, Long[] nioOffsets) {
this.chapters = chapters;
this.offsets = offsets;
this.titles = titles;
this.nioOffsets = nioOffsets;
}
@Override
public String toString() {
return "Ebook{" +
"eid=" + eid +
", ename='" + ename + '\'' +
", author='" + author + '\'' +
", translator='" + translator + '\'' +
", txtName='" + txtName + '\'' +
", coverName='" + coverName + '\'' +
", likeNum=" + likeNum +
", collectNum=" + collectNum +
", readerNum=" + readerNum +
", uploadData=" + uploadData +
", introduction='" + introduction + '\'' +
", uid=" + uid +
", sid=" + sid +
", txtSn='" + txtSn + '\'' +
", uname='" + uname + '\'' +
'}';
}
}
|
UTF-8
|
Java
| 7,551 |
java
|
Ebook.java
|
Java
|
[
{
"context": "'\" + ename + '\\'' +\n \", author='\" + author + '\\'' +\n \", translator='\" + trans",
"end": 6806,
"score": 0.6227124333381653,
"start": 6800,
"tag": "NAME",
"value": "author"
}
] | null |
[] |
package com.zzw.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Date;
import java.util.List;
//电子书信息表
@Entity
@Table(indexes = @Index(name = "index_txtSn", columnList = "txtSn", unique = true))
public class Ebook implements Serializable {
@Id
@GeneratedValue
private long eid;//电子书id
private String ename;//书名
private String author;//作者
private String translator;//翻译人
private String txtName;//txt文件名
private String coverName;//封面图片文件名
private long likeNum;//点赞人数
private long collectNum;//收藏人数
private long readerNum;//阅读人数
private Date uploadData;//上传日期
private String introduction;//简介
private String title;//目录
private String chapter;//章节下标
private String nioOffset;//nio流操作时章节头的byte偏移量
private String offset;
private long uid;//上传用户id
private long sid;//分类id
private String txtSn;
private String uname;
public String getUname() {
return uname;
}
public void setUname(String uname) {
this.uname = uname;
}
public long getEid() {
return eid;
}
public void setEid(long eid) {
this.eid = eid;
}
public String getEname() {
return ename;
}
public void setEname(String ename) {
this.ename = ename;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getTranslator() {
return translator;
}
public void setTranslator(String translator) {
this.translator = translator;
}
public String getTxtName() {
return txtName;
}
public void setTxtName(String txtName) {
this.txtName = txtName;
}
public String getCoverName() {
return coverName;
}
public void setCoverName(String coverName) {
this.coverName = coverName;
}
public long getLikeNum() {
return likeNum;
}
public void setLikeNum(long likeNum) {
this.likeNum = likeNum;
}
public long getCollectNum() {
return collectNum;
}
public void setCollectNum(long collectNum) {
this.collectNum = collectNum;
}
public long getReaderNum() {
return readerNum;
}
public void setReaderNum(long readerNum) {
this.readerNum = readerNum;
}
public Date getUploadData() {
return uploadData;
}
public void setUploadData(Date uploadData) {
this.uploadData = uploadData;
}
public String getIntroduction() {
return introduction;
}
public void setIntroduction(String introduction) {
this.introduction = introduction;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getChapter() {
return chapter;
}
public void setChapter(String chapter) {
this.chapter = chapter;
}
public String getNioOffset() {
return nioOffset;
}
public void setNioOffset(String nioOffset) {
this.nioOffset = nioOffset;
}
public Long[] getNioOffsets() {
if (getNioOffset() == null || getNioOffset().isEmpty()) return null;
String[] chapters = getNioOffset().split(",");
Long[] longs = new Long[chapters.length];
for (int i = 0; i < chapters.length; i++) {
longs[i] = new Long(chapters[i]);
}
return longs;
}
public long getUid() {
return uid;
}
public void setUid(long uid) {
this.uid = uid;
}
public long getSid() {
return sid;
}
public void setSid(long sid) {
this.sid = sid;
}
public String getTxtSn() {
return txtSn;
}
public void setTxtSn(String txtSn) {
this.txtSn = txtSn;
}
public String getOffset() {
return offset;
}
public void setOffset(String offset) {
this.offset = offset;
}
//不会被映射到表字段中
@Transient
private Integer[] chapters;
@Transient
private Long[] offsets;
@Transient
private String[] titles;
@Transient
private Long[] nioOffsets;
public String[] getTitles() {
return getTitle().split(",");
}
public void setTitles(String[] titles) {
this.titles = titles;
}
public Integer[] getChapters() {
String[] chapters = getChapter().split(",");
Integer[] integers = new Integer[chapters.length];
for (int i = 0; i < chapters.length; i++) {
integers[i] = new Integer(chapters[i]);
}
return integers;
}
public Long[] getOffsets() {
if (getOffset() == null || getOffset().isEmpty()) return null;
String[] chapters = getOffset().split(",");
Long[] longs = new Long[chapters.length];
for (int i = 0; i < chapters.length; i++) {
longs[i] = new Long(chapters[i]);
}
return longs;
}
public void addChapter(List chapter, List offset, List title, List nioOffset) {
StringBuffer sb = new StringBuffer();
for (Object cha : chapter) {
sb.append(cha + ",");
}
sb.deleteCharAt(sb.length() - 1);
String str1 = sb.toString();
sb.delete(0, sb.length());
if (offset != null) {
for (Object off : offset) {
sb.append(off + ",");
}
sb.deleteCharAt(sb.length() - 1);
}
String str2 = sb.toString();
sb.delete(0, sb.length());
for (Object tit : title) {
sb.append(tit + ",");
}
sb.deleteCharAt(sb.length() - 1);
String str3 = sb.toString();
sb.delete(0, sb.length());
if (nioOffset != null) {
for (Object nio : nioOffset) {
sb.append(nio + ",");
}
sb.deleteCharAt(sb.length() - 1);
}
String str4 = sb.toString();
if (this.chapter == null) {
this.chapter = str1;
this.offset = str2;
this.title = str3;
this.nioOffset = str4;
} else {
this.chapter += str1;
this.offset += str2;
this.title += str3;
this.nioOffset += str4;
}
}
public void pathChapters(Integer[] chapters, Long[] offsets, String[] titles, Long[] nioOffsets) {
this.chapters = chapters;
this.offsets = offsets;
this.titles = titles;
this.nioOffsets = nioOffsets;
}
@Override
public String toString() {
return "Ebook{" +
"eid=" + eid +
", ename='" + ename + '\'' +
", author='" + author + '\'' +
", translator='" + translator + '\'' +
", txtName='" + txtName + '\'' +
", coverName='" + coverName + '\'' +
", likeNum=" + likeNum +
", collectNum=" + collectNum +
", readerNum=" + readerNum +
", uploadData=" + uploadData +
", introduction='" + introduction + '\'' +
", uid=" + uid +
", sid=" + sid +
", txtSn='" + txtSn + '\'' +
", uname='" + uname + '\'' +
'}';
}
}
| 7,551 | 0.539543 | 0.536569 | 303 | 23.41254 | 18.297634 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.508251 | false | false |
5
|
8c6d8e4532778f68610d05952587a4c4b5753d78
| 16,509,854,355,239 |
4c15487b4b5852276b79b20b01b64115e0be00c7
|
/3_implementation/src/net/rem/regression/ui/RMInspector.java
|
24651cb54f2c6236bb2b50190b5a73da704fb259
|
[
"MIT"
] |
permissive
|
ngphloc/rem
|
https://github.com/ngphloc/rem
|
11ea9022784bf6eceb5c76ecae9a56adbd341bd0
|
f5c8f2ee4a30e5002608628aa7c8d7918ae880a0
|
refs/heads/master
| 2022-12-22T00:15:30.596000 | 2022-12-14T14:08:24 | 2022-12-14T14:08:24 | 134,131,536 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* SIM: MACHINE LEARNING ALGORITHMS FRAMEWORK
* (C) Copyright by Loc Nguyen's Academic Network
* Project homepage: sim.locnguyen.net
* Email: ng_phloc@yahoo.com
* Phone: +84-975250362
*/
package net.rem.regression.ui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import java.io.File;
import java.io.IOException;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Vector;
import javax.imageio.ImageIO;
import javax.swing.AbstractAction;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.table.TableModel;
import net.hudup.core.Constants;
import net.hudup.core.Util;
import net.hudup.core.data.AttributeList;
import net.hudup.core.data.Profile;
import net.hudup.core.logistic.Inspector;
import net.hudup.core.logistic.LogUtil;
import net.hudup.core.logistic.MathUtil;
import net.hudup.core.logistic.UriAssoc;
import net.hudup.core.logistic.xURI;
import net.hudup.core.logistic.ui.SortableTable;
import net.hudup.core.logistic.ui.SortableTableModel;
import net.hudup.core.logistic.ui.UIUtil;
import net.hudup.phoebe.math.ui.StatDlg;
import net.rem.regression.LargeStatistics;
import net.rem.regression.RM;
import net.rem.regression.RMAbstract;
import net.rem.regression.VarWrapper;
import net.rem.regression.ui.graph.Graph;
import net.rem.regression.ui.graph.PlotGraphExt;
/**
* This class represents the dialog to show content of regression model.
*
* @author Loc Nguyen
* @version 1.0
*
*/
public class RMInspector extends JDialog implements Inspector {
/**
* Serial version UID for serializable class.
*/
private static final long serialVersionUID = 1L;
/**
* Internal regression model.
*/
protected RM rm = null;
/**
* Regression table.
*/
private JTable tblRegression = null;
/**
* Calculation text.
*/
private JTextField txtCalc = null;
/**
* The first list of graphs.
*/
List<Graph> graphList = new ArrayList<Graph>();
/**
* The second list of graphs.
*/
List<Graph> graphList2 = new ArrayList<Graph>();
/**
* Constructor with specified regression model.
* @param comp parent component.
* @param rm specified regression model.
* @throws RemoteException if any error raises.
*/
public RMInspector(final Component comp, final RM rm) throws RemoteException {
super(UIUtil.getDialogForComponent(comp), "Regression Information", true);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setSize(800, 600);
setLocationRelativeTo(UIUtil.getDialogForComponent(comp));
this.rm = rm;
setLayout(new BorderLayout());
//Header
JPanel header = new JPanel(new BorderLayout());
this.add(header, BorderLayout.NORTH);
RMTextArea txtModel = new RMTextArea(rm);
header.add(new JScrollPane(txtModel), BorderLayout.CENTER);
//Body
JPanel body = new JPanel(new BorderLayout());
this.add(body, BorderLayout.CENTER);
//Information of body
JPanel paneInfo = new JPanel(new GridLayout(1, 0));
body.add(paneInfo, BorderLayout.NORTH);
JPanel col = null;
JPanel left = null;
JPanel right = null;
JPanel temp = null;
col = new JPanel(new BorderLayout());
paneInfo.add(col);
//
left = new JPanel(new GridLayout(0, 1));
col.add(left, BorderLayout.WEST);
//
left.add(new JLabel("Variance: "));
left.add(new JLabel("R: "));
//
right = new JPanel(new GridLayout(0, 1));
col.add(right, BorderLayout.CENTER);
//
double variance = rm.calcVariance();
JTextField txtVariance = new JTextField(MathUtil.format(variance));
txtVariance.setCaretPosition(0);
txtVariance.setEditable(false);
temp = new JPanel(new BorderLayout());
temp.add(txtVariance, BorderLayout.WEST);
right.add(temp);
//
JTextField txtR = new JTextField(
MathUtil.format(rm.calcR()));
txtR.setCaretPosition(0);
txtR.setEditable(false);
temp = new JPanel(new BorderLayout());
temp.add(txtR, BorderLayout.WEST);
right.add(temp);
col = new JPanel(new BorderLayout());
paneInfo.add(col);
//
left = new JPanel(new GridLayout(0, 1));
col.add(left, BorderLayout.WEST);
//
left.add(new JLabel("Error mean: "));
left.add(new JLabel("Error sd: "));
//
right = new JPanel(new GridLayout(0, 1));
col.add(right, BorderLayout.CENTER);
//
double[] error = rm.calcError();
error = (error == null || error.length < 2) ? new double[] {Constants.UNUSED, Constants.UNUSED} : error;
JTextField txtRatioErrMean = new JTextField(
MathUtil.format(error[0]));
txtRatioErrMean.setCaretPosition(0);
txtRatioErrMean.setEditable(false);
temp = new JPanel(new BorderLayout());
temp.add(txtRatioErrMean, BorderLayout.WEST);
right.add(temp);
//
JTextField txtRatioErrSd = new JTextField(
MathUtil.format(Math.sqrt(error[1])));
txtRatioErrSd.setCaretPosition(0);
txtRatioErrSd.setEditable(false);
temp = new JPanel(new BorderLayout());
temp.add(txtRatioErrSd, BorderLayout.WEST);
right.add(temp);
//Graphs of body
JPanel paneGraph = new JPanel(new GridLayout(1, 0));
body.add(paneGraph, BorderLayout.CENTER);
graphList = rm.createResponseRalatedGraphs();
graphList2 = rm.createResponseRalatedGraphs();
for (int i = 0; i < graphList.size(); i++) {
final Graph graph = graphList.get(i);
final Graph graph2 = graphList2.get(i);
JPanel gPanel = new JPanel(new BorderLayout());
paneGraph.add(gPanel);
gPanel.add((Component)graph, BorderLayout.CENTER);
JPanel toolbar = new JPanel();
gPanel.add(toolbar, BorderLayout.SOUTH);
JButton btnZoom = UIUtil.makeIconButton("zoomin-16x16.png",
"zoom", "Zoom", "Zoom",
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final JDialog dlg = new JDialog(UIUtil.getDialogForComponent(comp), "Graph", true);
dlg.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
dlg.setSize(600, 400);
dlg.setLocationRelativeTo(UIUtil.getDialogForComponent(comp));
dlg.setLayout(new BorderLayout());
dlg.add( (Component)graph2, BorderLayout.CENTER);
JPanel footer = new JPanel();
dlg.add(footer, BorderLayout.SOUTH);
JButton btnExport = new JButton("Export image");
btnExport.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
graph2.exportImage();
}
});
footer.add(btnExport);
dlg.setVisible(true);
}
});
btnZoom.setMargin(new Insets(0, 0 , 0, 0));
toolbar.add(btnZoom);
JButton btnPrint = UIUtil.makeIconButton("print-16x16.png",
"print", "Print", "Print",
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
Printable printable = new Printable() {
@Override
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
throws PrinterException {
if (pageIndex > 0)
return NO_SUCH_PAGE;
double x = pageFormat.getImageableX();
double y = pageFormat.getImageableY();
graphics.translate((int)x, (int)y);
((PlotGraphExt) graph2).paint(graphics, (int) pageFormat.getImageableWidth(), (int) pageFormat.getImageableHeight());
return PAGE_EXISTS;
}
};
PrinterJob pjob = PrinterJob.getPrinterJob();
//set a HelloPrint as the target to print
pjob.setPrintable(printable);
//get the print dialog, continue if cancel
//is not clicked
if (pjob.printDialog()) {
//print the target (HelloPrint)
pjob.print();
}
}
catch (Throwable ex) {
ex.printStackTrace();
}
}
});
btnPrint.setMargin(new Insets(0, 0 , 0, 0));
toolbar.add(btnPrint);
JButton btnOption = UIUtil.makeIconButton("option-16x16.png",
"view_option", "View Option", "View Option",
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
graph.setupViewOption();
((PlotGraphExt)graph2).setViewOption(((PlotGraphExt)graph).getViewOption());
}
}
);
btnOption.setMargin(new Insets(0, 0 , 0, 0));
toolbar.add(btnOption);
}
JPanel paneVars = new JPanel(new BorderLayout());
body.add(paneVars, BorderLayout.SOUTH);
List<VarWrapper> vars = rm.extractRegressors();
for (VarWrapper regressor : vars) {
regressor.setTag(0);
}
vars.sort(new Comparator<VarWrapper>() {
@Override
public int compare(VarWrapper o1, VarWrapper o2) {
return o1.toString().compareToIgnoreCase(o2.toString());
}
});
VarWrapper response = rm.extractResponse();
response.setTag(1);
vars.add(response);
JComboBox<VarWrapper> cmbVars = new JComboBox<VarWrapper>(vars.toArray(new VarWrapper[] {}));
paneVars.add(cmbVars, BorderLayout.CENTER);
JPanel varButtons = new JPanel();
paneVars.add(varButtons, BorderLayout.EAST);
JButton btnPlot = new JButton(new AbstractAction("Plot") {
/**
* Serial version UID for serializable class.
*/
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
VarWrapper var = (VarWrapper)cmbVars.getSelectedItem();
if (var == null)
JOptionPane.showMessageDialog(
cmbVars,
"No selected regressor",
"No selected regressor",
JOptionPane.ERROR_MESSAGE);
else {
try {
plotRegressorGraph(var);
}
catch (Exception ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(
cmbVars,
"Cannot show plot",
"Cannot show plot",
JOptionPane.ERROR_MESSAGE);
}
}
}
});
varButtons.add(btnPlot);
JButton btnStat = new JButton(new AbstractAction("Stat.") {
/**
* Serial version UID for serializable class.
*/
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
VarWrapper var = (VarWrapper)cmbVars.getSelectedItem();
if (var == null)
JOptionPane.showMessageDialog(
cmbVars,
"No selected variable",
"No selected variable",
JOptionPane.ERROR_MESSAGE);
else {
try {
statVar(var);
}
catch (RemoteException ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(
cmbVars,
"Cannot show statistics",
"Cannot show statistics",
JOptionPane.ERROR_MESSAGE);
}
}
}
});
varButtons.add(btnStat);
JButton btnLargeStats = new JButton(new AbstractAction("Large stat.") {
/**
* Serial version UID for serializable class.
*/
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
try {
LargeStatisticsTable.showDlg(getThisDlg(), rm, true);
} catch (Exception ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(
cmbVars,
"Cannot show large statistics due to remote exception",
"Cannot show large statistics",
JOptionPane.ERROR_MESSAGE);
};
}
});
varButtons.add(Box.createHorizontalBox());
varButtons.add(btnLargeStats);
//Footer
JPanel footer = new JPanel(new GridLayout(0, 1));
this.add(footer, BorderLayout.SOUTH);
JPanel paneCalc = new JPanel();
footer.add(paneCalc);
SortableTableModel tbm = new SortableTableModel() {
/**
* Serial version UID for serializable class.
*/
private static final long serialVersionUID = 1L;
@Override
public boolean isCellEditable(int row, int column) {
return (column == 1);
}
};
tbm.setColumnIdentifiers(new String[] {"Regressor", "Value"});
// List<VarWrapper> regressors = rm.extractRegressors();
// regressors.sort(new Comparator<VarWrapper>() {
//
// @Override
// public int compare(VarWrapper o1, VarWrapper o2) {
// return o1.toString().compareToIgnoreCase(o2.toString());
// }
//
// });
// for (VarWrapper regressor : regressors) {
// Vector<Object> rowData = new Vector<Object>();
// rowData.add(regressor);
// rowData.add(Double.valueOf(0));
// tbm.addRow(rowData);
// }
AttributeList regressors = rm.getAttributeList();
for (int i = 0; i < regressors.size(); i++) {
Vector<Object> rowData = new Vector<Object>();
rowData.add(regressors.get(i).getName());
rowData.add(Double.valueOf(0));
tbm.addRow(rowData);
}
this.tblRegression = new SortableTable(tbm);
this.tblRegression.setPreferredScrollableViewportSize(new Dimension(200, 60));
paneCalc.add(new JScrollPane(this.tblRegression));
JButton btnCalc = new JButton("Calculate");
btnCalc.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
calc();
}
});
paneCalc.add(btnCalc);
this.txtCalc = new JTextField(12);
txtCalc.setEditable(false);
paneCalc.add(txtCalc);
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if(SwingUtilities.isRightMouseButton(e) ) {
JPopupMenu contextMenu = createContextMenu();
if(contextMenu != null)
contextMenu.show((Component)e.getSource(), e.getX(), e.getY());
}
}
});
}
/**
* Plotting the graph of given regressor.
* @param regressor index of given regressor.
* @throws RemoteException if any error raises.
*/
private void plotRegressorGraph(VarWrapper regressor) throws RemoteException {
if (((Number)(regressor.getTag())).intValue() == 1) {
JOptionPane.showMessageDialog(
this,
"Variable is not regressor",
"None regressor",
JOptionPane.ERROR_MESSAGE);
return;
}
Graph graph = rm != null ? rm.createRegressorGraph(regressor) : null;
if (graph == null) {
JOptionPane.showMessageDialog(
this,
"Cannot create graph",
"Cannot create graph",
JOptionPane.ERROR_MESSAGE);
return;
}
final JDialog dlg = new JDialog(UIUtil.getDialogForComponent(this), "Graph", true);
dlg.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
dlg.setSize(450, 380);
dlg.setLocationRelativeTo(UIUtil.getDialogForComponent(this));
dlg.setLayout(new BorderLayout());
dlg.add( (Component)graph, BorderLayout.CENTER);
JPanel footer = new JPanel();
dlg.add(footer, BorderLayout.SOUTH);
JButton btnOption = new JButton("View option");
btnOption.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
graph.setupViewOption();
}
}
);
footer.add(btnOption);
JButton btnExport = new JButton("Export image");
btnExport.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
graph.exportImage();
}
});
footer.add(btnExport);
JButton btnPrint = new JButton("Print");
btnPrint.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
Printable printable = new Printable() {
@Override
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
throws PrinterException {
if (pageIndex > 0)
return NO_SUCH_PAGE;
double x = pageFormat.getImageableX();
double y = pageFormat.getImageableY();
graphics.translate((int)x, (int)y);
((PlotGraphExt) graph).paint(graphics, (int) pageFormat.getImageableWidth(), (int) pageFormat.getImageableHeight());
return PAGE_EXISTS;
}
};
PrinterJob pjob = PrinterJob.getPrinterJob();
//set a HelloPrint as the target to print
pjob.setPrintable(printable);
//get the print dialog, continue if canel
//is not clicked
if (pjob.printDialog()) {
//print the target (HelloPrint)
pjob.print();
}
}
catch (Throwable ex) {
ex.printStackTrace();
}
}
});
footer.add(btnPrint);
dlg.setVisible(true);
}
/**
* Showing statistic dialog for specified variable.
* @param var specified variable.
* @throws RemoteException if any error raises.
*/
private void statVar(VarWrapper var) throws RemoteException {
int tag = ((Number)(var.getTag())).intValue();
List<Double> data = null;
if (tag == 0) // Regressor
data = rm.extractRegressorStatistic(var);
else { // Response
LargeStatistics stats = rm.getLargeStatistics();
data = stats != null ? stats.getZStatistic() : Util.newList();
}
if (data.size() == 0) {
JOptionPane.showMessageDialog(
this,
"Empty data",
"Empty data",
JOptionPane.ERROR_MESSAGE);
}
else
new StatDlg(this, data, true);
}
/**
* Calculating regression model.
*/
private void calc() {
if (rm == null) {
JOptionPane.showMessageDialog(
this,
"Null regression model",
"Null regression model",
JOptionPane.ERROR_MESSAGE);
return;
}
try {
int n = tblRegression.getModel().getRowCount();
TableModel tbm = tblRegression.getModel();
// Map<String, Double> regressorValues = Util.newMap();
// for (int i = 0; i < n; i++) {
// String name = tbm.getValueAt(i, 0).toString();
// String value = tbm.getValueAt(i, 1).toString();
//
// regressorValues.put(name, Double.parseDouble(value));
// }
// double value = RMAbstract.extractNumber(rm.execute(regressorValues));
Profile profile = new Profile(rm.getAttributeList());
n = Math.min(n, profile.getAttCount());
for (int i = 0; i < n; i++) {
String name = tbm.getValueAt(i, 0).toString();
Object value = tbm.getValueAt(i, 1);
profile.setValue(name, value);
}
double value = RMAbstract.extractNumber(rm.execute(profile));
if (!Util.isUsed(value)) {
JOptionPane.showMessageDialog(
this,
"Regression model is not executed",
"Failed execution",
JOptionPane.ERROR_MESSAGE);
this.txtCalc.setText("");
}
else {
this.txtCalc.setText(MathUtil.format(value));
this.txtCalc.setCaretPosition(0);
}
}
catch (Exception e) {
LogUtil.trace(e);
this.txtCalc.setText("");
}
}
/**
* Creating context menu.
* @return context menu.
*/
private JPopupMenu createContextMenu() {
JPopupMenu contextMenu = new JPopupMenu();
JMenuItem miBigZoom = UIUtil.makeMenuItem(null, "Big zoom",
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final JDialog dlg = new JDialog(UIUtil.getDialogForComponent(getThisDlg()), "Big zoom", true);
dlg.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
dlg.setSize(600, 400);
dlg.setLocationRelativeTo(UIUtil.getDialogForComponent(getThisDlg()));
dlg.setLayout(new BorderLayout());
JPanel body = new JPanel(new GridLayout(1, 0));
dlg.add(body, BorderLayout.CENTER);
for (Graph graph : graphList2) {
body.add( (Component)graph);
}
JPanel footer = new JPanel();
dlg.add(footer, BorderLayout.SOUTH);
JButton btnExport = new JButton("Export image");
btnExport.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mergeGraphImages(getThisDlg(), graphList2);
}
});
footer.add(btnExport);
dlg.setVisible(true);
}
});
contextMenu.add(miBigZoom);
JMenuItem miExport = UIUtil.makeMenuItem(null, "Export graphs to image",
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mergeGraphImages(getThisDlg(), graphList);
}
});
contextMenu.add(miExport);
return contextMenu;
}
/**
* Merging list of graphs.
* @param comp parent component.
* @param graphList list of graphs.
*/
private static void mergeGraphImages(Component comp, List<Graph> graphList) {
if (graphList.size() == 0)
return;
UriAssoc uriAssoc = Util.getFactory().createUriAssoc(xURI.create(new File(".")));
xURI chooseUri = uriAssoc.chooseUri(comp, false, new String[] {"png"}, new String[] {"PNG file"}, null, "png");
if (chooseUri == null) {
JOptionPane.showMessageDialog(
comp,
"Image not exported",
"Image not exported",
JOptionPane.INFORMATION_MESSAGE);
return;
}
int bigWidth = 0;
int maxHeight = Integer.MIN_VALUE;
for (Graph graph : graphList) {
bigWidth += graph.getOuterBox().width;
maxHeight = Math.max(maxHeight, graph.getOuterBox().height);
}
BufferedImage bigImage = new BufferedImage(bigWidth, maxHeight, BufferedImage.TYPE_INT_ARGB);
Graphics2D bigGraphics = bigImage.createGraphics();
int x = 0;
for (Graph graph : graphList) {
Rectangle outerBox = graph.getOuterBox();
BufferedImage image = new BufferedImage(outerBox.width, outerBox.height, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = image.createGraphics();
graphics.setColor(new Color(0, 0, 0));
if (graph instanceof PlotGraphExt)
((PlotGraphExt)graph).paint(graphics, outerBox.width, outerBox.height);
else
graph.paint(graphics);
bigGraphics.drawImage(image, x, 0, null);
x += outerBox.width;
}
try {
ImageIO.write(bigImage, "png", new File(chooseUri.getURI()));
JOptionPane.showMessageDialog(
comp,
"Big image exported successfully",
"Big image exported successfully",
JOptionPane.INFORMATION_MESSAGE);
}
catch (IOException e) {
LogUtil.trace(e);
}
}
/**
* Getting this dialog.
* @return this dialog.
*/
private RMInspector getThisDlg() {
return this;
}
@Override
public void inspect() {
setVisible(true);
}
}
|
UTF-8
|
Java
| 22,677 |
java
|
RMInspector.java
|
Java
|
[
{
"context": " LEARNING ALGORITHMS FRAMEWORK\n * (C) Copyright by Loc Nguyen's Academic Network\n * Project homepage: sim.locng",
"end": 80,
"score": 0.9960928559303284,
"start": 70,
"tag": "NAME",
"value": "Loc Nguyen"
},
{
"context": "k\n * Project homepage: sim.locnguyen.net\n * Email: ng_phloc@yahoo.com\n * Phone: +84-975250362\n */\npackage net.rem.regre",
"end": 167,
"score": 0.9999266862869263,
"start": 149,
"tag": "EMAIL",
"value": "ng_phloc@yahoo.com"
},
{
"context": "o show content of regression model.\n * \n * @author Loc Nguyen\n * @version 1.0\n *\n */\npublic class RMInspector e",
"end": 2331,
"score": 0.9998297691345215,
"start": 2321,
"tag": "NAME",
"value": "Loc Nguyen"
}
] | null |
[] |
/**
* SIM: MACHINE LEARNING ALGORITHMS FRAMEWORK
* (C) Copyright by <NAME>'s Academic Network
* Project homepage: sim.locnguyen.net
* Email: <EMAIL>
* Phone: +84-975250362
*/
package net.rem.regression.ui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import java.io.File;
import java.io.IOException;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Vector;
import javax.imageio.ImageIO;
import javax.swing.AbstractAction;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.table.TableModel;
import net.hudup.core.Constants;
import net.hudup.core.Util;
import net.hudup.core.data.AttributeList;
import net.hudup.core.data.Profile;
import net.hudup.core.logistic.Inspector;
import net.hudup.core.logistic.LogUtil;
import net.hudup.core.logistic.MathUtil;
import net.hudup.core.logistic.UriAssoc;
import net.hudup.core.logistic.xURI;
import net.hudup.core.logistic.ui.SortableTable;
import net.hudup.core.logistic.ui.SortableTableModel;
import net.hudup.core.logistic.ui.UIUtil;
import net.hudup.phoebe.math.ui.StatDlg;
import net.rem.regression.LargeStatistics;
import net.rem.regression.RM;
import net.rem.regression.RMAbstract;
import net.rem.regression.VarWrapper;
import net.rem.regression.ui.graph.Graph;
import net.rem.regression.ui.graph.PlotGraphExt;
/**
* This class represents the dialog to show content of regression model.
*
* @author <NAME>
* @version 1.0
*
*/
public class RMInspector extends JDialog implements Inspector {
/**
* Serial version UID for serializable class.
*/
private static final long serialVersionUID = 1L;
/**
* Internal regression model.
*/
protected RM rm = null;
/**
* Regression table.
*/
private JTable tblRegression = null;
/**
* Calculation text.
*/
private JTextField txtCalc = null;
/**
* The first list of graphs.
*/
List<Graph> graphList = new ArrayList<Graph>();
/**
* The second list of graphs.
*/
List<Graph> graphList2 = new ArrayList<Graph>();
/**
* Constructor with specified regression model.
* @param comp parent component.
* @param rm specified regression model.
* @throws RemoteException if any error raises.
*/
public RMInspector(final Component comp, final RM rm) throws RemoteException {
super(UIUtil.getDialogForComponent(comp), "Regression Information", true);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setSize(800, 600);
setLocationRelativeTo(UIUtil.getDialogForComponent(comp));
this.rm = rm;
setLayout(new BorderLayout());
//Header
JPanel header = new JPanel(new BorderLayout());
this.add(header, BorderLayout.NORTH);
RMTextArea txtModel = new RMTextArea(rm);
header.add(new JScrollPane(txtModel), BorderLayout.CENTER);
//Body
JPanel body = new JPanel(new BorderLayout());
this.add(body, BorderLayout.CENTER);
//Information of body
JPanel paneInfo = new JPanel(new GridLayout(1, 0));
body.add(paneInfo, BorderLayout.NORTH);
JPanel col = null;
JPanel left = null;
JPanel right = null;
JPanel temp = null;
col = new JPanel(new BorderLayout());
paneInfo.add(col);
//
left = new JPanel(new GridLayout(0, 1));
col.add(left, BorderLayout.WEST);
//
left.add(new JLabel("Variance: "));
left.add(new JLabel("R: "));
//
right = new JPanel(new GridLayout(0, 1));
col.add(right, BorderLayout.CENTER);
//
double variance = rm.calcVariance();
JTextField txtVariance = new JTextField(MathUtil.format(variance));
txtVariance.setCaretPosition(0);
txtVariance.setEditable(false);
temp = new JPanel(new BorderLayout());
temp.add(txtVariance, BorderLayout.WEST);
right.add(temp);
//
JTextField txtR = new JTextField(
MathUtil.format(rm.calcR()));
txtR.setCaretPosition(0);
txtR.setEditable(false);
temp = new JPanel(new BorderLayout());
temp.add(txtR, BorderLayout.WEST);
right.add(temp);
col = new JPanel(new BorderLayout());
paneInfo.add(col);
//
left = new JPanel(new GridLayout(0, 1));
col.add(left, BorderLayout.WEST);
//
left.add(new JLabel("Error mean: "));
left.add(new JLabel("Error sd: "));
//
right = new JPanel(new GridLayout(0, 1));
col.add(right, BorderLayout.CENTER);
//
double[] error = rm.calcError();
error = (error == null || error.length < 2) ? new double[] {Constants.UNUSED, Constants.UNUSED} : error;
JTextField txtRatioErrMean = new JTextField(
MathUtil.format(error[0]));
txtRatioErrMean.setCaretPosition(0);
txtRatioErrMean.setEditable(false);
temp = new JPanel(new BorderLayout());
temp.add(txtRatioErrMean, BorderLayout.WEST);
right.add(temp);
//
JTextField txtRatioErrSd = new JTextField(
MathUtil.format(Math.sqrt(error[1])));
txtRatioErrSd.setCaretPosition(0);
txtRatioErrSd.setEditable(false);
temp = new JPanel(new BorderLayout());
temp.add(txtRatioErrSd, BorderLayout.WEST);
right.add(temp);
//Graphs of body
JPanel paneGraph = new JPanel(new GridLayout(1, 0));
body.add(paneGraph, BorderLayout.CENTER);
graphList = rm.createResponseRalatedGraphs();
graphList2 = rm.createResponseRalatedGraphs();
for (int i = 0; i < graphList.size(); i++) {
final Graph graph = graphList.get(i);
final Graph graph2 = graphList2.get(i);
JPanel gPanel = new JPanel(new BorderLayout());
paneGraph.add(gPanel);
gPanel.add((Component)graph, BorderLayout.CENTER);
JPanel toolbar = new JPanel();
gPanel.add(toolbar, BorderLayout.SOUTH);
JButton btnZoom = UIUtil.makeIconButton("zoomin-16x16.png",
"zoom", "Zoom", "Zoom",
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final JDialog dlg = new JDialog(UIUtil.getDialogForComponent(comp), "Graph", true);
dlg.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
dlg.setSize(600, 400);
dlg.setLocationRelativeTo(UIUtil.getDialogForComponent(comp));
dlg.setLayout(new BorderLayout());
dlg.add( (Component)graph2, BorderLayout.CENTER);
JPanel footer = new JPanel();
dlg.add(footer, BorderLayout.SOUTH);
JButton btnExport = new JButton("Export image");
btnExport.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
graph2.exportImage();
}
});
footer.add(btnExport);
dlg.setVisible(true);
}
});
btnZoom.setMargin(new Insets(0, 0 , 0, 0));
toolbar.add(btnZoom);
JButton btnPrint = UIUtil.makeIconButton("print-16x16.png",
"print", "Print", "Print",
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
Printable printable = new Printable() {
@Override
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
throws PrinterException {
if (pageIndex > 0)
return NO_SUCH_PAGE;
double x = pageFormat.getImageableX();
double y = pageFormat.getImageableY();
graphics.translate((int)x, (int)y);
((PlotGraphExt) graph2).paint(graphics, (int) pageFormat.getImageableWidth(), (int) pageFormat.getImageableHeight());
return PAGE_EXISTS;
}
};
PrinterJob pjob = PrinterJob.getPrinterJob();
//set a HelloPrint as the target to print
pjob.setPrintable(printable);
//get the print dialog, continue if cancel
//is not clicked
if (pjob.printDialog()) {
//print the target (HelloPrint)
pjob.print();
}
}
catch (Throwable ex) {
ex.printStackTrace();
}
}
});
btnPrint.setMargin(new Insets(0, 0 , 0, 0));
toolbar.add(btnPrint);
JButton btnOption = UIUtil.makeIconButton("option-16x16.png",
"view_option", "View Option", "View Option",
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
graph.setupViewOption();
((PlotGraphExt)graph2).setViewOption(((PlotGraphExt)graph).getViewOption());
}
}
);
btnOption.setMargin(new Insets(0, 0 , 0, 0));
toolbar.add(btnOption);
}
JPanel paneVars = new JPanel(new BorderLayout());
body.add(paneVars, BorderLayout.SOUTH);
List<VarWrapper> vars = rm.extractRegressors();
for (VarWrapper regressor : vars) {
regressor.setTag(0);
}
vars.sort(new Comparator<VarWrapper>() {
@Override
public int compare(VarWrapper o1, VarWrapper o2) {
return o1.toString().compareToIgnoreCase(o2.toString());
}
});
VarWrapper response = rm.extractResponse();
response.setTag(1);
vars.add(response);
JComboBox<VarWrapper> cmbVars = new JComboBox<VarWrapper>(vars.toArray(new VarWrapper[] {}));
paneVars.add(cmbVars, BorderLayout.CENTER);
JPanel varButtons = new JPanel();
paneVars.add(varButtons, BorderLayout.EAST);
JButton btnPlot = new JButton(new AbstractAction("Plot") {
/**
* Serial version UID for serializable class.
*/
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
VarWrapper var = (VarWrapper)cmbVars.getSelectedItem();
if (var == null)
JOptionPane.showMessageDialog(
cmbVars,
"No selected regressor",
"No selected regressor",
JOptionPane.ERROR_MESSAGE);
else {
try {
plotRegressorGraph(var);
}
catch (Exception ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(
cmbVars,
"Cannot show plot",
"Cannot show plot",
JOptionPane.ERROR_MESSAGE);
}
}
}
});
varButtons.add(btnPlot);
JButton btnStat = new JButton(new AbstractAction("Stat.") {
/**
* Serial version UID for serializable class.
*/
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
VarWrapper var = (VarWrapper)cmbVars.getSelectedItem();
if (var == null)
JOptionPane.showMessageDialog(
cmbVars,
"No selected variable",
"No selected variable",
JOptionPane.ERROR_MESSAGE);
else {
try {
statVar(var);
}
catch (RemoteException ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(
cmbVars,
"Cannot show statistics",
"Cannot show statistics",
JOptionPane.ERROR_MESSAGE);
}
}
}
});
varButtons.add(btnStat);
JButton btnLargeStats = new JButton(new AbstractAction("Large stat.") {
/**
* Serial version UID for serializable class.
*/
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
try {
LargeStatisticsTable.showDlg(getThisDlg(), rm, true);
} catch (Exception ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(
cmbVars,
"Cannot show large statistics due to remote exception",
"Cannot show large statistics",
JOptionPane.ERROR_MESSAGE);
};
}
});
varButtons.add(Box.createHorizontalBox());
varButtons.add(btnLargeStats);
//Footer
JPanel footer = new JPanel(new GridLayout(0, 1));
this.add(footer, BorderLayout.SOUTH);
JPanel paneCalc = new JPanel();
footer.add(paneCalc);
SortableTableModel tbm = new SortableTableModel() {
/**
* Serial version UID for serializable class.
*/
private static final long serialVersionUID = 1L;
@Override
public boolean isCellEditable(int row, int column) {
return (column == 1);
}
};
tbm.setColumnIdentifiers(new String[] {"Regressor", "Value"});
// List<VarWrapper> regressors = rm.extractRegressors();
// regressors.sort(new Comparator<VarWrapper>() {
//
// @Override
// public int compare(VarWrapper o1, VarWrapper o2) {
// return o1.toString().compareToIgnoreCase(o2.toString());
// }
//
// });
// for (VarWrapper regressor : regressors) {
// Vector<Object> rowData = new Vector<Object>();
// rowData.add(regressor);
// rowData.add(Double.valueOf(0));
// tbm.addRow(rowData);
// }
AttributeList regressors = rm.getAttributeList();
for (int i = 0; i < regressors.size(); i++) {
Vector<Object> rowData = new Vector<Object>();
rowData.add(regressors.get(i).getName());
rowData.add(Double.valueOf(0));
tbm.addRow(rowData);
}
this.tblRegression = new SortableTable(tbm);
this.tblRegression.setPreferredScrollableViewportSize(new Dimension(200, 60));
paneCalc.add(new JScrollPane(this.tblRegression));
JButton btnCalc = new JButton("Calculate");
btnCalc.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
calc();
}
});
paneCalc.add(btnCalc);
this.txtCalc = new JTextField(12);
txtCalc.setEditable(false);
paneCalc.add(txtCalc);
addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if(SwingUtilities.isRightMouseButton(e) ) {
JPopupMenu contextMenu = createContextMenu();
if(contextMenu != null)
contextMenu.show((Component)e.getSource(), e.getX(), e.getY());
}
}
});
}
/**
* Plotting the graph of given regressor.
* @param regressor index of given regressor.
* @throws RemoteException if any error raises.
*/
private void plotRegressorGraph(VarWrapper regressor) throws RemoteException {
if (((Number)(regressor.getTag())).intValue() == 1) {
JOptionPane.showMessageDialog(
this,
"Variable is not regressor",
"None regressor",
JOptionPane.ERROR_MESSAGE);
return;
}
Graph graph = rm != null ? rm.createRegressorGraph(regressor) : null;
if (graph == null) {
JOptionPane.showMessageDialog(
this,
"Cannot create graph",
"Cannot create graph",
JOptionPane.ERROR_MESSAGE);
return;
}
final JDialog dlg = new JDialog(UIUtil.getDialogForComponent(this), "Graph", true);
dlg.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
dlg.setSize(450, 380);
dlg.setLocationRelativeTo(UIUtil.getDialogForComponent(this));
dlg.setLayout(new BorderLayout());
dlg.add( (Component)graph, BorderLayout.CENTER);
JPanel footer = new JPanel();
dlg.add(footer, BorderLayout.SOUTH);
JButton btnOption = new JButton("View option");
btnOption.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
graph.setupViewOption();
}
}
);
footer.add(btnOption);
JButton btnExport = new JButton("Export image");
btnExport.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
graph.exportImage();
}
});
footer.add(btnExport);
JButton btnPrint = new JButton("Print");
btnPrint.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
Printable printable = new Printable() {
@Override
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
throws PrinterException {
if (pageIndex > 0)
return NO_SUCH_PAGE;
double x = pageFormat.getImageableX();
double y = pageFormat.getImageableY();
graphics.translate((int)x, (int)y);
((PlotGraphExt) graph).paint(graphics, (int) pageFormat.getImageableWidth(), (int) pageFormat.getImageableHeight());
return PAGE_EXISTS;
}
};
PrinterJob pjob = PrinterJob.getPrinterJob();
//set a HelloPrint as the target to print
pjob.setPrintable(printable);
//get the print dialog, continue if canel
//is not clicked
if (pjob.printDialog()) {
//print the target (HelloPrint)
pjob.print();
}
}
catch (Throwable ex) {
ex.printStackTrace();
}
}
});
footer.add(btnPrint);
dlg.setVisible(true);
}
/**
* Showing statistic dialog for specified variable.
* @param var specified variable.
* @throws RemoteException if any error raises.
*/
private void statVar(VarWrapper var) throws RemoteException {
int tag = ((Number)(var.getTag())).intValue();
List<Double> data = null;
if (tag == 0) // Regressor
data = rm.extractRegressorStatistic(var);
else { // Response
LargeStatistics stats = rm.getLargeStatistics();
data = stats != null ? stats.getZStatistic() : Util.newList();
}
if (data.size() == 0) {
JOptionPane.showMessageDialog(
this,
"Empty data",
"Empty data",
JOptionPane.ERROR_MESSAGE);
}
else
new StatDlg(this, data, true);
}
/**
* Calculating regression model.
*/
private void calc() {
if (rm == null) {
JOptionPane.showMessageDialog(
this,
"Null regression model",
"Null regression model",
JOptionPane.ERROR_MESSAGE);
return;
}
try {
int n = tblRegression.getModel().getRowCount();
TableModel tbm = tblRegression.getModel();
// Map<String, Double> regressorValues = Util.newMap();
// for (int i = 0; i < n; i++) {
// String name = tbm.getValueAt(i, 0).toString();
// String value = tbm.getValueAt(i, 1).toString();
//
// regressorValues.put(name, Double.parseDouble(value));
// }
// double value = RMAbstract.extractNumber(rm.execute(regressorValues));
Profile profile = new Profile(rm.getAttributeList());
n = Math.min(n, profile.getAttCount());
for (int i = 0; i < n; i++) {
String name = tbm.getValueAt(i, 0).toString();
Object value = tbm.getValueAt(i, 1);
profile.setValue(name, value);
}
double value = RMAbstract.extractNumber(rm.execute(profile));
if (!Util.isUsed(value)) {
JOptionPane.showMessageDialog(
this,
"Regression model is not executed",
"Failed execution",
JOptionPane.ERROR_MESSAGE);
this.txtCalc.setText("");
}
else {
this.txtCalc.setText(MathUtil.format(value));
this.txtCalc.setCaretPosition(0);
}
}
catch (Exception e) {
LogUtil.trace(e);
this.txtCalc.setText("");
}
}
/**
* Creating context menu.
* @return context menu.
*/
private JPopupMenu createContextMenu() {
JPopupMenu contextMenu = new JPopupMenu();
JMenuItem miBigZoom = UIUtil.makeMenuItem(null, "Big zoom",
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
final JDialog dlg = new JDialog(UIUtil.getDialogForComponent(getThisDlg()), "Big zoom", true);
dlg.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
dlg.setSize(600, 400);
dlg.setLocationRelativeTo(UIUtil.getDialogForComponent(getThisDlg()));
dlg.setLayout(new BorderLayout());
JPanel body = new JPanel(new GridLayout(1, 0));
dlg.add(body, BorderLayout.CENTER);
for (Graph graph : graphList2) {
body.add( (Component)graph);
}
JPanel footer = new JPanel();
dlg.add(footer, BorderLayout.SOUTH);
JButton btnExport = new JButton("Export image");
btnExport.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mergeGraphImages(getThisDlg(), graphList2);
}
});
footer.add(btnExport);
dlg.setVisible(true);
}
});
contextMenu.add(miBigZoom);
JMenuItem miExport = UIUtil.makeMenuItem(null, "Export graphs to image",
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
mergeGraphImages(getThisDlg(), graphList);
}
});
contextMenu.add(miExport);
return contextMenu;
}
/**
* Merging list of graphs.
* @param comp parent component.
* @param graphList list of graphs.
*/
private static void mergeGraphImages(Component comp, List<Graph> graphList) {
if (graphList.size() == 0)
return;
UriAssoc uriAssoc = Util.getFactory().createUriAssoc(xURI.create(new File(".")));
xURI chooseUri = uriAssoc.chooseUri(comp, false, new String[] {"png"}, new String[] {"PNG file"}, null, "png");
if (chooseUri == null) {
JOptionPane.showMessageDialog(
comp,
"Image not exported",
"Image not exported",
JOptionPane.INFORMATION_MESSAGE);
return;
}
int bigWidth = 0;
int maxHeight = Integer.MIN_VALUE;
for (Graph graph : graphList) {
bigWidth += graph.getOuterBox().width;
maxHeight = Math.max(maxHeight, graph.getOuterBox().height);
}
BufferedImage bigImage = new BufferedImage(bigWidth, maxHeight, BufferedImage.TYPE_INT_ARGB);
Graphics2D bigGraphics = bigImage.createGraphics();
int x = 0;
for (Graph graph : graphList) {
Rectangle outerBox = graph.getOuterBox();
BufferedImage image = new BufferedImage(outerBox.width, outerBox.height, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = image.createGraphics();
graphics.setColor(new Color(0, 0, 0));
if (graph instanceof PlotGraphExt)
((PlotGraphExt)graph).paint(graphics, outerBox.width, outerBox.height);
else
graph.paint(graphics);
bigGraphics.drawImage(image, x, 0, null);
x += outerBox.width;
}
try {
ImageIO.write(bigImage, "png", new File(chooseUri.getURI()));
JOptionPane.showMessageDialog(
comp,
"Big image exported successfully",
"Big image exported successfully",
JOptionPane.INFORMATION_MESSAGE);
}
catch (IOException e) {
LogUtil.trace(e);
}
}
/**
* Getting this dialog.
* @return this dialog.
*/
private RMInspector getThisDlg() {
return this;
}
@Override
public void inspect() {
setVisible(true);
}
}
| 22,658 | 0.665167 | 0.658817 | 834 | 26.18825 | 21.449886 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.535971 | false | false |
5
|
f934ab4a00a2768339144b9ea07c9d87b7cbc66a
| 28,312,424,457,513 |
e0caa8f2d9171ee603f29d1a8c31735d80fbebbf
|
/core/src/edu/franklin/practicum/f15/strategygame/map/RandomEncounterType.java
|
5076031121570aad2eb7ccb474a15fedace22171
|
[] |
no_license
|
cyrex562/franklin_f15_game
|
https://github.com/cyrex562/franklin_f15_game
|
5ad51c1eb85ffa51dc736cbfe63673c38b29d167
|
b0ac0f06bd5a8ba6afad71ec0d26b3b27278e892
|
refs/heads/master
| 2016-08-11T14:14:34.466000 | 2015-12-13T21:54:54 | 2015-12-13T21:54:54 | 47,938,012 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package edu.franklin.practicum.f15.strategygame.map;
public enum RandomEncounterType {
ATTACK,
SUPPLY_DROP,
COCONUT,
BUMP,
MIST,
THIEVES
}
|
UTF-8
|
Java
| 146 |
java
|
RandomEncounterType.java
|
Java
|
[] | null |
[] |
package edu.franklin.practicum.f15.strategygame.map;
public enum RandomEncounterType {
ATTACK,
SUPPLY_DROP,
COCONUT,
BUMP,
MIST,
THIEVES
}
| 146 | 0.767123 | 0.753425 | 10 | 13.6 | 15.473849 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.2 | false | false |
5
|
2a82e8595610898f7622e031daaf945f86d21ab7
| 29,137,058,169,820 |
2ccd9229cb0b5ae3b805d49c0d59fe20e46b7501
|
/src/hrhx/dhm/service/XmlService.java
|
d1b7ebfae20e8860490d8b0bfd25a868bf67bebd
|
[] |
no_license
|
duhongming1990/xstream
|
https://github.com/duhongming1990/xstream
|
c9bf9a6597a68264c2014ab0fcd2523ad19feef0
|
dbb34c037eecd7a5b3675bc2c75c7367413c4296
|
refs/heads/master
| 2016-08-11T09:39:37.285000 | 2016-03-17T05:52:26 | 2016-03-17T05:52:26 | 53,632,912 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package hrhx.dhm.service;
import hrhx.dhm.util.XmlUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class XmlService {
@Autowired
private XmlUtil xmlUtil;
public void jsonUtil(){
System.out.println("XmlUtil类"+xmlUtil+"已经加载了!!!");
}
}
|
UTF-8
|
Java
| 345 |
java
|
XmlService.java
|
Java
|
[] | null |
[] |
package hrhx.dhm.service;
import hrhx.dhm.util.XmlUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class XmlService {
@Autowired
private XmlUtil xmlUtil;
public void jsonUtil(){
System.out.println("XmlUtil类"+xmlUtil+"已经加载了!!!");
}
}
| 345 | 0.7737 | 0.7737 | 16 | 19.4375 | 19.528725 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8125 | false | false |
12
|
7c15687f8ba1fc95326a2cbf1093f1668eb33403
| 13,030,930,820,999 |
b9ee3e2770d239c58e4b50898036f9f61c410f95
|
/src/main/java/com/example/demo/MathController.java
|
b6edb8ea6be7126c3d097fa52178acba7f983291
|
[] |
no_license
|
xchrisw92/spring-playground
|
https://github.com/xchrisw92/spring-playground
|
4c5fcf7b130d4b6d0d2794dc4c944ab41f9ccfa7
|
690cf4fa1f90453813787855c7ec4f486fcbfe49
|
refs/heads/main
| 2023-08-23T18:32:06.031000 | 2021-09-21T19:06:01 | 2021-09-21T19:06:01 | 406,025,370 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.demo;
import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@RequestMapping("/math")
public class MathController {
private String operation;
@GetMapping("/pi")
String getPi(){ return Double.toString(Math.PI); }
@GetMapping("/calculate")
String getCalculation(@RequestParam String operation, @RequestParam int x, @RequestParam int y){
return String.format("%s %s %s = %s" , x, MathService.getOperand(operation), y,
MathService.calculateOperation(operation, x, y));
}
@PostMapping("/sum")
String sum(@RequestParam MultiValueMap<String, String> input){
int y = 0;
String print = "";
for(int x = 0 ; x<input.get("n").size() - 1 ; x++){
print += input.get("n").get(x) + " + ";
y=x;
}
print += input.get("n").get(y+1) + " = " + MathService.sum(input.get("n"));
return print;
}
@RequestMapping("/volume/{x}/{y}/{z}")
String volume(@PathVariable int x, @PathVariable int y, @PathVariable int z){
return "The volume of a " + x + "x" + y + "x" + z + " rectangle is " + MathService.calculateVolume(x, y, z)
+ ".";
}
@PostMapping("/area")
String area(@RequestParam Map<String, String> params){
if(params.get("type").equals("circle")){
return "Area of a circle with a radius of " + params.get("radius") + " is " +
String.valueOf(MathService.areaOfCircle(params.get("radius"))) + ".";
} else if(params.get("type").equals("rectangle")){
return "Area of a " + params.get("width") + "x" + params.get("height") + " rectangle is " +
String.valueOf(MathService.areaOfRectangle(params.get("width"), params.get("height"))) + ".";
} else { return "Invalid"; }
}
}
|
UTF-8
|
Java
| 1,967 |
java
|
MathController.java
|
Java
|
[] | null |
[] |
package com.example.demo;
import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@RestController
@RequestMapping("/math")
public class MathController {
private String operation;
@GetMapping("/pi")
String getPi(){ return Double.toString(Math.PI); }
@GetMapping("/calculate")
String getCalculation(@RequestParam String operation, @RequestParam int x, @RequestParam int y){
return String.format("%s %s %s = %s" , x, MathService.getOperand(operation), y,
MathService.calculateOperation(operation, x, y));
}
@PostMapping("/sum")
String sum(@RequestParam MultiValueMap<String, String> input){
int y = 0;
String print = "";
for(int x = 0 ; x<input.get("n").size() - 1 ; x++){
print += input.get("n").get(x) + " + ";
y=x;
}
print += input.get("n").get(y+1) + " = " + MathService.sum(input.get("n"));
return print;
}
@RequestMapping("/volume/{x}/{y}/{z}")
String volume(@PathVariable int x, @PathVariable int y, @PathVariable int z){
return "The volume of a " + x + "x" + y + "x" + z + " rectangle is " + MathService.calculateVolume(x, y, z)
+ ".";
}
@PostMapping("/area")
String area(@RequestParam Map<String, String> params){
if(params.get("type").equals("circle")){
return "Area of a circle with a radius of " + params.get("radius") + " is " +
String.valueOf(MathService.areaOfCircle(params.get("radius"))) + ".";
} else if(params.get("type").equals("rectangle")){
return "Area of a " + params.get("width") + "x" + params.get("height") + " rectangle is " +
String.valueOf(MathService.areaOfRectangle(params.get("width"), params.get("height"))) + ".";
} else { return "Invalid"; }
}
}
| 1,967 | 0.592273 | 0.590239 | 53 | 36.113209 | 33.341946 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.660377 | false | false |
12
|
fb59f4098fa8518e105837bdc203216d1558dd67
| 25,580,825,266,468 |
413828f6d7649dbc1d4284ab03c2a71d6c482b6e
|
/app/src/main/java/com/cassio/app/cassio/adapters/LogItemListAdapter.java
|
a627be07f894003194006d80a676e5f082861f13
|
[] |
no_license
|
grantas33/Cassio-
|
https://github.com/grantas33/Cassio-
|
7c4f66eb80f6235687ef6ee3daf81dd69844e1b8
|
0bb1349d6ce4409edee82c009beb890d62caaee0
|
refs/heads/master
| 2020-12-02T19:32:57.015000 | 2017-12-12T16:18:55 | 2017-12-12T16:18:55 | 96,357,601 | 0 | 0 | null | false | 2017-12-12T16:18:55 | 2017-07-05T20:14:43 | 2017-08-29T11:02:53 | 2017-12-12T16:18:55 | 4,531 | 2 | 0 | 0 |
Java
| false | null |
package com.cassio.app.cassio.adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.cassio.app.cassio.fragmentLogic.FoodLogLogic;
import com.cassio.app.cassio.models.LogItem;
import com.cassio.app.cassio.R;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Locale;
public class LogItemListAdapter extends BaseAdapter {
Context context;
List<LogItem> items;
FoodLogLogic Logic;
public LogItemListAdapter(Context context, List<LogItem> items) {
this.context = context;
Logic = new FoodLogLogic(context);
this.items = items;
}
@Override
public int getCount() {
if (items != null) return items.size();
else return 0;
}
@Override
public Object getItem(int position) {
return items.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final LogItem item = items.get(position);
View view = convertView;
if (view == null) {
view = LayoutInflater.from(context).inflate(R.layout.log_item_info, parent, false);
}
ImageView trashcan = (ImageView) view.findViewById(R.id.redtrashcan);
trashcan.setImageResource(R.drawable.red_trash_can);
trashcan.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Logic.deleteLogItem(item.logId);
UpdateAdapter(Logic.getLogItems());
}
});
((TextView) view.findViewById(R.id.logiteminfoname)).setText(item.FoodName);
SimpleDateFormat sdfDate = new SimpleDateFormat("HH:mm", Locale.getDefault());
((TextView) view.findViewById(R.id.logiteminfodate)).setText(sdfDate.format(item.Time));
((TextView) view.findViewById(R.id.logiteminfocalories)).setText(item.getCalories() + " kal.");
((TextView) view.findViewById(R.id.logiteminfograms)).setText(item.Grams + " g.");
return view;
}
public void UpdateAdapter(List<LogItem> list) {
this.items = list;
notifyDataSetChanged();
}
}
|
UTF-8
|
Java
| 2,419 |
java
|
LogItemListAdapter.java
|
Java
|
[] | null |
[] |
package com.cassio.app.cassio.adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.cassio.app.cassio.fragmentLogic.FoodLogLogic;
import com.cassio.app.cassio.models.LogItem;
import com.cassio.app.cassio.R;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Locale;
public class LogItemListAdapter extends BaseAdapter {
Context context;
List<LogItem> items;
FoodLogLogic Logic;
public LogItemListAdapter(Context context, List<LogItem> items) {
this.context = context;
Logic = new FoodLogLogic(context);
this.items = items;
}
@Override
public int getCount() {
if (items != null) return items.size();
else return 0;
}
@Override
public Object getItem(int position) {
return items.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final LogItem item = items.get(position);
View view = convertView;
if (view == null) {
view = LayoutInflater.from(context).inflate(R.layout.log_item_info, parent, false);
}
ImageView trashcan = (ImageView) view.findViewById(R.id.redtrashcan);
trashcan.setImageResource(R.drawable.red_trash_can);
trashcan.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Logic.deleteLogItem(item.logId);
UpdateAdapter(Logic.getLogItems());
}
});
((TextView) view.findViewById(R.id.logiteminfoname)).setText(item.FoodName);
SimpleDateFormat sdfDate = new SimpleDateFormat("HH:mm", Locale.getDefault());
((TextView) view.findViewById(R.id.logiteminfodate)).setText(sdfDate.format(item.Time));
((TextView) view.findViewById(R.id.logiteminfocalories)).setText(item.getCalories() + " kal.");
((TextView) view.findViewById(R.id.logiteminfograms)).setText(item.Grams + " g.");
return view;
}
public void UpdateAdapter(List<LogItem> list) {
this.items = list;
notifyDataSetChanged();
}
}
| 2,419 | 0.667218 | 0.666804 | 82 | 28.5 | 26.778336 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.560976 | false | false |
12
|
1afb8f1abdc65368551055c8d76efaec92f1d449
| 17,514,876,680,543 |
b971a7188caac96a47a8fd996280030daef3513d
|
/ISoccer/src/ISoccer/Motorista.java
|
db5347cc658bcb0a03f0c46a6ef2d1352b19baad
|
[] |
no_license
|
jvarocha/iSoccer_P3
|
https://github.com/jvarocha/iSoccer_P3
|
af7e0a19b433712325363f0065e3c64a89dfbbd4
|
01c822ed48ec25558de2e5d1d77d626c41689a7b
|
refs/heads/master
| 2020-08-26T23:00:03.377000 | 2019-11-27T04:47:10 | 2019-11-27T04:47:10 | 217,174,457 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ISoccer;
public class Motorista extends Pessoa {
private double habilitacao;
public double getHabilitacao() {
return habilitacao;
}
public void setHabilitacao(double habilitacao) {
this.habilitacao = habilitacao;
}
}
|
UTF-8
|
Java
| 250 |
java
|
Motorista.java
|
Java
|
[] | null |
[] |
package ISoccer;
public class Motorista extends Pessoa {
private double habilitacao;
public double getHabilitacao() {
return habilitacao;
}
public void setHabilitacao(double habilitacao) {
this.habilitacao = habilitacao;
}
}
| 250 | 0.724 | 0.724 | 13 | 17.23077 | 16.939503 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
12
|
d6a11e336762f425a6d2009e89820783bc2c8b99
| 18,056,042,559,036 |
15e5e059df9c530399e6214e751acd483e377072
|
/JukeboxApp2/src/model/Jukebox.java
|
33c9615f9e9edff9622b23257515a74379bdbf42
|
[] |
no_license
|
MarshallaSlagle/Java-Course
|
https://github.com/MarshallaSlagle/Java-Course
|
afe5a57c51d951e69a5aa09323764710eecd4f6d
|
21c27945c4117d2976406976156d2bf35256cf41
|
refs/heads/master
| 2022-07-05T08:16:57.527000 | 2020-05-20T20:49:32 | 2020-05-20T20:49:32 | 265,651,217 | 0 | 0 | null | false | 2020-05-20T19:51:48 | 2020-05-20T18:19:59 | 2020-05-20T18:20:03 | 2020-05-20T19:51:47 | 0 | 0 | 0 | 0 | null | false | false |
package model;
import java.util.ArrayList;
public class Jukebox
{
private int numberOfAlbums;
private ArrayList <Album> albums;
private ArrayList <Song> hits;
/**
* Constructor Method used to instantiate an object of the class Jukebox.
* <b>pre: </b>Scanner and Region class' has been imported<b>
* <b>post: </b>An object of type Interpreter will be initialized<b>
* @param pName is a string. <br>
* @param pSurname is a string. <br>
* @param pAge is an int. <br>
* @param pRegion is a Region. <br>
*/
public Jukebox()
{
numberOfAlbums = 0;
this.albums = new ArrayList<>();
this.hits = new ArrayList<>();
}
/**
* Method used to return hits ArrayList attribute.
* <b>pre: </b>hits has been initialized<b>
* <b>post: </b>hits will be returned.<b>
* @return An arrayList containing the songs in the hits ArrayList will be returned.
*/
public ArrayList<Song> getHits()
{
return hits;
}
/**
* Method used to return getNumberOfAlbums attribute.
* <b>pre: </b>NumberOfAlbums has been initialized<b>
* <b>post: </b>An int will be returned.<b>
* @return An int containing the NumberOfAlbums in the album will be returned.
*/
public int getNumberOfAlbums()
{
return numberOfAlbums;
}
/**
* Method used to add an object of the class Album.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type album will be initialized<b>
* @param pName is a string that does not already exist in the Jukebox. pName!=null <br>
* @param pGenre is a Genre that does already exist in the Genre enum. <br>
* @param pPrice is a double. <br>
* @param pInterpreter is an Interpreter. <br>
* @return A boolean value based on the truthfulness of the addition to the Arraylist albums.
*/
public boolean addAlbum(String pName, Genre pGenre, double pPrice, Interpreter pInterpreter)
{
boolean response = false;
Album existingAlbum = searchAlbum(pName);
if(existingAlbum == null)
{
albums.add(new Album(pName, pGenre, pPrice, pInterpreter));
response = true;
numberOfAlbums++;
}
return response;
}
/**
* Method used to search for an object of the class Album.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type album will be found<b>
* @param pNameAlbum is a string. <br>
* @return An object of type Album found or null.
*/
public Album searchAlbum(String pNameAlbum)
{
Album response = null;
for(int i = 0; i < albums.size(); i++)
{
if(albums.get(i).getName().equalsIgnoreCase(pNameAlbum))
{
response = albums.get(i);
}
}
return response;
}
/**
* Method used to add an object of the class Song.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type Song will be initialized<b>
* @param pName is a string that does not already exist in the Jukebox. pName!=null <br>
* @param pGenre is a Genre that does already exist in the Genre enum. <br>
* @param pDuration is an int. <br>
* @param pNameAlbum is a string. <br>
* @return A boolean value based on the truthfulness of the addition to the Arraylist songs within the album object.
*/
public boolean addSong(String pName, int pDuration, String pNameAlbum)
{
boolean response = false;
Album album = searchAlbum(pNameAlbum);
Song song = searchSong(pName, pNameAlbum);
if(album != null && song == null)
{
Song newSong = new Song(pName, pDuration);
response = album.addSong(newSong);
}
return response;
}
/**
* Method used to search for an object of the class Song.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type Song will be found<b>
* @param pNameAlbum is a string. <br>
* @param pName is a string. <br>
* @return An object of type Song found or null.
*/
public Song searchSong(String pName, String pNameAlbum)
{
Song result = null;
Album searched = searchAlbum(pNameAlbum);
if(searched != null)
{
for(int i = 0; i < searched.getSongs().size(); i++)
{
if(searched.getSongs().get(i).getName().equalsIgnoreCase(pName))
{
result = searched.getSongs().get(i);
}
}
}
return result;
}
/**
* Method used to search for an object of the class Album that is the most expensive.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type album will be found<b>
* @return An object of type Album found or null.
*/
public Album getMostExpensiveAlbum()
{
Album mostExpensiveAlbum = null;
double maxPrice = 0.0;
for(int i = 0; i < albums.size(); i++)
{
if(albums.get(i).getPrice()>maxPrice)
{
mostExpensiveAlbum = albums.get(i);
maxPrice = albums.get(i).getPrice();
}
}
return mostExpensiveAlbum;
}
/**
* Method used to add an object of the class Song to the hits arrayList.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type Song will be initialized<b>
* @param pName is a string that does not already exist in the Jukebox. pName!=null <br>
* @param pNameAlbum is a string. <br>
* @return A boolean value based on the truthfulness of the addition to the Arraylist hits.
*/
public boolean addHitSong(String pName, String pNameAlbum)
{
boolean result = false;
Song song = searchSong(pName, pNameAlbum);
if(song != null)
{
this.hits.add(song);
result = true;
}
return result;
}
/**
* Method used to search for an object of the class Song in the ArrayList hits.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type Song will be found<b>
* @param pName is a string. <br>
* @return An object of type Song found or null.
*/
public Song searchHitSong(String pName)
{
Song result = null;
for(int i = 0; i < hits.size(); i++)
{
if(hits.get(i).getName().equalsIgnoreCase(pName))
{
result = hits.get(i);
}
}
return result;
}
/**
* Method used to remove an object of the class Album from the ArrayList albums.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type album will be removed<b>
* @param pNameAlbum is a string <br>
* @return A boolean value based on the truthfulness of the removal from the Arraylist albums.
*/
public boolean removeAlbum(String pNameAlbum)
{
boolean result = false;
Album searched = searchAlbum(pNameAlbum);
if(searched != null)
{
result = this.albums.remove(searched);
numberOfAlbums--;
}
return result;
}
/**
* Method used to remove an object of the class Song from the ArrayList songs within an album object.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type song will be removed<b>
* @param pNameSong is a string <br>
* @param pNameAlbum is a string <br>
* @return A boolean value based on the truthfulness of the removal from the Arraylist songs within an album object.
*/
public boolean removeSong(String pNameSong, String pNameAlbum)
{
boolean result = false;
Album searchedAlbum = searchAlbum(pNameAlbum);
Song searchedSong = searchSong(pNameSong, pNameAlbum);
if(searchedAlbum != null && searchedSong != null)
{
result = searchedAlbum.getSongs().remove(searchedSong);
}
return result;
}
/**
* Method used to remove an object of the class Song from the ArrayList hits.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type song will be removed<b>
* @param pNameSong is a string <br>
* @return A boolean value based on the truthfulness of the removal from the Arraylist hits.
*/
public boolean removeHit(String pNameSong)
{
boolean result = false;
Song searchedSong = searchHitSong(pNameSong);
if(searchedSong != null)
{
result = this.hits.remove(searchedSong);
}
return result;
}
/**
* Method used to search for an object of the class Album that is the least expensive.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type album will be found<b>
* @return An object of type Album found or null.
*/
public Album getLeastExpensiveAlbum()
{
Album leastExpensiveAlbum = null;
double minPrice = 0.0;
for(int i = 0; i < albums.size(); i++)
{
if(albums.get(i)!=null)
{
leastExpensiveAlbum = albums.get(i);
minPrice = albums.get(i).getPrice();
break;
}
}
for(int i = 0; i < albums.size(); i++)
{
if(albums.get(i).getPrice()<minPrice)
{
leastExpensiveAlbum = albums.get(i);
minPrice = albums.get(i).getPrice();
}
}
return leastExpensiveAlbum;
}
/**
* Method used to search for an object of the class Song in the ArrayList albums that is the longest in duration.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type Song will be found<b>
* @param pNameAlbum is a string. <br>
* @return An object of type Song found or null.
*/
public Song longestSong(String pNameAlbum)
{
Song result = null;
Album searched = searchAlbum(pNameAlbum);
int max = 0;
if(searched != null)
{
for(int i =0; i < searched.getSongs().size(); i++)
{
if(searched.getSongs().get(i).getDuration()>max)
{
result = searched.getSongs().get(i);
max = searched.getSongs().get(i).getDuration();
}
}
}
return result;
}
/**
* Method used to search for an object of the class Song in the ArrayList albums that is the shortest in duration.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type Song will be found<b>
* @param pNameAlbum is a string. <br>
* @return An object of type Song found or null.
*/
public Song shortestSong(String pNameAlbum)
{
Song result = null;
Album searched = searchAlbum(pNameAlbum);
int max = 0;
if(searched != null)
{
for(int i =0; i < searched.getSongs().size(); i++)
{
if(searched.getSongs().get(i) != null)
{
result = searched.getSongs().get(i);
max = searched.getSongs().get(i).getDuration();
break;
}
}
for(int i =0; i < searched.getSongs().size(); i++)
{
if(searched.getSongs().get(i).getDuration()<max)
{
result = searched.getSongs().get(i);
max = searched.getSongs().get(i).getDuration();
}
}
}
return result;
}
/**
* Method used to search for an object of the class Song in the ArrayList hits that is the longest.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type Song will be found<b>
* @return An object of type Song found or null.
*/
public Song longestHit()
{
Song result = null;
int max = 0;
for(int i =0; i < hits.size(); i++)
{
if(hits.get(i) != null && hits.get(i).getDuration()>max)
{
result = hits.get(i);
max = hits.get(i).getDuration();
}
}
return result;
}
/**
* Method used to search for an object of the class Song in the ArrayList hits that is the shortest.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type Song will be found<b>
* @return An object of type Song found or null.
*/
public Song shortestHit()
{
Song result = null;
int min = 0;
for(int i =0; i < hits.size(); i++)
{
if(hits.get(i) != null)
{
result = hits.get(i);
min = hits.get(i).getDuration();
break;
}
}
for(int i =0; i < hits.size(); i++)
{
if(hits.get(i) != null && hits.get(i).getDuration()<min)
{
result = hits.get(i);
min = hits.get(i).getDuration();
}
}
return result;
}
/**
* Method used to get the number of objects in the ArrayList hits.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An int of the number of Songs in hits will be returned<b>
* @return An int of the number of Songs in hits will be returned or 0.
*/
public int getNumberHits()
{
int result = 0;
for(int i = 0; i < hits.size(); i++)
{
if(hits.get(i) != null)
{
result++;
}
}
return result;
}
}
|
UTF-8
|
Java
| 12,293 |
java
|
Jukebox.java
|
Java
|
[] | null |
[] |
package model;
import java.util.ArrayList;
public class Jukebox
{
private int numberOfAlbums;
private ArrayList <Album> albums;
private ArrayList <Song> hits;
/**
* Constructor Method used to instantiate an object of the class Jukebox.
* <b>pre: </b>Scanner and Region class' has been imported<b>
* <b>post: </b>An object of type Interpreter will be initialized<b>
* @param pName is a string. <br>
* @param pSurname is a string. <br>
* @param pAge is an int. <br>
* @param pRegion is a Region. <br>
*/
public Jukebox()
{
numberOfAlbums = 0;
this.albums = new ArrayList<>();
this.hits = new ArrayList<>();
}
/**
* Method used to return hits ArrayList attribute.
* <b>pre: </b>hits has been initialized<b>
* <b>post: </b>hits will be returned.<b>
* @return An arrayList containing the songs in the hits ArrayList will be returned.
*/
public ArrayList<Song> getHits()
{
return hits;
}
/**
* Method used to return getNumberOfAlbums attribute.
* <b>pre: </b>NumberOfAlbums has been initialized<b>
* <b>post: </b>An int will be returned.<b>
* @return An int containing the NumberOfAlbums in the album will be returned.
*/
public int getNumberOfAlbums()
{
return numberOfAlbums;
}
/**
* Method used to add an object of the class Album.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type album will be initialized<b>
* @param pName is a string that does not already exist in the Jukebox. pName!=null <br>
* @param pGenre is a Genre that does already exist in the Genre enum. <br>
* @param pPrice is a double. <br>
* @param pInterpreter is an Interpreter. <br>
* @return A boolean value based on the truthfulness of the addition to the Arraylist albums.
*/
public boolean addAlbum(String pName, Genre pGenre, double pPrice, Interpreter pInterpreter)
{
boolean response = false;
Album existingAlbum = searchAlbum(pName);
if(existingAlbum == null)
{
albums.add(new Album(pName, pGenre, pPrice, pInterpreter));
response = true;
numberOfAlbums++;
}
return response;
}
/**
* Method used to search for an object of the class Album.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type album will be found<b>
* @param pNameAlbum is a string. <br>
* @return An object of type Album found or null.
*/
public Album searchAlbum(String pNameAlbum)
{
Album response = null;
for(int i = 0; i < albums.size(); i++)
{
if(albums.get(i).getName().equalsIgnoreCase(pNameAlbum))
{
response = albums.get(i);
}
}
return response;
}
/**
* Method used to add an object of the class Song.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type Song will be initialized<b>
* @param pName is a string that does not already exist in the Jukebox. pName!=null <br>
* @param pGenre is a Genre that does already exist in the Genre enum. <br>
* @param pDuration is an int. <br>
* @param pNameAlbum is a string. <br>
* @return A boolean value based on the truthfulness of the addition to the Arraylist songs within the album object.
*/
public boolean addSong(String pName, int pDuration, String pNameAlbum)
{
boolean response = false;
Album album = searchAlbum(pNameAlbum);
Song song = searchSong(pName, pNameAlbum);
if(album != null && song == null)
{
Song newSong = new Song(pName, pDuration);
response = album.addSong(newSong);
}
return response;
}
/**
* Method used to search for an object of the class Song.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type Song will be found<b>
* @param pNameAlbum is a string. <br>
* @param pName is a string. <br>
* @return An object of type Song found or null.
*/
public Song searchSong(String pName, String pNameAlbum)
{
Song result = null;
Album searched = searchAlbum(pNameAlbum);
if(searched != null)
{
for(int i = 0; i < searched.getSongs().size(); i++)
{
if(searched.getSongs().get(i).getName().equalsIgnoreCase(pName))
{
result = searched.getSongs().get(i);
}
}
}
return result;
}
/**
* Method used to search for an object of the class Album that is the most expensive.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type album will be found<b>
* @return An object of type Album found or null.
*/
public Album getMostExpensiveAlbum()
{
Album mostExpensiveAlbum = null;
double maxPrice = 0.0;
for(int i = 0; i < albums.size(); i++)
{
if(albums.get(i).getPrice()>maxPrice)
{
mostExpensiveAlbum = albums.get(i);
maxPrice = albums.get(i).getPrice();
}
}
return mostExpensiveAlbum;
}
/**
* Method used to add an object of the class Song to the hits arrayList.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type Song will be initialized<b>
* @param pName is a string that does not already exist in the Jukebox. pName!=null <br>
* @param pNameAlbum is a string. <br>
* @return A boolean value based on the truthfulness of the addition to the Arraylist hits.
*/
public boolean addHitSong(String pName, String pNameAlbum)
{
boolean result = false;
Song song = searchSong(pName, pNameAlbum);
if(song != null)
{
this.hits.add(song);
result = true;
}
return result;
}
/**
* Method used to search for an object of the class Song in the ArrayList hits.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type Song will be found<b>
* @param pName is a string. <br>
* @return An object of type Song found or null.
*/
public Song searchHitSong(String pName)
{
Song result = null;
for(int i = 0; i < hits.size(); i++)
{
if(hits.get(i).getName().equalsIgnoreCase(pName))
{
result = hits.get(i);
}
}
return result;
}
/**
* Method used to remove an object of the class Album from the ArrayList albums.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type album will be removed<b>
* @param pNameAlbum is a string <br>
* @return A boolean value based on the truthfulness of the removal from the Arraylist albums.
*/
public boolean removeAlbum(String pNameAlbum)
{
boolean result = false;
Album searched = searchAlbum(pNameAlbum);
if(searched != null)
{
result = this.albums.remove(searched);
numberOfAlbums--;
}
return result;
}
/**
* Method used to remove an object of the class Song from the ArrayList songs within an album object.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type song will be removed<b>
* @param pNameSong is a string <br>
* @param pNameAlbum is a string <br>
* @return A boolean value based on the truthfulness of the removal from the Arraylist songs within an album object.
*/
public boolean removeSong(String pNameSong, String pNameAlbum)
{
boolean result = false;
Album searchedAlbum = searchAlbum(pNameAlbum);
Song searchedSong = searchSong(pNameSong, pNameAlbum);
if(searchedAlbum != null && searchedSong != null)
{
result = searchedAlbum.getSongs().remove(searchedSong);
}
return result;
}
/**
* Method used to remove an object of the class Song from the ArrayList hits.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type song will be removed<b>
* @param pNameSong is a string <br>
* @return A boolean value based on the truthfulness of the removal from the Arraylist hits.
*/
public boolean removeHit(String pNameSong)
{
boolean result = false;
Song searchedSong = searchHitSong(pNameSong);
if(searchedSong != null)
{
result = this.hits.remove(searchedSong);
}
return result;
}
/**
* Method used to search for an object of the class Album that is the least expensive.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type album will be found<b>
* @return An object of type Album found or null.
*/
public Album getLeastExpensiveAlbum()
{
Album leastExpensiveAlbum = null;
double minPrice = 0.0;
for(int i = 0; i < albums.size(); i++)
{
if(albums.get(i)!=null)
{
leastExpensiveAlbum = albums.get(i);
minPrice = albums.get(i).getPrice();
break;
}
}
for(int i = 0; i < albums.size(); i++)
{
if(albums.get(i).getPrice()<minPrice)
{
leastExpensiveAlbum = albums.get(i);
minPrice = albums.get(i).getPrice();
}
}
return leastExpensiveAlbum;
}
/**
* Method used to search for an object of the class Song in the ArrayList albums that is the longest in duration.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type Song will be found<b>
* @param pNameAlbum is a string. <br>
* @return An object of type Song found or null.
*/
public Song longestSong(String pNameAlbum)
{
Song result = null;
Album searched = searchAlbum(pNameAlbum);
int max = 0;
if(searched != null)
{
for(int i =0; i < searched.getSongs().size(); i++)
{
if(searched.getSongs().get(i).getDuration()>max)
{
result = searched.getSongs().get(i);
max = searched.getSongs().get(i).getDuration();
}
}
}
return result;
}
/**
* Method used to search for an object of the class Song in the ArrayList albums that is the shortest in duration.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type Song will be found<b>
* @param pNameAlbum is a string. <br>
* @return An object of type Song found or null.
*/
public Song shortestSong(String pNameAlbum)
{
Song result = null;
Album searched = searchAlbum(pNameAlbum);
int max = 0;
if(searched != null)
{
for(int i =0; i < searched.getSongs().size(); i++)
{
if(searched.getSongs().get(i) != null)
{
result = searched.getSongs().get(i);
max = searched.getSongs().get(i).getDuration();
break;
}
}
for(int i =0; i < searched.getSongs().size(); i++)
{
if(searched.getSongs().get(i).getDuration()<max)
{
result = searched.getSongs().get(i);
max = searched.getSongs().get(i).getDuration();
}
}
}
return result;
}
/**
* Method used to search for an object of the class Song in the ArrayList hits that is the longest.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type Song will be found<b>
* @return An object of type Song found or null.
*/
public Song longestHit()
{
Song result = null;
int max = 0;
for(int i =0; i < hits.size(); i++)
{
if(hits.get(i) != null && hits.get(i).getDuration()>max)
{
result = hits.get(i);
max = hits.get(i).getDuration();
}
}
return result;
}
/**
* Method used to search for an object of the class Song in the ArrayList hits that is the shortest.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An object of type Song will be found<b>
* @return An object of type Song found or null.
*/
public Song shortestHit()
{
Song result = null;
int min = 0;
for(int i =0; i < hits.size(); i++)
{
if(hits.get(i) != null)
{
result = hits.get(i);
min = hits.get(i).getDuration();
break;
}
}
for(int i =0; i < hits.size(); i++)
{
if(hits.get(i) != null && hits.get(i).getDuration()<min)
{
result = hits.get(i);
min = hits.get(i).getDuration();
}
}
return result;
}
/**
* Method used to get the number of objects in the ArrayList hits.
* <b>pre: </b>Genre and ArrayList class' have been imported<b>
* <b>post: </b>An int of the number of Songs in hits will be returned<b>
* @return An int of the number of Songs in hits will be returned or 0.
*/
public int getNumberHits()
{
int result = 0;
for(int i = 0; i < hits.size(); i++)
{
if(hits.get(i) != null)
{
result++;
}
}
return result;
}
}
| 12,293 | 0.64671 | 0.644757 | 470 | 25.155319 | 26.6276 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.112766 | false | false |
12
|
038300e3dd6a205e11473cd3dd19bb49943ebf48
| 10,179,072,533,879 |
d75684b4cda688a4f39005927fe6b402311c7549
|
/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/util/JDBCUtil.java
|
2982056d3b6565f730900474e62500eaf228ab8e
|
[
"Apache-2.0"
] |
permissive
|
zoujianchao/shardingsphere
|
https://github.com/zoujianchao/shardingsphere
|
6c017f5ce69b6624474f396bd1a6ff9e7f4b84db
|
ea9fb193f5372dfd18e95c12417c9db7b096d92c
|
refs/heads/master
| 2023-06-27T20:45:17.301000 | 2021-08-02T07:29:59 | 2021-08-02T07:29:59 | 378,817,258 | 2 | 0 |
Apache-2.0
| true | 2021-06-21T05:32:53 | 2021-06-21T05:32:53 | 2021-06-21T03:04:55 | 2021-06-21T02:57:03 | 400,231 | 0 | 0 | 0 | null | false | false |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.shardingsphere.scaling.core.util;
import com.google.common.base.Preconditions;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.scaling.core.common.datasource.JdbcUri;
import org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.config.datasource.ShardingSphereJDBCDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
import java.util.Map;
import java.util.Map.Entry;
/**
* JDBC util.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class JDBCUtil {
/**
* Append jdbc parameter.
*
* @param scalingDataSourceConfiguration data source configuration
* @param parameters parameters
*/
public static void appendJDBCParameter(final ScalingDataSourceConfiguration scalingDataSourceConfiguration, final Map<String, String> parameters) {
if (scalingDataSourceConfiguration instanceof StandardJDBCDataSourceConfiguration) {
append((StandardJDBCDataSourceConfiguration) scalingDataSourceConfiguration, parameters);
} else if (scalingDataSourceConfiguration instanceof ShardingSphereJDBCDataSourceConfiguration) {
append((ShardingSphereJDBCDataSourceConfiguration) scalingDataSourceConfiguration, parameters);
}
}
private static void append(final StandardJDBCDataSourceConfiguration dataSourceConfig, final Map<String, String> parameters) {
dataSourceConfig.getHikariConfig().setJdbcUrl(append(dataSourceConfig.getHikariConfig().getJdbcUrl(), parameters));
}
private static void append(final ShardingSphereJDBCDataSourceConfiguration dataSourceConfig, final Map<String, String> parameters) {
dataSourceConfig.getRootRuleConfigs().getDataSources()
.forEach((key, value) -> {
String jdbcUrlKey = value.containsKey("url") ? "url" : "jdbcUrl";
value.replace(jdbcUrlKey, append(value.get(jdbcUrlKey).toString(), parameters));
});
}
private static String append(final String url, final Map<String, String> parameters) {
JdbcUri uri = new JdbcUri(url);
return String.format("jdbc:%s://%s/%s?%s", uri.getScheme(), uri.getHost(), uri.getDatabase(), mergeParameters(uri.getParameters(), parameters));
}
private static String mergeParameters(final Map<String, String> parameters, final Map<String, String> appendParameters) {
parameters.putAll(appendParameters);
return formatParameters(parameters);
}
private static String formatParameters(final Map<String, String> parameters) {
StringBuilder result = new StringBuilder();
for (Entry<String, String> entry : parameters.entrySet()) {
result.append(entry.getKey());
if (null != entry.getValue()) {
result.append("=").append(entry.getValue());
}
result.append("&");
}
result.deleteCharAt(result.length() - 1);
return result.toString();
}
/**
* Get jdbc url from parameters, the key can be url or jdbcUrl.
*
* @param parameters parameters
* @return jdbc url
*/
public static String getJdbcUrl(final Map<String, Object> parameters) {
Object result = parameters.getOrDefault("url", parameters.get("jdbcUrl"));
Preconditions.checkNotNull(result, "url or jdbcUrl is required.");
return result.toString();
}
}
|
UTF-8
|
Java
| 4,417 |
java
|
JDBCUtil.java
|
Java
|
[] | null |
[] |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.shardingsphere.scaling.core.util;
import com.google.common.base.Preconditions;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.scaling.core.common.datasource.JdbcUri;
import org.apache.shardingsphere.scaling.core.config.datasource.ScalingDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.config.datasource.ShardingSphereJDBCDataSourceConfiguration;
import org.apache.shardingsphere.scaling.core.config.datasource.StandardJDBCDataSourceConfiguration;
import java.util.Map;
import java.util.Map.Entry;
/**
* JDBC util.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class JDBCUtil {
/**
* Append jdbc parameter.
*
* @param scalingDataSourceConfiguration data source configuration
* @param parameters parameters
*/
public static void appendJDBCParameter(final ScalingDataSourceConfiguration scalingDataSourceConfiguration, final Map<String, String> parameters) {
if (scalingDataSourceConfiguration instanceof StandardJDBCDataSourceConfiguration) {
append((StandardJDBCDataSourceConfiguration) scalingDataSourceConfiguration, parameters);
} else if (scalingDataSourceConfiguration instanceof ShardingSphereJDBCDataSourceConfiguration) {
append((ShardingSphereJDBCDataSourceConfiguration) scalingDataSourceConfiguration, parameters);
}
}
private static void append(final StandardJDBCDataSourceConfiguration dataSourceConfig, final Map<String, String> parameters) {
dataSourceConfig.getHikariConfig().setJdbcUrl(append(dataSourceConfig.getHikariConfig().getJdbcUrl(), parameters));
}
private static void append(final ShardingSphereJDBCDataSourceConfiguration dataSourceConfig, final Map<String, String> parameters) {
dataSourceConfig.getRootRuleConfigs().getDataSources()
.forEach((key, value) -> {
String jdbcUrlKey = value.containsKey("url") ? "url" : "jdbcUrl";
value.replace(jdbcUrlKey, append(value.get(jdbcUrlKey).toString(), parameters));
});
}
private static String append(final String url, final Map<String, String> parameters) {
JdbcUri uri = new JdbcUri(url);
return String.format("jdbc:%s://%s/%s?%s", uri.getScheme(), uri.getHost(), uri.getDatabase(), mergeParameters(uri.getParameters(), parameters));
}
private static String mergeParameters(final Map<String, String> parameters, final Map<String, String> appendParameters) {
parameters.putAll(appendParameters);
return formatParameters(parameters);
}
private static String formatParameters(final Map<String, String> parameters) {
StringBuilder result = new StringBuilder();
for (Entry<String, String> entry : parameters.entrySet()) {
result.append(entry.getKey());
if (null != entry.getValue()) {
result.append("=").append(entry.getValue());
}
result.append("&");
}
result.deleteCharAt(result.length() - 1);
return result.toString();
}
/**
* Get jdbc url from parameters, the key can be url or jdbcUrl.
*
* @param parameters parameters
* @return jdbc url
*/
public static String getJdbcUrl(final Map<String, Object> parameters) {
Object result = parameters.getOrDefault("url", parameters.get("jdbcUrl"));
Preconditions.checkNotNull(result, "url or jdbcUrl is required.");
return result.toString();
}
}
| 4,417 | 0.715418 | 0.714286 | 97 | 44.536083 | 39.886196 | 152 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.639175 | false | false |
12
|
5ea4dd6512ef8322fe21fbcb97cf9005f5340158
| 2,791,728,744,247 |
5885d78198877013d725a73f56451e3692de76a6
|
/ClusterWatchdog/ClusterWatchdogService/src/main/java/com/redhat/gss/eap6/clustering/JgroupsViewChangeWorkerThread.java
|
9eae79ad68443c4e6d90f21e422125aa787fa120
|
[] |
no_license
|
lichyc/clusterWatchdog
|
https://github.com/lichyc/clusterWatchdog
|
f538c5c655e5e63b5093d55e16aad0e134a86636
|
2cf79f6357a6ddaf6d87b1f09e74e8c03509fd9a
|
refs/heads/master
| 2021-11-23T23:40:46.574000 | 2016-07-18T10:36:51 | 2016-07-18T10:36:51 | 38,826,426 | 1 | 1 | null | false | 2015-07-13T16:19:06 | 2015-07-09T14:47:37 | 2015-07-10T15:11:48 | 2015-07-13T16:19:05 | 0 | 0 | 1 | 0 |
Java
| null | null |
/**
* JBoss, Home of Professional Open Source
* Copyright 2016, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package com.redhat.gss.eap6.clustering;
import java.util.List;
import java.util.logging.Logger;
import org.jgroups.Address;
import org.jgroups.View;
/**
* Worker to process operations on <code>JgroupsViewChangeListener</code> implementations.
* We spin a new thread to avoid <code>jgroups</code> get blocked by these operations.
*
* @author <a href="mailto:clichybi@redhat.com">Carsten Lichy-Bittendorf</a>
* @version $Revision$
* $Date$: Date of last commit
*
*/
public class JgroupsViewChangeWorkerThread extends Thread {
private static final Logger log = Logger.getLogger( JgroupsViewChangeWorkerThread.class.getName() );
private JgroupsViewChangeListener listener;
private View view;
private List<Address> membersCluster;
private JGroupsEvent event;
public JgroupsViewChangeWorkerThread(JgroupsViewChangeListener listener, View view, List<Address> membersCluster, JGroupsEvent event) {
super ();
this.listener = listener;
this.view = view;
this.membersCluster = membersCluster;
this.event = event;
}
public void run() {
switch (event) {
case join:
listener.executeOnJoin(view, membersCluster);
break;
case exit:
listener.executeOnExit(view, membersCluster);
break;
case failure:
listener.executeOnFailure(view, membersCluster);
break;
case assumeNormalOperationsMode:
listener.assumeNormalOperationsMode();
break;
default:
log.severe("Switch to operation failed.");
break;
}
}
}
|
UTF-8
|
Java
| 2,498 |
java
|
JgroupsViewChangeWorkerThread.java
|
Java
|
[
{
"context": " these operations.\n * \n * @author <a href=\"mailto:clichybi@redhat.com\">Carsten Lichy-Bittendorf</a>\n * @version $Revisi",
"end": 1389,
"score": 0.9998129606246948,
"start": 1370,
"tag": "EMAIL",
"value": "clichybi@redhat.com"
},
{
"context": " \n * @author <a href=\"mailto:clichybi@redhat.com\">Carsten Lichy-Bittendorf</a>\n * @version $Revision$\n * $Date$: Date of ",
"end": 1415,
"score": 0.9998883008956909,
"start": 1391,
"tag": "NAME",
"value": "Carsten Lichy-Bittendorf"
}
] | null |
[] |
/**
* JBoss, Home of Professional Open Source
* Copyright 2016, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package com.redhat.gss.eap6.clustering;
import java.util.List;
import java.util.logging.Logger;
import org.jgroups.Address;
import org.jgroups.View;
/**
* Worker to process operations on <code>JgroupsViewChangeListener</code> implementations.
* We spin a new thread to avoid <code>jgroups</code> get blocked by these operations.
*
* @author <a href="mailto:<EMAIL>"><NAME></a>
* @version $Revision$
* $Date$: Date of last commit
*
*/
public class JgroupsViewChangeWorkerThread extends Thread {
private static final Logger log = Logger.getLogger( JgroupsViewChangeWorkerThread.class.getName() );
private JgroupsViewChangeListener listener;
private View view;
private List<Address> membersCluster;
private JGroupsEvent event;
public JgroupsViewChangeWorkerThread(JgroupsViewChangeListener listener, View view, List<Address> membersCluster, JGroupsEvent event) {
super ();
this.listener = listener;
this.view = view;
this.membersCluster = membersCluster;
this.event = event;
}
public void run() {
switch (event) {
case join:
listener.executeOnJoin(view, membersCluster);
break;
case exit:
listener.executeOnExit(view, membersCluster);
break;
case failure:
listener.executeOnFailure(view, membersCluster);
break;
case assumeNormalOperationsMode:
listener.assumeNormalOperationsMode();
break;
default:
log.severe("Switch to operation failed.");
break;
}
}
}
| 2,468 | 0.740592 | 0.733387 | 83 | 29.108435 | 29.208437 | 136 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.578313 | false | false |
12
|
be30188e171b8ed13440682110cd5c8a7f1c497e
| 32,813,550,206,037 |
4ab0638789ba41d61e007aad16de86e74ee36648
|
/src/teste/testeProp.java
|
ab402484372b2dd8c8f6bf1a6d23dc9db39162a9
|
[] |
no_license
|
Pinotti/Simob
|
https://github.com/Pinotti/Simob
|
ce2bd505d0cf33cc23c06ca5b92933536ee969cf
|
3f37b696357c27e434601bf49a9308822a32ae95
|
refs/heads/master
| 2018-02-06T23:52:31.575000 | 2017-09-19T23:34:34 | 2017-09-19T23:34:34 | 95,700,708 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package teste;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import bean.DadosPJ;
import bean.Endereco;
import bean.Fone;
import bean.Proprietario;
import dao.ProprietarioDao;
public class testeProp {
public static void main(String[] args) {
/*Proprietario prop = new Proprietario();
DadosPF dados = new DadosPF();
Endereco end = new Endereco();
Fone foneCel = new Fone();
Fone foneRes = new Fone();
List<Endereco> ends = new ArrayList<Endereco>();
List<Fone> fones = new ArrayList<Fone>();
//dados.setIdPf(43);
dados.setSexo("F");
dados.setNaturalidade("Blumenau");
dados.setNacionalidade("Brasileira");
dados.setEstadoCivil("Separado(a)");
dados.setRg("12354");
//end.setIdEndereco(17);
end.setTipo("Residencial");
end.setLogradouro("Avenida Castelo Branco");
end.setNro("314");
end.setComplemento("Ap 1106");
end.setBairro("Centro");
end.setCidade("Pomerode");
end.setEstado("Santa Catarina");
end.setCep("88123456");
ends.add(end);
//foneRes.setIdFone(37);
foneRes.setTipo("Residencial");
foneRes.setDdd("47");
foneRes.setNro("30678912");
//foneCel.setIdFone(38);
foneCel.setTipo("Celular");
foneCel.setDdd("47");
foneCel.setNro("988123456");
foneCel.setOperadora("VIVO");
fones.add(foneRes);
fones.add(foneCel);
//prop.setIdPessoa(43);
prop.setTipo("PF");
prop.setNome("Elisabete Vieira da Silva");
prop.setRegistro("12345678988");
prop.setEmail("elvis@email.com");
prop.setDadosPF(dados);
prop.setEndereco(ends);
prop.setFone(fones);
ProprietarioDao propDao = new ProprietarioDao();
try {
propDao.inserirPF(prop);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/
/*ProprietarioDao pDao = new ProprietarioDao();
Proprietario p = new Proprietario();
try {
p = pDao.selecionarPorId(39);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(p.getNome());
System.out.println(p.getRegistro());
List<Proprietario> pros = new ArrayList<Proprietario>();
try {
pros.addAll(pDao.selecionarTodos());
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for (Proprietario proprietario : pros) {
System.out.println(proprietario.getIdPessoa());
System.out.println(proprietario.getNome());
System.out.println(proprietario.getRegistro());
System.out.println(proprietario.getEmail());
for (Fone fones1 : proprietario.getFone()) {
System.out.println(fones1.getTipo());
System.out.println("("+fones1.getDdd()+")"+fones1.getNro());
}
}*/
Proprietario propPJ = new Proprietario();
ProprietarioDao propDaoPJ = new ProprietarioDao();
List<Endereco> ends = new ArrayList<Endereco>();
List<Fone> fonesPJ = new ArrayList<Fone>();
DadosPJ dadosPJ = new DadosPJ();
propPJ.setTipo("PJ");
propPJ.setNome("Restaurante Ataliba LTDA.");
propPJ.setRegistro("78945612325894");
propPJ.setEmail("contato@ataliba.com.br");
Endereco endCom = new Endereco();
endCom.setTipo("Comercial");
endCom.setLogradouro("Alameda Rio Branco");
endCom.setNro("16854");
endCom.setBairro("Centro");
endCom.setCidade("Blumenau");
endCom.setEstado("SC");
endCom.setCep("88999444");
ends.add(endCom);
//propPJ.setEndereco(ends);
Fone foneCom = new Fone();
foneCom.setTipo("Comercial");
foneCom.setDdd("47");
foneCom.setNro("33874188");
Fone foneCel = new Fone();
foneCel.setTipo("Celular");
foneCel.setDdd("47");
foneCel.setNro("988556699");
fonesPJ.add(foneCom);
fonesPJ.add(foneCel);
propPJ.setFone(fonesPJ);
dadosPJ.setRazaoSocial("Restaurante Ataliba LTDA.");
dadosPJ.setInscEstadual("789456132");
dadosPJ.setInscMunicipal("001.258");
dadosPJ.setFaturamentoMensal(7000.50);
propPJ.setDadosPJ(dadosPJ);
try {
propDaoPJ.inserir(propPJ);
//propDaoPJ.editar(propPJ);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 4,102 |
java
|
testeProp.java
|
Java
|
[
{
"context": "Pessoa(43);\n\t\tprop.setTipo(\"PF\");\n\t\tprop.setNome(\"Elisabete Vieira da Silva\");\n\t\tprop.setRegistro(\"12345678988\");\n\t\tprop.setE",
"end": 1432,
"score": 0.9998866319656372,
"start": 1407,
"tag": "NAME",
"value": "Elisabete Vieira da Silva"
},
{
"context": "prop.setRegistro(\"12345678988\");\n\t\tprop.setEmail(\"elvis@email.com\");\n\t\tprop.setDadosPF(dados);\n\t\tprop.setEndereco(e",
"end": 1503,
"score": 0.9999306797981262,
"start": 1488,
"tag": "EMAIL",
"value": "elvis@email.com"
},
{
"context": "setRegistro(\"78945612325894\");\n\t\tpropPJ.setEmail(\"contato@ataliba.com.br\");\n\t\t\n\t\tEndereco endCom = new Endereco();\n\t\tendCo",
"end": 3075,
"score": 0.9999241232872009,
"start": 3053,
"tag": "EMAIL",
"value": "contato@ataliba.com.br"
}
] | null |
[] |
package teste;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import bean.DadosPJ;
import bean.Endereco;
import bean.Fone;
import bean.Proprietario;
import dao.ProprietarioDao;
public class testeProp {
public static void main(String[] args) {
/*Proprietario prop = new Proprietario();
DadosPF dados = new DadosPF();
Endereco end = new Endereco();
Fone foneCel = new Fone();
Fone foneRes = new Fone();
List<Endereco> ends = new ArrayList<Endereco>();
List<Fone> fones = new ArrayList<Fone>();
//dados.setIdPf(43);
dados.setSexo("F");
dados.setNaturalidade("Blumenau");
dados.setNacionalidade("Brasileira");
dados.setEstadoCivil("Separado(a)");
dados.setRg("12354");
//end.setIdEndereco(17);
end.setTipo("Residencial");
end.setLogradouro("Avenida Castelo Branco");
end.setNro("314");
end.setComplemento("Ap 1106");
end.setBairro("Centro");
end.setCidade("Pomerode");
end.setEstado("Santa Catarina");
end.setCep("88123456");
ends.add(end);
//foneRes.setIdFone(37);
foneRes.setTipo("Residencial");
foneRes.setDdd("47");
foneRes.setNro("30678912");
//foneCel.setIdFone(38);
foneCel.setTipo("Celular");
foneCel.setDdd("47");
foneCel.setNro("988123456");
foneCel.setOperadora("VIVO");
fones.add(foneRes);
fones.add(foneCel);
//prop.setIdPessoa(43);
prop.setTipo("PF");
prop.setNome("<NAME>");
prop.setRegistro("12345678988");
prop.setEmail("<EMAIL>");
prop.setDadosPF(dados);
prop.setEndereco(ends);
prop.setFone(fones);
ProprietarioDao propDao = new ProprietarioDao();
try {
propDao.inserirPF(prop);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/
/*ProprietarioDao pDao = new ProprietarioDao();
Proprietario p = new Proprietario();
try {
p = pDao.selecionarPorId(39);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(p.getNome());
System.out.println(p.getRegistro());
List<Proprietario> pros = new ArrayList<Proprietario>();
try {
pros.addAll(pDao.selecionarTodos());
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for (Proprietario proprietario : pros) {
System.out.println(proprietario.getIdPessoa());
System.out.println(proprietario.getNome());
System.out.println(proprietario.getRegistro());
System.out.println(proprietario.getEmail());
for (Fone fones1 : proprietario.getFone()) {
System.out.println(fones1.getTipo());
System.out.println("("+fones1.getDdd()+")"+fones1.getNro());
}
}*/
Proprietario propPJ = new Proprietario();
ProprietarioDao propDaoPJ = new ProprietarioDao();
List<Endereco> ends = new ArrayList<Endereco>();
List<Fone> fonesPJ = new ArrayList<Fone>();
DadosPJ dadosPJ = new DadosPJ();
propPJ.setTipo("PJ");
propPJ.setNome("Restaurante Ataliba LTDA.");
propPJ.setRegistro("78945612325894");
propPJ.setEmail("<EMAIL>");
Endereco endCom = new Endereco();
endCom.setTipo("Comercial");
endCom.setLogradouro("Alameda Rio Branco");
endCom.setNro("16854");
endCom.setBairro("Centro");
endCom.setCidade("Blumenau");
endCom.setEstado("SC");
endCom.setCep("88999444");
ends.add(endCom);
//propPJ.setEndereco(ends);
Fone foneCom = new Fone();
foneCom.setTipo("Comercial");
foneCom.setDdd("47");
foneCom.setNro("33874188");
Fone foneCel = new Fone();
foneCel.setTipo("Celular");
foneCel.setDdd("47");
foneCel.setNro("988556699");
fonesPJ.add(foneCom);
fonesPJ.add(foneCel);
propPJ.setFone(fonesPJ);
dadosPJ.setRazaoSocial("Restaurante Ataliba LTDA.");
dadosPJ.setInscEstadual("789456132");
dadosPJ.setInscMunicipal("001.258");
dadosPJ.setFaturamentoMensal(7000.50);
propPJ.setDadosPJ(dadosPJ);
try {
propDaoPJ.inserir(propPJ);
//propDaoPJ.editar(propPJ);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| 4,060 | 0.686494 | 0.653096 | 161 | 24.47826 | 15.549595 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.608696 | false | false |
12
|
3a0c233d16bf1c94cc18e6340682b3abf4a130a0
| 26,603,027,489,122 |
24a70d18d5913bb08cd24eff2e91fdd5f056e30d
|
/src/main/java/com/jcbase/core/pojo/Obj.java
|
47ae1e49b2fb32b2229f80223937ed4f54a3e596
|
[
"Apache-2.0"
] |
permissive
|
379685397/BIManager
|
https://github.com/379685397/BIManager
|
51783ac380ea576b1ad7b334a94db4d1488b07f8
|
f6b20c8c3ca6165464c04e7872259cae6653288c
|
refs/heads/master
| 2020-03-15T11:26:05.742000 | 2018-06-13T00:17:20 | 2018-06-13T00:17:20 | 132,120,853 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jcbase.core.pojo;
import java.util.Date;
/**
* sys_obj 实体类
*/
public class Obj{
private int id;
private String name;
private String link;
private String params;
private String type;
private int group_id;
private String subject;
private int user_id;
private Date create_time;
public void setId(int id){
this.id=id;
}
public int getId(){
return id;
}
public void setName(String name){
this.name=name;
}
public String getName(){
return name;
}
public void setLink(String link){
this.link=link;
}
public String getLink(){
return link;
}
public void setParams(String params){
this.params=params;
}
public String getParams(){
return params;
}
public void setType(String type){
this.type=type;
}
public String getType(){
return type;
}
public void setGroup_id(int group_id){
this.group_id=group_id;
}
public int getGroup_id(){
return group_id;
}
public void setSubject(String subject){
this.subject=subject;
}
public String getSubject(){
return subject;
}
public void setUser_id(int user_id){
this.user_id=user_id;
}
public int getUser_id(){
return user_id;
}
public void setCreate_time(Date create_time){
this.create_time=create_time;
}
public Date getCreate_time(){
return create_time;
}
}
|
UTF-8
|
Java
| 1,292 |
java
|
Obj.java
|
Java
|
[] | null |
[] |
package com.jcbase.core.pojo;
import java.util.Date;
/**
* sys_obj 实体类
*/
public class Obj{
private int id;
private String name;
private String link;
private String params;
private String type;
private int group_id;
private String subject;
private int user_id;
private Date create_time;
public void setId(int id){
this.id=id;
}
public int getId(){
return id;
}
public void setName(String name){
this.name=name;
}
public String getName(){
return name;
}
public void setLink(String link){
this.link=link;
}
public String getLink(){
return link;
}
public void setParams(String params){
this.params=params;
}
public String getParams(){
return params;
}
public void setType(String type){
this.type=type;
}
public String getType(){
return type;
}
public void setGroup_id(int group_id){
this.group_id=group_id;
}
public int getGroup_id(){
return group_id;
}
public void setSubject(String subject){
this.subject=subject;
}
public String getSubject(){
return subject;
}
public void setUser_id(int user_id){
this.user_id=user_id;
}
public int getUser_id(){
return user_id;
}
public void setCreate_time(Date create_time){
this.create_time=create_time;
}
public Date getCreate_time(){
return create_time;
}
}
| 1,292 | 0.695956 | 0.695956 | 74 | 16.364864 | 12.109383 | 46 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.364865 | false | false |
12
|
a30cc19d03b9313de2ede91ef73e44dbd47154b4
| 15,496,242,006,863 |
ed428bcab325df7481ed146fbb521451d7ee71e1
|
/backend/src/main/java/com/se/team19/server/Repository/MaintenanceStatusRepository.java
|
d1447bc4f4e6ab540e5a3fe4b8ec5ce0747c2cf7
|
[] |
no_license
|
mmaphr/team19
|
https://github.com/mmaphr/team19
|
151e85bf565971124b8ec44ca9833c96bcce70c0
|
c98344c150571a7f1e94adbba34884992d69c589
|
refs/heads/master
| 2020-05-28T06:37:19.641000 | 2019-03-07T12:30:24 | 2019-03-07T12:30:24 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.se.team19.server.Repository;
import com.se.team19.server.Entity.MaintenanceStatus;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource
public interface MaintenanceStatusRepository extends JpaRepository<MaintenanceStatus, Long> {
MaintenanceStatus findById(long Id);
}
|
UTF-8
|
Java
| 407 |
java
|
MaintenanceStatusRepository.java
|
Java
|
[] | null |
[] |
package com.se.team19.server.Repository;
import com.se.team19.server.Entity.MaintenanceStatus;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource
public interface MaintenanceStatusRepository extends JpaRepository<MaintenanceStatus, Long> {
MaintenanceStatus findById(long Id);
}
| 407 | 0.830467 | 0.820639 | 10 | 38.700001 | 31.157824 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
12
|
88d56152ef9f050862b274c31a8f717485799a75
| 6,648,609,381,641 |
bbc65cbada742e7b54a5bb7839caabe860cb2459
|
/src/main/java/com/hugovs/gls/core/util/StringUtils.java
|
6cc2e092d4f2a6c950b5274316ac25c003fa3caf
|
[] |
no_license
|
HugoSart/gls-core
|
https://github.com/HugoSart/gls-core
|
c18ddb8b8269b900ff56d805a487c7579138ba43
|
80ddccf3966f0865921fd4d45aca70185c79aaf7
|
refs/heads/master
| 2020-05-05T09:55:43.933000 | 2019-04-07T21:07:37 | 2019-04-07T21:07:37 | 179,923,412 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hugovs.gls.core.util;
import java.util.Collection;
/**
* String utilities.
*
* @author Hugo Sartori
*/
public class StringUtils {
private StringUtils() {
//no instance
}
/**
* The hexadecimal representation of each number in a {@link String} format.
*/
private static final String HEXES = "0123456789ABCDEF";
/**
* Join a {@link Collection} into a {@link String} with each element separated with commas.
*
* @param collection: the {@link Collection} to be joined into a {@link String}.
* @return the {@link String} of the joined elements.
*/
public static String join(Collection<?> collection) {
StringBuilder builder = new StringBuilder();
int count = 0;
for (Object o : collection) {
builder.append(o.toString());
if (count < collection.size() - 1) builder.append(", ");
count++;
}
return builder.toString();
}
/**
* Generate a {@link String} of a byte array, separated with spaces.
*
* @param bytes the byte array to be converted to an hexadecimal {@link String}.
* @param hex if the {@link String} needs to be built using hexadecimal representation of bytes.
* @return an hexadecimal {@link String} separated with spaces.
*/
public static String from(byte[] bytes, boolean hex) {
StringBuilder prt = new StringBuilder("[");
int i = 0;
for (byte b : bytes) {
if (hex) prt.append(getHex(new byte[]{b}));
else prt.append(String.format("%4d", b));
if (i < bytes.length - 1)
prt.append(" ");
i++;
}
prt.append("]");
return prt.toString();
}
/**
* Generate a hexadecimal {@link String} of a byte array, separated with spaces.
*
* @param bytes the byte array to be converted to an hexadecimal {@link String}.
* @return an hexadecimal {@link String} separated with spaces.
*/
public static String from(byte[] bytes) {
return from(bytes, true);
}
/**
* Get the hexadecimal {@link String} representation of a byte array.
*
* @param bytes the byte array to be converted to an single hexadecimal {@link String}.
* @return the hexadecimal representation in {@link String} of the {@code bytes}.
*/
private static String getHex(byte[] bytes ) {
if ( bytes == null ) {
return null;
}
final StringBuilder hex = new StringBuilder( 2 * bytes.length );
for ( final byte b : bytes ) {
hex.append(HEXES.charAt((b & 0xF0) >> 4))
.append(HEXES.charAt((b & 0x0F)));
}
return hex.toString();
}
}
|
UTF-8
|
Java
| 2,774 |
java
|
StringUtils.java
|
Java
|
[
{
"context": "ollection;\n\n/**\n * String utilities.\n *\n * @author Hugo Sartori\n */\npublic class StringUtils {\n\n private Strin",
"end": 116,
"score": 0.9998717308044434,
"start": 104,
"tag": "NAME",
"value": "Hugo Sartori"
}
] | null |
[] |
package com.hugovs.gls.core.util;
import java.util.Collection;
/**
* String utilities.
*
* @author <NAME>
*/
public class StringUtils {
private StringUtils() {
//no instance
}
/**
* The hexadecimal representation of each number in a {@link String} format.
*/
private static final String HEXES = "0123456789ABCDEF";
/**
* Join a {@link Collection} into a {@link String} with each element separated with commas.
*
* @param collection: the {@link Collection} to be joined into a {@link String}.
* @return the {@link String} of the joined elements.
*/
public static String join(Collection<?> collection) {
StringBuilder builder = new StringBuilder();
int count = 0;
for (Object o : collection) {
builder.append(o.toString());
if (count < collection.size() - 1) builder.append(", ");
count++;
}
return builder.toString();
}
/**
* Generate a {@link String} of a byte array, separated with spaces.
*
* @param bytes the byte array to be converted to an hexadecimal {@link String}.
* @param hex if the {@link String} needs to be built using hexadecimal representation of bytes.
* @return an hexadecimal {@link String} separated with spaces.
*/
public static String from(byte[] bytes, boolean hex) {
StringBuilder prt = new StringBuilder("[");
int i = 0;
for (byte b : bytes) {
if (hex) prt.append(getHex(new byte[]{b}));
else prt.append(String.format("%4d", b));
if (i < bytes.length - 1)
prt.append(" ");
i++;
}
prt.append("]");
return prt.toString();
}
/**
* Generate a hexadecimal {@link String} of a byte array, separated with spaces.
*
* @param bytes the byte array to be converted to an hexadecimal {@link String}.
* @return an hexadecimal {@link String} separated with spaces.
*/
public static String from(byte[] bytes) {
return from(bytes, true);
}
/**
* Get the hexadecimal {@link String} representation of a byte array.
*
* @param bytes the byte array to be converted to an single hexadecimal {@link String}.
* @return the hexadecimal representation in {@link String} of the {@code bytes}.
*/
private static String getHex(byte[] bytes ) {
if ( bytes == null ) {
return null;
}
final StringBuilder hex = new StringBuilder( 2 * bytes.length );
for ( final byte b : bytes ) {
hex.append(HEXES.charAt((b & 0xF0) >> 4))
.append(HEXES.charAt((b & 0x0F)));
}
return hex.toString();
}
}
| 2,768 | 0.578587 | 0.571017 | 87 | 30.885057 | 28.607702 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.321839 | false | false |
12
|
13e8e929ed9f055a902d96f992bc555b73804342
| 22,514,218,626,874 |
817a5de5aa2ce5adcc5673802bc8f71537c9ceee
|
/app/src/main/java/com/prasilabs/traveldistance/modules/splash_login/LoginFragment.java
|
1173a97de9d113d80623794bcbd6870e7e0654df
|
[] |
no_license
|
praslnx8/TruckTracker
|
https://github.com/praslnx8/TruckTracker
|
2bed69b000c358079dcc9aacecea939ac8cf0489
|
46ee462a0779b89046633b4c19cd2077c002394b
|
refs/heads/master
| 2016-09-13T19:10:18.150000 | 2016-04-25T19:38:03 | 2016-04-25T19:38:03 | 56,995,647 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.prasilabs.traveldistance.modules.splash_login;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.InputType;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.prasilabs.traveldistance.HomeActivity;
import com.prasilabs.traveldistance.R;
import com.prasilabs.traveldistance.constants.MyConstant;
import com.prasilabs.traveldistance.core.CoreFragment;
import com.prasilabs.traveldistance.data.LocalPreference;
import com.prasilabs.traveldistance.model.AdminModel;
import com.prasilabs.traveldistance.model.StatsModel;
import com.prasilabs.traveldistance.utils.CoreUtil;
import com.prasilabs.traveldistance.utils.UserInteractionUtil;
/**
* Created by prasi on 18/4/16.
*/
public class LoginFragment extends CoreFragment
{
private static final String TAG = LoginFragment.class.getSimpleName();
public static LoginFragment newInstance()
{
LoginFragment loginFragment = new LoginFragment();
return loginFragment;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
{
if(getFragmentView() == null)
{
setFragmentView(inflater.inflate(R.layout.fragment_logn, container, false));
final EditText vNameText = (EditText) getFragmentView().findViewById(R.id.v_name_text);
Button lgnButton = (Button) getFragmentView().findViewById(R.id.login_btn);
TextView adminButton = (TextView) getFragmentView().findViewById(R.id.admin_btn);
lgnButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
if(TextUtils.isEmpty(vNameText.getText()))
{
vNameText.setError("Enter vehicle name");
}
else if(vNameText.getText().toString().equalsIgnoreCase("admin"))
{
vNameText.setError("name should not be admin");
}
else
{
LocalPreference.saveLoginDataInShared(getContext(), MyConstant.V_NAME_TEXT, vNameText.getText().toString());
showLoader();
StatsModel.getInstance().sendStatsData(getContext(), new StatsModel.SendStatsCallBack() {
@Override
public void statusSent(boolean success)
{
dismissLoader();
Intent intent = new Intent(getContext(), HomeActivity.class);
startActivity(intent);
getCoreActivity().finish();
}
});
}
}
});
adminButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
UserInteractionUtil.showEditTextDialog(getContext(), InputType.TYPE_CLASS_NUMBER, "Admin key", new UserInteractionUtil.EditTextDialogCallBack() {
@Override
public void getValue(final String value)
{
AdminModel.getInstance().adminLogin(value, new AdminModel.AdminLoginCallBack() {
@Override
public void adminLoginResult(boolean success)
{
if(success)
{
LocalPreference.saveLoginDataInShared(getContext(), MyConstant.ADMIN_KEY, value);
Intent intent = new Intent(getContext(), HomeActivity.class);
startActivity(intent);
getCoreActivity().finish();
}
else
{
CoreUtil.t(getContext(), "unabel to verify admin. Please contact praslnx8@gmail.com");
}
}
});
}
});
}
});
}
return getFragmentView();
}
}
|
UTF-8
|
Java
| 4,802 |
java
|
LoginFragment.java
|
Java
|
[
{
"context": "ance.utils.UserInteractionUtil;\n\n/**\n * Created by prasi on 18/4/16.\n */\npublic class LoginFragment extend",
"end": 918,
"score": 0.9936206340789795,
"start": 913,
"tag": "USERNAME",
"value": "prasi"
},
{
"context": "Context(), \"unabel to verify admin. Please contact praslnx8@gmail.com\");\n }\n ",
"end": 4557,
"score": 0.9999239444732666,
"start": 4539,
"tag": "EMAIL",
"value": "praslnx8@gmail.com"
}
] | null |
[] |
package com.prasilabs.traveldistance.modules.splash_login;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.InputType;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.prasilabs.traveldistance.HomeActivity;
import com.prasilabs.traveldistance.R;
import com.prasilabs.traveldistance.constants.MyConstant;
import com.prasilabs.traveldistance.core.CoreFragment;
import com.prasilabs.traveldistance.data.LocalPreference;
import com.prasilabs.traveldistance.model.AdminModel;
import com.prasilabs.traveldistance.model.StatsModel;
import com.prasilabs.traveldistance.utils.CoreUtil;
import com.prasilabs.traveldistance.utils.UserInteractionUtil;
/**
* Created by prasi on 18/4/16.
*/
public class LoginFragment extends CoreFragment
{
private static final String TAG = LoginFragment.class.getSimpleName();
public static LoginFragment newInstance()
{
LoginFragment loginFragment = new LoginFragment();
return loginFragment;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
{
if(getFragmentView() == null)
{
setFragmentView(inflater.inflate(R.layout.fragment_logn, container, false));
final EditText vNameText = (EditText) getFragmentView().findViewById(R.id.v_name_text);
Button lgnButton = (Button) getFragmentView().findViewById(R.id.login_btn);
TextView adminButton = (TextView) getFragmentView().findViewById(R.id.admin_btn);
lgnButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
if(TextUtils.isEmpty(vNameText.getText()))
{
vNameText.setError("Enter vehicle name");
}
else if(vNameText.getText().toString().equalsIgnoreCase("admin"))
{
vNameText.setError("name should not be admin");
}
else
{
LocalPreference.saveLoginDataInShared(getContext(), MyConstant.V_NAME_TEXT, vNameText.getText().toString());
showLoader();
StatsModel.getInstance().sendStatsData(getContext(), new StatsModel.SendStatsCallBack() {
@Override
public void statusSent(boolean success)
{
dismissLoader();
Intent intent = new Intent(getContext(), HomeActivity.class);
startActivity(intent);
getCoreActivity().finish();
}
});
}
}
});
adminButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
UserInteractionUtil.showEditTextDialog(getContext(), InputType.TYPE_CLASS_NUMBER, "Admin key", new UserInteractionUtil.EditTextDialogCallBack() {
@Override
public void getValue(final String value)
{
AdminModel.getInstance().adminLogin(value, new AdminModel.AdminLoginCallBack() {
@Override
public void adminLoginResult(boolean success)
{
if(success)
{
LocalPreference.saveLoginDataInShared(getContext(), MyConstant.ADMIN_KEY, value);
Intent intent = new Intent(getContext(), HomeActivity.class);
startActivity(intent);
getCoreActivity().finish();
}
else
{
CoreUtil.t(getContext(), "unabel to verify admin. Please contact <EMAIL>");
}
}
});
}
});
}
});
}
return getFragmentView();
}
}
| 4,791 | 0.531862 | 0.530612 | 115 | 40.756523 | 33.197327 | 165 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.547826 | false | false |
12
|
43dfb4ee93e8ddf0388bf094a36078c9922e3e1a
| 9,852,654,977,649 |
6704c3853e9b59c420b174c5462d52278768ccb8
|
/appiumframework/src/test/java/com/test/tets.java
|
05d5b72a3e153f417d20961bfd9a6677f6392fe7
|
[] |
no_license
|
cataco/podam-java-habitica
|
https://github.com/cataco/podam-java-habitica
|
5324e4905f41c89f275cd84d7fb981bae1912e9b
|
bd34b35bd666812f2696727e7c77976d6d92204d
|
refs/heads/master
| 2022-12-19T20:18:33.017000 | 2020-10-16T19:38:20 | 2020-10-16T19:38:20 | 304,722,587 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.test;
import model.Habit;
import org.testng.annotations.Test;
import uk.co.jemos.podam.api.PodamFactory;
import uk.co.jemos.podam.api.PodamFactoryImpl;
public class tets {
@Test
public void testName() {
PodamFactory factory = new PodamFactoryImpl();
// This will use constructor with minimum arguments and
// then setters to populate POJO
Habit habit = factory.manufacturePojo(Habit.class);
System.out.println("Title: " + habit.getTitle());
System.out.println("Notes: " + habit.getNotes());
}
}
|
UTF-8
|
Java
| 533 |
java
|
tets.java
|
Java
|
[] | null |
[] |
package com.test;
import model.Habit;
import org.testng.annotations.Test;
import uk.co.jemos.podam.api.PodamFactory;
import uk.co.jemos.podam.api.PodamFactoryImpl;
public class tets {
@Test
public void testName() {
PodamFactory factory = new PodamFactoryImpl();
// This will use constructor with minimum arguments and
// then setters to populate POJO
Habit habit = factory.manufacturePojo(Habit.class);
System.out.println("Title: " + habit.getTitle());
System.out.println("Notes: " + habit.getNotes());
}
}
| 533 | 0.729831 | 0.729831 | 20 | 25.65 | 21.076706 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.45 | false | false |
12
|
1905cfb64df05991be40c5919a44d7077fe73308
| 24,318,104,832,269 |
8aa90e75e3eeacc58c428721e81b00eca5339656
|
/CreateAgent/com/example/tests/Before.java
|
ae164952ed0dd6e467c4255514652a2d6bb41b15
|
[] |
no_license
|
anuroj/automation
|
https://github.com/anuroj/automation
|
214c7d2d88657d37a5ee0eb1e31ddd115ab013f5
|
f2ba8259c9546f126c2fe9ac407fbd6ffa0ab35c
|
refs/heads/master
| 2016-09-01T19:26:20.334000 | 2013-04-26T07:45:05 | 2013-04-26T07:45:05 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.tests;
public @interface Before {
}
|
UTF-8
|
Java
| 58 |
java
|
Before.java
|
Java
|
[] | null |
[] |
package com.example.tests;
public @interface Before {
}
| 58 | 0.741379 | 0.741379 | 5 | 10.6 | 12.579349 | 26 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false |
12
|
dfeb2e968e843b110d36774e6f59873ef412b653
| 14,139,032,370,358 |
702674cd6456486025a08a9a081a41aff6fdfb09
|
/app/src/main/java/com/tsyc/tianshengyoucai/model/adapter/BackMoneyRecAdapter.java
|
8784b21d7223ef96b98638529113c4c1e1c3fa5d
|
[] |
no_license
|
yufeilong92/2019-9-12
|
https://github.com/yufeilong92/2019-9-12
|
b9730b128e6bdf37bc7dd007559e0ec15e4c46ed
|
ac9c14467ea6e513c057062880da2b193b4eff86
|
refs/heads/master
| 2020-07-24T12:58:51.588000 | 2019-09-12T02:08:21 | 2019-09-12T02:08:21 | 207,935,624 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.tsyc.tianshengyoucai.model.adapter;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tsyc.tianshengyoucai.R;
import com.tsyc.tianshengyoucai.model.bean.BackMoneyBean;
import com.tsyc.tianshengyoucai.utils.ImageLoader;
import java.util.List;
/**
* author:van
* CreateTime:2019/8/8
* File description: 退款是否收到货
*/
public class BackMoneyRecAdapter extends BaseQuickAdapter<BackMoneyBean.ResultBean.RefundTypeBean, BaseViewHolder> {
public BackMoneyRecAdapter(@Nullable List<BackMoneyBean.ResultBean.RefundTypeBean> data) {
super(R.layout.layout_back_money_rec_item, data);
}
public BackMoneyRecAdapter() {
super(R.layout.layout_back_money_rec_item);
}
@Override
protected void convert(BaseViewHolder holder, BackMoneyBean.ResultBean.RefundTypeBean dataBean) {
TextView tv_name = holder.getView(R.id.tv_bag_type);
TextView tv_desc = holder.getView(R.id.tv_bag_detail);
ImageView imageView = holder.getView(R.id.iv_bag);
String description = dataBean.getDescription();
String img = dataBean.getImg();
String name = dataBean.getName();
tv_name.setText(name);
tv_desc.setText(description);
ImageLoader.setImageCircle(mContext, img, imageView);
}
}
|
UTF-8
|
Java
| 1,485 |
java
|
BackMoneyRecAdapter.java
|
Java
|
[
{
"context": "ageLoader;\n\nimport java.util.List;\n\n/**\n * author:van\n * CreateTime:2019/8/8\n * File description: 退款是否收",
"end": 453,
"score": 0.9448253512382507,
"start": 450,
"tag": "USERNAME",
"value": "van"
}
] | null |
[] |
package com.tsyc.tianshengyoucai.model.adapter;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tsyc.tianshengyoucai.R;
import com.tsyc.tianshengyoucai.model.bean.BackMoneyBean;
import com.tsyc.tianshengyoucai.utils.ImageLoader;
import java.util.List;
/**
* author:van
* CreateTime:2019/8/8
* File description: 退款是否收到货
*/
public class BackMoneyRecAdapter extends BaseQuickAdapter<BackMoneyBean.ResultBean.RefundTypeBean, BaseViewHolder> {
public BackMoneyRecAdapter(@Nullable List<BackMoneyBean.ResultBean.RefundTypeBean> data) {
super(R.layout.layout_back_money_rec_item, data);
}
public BackMoneyRecAdapter() {
super(R.layout.layout_back_money_rec_item);
}
@Override
protected void convert(BaseViewHolder holder, BackMoneyBean.ResultBean.RefundTypeBean dataBean) {
TextView tv_name = holder.getView(R.id.tv_bag_type);
TextView tv_desc = holder.getView(R.id.tv_bag_detail);
ImageView imageView = holder.getView(R.id.iv_bag);
String description = dataBean.getDescription();
String img = dataBean.getImg();
String name = dataBean.getName();
tv_name.setText(name);
tv_desc.setText(description);
ImageLoader.setImageCircle(mContext, img, imageView);
}
}
| 1,485 | 0.735836 | 0.731741 | 49 | 28.897959 | 29.40099 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.530612 | false | false |
12
|
8916cb12ea51cf07742afd049d96464c4b6986f2
| 12,206,297,075,612 |
2da3e9e465d2119d6a49d65efdcb4426ec5015a9
|
/spring-thymeleaf-demo-2/bin/src/main/java/com/spring/thymeleaf/demo2/util/SeguridadUtil.java
|
893da3342132e959df2cf7ad9ad41c35a74df8d0
|
[] |
no_license
|
hernxntk/spring-thymeleaf-demo
|
https://github.com/hernxntk/spring-thymeleaf-demo
|
15d5c7791890d488a0e35a3b0c191696ae9c24c2
|
2de4ce57562b34291c06400177c26b3b947e97ac
|
refs/heads/master
| 2021-01-22T06:28:25.503000 | 2018-02-11T12:02:26 | 2018-02-11T12:02:26 | 92,557,798 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.spring.thymeleaf.demo2.util;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
public class SeguridadUtil {
public static Authentication getAuthentication(){
return SecurityContextHolder.getContext().getAuthentication();
}
public static String getUsername(){
Authentication auth = getAuthentication();
return auth == null ? "": auth.getName();
}
}
|
UTF-8
|
Java
| 470 |
java
|
SeguridadUtil.java
|
Java
|
[] | null |
[] |
package com.spring.thymeleaf.demo2.util;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
public class SeguridadUtil {
public static Authentication getAuthentication(){
return SecurityContextHolder.getContext().getAuthentication();
}
public static String getUsername(){
Authentication auth = getAuthentication();
return auth == null ? "": auth.getName();
}
}
| 470 | 0.761702 | 0.759574 | 16 | 27.375 | 25.320137 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.0625 | false | false |
12
|
221a93daec55dbe72eaeab1555c273a8665ba585
| 17,274,358,506,739 |
355317975d9ddce10cb4131f5c3c16d9669d2667
|
/app/src/main/java/com/autokrew/dialogs/GreetingsDialog.java
|
32c35dfdadaf97f674673b3cb00a99fea2af0526
|
[] |
no_license
|
jigspatel119/Autokrew
|
https://github.com/jigspatel119/Autokrew
|
e693192de81bc420d7ce847a2965ff479522fe1e
|
ff7f4dbaca70cc8960f162b280d6e777830328ff
|
refs/heads/master
| 2023-02-28T23:33:10.443000 | 2021-02-15T06:09:58 | 2021-02-15T06:09:58 | 338,982,707 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.autokrew.dialogs;
import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatDialog;
import android.telephony.SmsManager;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import com.autokrew.R;
import com.autokrew.utils.CommonUtils;
import java.util.ArrayList;
public class GreetingsDialog extends AppCompatDialog implements View.OnClickListener {
private Context mContext;
private Activity mActivity;
Button btn_call,btn_sms;
private static final int MY_PERMISSION_CALL_SMS = 5;
String from_last = "";
EditText edt_msg;
ImageView iv_dialog_cancel;
public GreetingsDialog(Context context, int position) {
super(context);
this.mContext = context;
mActivity = (Activity) mContext;
}
@Override
protected void onStart() {
super.onStart();
getWindow().setWindowAnimations(R.style.animation_slide_from_right);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.dialog_greetings);
getData();
findView();
setData();
setListner();
}
private void getData() {
}
private void setData() {
}
private void setListner() {
btn_call.setOnClickListener(this);
btn_sms.setOnClickListener(this);
iv_dialog_cancel.setOnClickListener(this);
}
private void findView() {
btn_call = (Button) this.findViewById(R.id.btn_call);
btn_sms = (Button) this.findViewById(R.id.btn_sms);
edt_msg = (EditText)this.findViewById(R.id.edt_msg);
iv_dialog_cancel = (ImageView)this.findViewById(R.id.iv_dialog_cancel);
/*Typeface copperplateGothicLight = Typeface.createFromAsset(getAppContext().getAssets(), "GillSans-SemiBold.ttf");
btn_call.setTypeface(copperplateGothicLight);
btn_sms.setTypeface(copperplateGothicLight);*/
}
@Override
public void onClick(View v) {
switch (v.getId())
{
case R.id.btn_call:
from_last = "call";
requestPermissionForCallAndSms(from_last);
break;
case R.id.btn_sms:
from_last = "sms";
requestPermissionForCallAndSms(from_last);
break;
case R.id.iv_dialog_cancel:
dismiss();
break;
}
}
private void requestPermissionForCallAndSms(String from_last) {
if (Build.VERSION.SDK_INT >= 23) {
if(from_last.equalsIgnoreCase("call")){
if(ContextCompat.checkSelfPermission(mContext,
Manifest.permission.CALL_PHONE)
== PackageManager.PERMISSION_GRANTED){
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "")); //number
mContext.startActivity(intent);
dismiss();
}
else {
ActivityCompat.requestPermissions(mActivity,
new String[]{Manifest.permission.SEND_SMS, Manifest.permission.CALL_PHONE},
MY_PERMISSION_CALL_SMS);
}
}
if(from_last.equalsIgnoreCase("sms")){
if (ContextCompat.checkSelfPermission(mContext,
Manifest.permission.SEND_SMS)
== PackageManager.PERMISSION_GRANTED) {
if(edt_msg.getText().toString().length()>0){
//send sms here
sendMessage(edt_msg.getText().toString());
dismiss();
}
else{
CommonUtils.getInstance().displayToast(mContext,"Write message!");
}
}
else {
ActivityCompat.requestPermissions(mActivity,
new String[]{Manifest.permission.SEND_SMS, Manifest.permission.CALL_PHONE},
MY_PERMISSION_CALL_SMS);
}
}
} else {
if(from_last.equalsIgnoreCase("call")){
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "")); //number
mContext.startActivity(intent);
dismiss();
}
else if(from_last.equalsIgnoreCase("sms")){
if(edt_msg.getText().toString().length()>0){
//send sms here
sendMessage(edt_msg.getText().toString());
dismiss();
}
else{
CommonUtils.getInstance().displayToast(mContext,"Write message!");
}
}
}
}
private void sendMessage(String message){
String number = ""; //9276505372
try {
SmsManager smsManager = SmsManager.getDefault();
//smsManager.sendTextMessage(number, null, message, null, null);
ArrayList<String> messageParts = smsManager.divideMessage(message);
smsManager.sendMultipartTextMessage(number, null, messageParts, null, null);
CommonUtils.getInstance().displayToast(mContext,"Message sent!");
} catch (Exception ex) {
Toast.makeText(mContext,ex.getMessage(),
Toast.LENGTH_LONG).show();
ex.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 6,369 |
java
|
GreetingsDialog.java
|
Java
|
[] | null |
[] |
package com.autokrew.dialogs;
import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatDialog;
import android.telephony.SmsManager;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import com.autokrew.R;
import com.autokrew.utils.CommonUtils;
import java.util.ArrayList;
public class GreetingsDialog extends AppCompatDialog implements View.OnClickListener {
private Context mContext;
private Activity mActivity;
Button btn_call,btn_sms;
private static final int MY_PERMISSION_CALL_SMS = 5;
String from_last = "";
EditText edt_msg;
ImageView iv_dialog_cancel;
public GreetingsDialog(Context context, int position) {
super(context);
this.mContext = context;
mActivity = (Activity) mContext;
}
@Override
protected void onStart() {
super.onStart();
getWindow().setWindowAnimations(R.style.animation_slide_from_right);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.dialog_greetings);
getData();
findView();
setData();
setListner();
}
private void getData() {
}
private void setData() {
}
private void setListner() {
btn_call.setOnClickListener(this);
btn_sms.setOnClickListener(this);
iv_dialog_cancel.setOnClickListener(this);
}
private void findView() {
btn_call = (Button) this.findViewById(R.id.btn_call);
btn_sms = (Button) this.findViewById(R.id.btn_sms);
edt_msg = (EditText)this.findViewById(R.id.edt_msg);
iv_dialog_cancel = (ImageView)this.findViewById(R.id.iv_dialog_cancel);
/*Typeface copperplateGothicLight = Typeface.createFromAsset(getAppContext().getAssets(), "GillSans-SemiBold.ttf");
btn_call.setTypeface(copperplateGothicLight);
btn_sms.setTypeface(copperplateGothicLight);*/
}
@Override
public void onClick(View v) {
switch (v.getId())
{
case R.id.btn_call:
from_last = "call";
requestPermissionForCallAndSms(from_last);
break;
case R.id.btn_sms:
from_last = "sms";
requestPermissionForCallAndSms(from_last);
break;
case R.id.iv_dialog_cancel:
dismiss();
break;
}
}
private void requestPermissionForCallAndSms(String from_last) {
if (Build.VERSION.SDK_INT >= 23) {
if(from_last.equalsIgnoreCase("call")){
if(ContextCompat.checkSelfPermission(mContext,
Manifest.permission.CALL_PHONE)
== PackageManager.PERMISSION_GRANTED){
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "")); //number
mContext.startActivity(intent);
dismiss();
}
else {
ActivityCompat.requestPermissions(mActivity,
new String[]{Manifest.permission.SEND_SMS, Manifest.permission.CALL_PHONE},
MY_PERMISSION_CALL_SMS);
}
}
if(from_last.equalsIgnoreCase("sms")){
if (ContextCompat.checkSelfPermission(mContext,
Manifest.permission.SEND_SMS)
== PackageManager.PERMISSION_GRANTED) {
if(edt_msg.getText().toString().length()>0){
//send sms here
sendMessage(edt_msg.getText().toString());
dismiss();
}
else{
CommonUtils.getInstance().displayToast(mContext,"Write message!");
}
}
else {
ActivityCompat.requestPermissions(mActivity,
new String[]{Manifest.permission.SEND_SMS, Manifest.permission.CALL_PHONE},
MY_PERMISSION_CALL_SMS);
}
}
} else {
if(from_last.equalsIgnoreCase("call")){
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "")); //number
mContext.startActivity(intent);
dismiss();
}
else if(from_last.equalsIgnoreCase("sms")){
if(edt_msg.getText().toString().length()>0){
//send sms here
sendMessage(edt_msg.getText().toString());
dismiss();
}
else{
CommonUtils.getInstance().displayToast(mContext,"Write message!");
}
}
}
}
private void sendMessage(String message){
String number = ""; //9276505372
try {
SmsManager smsManager = SmsManager.getDefault();
//smsManager.sendTextMessage(number, null, message, null, null);
ArrayList<String> messageParts = smsManager.divideMessage(message);
smsManager.sendMultipartTextMessage(number, null, messageParts, null, null);
CommonUtils.getInstance().displayToast(mContext,"Message sent!");
} catch (Exception ex) {
Toast.makeText(mContext,ex.getMessage(),
Toast.LENGTH_LONG).show();
ex.printStackTrace();
}
}
}
| 6,369 | 0.582509 | 0.579683 | 229 | 26.812227 | 27.036522 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.489083 | false | false |
12
|
b5ba2fdf778e28489229e4aff994cbc601333b8b
| 31,576,599,585,976 |
d3de16f73a6fd44a7c67fbeec0c42731c9f93a11
|
/src/main/java/com/bookstore/BookstoreApplication.java
|
b4e1f3140e07f3f4594f88eaae712f7eea3b01a3
|
[] |
no_license
|
a1500956/Bookstore
|
https://github.com/a1500956/Bookstore
|
263b678d850a8ab6485c198acd8181cdeab13a5f
|
59499c32f38619433da69e116baaae08ec69e094
|
refs/heads/master
| 2021-01-11T14:43:39.908000 | 2017-02-09T15:01:47 | 2017-02-09T15:01:47 | 80,199,424 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bookstore;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import com.bookstore.domain.Book;
import com.bookstore.domain.BookRepository;
import com.bookstore.domain.User;
import com.bookstore.domain.UserRepository;
@SpringBootApplication
public class BookstoreApplication {
@Bean
public CommandLineRunner demo(BookRepository repository, UserRepository urepository){
return(args)->{
Book book1 = new Book("Kalevala", "Elias Lönnrot", 2014, "978-1505723847", 12.99);
repository.save(book1);
Book book2 = new Book("Moby Dick", "Herman Melville", 1977, "978-3401036397", 24.99);
repository.save(book2);
Book book3 = new Book("Odyssey", "Homer", 1999, "978-0140268867", 9.99);
repository.save(book3);
User user1 = new User("user", "$2a$04$/5O4.ewax.a9VVYdXuxIx.XlfN2M.geqUNkvOBgrlWH5xMORZ2WSa", "USER");
urepository.save(user1);
User user2 = new User("admin", "$2a$04$/n9gE0IP31lUabc.qeOyhOR4DJNPyxE070lPKSgS3IxicSmOrATDe", "ADMIN");
urepository.save(user2);
System.out.println(user2);
};
}
public static void main(String[] args) {
SpringApplication.run(BookstoreApplication.class, args);
}
}
|
UTF-8
|
Java
| 1,345 |
java
|
BookstoreApplication.java
|
Java
|
[
{
"context": "\t\t\n\t\n\treturn(args)->{\n\t\t\n\t\tBook book1 = new Book(\"Kalevala\", \"Elias Lönnrot\", 2014, \"978-1505723847\", 12.99)",
"end": 618,
"score": 0.9918093085289001,
"start": 610,
"tag": "NAME",
"value": "Kalevala"
},
{
"context": "(args)->{\n\t\t\n\t\tBook book1 = new Book(\"Kalevala\", \"Elias Lönnrot\", 2014, \"978-1505723847\", 12.99);\n\t\trepository.sa",
"end": 635,
"score": 0.999832034111023,
"start": 622,
"tag": "NAME",
"value": "Elias Lönnrot"
},
{
"context": "\trepository.save(book1);\n\t\tBook book2 = new Book(\"Moby Dick\", \"Herman Melville\", 1977, \"978-3401036397\", 24.9",
"end": 730,
"score": 0.9998277425765991,
"start": 721,
"tag": "NAME",
"value": "Moby Dick"
},
{
"context": "ave(book1);\n\t\tBook book2 = new Book(\"Moby Dick\", \"Herman Melville\", 1977, \"978-3401036397\", 24.99);\n\t\trepository.sa",
"end": 749,
"score": 0.9998387098312378,
"start": 734,
"tag": "NAME",
"value": "Herman Melville"
},
{
"context": "\trepository.save(book2);\n\t\tBook book3 = new Book(\"Odyssey\", \"Homer\", 1999, \"978-0140268867\", 9.99);\n\t\trepos",
"end": 842,
"score": 0.9985403418540955,
"start": 835,
"tag": "NAME",
"value": "Odyssey"
},
{
"context": ".save(book2);\n\t\tBook book3 = new Book(\"Odyssey\", \"Homer\", 1999, \"978-0140268867\", 9.99);\n\t\trepository.sav",
"end": 851,
"score": 0.9993468523025513,
"start": 846,
"tag": "NAME",
"value": "Homer"
},
{
"context": "itory.save(book3);\n\t\t\n\t\t\n\t\tUser user1 = new User(\"user\", \"$2a$04$/5O4.ewax.a9VVYdXuxIx.XlfN2M.geqUNkvOBg",
"end": 946,
"score": 0.6782151460647583,
"start": 942,
"tag": "USERNAME",
"value": "user"
}
] | null |
[] |
package com.bookstore;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import com.bookstore.domain.Book;
import com.bookstore.domain.BookRepository;
import com.bookstore.domain.User;
import com.bookstore.domain.UserRepository;
@SpringBootApplication
public class BookstoreApplication {
@Bean
public CommandLineRunner demo(BookRepository repository, UserRepository urepository){
return(args)->{
Book book1 = new Book("Kalevala", "<NAME>", 2014, "978-1505723847", 12.99);
repository.save(book1);
Book book2 = new Book("<NAME>", "<NAME>", 1977, "978-3401036397", 24.99);
repository.save(book2);
Book book3 = new Book("Odyssey", "Homer", 1999, "978-0140268867", 9.99);
repository.save(book3);
User user1 = new User("user", "$2a$04$/5O4.ewax.a9VVYdXuxIx.XlfN2M.geqUNkvOBgrlWH5xMORZ2WSa", "USER");
urepository.save(user1);
User user2 = new User("admin", "$2a$04$/n9gE0IP31lUabc.qeOyhOR4DJNPyxE070lPKSgS3IxicSmOrATDe", "ADMIN");
urepository.save(user2);
System.out.println(user2);
};
}
public static void main(String[] args) {
SpringApplication.run(BookstoreApplication.class, args);
}
}
| 1,325 | 0.75 | 0.68006 | 48 | 26.979166 | 30.381937 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.895833 | false | false |
12
|
7038e4234af4960309de6663027b23be72e45f17
| 9,852,655,011,167 |
fa6f82588ac4d8f0a30e9ae6c756f2de63fde4c9
|
/RobotState.java
|
3dd838b9d8b48f695cde273a60f3c966a69f03ae
|
[] |
no_license
|
zotya701/PhoebeSzkeleton
|
https://github.com/zotya701/PhoebeSzkeleton
|
ecfac012d88384635d16c43e81bdb18877cb45b0
|
5e751f63a886d03b752277781a4fb9dcadb101ac
|
refs/heads/master
| 2020-12-30T18:58:26.803000 | 2015-03-23T00:46:48 | 2015-03-23T00:46:57 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Phoebe;
/**
* A robot lehetséges állapotai.
*/
public enum RobotState {
Normal,
Collided,
Eliminated
}
|
ISO-8859-2
|
Java
| 124 |
java
|
RobotState.java
|
Java
|
[] | null |
[] |
package Phoebe;
/**
* A robot lehetséges állapotai.
*/
public enum RobotState {
Normal,
Collided,
Eliminated
}
| 124 | 0.672131 | 0.672131 | 12 | 9.166667 | 9.948479 | 33 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
12
|
71221e9f730ce8e804db281428ff32b2d3aeb0ee
| 28,269,474,767,107 |
c5cf4137805bca771be48b34433cae7cdf4aa134
|
/src/main/java/me/eddie/inventoryguiapi/gui/elements/FormImage.java
|
4c97086f20a9ab6862cba56e2f3fd5b19af3a339
|
[] |
no_license
|
Prodrivers/InventoryGUIAPI
|
https://github.com/Prodrivers/InventoryGUIAPI
|
f624401b072c5b2f5198ae73d8a97628059e4536
|
94245831e8098127d354a294096a8033d38d9ea1
|
refs/heads/master
| 2021-09-22T10:38:03.867000 | 2021-09-20T21:13:47 | 2021-09-20T21:13:47 | 251,445,766 | 0 | 0 | null | true | 2020-03-30T22:48:04 | 2020-03-30T22:48:03 | 2019-03-13T18:03:23 | 2017-05-27T13:36:40 | 8,588 | 0 | 0 | 0 | null | false | false |
package me.eddie.inventoryguiapi.gui.elements;
import java.io.Serializable;
/**
* Describes a Bedrock Form image.
*/
public class FormImage implements Serializable {
public static final FormImage NONE = new FormImage(Type.NONE, null);
public static final FormImage DEFAULT = new FormImage(Type.PATH, null);
private final Type type;
private final String path;
/**
* Creates a new NONE Bedrock image.
*/
public FormImage() {
this(Type.NONE, null);
}
/**
* Creates a new Bedrock image.
* @param type Image type
* @param path Image path
*/
public FormImage(Type type, String path) {
this.type = type;
this.path = path;
}
public Type getType() {
return this.type;
}
public String getPath() {
return this.path;
}
public enum Type {
NONE(null),
PATH("path"),
URL("url");
private final String name;
Type(String name) {
this.name = name;
}
public String toString() {
return this.name;
}
public String getName() {
return this.name;
}
}
}
|
UTF-8
|
Java
| 1,192 |
java
|
FormImage.java
|
Java
|
[] | null |
[] |
package me.eddie.inventoryguiapi.gui.elements;
import java.io.Serializable;
/**
* Describes a Bedrock Form image.
*/
public class FormImage implements Serializable {
public static final FormImage NONE = new FormImage(Type.NONE, null);
public static final FormImage DEFAULT = new FormImage(Type.PATH, null);
private final Type type;
private final String path;
/**
* Creates a new NONE Bedrock image.
*/
public FormImage() {
this(Type.NONE, null);
}
/**
* Creates a new Bedrock image.
* @param type Image type
* @param path Image path
*/
public FormImage(Type type, String path) {
this.type = type;
this.path = path;
}
public Type getType() {
return this.type;
}
public String getPath() {
return this.path;
}
public enum Type {
NONE(null),
PATH("path"),
URL("url");
private final String name;
Type(String name) {
this.name = name;
}
public String toString() {
return this.name;
}
public String getName() {
return this.name;
}
}
}
| 1,192 | 0.565436 | 0.565436 | 59 | 19.20339 | 17.538122 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.372881 | false | false |
12
|
d194a212e7df541db8f6c0ac59564be7946e29da
| 30,442,728,219,379 |
b22e83c6723ee1844e918020954613055cf30987
|
/src/SlidingWindow/LongestSubstringAtMostK.java
|
1fc571722fd43ca342fdbf40a6690970ed60649a
|
[] |
no_license
|
zrjaa1/LeetCode
|
https://github.com/zrjaa1/LeetCode
|
20ca452f9c101e475c92efb93708b8bc751c574d
|
b485886e59b0376622329c8691efbaebbdb12880
|
refs/heads/master
| 2022-08-04T23:59:16.005000 | 2022-07-06T04:52:27 | 2022-07-06T04:52:27 | 172,004,459 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package SlidingWindow;
import java.util.HashMap;
import java.util.Map;
/**
* 340. Longest Substring with At Most K Distinct Characters: https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters/
* Medium
*
* Given a string s and an integer k, return the length of the longest substring of s that contains at most k distinct characters.
*
*
*
* Example 1:
*
* Input: s = "eceba", k = 2
* Output: 3
* Explanation: The substring is "ece" with length 3.
* Example 2:
*
* Input: s = "aa", k = 1
* Output: 2
* Explanation: The substring is "aa" with length 2.
*
*
* Constraints:
*
* 1 <= s.length <= 5 * 104
* 0 <= k <= 50
*/
/**
* 这道题主要考察:
* 1. 复合数据结构:Sorted Double Link List + Map的应用,猜测LRU Cache与此类似
* 2. Potential Optimization: Instead of updateIdx, remove the node directly and append again.
* 3. Alternative Solution: Counter, applicable for both 2 and k cases.
*/
public class LongestSubstringAtMostK {
class Node {
char ch;
int idx;
Node prev, next;
public Node(char ch, int idx) {
this.ch = ch;
this.idx = idx;
}
}
class MyQueue {
Map<Character, Node> map;
Node head, tail;
int k;
public MyQueue(int k) {
this.map = new HashMap<>(k + 1);
this.k = k;
head = new Node('\0', -1);
tail = new Node('\0', -1);
head.next = tail;
tail.prev = head;
}
/**
* add a node in map and linked list
* @param ch
* @param idx
* @return the next start idx if it needs update, otherwise return -1
*/
public int addNode(char ch, int idx) {
if (map.containsKey(ch)) {
updateIdx(ch, idx);
} else { // add a new node at the end of linked list
Node node = new Node(ch, idx);
map.put(ch, node);
node.prev = tail.prev;
node.next = tail;
tail.prev.next = node;
tail.prev = node;
if (map.size() > k) {
Node remove = head.next;
removeNode(remove);
return remove.idx + 1;
}
}
return -1;
}
/**
* remove a node in map and linked list
* @param node
*/
public void removeNode(Node node) {
node.prev.next = node.next;
node.next.prev = node.prev;
map.remove(node.ch);
}
/**
* update the index of last appearance of a character
* @param ch
* @param idx
*/
private void updateIdx(char ch, int idx) {
Node node = map.get(ch);
node.idx = idx;
Node cur = node;
while (cur != tail && node.idx >= cur.idx) {
cur = cur.next;
}
node.prev.next = node.next;
node.next.prev = node.prev;
node.prev = cur.prev;
node.next = cur;
cur.prev.next = node;
cur.prev = node;
}
}
public int lengthOfLongestSubstringKDistinct(String s, int k) {
if (s == null || s.length() == 0 || k == 0) {
return 0;
}
if (s.length() <= k) {
return s.length();
}
MyQueue queue = new MyQueue(k);
int max = 0, start = 0;
for (int i = 0; i < s.length(); i++) {
char ch = s.charAt(i);
int res = queue.addNode(ch, i);
if (res != -1) {
start = res;
}
max = Math.max(max, i - start + 1);
}
return max;
}
}
|
UTF-8
|
Java
| 3,825 |
java
|
LongestSubstringAtMostK.java
|
Java
|
[] | null |
[] |
package SlidingWindow;
import java.util.HashMap;
import java.util.Map;
/**
* 340. Longest Substring with At Most K Distinct Characters: https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters/
* Medium
*
* Given a string s and an integer k, return the length of the longest substring of s that contains at most k distinct characters.
*
*
*
* Example 1:
*
* Input: s = "eceba", k = 2
* Output: 3
* Explanation: The substring is "ece" with length 3.
* Example 2:
*
* Input: s = "aa", k = 1
* Output: 2
* Explanation: The substring is "aa" with length 2.
*
*
* Constraints:
*
* 1 <= s.length <= 5 * 104
* 0 <= k <= 50
*/
/**
* 这道题主要考察:
* 1. 复合数据结构:Sorted Double Link List + Map的应用,猜测LRU Cache与此类似
* 2. Potential Optimization: Instead of updateIdx, remove the node directly and append again.
* 3. Alternative Solution: Counter, applicable for both 2 and k cases.
*/
public class LongestSubstringAtMostK {
class Node {
char ch;
int idx;
Node prev, next;
public Node(char ch, int idx) {
this.ch = ch;
this.idx = idx;
}
}
class MyQueue {
Map<Character, Node> map;
Node head, tail;
int k;
public MyQueue(int k) {
this.map = new HashMap<>(k + 1);
this.k = k;
head = new Node('\0', -1);
tail = new Node('\0', -1);
head.next = tail;
tail.prev = head;
}
/**
* add a node in map and linked list
* @param ch
* @param idx
* @return the next start idx if it needs update, otherwise return -1
*/
public int addNode(char ch, int idx) {
if (map.containsKey(ch)) {
updateIdx(ch, idx);
} else { // add a new node at the end of linked list
Node node = new Node(ch, idx);
map.put(ch, node);
node.prev = tail.prev;
node.next = tail;
tail.prev.next = node;
tail.prev = node;
if (map.size() > k) {
Node remove = head.next;
removeNode(remove);
return remove.idx + 1;
}
}
return -1;
}
/**
* remove a node in map and linked list
* @param node
*/
public void removeNode(Node node) {
node.prev.next = node.next;
node.next.prev = node.prev;
map.remove(node.ch);
}
/**
* update the index of last appearance of a character
* @param ch
* @param idx
*/
private void updateIdx(char ch, int idx) {
Node node = map.get(ch);
node.idx = idx;
Node cur = node;
while (cur != tail && node.idx >= cur.idx) {
cur = cur.next;
}
node.prev.next = node.next;
node.next.prev = node.prev;
node.prev = cur.prev;
node.next = cur;
cur.prev.next = node;
cur.prev = node;
}
}
public int lengthOfLongestSubstringKDistinct(String s, int k) {
if (s == null || s.length() == 0 || k == 0) {
return 0;
}
if (s.length() <= k) {
return s.length();
}
MyQueue queue = new MyQueue(k);
int max = 0, start = 0;
for (int i = 0; i < s.length(); i++) {
char ch = s.charAt(i);
int res = queue.addNode(ch, i);
if (res != -1) {
start = res;
}
max = Math.max(max, i - start + 1);
}
return max;
}
}
| 3,825 | 0.481324 | 0.470993 | 139 | 26.158274 | 22.874779 | 145 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.553957 | false | false |
12
|
0fe618f6ef8fa7309155d612e78637a1ad123a32
| 31,825,707,683,413 |
215e3c3f223baae97f2c23ea024af9468860008a
|
/strategy/src/strategy/RealizadorDeInvestimentos.java
|
144d950182a3b33ade7d6d0a0849c99d565f8c91
|
[] |
no_license
|
ricardolc/DesignPatternsExamples
|
https://github.com/ricardolc/DesignPatternsExamples
|
8e014037fc8d2ce18518dc9cf4ce351e449234ff
|
938f05b967dff76226b6a3c6695fbb4d4e16fb26
|
refs/heads/master
| 2021-01-24T00:27:59.167000 | 2018-04-14T22:10:21 | 2018-04-14T22:10:21 | 29,794,797 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package strategy;
public class RealizadorDeInvestimentos {
public void realizaCalculo(Investimento investimento, TipoInvestimento tipo) {
double retorno = tipo.calcula(investimento);
System.out.println(retorno);
}
}
|
UTF-8
|
Java
| 252 |
java
|
RealizadorDeInvestimentos.java
|
Java
|
[] | null |
[] |
package strategy;
public class RealizadorDeInvestimentos {
public void realizaCalculo(Investimento investimento, TipoInvestimento tipo) {
double retorno = tipo.calcula(investimento);
System.out.println(retorno);
}
}
| 252 | 0.706349 | 0.706349 | 14 | 16 | 23.274755 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.357143 | false | false |
12
|
beab4b9e3d94c04fdd79b1b031a5cc717a12c9cc
| 12,275,016,592,257 |
f89a5ce0bee1382965f8541f9880c015673cc207
|
/2/src/object/main.java
|
e430382f60e07a15d12f55fb60433f748e8e1afd
|
[] |
no_license
|
TaiyuLong/zoo
|
https://github.com/TaiyuLong/zoo
|
3f7b6d57a1bcd7374794ecf6e2d274228c850a5c
|
0fc2e830bea8d1618db8bc6d5e991d5955d36e7c
|
refs/heads/master
| 2020-04-16T18:36:29.347000 | 2019-01-18T10:06:38 | 2019-01-18T10:06:38 | 165,827,367 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package object;
import java.util.Scanner;
public class main {
public static void main(String[]args){
Scanner input=new Scanner(System.in);
Animal cat=new Cat();
System.out.println("请输入猫的年龄:");
cat.setAge(input.nextInt());
System.out.println("请输入猫的身长:");
cat.setSize(input.nextInt());
System.out.println("请输入猫的腿数:");
cat.setLegNumber(input.nextInt());
System.out.println("请输入猫的眼睛数:");
cat.setEyesNumber(input.nextInt());
System.out.println("请输入猫的耳朵数:");
cat.setEarsNumber(input.nextInt());
Animal tiger=new Tiger();
System.out.println("请输入老虎的年龄:");
tiger.setAge(input.nextInt());
System.out.println("请输入老虎的身长:");
tiger.setSize(input.nextInt());
System.out.println("请输入老虎的腿数:");
tiger.setLegNumber(input.nextInt());
System.out.println("请输入老虎的眼睛数:");
tiger.setEyesNumber(input.nextInt());
System.out.println("请输入老虎的耳朵数:");
tiger.setEarsNumber(input.nextInt());
Bird duck=new Duck();
System.out.println("请输入鸭子的年龄:");
duck.setAge(input.nextInt());
System.out.println("请输入鸭子的身长:");
duck.setSize(input.nextInt());
System.out.println("请输入鸭子是否能飞:");
duck.setCanfly(input.next());
System.out.println("请输入鸭子是否为候鸟:");
duck.setMigratorybird(input.next());
Bird dayan=new Dayan();
System.out.println("请输入大雁的年龄:");
dayan.setAge(input.nextInt());
System.out.println("请输入大雁的身长:");
dayan.setSize(input.nextInt());
System.out.println("请输入大雁是否能飞:");
dayan.setCanfly(input.next());
System.out.println("请输入大雁是否为候鸟:");
dayan.setMigratorybird(input.next());
cat.getDescribe();
tiger.getDescribe();
duck.getDescribe();
dayan.getDescribe();
}
}
|
UTF-8
|
Java
| 2,230 |
java
|
main.java
|
Java
|
[] | null |
[] |
package object;
import java.util.Scanner;
public class main {
public static void main(String[]args){
Scanner input=new Scanner(System.in);
Animal cat=new Cat();
System.out.println("请输入猫的年龄:");
cat.setAge(input.nextInt());
System.out.println("请输入猫的身长:");
cat.setSize(input.nextInt());
System.out.println("请输入猫的腿数:");
cat.setLegNumber(input.nextInt());
System.out.println("请输入猫的眼睛数:");
cat.setEyesNumber(input.nextInt());
System.out.println("请输入猫的耳朵数:");
cat.setEarsNumber(input.nextInt());
Animal tiger=new Tiger();
System.out.println("请输入老虎的年龄:");
tiger.setAge(input.nextInt());
System.out.println("请输入老虎的身长:");
tiger.setSize(input.nextInt());
System.out.println("请输入老虎的腿数:");
tiger.setLegNumber(input.nextInt());
System.out.println("请输入老虎的眼睛数:");
tiger.setEyesNumber(input.nextInt());
System.out.println("请输入老虎的耳朵数:");
tiger.setEarsNumber(input.nextInt());
Bird duck=new Duck();
System.out.println("请输入鸭子的年龄:");
duck.setAge(input.nextInt());
System.out.println("请输入鸭子的身长:");
duck.setSize(input.nextInt());
System.out.println("请输入鸭子是否能飞:");
duck.setCanfly(input.next());
System.out.println("请输入鸭子是否为候鸟:");
duck.setMigratorybird(input.next());
Bird dayan=new Dayan();
System.out.println("请输入大雁的年龄:");
dayan.setAge(input.nextInt());
System.out.println("请输入大雁的身长:");
dayan.setSize(input.nextInt());
System.out.println("请输入大雁是否能飞:");
dayan.setCanfly(input.next());
System.out.println("请输入大雁是否为候鸟:");
dayan.setMigratorybird(input.next());
cat.getDescribe();
tiger.getDescribe();
duck.getDescribe();
dayan.getDescribe();
}
}
| 2,230 | 0.596519 | 0.596519 | 58 | 31.689655 | 14.688967 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.810345 | false | false |
12
|
641dd0bdbc3624e73f04ae66d8f43b17286db890
| 3,685,081,952,740 |
85b954bf13411a6737e1649ccf41b02f2a421723
|
/src/main/java/net/paguo/web/lifecycle/RedeployListener.java
|
7bab843489566e51cd8a729ba5dc0bc6d5fdd316
|
[] |
no_license
|
rsvato/problems-journal
|
https://github.com/rsvato/problems-journal
|
7f3a29d776f688011533257a58eb00965b282b7b
|
7f037385847d08d949aab35281e6f372d2da67fc
|
refs/heads/master
| 2021-01-18T13:11:50.406000 | 2008-09-24T22:10:56 | 2008-09-24T22:10:56 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.paguo.web.lifecycle;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContext;
import java.sql.DriverManager;
import java.sql.Driver;
import java.sql.SQLException;
import java.util.Enumeration;
/**
* User: slava
* Date: 15.11.2006
* Time: 1:03:42
* Version: $Id$
*/
public class RedeployListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent servletContextEvent) {
}
public void contextDestroyed(ServletContextEvent servletContextEvent) {
Enumeration<java.sql.Driver> e = DriverManager.getDrivers();
while(e.hasMoreElements()){
Driver d = e.nextElement();
try {
DriverManager.deregisterDriver(d);
} catch (SQLException e1) {
ServletContext servletContext = servletContextEvent.getServletContext();
servletContext.log(new StringBuilder().append("Error deregistering driver ")
.append(d).append(": ").append(e1).toString());
}
}
}
}
|
UTF-8
|
Java
| 1,118 |
java
|
RedeployListener.java
|
Java
|
[
{
"context": "ption;\nimport java.util.Enumeration;\n\n/**\n * User: slava\n * Date: 15.11.2006\n * Time: 1:03:42\n * Version: ",
"end": 292,
"score": 0.9995633363723755,
"start": 287,
"tag": "USERNAME",
"value": "slava"
}
] | null |
[] |
package net.paguo.web.lifecycle;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContext;
import java.sql.DriverManager;
import java.sql.Driver;
import java.sql.SQLException;
import java.util.Enumeration;
/**
* User: slava
* Date: 15.11.2006
* Time: 1:03:42
* Version: $Id$
*/
public class RedeployListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent servletContextEvent) {
}
public void contextDestroyed(ServletContextEvent servletContextEvent) {
Enumeration<java.sql.Driver> e = DriverManager.getDrivers();
while(e.hasMoreElements()){
Driver d = e.nextElement();
try {
DriverManager.deregisterDriver(d);
} catch (SQLException e1) {
ServletContext servletContext = servletContextEvent.getServletContext();
servletContext.log(new StringBuilder().append("Error deregistering driver ")
.append(d).append(": ").append(e1).toString());
}
}
}
}
| 1,118 | 0.675313 | 0.661896 | 34 | 31.882353 | 26.889496 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.382353 | false | false |
12
|
ffc503e87170f815158ed3aeb60261a8f18f4a5b
| 32,787,780,356,291 |
76ca52991ca1a1e50d066e9f7c4827b6a4453414
|
/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AnimationProperties.java
|
87a3cc9d2db8de596fdade219e4b8c92684b1038
|
[
"Apache-2.0",
"LicenseRef-scancode-unicode"
] |
permissive
|
ResurrectionRemix/android_frameworks_base
|
https://github.com/ResurrectionRemix/android_frameworks_base
|
3126048967fa5f14760664bea8002e7911da206a
|
5e1db0334755ba47245d69857a17f84503f7ce6f
|
refs/heads/Q
| 2023-02-17T11:50:11.652000 | 2021-09-19T11:36:09 | 2021-09-19T11:36:09 | 17,213,932 | 169 | 1,154 |
Apache-2.0
| false | 2023-02-11T12:45:31 | 2014-02-26T14:52:44 | 2022-11-20T20:08:48 | 2023-02-11T11:57:00 | 3,325,928 | 112 | 289 | 0 |
Java
| false | false |
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package com.android.systemui.statusbar.notification.stack;
import android.animation.AnimatorListenerAdapter;
import android.util.ArrayMap;
import android.util.Property;
import android.view.View;
import android.view.animation.Interpolator;
/**
* Properties for a View animation
*/
public class AnimationProperties {
public long duration;
public long delay;
private ArrayMap<Property, Interpolator> mInterpolatorMap;
private AnimatorListenerAdapter mAnimatorListenerAdapter;
/**
* @return an animation filter for this animation.
*/
public AnimationFilter getAnimationFilter() {
return new AnimationFilter() {
@Override
public boolean shouldAnimateProperty(Property property) {
return true;
}
};
}
/**
* @return a listener that should be run whenever any property finished its animation
*/
public AnimatorListenerAdapter getAnimationFinishListener() {
return mAnimatorListenerAdapter;
}
public AnimationProperties setAnimationFinishListener(AnimatorListenerAdapter listener) {
mAnimatorListenerAdapter = listener;
return this;
}
public boolean wasAdded(View view) {
return false;
}
/**
* Get a custom interpolator for a property instead of the normal one.
*/
public Interpolator getCustomInterpolator(View child, Property property) {
return mInterpolatorMap != null ? mInterpolatorMap.get(property) : null;
}
public void combineCustomInterpolators(AnimationProperties iconAnimationProperties) {
ArrayMap<Property, Interpolator> map = iconAnimationProperties.mInterpolatorMap;
if (map != null) {
if (mInterpolatorMap == null) {
mInterpolatorMap = new ArrayMap<>();
}
mInterpolatorMap.putAll(map);
}
}
/**
* Set a custom interpolator to use for all views for a property.
*/
public AnimationProperties setCustomInterpolator(Property property, Interpolator interpolator) {
if (mInterpolatorMap == null) {
mInterpolatorMap = new ArrayMap<>();
}
mInterpolatorMap.put(property, interpolator);
return this;
}
public AnimationProperties setDuration(long duration) {
this.duration = duration;
return this;
}
public AnimationProperties setDelay(long delay) {
this.delay = delay;
return this;
}
public AnimationProperties resetCustomInterpolators() {
mInterpolatorMap = null;
return this;
}
}
|
UTF-8
|
Java
| 3,241 |
java
|
AnimationProperties.java
|
Java
|
[] | null |
[] |
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package com.android.systemui.statusbar.notification.stack;
import android.animation.AnimatorListenerAdapter;
import android.util.ArrayMap;
import android.util.Property;
import android.view.View;
import android.view.animation.Interpolator;
/**
* Properties for a View animation
*/
public class AnimationProperties {
public long duration;
public long delay;
private ArrayMap<Property, Interpolator> mInterpolatorMap;
private AnimatorListenerAdapter mAnimatorListenerAdapter;
/**
* @return an animation filter for this animation.
*/
public AnimationFilter getAnimationFilter() {
return new AnimationFilter() {
@Override
public boolean shouldAnimateProperty(Property property) {
return true;
}
};
}
/**
* @return a listener that should be run whenever any property finished its animation
*/
public AnimatorListenerAdapter getAnimationFinishListener() {
return mAnimatorListenerAdapter;
}
public AnimationProperties setAnimationFinishListener(AnimatorListenerAdapter listener) {
mAnimatorListenerAdapter = listener;
return this;
}
public boolean wasAdded(View view) {
return false;
}
/**
* Get a custom interpolator for a property instead of the normal one.
*/
public Interpolator getCustomInterpolator(View child, Property property) {
return mInterpolatorMap != null ? mInterpolatorMap.get(property) : null;
}
public void combineCustomInterpolators(AnimationProperties iconAnimationProperties) {
ArrayMap<Property, Interpolator> map = iconAnimationProperties.mInterpolatorMap;
if (map != null) {
if (mInterpolatorMap == null) {
mInterpolatorMap = new ArrayMap<>();
}
mInterpolatorMap.putAll(map);
}
}
/**
* Set a custom interpolator to use for all views for a property.
*/
public AnimationProperties setCustomInterpolator(Property property, Interpolator interpolator) {
if (mInterpolatorMap == null) {
mInterpolatorMap = new ArrayMap<>();
}
mInterpolatorMap.put(property, interpolator);
return this;
}
public AnimationProperties setDuration(long duration) {
this.duration = duration;
return this;
}
public AnimationProperties setDelay(long delay) {
this.delay = delay;
return this;
}
public AnimationProperties resetCustomInterpolators() {
mInterpolatorMap = null;
return this;
}
}
| 3,241 | 0.68158 | 0.679111 | 105 | 29.866667 | 27.806154 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.371429 | false | false |
12
|
962a3e4b91a4163b04ca2186201cdf441c8d3254
| 13,168,369,741,660 |
1f4baf62e83d3d9d1a7f69bb884e347615035329
|
/test/old/Test_AccountManager.java
|
4704b9276fb318b6825a85a4cdcd8e874e86a3e8
|
[] |
no_license
|
ammirate/mit-site
|
https://github.com/ammirate/mit-site
|
2da42bcad5c1afc8f7a6fdcc19ab4d4c0103c5cc
|
1e5ce224e599cf28ee38c9f428ac20fed95744d3
|
refs/heads/master
| 2021-01-19T11:23:17.061000 | 2015-02-01T19:32:24 | 2015-02-01T19:32:24 | 42,708,071 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package old;
import org.junit.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import it.unisa.offerta_formativa.manager.old.AccountManager;
/**
*
* @author Alessandro, Antonio
*
*/
public class Test_AccountManager extends TestCase {
public Test_AccountManager(String s) {
super(s);
}
public static TestSuite suite() {
TestSuite suite = new TestSuite();
suite.addTest(new Test_AccountManager("TC_9_1_getAllAccounts"));
return suite;
}
@Test
public void test() {
suite();
}
/**
* insert a class into the DB
*/
public void TC_9_1_getAllAccounts() {
System.out.print("Executing TC_9_1...");
AccountManager am = AccountManager.getInstance();
assertEquals(2, am.getAllAccounts().size());
//in the DB, testing version there are already 2 accounts
System.out.println("Done");
}
}
|
UTF-8
|
Java
| 981 |
java
|
Test_AccountManager.java
|
Java
|
[
{
"context": "manager.old.AccountManager;\r\n\r\n/**\r\n *\r\n * @author Alessandro, Antonio\r\n *\r\n */\r\npublic class Test_AccountManag",
"end": 204,
"score": 0.9997709393501282,
"start": 194,
"tag": "NAME",
"value": "Alessandro"
},
{
"context": "AccountManager;\r\n\r\n/**\r\n *\r\n * @author Alessandro, Antonio\r\n *\r\n */\r\npublic class Test_AccountManager extend",
"end": 213,
"score": 0.9195026159286499,
"start": 206,
"tag": "NAME",
"value": "Antonio"
}
] | null |
[] |
package old;
import org.junit.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import it.unisa.offerta_formativa.manager.old.AccountManager;
/**
*
* @author Alessandro, Antonio
*
*/
public class Test_AccountManager extends TestCase {
public Test_AccountManager(String s) {
super(s);
}
public static TestSuite suite() {
TestSuite suite = new TestSuite();
suite.addTest(new Test_AccountManager("TC_9_1_getAllAccounts"));
return suite;
}
@Test
public void test() {
suite();
}
/**
* insert a class into the DB
*/
public void TC_9_1_getAllAccounts() {
System.out.print("Executing TC_9_1...");
AccountManager am = AccountManager.getInstance();
assertEquals(2, am.getAllAccounts().size());
//in the DB, testing version there are already 2 accounts
System.out.println("Done");
}
}
| 981 | 0.605505 | 0.59735 | 42 | 21.357143 | 21.39851 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.404762 | false | false |
12
|
0da2d4411a795bc828e5edd80b4b405a786b057f
| 24,223,615,558,868 |
e2e1ff43cefaa435d3a0a1ce6e5d0ee9c0ce6c95
|
/src/CodeRound2/max_point_in_a_line.java
|
5a0da448a891fa3b3fd4f0c857dc8661d54d52a2
|
[] |
no_license
|
stameying/lintcode
|
https://github.com/stameying/lintcode
|
bf0836c097121ec9a70777b4886dc1334909778d
|
1c0c4a45e09dcea89229c840422c5fa995b94a9a
|
refs/heads/master
| 2021-01-10T03:26:08.526000 | 2016-04-12T22:41:41 | 2016-04-12T22:41:41 | 47,867,250 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package src.CodeRound2;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* Created by stameying on 2/18/16.
*/
public class max_point_in_a_line {
class Point {
int x;
int y;
Point() { x = 0; y = 0; }
Point(int a, int b) { x = a; y = b; }
}
private static class Rational implements Comparable<Rational>{
public Integer numerator;
public Integer denominator;
public Rational(Integer numerator, Integer denominator){
this.numerator = numerator;
this.denominator = denominator;
}
@Override
public int compareTo(Rational r2){
if (this.denominator == 0 && r2.denominator == 0) return 0;
else if (this.denominator == 0) return 1;
else if (r2.denominator == 0) return -1;
else{
return Double.compare(((double)this.numerator)/this.denominator,((double)r2.numerator)/r2.denominator);
}
}
@Override
public boolean equals(Object obj){
if (obj == null || !(obj instanceof Rational)) return false;
if (this == obj) return true;
else return (this.numerator*((Rational)obj).denominator == this.denominator*((Rational)obj).numerator);
}
@Override
public int hashCode(){
int gcd = BigInteger.valueOf(numerator).gcd(BigInteger.valueOf(denominator)).intValue();
if (gcd != 0) return Objects.hash(this.numerator/gcd,this.denominator/gcd);
else return 0;
}
}
//
public int maxPoints(Point[] points) {
if (points.length < 2) return 0;
Map<Rational, Integer> map = new HashMap<>();
int max = 0;
for (int i = 0; i < points.length; i++){
map.clear();
int duplicate = 1;
Point A = points[i];
for (int j = 0; j < points.length; j++){
if (i == j) continue;
Point B = points[j];
if (A.x == B.x && A.y == B.y){
duplicate++;
continue;
}
Rational scope = new Rational(A.y-B.y,A.x-B.x);
if (map.containsKey(scope)){
map.put(scope,map.get(scope)+1);
}else{
map.put(scope,1);
}
}
if (map.size() == 0){
max = Math.max(max,duplicate);
}else{
for (Rational key: map.keySet()){
max = Math.max(max,duplicate+map.get(key));
}
}
}
return max;
}
public static void main(String[] args) {
Rational r1 = new Rational(0,0);
Rational r2 = new Rational(-2,-2);
Map<Rational, Integer> map = new HashMap<>();
map.put(r1,2);
// System.out.println(map.containsKey(r2));
int gcd = BigInteger.valueOf(2).gcd(BigInteger.valueOf(3)).intValue();
System.out.println(gcd);
}
}
|
UTF-8
|
Java
| 3,127 |
java
|
max_point_in_a_line.java
|
Java
|
[
{
"context": ".Map;\nimport java.util.Objects;\n\n/**\n * Created by stameying on 2/18/16.\n */\npublic class max_point_in_a_line ",
"end": 156,
"score": 0.9996554255485535,
"start": 147,
"tag": "USERNAME",
"value": "stameying"
}
] | null |
[] |
package src.CodeRound2;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* Created by stameying on 2/18/16.
*/
public class max_point_in_a_line {
class Point {
int x;
int y;
Point() { x = 0; y = 0; }
Point(int a, int b) { x = a; y = b; }
}
private static class Rational implements Comparable<Rational>{
public Integer numerator;
public Integer denominator;
public Rational(Integer numerator, Integer denominator){
this.numerator = numerator;
this.denominator = denominator;
}
@Override
public int compareTo(Rational r2){
if (this.denominator == 0 && r2.denominator == 0) return 0;
else if (this.denominator == 0) return 1;
else if (r2.denominator == 0) return -1;
else{
return Double.compare(((double)this.numerator)/this.denominator,((double)r2.numerator)/r2.denominator);
}
}
@Override
public boolean equals(Object obj){
if (obj == null || !(obj instanceof Rational)) return false;
if (this == obj) return true;
else return (this.numerator*((Rational)obj).denominator == this.denominator*((Rational)obj).numerator);
}
@Override
public int hashCode(){
int gcd = BigInteger.valueOf(numerator).gcd(BigInteger.valueOf(denominator)).intValue();
if (gcd != 0) return Objects.hash(this.numerator/gcd,this.denominator/gcd);
else return 0;
}
}
//
public int maxPoints(Point[] points) {
if (points.length < 2) return 0;
Map<Rational, Integer> map = new HashMap<>();
int max = 0;
for (int i = 0; i < points.length; i++){
map.clear();
int duplicate = 1;
Point A = points[i];
for (int j = 0; j < points.length; j++){
if (i == j) continue;
Point B = points[j];
if (A.x == B.x && A.y == B.y){
duplicate++;
continue;
}
Rational scope = new Rational(A.y-B.y,A.x-B.x);
if (map.containsKey(scope)){
map.put(scope,map.get(scope)+1);
}else{
map.put(scope,1);
}
}
if (map.size() == 0){
max = Math.max(max,duplicate);
}else{
for (Rational key: map.keySet()){
max = Math.max(max,duplicate+map.get(key));
}
}
}
return max;
}
public static void main(String[] args) {
Rational r1 = new Rational(0,0);
Rational r2 = new Rational(-2,-2);
Map<Rational, Integer> map = new HashMap<>();
map.put(r1,2);
// System.out.println(map.containsKey(r2));
int gcd = BigInteger.valueOf(2).gcd(BigInteger.valueOf(3)).intValue();
System.out.println(gcd);
}
}
| 3,127 | 0.505916 | 0.492485 | 99 | 30.585859 | 25.041384 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.686869 | false | false |
12
|
3a5c06be76987d5e2a1ed5e5068cde1cbebc3b8f
| 30,030,411,372,320 |
7a1fbfb5b391f86a4c4278b9c8759eacfccf57ff
|
/vbam/src/Main.java
|
a5e4c61d2c6cf1d8b538bb1a3cfedb2b3660ba2b
|
[] |
no_license
|
MPS-UPB/Jagermeisterz
|
https://github.com/MPS-UPB/Jagermeisterz
|
de253753ab49b35adfe025a9a0cd24bd3e72681d
|
422baa5c7203dfbff7f082de2f3f5035ea295f6f
|
refs/heads/master
| 2021-01-01T05:32:55.979000 | 2013-12-17T22:05:25 | 2013-12-17T22:05:25 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
if (args.length != 6) {
System.out.println("Wrong arguments!");
return;
}
int timeout = Integer.parseInt(args[0]);
int iniTimeout = Integer.parseInt(args[1]);
String execDirName = args[2];
String imgFilename = args[3];
String BAMresultDir = args[4];
String resultImgFilename = args[5];
File execDir = new File(execDirName);
ArrayList<String> names = new ArrayList<String>(Arrays.asList(execDir.list()));
for (int i = 0; i < names.size(); i++) {
//System.out.println(names.get(i));
if (names.get(i).endsWith(".exe")) {
String execName = execDirName + "\\" + names.get(i);
System.out.println("We should run this one: " + execName);
try {
System.out.println(execName + " " + imgFilename);
Process process = new ProcessBuilder(execName, imgFilename).start();
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
System.out.printf("Output of running %s is:", Arrays.toString(args));
while ((line = br.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}
|
UTF-8
|
Java
| 1,596 |
java
|
Main.java
|
Java
|
[] | null |
[] |
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
if (args.length != 6) {
System.out.println("Wrong arguments!");
return;
}
int timeout = Integer.parseInt(args[0]);
int iniTimeout = Integer.parseInt(args[1]);
String execDirName = args[2];
String imgFilename = args[3];
String BAMresultDir = args[4];
String resultImgFilename = args[5];
File execDir = new File(execDirName);
ArrayList<String> names = new ArrayList<String>(Arrays.asList(execDir.list()));
for (int i = 0; i < names.size(); i++) {
//System.out.println(names.get(i));
if (names.get(i).endsWith(".exe")) {
String execName = execDirName + "\\" + names.get(i);
System.out.println("We should run this one: " + execName);
try {
System.out.println(execName + " " + imgFilename);
Process process = new ProcessBuilder(execName, imgFilename).start();
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
System.out.printf("Output of running %s is:", Arrays.toString(args));
while ((line = br.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}
| 1,596 | 0.651629 | 0.646617 | 62 | 24.741936 | 21.579512 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.935484 | false | false |
12
|
7487dd94a23b79ef536400bb88f6199d43c048bb
| 24,635,932,430,576 |
fab99649d3aada8a01256233dfe0c7352ab08a9e
|
/HelloWorld/src/main/java/RecommenderIntro.java
|
8bc36cd44f8376a0e058868bcb1eedf3d8a1911b
|
[] |
no_license
|
syangunique/dev
|
https://github.com/syangunique/dev
|
9dbe55d137e89df8f640b24ef1271a2554cfcec4
|
69dc8ced5639d3168fb4ee252c2be2f942077835
|
refs/heads/master
| 2016-09-10T14:59:05.584000 | 2015-04-11T07:12:55 | 2015-04-11T07:12:55 | 33,763,692 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Created by sam on 15/4/10.
*/
import org.apache.mahout.cf.taste.impl.model.file.*;
import org.apache.mahout.cf.taste.impl.neighborhood.*;
import org.apache.mahout.cf.taste.impl.recommender.*;
import org.apache.mahout.cf.taste.impl.similarity.*;
import org.apache.mahout.cf.taste.model.*;
import org.apache.mahout.cf.taste.neighborhood.*;
import org.apache.mahout.cf.taste.recommender.*;
import org.apache.mahout.cf.taste.similarity.*;
import java.io.*;
import java.util.*;
public class RecommenderIntro {
private RecommenderIntro() {
}
public static void main(String args[]) throws Exception {
// step:1 构建模型 2 计算相似度 3 查找k紧邻 4 构造推荐引擎
DataModel model = new FileDataModel(new File("/Users/sam/dev/mvnintell/data/test.txt"));//文件名一定要是绝对路径
UserSimilarity similarity = new PearsonCorrelationSimilarity(model);
UserNeighborhood neighborhood = new NearestNUserNeighborhood(2, similarity, model);
Recommender recommender = new GenericUserBasedRecommender(model, neighborhood, similarity);
List<RecommendedItem> recommendations = recommender.recommend(1, 2);//为用户1推荐两个ItemID
for (RecommendedItem recommendation : recommendations) {
System.out.println(recommendation);
}
}
}
|
UTF-8
|
Java
| 1,342 |
java
|
RecommenderIntro.java
|
Java
|
[
{
"context": "/**\n * Created by sam on 15/4/10.\n */\n\nimport org.apache.mahout.cf.tast",
"end": 21,
"score": 0.8335998058319092,
"start": 18,
"tag": "USERNAME",
"value": "sam"
}
] | null |
[] |
/**
* Created by sam on 15/4/10.
*/
import org.apache.mahout.cf.taste.impl.model.file.*;
import org.apache.mahout.cf.taste.impl.neighborhood.*;
import org.apache.mahout.cf.taste.impl.recommender.*;
import org.apache.mahout.cf.taste.impl.similarity.*;
import org.apache.mahout.cf.taste.model.*;
import org.apache.mahout.cf.taste.neighborhood.*;
import org.apache.mahout.cf.taste.recommender.*;
import org.apache.mahout.cf.taste.similarity.*;
import java.io.*;
import java.util.*;
public class RecommenderIntro {
private RecommenderIntro() {
}
public static void main(String args[]) throws Exception {
// step:1 构建模型 2 计算相似度 3 查找k紧邻 4 构造推荐引擎
DataModel model = new FileDataModel(new File("/Users/sam/dev/mvnintell/data/test.txt"));//文件名一定要是绝对路径
UserSimilarity similarity = new PearsonCorrelationSimilarity(model);
UserNeighborhood neighborhood = new NearestNUserNeighborhood(2, similarity, model);
Recommender recommender = new GenericUserBasedRecommender(model, neighborhood, similarity);
List<RecommendedItem> recommendations = recommender.recommend(1, 2);//为用户1推荐两个ItemID
for (RecommendedItem recommendation : recommendations) {
System.out.println(recommendation);
}
}
}
| 1,342 | 0.728707 | 0.718454 | 31 | 39.903225 | 31.374281 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.677419 | false | false |
12
|
8d8e3b9e6019189c7c9bc9b229158cdb59b15a38
| 32,753,420,620,755 |
a936ae0ebb202dab136736bc07c6f5a79dc02e9b
|
/src/main/java/com/lin/missyou/vo/OrderPureVO.java
|
a34b1c7c1c496dc7d1d210420e2fa13fd0c28cc3
|
[] |
no_license
|
Mrguoxiaobai/missyou
|
https://github.com/Mrguoxiaobai/missyou
|
8d57edb3cda70cc5f9d69927dc680a20f92d43ee
|
ad9089a34d1f5b19404d488f75e9c9a1c118a7d6
|
refs/heads/master
| 2023-06-04T06:40:07.287000 | 2021-06-26T10:42:49 | 2021-06-26T10:42:49 | 377,073,988 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.lin.missyou.vo;
import com.lin.missyou.model.Order;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.BeanUtils;
import java.util.Date;
/**
* @ClassName: OrderPureVO
* @Author: Mrguo
* @Description:
* @Date: 2021-06-2315:32
* @Version: 1.0
*/
@Getter
@Setter
public class OrderPureVO extends Order {
private Long period;
private Date createTime;
public OrderPureVO(Order order, Long period) {
BeanUtils.copyProperties(order, this);
this.period = period;
}
}
|
UTF-8
|
Java
| 539 |
java
|
OrderPureVO.java
|
Java
|
[
{
"context": ".Date;\n\n/**\n * @ClassName: OrderPureVO\n * @Author: Mrguo\n * @Description:\n * @Date: 2021-06-2315:32\n * @Ve",
"end": 226,
"score": 0.9997069239616394,
"start": 221,
"tag": "USERNAME",
"value": "Mrguo"
}
] | null |
[] |
package com.lin.missyou.vo;
import com.lin.missyou.model.Order;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.BeanUtils;
import java.util.Date;
/**
* @ClassName: OrderPureVO
* @Author: Mrguo
* @Description:
* @Date: 2021-06-2315:32
* @Version: 1.0
*/
@Getter
@Setter
public class OrderPureVO extends Order {
private Long period;
private Date createTime;
public OrderPureVO(Order order, Long period) {
BeanUtils.copyProperties(order, this);
this.period = period;
}
}
| 539 | 0.703154 | 0.67718 | 27 | 18.962963 | 15.056638 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false |
12
|
b7f8b38831eb5d532a6a061a282e85b46ddc496a
| 5,265,629,931,896 |
37276ed841d23ca124aba9a67f03e256cfea6e07
|
/src/main/java/win/suroot/common/service/ThreadService.java
|
a948bb4705a5c216fbae5b7fb2761db679cf18dd
|
[] |
no_license
|
onlinelei/ida-spring-boot
|
https://github.com/onlinelei/ida-spring-boot
|
9b77fd754cd892086a4dafdf413280c82ae4a9ea
|
39b3eae56c12c0c0f699f5be8e21b49a1bb3476d
|
refs/heads/master
| 2018-07-11T20:59:12.480000 | 2018-06-12T03:32:13 | 2018-06-12T03:32:13 | 114,841,626 | 0 | 0 | null | false | 2018-06-11T11:44:10 | 2017-12-20T04:10:01 | 2017-12-20T04:16:49 | 2018-06-11T11:44:10 | 44 | 0 | 0 | 0 |
Java
| false | null |
package win.suroot.common.service;
/**
* @author qianlei
* @create 2017-12-20 14:54
* @desc 线程服务类
*/
public interface ThreadService {
/**
* 当前线程休息
*
* @author: qianlei
* @date: 2017-12-20 16:47
* @update: [变更日期YYYY-MM-DD][变更人姓名][变更描述]
*/
void sleep(Long time);
}
|
UTF-8
|
Java
| 355 |
java
|
ThreadService.java
|
Java
|
[
{
"context": "package win.suroot.common.service;\n\n/**\n * @author qianlei\n * @create 2017-12-20 14:54\n * @desc 线程服务类\n */\npu",
"end": 58,
"score": 0.998711884021759,
"start": 51,
"tag": "USERNAME",
"value": "qianlei"
},
{
"context": "ce {\n\n /**\n * 当前线程休息\n *\n * @author: qianlei\n * @date: 2017-12-20 16:47\n * @update: [变",
"end": 192,
"score": 0.9989117383956909,
"start": 185,
"tag": "USERNAME",
"value": "qianlei"
}
] | null |
[] |
package win.suroot.common.service;
/**
* @author qianlei
* @create 2017-12-20 14:54
* @desc 线程服务类
*/
public interface ThreadService {
/**
* 当前线程休息
*
* @author: qianlei
* @date: 2017-12-20 16:47
* @update: [变更日期YYYY-MM-DD][变更人姓名][变更描述]
*/
void sleep(Long time);
}
| 355 | 0.57329 | 0.495114 | 18 | 16.055555 | 13.418364 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | false | false |
12
|
892fe0e0c6f411a0d58cdd70ae36364c146c5f58
| 10,986,526,369,266 |
91d326a5a2f64ed5fac5fc7b2a907f5874e3d26c
|
/src/main/java/solutions/misi/clymeskyblockcore/leaderboards/ClymeLeaderboard.java
|
3345624cb9ed73b27be17ab001ff3f4bccde66e4
|
[] |
no_license
|
ClymeGames/ClymeSkyblock
|
https://github.com/ClymeGames/ClymeSkyblock
|
189d7db9fd9afd68c47ea747dc065079442c2f12
|
62feb9f52d9a3a574fba4c1c682d8293640a85ec
|
refs/heads/master
| 2023-03-11T07:08:48.757000 | 2021-02-08T15:02:31 | 2021-02-08T15:02:31 | 319,964,973 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package solutions.misi.clymeskyblockcore.leaderboards;
import lombok.Getter;
import lombok.Setter;
import java.util.LinkedHashMap;
import java.util.Map;
public abstract class ClymeLeaderboard {
@Getter private int timerInMinutes = 15;
@Getter @Setter private Map<String, Long> leaderboard = new LinkedHashMap<>();
public ClymeLeaderboard(int timerInMinutes) {
this.timerInMinutes = timerInMinutes;
}
public abstract void startCalculation();
public abstract void update(Map<String, Long> queryData);
}
|
UTF-8
|
Java
| 539 |
java
|
ClymeLeaderboard.java
|
Java
|
[] | null |
[] |
package solutions.misi.clymeskyblockcore.leaderboards;
import lombok.Getter;
import lombok.Setter;
import java.util.LinkedHashMap;
import java.util.Map;
public abstract class ClymeLeaderboard {
@Getter private int timerInMinutes = 15;
@Getter @Setter private Map<String, Long> leaderboard = new LinkedHashMap<>();
public ClymeLeaderboard(int timerInMinutes) {
this.timerInMinutes = timerInMinutes;
}
public abstract void startCalculation();
public abstract void update(Map<String, Long> queryData);
}
| 539 | 0.753247 | 0.749536 | 21 | 24.714285 | 24.632814 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false |
12
|
71d647388300b0156bf8a0e420e4a3cbd03da635
| 9,002,251,478,006 |
0d60b0e46fd7daa6ada2f2098756f7bd13f305b0
|
/src/main/java/designpattern/creational/singleton/EagerSingletonExample.java
|
578b6d779e8803940f29406262a5086120b164b8
|
[] |
no_license
|
jainagarani/Java_Learn
|
https://github.com/jainagarani/Java_Learn
|
e8dced4c86f15d10c1db4d1084b86ee7d257f1ee
|
550208af7508d2371b0447648ed242aa7ddbaab0
|
refs/heads/master
| 2023-08-17T02:51:11.603000 | 2021-09-23T05:38:01 | 2021-09-23T05:38:01 | 408,805,184 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package designpattern.creational.singleton;
public class EagerSingletonExample {
private static EagerSingletonExample singletonExample = new EagerSingletonExample();
private EagerSingletonExample(){
}
public EagerSingletonExample getSingletonInstance(){
return singletonExample;
}
}
|
UTF-8
|
Java
| 319 |
java
|
EagerSingletonExample.java
|
Java
|
[] | null |
[] |
package designpattern.creational.singleton;
public class EagerSingletonExample {
private static EagerSingletonExample singletonExample = new EagerSingletonExample();
private EagerSingletonExample(){
}
public EagerSingletonExample getSingletonInstance(){
return singletonExample;
}
}
| 319 | 0.758621 | 0.758621 | 17 | 17.764706 | 25.473238 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.176471 | false | false |
12
|
935b4f5893d06fecaf7c63588bd7429501b6672d
| 11,355,893,557,124 |
028d6009f3beceba80316daa84b628496a210f8d
|
/uidesigner/com.nokia.carbide.cpp.uiq.ui/src/com/nokia/carbide/cpp/uiq/ui/viewwizard/CustomizerPage.java
|
ac4d41938717c719524467edfa41864be362d9b4
|
[] |
no_license
|
JamesLinus/oss.FCL.sftools.dev.ide.carbidecpp
|
https://github.com/JamesLinus/oss.FCL.sftools.dev.ide.carbidecpp
|
fa50cafa69d3e317abf0db0f4e3e557150fd88b3
|
4420f338bc4e522c563f8899d81201857236a66a
|
refs/heads/master
| 2020-12-30T16:45:28.474000 | 2010-10-20T16:19:31 | 2010-10-20T16:19:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
/* START_USECASES: CU2 END_USECASES */
package com.nokia.carbide.cpp.uiq.ui.viewwizard;
import com.nokia.sdt.component.customizer.IComponentCustomizerCommandFactory;
import com.nokia.sdt.datamodel.adapter.IComponentCustomizerUI;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
public class CustomizerPage extends ViewWizardPageBase {
public static final String PAGE_NAME = "Customizer"; //$NON-NLS-1$
private IComponentCustomizerUI customizerUI;
private Composite parent;
private Composite curComposite;
public CustomizerPage(ViewWizardManager manager) {
super(PAGE_NAME, manager);
setTitle(Messages.getString("CustomizerPage.PageTitle")); //$NON-NLS-1$
setDescription(Messages.getString("CustomizerPage.PageDescription")); //$NON-NLS-1$
}
public void setCustomizerUI(IComponentCustomizerUI customizerUI) {
this.customizerUI = customizerUI;
if (parent == null)
return;
if (curComposite != null)
curComposite.dispose();
curComposite = null;
if (customizerUI != null) {
curComposite = customizerUI.getCustomizerComposite(parent);
curComposite.setData(NAME_KEY, "customizerComposite");
setControl(curComposite);
setHelpContextId(ViewWizardManager.CUSTOMIZER_PAGE);
}
getWizard().getContainer().updateButtons();
}
public void createControl(Composite parent) {
initializeDialogUnits(parent);
this.parent = parent;
if (customizerUI != null)
curComposite = customizerUI.getCustomizerComposite(parent);
else
curComposite = new Composite(parent, SWT.DEFAULT);
setControl(curComposite);
setHelpContextId(ViewWizardManager.CUSTOMIZER_PAGE);
}
/* (non-Javadoc)
* @see com.nokia.sdt.symbian.ui.wizard.WizardPageBase#leavingPage(java.lang.Object)
*/
protected void leavingPage(Object nextPage) {
IComponentCustomizerCommandFactory commandFactory = null;
if (customizerUI != null)
commandFactory = customizerUI.getCommandFactory();
getWizardManager().getDataStore().put(ViewWizardManager.CUSTOMIZER_COMMAND_FACTORY_KEY, commandFactory);
}
/* (non-Javadoc)
* @see com.nokia.sdt.symbian.ui.wizard.ViewWizardPageBase#enteringPage()
*/
protected void enteringPage() {
super.enteringPage();
Rectangle clientArea = curComposite.getParent().getClientArea();
curComposite.setSize(curComposite.computeSize(clientArea.width, clientArea.height, true));
}
public void dispose() {
super.dispose();
if (curComposite != null) {
curComposite.dispose();
curComposite = null;
}
}
}
|
UTF-8
|
Java
| 3,123 |
java
|
CustomizerPage.java
|
Java
|
[] | null |
[] |
/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/
/* START_USECASES: CU2 END_USECASES */
package com.nokia.carbide.cpp.uiq.ui.viewwizard;
import com.nokia.sdt.component.customizer.IComponentCustomizerCommandFactory;
import com.nokia.sdt.datamodel.adapter.IComponentCustomizerUI;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
public class CustomizerPage extends ViewWizardPageBase {
public static final String PAGE_NAME = "Customizer"; //$NON-NLS-1$
private IComponentCustomizerUI customizerUI;
private Composite parent;
private Composite curComposite;
public CustomizerPage(ViewWizardManager manager) {
super(PAGE_NAME, manager);
setTitle(Messages.getString("CustomizerPage.PageTitle")); //$NON-NLS-1$
setDescription(Messages.getString("CustomizerPage.PageDescription")); //$NON-NLS-1$
}
public void setCustomizerUI(IComponentCustomizerUI customizerUI) {
this.customizerUI = customizerUI;
if (parent == null)
return;
if (curComposite != null)
curComposite.dispose();
curComposite = null;
if (customizerUI != null) {
curComposite = customizerUI.getCustomizerComposite(parent);
curComposite.setData(NAME_KEY, "customizerComposite");
setControl(curComposite);
setHelpContextId(ViewWizardManager.CUSTOMIZER_PAGE);
}
getWizard().getContainer().updateButtons();
}
public void createControl(Composite parent) {
initializeDialogUnits(parent);
this.parent = parent;
if (customizerUI != null)
curComposite = customizerUI.getCustomizerComposite(parent);
else
curComposite = new Composite(parent, SWT.DEFAULT);
setControl(curComposite);
setHelpContextId(ViewWizardManager.CUSTOMIZER_PAGE);
}
/* (non-Javadoc)
* @see com.nokia.sdt.symbian.ui.wizard.WizardPageBase#leavingPage(java.lang.Object)
*/
protected void leavingPage(Object nextPage) {
IComponentCustomizerCommandFactory commandFactory = null;
if (customizerUI != null)
commandFactory = customizerUI.getCommandFactory();
getWizardManager().getDataStore().put(ViewWizardManager.CUSTOMIZER_COMMAND_FACTORY_KEY, commandFactory);
}
/* (non-Javadoc)
* @see com.nokia.sdt.symbian.ui.wizard.ViewWizardPageBase#enteringPage()
*/
protected void enteringPage() {
super.enteringPage();
Rectangle clientArea = curComposite.getParent().getClientArea();
curComposite.setSize(curComposite.computeSize(clientArea.width, clientArea.height, true));
}
public void dispose() {
super.dispose();
if (curComposite != null) {
curComposite.dispose();
curComposite = null;
}
}
}
| 3,123 | 0.728786 | 0.724944 | 98 | 29.867348 | 26.500149 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.5 | false | false |
12
|
eb3862c807a525996ac8a37502e242018f9e7319
| 1,580,547,992,953 |
b0a59a2eb66900ff9616df18ab7b1444097698d7
|
/src/test/java/com/stepdefinitions/UpdateUserSteps.java
|
dd00f9486bc7d5ec672d430399c82a15037fd70d
|
[] |
no_license
|
teamlead11/RestMay2019
|
https://github.com/teamlead11/RestMay2019
|
eb3b6a04e75b703f15b935afcdd08a682bb2dae6
|
b45ccdfe248e30a3462f7eb6ce59e4408fb45e55
|
refs/heads/master
| 2022-06-03T10:49:32.486000 | 2019-06-30T11:53:21 | 2019-06-30T11:53:21 | 194,510,242 | 1 | 0 | null | false | 2022-05-20T21:01:28 | 2019-06-30T11:52:24 | 2019-07-04T05:30:52 | 2022-05-20T21:01:27 | 98 | 1 | 0 | 2 |
Java
| false | false |
package com.stepdefinitions;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import com.common.Helper;
import com.common.StepDefinitionHelper;
import com.itextpdf.text.log.SysoCounter;
import cucumber.api.DataTable;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import requestModel.Newuser;
public class UpdateUserSteps extends Helper {
private StepDefinitionHelper commonCode = getStepDefinitionHelper();
@When("^The user makes the put call to the resource to update user \"([^\"]*)\"$")
public void the_user_makes_the_put_call_to_the_resource_to_update_user(String resource, DataTable userDetails)
throws Throwable {
List<String> userDetailsList = userDetails.asList(String.class);
Newuser user1 = new Newuser();
user1.setId(Integer.parseInt(userDetailsList.get(0)));
user1.setUsername(userDetailsList.get(1));
user1.setFirstName(userDetailsList.get(2));
user1.setLastName(userDetailsList.get(3));
user1.setEmail(userDetailsList.get(4));
user1.setPassword(userDetailsList.get(5));
user1.setPhone(userDetailsList.get(6));
user1.setUserStatus(Integer.parseInt(userDetailsList.get(7)));
Map<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/json");
response = commonCode.makePutCallWithHeader(resource, user1, headers);
}
@Then("^The user should see the updated values$")
public void the_user_should_see_the_updated_values(DataTable userDetails) throws Throwable {
commonCode.configureBaseUri();
response = commonCode.makeGetCall("user/gopiselenium");
System.out.println(response.prettyPrint());
List<String> userDetailsList = userDetails.asList(String.class);
Newuser usern = response.as(Newuser.class);
Assert.assertEquals(Integer.parseInt(userDetailsList.get(0)), usern.getId());
Assert.assertEquals(userDetailsList.get(1), usern.getUsername());
}
}
|
UTF-8
|
Java
| 1,930 |
java
|
UpdateUserSteps.java
|
Java
|
[] | null |
[] |
package com.stepdefinitions;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import com.common.Helper;
import com.common.StepDefinitionHelper;
import com.itextpdf.text.log.SysoCounter;
import cucumber.api.DataTable;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import requestModel.Newuser;
public class UpdateUserSteps extends Helper {
private StepDefinitionHelper commonCode = getStepDefinitionHelper();
@When("^The user makes the put call to the resource to update user \"([^\"]*)\"$")
public void the_user_makes_the_put_call_to_the_resource_to_update_user(String resource, DataTable userDetails)
throws Throwable {
List<String> userDetailsList = userDetails.asList(String.class);
Newuser user1 = new Newuser();
user1.setId(Integer.parseInt(userDetailsList.get(0)));
user1.setUsername(userDetailsList.get(1));
user1.setFirstName(userDetailsList.get(2));
user1.setLastName(userDetailsList.get(3));
user1.setEmail(userDetailsList.get(4));
user1.setPassword(userDetailsList.get(5));
user1.setPhone(userDetailsList.get(6));
user1.setUserStatus(Integer.parseInt(userDetailsList.get(7)));
Map<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/json");
response = commonCode.makePutCallWithHeader(resource, user1, headers);
}
@Then("^The user should see the updated values$")
public void the_user_should_see_the_updated_values(DataTable userDetails) throws Throwable {
commonCode.configureBaseUri();
response = commonCode.makeGetCall("user/gopiselenium");
System.out.println(response.prettyPrint());
List<String> userDetailsList = userDetails.asList(String.class);
Newuser usern = response.as(Newuser.class);
Assert.assertEquals(Integer.parseInt(userDetailsList.get(0)), usern.getId());
Assert.assertEquals(userDetailsList.get(1), usern.getUsername());
}
}
| 1,930 | 0.771503 | 0.76114 | 52 | 36.115383 | 27.425882 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.75 | false | false |
12
|
ef31435ab7c1c05d86886344eb97970b4199315a
| 14,920,716,419,376 |
e7d7a03485f10577af35d17e8f224a0a8e088ca0
|
/Lab3/src/lab3/Main.java
|
7463743e25de8f973188b4200150d0760cd86d7e
|
[] |
no_license
|
meta-bot/Networking-Lab
|
https://github.com/meta-bot/Networking-Lab
|
a6c5da52be4520bfd1a000bb2980b3289cce74c5
|
95cf40c5a000d750a52d4246584b7e916b7c3ddf
|
refs/heads/master
| 2021-01-20T21:11:43.870000 | 2016-11-19T17:07:20 | 2016-11-19T17:07:20 | 64,645,403 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package lab3;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author student
*/
public class Main {
public static void main(String[] args) throws IOException {
try {
new Server();
} catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
|
UTF-8
|
Java
| 394 |
java
|
Main.java
|
Java
|
[
{
"context": "mport java.util.logging.Logger;\n\n/**\n *\n * @author student\n */\npublic class Main {\n public static void ma",
"end": 134,
"score": 0.9728303551673889,
"start": 127,
"tag": "USERNAME",
"value": "student"
}
] | null |
[] |
package lab3;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author student
*/
public class Main {
public static void main(String[] args) throws IOException {
try {
new Server();
} catch (Exception ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
| 394 | 0.611675 | 0.609137 | 19 | 19.736841 | 20.930567 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421053 | false | false |
12
|
ce693b4e9386e48d59efd2b6737ce853927635bd
| 7,524,782,734,736 |
820280ea1ffdc2d2a503fff50bf9cd7fea9f1656
|
/chaosblade-box-common/src/main/java/com/alibaba/chaosblade/box/common/infrastructure/domain/experiment/ExperimentTaskLog.java
|
540b542771d3bb3394ffa2550524ec433426b06f
|
[
"Apache-2.0"
] |
permissive
|
chaosblade-io/chaosbox
|
https://github.com/chaosblade-io/chaosbox
|
fa888086bcd8bdb1405adba768955887f693bcba
|
897673d541ee68067e5ce0991e5f778e8044dfd9
|
refs/heads/main
| 2023-03-21T04:48:00.754000 | 2022-10-31T08:39:50 | 2022-10-31T08:39:50 | 335,221,546 | 7 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.alibaba.chaosblade.box.common.infrastructure.domain.experiment;
import com.alibaba.chaosblade.box.common.common.enums.ResultEnum;
import lombok.AccessLevel;
import lombok.Data;
import lombok.experimental.FieldDefaults;
import java.util.Date;
import java.util.Map;
import java.util.Set;
/**
* @author jiumu
*
*/
@Data
@FieldDefaults(level = AccessLevel.PRIVATE)
public class ExperimentTaskLog {
/**
* 演练名字
*/
String experimentName;
/**
* 演练ID
*/
String experimentId;
/**
* 演练任务Id
*/
String taskId;
/**
* 演练开始时间
*/
Date startTime;
/**
* 结束事件
*/
Date endTime;
/**
* 演练执行人
*/
String userName;
/**
* 结果
*/
ResultEnum result;
/**
* 演练日志
*/
Map<Long, String> logs;
/**
* 演练中涉及的aone应用名列表
*/
Set<String> aoneApps;
}
|
UTF-8
|
Java
| 981 |
java
|
ExperimentTaskLog.java
|
Java
|
[
{
"context": "va.util.Map;\nimport java.util.Set;\n\n/**\n * @author jiumu\n *\n */\n@Data\n@FieldDefaults(level = AccessLevel.P",
"end": 321,
"score": 0.9994487762451172,
"start": 316,
"tag": "USERNAME",
"value": "jiumu"
}
] | null |
[] |
package com.alibaba.chaosblade.box.common.infrastructure.domain.experiment;
import com.alibaba.chaosblade.box.common.common.enums.ResultEnum;
import lombok.AccessLevel;
import lombok.Data;
import lombok.experimental.FieldDefaults;
import java.util.Date;
import java.util.Map;
import java.util.Set;
/**
* @author jiumu
*
*/
@Data
@FieldDefaults(level = AccessLevel.PRIVATE)
public class ExperimentTaskLog {
/**
* 演练名字
*/
String experimentName;
/**
* 演练ID
*/
String experimentId;
/**
* 演练任务Id
*/
String taskId;
/**
* 演练开始时间
*/
Date startTime;
/**
* 结束事件
*/
Date endTime;
/**
* 演练执行人
*/
String userName;
/**
* 结果
*/
ResultEnum result;
/**
* 演练日志
*/
Map<Long, String> logs;
/**
* 演练中涉及的aone应用名列表
*/
Set<String> aoneApps;
}
| 981 | 0.576366 | 0.576366 | 65 | 12.8 | 14.325019 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.276923 | false | false |
12
|
97e905274a434fa054de2b3bd9214988abca4371
| 773,094,149,183 |
0824cb02597e0ef2cff9cef450117e742c58add7
|
/ambiorix/src/ambiorix/gui/Pion_Gui.java
|
d23da0de82bdc0823e9908539797e27db21e7598
|
[] |
no_license
|
oliviersels/ambiorix
|
https://github.com/oliviersels/ambiorix
|
7a284db31750dc9f879265796e4896d1fdc7055b
|
9ecdbbf25edd41718b5c6a36fde94b906643835d
|
refs/heads/master
| 2020-05-18T13:26:18.704000 | 2013-02-06T14:40:52 | 2013-02-06T14:40:52 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ambiorix.gui;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import java.awt.image.WritableRaster;
import java.util.Iterator;
import java.util.Vector;
import javax.swing.JComponent;
import ambiorix.spelbord.PionBasis;
/**
* De klasse die gebruikt wordt om een pion weer te geven. Nadat de afbeelding
* van de pion is ingeladen wordt deze aangepast. Elke pixel die volledig wit
* is, wordt vervangen door de kleur van de speler die eigenaar is van de pion.
*
* @author Jens
*
*/
public class Pion_Gui extends JComponent implements MouseListener {
private static final long serialVersionUID = 1L;
private PionBasis mijnPion;
private BufferedImage mijnAfbeelding = null;
private Vector<PionLuisteraar> mijnPionLuisteraars;
@Override
public void update(Graphics g) {
paint(g);
}
public Pion_Gui(PionBasis pion) {
mijnPionLuisteraars = new Vector<PionLuisteraar>();
mijnPion = pion;
WritableRaster raster = AfbeeldingLader.geefAfbeelding(
pion.getType().getAfbeelding()).copyData(null);
mijnAfbeelding = new BufferedImage(AfbeeldingLader.geefAfbeelding(
pion.getType().getAfbeelding()).getColorModel(), raster,
AfbeeldingLader.geefAfbeelding(pion.getType().getAfbeelding())
.isAlphaPremultiplied(), null);
for (int y = 0; y < mijnAfbeelding.getHeight(); y++)
for (int x = 0; x < mijnAfbeelding.getWidth(); x++) {
if (mijnAfbeelding.getRGB(x, y) == Color.WHITE.getRGB()) {
mijnAfbeelding.setRGB(x, y, pion.getSpeler().getKleur()
.getRGB());
}
}
this.addMouseListener(this);
}
public BufferedImage geefAfbeelding() {
return this.mijnAfbeelding;
}
public PionBasis getPion() {
return mijnPion;
}
public void voegPionLuisteraarToe(PionLuisteraar pl) {
mijnPionLuisteraars.add(pl);
}
public void verwijderPionLuisteraar(PionLuisteraar pl) {
mijnPionLuisteraars.remove(pl);
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Rectangle rec = this.getBounds();
Graphics2D g2 = (Graphics2D) g;
g2.drawImage(mijnAfbeelding, 0, 0, rec.width, rec.height, null);
}
@Override
public void mouseClicked(MouseEvent arg0) {
PionGebeurtenis pg = new PionGebeurtenis();
pg.pion = this.mijnPion;
Iterator<PionLuisteraar> it = mijnPionLuisteraars.iterator();
while (it.hasNext()) {
(it.next()).geklikt(pg);
}
}
@Override
public void mouseEntered(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent arg0) {
// TODO Auto-generated method stub
}
}
|
UTF-8
|
Java
| 3,029 |
java
|
Pion_Gui.java
|
Java
|
[
{
"context": "eler die eigenaar is van de pion.\r\n * \r\n * @author Jens\r\n * \r\n */\r\n\r\npublic class Pion_Gui extends JCompo",
"end": 677,
"score": 0.9992821216583252,
"start": 673,
"tag": "NAME",
"value": "Jens"
}
] | null |
[] |
package ambiorix.gui;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import java.awt.image.WritableRaster;
import java.util.Iterator;
import java.util.Vector;
import javax.swing.JComponent;
import ambiorix.spelbord.PionBasis;
/**
* De klasse die gebruikt wordt om een pion weer te geven. Nadat de afbeelding
* van de pion is ingeladen wordt deze aangepast. Elke pixel die volledig wit
* is, wordt vervangen door de kleur van de speler die eigenaar is van de pion.
*
* @author Jens
*
*/
public class Pion_Gui extends JComponent implements MouseListener {
private static final long serialVersionUID = 1L;
private PionBasis mijnPion;
private BufferedImage mijnAfbeelding = null;
private Vector<PionLuisteraar> mijnPionLuisteraars;
@Override
public void update(Graphics g) {
paint(g);
}
public Pion_Gui(PionBasis pion) {
mijnPionLuisteraars = new Vector<PionLuisteraar>();
mijnPion = pion;
WritableRaster raster = AfbeeldingLader.geefAfbeelding(
pion.getType().getAfbeelding()).copyData(null);
mijnAfbeelding = new BufferedImage(AfbeeldingLader.geefAfbeelding(
pion.getType().getAfbeelding()).getColorModel(), raster,
AfbeeldingLader.geefAfbeelding(pion.getType().getAfbeelding())
.isAlphaPremultiplied(), null);
for (int y = 0; y < mijnAfbeelding.getHeight(); y++)
for (int x = 0; x < mijnAfbeelding.getWidth(); x++) {
if (mijnAfbeelding.getRGB(x, y) == Color.WHITE.getRGB()) {
mijnAfbeelding.setRGB(x, y, pion.getSpeler().getKleur()
.getRGB());
}
}
this.addMouseListener(this);
}
public BufferedImage geefAfbeelding() {
return this.mijnAfbeelding;
}
public PionBasis getPion() {
return mijnPion;
}
public void voegPionLuisteraarToe(PionLuisteraar pl) {
mijnPionLuisteraars.add(pl);
}
public void verwijderPionLuisteraar(PionLuisteraar pl) {
mijnPionLuisteraars.remove(pl);
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Rectangle rec = this.getBounds();
Graphics2D g2 = (Graphics2D) g;
g2.drawImage(mijnAfbeelding, 0, 0, rec.width, rec.height, null);
}
@Override
public void mouseClicked(MouseEvent arg0) {
PionGebeurtenis pg = new PionGebeurtenis();
pg.pion = this.mijnPion;
Iterator<PionLuisteraar> it = mijnPionLuisteraars.iterator();
while (it.hasNext()) {
(it.next()).geklikt(pg);
}
}
@Override
public void mouseEntered(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent arg0) {
// TODO Auto-generated method stub
}
}
| 3,029 | 0.707494 | 0.702542 | 115 | 24.33913 | 22.647348 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.582609 | false | false |
12
|
d9ab47c4c609787b454b701bbafd059a09b04f84
| 19,275,813,256,655 |
9d82b699b014eb82e423a302a01a2f25549aff9a
|
/zpp-springcloud-common/zpp-springcloud-common-core/src/main/java/org/zpp/common/core/bean/GlobalExceptionHandler.java
|
6406fd1d1a6e1ee4ac79bbb9a3f9381839f97106
|
[] |
no_license
|
brianye2017/zpp-springcloud-parent
|
https://github.com/brianye2017/zpp-springcloud-parent
|
e2c7b0655d400c1da7e67ba44b3347f92f1322a4
|
154fa19c2e44ca62332e98ebec687dbbcd51b287
|
refs/heads/master
| 2022-03-27T14:51:24.289000 | 2019-11-28T08:39:47 | 2019-11-28T08:39:47 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.zpp.common.core.bean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.zpp.common.core.util.R;
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
@ExceptionHandler(Exception.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseBody
public R exception(Exception e) {
log.error("全局异常:{}",e.getLocalizedMessage());
return new R<>(e);
}
}
|
UTF-8
|
Java
| 722 |
java
|
GlobalExceptionHandler.java
|
Java
|
[] | null |
[] |
package org.zpp.common.core.bean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.zpp.common.core.util.R;
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {
@ExceptionHandler(Exception.class)
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
@ResponseBody
public R exception(Exception e) {
log.error("全局异常:{}",e.getLocalizedMessage());
return new R<>(e);
}
}
| 722 | 0.783708 | 0.779494 | 22 | 31.40909 | 22.270361 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
12
|
86726bb0324bbc28bace046a3c1538c54eca6ab2
| 26,628,797,270,740 |
59fc99d93bec66172a545543bdb2ee6a335b4f23
|
/src/main/java/frc/util/SteelHawk.java
|
9be47e256dfc2bd62d397e24d9519e309818b419
|
[] |
no_license
|
AmarMaksumic/2020InfiniteBot
|
https://github.com/AmarMaksumic/2020InfiniteBot
|
042e8aba9d80b8d6c4f2da6daf752fd6d81ff5a6
|
5c7813641516bd1f84b946ec6f8448b0a5e96e8f
|
refs/heads/master
| 2023-03-16T16:46:35.102000 | 2020-03-17T17:59:50 | 2020-03-17T17:59:50 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.util;
public abstract class SteelHawk extends ThreeLaws {
public SteelHawk() {
/*
* The Steel Hawks’ mission is to empower our diverse team to develop our
* abilities through a collaborative learning environment. We create
* opportunities to explore a myriad of fields to ignite and fuel our passions.
* Our enthusiasm drives us to share our knowledge globally to inspire the next
* generation of innovators.
*/
}
}
|
UTF-8
|
Java
| 955 |
java
|
SteelHawk.java
|
Java
|
[] | null |
[] |
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
package frc.util;
public abstract class SteelHawk extends ThreeLaws {
public SteelHawk() {
/*
* The Steel Hawks’ mission is to empower our diverse team to develop our
* abilities through a collaborative learning environment. We create
* opportunities to explore a myriad of fields to ignite and fuel our passions.
* Our enthusiasm drives us to share our knowledge globally to inspire the next
* generation of innovators.
*/
}
}
| 955 | 0.524659 | 0.520462 | 20 | 46.700001 | 34.760754 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.05 | false | false |
12
|
2ca9035c6030982b159759c5f7a493c162f7a87e
| 34,239,479,294,752 |
64c6b427005a200b9822062bd59e2dbd6a12137c
|
/src/main/java/com/nuc/mapper/MarketMapper.java
|
1b213f2cde36e617c1083f9aef99ef4b12534363
|
[] |
no_license
|
mrsongjiangtao/MyMybatis
|
https://github.com/mrsongjiangtao/MyMybatis
|
22914370f2f8c13f22a90436108522790982ea6c
|
959c880aa768459a2ead92b024f06a28ff9f47d1
|
refs/heads/master
| 2020-03-28T05:07:38.264000 | 2018-09-07T02:13:03 | 2018-09-07T02:13:03 | 147,758,098 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.nuc.mapper;
import com.nuc.entity.Customer;
import com.nuc.entity.Market;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface MarketMapper {
//增删改查
public void insertMarket(Market market);
public void deleteMarket(String market_id);
public void updateMarket(Market market);
public List<Market> selectMarket();
//通过market_name模糊查询market信息
public List<Market> selectByNameList(@Param("name") String market_name);
@MapKey("market_id")//赋值的是Market中的market_id(实体中的),mybatis自动获取
public Map<String,Market> selectByNameMap(@Param("name") String market_name);
//通过market_name和address模糊查询market信息,返回list信息。要求使用map作为参数传递。
public List<Market> selectByNameAdd(Map<Object,Object> map);
//通过market_id查询market信息。
public Market selectById(String market_id);
//一对多集合嵌套映射
public List<Customer> getCustomerByMarketId(String market_id);
//一对多集合分步映射
public Market selectAllCusById(String market_id);
}
|
UTF-8
|
Java
| 1,223 |
java
|
MarketMapper.java
|
Java
|
[] | null |
[] |
package com.nuc.mapper;
import com.nuc.entity.Customer;
import com.nuc.entity.Market;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface MarketMapper {
//增删改查
public void insertMarket(Market market);
public void deleteMarket(String market_id);
public void updateMarket(Market market);
public List<Market> selectMarket();
//通过market_name模糊查询market信息
public List<Market> selectByNameList(@Param("name") String market_name);
@MapKey("market_id")//赋值的是Market中的market_id(实体中的),mybatis自动获取
public Map<String,Market> selectByNameMap(@Param("name") String market_name);
//通过market_name和address模糊查询market信息,返回list信息。要求使用map作为参数传递。
public List<Market> selectByNameAdd(Map<Object,Object> map);
//通过market_id查询market信息。
public Market selectById(String market_id);
//一对多集合嵌套映射
public List<Customer> getCustomerByMarketId(String market_id);
//一对多集合分步映射
public Market selectAllCusById(String market_id);
}
| 1,223 | 0.753515 | 0.753515 | 34 | 30.382353 | 24.564459 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.558824 | false | false |
12
|
fc92b391d932b8d4560cd5d90a2d68caf053d059
| 6,124,623,402,759 |
c75736c1cc6c5a9d4a76f998efb5e64b832ceb81
|
/src/magiera/projekt/Funkcja.java
|
449417e18a33492530b419e133831ba2773450ee
|
[] |
no_license
|
kamilmag/Robot-programowalny
|
https://github.com/kamilmag/Robot-programowalny
|
aacde6aa24ebe743d4522c711d95f7f16fb34465
|
dde83f158411ad194c83c2423d21b685aceda343
|
refs/heads/master
| 2018-04-05T09:12:22.917000 | 2017-04-26T21:20:55 | 2017-04-26T21:20:55 | 89,173,607 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package magiera.projekt;
import java.util.ArrayList;
/**
* Klasa implementująca interfejs FunkcjaInterfejs, jej zadaniem jest dostarcznie interfejsu do reprezentowania funkcji użytkownika
* @author KM
*
*/
class Funkcja implements FunkcjaInterfejs{
private String nazwaFunkcji;
private ArrayList<String> listaRozkazowFunkcji= new ArrayList<String>();
private ArrayList<ZnacznikPetli> listaPetliFunkcji= new ArrayList<ZnacznikPetli>();
private ArrayList<String> listaBledowFunkcji=new ArrayList<String>();
/**
* metoda zwracjąca listę rozkazów funkcji
*/
public ArrayList<String> getListaRozkazowFunkcji(){
return listaRozkazowFunkcji;
}
/**
* metoda zwracająca listę pętli funkcji
*/
public ArrayList<ZnacznikPetli> getListaPetliFunkcji(){
return listaPetliFunkcji;
}
/**
* metoda zwracająca listę błędów semantycznych znajduących się w funkcji użytkownika
*/
public ArrayList<String> getListaBledowFunkcji(){
return listaBledowFunkcji;
}
Funkcja(String nazwa, ArrayList<String> lsrozkazow){
nazwaFunkcji=nazwa;
listaRozkazowFunkcji=lsrozkazow;
}
/**
* Metoda sprawdzająca czy funkcja posiada błędy składniowe języka
* @return true jeśli są błędy, false brak błędów
*/
public boolean czySaBledyWFunkcji(){
return listaBledowFunkcji.isEmpty();
}
/**
* Przesłonięta metoda toString wypisująca błędy semantyczne języka znajdujące się w funkcji użytkownika
*/
public String toString(){
String[] tmp = listaBledowFunkcji.toString().split(",");
StringBuilder str = new StringBuilder();
for(String s : tmp){
str.append(s+"\n");
}
return str.toString();
}
}
|
WINDOWS-1250
|
Java
| 1,732 |
java
|
Funkcja.java
|
Java
|
[
{
"context": "do reprezentowania funkcji użytkownika\r\n * @author KM\r\n *\r\n */\r\nclass Funkcja implements FunkcjaInterfe",
"end": 212,
"score": 0.9995459318161011,
"start": 210,
"tag": "USERNAME",
"value": "KM"
}
] | null |
[] |
package magiera.projekt;
import java.util.ArrayList;
/**
* Klasa implementująca interfejs FunkcjaInterfejs, jej zadaniem jest dostarcznie interfejsu do reprezentowania funkcji użytkownika
* @author KM
*
*/
class Funkcja implements FunkcjaInterfejs{
private String nazwaFunkcji;
private ArrayList<String> listaRozkazowFunkcji= new ArrayList<String>();
private ArrayList<ZnacznikPetli> listaPetliFunkcji= new ArrayList<ZnacznikPetli>();
private ArrayList<String> listaBledowFunkcji=new ArrayList<String>();
/**
* metoda zwracjąca listę rozkazów funkcji
*/
public ArrayList<String> getListaRozkazowFunkcji(){
return listaRozkazowFunkcji;
}
/**
* metoda zwracająca listę pętli funkcji
*/
public ArrayList<ZnacznikPetli> getListaPetliFunkcji(){
return listaPetliFunkcji;
}
/**
* metoda zwracająca listę błędów semantycznych znajduących się w funkcji użytkownika
*/
public ArrayList<String> getListaBledowFunkcji(){
return listaBledowFunkcji;
}
Funkcja(String nazwa, ArrayList<String> lsrozkazow){
nazwaFunkcji=nazwa;
listaRozkazowFunkcji=lsrozkazow;
}
/**
* Metoda sprawdzająca czy funkcja posiada błędy składniowe języka
* @return true jeśli są błędy, false brak błędów
*/
public boolean czySaBledyWFunkcji(){
return listaBledowFunkcji.isEmpty();
}
/**
* Przesłonięta metoda toString wypisująca błędy semantyczne języka znajdujące się w funkcji użytkownika
*/
public String toString(){
String[] tmp = listaBledowFunkcji.toString().split(",");
StringBuilder str = new StringBuilder();
for(String s : tmp){
str.append(s+"\n");
}
return str.toString();
}
}
| 1,732 | 0.728614 | 0.728614 | 59 | 26.728813 | 29.472672 | 131 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.372881 | false | false |
12
|
63b5035857f6945c039a3adf22e1f02b83278085
| 9,388,798,510,995 |
e2d6d535b4f71832b16b3cfb889afc7bf5f998fc
|
/src/main/java/CodeReview.java
|
ae663ab1795dfbf6ad6cfb9b36351b87b92904ea
|
[] |
no_license
|
spik3r/interview
|
https://github.com/spik3r/interview
|
311af6adefa0c9c852fc15cb05c8126a89fd5a0e
|
a4b0f20301da0767140861bd0d29a4cd217090c1
|
refs/heads/master
| 2020-03-19T14:03:35.456000 | 2018-06-08T12:04:26 | 2018-06-08T12:04:26 | 136,606,902 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CodeReview {
private static final Logger LOG = LoggerFactory.getLogger(CodeReview.class);
public Integer MAX_ENTITIES = 100;
public String APP_TITLE = "Printing " + MAX_ENTITIES + " Entities";
public Ball b;
private Integer getMAX_ENTITIES() {
return MAX_ENTITIES;
}
public CodeReview() {
this.b = new Ball();
}
public void doStuffWithBall() {
this.b.d = 123;
this.b.c = "pink";
}
public class Ball {
public int d = 5;
public String c = "blue";
public void playWithBall() {
System.out.println("Playing with ball");
try {
Thread.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private void print100Entities() {
String output= APP_TITLE + ": ";
for (int i=1; i<=500; i++) {
output = output + ", ";
output = output + i;
}
System.out.println(output);
}
}
|
UTF-8
|
Java
| 1,110 |
java
|
CodeReview.java
|
Java
|
[] | null |
[] |
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CodeReview {
private static final Logger LOG = LoggerFactory.getLogger(CodeReview.class);
public Integer MAX_ENTITIES = 100;
public String APP_TITLE = "Printing " + MAX_ENTITIES + " Entities";
public Ball b;
private Integer getMAX_ENTITIES() {
return MAX_ENTITIES;
}
public CodeReview() {
this.b = new Ball();
}
public void doStuffWithBall() {
this.b.d = 123;
this.b.c = "pink";
}
public class Ball {
public int d = 5;
public String c = "blue";
public void playWithBall() {
System.out.println("Playing with ball");
try {
Thread.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private void print100Entities() {
String output= APP_TITLE + ": ";
for (int i=1; i<=500; i++) {
output = output + ", ";
output = output + i;
}
System.out.println(output);
}
}
| 1,110 | 0.535135 | 0.51982 | 47 | 22.617022 | 18.814383 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.468085 | false | false |
12
|
c7cdbcfe43cebf30ea8b02846c44002cd6329b18
| 5,686,536,732,959 |
d8addb14a761c3eb3d7a1b464ecee17e9a53c521
|
/app/src/main/java/com/example/aac088/chatapp/RegisterActivity.java
|
a62ccdc768064fbe236dba958bb44a82229de486
|
[] |
no_license
|
albertoceballos/ChatApp
|
https://github.com/albertoceballos/ChatApp
|
1a4ea4606134e7b251c6071eb8761767f3532343
|
5a1896f0a357bd85362eae77482b0faebfc264d3
|
refs/heads/master
| 2021-07-12T13:33:24.038000 | 2017-10-14T22:19:18 | 2017-10-14T22:19:18 | 104,703,466 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.aac088.chatapp;
import android.app.ProgressDialog;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.iid.FirebaseInstanceId;
public class RegisterActivity extends AppCompatActivity {
private Toolbar toolbar;
private EditText display_name,email,password,confirm;
private Button reg_btn;
private FirebaseAuth mAuth;
private ProgressDialog loadingBar;
private DatabaseReference storeUserDefaultDataReference;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
mAuth = FirebaseAuth.getInstance();
toolbar = (Toolbar) findViewById(R.id.reg_toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("Create Account");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
display_name = (EditText) findViewById(R.id.reg_display_name_et);
email = (EditText) findViewById(R.id.reg_email_et);
password = (EditText) findViewById(R.id.reg_pass_et);
confirm = (EditText) findViewById(R.id.reg_confirm_pass_et);
loadingBar = new ProgressDialog(this);
reg_btn = (Button) findViewById(R.id.reg_create_acnt_btn);
reg_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String display_name_str = display_name.getText().toString();
String email_str = email.getText().toString();
String password_str = password.getText().toString();
String confirm_str = confirm.getText().toString();
if(validateFields(display_name_str,email_str,password_str,confirm_str)){
register_user(display_name_str,email_str,password_str);
}else{
Toast.makeText(RegisterActivity.this, "Try Again", Toast.LENGTH_SHORT).show();
}
}
});
}
private boolean validateFields(String display, String email, String password, String confirm) {
if(display.isEmpty()){
Toast.makeText(RegisterActivity.this, "Display can't be empty", Toast.LENGTH_SHORT).show();
return false;
}
if(email.isEmpty()){
Toast.makeText(RegisterActivity.this, "Email can't be empty", Toast.LENGTH_SHORT).show();
return false;
}
if(password.isEmpty()){
Toast.makeText(RegisterActivity.this,"Password field can't be empty", Toast.LENGTH_SHORT).show();
return false;
}
if(confirm.isEmpty()){
Toast.makeText(RegisterActivity.this,"Confirm password can't be empty", Toast.LENGTH_SHORT).show();
return false;
}
if(!password.equals(confirm)){
Toast.makeText(RegisterActivity.this,"Passwords do not match", Toast.LENGTH_SHORT).show();
return false;
}
return true;
}
private void register_user(final String display_name_str, String email_str, String password_str) {
loadingBar.setTitle("Creating New Account");
loadingBar.setMessage("Please Wait...");
loadingBar.show();
mAuth.createUserWithEmailAndPassword(email_str, password_str)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
String device_token = FirebaseInstanceId.getInstance().getToken();
//Gets user ID
String current_user_id = mAuth.getCurrentUser().getUid();
//Initializes the instance of Firebase
storeUserDefaultDataReference = FirebaseDatabase.getInstance().getReference().child("Users").child(current_user_id);
//Store Data to FirebaseDB
storeUserDefaultDataReference.child("user_name").setValue(display_name_str);
storeUserDefaultDataReference.child("user_status").setValue("Hey there, I am using BoostChat!");
storeUserDefaultDataReference.child("device_token").setValue(device_token);
storeUserDefaultDataReference.child("user_image").setValue("default_img_user");
storeUserDefaultDataReference.child("user_thumb_image").setValue("default_image")
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if(task.isSuccessful()){
Intent mainIntent = new Intent(RegisterActivity.this,LoginActivity.class);
mainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(mainIntent);
finish();
}
}
});
}
// If sign in fails, display a message to the user. If sign in succeeds
// the auth state listener will be notified and logic to handle the
// signed in user can be handled in the listener.
else{
Toast.makeText(RegisterActivity.this, "Unable to register.",
Toast.LENGTH_LONG).show();
}
loadingBar.dismiss();
// ...
}
});
}
}
|
UTF-8
|
Java
| 6,621 |
java
|
RegisterActivity.java
|
Java
|
[
{
"context": "g device_token = FirebaseInstanceId.getInstance().getToken();\n //Gets user ID\n ",
"end": 4222,
"score": 0.5607700347900391,
"start": 4214,
"tag": "KEY",
"value": "getToken"
}
] | null |
[] |
package com.example.aac088.chatapp;
import android.app.ProgressDialog;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.iid.FirebaseInstanceId;
public class RegisterActivity extends AppCompatActivity {
private Toolbar toolbar;
private EditText display_name,email,password,confirm;
private Button reg_btn;
private FirebaseAuth mAuth;
private ProgressDialog loadingBar;
private DatabaseReference storeUserDefaultDataReference;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
mAuth = FirebaseAuth.getInstance();
toolbar = (Toolbar) findViewById(R.id.reg_toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("Create Account");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
display_name = (EditText) findViewById(R.id.reg_display_name_et);
email = (EditText) findViewById(R.id.reg_email_et);
password = (EditText) findViewById(R.id.reg_pass_et);
confirm = (EditText) findViewById(R.id.reg_confirm_pass_et);
loadingBar = new ProgressDialog(this);
reg_btn = (Button) findViewById(R.id.reg_create_acnt_btn);
reg_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String display_name_str = display_name.getText().toString();
String email_str = email.getText().toString();
String password_str = password.getText().toString();
String confirm_str = confirm.getText().toString();
if(validateFields(display_name_str,email_str,password_str,confirm_str)){
register_user(display_name_str,email_str,password_str);
}else{
Toast.makeText(RegisterActivity.this, "Try Again", Toast.LENGTH_SHORT).show();
}
}
});
}
private boolean validateFields(String display, String email, String password, String confirm) {
if(display.isEmpty()){
Toast.makeText(RegisterActivity.this, "Display can't be empty", Toast.LENGTH_SHORT).show();
return false;
}
if(email.isEmpty()){
Toast.makeText(RegisterActivity.this, "Email can't be empty", Toast.LENGTH_SHORT).show();
return false;
}
if(password.isEmpty()){
Toast.makeText(RegisterActivity.this,"Password field can't be empty", Toast.LENGTH_SHORT).show();
return false;
}
if(confirm.isEmpty()){
Toast.makeText(RegisterActivity.this,"Confirm password can't be empty", Toast.LENGTH_SHORT).show();
return false;
}
if(!password.equals(confirm)){
Toast.makeText(RegisterActivity.this,"Passwords do not match", Toast.LENGTH_SHORT).show();
return false;
}
return true;
}
private void register_user(final String display_name_str, String email_str, String password_str) {
loadingBar.setTitle("Creating New Account");
loadingBar.setMessage("Please Wait...");
loadingBar.show();
mAuth.createUserWithEmailAndPassword(email_str, password_str)
.addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
String device_token = FirebaseInstanceId.getInstance().getToken();
//Gets user ID
String current_user_id = mAuth.getCurrentUser().getUid();
//Initializes the instance of Firebase
storeUserDefaultDataReference = FirebaseDatabase.getInstance().getReference().child("Users").child(current_user_id);
//Store Data to FirebaseDB
storeUserDefaultDataReference.child("user_name").setValue(display_name_str);
storeUserDefaultDataReference.child("user_status").setValue("Hey there, I am using BoostChat!");
storeUserDefaultDataReference.child("device_token").setValue(device_token);
storeUserDefaultDataReference.child("user_image").setValue("default_img_user");
storeUserDefaultDataReference.child("user_thumb_image").setValue("default_image")
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if(task.isSuccessful()){
Intent mainIntent = new Intent(RegisterActivity.this,LoginActivity.class);
mainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(mainIntent);
finish();
}
}
});
}
// If sign in fails, display a message to the user. If sign in succeeds
// the auth state listener will be notified and logic to handle the
// signed in user can be handled in the listener.
else{
Toast.makeText(RegisterActivity.this, "Unable to register.",
Toast.LENGTH_LONG).show();
}
loadingBar.dismiss();
// ...
}
});
}
}
| 6,621 | 0.58103 | 0.580275 | 140 | 46.292858 | 34.164623 | 144 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false |
12
|
9f261c8909963213f4cbecf3ce99e6b92565b9be
| 26,130,581,090,053 |
c29fe44abc78482ca4c297162d2ba2fa8d531036
|
/src/main/java/biz/manager/TransactionsMgr.java
|
7a70d0a233ed755f1e2d66d7a959c9879d9e1d17
|
[] |
no_license
|
Saw6Bdx/BankAppWeb1.0
|
https://github.com/Saw6Bdx/BankAppWeb1.0
|
13564908d802acdabd9f15c863b6fe32a4f15c49
|
2b0b7cece6630c549c73d80d7cdf1a2631f3eb13
|
refs/heads/master
| 2021-01-23T05:04:31.741000 | 2017-06-14T14:40:35 | 2017-06-14T14:40:35 | 92,954,088 | 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 biz.manager;
import biz.exception.NoTransactionsAvailableException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import model.Category;
import model.TransactionType;
import model.Transactions;
/**
*
* @author Guest
*/
@Stateless
public class TransactionsMgr {
@PersistenceContext(unitName = "BankAppPU")
private EntityManager em;
private List<Transactions> transactionsList = new ArrayList<Transactions>();
private List<TransactionType> transactionTypeList = new ArrayList<TransactionType>();
public void createTransactions(Transactions transactions) {
this.em.persist(transactions);
}
public List<Transactions> displayTransactions(int Id) throws NoTransactionsAvailableException {
try {
TypedQuery<Transactions> qTransactions = this.em.createQuery("SELECT t FROM Transactions t JOIN t.idAccount a WHERE a.id =:account ORDER BY t.date DESC", Transactions.class);
qTransactions.setParameter("account", Id);
this.transactionsList = qTransactions.getResultList();
return this.transactionsList;
} catch (NoResultException e) {
throw new NoTransactionsAvailableException();
}
}
public List<TransactionType> displayTransactionType() throws NoTransactionsAvailableException {
try {
TypedQuery<TransactionType> qTransactionType = this.em.createNamedQuery("TransactionType.findAll", TransactionType.class);
this.transactionTypeList = qTransactionType.getResultList();
return this.transactionTypeList;
} catch (NoResultException e) {
throw new NoTransactionsAvailableException();
}
}
public void delete(String parameter) {
TypedQuery<Transactions> qTransactions = this.em.createQuery("SELECT t FROM Transactions t WHERE t.id=:ptrans", Transactions.class);
qTransactions.setParameter("ptrans", Integer.parseInt(parameter));
Transactions transaction = qTransactions.getResultList().get(0);
this.em.remove(transaction);
}
public List<Transactions> transactionsOrderBy(int Id, String param, String order) throws NoTransactionsAvailableException {
TypedQuery<Transactions> qTransactions;
switch (param) {
case "category":
qTransactions = this.em.createQuery("SELECT t FROM Transactions t JOIN t.idAccount a WHERE a.id =:account ORDER BY t.idCategory.label " + order, Transactions.class);
break;
case "debit":
qTransactions = this.em.createQuery("SELECT t FROM Transactions t JOIN t.idAccount a WHERE a.id =:account ORDER BY t.amount " + order, Transactions.class);
break;
case "credit":
qTransactions = this.em.createQuery("SELECT t FROM Transactions t JOIN t.idAccount a WHERE a.id =:account ORDER BY t.amount " + order, Transactions.class);
break;
default: // date
qTransactions = this.em.createQuery("SELECT t FROM Transactions t JOIN t.idAccount a WHERE a.id =:account ORDER BY t.date " + order, Transactions.class);
break;
}
qTransactions.setParameter("account", Id);
try {
this.transactionsList = qTransactions.getResultList();
return this.transactionsList;
} catch (NoResultException e) {
throw new NoTransactionsAvailableException();
}
}
public void modify(int Id, Date date, Date endDate, String label, double amount, Category category) {
Transactions trans = new Transactions(
Id,
label,
amount,
date,
endDate
);
trans.setIdCategory(category);
this.em.merge(trans);
}
public Transactions getTransaction(int Id) {
TypedQuery<Transactions> qTransactions = this.em.createNamedQuery("Transactions.findById", Transactions.class);
qTransactions.setParameter("id", Id);
return qTransactions.getResultList().get(0);
}
}
|
UTF-8
|
Java
| 4,526 |
java
|
TransactionsMgr.java
|
Java
|
[
{
"context": "ype;\nimport model.Transactions;\n\n/**\n *\n * @author Guest\n */\n@Stateless\npublic class TransactionsMgr {\n\n ",
"end": 634,
"score": 0.8556999564170837,
"start": 629,
"tag": "NAME",
"value": "Guest"
}
] | 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 biz.manager;
import biz.exception.NoTransactionsAvailableException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import model.Category;
import model.TransactionType;
import model.Transactions;
/**
*
* @author Guest
*/
@Stateless
public class TransactionsMgr {
@PersistenceContext(unitName = "BankAppPU")
private EntityManager em;
private List<Transactions> transactionsList = new ArrayList<Transactions>();
private List<TransactionType> transactionTypeList = new ArrayList<TransactionType>();
public void createTransactions(Transactions transactions) {
this.em.persist(transactions);
}
public List<Transactions> displayTransactions(int Id) throws NoTransactionsAvailableException {
try {
TypedQuery<Transactions> qTransactions = this.em.createQuery("SELECT t FROM Transactions t JOIN t.idAccount a WHERE a.id =:account ORDER BY t.date DESC", Transactions.class);
qTransactions.setParameter("account", Id);
this.transactionsList = qTransactions.getResultList();
return this.transactionsList;
} catch (NoResultException e) {
throw new NoTransactionsAvailableException();
}
}
public List<TransactionType> displayTransactionType() throws NoTransactionsAvailableException {
try {
TypedQuery<TransactionType> qTransactionType = this.em.createNamedQuery("TransactionType.findAll", TransactionType.class);
this.transactionTypeList = qTransactionType.getResultList();
return this.transactionTypeList;
} catch (NoResultException e) {
throw new NoTransactionsAvailableException();
}
}
public void delete(String parameter) {
TypedQuery<Transactions> qTransactions = this.em.createQuery("SELECT t FROM Transactions t WHERE t.id=:ptrans", Transactions.class);
qTransactions.setParameter("ptrans", Integer.parseInt(parameter));
Transactions transaction = qTransactions.getResultList().get(0);
this.em.remove(transaction);
}
public List<Transactions> transactionsOrderBy(int Id, String param, String order) throws NoTransactionsAvailableException {
TypedQuery<Transactions> qTransactions;
switch (param) {
case "category":
qTransactions = this.em.createQuery("SELECT t FROM Transactions t JOIN t.idAccount a WHERE a.id =:account ORDER BY t.idCategory.label " + order, Transactions.class);
break;
case "debit":
qTransactions = this.em.createQuery("SELECT t FROM Transactions t JOIN t.idAccount a WHERE a.id =:account ORDER BY t.amount " + order, Transactions.class);
break;
case "credit":
qTransactions = this.em.createQuery("SELECT t FROM Transactions t JOIN t.idAccount a WHERE a.id =:account ORDER BY t.amount " + order, Transactions.class);
break;
default: // date
qTransactions = this.em.createQuery("SELECT t FROM Transactions t JOIN t.idAccount a WHERE a.id =:account ORDER BY t.date " + order, Transactions.class);
break;
}
qTransactions.setParameter("account", Id);
try {
this.transactionsList = qTransactions.getResultList();
return this.transactionsList;
} catch (NoResultException e) {
throw new NoTransactionsAvailableException();
}
}
public void modify(int Id, Date date, Date endDate, String label, double amount, Category category) {
Transactions trans = new Transactions(
Id,
label,
amount,
date,
endDate
);
trans.setIdCategory(category);
this.em.merge(trans);
}
public Transactions getTransaction(int Id) {
TypedQuery<Transactions> qTransactions = this.em.createNamedQuery("Transactions.findById", Transactions.class);
qTransactions.setParameter("id", Id);
return qTransactions.getResultList().get(0);
}
}
| 4,526 | 0.676536 | 0.676094 | 125 | 35.208 | 42.187069 | 186 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
12
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.