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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c4f9dd0a33ac7c18dad10f4708933ee67f20332e
| 24,515,673,391,560 |
2cf1c9c97a6c0bb7ccb7616c11f15f42d00a61d5
|
/src/DailyTemperatures.java
|
e452ecdcef66c07c014a9d4730b9123c57542e4b
|
[] |
no_license
|
BrunoDeNadaiSarnaglia/LeetCode
|
https://github.com/BrunoDeNadaiSarnaglia/LeetCode
|
6b0410887de979a85e77d939e188f957262026fd
|
e4e514bc75949ece617a7da7ebeec80a273faad4
|
refs/heads/master
| 2021-01-17T02:42:25.389000 | 2018-07-09T02:20:36 | 2018-07-09T02:20:36 | 58,097,400 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.Stack;
public class DailyTemperatures {
public int[] dailyTemperatures(int[] temperatures) {
Stack<Integer> stk = new Stack<>();
int[] waitToWarmerDays = new int[temperatures.length];
for (int i = 0; i < temperatures.length; i++) {
while(!stk.isEmpty() && temperatures[stk.peek()] < temperatures[i]) {
int day = stk.pop();
waitToWarmerDays[day] = i - day;
}
stk.push(i);
}
return waitToWarmerDays;
}
}
|
UTF-8
|
Java
| 478 |
java
|
DailyTemperatures.java
|
Java
|
[] | null |
[] |
import java.util.Stack;
public class DailyTemperatures {
public int[] dailyTemperatures(int[] temperatures) {
Stack<Integer> stk = new Stack<>();
int[] waitToWarmerDays = new int[temperatures.length];
for (int i = 0; i < temperatures.length; i++) {
while(!stk.isEmpty() && temperatures[stk.peek()] < temperatures[i]) {
int day = stk.pop();
waitToWarmerDays[day] = i - day;
}
stk.push(i);
}
return waitToWarmerDays;
}
}
| 478 | 0.615063 | 0.612971 | 16 | 28.875 | 22.101683 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5625 | false | false |
12
|
16be14299a0e8c6e38b824c11094ccf8271c7653
| 29,025,389,048,461 |
014c6b12c2b4625c5c6845064ca07337d34a3e06
|
/src/main/java/br/com/tech4me/filmes/model/Ator.java
|
b48b58f0a6cd80f22d174dfc3c4280cd3b2b5a13
|
[] |
no_license
|
luiz0110/filmes
|
https://github.com/luiz0110/filmes
|
a39ae07b139a34bee9d71960ca62dfd65e895b37
|
013c6edc41d1f1951ce6159c176313ffed55c24e
|
refs/heads/main
| 2023-08-08T04:07:32.286000 | 2021-09-17T01:20:31 | 2021-09-17T01:20:31 | 404,902,985 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
//ls//
package br.com.tech4me.filmes.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table (name = "actor")
public class Ator {
@Id
@Column(name = "act_id")
private Integer id;
@Column(name = "act_fname")
private String nome;
@Column(name = "act_lname")
private String sobrenome;
@Column(name = "act_gender")
private Character sexo;
//#region Getter/Setter
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getSobrenome() {
return sobrenome;
}
public void setSobrenome(String sobrenome) {
this.sobrenome = sobrenome;
}
public Character getSexo() {
return sexo;
}
public void setSexo(Character character) {
this.sexo = character;
}
//#endregion
public String getNomeCompleto(){
return String.format("%s %s", nome.trim(), sobrenome.trim());
}
@Override
public String toString(){
return getNomeCompleto();
}
}
|
UTF-8
|
Java
| 1,274 |
java
|
Ator.java
|
Java
|
[] | null |
[] |
//ls//
package br.com.tech4me.filmes.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table (name = "actor")
public class Ator {
@Id
@Column(name = "act_id")
private Integer id;
@Column(name = "act_fname")
private String nome;
@Column(name = "act_lname")
private String sobrenome;
@Column(name = "act_gender")
private Character sexo;
//#region Getter/Setter
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getSobrenome() {
return sobrenome;
}
public void setSobrenome(String sobrenome) {
this.sobrenome = sobrenome;
}
public Character getSexo() {
return sexo;
}
public void setSexo(Character character) {
this.sexo = character;
}
//#endregion
public String getNomeCompleto(){
return String.format("%s %s", nome.trim(), sobrenome.trim());
}
@Override
public String toString(){
return getNomeCompleto();
}
}
| 1,274 | 0.60675 | 0.605965 | 60 | 20.233334 | 14.849654 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.35 | false | false |
12
|
94d0b2a93008e7d170a0f7de0e996f5b1c1e559e
| 21,844,203,736,568 |
18e4bcbc2173e734b77902098abda96f16c10ef8
|
/springboot-mybatis-redis-swagger2/src/main/java/com/lnjecit/service/system/impl/UserServiceImpl.java
|
f780af89bb506a6375974a630af27c508cafabdd
|
[
"MIT"
] |
permissive
|
Dive1710393852/springboot-learn
|
https://github.com/Dive1710393852/springboot-learn
|
90327d95a585d27a435acae3bcf70f28e51b3029
|
54a0d94f869d3c93bf8db4ee7f96bcf31bfad50f
|
refs/heads/master
| 2021-03-25T23:41:20.066000 | 2019-11-06T12:06:55 | 2019-11-06T12:06:55 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.lnjecit.service.system.impl;
import com.lnjecit.common.base.BaseServiceImpl;
import com.lnjecit.common.constants.MsgConstants;
import com.lnjecit.common.exception.ServiceException;
import com.lnjecit.common.result.Result;
import com.lnjecit.common.shiro.ShiroUtils;
import com.lnjecit.common.util.PasswordHash;
import com.lnjecit.common.util.PhoneFormatCheckUtil;
import com.lnjecit.common.util.StringUtil;
import com.lnjecit.dao.system.UserDao;
import com.lnjecit.dao.system.UserRoleDao;
import com.lnjecit.entity.system.User;
import com.lnjecit.entity.system.UserRole;
import com.lnjecit.service.IpAddressService;
import com.lnjecit.service.system.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
* Create by lnj
* create time: 2018-05-13 22:34:10
*/
@Service
public class UserServiceImpl extends BaseServiceImpl<UserDao, User> implements UserService {
@Autowired
private UserDao userDao;
@Autowired
private UserRoleDao userRoleDao;
@Autowired
private IpAddressService ipAddressService;
@Transactional(propagation = Propagation.REQUIRED)
@Override
public Result insert(User user) {
String password = user.getPassword();
if (StringUtil.isBlank(password)) {
return Result.error(MsgConstants.PASSWORD_CAN_NOT_NULL);
}
String mobile = user.getMobile();
// 手机号格式校验
if (StringUtil.isNotBlank(mobile) && !PhoneFormatCheckUtil.isPhoneLegal(mobile)) {
return Result.error(MsgConstants.MOBILE_FORMAT_ERROR);
}
String username = user.getUsername();
Result checkUsernameResult = checkUsername(username);
if (null != checkUsernameResult) {
return checkUsernameResult;
}
// 密码加密
try {
user.setPassword(PasswordHash.createHash(password));
} catch (Exception e) {
logger.error(MsgConstants.PASSWORD_HASH_ERROR, e);
throw new ServiceException(MsgConstants.PASSWORD_HASH_ERROR);
}
return super.insert(user);
}
@Transactional(propagation = Propagation.REQUIRED)
@Override
public Result update(User user) {
String mobile = user.getMobile();
// 手机号格式校验
if (StringUtil.isNotBlank(mobile) && !PhoneFormatCheckUtil.isPhoneLegal(mobile)) {
return Result.error(MsgConstants.MOBILE_FORMAT_ERROR);
}
String username = user.getUsername();
User oldUser = super.getById(user.getId());
// 如果用户名被修改
if (!username.equals(oldUser.getUsername())) {
Result checkUsernameResult = checkUsername(username);
if (null != checkUsernameResult) {
return checkUsernameResult;
}
}
oldUser.setUsername(user.getUsername());
oldUser.setNickname(user.getNickname());
oldUser.setRealname(user.getRealname());
oldUser.setMobile(user.getMobile());
oldUser.setEmail(user.getEmail());
oldUser.setAvatar(user.getAvatar());
return super.update(oldUser);
}
@Transactional(propagation = Propagation.REQUIRED)
@Override
public void updateLastLoginInfo() {
Date lastLoginTime = new Date();
Long userId = ShiroUtils.getUserId();
String lastLoginIp = ShiroUtils.getLastLoginIp();
User oldUser = super.getById(userId);
oldUser.setLastLoginTime(lastLoginTime);
oldUser.setLastLoginIp(lastLoginIp);
oldUser.setLastLoginAddress(ipAddressService.getAddressByIp(lastLoginIp));
super.update(oldUser);
}
@Transactional(propagation = Propagation.REQUIRED)
@Override
public void selectRoles(Long userId, Long[] roleIds) throws Exception {
// 通过用户id删除用户与角色关联关系
userRoleDao.deleteByUserId(userId);
for (Long roleId : roleIds) {
UserRole userRole = new UserRole();
userRole.setUserId(userId);
userRole.setRoleId(roleId);
userRole.setDefaultValueForFields();
userRoleDao.insert(userRole);
}
}
@Override
public boolean existUsername(String username) {
// 用户名是否已存在
User userList = userDao.getByUsername(username);
if (null != userList) {
return true;
}
return false;
}
@Override
public User getByUsername(String username) {
return userDao.getByUsername(username);
}
/**
* 校验用户名
*
* @param username 用户名
* @return
*/
private Result checkUsername(String username) {
// 用户名不能为纯数字
if (StringUtil.isNumeric(username)) {
return Result.error(MsgConstants.USERNAME_CANNOT_BE_NUMERIC);
}
// 用户名格式校验
if (!StringUtil.usernameFormatCheck(username)) {
return Result.error(MsgConstants.USERNAME_FORMAT_ERROR);
}
// 用户名是否已存在
if (existUsername(username)) {
return Result.error(MsgConstants.USERNAME_HAS_EXIST);
}
return null;
}
}
|
UTF-8
|
Java
| 5,430 |
java
|
UserServiceImpl.java
|
Java
|
[
{
"context": "ctional;\n\nimport java.util.Date;\n\n/**\n * Create by lnj\n * create time: 2018-05-13 22:34:10\n */\n@Service\n",
"end": 959,
"score": 0.9993366003036499,
"start": 956,
"tag": "USERNAME",
"value": "lnj"
},
{
"context": " Result checkUsernameResult = checkUsername(username);\n if (null != checkUsernameResult) {\n ",
"end": 1874,
"score": 0.9649190306663513,
"start": 1866,
"tag": "USERNAME",
"value": "username"
}
] | null |
[] |
package com.lnjecit.service.system.impl;
import com.lnjecit.common.base.BaseServiceImpl;
import com.lnjecit.common.constants.MsgConstants;
import com.lnjecit.common.exception.ServiceException;
import com.lnjecit.common.result.Result;
import com.lnjecit.common.shiro.ShiroUtils;
import com.lnjecit.common.util.PasswordHash;
import com.lnjecit.common.util.PhoneFormatCheckUtil;
import com.lnjecit.common.util.StringUtil;
import com.lnjecit.dao.system.UserDao;
import com.lnjecit.dao.system.UserRoleDao;
import com.lnjecit.entity.system.User;
import com.lnjecit.entity.system.UserRole;
import com.lnjecit.service.IpAddressService;
import com.lnjecit.service.system.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
* Create by lnj
* create time: 2018-05-13 22:34:10
*/
@Service
public class UserServiceImpl extends BaseServiceImpl<UserDao, User> implements UserService {
@Autowired
private UserDao userDao;
@Autowired
private UserRoleDao userRoleDao;
@Autowired
private IpAddressService ipAddressService;
@Transactional(propagation = Propagation.REQUIRED)
@Override
public Result insert(User user) {
String password = user.getPassword();
if (StringUtil.isBlank(password)) {
return Result.error(MsgConstants.PASSWORD_CAN_NOT_NULL);
}
String mobile = user.getMobile();
// 手机号格式校验
if (StringUtil.isNotBlank(mobile) && !PhoneFormatCheckUtil.isPhoneLegal(mobile)) {
return Result.error(MsgConstants.MOBILE_FORMAT_ERROR);
}
String username = user.getUsername();
Result checkUsernameResult = checkUsername(username);
if (null != checkUsernameResult) {
return checkUsernameResult;
}
// 密码加密
try {
user.setPassword(PasswordHash.createHash(password));
} catch (Exception e) {
logger.error(MsgConstants.PASSWORD_HASH_ERROR, e);
throw new ServiceException(MsgConstants.PASSWORD_HASH_ERROR);
}
return super.insert(user);
}
@Transactional(propagation = Propagation.REQUIRED)
@Override
public Result update(User user) {
String mobile = user.getMobile();
// 手机号格式校验
if (StringUtil.isNotBlank(mobile) && !PhoneFormatCheckUtil.isPhoneLegal(mobile)) {
return Result.error(MsgConstants.MOBILE_FORMAT_ERROR);
}
String username = user.getUsername();
User oldUser = super.getById(user.getId());
// 如果用户名被修改
if (!username.equals(oldUser.getUsername())) {
Result checkUsernameResult = checkUsername(username);
if (null != checkUsernameResult) {
return checkUsernameResult;
}
}
oldUser.setUsername(user.getUsername());
oldUser.setNickname(user.getNickname());
oldUser.setRealname(user.getRealname());
oldUser.setMobile(user.getMobile());
oldUser.setEmail(user.getEmail());
oldUser.setAvatar(user.getAvatar());
return super.update(oldUser);
}
@Transactional(propagation = Propagation.REQUIRED)
@Override
public void updateLastLoginInfo() {
Date lastLoginTime = new Date();
Long userId = ShiroUtils.getUserId();
String lastLoginIp = ShiroUtils.getLastLoginIp();
User oldUser = super.getById(userId);
oldUser.setLastLoginTime(lastLoginTime);
oldUser.setLastLoginIp(lastLoginIp);
oldUser.setLastLoginAddress(ipAddressService.getAddressByIp(lastLoginIp));
super.update(oldUser);
}
@Transactional(propagation = Propagation.REQUIRED)
@Override
public void selectRoles(Long userId, Long[] roleIds) throws Exception {
// 通过用户id删除用户与角色关联关系
userRoleDao.deleteByUserId(userId);
for (Long roleId : roleIds) {
UserRole userRole = new UserRole();
userRole.setUserId(userId);
userRole.setRoleId(roleId);
userRole.setDefaultValueForFields();
userRoleDao.insert(userRole);
}
}
@Override
public boolean existUsername(String username) {
// 用户名是否已存在
User userList = userDao.getByUsername(username);
if (null != userList) {
return true;
}
return false;
}
@Override
public User getByUsername(String username) {
return userDao.getByUsername(username);
}
/**
* 校验用户名
*
* @param username 用户名
* @return
*/
private Result checkUsername(String username) {
// 用户名不能为纯数字
if (StringUtil.isNumeric(username)) {
return Result.error(MsgConstants.USERNAME_CANNOT_BE_NUMERIC);
}
// 用户名格式校验
if (!StringUtil.usernameFormatCheck(username)) {
return Result.error(MsgConstants.USERNAME_FORMAT_ERROR);
}
// 用户名是否已存在
if (existUsername(username)) {
return Result.error(MsgConstants.USERNAME_HAS_EXIST);
}
return null;
}
}
| 5,430 | 0.665338 | 0.66268 | 159 | 32.132076 | 22.850378 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.45283 | false | false |
12
|
56f632431b9d6725a1ea64133f30a9acc602cb47
| 30,897,994,752,677 |
fa1f63ac494d3efdc18d62b2b58f5bab9b919361
|
/LangerServer/api/src/main/java/com/langer/server/api/admin/dto/WordWithTranslation.java
|
e86ff82126ca608aea9781e77d8611805423b3b8
|
[] |
no_license
|
barakc82/langer
|
https://github.com/barakc82/langer
|
5e6a14669c8572aa2f6950cdfdd06e6e065c2379
|
a13d3a256854697abd24c775088834ee507cf2f1
|
refs/heads/master
| 2023-01-11T02:30:06.095000 | 2020-12-20T18:52:58 | 2020-12-20T18:52:58 | 195,468,128 | 0 | 0 | null | false | 2023-01-07T22:43:55 | 2019-07-05T21:16:23 | 2020-12-20T18:58:57 | 2023-01-07T22:43:55 | 3,541 | 0 | 0 | 26 |
Java
| false | false |
package com.langer.server.api.admin.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WordWithTranslation
{
WordDto word;
WordTranslationDto wordTranslation;
@Override
public boolean equals(Object obj)
{
if (this == obj) return true;
if (obj == null || this.getClass() != obj.getClass())
return false;
WordWithTranslation other = (WordWithTranslation) obj;
return word.getId() == other.word.getId() && wordTranslation.getId() == other.wordTranslation.getId();
}
@Override
public int hashCode()
{
final int prime = 31;
int result = prime * word.hashCode();
result = prime * result + wordTranslation.hashCode();
return result;
}
}
|
UTF-8
|
Java
| 894 |
java
|
WordWithTranslation.java
|
Java
|
[] | null |
[] |
package com.langer.server.api.admin.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WordWithTranslation
{
WordDto word;
WordTranslationDto wordTranslation;
@Override
public boolean equals(Object obj)
{
if (this == obj) return true;
if (obj == null || this.getClass() != obj.getClass())
return false;
WordWithTranslation other = (WordWithTranslation) obj;
return word.getId() == other.word.getId() && wordTranslation.getId() == other.wordTranslation.getId();
}
@Override
public int hashCode()
{
final int prime = 31;
int result = prime * word.hashCode();
result = prime * result + wordTranslation.hashCode();
return result;
}
}
| 894 | 0.652125 | 0.649888 | 36 | 23.861111 | 23.252422 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.472222 | false | false |
12
|
4d76302280eea5352c1603d29cdb52029891bd2e
| 35,364,760,726,554 |
9a7889b754ddfe5c342d78aada4bccc1832c32de
|
/app/src/main/java/com/jarvisdong/jdrobot/di/component/AppComponent.java
|
9ef50288afd12a68f0b9da8f98bf31035b336cca
|
[
"MIT"
] |
permissive
|
JarvisBuop/jarvisSet
|
https://github.com/JarvisBuop/jarvisSet
|
f37b247e46c5c8faca5a366c7febb74a8631ee67
|
1860c5f308edf34e9a42ae69f0c10f992a64d21a
|
refs/heads/master
| 2018-12-03T22:55:21.621000 | 2018-11-16T06:07:18 | 2018-11-16T06:07:18 | 106,676,649 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jarvisdong.jdrobot.di.component;
import com.jarvisdong.jdrobot.app.MyApplication;
import com.jarvisdong.jdrobot.di.build.ActivityBuilder;
import com.jarvisdong.jdrobot.di.module.AppModule;
import javax.inject.Singleton;
import dagger.Component;
import dagger.android.AndroidInjectionModule;
/**
* Created by JarvisDong on 2018/10/31.
* OverView:
*/
@Singleton
@Component(modules = {AndroidInjectionModule.class,AppModule.class, ActivityBuilder.class})
public interface AppComponent {
void inject(MyApplication application);
// @Component.Builder
// interface Builder {
//
// @BindsInstance
// Builder application(Application application);
//
// AppComponent build();
// }
}
|
UTF-8
|
Java
| 728 |
java
|
AppComponent.java
|
Java
|
[
{
"context": "android.AndroidInjectionModule;\n\n/**\n * Created by JarvisDong on 2018/10/31.\n * OverView:\n */\n@Singleton\n@C",
"end": 331,
"score": 0.6592159271240234,
"start": 325,
"tag": "NAME",
"value": "Jarvis"
},
{
"context": ".AndroidInjectionModule;\n\n/**\n * Created by JarvisDong on 2018/10/31.\n * OverView:\n */\n@Singleton\n@Co",
"end": 332,
"score": 0.7237449884414673,
"start": 331,
"tag": "USERNAME",
"value": "D"
},
{
"context": "AndroidInjectionModule;\n\n/**\n * Created by JarvisDong on 2018/10/31.\n * OverView:\n */\n@Singleton\n@Compo",
"end": 335,
"score": 0.5841595530509949,
"start": 332,
"tag": "NAME",
"value": "ong"
}
] | null |
[] |
package com.jarvisdong.jdrobot.di.component;
import com.jarvisdong.jdrobot.app.MyApplication;
import com.jarvisdong.jdrobot.di.build.ActivityBuilder;
import com.jarvisdong.jdrobot.di.module.AppModule;
import javax.inject.Singleton;
import dagger.Component;
import dagger.android.AndroidInjectionModule;
/**
* Created by JarvisDong on 2018/10/31.
* OverView:
*/
@Singleton
@Component(modules = {AndroidInjectionModule.class,AppModule.class, ActivityBuilder.class})
public interface AppComponent {
void inject(MyApplication application);
// @Component.Builder
// interface Builder {
//
// @BindsInstance
// Builder application(Application application);
//
// AppComponent build();
// }
}
| 728 | 0.748626 | 0.737637 | 29 | 24.103449 | 22.828211 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.413793 | false | false |
12
|
75eb532af09f29f867a1141a88ef2da1561816f5
| 20,993,800,170,705 |
b5b4619dc245a65e7f77bec0a0dc91a7751e45a1
|
/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/Balloon/org/apache/jsp/WEB_002dINF/pages/Login_jsp.java
|
f89f45d1b2f33abed641f9e793b2006995574e9c
|
[] |
no_license
|
LsCodeMaster/TrainingExamples
|
https://github.com/LsCodeMaster/TrainingExamples
|
d3577a0c2694008850874da227f1b7444eb66d90
|
f5185af00ce15aa6165190c57e07b4fe82f06eb9
|
refs/heads/master
| 2021-01-10T17:01:15.044000 | 2015-10-14T12:08:01 | 2015-10-14T12:08:01 | 44,244,936 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.apache.jsp.WEB_002dINF.pages;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class Login_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.List _jspx_dependants;
static {
_jspx_dependants = new java.util.ArrayList(1);
_jspx_dependants.add("/WEB-INF/pages/header.jsp");
}
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005fform_0026_005fmethod_005fcssClass_005fcommandName_005faction;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005finput_0026_005fpath_005fnobody;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fcssClass_005fnobody;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fpath_005fnobody;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.AnnotationProcessor _jsp_annotationprocessor;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_005fjspx_005ftagPool_005fform_005fform_0026_005fmethod_005fcssClass_005fcommandName_005faction = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fform_005finput_0026_005fpath_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fcssClass_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fpath_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
}
public void _jspDestroy() {
_005fjspx_005ftagPool_005fform_005fform_0026_005fmethod_005fcssClass_005fcommandName_005faction.release();
_005fjspx_005ftagPool_005fform_005finput_0026_005fpath_005fnobody.release();
_005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fcssClass_005fnobody.release();
_005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fpath_005fnobody.release();
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=ISO-8859-1");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("<!DOCTYPE html>\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta charset=\"ISO-8859-1\">\r\n");
out.write("<title>Insert title here</title>\r\n");
out.write("<!-- <link rel=\"stylesheet\" type=\"text/css\" href=\"../../css/loginStyle.css\" /> -->\r\n");
out.write("<!-- Bootstrap Core CSS -->\r\n");
out.write("<link href=\"css/bootstrap.min.css\" rel=\"stylesheet\">\r\n");
out.write("\r\n");
out.write("<!-- Custom CSS -->\r\n");
out.write("<link href=\"css/shop-homepage.css\" rel=\"stylesheet\">\r\n");
out.write("\t<nav class=\"navbar navbar-inverse navbar-fixed-top\" role=\"navigation\">\r\n");
out.write(" <div class=\"container\">\r\n");
out.write(" \r\n");
out.write(" <div class=\"navbar-header\">\r\n");
out.write(" <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\"#bs-example-navbar-collapse-1\">\r\n");
out.write(" <span class=\"sr-only\">Toggle navigation</span>\r\n");
out.write(" <span class=\"icon-bar\"></span>\r\n");
out.write(" <span class=\"icon-bar\"></span>\r\n");
out.write(" <span class=\"icon-bar\"></span>\r\n");
out.write(" </button>\r\n");
out.write(" <a class=\"navbar-brand\" href=\"/Balloon/home\">Shopping Portal</a>\r\n");
out.write(" </div>\r\n");
out.write(" \r\n");
out.write(" <div class=\"collapse navbar-collapse\" id=\"bs-example-navbar-collapse-1\">\r\n");
out.write(" <ul class=\"nav navbar-nav\">\r\n");
out.write(" \r\n");
out.write(" <li style=\"float:right\">\r\n");
out.write(" <a href=\"/Balloon/cart\">");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${sessionScope.username}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("</a>\r\n");
out.write(" </li>\r\n");
out.write(" <li style=\"float:right\">\r\n");
out.write(" <a href=\"/Balloon/acnt\">My Account</a>\r\n");
out.write(" </li>\r\n");
out.write(" <li style=\"float:right\">\r\n");
out.write(" <a href=\"/Balloon/");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${sessionScope.login }", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write('"');
out.write('>');
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${sessionScope.login }", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("</a>\r\n");
out.write(" </li>\r\n");
out.write(" <li style=\"float:right\">\r\n");
out.write(" <a href=\"/Balloon/cart\">Checkout</a>\r\n");
out.write(" </li>\r\n");
out.write("\r\n");
out.write(" </ul>\r\n");
out.write(" </div>\r\n");
out.write(" \r\n");
out.write(" </div>\r\n");
out.write(" \r\n");
out.write(" </nav>");
out.write("\r\n");
out.write("<style type=\"text/css\">\r\n");
out.write(".errMsg {\r\n");
out.write("color : red;\r\n");
out.write("left: 30%;\r\n");
out.write("}\r\n");
out.write("\r\n");
out.write("</style>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("<h1 style=\"font-size:90px;text-align:center\"><a href=\"/Balloon/home\">BALLOONS!!!!</a></h1>\r\n");
out.write("<div id=\"login\">\r\n");
out.write("\t\t<h3>\r\n");
out.write("\t\t\t<strong>Welcome.</strong> Please login.\r\n");
out.write("\t\t</h3>\r\n");
out.write("\t\t");
// form:form
org.springframework.web.servlet.tags.form.FormTag _jspx_th_form_005fform_005f0 = (org.springframework.web.servlet.tags.form.FormTag) _005fjspx_005ftagPool_005fform_005fform_0026_005fmethod_005fcssClass_005fcommandName_005faction.get(org.springframework.web.servlet.tags.form.FormTag.class);
_jspx_th_form_005fform_005f0.setPageContext(_jspx_page_context);
_jspx_th_form_005fform_005f0.setParent(null);
// /WEB-INF/pages/Login.jsp(30,2) name = method type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005fform_005f0.setMethod("POST");
// /WEB-INF/pages/Login.jsp(30,2) name = commandName type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005fform_005f0.setCommandName("command");
// /WEB-INF/pages/Login.jsp(30,2) name = action type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005fform_005f0.setAction("/Balloon/log");
// /WEB-INF/pages/Login.jsp(30,2) name = cssClass type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005fform_005f0.setCssClass("abc");
int[] _jspx_push_body_count_form_005fform_005f0 = new int[] { 0 };
try {
int _jspx_eval_form_005fform_005f0 = _jspx_th_form_005fform_005f0.doStartTag();
if (_jspx_eval_form_005fform_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write("\t\t<table>\r\n");
out.write("\t\t\t<tr>\r\n");
out.write("\t\t\t\t<td colspan=\"5\">Customer Name :</td>\r\n");
out.write("\t\t\t\t<td>");
if (_jspx_meth_form_005finput_005f0(_jspx_th_form_005fform_005f0, _jspx_page_context, _jspx_push_body_count_form_005fform_005f0))
return;
out.write("</td>\r\n");
out.write("\t\t\t\t<td>");
// form:errors
org.springframework.web.servlet.tags.form.ErrorsTag _jspx_th_form_005ferrors_005f0 = (org.springframework.web.servlet.tags.form.ErrorsTag) _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fcssClass_005fnobody.get(org.springframework.web.servlet.tags.form.ErrorsTag.class);
_jspx_th_form_005ferrors_005f0.setPageContext(_jspx_page_context);
_jspx_th_form_005ferrors_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0);
// /WEB-INF/pages/Login.jsp(35,8) name = path type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005ferrors_005f0.setPath("username");
// /WEB-INF/pages/Login.jsp(35,8) name = cssClass type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005ferrors_005f0.setCssClass("errMsg");
int[] _jspx_push_body_count_form_005ferrors_005f0 = new int[] { 0 };
try {
int _jspx_eval_form_005ferrors_005f0 = _jspx_th_form_005ferrors_005f0.doStartTag();
if (_jspx_th_form_005ferrors_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return;
}
} catch (Throwable _jspx_exception) {
while (_jspx_push_body_count_form_005ferrors_005f0[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_form_005ferrors_005f0.doCatch(_jspx_exception);
} finally {
_jspx_th_form_005ferrors_005f0.doFinally();
_005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fcssClass_005fnobody.reuse(_jspx_th_form_005ferrors_005f0);
}
out.write("</td>\r\n");
out.write("\t\t\t</tr>\r\n");
out.write("\t\t\t<tr>\r\n");
out.write("\t\t\t\t<td colspan=\"5\">Password :</td>\r\n");
out.write("\t\t\t\t<td>");
if (_jspx_meth_form_005finput_005f1(_jspx_th_form_005fform_005f0, _jspx_page_context, _jspx_push_body_count_form_005fform_005f0))
return;
out.write("</td>\r\n");
out.write("\t\t\t\t<td>");
// form:errors
org.springframework.web.servlet.tags.form.ErrorsTag _jspx_th_form_005ferrors_005f1 = (org.springframework.web.servlet.tags.form.ErrorsTag) _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fcssClass_005fnobody.get(org.springframework.web.servlet.tags.form.ErrorsTag.class);
_jspx_th_form_005ferrors_005f1.setPageContext(_jspx_page_context);
_jspx_th_form_005ferrors_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0);
// /WEB-INF/pages/Login.jsp(40,8) name = path type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005ferrors_005f1.setPath("password");
// /WEB-INF/pages/Login.jsp(40,8) name = cssClass type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005ferrors_005f1.setCssClass("errMsg");
int[] _jspx_push_body_count_form_005ferrors_005f1 = new int[] { 0 };
try {
int _jspx_eval_form_005ferrors_005f1 = _jspx_th_form_005ferrors_005f1.doStartTag();
if (_jspx_th_form_005ferrors_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return;
}
} catch (Throwable _jspx_exception) {
while (_jspx_push_body_count_form_005ferrors_005f1[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_form_005ferrors_005f1.doCatch(_jspx_exception);
} finally {
_jspx_th_form_005ferrors_005f1.doFinally();
_005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fcssClass_005fnobody.reuse(_jspx_th_form_005ferrors_005f1);
}
out.write("</td>\r\n");
out.write("\t\t\t</tr>\r\n");
out.write("\t\t\t<tr>\r\n");
out.write("\t\t\t\t<td colspan=\"2\"><input type=\"submit\" value=\"Submit\" />\r\n");
out.write("\t\t\t</tr>\r\n");
out.write("\t\t</table>\r\n");
out.write("\t");
int evalDoAfterBody = _jspx_th_form_005fform_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_form_005fform_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return;
}
} catch (Throwable _jspx_exception) {
while (_jspx_push_body_count_form_005fform_005f0[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_form_005fform_005f0.doCatch(_jspx_exception);
} finally {
_jspx_th_form_005fform_005f0.doFinally();
_005fjspx_005ftagPool_005fform_005fform_0026_005fmethod_005fcssClass_005fcommandName_005faction.reuse(_jspx_th_form_005fform_005f0);
}
out.write("\r\n");
out.write("\t\t\r\n");
out.write("\t\t\r\n");
out.write("\t\r\n");
out.write("\t\t\r\n");
out.write("\t</div>\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else log(t.getMessage(), t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_form_005finput_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f0, PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f0)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// form:input
org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f0 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005fpath_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class);
_jspx_th_form_005finput_005f0.setPageContext(_jspx_page_context);
_jspx_th_form_005finput_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0);
// /WEB-INF/pages/Login.jsp(34,8) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005finput_005f0.setPath("username");
int[] _jspx_push_body_count_form_005finput_005f0 = new int[] { 0 };
try {
int _jspx_eval_form_005finput_005f0 = _jspx_th_form_005finput_005f0.doStartTag();
if (_jspx_th_form_005finput_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return true;
}
} catch (Throwable _jspx_exception) {
while (_jspx_push_body_count_form_005finput_005f0[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_form_005finput_005f0.doCatch(_jspx_exception);
} finally {
_jspx_th_form_005finput_005f0.doFinally();
_005fjspx_005ftagPool_005fform_005finput_0026_005fpath_005fnobody.reuse(_jspx_th_form_005finput_005f0);
}
return false;
}
private boolean _jspx_meth_form_005finput_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f0, PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f0)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// form:input
org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f1 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fpath_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class);
_jspx_th_form_005finput_005f1.setPageContext(_jspx_page_context);
_jspx_th_form_005finput_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0);
// /WEB-INF/pages/Login.jsp(39,8) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005finput_005f1.setPath("password");
// /WEB-INF/pages/Login.jsp(39,8) null
_jspx_th_form_005finput_005f1.setDynamicAttribute(null, "type", new String("password"));
int[] _jspx_push_body_count_form_005finput_005f1 = new int[] { 0 };
try {
int _jspx_eval_form_005finput_005f1 = _jspx_th_form_005finput_005f1.doStartTag();
if (_jspx_th_form_005finput_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return true;
}
} catch (Throwable _jspx_exception) {
while (_jspx_push_body_count_form_005finput_005f1[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_form_005finput_005f1.doCatch(_jspx_exception);
} finally {
_jspx_th_form_005finput_005f1.doFinally();
_005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fpath_005fnobody.reuse(_jspx_th_form_005finput_005f1);
}
return false;
}
}
|
UTF-8
|
Java
| 19,681 |
java
|
Login_jsp.java
|
Java
|
[
{
"context": "\n out.write(\"\\t\\t\\t\\t<td colspan=\\\"5\\\">Customer Name :</td>\\r\\n\");\n out.write(\"\\t\\t\\t\\t<td>",
"end": 9688,
"score": 0.9877563714981079,
"start": 9675,
"tag": "NAME",
"value": "Customer Name"
}
] | null |
[] |
package org.apache.jsp.WEB_002dINF.pages;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class Login_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();
private static java.util.List _jspx_dependants;
static {
_jspx_dependants = new java.util.ArrayList(1);
_jspx_dependants.add("/WEB-INF/pages/header.jsp");
}
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005fform_0026_005fmethod_005fcssClass_005fcommandName_005faction;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005finput_0026_005fpath_005fnobody;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fcssClass_005fnobody;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fpath_005fnobody;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.AnnotationProcessor _jsp_annotationprocessor;
public Object getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_005fjspx_005ftagPool_005fform_005fform_0026_005fmethod_005fcssClass_005fcommandName_005faction = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fform_005finput_0026_005fpath_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fcssClass_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fpath_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
}
public void _jspDestroy() {
_005fjspx_005ftagPool_005fform_005fform_0026_005fmethod_005fcssClass_005fcommandName_005faction.release();
_005fjspx_005ftagPool_005fform_005finput_0026_005fpath_005fnobody.release();
_005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fcssClass_005fnobody.release();
_005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fpath_005fnobody.release();
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=ISO-8859-1");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("<!DOCTYPE html>\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta charset=\"ISO-8859-1\">\r\n");
out.write("<title>Insert title here</title>\r\n");
out.write("<!-- <link rel=\"stylesheet\" type=\"text/css\" href=\"../../css/loginStyle.css\" /> -->\r\n");
out.write("<!-- Bootstrap Core CSS -->\r\n");
out.write("<link href=\"css/bootstrap.min.css\" rel=\"stylesheet\">\r\n");
out.write("\r\n");
out.write("<!-- Custom CSS -->\r\n");
out.write("<link href=\"css/shop-homepage.css\" rel=\"stylesheet\">\r\n");
out.write("\t<nav class=\"navbar navbar-inverse navbar-fixed-top\" role=\"navigation\">\r\n");
out.write(" <div class=\"container\">\r\n");
out.write(" \r\n");
out.write(" <div class=\"navbar-header\">\r\n");
out.write(" <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\"#bs-example-navbar-collapse-1\">\r\n");
out.write(" <span class=\"sr-only\">Toggle navigation</span>\r\n");
out.write(" <span class=\"icon-bar\"></span>\r\n");
out.write(" <span class=\"icon-bar\"></span>\r\n");
out.write(" <span class=\"icon-bar\"></span>\r\n");
out.write(" </button>\r\n");
out.write(" <a class=\"navbar-brand\" href=\"/Balloon/home\">Shopping Portal</a>\r\n");
out.write(" </div>\r\n");
out.write(" \r\n");
out.write(" <div class=\"collapse navbar-collapse\" id=\"bs-example-navbar-collapse-1\">\r\n");
out.write(" <ul class=\"nav navbar-nav\">\r\n");
out.write(" \r\n");
out.write(" <li style=\"float:right\">\r\n");
out.write(" <a href=\"/Balloon/cart\">");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${sessionScope.username}", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("</a>\r\n");
out.write(" </li>\r\n");
out.write(" <li style=\"float:right\">\r\n");
out.write(" <a href=\"/Balloon/acnt\">My Account</a>\r\n");
out.write(" </li>\r\n");
out.write(" <li style=\"float:right\">\r\n");
out.write(" <a href=\"/Balloon/");
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${sessionScope.login }", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write('"');
out.write('>');
out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${sessionScope.login }", java.lang.String.class, (PageContext)_jspx_page_context, null, false));
out.write("</a>\r\n");
out.write(" </li>\r\n");
out.write(" <li style=\"float:right\">\r\n");
out.write(" <a href=\"/Balloon/cart\">Checkout</a>\r\n");
out.write(" </li>\r\n");
out.write("\r\n");
out.write(" </ul>\r\n");
out.write(" </div>\r\n");
out.write(" \r\n");
out.write(" </div>\r\n");
out.write(" \r\n");
out.write(" </nav>");
out.write("\r\n");
out.write("<style type=\"text/css\">\r\n");
out.write(".errMsg {\r\n");
out.write("color : red;\r\n");
out.write("left: 30%;\r\n");
out.write("}\r\n");
out.write("\r\n");
out.write("</style>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("<h1 style=\"font-size:90px;text-align:center\"><a href=\"/Balloon/home\">BALLOONS!!!!</a></h1>\r\n");
out.write("<div id=\"login\">\r\n");
out.write("\t\t<h3>\r\n");
out.write("\t\t\t<strong>Welcome.</strong> Please login.\r\n");
out.write("\t\t</h3>\r\n");
out.write("\t\t");
// form:form
org.springframework.web.servlet.tags.form.FormTag _jspx_th_form_005fform_005f0 = (org.springframework.web.servlet.tags.form.FormTag) _005fjspx_005ftagPool_005fform_005fform_0026_005fmethod_005fcssClass_005fcommandName_005faction.get(org.springframework.web.servlet.tags.form.FormTag.class);
_jspx_th_form_005fform_005f0.setPageContext(_jspx_page_context);
_jspx_th_form_005fform_005f0.setParent(null);
// /WEB-INF/pages/Login.jsp(30,2) name = method type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005fform_005f0.setMethod("POST");
// /WEB-INF/pages/Login.jsp(30,2) name = commandName type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005fform_005f0.setCommandName("command");
// /WEB-INF/pages/Login.jsp(30,2) name = action type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005fform_005f0.setAction("/Balloon/log");
// /WEB-INF/pages/Login.jsp(30,2) name = cssClass type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005fform_005f0.setCssClass("abc");
int[] _jspx_push_body_count_form_005fform_005f0 = new int[] { 0 };
try {
int _jspx_eval_form_005fform_005f0 = _jspx_th_form_005fform_005f0.doStartTag();
if (_jspx_eval_form_005fform_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\r\n");
out.write("\t\t<table>\r\n");
out.write("\t\t\t<tr>\r\n");
out.write("\t\t\t\t<td colspan=\"5\"><NAME> :</td>\r\n");
out.write("\t\t\t\t<td>");
if (_jspx_meth_form_005finput_005f0(_jspx_th_form_005fform_005f0, _jspx_page_context, _jspx_push_body_count_form_005fform_005f0))
return;
out.write("</td>\r\n");
out.write("\t\t\t\t<td>");
// form:errors
org.springframework.web.servlet.tags.form.ErrorsTag _jspx_th_form_005ferrors_005f0 = (org.springframework.web.servlet.tags.form.ErrorsTag) _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fcssClass_005fnobody.get(org.springframework.web.servlet.tags.form.ErrorsTag.class);
_jspx_th_form_005ferrors_005f0.setPageContext(_jspx_page_context);
_jspx_th_form_005ferrors_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0);
// /WEB-INF/pages/Login.jsp(35,8) name = path type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005ferrors_005f0.setPath("username");
// /WEB-INF/pages/Login.jsp(35,8) name = cssClass type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005ferrors_005f0.setCssClass("errMsg");
int[] _jspx_push_body_count_form_005ferrors_005f0 = new int[] { 0 };
try {
int _jspx_eval_form_005ferrors_005f0 = _jspx_th_form_005ferrors_005f0.doStartTag();
if (_jspx_th_form_005ferrors_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return;
}
} catch (Throwable _jspx_exception) {
while (_jspx_push_body_count_form_005ferrors_005f0[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_form_005ferrors_005f0.doCatch(_jspx_exception);
} finally {
_jspx_th_form_005ferrors_005f0.doFinally();
_005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fcssClass_005fnobody.reuse(_jspx_th_form_005ferrors_005f0);
}
out.write("</td>\r\n");
out.write("\t\t\t</tr>\r\n");
out.write("\t\t\t<tr>\r\n");
out.write("\t\t\t\t<td colspan=\"5\">Password :</td>\r\n");
out.write("\t\t\t\t<td>");
if (_jspx_meth_form_005finput_005f1(_jspx_th_form_005fform_005f0, _jspx_page_context, _jspx_push_body_count_form_005fform_005f0))
return;
out.write("</td>\r\n");
out.write("\t\t\t\t<td>");
// form:errors
org.springframework.web.servlet.tags.form.ErrorsTag _jspx_th_form_005ferrors_005f1 = (org.springframework.web.servlet.tags.form.ErrorsTag) _005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fcssClass_005fnobody.get(org.springframework.web.servlet.tags.form.ErrorsTag.class);
_jspx_th_form_005ferrors_005f1.setPageContext(_jspx_page_context);
_jspx_th_form_005ferrors_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0);
// /WEB-INF/pages/Login.jsp(40,8) name = path type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005ferrors_005f1.setPath("password");
// /WEB-INF/pages/Login.jsp(40,8) name = cssClass type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005ferrors_005f1.setCssClass("errMsg");
int[] _jspx_push_body_count_form_005ferrors_005f1 = new int[] { 0 };
try {
int _jspx_eval_form_005ferrors_005f1 = _jspx_th_form_005ferrors_005f1.doStartTag();
if (_jspx_th_form_005ferrors_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return;
}
} catch (Throwable _jspx_exception) {
while (_jspx_push_body_count_form_005ferrors_005f1[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_form_005ferrors_005f1.doCatch(_jspx_exception);
} finally {
_jspx_th_form_005ferrors_005f1.doFinally();
_005fjspx_005ftagPool_005fform_005ferrors_0026_005fpath_005fcssClass_005fnobody.reuse(_jspx_th_form_005ferrors_005f1);
}
out.write("</td>\r\n");
out.write("\t\t\t</tr>\r\n");
out.write("\t\t\t<tr>\r\n");
out.write("\t\t\t\t<td colspan=\"2\"><input type=\"submit\" value=\"Submit\" />\r\n");
out.write("\t\t\t</tr>\r\n");
out.write("\t\t</table>\r\n");
out.write("\t");
int evalDoAfterBody = _jspx_th_form_005fform_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_form_005fform_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return;
}
} catch (Throwable _jspx_exception) {
while (_jspx_push_body_count_form_005fform_005f0[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_form_005fform_005f0.doCatch(_jspx_exception);
} finally {
_jspx_th_form_005fform_005f0.doFinally();
_005fjspx_005ftagPool_005fform_005fform_0026_005fmethod_005fcssClass_005fcommandName_005faction.reuse(_jspx_th_form_005fform_005f0);
}
out.write("\r\n");
out.write("\t\t\r\n");
out.write("\t\t\r\n");
out.write("\t\r\n");
out.write("\t\t\r\n");
out.write("\t</div>\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try { out.clearBuffer(); } catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else log(t.getMessage(), t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_form_005finput_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f0, PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f0)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// form:input
org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f0 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005fpath_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class);
_jspx_th_form_005finput_005f0.setPageContext(_jspx_page_context);
_jspx_th_form_005finput_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0);
// /WEB-INF/pages/Login.jsp(34,8) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005finput_005f0.setPath("username");
int[] _jspx_push_body_count_form_005finput_005f0 = new int[] { 0 };
try {
int _jspx_eval_form_005finput_005f0 = _jspx_th_form_005finput_005f0.doStartTag();
if (_jspx_th_form_005finput_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return true;
}
} catch (Throwable _jspx_exception) {
while (_jspx_push_body_count_form_005finput_005f0[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_form_005finput_005f0.doCatch(_jspx_exception);
} finally {
_jspx_th_form_005finput_005f0.doFinally();
_005fjspx_005ftagPool_005fform_005finput_0026_005fpath_005fnobody.reuse(_jspx_th_form_005finput_005f0);
}
return false;
}
private boolean _jspx_meth_form_005finput_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f0, PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f0)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// form:input
org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f1 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fpath_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class);
_jspx_th_form_005finput_005f1.setPageContext(_jspx_page_context);
_jspx_th_form_005finput_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0);
// /WEB-INF/pages/Login.jsp(39,8) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_form_005finput_005f1.setPath("password");
// /WEB-INF/pages/Login.jsp(39,8) null
_jspx_th_form_005finput_005f1.setDynamicAttribute(null, "type", new String("password"));
int[] _jspx_push_body_count_form_005finput_005f1 = new int[] { 0 };
try {
int _jspx_eval_form_005finput_005f1 = _jspx_th_form_005finput_005f1.doStartTag();
if (_jspx_th_form_005finput_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
return true;
}
} catch (Throwable _jspx_exception) {
while (_jspx_push_body_count_form_005finput_005f1[0]-- > 0)
out = _jspx_page_context.popBody();
_jspx_th_form_005finput_005f1.doCatch(_jspx_exception);
} finally {
_jspx_th_form_005finput_005f1.doFinally();
_005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fpath_005fnobody.reuse(_jspx_th_form_005finput_005f1);
}
return false;
}
}
| 19,674 | 0.638839 | 0.576952 | 320 | 60.503124 | 55.735424 | 296 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.834375 | false | false |
12
|
053e4dcc76d1f3f595180bd5db49ac7eedb798aa
| 31,396,210,983,055 |
7630c0381fb071fad5f47ab4c5379c5f8ca8de07
|
/src/main/java/com/mastek/edp/trigger/audit/WebServiceAuditLog.java
|
88d4dd0471b6198a932fd38698133f1f69821934
|
[] |
no_license
|
sanmegh/kameleon-trigger
|
https://github.com/sanmegh/kameleon-trigger
|
9f135a6f1e5d4846913e10dfff956b96f692b896
|
fa9cbe25c1a851a13cdd7f585c3c3c24fcb3904d
|
refs/heads/master
| 2018-01-10T23:45:23.266000 | 2016-01-20T07:54:24 | 2016-01-20T07:54:24 | 50,008,511 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mastek.edp.trigger.audit;
import java.io.Serializable;
import java.util.Calendar;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import com.mastek.edp.trigger.schedule.controller.ScheduleControllerUtil.IdType;
@Entity
@Table(name = "KAM_WS_AUDIT_LOG")
public class WebServiceAuditLog implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private Integer id;
private String username;
@Temporal(TemporalType.TIMESTAMP)
private Calendar triggerTime;
private Integer triggerId;
private IdType triggerIdType;
@Temporal(TemporalType.TIMESTAMP)
private Calendar processStartTime;
private String searchQuery;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Calendar getTriggerTime() {
return triggerTime;
}
public void setTriggerTime(Calendar triggerTime) {
this.triggerTime = triggerTime;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getTriggerId() {
return triggerId;
}
public void setTriggerId(Integer triggerId) {
this.triggerId = triggerId;
}
public IdType getTriggerIdType() {
return triggerIdType;
}
public void setTriggerIdType(IdType triggerIdType) {
this.triggerIdType = triggerIdType;
}
public Calendar getProcessStartTime() {
return processStartTime;
}
public void setProcessStartTime(Calendar processStartTime) {
this.processStartTime = processStartTime;
}
public String getSearchQuery() {
return searchQuery;
}
public void setSearchQuery(String searchQuery) {
this.searchQuery = searchQuery;
}
@Override
public String toString() {
return "WebServiceAuditLog [id=" + id + ", username=" + username + ", triggerTime=" + triggerTime + ", triggerId=" + triggerId + ", triggerIdType=" + triggerIdType + ", processStartTime=" + processStartTime + ", searchQuery=" + searchQuery + "]";
}
}
|
UTF-8
|
Java
| 2,076 |
java
|
WebServiceAuditLog.java
|
Java
|
[
{
"context": "d setUsername(String username) {\n\t\tthis.username = username;\n\t}\n\n\tpublic Calendar getTriggerTime() {\n\t\treturn",
"end": 900,
"score": 0.815772533416748,
"start": 892,
"tag": "USERNAME",
"value": "username"
},
{
"context": "n \"WebServiceAuditLog [id=\" + id + \", username=\" + username + \", triggerTime=\" + triggerTime + \", triggerId=\"",
"end": 1887,
"score": 0.9983428716659546,
"start": 1879,
"tag": "USERNAME",
"value": "username"
}
] | null |
[] |
package com.mastek.edp.trigger.audit;
import java.io.Serializable;
import java.util.Calendar;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import com.mastek.edp.trigger.schedule.controller.ScheduleControllerUtil.IdType;
@Entity
@Table(name = "KAM_WS_AUDIT_LOG")
public class WebServiceAuditLog implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private Integer id;
private String username;
@Temporal(TemporalType.TIMESTAMP)
private Calendar triggerTime;
private Integer triggerId;
private IdType triggerIdType;
@Temporal(TemporalType.TIMESTAMP)
private Calendar processStartTime;
private String searchQuery;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public Calendar getTriggerTime() {
return triggerTime;
}
public void setTriggerTime(Calendar triggerTime) {
this.triggerTime = triggerTime;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getTriggerId() {
return triggerId;
}
public void setTriggerId(Integer triggerId) {
this.triggerId = triggerId;
}
public IdType getTriggerIdType() {
return triggerIdType;
}
public void setTriggerIdType(IdType triggerIdType) {
this.triggerIdType = triggerIdType;
}
public Calendar getProcessStartTime() {
return processStartTime;
}
public void setProcessStartTime(Calendar processStartTime) {
this.processStartTime = processStartTime;
}
public String getSearchQuery() {
return searchQuery;
}
public void setSearchQuery(String searchQuery) {
this.searchQuery = searchQuery;
}
@Override
public String toString() {
return "WebServiceAuditLog [id=" + id + ", username=" + username + ", triggerTime=" + triggerTime + ", triggerId=" + triggerId + ", triggerIdType=" + triggerIdType + ", processStartTime=" + processStartTime + ", searchQuery=" + searchQuery + "]";
}
}
| 2,076 | 0.75578 | 0.755299 | 91 | 21.813187 | 30.143946 | 248 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.208791 | false | false |
12
|
62e20b1dac20ff367b23ccd2e784c2db769289c5
| 34,127,810,178,926 |
2bc4163cd39f8095e54363da2a8dd931b52d6f3f
|
/src/com/vp/game/trajectories/CirclesegLineTrajectory.java
|
4c39069b57e50718f055d05d6344a6f91f6efb31
|
[] |
no_license
|
KarlKulator/Slidegame
|
https://github.com/KarlKulator/Slidegame
|
59eebf77158e43d40e0278223ea3ce9f5bc9f3bf
|
7890d0343c3de729b1d41edfdf3a067ae73b0dec
|
refs/heads/master
| 2021-01-20T12:12:41.319000 | 2015-02-16T18:16:49 | 2015-02-16T18:16:49 | 27,669,727 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.vp.game.trajectories;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.vp.game.units.Unit;
public class CirclesegLineTrajectory extends Trajectory {
//Radius of the circle segment
private float radius;
//The Vector pointing form the middle of the circle segment to the position on the circle before the update
private Vector2 vecOnCircleOld = new Vector2();
//The Vector pointing form the middle of the circle segment to the position on the circle after the update
private Vector2 vecOnCircleNew = new Vector2();
//For clockwise circling (in the camera view of this game) its set to 1 else -1
public int clockwise;
//Vector pointing in the direction of the line
private Vector2 lineVector = new Vector2();
//Is true if the current position is already on the line
public boolean onLine;
public CirclesegLineTrajectory(Unit unit){
super(unit);
}
//Set trajectory without circle segment
public void setTrajectory(float lineVectorX, float lineVectorZ){
this.lineVector.set(lineVectorX, lineVectorZ);
lineVector.nor();
unit.direction.x = lineVector.x;
unit.direction.y = lineVector.y;
onLine = true;
}
//Set trajectory with circle segment
public void setTrajectory(Vector2 center, float radius, boolean clockwise, Vector2 lineVector){
if(radius == 0){
setTrajectory(lineVector.x, lineVector.y);
}else{
this.clockwise=clockwise?1:-1;
this.lineVector.set(lineVector.x, lineVector.y);
this.vecOnCircleOld.set(unit.position.x-center.x, unit.position.y - center.y);
this.vecOnCircleNew.set(vecOnCircleOld);
this.radius = radius;
onLine = false;
}
}
//Set trajectory with circle segment
public void setTrajectory(Vector2 center, float radius, boolean clockwise, float lineVectorX, float lineVectorZ){
if(radius == 0){
setTrajectory(lineVectorX, lineVectorZ);
}else{
this.clockwise=clockwise?1:-1;
this.lineVector.set(lineVectorX, lineVectorZ);
this.vecOnCircleOld.set(unit.position.x-center.x, unit.position.y - center.y);
this.vecOnCircleNew.set(vecOnCircleOld);
this.radius = radius;
onLine = false;
}
}
//Set trajectory with circle segment
public void setTrajectory(float centerX, float centerZ, float radius, boolean clockwise, float lineVectorX, float lineVectorZ){
if(radius == 0){
setTrajectory(lineVectorX, lineVectorZ);
}else{
this.clockwise=clockwise?1:-1;
this.lineVector.set(lineVectorX, lineVectorZ);
this.vecOnCircleOld.set(unit.position.x-centerX, unit.position.y - centerZ);
this.vecOnCircleNew.set(vecOnCircleOld);
this.radius = radius;
onLine = false;
}
}
@Override
public void update(float delta) {
if(onLine){
//Move on line
unit.position.add(unit.direction.x*delta*unit.speed, unit.direction.y*delta*unit.speed);
}else{
//Move on circle
//Save vecOnCircleNew
vecOnCircleOld.set(vecOnCircleNew);
//Rotate the vector depending on the speed, radius, delta and rotation direction
float rotationAngle = delta*clockwise*unit.speed/radius;
vecOnCircleNew.rotateRad(rotationAngle);
//Rotate direction vector of the unit
unit.direction.rotateRad(rotationAngle);
//Move unit by difference of New and Old (setting it to the new position on the circle)
unit.position.add(vecOnCircleNew.x-vecOnCircleOld.x, vecOnCircleNew.y-vecOnCircleOld.y);
//Check if lineVector is already reached
float lr = (lineVector.y*unit.direction.x-lineVector.x*unit.direction.y)* clockwise;
if(lr< 0){
//We will be on the line in the next update
lineVector.nor();
unit.direction.x = lineVector.x;
unit.direction.y = lineVector.y;
onLine=true;
}
}
}
}
|
UTF-8
|
Java
| 3,690 |
java
|
CirclesegLineTrajectory.java
|
Java
|
[] | null |
[] |
package com.vp.game.trajectories;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.vp.game.units.Unit;
public class CirclesegLineTrajectory extends Trajectory {
//Radius of the circle segment
private float radius;
//The Vector pointing form the middle of the circle segment to the position on the circle before the update
private Vector2 vecOnCircleOld = new Vector2();
//The Vector pointing form the middle of the circle segment to the position on the circle after the update
private Vector2 vecOnCircleNew = new Vector2();
//For clockwise circling (in the camera view of this game) its set to 1 else -1
public int clockwise;
//Vector pointing in the direction of the line
private Vector2 lineVector = new Vector2();
//Is true if the current position is already on the line
public boolean onLine;
public CirclesegLineTrajectory(Unit unit){
super(unit);
}
//Set trajectory without circle segment
public void setTrajectory(float lineVectorX, float lineVectorZ){
this.lineVector.set(lineVectorX, lineVectorZ);
lineVector.nor();
unit.direction.x = lineVector.x;
unit.direction.y = lineVector.y;
onLine = true;
}
//Set trajectory with circle segment
public void setTrajectory(Vector2 center, float radius, boolean clockwise, Vector2 lineVector){
if(radius == 0){
setTrajectory(lineVector.x, lineVector.y);
}else{
this.clockwise=clockwise?1:-1;
this.lineVector.set(lineVector.x, lineVector.y);
this.vecOnCircleOld.set(unit.position.x-center.x, unit.position.y - center.y);
this.vecOnCircleNew.set(vecOnCircleOld);
this.radius = radius;
onLine = false;
}
}
//Set trajectory with circle segment
public void setTrajectory(Vector2 center, float radius, boolean clockwise, float lineVectorX, float lineVectorZ){
if(radius == 0){
setTrajectory(lineVectorX, lineVectorZ);
}else{
this.clockwise=clockwise?1:-1;
this.lineVector.set(lineVectorX, lineVectorZ);
this.vecOnCircleOld.set(unit.position.x-center.x, unit.position.y - center.y);
this.vecOnCircleNew.set(vecOnCircleOld);
this.radius = radius;
onLine = false;
}
}
//Set trajectory with circle segment
public void setTrajectory(float centerX, float centerZ, float radius, boolean clockwise, float lineVectorX, float lineVectorZ){
if(radius == 0){
setTrajectory(lineVectorX, lineVectorZ);
}else{
this.clockwise=clockwise?1:-1;
this.lineVector.set(lineVectorX, lineVectorZ);
this.vecOnCircleOld.set(unit.position.x-centerX, unit.position.y - centerZ);
this.vecOnCircleNew.set(vecOnCircleOld);
this.radius = radius;
onLine = false;
}
}
@Override
public void update(float delta) {
if(onLine){
//Move on line
unit.position.add(unit.direction.x*delta*unit.speed, unit.direction.y*delta*unit.speed);
}else{
//Move on circle
//Save vecOnCircleNew
vecOnCircleOld.set(vecOnCircleNew);
//Rotate the vector depending on the speed, radius, delta and rotation direction
float rotationAngle = delta*clockwise*unit.speed/radius;
vecOnCircleNew.rotateRad(rotationAngle);
//Rotate direction vector of the unit
unit.direction.rotateRad(rotationAngle);
//Move unit by difference of New and Old (setting it to the new position on the circle)
unit.position.add(vecOnCircleNew.x-vecOnCircleOld.x, vecOnCircleNew.y-vecOnCircleOld.y);
//Check if lineVector is already reached
float lr = (lineVector.y*unit.direction.x-lineVector.x*unit.direction.y)* clockwise;
if(lr< 0){
//We will be on the line in the next update
lineVector.nor();
unit.direction.x = lineVector.x;
unit.direction.y = lineVector.y;
onLine=true;
}
}
}
}
| 3,690 | 0.742005 | 0.735772 | 102 | 35.176472 | 29.169689 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.754902 | false | false |
12
|
c422e3cc2a53f193a2167d3db7a4308ee373ca84
| 35,132,832,523,516 |
fea4da2f8459f1d991bf432b86a64bc1c7d1febe
|
/thread-example/src/main/java/com/example/practice/CountDownLatchDemo.java
|
26f6c7ae6d8bf16d750b1317726406d61e4f21be
|
[] |
no_license
|
xionglinpeng/example
|
https://github.com/xionglinpeng/example
|
2007c5bd0db34ad27084a5696de9cf3fc0e9b89a
|
08797230c799071e748ca3b5f41b979b6cc751b3
|
refs/heads/master
| 2021-06-28T12:12:10.119000 | 2019-04-04T08:09:41 | 2019-04-04T08:09:41 | 133,789,087 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.practice;
import java.util.concurrent.CountDownLatch;
import java.util.stream.Stream;
public class CountDownLatchDemo {
public static void main(String[] args) {
CountDownLatch downLatch = new CountDownLatch(3);
Stream.generate(()->new Thread(()->{
System.out.printf("子任务:%s\n",Thread.currentThread().getName());
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
downLatch.countDown();
})).limit(3).forEach(Thread::start);
try {
System.out.println("主任务开始执行...");
System.out.println("等待子任务执行完毕...");
downLatch.await();
System.out.println("子任务执行完毕...");
System.out.printf("开始执行后续主任务...");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 1,005 |
java
|
CountDownLatchDemo.java
|
Java
|
[] | null |
[] |
package com.example.practice;
import java.util.concurrent.CountDownLatch;
import java.util.stream.Stream;
public class CountDownLatchDemo {
public static void main(String[] args) {
CountDownLatch downLatch = new CountDownLatch(3);
Stream.generate(()->new Thread(()->{
System.out.printf("子任务:%s\n",Thread.currentThread().getName());
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
downLatch.countDown();
})).limit(3).forEach(Thread::start);
try {
System.out.println("主任务开始执行...");
System.out.println("等待子任务执行完毕...");
downLatch.await();
System.out.println("子任务执行完毕...");
System.out.printf("开始执行后续主任务...");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
| 1,005 | 0.550911 | 0.54448 | 37 | 24.216217 | 20.998243 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.432432 | false | false |
12
|
6182845bd5b0df05fa3e031180b87851830129b1
| 37,340,445,693,078 |
51fb23a75d45965685735961809165f60f32c7f6
|
/code-generator-maven-plugin/src/main/java/com/wolfjc/code/generator/config/GlobalConfig.java
|
014d9f646dae646bc262c97e9472d18e744957ce
|
[] |
no_license
|
WolfJC/code
|
https://github.com/WolfJC/code
|
612b3908d1167d6890c6336e09976a76ec4ab292
|
57f5d47985a45a949bbb75b53bbbad16394165f3
|
refs/heads/master
| 2020-03-22T17:47:18.070000 | 2018-08-28T06:39:10 | 2018-08-28T06:39:10 | 140,415,769 | 0 | 1 | null | false | 2018-08-28T06:39:11 | 2018-07-10T10:27:25 | 2018-08-24T10:21:02 | 2018-08-28T06:39:11 | 73 | 0 | 1 | 0 |
Java
| false | null |
package com.wolfjc.code.generator.config;
/**
* 全局配置
* <p>
* 该实体用来保存从外部获取数据库的配置以及代码生成规则
*
* @author xdd
* @date 2018/7/11.
*/
public class GlobalConfig {
/**
* 数据源配置
*/
private DataSourceConfig dataSourceConfig;
/**
* 代码生成选项
*/
private CodeGeneratorOption codeGeneratorOption;
/**
* 模板文件配置
*/
private TemplateConfig templateConfig;
private GlobalConfig() {
}
private static class GlobalConfigHolder {
private static final GlobalConfig globalConfig = new GlobalConfig();
}
public static GlobalConfig newInstance() {
return GlobalConfigHolder.globalConfig;
}
public DataSourceConfig getDataSourceConfig() {
return dataSourceConfig;
}
public void setDataSourceConfig(DataSourceConfig dataSourceConfig) {
this.dataSourceConfig = dataSourceConfig;
}
public CodeGeneratorOption getCodeGeneratorOption() {
return codeGeneratorOption;
}
public void setCodeGeneratorOption(CodeGeneratorOption codeGeneratorOption) {
this.codeGeneratorOption = codeGeneratorOption;
}
public TemplateConfig getTemplateConfig() {
return templateConfig;
}
public void setTemplateConfig(TemplateConfig templateConfig) {
this.templateConfig = templateConfig;
}
}
|
UTF-8
|
Java
| 1,437 |
java
|
GlobalConfig.java
|
Java
|
[
{
"context": " * <p>\n * 该实体用来保存从外部获取数据库的配置以及代码生成规则\n *\n * @author xdd\n * @date 2018/7/11.\n */\npublic class GlobalConfig",
"end": 110,
"score": 0.9996685981750488,
"start": 107,
"tag": "USERNAME",
"value": "xdd"
}
] | null |
[] |
package com.wolfjc.code.generator.config;
/**
* 全局配置
* <p>
* 该实体用来保存从外部获取数据库的配置以及代码生成规则
*
* @author xdd
* @date 2018/7/11.
*/
public class GlobalConfig {
/**
* 数据源配置
*/
private DataSourceConfig dataSourceConfig;
/**
* 代码生成选项
*/
private CodeGeneratorOption codeGeneratorOption;
/**
* 模板文件配置
*/
private TemplateConfig templateConfig;
private GlobalConfig() {
}
private static class GlobalConfigHolder {
private static final GlobalConfig globalConfig = new GlobalConfig();
}
public static GlobalConfig newInstance() {
return GlobalConfigHolder.globalConfig;
}
public DataSourceConfig getDataSourceConfig() {
return dataSourceConfig;
}
public void setDataSourceConfig(DataSourceConfig dataSourceConfig) {
this.dataSourceConfig = dataSourceConfig;
}
public CodeGeneratorOption getCodeGeneratorOption() {
return codeGeneratorOption;
}
public void setCodeGeneratorOption(CodeGeneratorOption codeGeneratorOption) {
this.codeGeneratorOption = codeGeneratorOption;
}
public TemplateConfig getTemplateConfig() {
return templateConfig;
}
public void setTemplateConfig(TemplateConfig templateConfig) {
this.templateConfig = templateConfig;
}
}
| 1,437 | 0.682055 | 0.676843 | 64 | 19.984375 | 22.916624 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.1875 | false | false |
12
|
784ff863ec1248b92c3bb1daa9f8ea74aa52d2ae
| 37,950,331,039,458 |
96e979ae4ea0497622f56c2c3f671abb081e9d46
|
/tests/jsr334/twr/exception_03f/Test.java
|
b9dae9555e8613d8a9355ad9fccdfdbdecfb7803
|
[
"BSD-3-Clause"
] |
permissive
|
ExtendJ/Regression-Tests
|
https://github.com/ExtendJ/Regression-Tests
|
a8e588c452bea830a838514cc307e54c2abd3a4f
|
2cae0e2f444a78857980224f9c216edb6a29ece2
|
refs/heads/master
| 2021-05-04T01:09:08.662000 | 2018-12-21T09:56:26 | 2018-12-21T09:56:57 | 71,147,163 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// Resource initialization exception must be caught or declared to be thrown.
// .result=COMPILE_FAIL
class Test {
class ResourceInitializationException extends Exception {}
class NonInitializableResource implements AutoCloseable {
public NonInitializableResource() throws ResourceInitializationException {
throw new ResourceInitializationException();
}
public void close() {}
}
public void fail() {
try (NonInitializableResource r = new NonInitializableResource()) {
}
}
}
|
UTF-8
|
Java
| 513 |
java
|
Test.java
|
Java
|
[] | null |
[] |
// Resource initialization exception must be caught or declared to be thrown.
// .result=COMPILE_FAIL
class Test {
class ResourceInitializationException extends Exception {}
class NonInitializableResource implements AutoCloseable {
public NonInitializableResource() throws ResourceInitializationException {
throw new ResourceInitializationException();
}
public void close() {}
}
public void fail() {
try (NonInitializableResource r = new NonInitializableResource()) {
}
}
}
| 513 | 0.746589 | 0.746589 | 18 | 27.5 | 28.794771 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.055556 | false | false |
12
|
539fbe851efd499e606a2268bafe3f07619c95f1
| 28,999,619,251,762 |
32a60eee88ba5ce2f6420084b654586790924129
|
/src/com/homwork/testDao.java
|
2d6cd11ea3aa4cbbe8b376ac8e4650649398e38e
|
[] |
no_license
|
cbbsir/homework
|
https://github.com/cbbsir/homework
|
a87bd50b140ad25b9ee4e85ec090b86863381957
|
93a6f0a4a4e0703ecb11cc8f8b124c478cca4047
|
refs/heads/master
| 2023-02-10T03:17:25.969000 | 2021-01-13T15:28:12 | 2021-01-13T15:28:12 | 329,350,170 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.homwork;
import com.dao.GoodsDao;
import com.dao.GoodsDaoImpl;
import com.domain.Goods;
import java.util.ArrayList;
import java.util.List;
public class testDao {
public static void main(String[] args) {
GoodsDao goodsDao = new GoodsDaoImpl();
//测试新增
int res = goodsDao.add(new Goods(4,"欧兰亚",29.9));
int res1 = goodsDao.add(new Goods(5,"欧皇",9999));
//测试查询
List<Goods> list = goodsDao.list();
for (Goods good:list){
System.out.println(good);
}
}
}
|
UTF-8
|
Java
| 575 |
java
|
testDao.java
|
Java
|
[] | null |
[] |
package com.homwork;
import com.dao.GoodsDao;
import com.dao.GoodsDaoImpl;
import com.domain.Goods;
import java.util.ArrayList;
import java.util.List;
public class testDao {
public static void main(String[] args) {
GoodsDao goodsDao = new GoodsDaoImpl();
//测试新增
int res = goodsDao.add(new Goods(4,"欧兰亚",29.9));
int res1 = goodsDao.add(new Goods(5,"欧皇",9999));
//测试查询
List<Goods> list = goodsDao.list();
for (Goods good:list){
System.out.println(good);
}
}
}
| 575 | 0.6102 | 0.591985 | 26 | 20.115385 | 18.130568 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.576923 | false | false |
12
|
e147a2d307dfb3404f5ba0c5445caf7451ce19ca
| 37,331,855,762,408 |
084f2aaba4329a2b1636aa7bdc614bf741fc075a
|
/app/src/main/java/com/android/adapter/OpenDoorLimitAdapter.java
|
a8ef92db8196770c59f7813d95209b44ae024ad7
|
[] |
no_license
|
junqinliu/QrCode
|
https://github.com/junqinliu/QrCode
|
59145eabfc5f016b2a08956bdccaa10cf3a5d60d
|
7d15fe12f58ba2eb8313c97ebda4d5d318566648
|
refs/heads/master
| 2020-04-06T07:13:20.634000 | 2016-09-02T13:51:58 | 2016-09-02T13:51:58 | 62,142,393 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.android.adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.TextView;
import com.android.mylibrary.model.OpenDoorLimit;
import com.android.qrcode.R;
import com.android.utils.OnAddDeleteListener;
import java.util.HashMap;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
/**
* Created by liujunqin on 2016/5/12.
*/
public class OpenDoorLimitAdapter extends BaseAdapter {
Context context;
List<OpenDoorLimit> list;
private static HashMap<Integer, Boolean> isSelectedMap = new HashMap<Integer, Boolean>();
OnAddDeleteListener onAddDeleteListener;
public OpenDoorLimitAdapter(Context context, List<OpenDoorLimit> list,OnAddDeleteListener onAddDeleteListener) {
this.context = context;
this.list = list;
this.onAddDeleteListener = onAddDeleteListener;
for (int i = 0; i < list.size(); i++) {
getIsSelected().put(i, false);
}
}
// 初始化isSelected的数据
public void initDate() {
for (int i = 0; i < list.size(); i++) {
if(list.get(i).isOpen()){
getIsSelected().put(i, true);
}else{
getIsSelected().put(i, false);
}
}
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int i) {
return list.get(i);
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public View getView(int i, View convertView, ViewGroup viewGroup) {
ViewHolder holder;
if (convertView == null) {
convertView = View.inflate(context, R.layout.item_open_door, null);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.open_door_desc.setText(list.get(i).getBuildname());
final int tempPosition = i;
holder.toggle_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (((CheckBox) v).isChecked()) {
getIsSelected().put(tempPosition, true);
onAddDeleteListener.onAdd(list.get(tempPosition).getBuildid());
// notifyDataSetChanged();
} else {
getIsSelected().put(tempPosition, false);
onAddDeleteListener.onDelete(list.get(tempPosition).getBuildid());
//notifyDataSetChanged();
}
}
});
holder.toggle_btn.setChecked(getIsSelected().get(i));
return convertView;
}
class ViewHolder {
@Bind(R.id.open_door_desc)
TextView open_door_desc;
@Bind(R.id.toggle_btn)
CheckBox toggle_btn;
ViewHolder(View view) {
ButterKnife.bind(this, view);
}
}
public HashMap<Integer, Boolean> getIsSelected() {
return isSelectedMap;
}
public void setIsSelected(HashMap<Integer, Boolean> isSelected) {
isSelectedMap = isSelected;
}
}
|
UTF-8
|
Java
| 3,320 |
java
|
OpenDoorLimitAdapter.java
|
Java
|
[
{
"context": "import butterknife.ButterKnife;\n\n/**\n * Created by liujunqin on 2016/5/12.\n */\npublic class OpenDoorLimitAdapt",
"end": 478,
"score": 0.9995608329772949,
"start": 469,
"tag": "USERNAME",
"value": "liujunqin"
}
] | null |
[] |
package com.android.adapter;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.TextView;
import com.android.mylibrary.model.OpenDoorLimit;
import com.android.qrcode.R;
import com.android.utils.OnAddDeleteListener;
import java.util.HashMap;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
/**
* Created by liujunqin on 2016/5/12.
*/
public class OpenDoorLimitAdapter extends BaseAdapter {
Context context;
List<OpenDoorLimit> list;
private static HashMap<Integer, Boolean> isSelectedMap = new HashMap<Integer, Boolean>();
OnAddDeleteListener onAddDeleteListener;
public OpenDoorLimitAdapter(Context context, List<OpenDoorLimit> list,OnAddDeleteListener onAddDeleteListener) {
this.context = context;
this.list = list;
this.onAddDeleteListener = onAddDeleteListener;
for (int i = 0; i < list.size(); i++) {
getIsSelected().put(i, false);
}
}
// 初始化isSelected的数据
public void initDate() {
for (int i = 0; i < list.size(); i++) {
if(list.get(i).isOpen()){
getIsSelected().put(i, true);
}else{
getIsSelected().put(i, false);
}
}
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int i) {
return list.get(i);
}
@Override
public long getItemId(int i) {
return i;
}
@Override
public View getView(int i, View convertView, ViewGroup viewGroup) {
ViewHolder holder;
if (convertView == null) {
convertView = View.inflate(context, R.layout.item_open_door, null);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.open_door_desc.setText(list.get(i).getBuildname());
final int tempPosition = i;
holder.toggle_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (((CheckBox) v).isChecked()) {
getIsSelected().put(tempPosition, true);
onAddDeleteListener.onAdd(list.get(tempPosition).getBuildid());
// notifyDataSetChanged();
} else {
getIsSelected().put(tempPosition, false);
onAddDeleteListener.onDelete(list.get(tempPosition).getBuildid());
//notifyDataSetChanged();
}
}
});
holder.toggle_btn.setChecked(getIsSelected().get(i));
return convertView;
}
class ViewHolder {
@Bind(R.id.open_door_desc)
TextView open_door_desc;
@Bind(R.id.toggle_btn)
CheckBox toggle_btn;
ViewHolder(View view) {
ButterKnife.bind(this, view);
}
}
public HashMap<Integer, Boolean> getIsSelected() {
return isSelectedMap;
}
public void setIsSelected(HashMap<Integer, Boolean> isSelected) {
isSelectedMap = isSelected;
}
}
| 3,320 | 0.602479 | 0.599758 | 125 | 25.464001 | 23.784548 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.544 | false | false |
12
|
24278e7e6ae65ee0b126cf79c465c09ef541a890
| 33,285,996,563,604 |
f47d8154443afe4bed253aaff76bd44e9e0413bd
|
/src/main/ChromosomeComponent.java
|
bce074e887dfcedcb6d3f3bddef099a0a91fe8f3
|
[] |
no_license
|
shenj7/genetic-algorithm
|
https://github.com/shenj7/genetic-algorithm
|
0c11e8fe0b7e2e7e33447948ea09431cb95015ce
|
c6a802dba3fd5ce1ae12d67e4752f6e7e4e3993d
|
refs/heads/main
| 2023-06-03T00:38:52.601000 | 2021-06-27T16:15:10 | 2021-06-27T16:15:10 | 376,115,652 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package main;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JButton;
import javax.swing.JComponent;
@SuppressWarnings("serial")
public class ChromosomeComponent extends JComponent{
private Chromosome chrom;
private JButton[] geneBtns;
public ChromosomeComponent(Chromosome c, JButton[] btns) {
this.chrom = c;
this.geneBtns = btns;
// setPreferredSize(new Dimension((c.WIDTH+1)*10, (c.WIDTH+1)*10));//wrong/arbitrary?
}
@Override
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g.create();
chrom.drawOn(g2d);
}
public void updateButtons() {
for(int i=0;i<chrom.getGenome().length;i++) {
if(chrom.getGenome()[i]==1) {
geneBtns[i].setBackground(Color.GREEN);
geneBtns[i].setSelected(true);
}
else {
geneBtns[i].setBackground(Color.BLACK);
geneBtns[i].setSelected(true);
}
}
}
public Chromosome getChrom() {
return chrom;
}
public void setChrom(Chromosome c) {
chrom = c;
}
public JButton[] getGeneBtns() {
return geneBtns;
}
public void setGeneBtns(JButton[] geneBtns) {
this.geneBtns = geneBtns;
}
}
|
UTF-8
|
Java
| 1,159 |
java
|
ChromosomeComponent.java
|
Java
|
[] | null |
[] |
package main;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JButton;
import javax.swing.JComponent;
@SuppressWarnings("serial")
public class ChromosomeComponent extends JComponent{
private Chromosome chrom;
private JButton[] geneBtns;
public ChromosomeComponent(Chromosome c, JButton[] btns) {
this.chrom = c;
this.geneBtns = btns;
// setPreferredSize(new Dimension((c.WIDTH+1)*10, (c.WIDTH+1)*10));//wrong/arbitrary?
}
@Override
protected void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g.create();
chrom.drawOn(g2d);
}
public void updateButtons() {
for(int i=0;i<chrom.getGenome().length;i++) {
if(chrom.getGenome()[i]==1) {
geneBtns[i].setBackground(Color.GREEN);
geneBtns[i].setSelected(true);
}
else {
geneBtns[i].setBackground(Color.BLACK);
geneBtns[i].setSelected(true);
}
}
}
public Chromosome getChrom() {
return chrom;
}
public void setChrom(Chromosome c) {
chrom = c;
}
public JButton[] getGeneBtns() {
return geneBtns;
}
public void setGeneBtns(JButton[] geneBtns) {
this.geneBtns = geneBtns;
}
}
| 1,159 | 0.69629 | 0.685073 | 56 | 19.678572 | 18.961529 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.714286 | false | false |
12
|
03fa3b6d76099c4e27bc2134ae409ddf16753328
| 20,005,957,693,222 |
cb88a02fa2ef4092a150b229b5b3779dc89b1586
|
/Java/HelloWorld/src/JavaBase/多线程/threadLocal/并发模拟/Var.java
|
1d31e6ed9c47067071a1e145311e4962ca2f1e70
|
[] |
no_license
|
1765155167/C-Java-Python
|
https://github.com/1765155167/C-Java-Python
|
f083ed7de36936ff4b20ddcf865b593c353d3abd
|
aa31d765d3e895dc65bbb770a32c7bc07a64b4bd
|
refs/heads/master
| 2022-06-26T19:55:45.171000 | 2020-04-13T15:20:39 | 2020-04-13T15:20:39 | 205,353,222 | 0 | 0 | null | false | 2022-06-21T04:12:40 | 2019-08-30T09:45:46 | 2020-04-13T15:29:11 | 2022-06-21T04:12:40 | 1,128,600 | 0 | 0 | 1 |
Python
| false | false |
package JavaBase.多线程.threadLocal.并发模拟;
public class Var<T> {
T v;
public T get() {
return v;
}
public void set(T v) {
this.v = v;
}
}
|
UTF-8
|
Java
| 187 |
java
|
Var.java
|
Java
|
[] | null |
[] |
package JavaBase.多线程.threadLocal.并发模拟;
public class Var<T> {
T v;
public T get() {
return v;
}
public void set(T v) {
this.v = v;
}
}
| 187 | 0.508671 | 0.508671 | 13 | 12.307693 | 11.624805 | 38 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.307692 | false | false |
12
|
fa62147a0e8c85916b521ec9720c2353e15c38d3
| 12,575,664,275,597 |
2607e230ba53033ae2a28bdade18b63b81cbe0f9
|
/monitor/insightview-monitor-web/src/main/java/com/fable/insightview/monitor/middelware/controller/MiddlewareImportController.java
|
e9aaf073a2aee36d59a6a5f60109b0c75097371f
|
[] |
no_license
|
fshirly/ZGDX_YUNWEI
|
https://github.com/fshirly/ZGDX_YUNWEI
|
c39ee740597865bff992f175189af2168fad7741
|
f73835cdfb49ac7ff027c8557775b36b256c70d3
|
refs/heads/master
| 2021-08-23T07:42:06.735000 | 2017-12-04T05:39:47 | 2017-12-04T05:39:47 | 112,998,941 | 0 | 4 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.fable.insightview.monitor.middelware.controller;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import net.sf.json.processors.DefaultValueProcessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;
import com.fable.insightview.monitor.middleware.tomcat.service.IMiddlewareSyncService;
import com.fable.insightview.platform.common.helper.RestHepler;
import com.fable.insightview.platform.sysinit.SystemParamInit;
@Controller
@RequestMapping("/middleware/middlewareImport")
@SuppressWarnings("all")
public class MiddlewareImportController {
private static final Logger logger = LoggerFactory.getLogger(MiddlewareImportController.class);
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
@Autowired
private IMiddlewareSyncService iMiddlewareSyncService;
// MOMiddleWareJVMBean
@ResponseBody
@RequestMapping(value = "/execute", produces = "application/json; charset=utf-8")
public String execute() {
String[] models = { "MOMiddleWareJMX", "MOMiddleWareJVM", "MOMiddleWareMemory", "MOMiddleWareJTA", "MOMiddleWareJMS", "MOMiddleWareJdbcDS", "MOMiddleWareJdbcPool", "MOMiddleClassLoad", "MOMiddleWareThreadPool", "MOMiddleEJBModule", "MOMiddleWareWebModule", "MOMiddleWareJ2eeApp" };
logger.info("....start execute synchron mobject to CMDB....");
try {
logger.info("....begin synchronized middleware.....");
logger.info("....end synchronized middleware.....");
return sendMOMiddleWareJMX();
} catch (Exception ex) {
ex.printStackTrace();
return "ERROR";
}
// return "OK";
}
public String sendHeader() {
List<Map> temp = iMiddlewareSyncService.queryByTableName("MOMiddleWareJTA");
return JSONArray.fromObject(temp).toString();
}
public String sendMOMiddleWareJMX() {
List<Map> temp = iMiddlewareSyncService.queryByTableName("MOMiddleWareJTA");
for (Map map : temp) {
// 资源类型
map.put("resTypeId", "");
// 资源ID
map.put("resId", "");
}
JSONObject json = new JSONObject();
json.put("transferor", "monitor");
json.put("transfertime", df.format(new Date()));
json.put("process", 1);
json.put("batchid", 1);
json.put("size", temp.size());
JsonConfig conf = new JsonConfig();
conf.registerDefaultValueProcessor(Date.class, new DefaultValueProcessor() {
@Override
public Object getDefaultValue(Class clazz) {
System.out.println(clazz);
return null;
}
});
json.put("data", JSONArray.fromObject(temp, conf));
return json.toString();
}
/**
* 同步设备
*
*/
private void executeDevice() {
logger.info("...... start sync device ......");
}
private void invokeParty(JSONObject jsondata) {
try {
String url = SystemParamInit.getValueByKey("rest.resSychron.url");
String path = "/rest/cmdb/monitor/sync/bulk";
String username = SystemParamInit.getValueByKey("rest.username");
String password = SystemParamInit.getValueByKey("rest.password");
// 拼接获取单板接口URL
StringBuffer basePath = new StringBuffer();
basePath.append(url);
basePath.append(path);
HttpHeaders requestHeaders = RestHepler.createHeaders(username, password);
HttpEntity<Object> requestEntity = new HttpEntity<Object>(jsondata, requestHeaders);
RestTemplate rest = new RestTemplate();
// 参数1:请求地址 ,参数2:请求方式,参数3:请求头信息,参数4:相应类
ResponseEntity<String> rssResponse = rest.exchange(basePath.toString(), HttpMethod.POST, requestEntity, String.class);
if (null != rssResponse) {
logger.info(rssResponse.getBody());
}
} catch (Exception e) {
logger.error("invoke rest interface, error!");
}
}
public static void main(String[] args) {
}
}
|
UTF-8
|
Java
| 4,322 |
java
|
MiddlewareImportController.java
|
Java
|
[] | null |
[] |
package com.fable.insightview.monitor.middelware.controller;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import net.sf.json.processors.DefaultValueProcessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;
import com.fable.insightview.monitor.middleware.tomcat.service.IMiddlewareSyncService;
import com.fable.insightview.platform.common.helper.RestHepler;
import com.fable.insightview.platform.sysinit.SystemParamInit;
@Controller
@RequestMapping("/middleware/middlewareImport")
@SuppressWarnings("all")
public class MiddlewareImportController {
private static final Logger logger = LoggerFactory.getLogger(MiddlewareImportController.class);
final DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
@Autowired
private IMiddlewareSyncService iMiddlewareSyncService;
// MOMiddleWareJVMBean
@ResponseBody
@RequestMapping(value = "/execute", produces = "application/json; charset=utf-8")
public String execute() {
String[] models = { "MOMiddleWareJMX", "MOMiddleWareJVM", "MOMiddleWareMemory", "MOMiddleWareJTA", "MOMiddleWareJMS", "MOMiddleWareJdbcDS", "MOMiddleWareJdbcPool", "MOMiddleClassLoad", "MOMiddleWareThreadPool", "MOMiddleEJBModule", "MOMiddleWareWebModule", "MOMiddleWareJ2eeApp" };
logger.info("....start execute synchron mobject to CMDB....");
try {
logger.info("....begin synchronized middleware.....");
logger.info("....end synchronized middleware.....");
return sendMOMiddleWareJMX();
} catch (Exception ex) {
ex.printStackTrace();
return "ERROR";
}
// return "OK";
}
public String sendHeader() {
List<Map> temp = iMiddlewareSyncService.queryByTableName("MOMiddleWareJTA");
return JSONArray.fromObject(temp).toString();
}
public String sendMOMiddleWareJMX() {
List<Map> temp = iMiddlewareSyncService.queryByTableName("MOMiddleWareJTA");
for (Map map : temp) {
// 资源类型
map.put("resTypeId", "");
// 资源ID
map.put("resId", "");
}
JSONObject json = new JSONObject();
json.put("transferor", "monitor");
json.put("transfertime", df.format(new Date()));
json.put("process", 1);
json.put("batchid", 1);
json.put("size", temp.size());
JsonConfig conf = new JsonConfig();
conf.registerDefaultValueProcessor(Date.class, new DefaultValueProcessor() {
@Override
public Object getDefaultValue(Class clazz) {
System.out.println(clazz);
return null;
}
});
json.put("data", JSONArray.fromObject(temp, conf));
return json.toString();
}
/**
* 同步设备
*
*/
private void executeDevice() {
logger.info("...... start sync device ......");
}
private void invokeParty(JSONObject jsondata) {
try {
String url = SystemParamInit.getValueByKey("rest.resSychron.url");
String path = "/rest/cmdb/monitor/sync/bulk";
String username = SystemParamInit.getValueByKey("rest.username");
String password = SystemParamInit.getValueByKey("rest.password");
// 拼接获取单板接口URL
StringBuffer basePath = new StringBuffer();
basePath.append(url);
basePath.append(path);
HttpHeaders requestHeaders = RestHepler.createHeaders(username, password);
HttpEntity<Object> requestEntity = new HttpEntity<Object>(jsondata, requestHeaders);
RestTemplate rest = new RestTemplate();
// 参数1:请求地址 ,参数2:请求方式,参数3:请求头信息,参数4:相应类
ResponseEntity<String> rssResponse = rest.exchange(basePath.toString(), HttpMethod.POST, requestEntity, String.class);
if (null != rssResponse) {
logger.info(rssResponse.getBody());
}
} catch (Exception e) {
logger.error("invoke rest interface, error!");
}
}
public static void main(String[] args) {
}
}
| 4,322 | 0.747159 | 0.744792 | 123 | 33.349594 | 34.148403 | 283 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.162602 | false | false |
12
|
884f46728c7c222d45650209e7865f6eeeff20e4
| 28,037,546,544,192 |
02183ceb7fcf19e59bd1a041343013c68b50a6b8
|
/src/com/yuanneng/book/manage/login/service/AdminUserLoginService.java
|
80e85771ac7f12d39c2e9e46a61f5f8d46ff7c19
|
[] |
no_license
|
flyqxf/book
|
https://github.com/flyqxf/book
|
7f63dc9081874f6ecb36933222f636d523dd181c
|
ef1aa37a72aa8bbeb11d5e2f51f1a829ed014086
|
refs/heads/master
| 2020-04-28T09:02:19.900000 | 2019-03-12T06:53:02 | 2019-03-12T06:53:02 | 175,151,798 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* @(#)AdminUserLoginService.java
*/
package com.yuanneng.book.manage.login.service;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.log4j.Logger;
import com.yuanneng.book.common.service.CommonService;
import com.yuanneng.book.common.utils.BusinessUtils;
import com.yuanneng.book.common.utils.Constant;
import com.yuanneng.book.manage.login.dao.IAdminUserDisplayDao;
import com.yuanneng.book.manage.login.entity.AdminUserBean;
public class AdminUserLoginService implements CommonService {
/**
* 日志
*/
public static Logger logger = Logger.getLogger(AdminUserLoginService.class);
/**
* 注入的ISelectUserDao层
*/
@Resource
public IAdminUserDisplayDao iAdminUserDisplayDao;
/**
* 输入密码错误的ID保存MAP
*/
public Map<String, Integer> failureUserCount;
/**
* 查询判断密码是否正确
*
* @param userName 查询的用户
* @return 用户信息
* @throws Exception 密码MD5转换异常
*/
public AdminUserBean equelUserPwd(String userName, String password) throws Exception {
/** 设置查询参数 */
AdminUserBean adminUserBean = new AdminUserBean();
adminUserBean.setUserId(userName);
List<AdminUserBean> list = iAdminUserDisplayDao.getUserBeans(adminUserBean);
/** 若返回空则修改失败 */
if (list.size() <= 0) {
return null;
}
/** 获取查询用户的密码 */
String userPwd = list.get(0).getUserPassword();
/** 密码MD5转化 */
String pwd = BusinessUtils.getPasswordMD5(password);
/** 判断密码是否相同 */
if (!pwd.equals(userPwd)) {
return null;
}
/** 将用户信息中的密码清除掉 */
list.get(0).setUserPassword(Constant.STRING_BLANK);
adminUserBean = list.get(0);
adminUserBean.setUserId(userName);
return adminUserBean;
}
}
|
UTF-8
|
Java
| 2,038 |
java
|
AdminUserLoginService.java
|
Java
|
[] | null |
[] |
/*
* @(#)AdminUserLoginService.java
*/
package com.yuanneng.book.manage.login.service;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.log4j.Logger;
import com.yuanneng.book.common.service.CommonService;
import com.yuanneng.book.common.utils.BusinessUtils;
import com.yuanneng.book.common.utils.Constant;
import com.yuanneng.book.manage.login.dao.IAdminUserDisplayDao;
import com.yuanneng.book.manage.login.entity.AdminUserBean;
public class AdminUserLoginService implements CommonService {
/**
* 日志
*/
public static Logger logger = Logger.getLogger(AdminUserLoginService.class);
/**
* 注入的ISelectUserDao层
*/
@Resource
public IAdminUserDisplayDao iAdminUserDisplayDao;
/**
* 输入密码错误的ID保存MAP
*/
public Map<String, Integer> failureUserCount;
/**
* 查询判断密码是否正确
*
* @param userName 查询的用户
* @return 用户信息
* @throws Exception 密码MD5转换异常
*/
public AdminUserBean equelUserPwd(String userName, String password) throws Exception {
/** 设置查询参数 */
AdminUserBean adminUserBean = new AdminUserBean();
adminUserBean.setUserId(userName);
List<AdminUserBean> list = iAdminUserDisplayDao.getUserBeans(adminUserBean);
/** 若返回空则修改失败 */
if (list.size() <= 0) {
return null;
}
/** 获取查询用户的密码 */
String userPwd = list.get(0).getUserPassword();
/** 密码MD5转化 */
String pwd = BusinessUtils.getPasswordMD5(password);
/** 判断密码是否相同 */
if (!pwd.equals(userPwd)) {
return null;
}
/** 将用户信息中的密码清除掉 */
list.get(0).setUserPassword(Constant.STRING_BLANK);
adminUserBean = list.get(0);
adminUserBean.setUserId(userName);
return adminUserBean;
}
}
| 2,038 | 0.647154 | 0.642857 | 74 | 24.162163 | 23.058695 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.351351 | false | false |
12
|
fdb1e4cab5341c2c8597ecc37fda2401690396a4
| 4,647,154,647,018 |
779757b123711e6a0d17938835aa15809d525ef8
|
/sai-app/src/main/java/com/maga/saiapp/dto/article/FindArticlesSearchFilter.java
|
ee6a45c36fa6688dd413537543ccae6ed0ccbc98
|
[] |
no_license
|
Matvey10/JavaApplications
|
https://github.com/Matvey10/JavaApplications
|
a94c7bd34ce362a336e456c2733d661fa1c5b38c
|
f80e092acf694b75ea8c795cd0cdeb05af412c67
|
refs/heads/master
| 2022-11-30T03:49:40.861000 | 2021-12-03T13:28:03 | 2021-12-03T13:28:03 | 237,984,976 | 0 | 0 | null | false | 2022-11-24T08:18:13 | 2020-02-03T14:30:17 | 2021-12-03T13:28:06 | 2022-11-24T08:18:11 | 59,020 | 0 | 0 | 9 |
Java
| false | false |
package com.maga.saiapp.dto.article;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class FindArticlesSearchFilter {
private String articleTitle;
private String magazine;
private String aiAreas;
private String keywords;
private String orderBy;
}
|
UTF-8
|
Java
| 317 |
java
|
FindArticlesSearchFilter.java
|
Java
|
[] | null |
[] |
package com.maga.saiapp.dto.article;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class FindArticlesSearchFilter {
private String articleTitle;
private String magazine;
private String aiAreas;
private String keywords;
private String orderBy;
}
| 317 | 0.766562 | 0.766562 | 14 | 21.642857 | 13.735289 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false |
12
|
791e436275b7751bf2b42d3e8c84a99bc1ccd5d5
| 4,647,154,644,576 |
80ae707b8a633400c7a259fa666de098b970c4d1
|
/src/main/java/site/mingsha/pattern/structure/flyweight/Flyweight.java
|
e83289aa3b72d382ff4b7932e93c55612b283ea0
|
[] |
no_license
|
chenlong220192/design-patterns-examples
|
https://github.com/chenlong220192/design-patterns-examples
|
e9dbefc0b6fe5652397c47a452e0b8efae1f1169
|
44eb28fe1b62b7b1df8def4eb84c66775cb66708
|
refs/heads/master
| 2022-07-18T18:39:56.032000 | 2020-05-19T15:12:32 | 2020-05-19T15:12:32 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package site.mingsha.pattern.structure.flyweight;
/**
* @author chenlong
* @version : Flyweight.java, v0.1 2020/5/18 Exp $$
*/
public abstract class Flyweight {
/**
* 内部状态
*/
private String intrinsic;
/**
* 外部状态
*/
protected final String extrinsic;
/**
* 要求享元角色必须接受外部状态
*
* @param _Extrinsic
*/
public Flyweight(String _Extrinsic) {
this.extrinsic = _Extrinsic;
}
/**
* 定义业务操作
*/
public abstract void operate();
/**
* 内部状态的getter
*
* @return
*/
public String getIntrinsic() {
return intrinsic;
}
public String getExtrinsic() {
return extrinsic;
}
/**
* 内部状态的setter
*
* @param intrinsic
*/
public void setIntrinsic(String intrinsic) {
this.intrinsic = intrinsic;
}
}
|
UTF-8
|
Java
| 966 |
java
|
Flyweight.java
|
Java
|
[
{
"context": "ngsha.pattern.structure.flyweight;\n\n/**\n * @author chenlong\n * @version : Flyweight.java, v0.1 2020/5/18 Exp ",
"end": 74,
"score": 0.9991840720176697,
"start": 66,
"tag": "USERNAME",
"value": "chenlong"
}
] | null |
[] |
package site.mingsha.pattern.structure.flyweight;
/**
* @author chenlong
* @version : Flyweight.java, v0.1 2020/5/18 Exp $$
*/
public abstract class Flyweight {
/**
* 内部状态
*/
private String intrinsic;
/**
* 外部状态
*/
protected final String extrinsic;
/**
* 要求享元角色必须接受外部状态
*
* @param _Extrinsic
*/
public Flyweight(String _Extrinsic) {
this.extrinsic = _Extrinsic;
}
/**
* 定义业务操作
*/
public abstract void operate();
/**
* 内部状态的getter
*
* @return
*/
public String getIntrinsic() {
return intrinsic;
}
public String getExtrinsic() {
return extrinsic;
}
/**
* 内部状态的setter
*
* @param intrinsic
*/
public void setIntrinsic(String intrinsic) {
this.intrinsic = intrinsic;
}
}
| 966 | 0.524719 | 0.514607 | 53 | 15.792453 | 14.040854 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.169811 | false | false |
12
|
9d51075e3a8bdbefcdceba608c80ef0896e95038
| 5,394,478,959,890 |
8638fd326bf37198d86ae2b94b1d3529e7b1fadd
|
/de.uni_stuttgart.iste.cowolf.ui.model.ctmc/src/de/uni_stuttgart/iste/cowolf/ui/model/ctmc/analyze/AnalyzeWizardPage1.java
|
1e68ef48f886a4328283311aee78671e65138869
|
[] |
no_license
|
timsanwald/CoWolf
|
https://github.com/timsanwald/CoWolf
|
774c22d8e1f097a87093498f09524eeece1be4ad
|
706b12b6170cb7369d82c6840b93e3854122e6b8
|
refs/heads/master
| 2021-01-21T16:11:11.770000 | 2014-12-02T21:31:17 | 2014-12-02T21:31:17 | 25,541,447 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package de.uni_stuttgart.iste.cowolf.ui.model.ctmc.analyze;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
import org.eclipse.xtext.resource.XtextResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.uni_stuttgart.iste.cowolf.model.ctmc.xtext.pCTL.Comment;
import de.uni_stuttgart.iste.cowolf.model.ctmc.xtext.pCTL.Fragment;
import de.uni_stuttgart.iste.cowolf.model.ctmc.xtext.pCTL.PCTLFactory;
import de.uni_stuttgart.iste.cowolf.model.ctmc.xtext.pCTL.Rule;
import de.uni_stuttgart.iste.cowolf.model.ctmc.xtext.pCTL.Start;
public class AnalyzeWizardPage1 extends WizardPage {
private final static Logger LOGGER = LoggerFactory
.getLogger(AnalyzeWizardPage1.class);
private Composite container;
private Resource resource;
Table table;
TableViewer tableViewer;
private List<Object[]> tableData;
private XtextResource pctlRes;
protected AnalyzeWizardPage1(final String pageName, final Resource res) {
super(pageName);
this.resource = res;
this.setTitle("Analyze a ctmc model");
this.setDescription("Select properties to analyze.");
this.tableData = new LinkedList<>();
loadPCTL();
}
private void loadPCTL() {
IFile modelfile = ResourcesPlugin.getWorkspace().getRoot()
.getFile(new Path(resource.getURI().toPlatformString(true)));
IFile resultfile = ResourcesPlugin.getWorkspace().getRoot()
.getFile(modelfile.getFullPath().addFileExtension("pctl"));
ResourceSet resSet = new ResourceSetImpl();
if (!resultfile.exists()) {
try {
resultfile.create(new ByteArrayInputStream(new byte[0]), true, null);
} catch (CoreException e) {
LOGGER.error("Could not create pctl file", e);
}
pctlRes = (XtextResource) resSet.createResource(URI.createPlatformResourceURI(resultfile.getFullPath().toString(), false));
} else {
pctlRes = (XtextResource) resSet.getResource(URI.createPlatformResourceURI(resultfile.getFullPath().toString(), false), true);
}
try {
pctlRes.load(Collections.EMPTY_MAP);
} catch (IOException e) {
LOGGER.error("Could not load pctl file", e);
}
if (pctlRes.getContents().size() == 0 || !(pctlRes.getContents().get(0) instanceof Start)) {
return;
}
readTableData();
}
private void readTableData() {
tableData.clear();
Iterator<Fragment> it = ((Start)pctlRes.getContents().get(0)).getRule().iterator();
Comment comment = null;
while (it.hasNext()) {
Fragment current = it.next();
if (current instanceof Comment) {
comment = (Comment) current;
} else if (current instanceof Rule) {
tableData.add(new Object[] {null, comment, (Rule) current});
comment = null;
}
}
}
public void addTableItem(Comment key, Rule value) {
tableData.add(new Object[] { null, key, value });
tableViewer.setInput(tableData);
tableViewer.refresh();
// When a new file is created, Start seems to be missing.
if (pctlRes.getContents().size() == 0) {
pctlRes.getContents().add(PCTLFactory.eINSTANCE.createStart());
}
if (key != null && !key.getComment().matches("^/*\\s*$")) {
((Start) pctlRes.getContents().get(0)).getRule().add(key);
}
if (value != null) {
((Start) pctlRes.getContents().get(0)).getRule().add(value);
}
save();
}
public void editTableItem(Integer index, Comment key, Rule value) {
if (tableData.size() <= index) {
return;
}
Start start = (Start) pctlRes.getContents().get(0);
Set<Integer> selection = this.getCheckedItems();
if (tableData.get(index)[1] == null) {
if (!key.getComment().matches("^/*\\s*$")) {
// Add comment.
start.getRule().add(start.getRule().indexOf(tableData.get(index)[2]), key);
tableData.get(index)[1] = key;
}
} else if (key.getComment().matches("^/*\\s*$")) {
//remove comment.
start.getRule().remove(tableData.get(index)[1]);
tableData.get(index)[1] = null;
} else {
//update comment.
((Comment) tableData.get(index)[1]).setComment(key.getComment());
}
int oldIndex = start.getRule().indexOf(tableData.get(index)[2]);
//ICompositeNode node = NodeModelUtils.getNode((EObject) tableData.get(index)[2]);
//pctlRes.update(node.getOffset(), node.getLength(), NodeModelUtils.getNode(value).getText().trim());
start.getRule().set(oldIndex, value);
save();
start = (Start) pctlRes.getContents().get(0);
tableData.get(index)[2] = start.getRule().get(oldIndex);
this.readTableData();
tableViewer.setInput(tableData);
tableViewer.refresh();
table.redraw();
this.setCheckedItems(selection);
}
private void setCheckedItems(Set<Integer> selection) {
if (selection == null) {
return;
}
for (int i : selection) {
if (i < table.getItemCount()) {
table.getItem(i).setChecked(true);
}
}
}
private Set<Integer> getCheckedItems() {
Set<Integer> result = new TreeSet<>();
for (int i=0; i<table.getItemCount();i++) {
if (table.getItem(i).getChecked()) {
result.add(i);
}
}
return result;
}
public void deleteTableItem(int index) {
Start start = (Start) pctlRes.getContents().get(0);
if (tableData.get(index)[1] != null) {
start.getRule().remove(tableData.get(index)[1]);
}
if (tableData.get(index)[2] != null) {
start.getRule().remove(tableData.get(index)[2]);
}
save();
tableData.remove(index);
tableViewer.setInput(tableData);
tableViewer.refresh();
table.redraw();
}
public void save() {
try {
pctlRes.save(Collections.EMPTY_MAP);
} catch (IOException e) {
LOGGER.error("Could not save PCTL file.", e);
}
}
@Override
public void createControl(final Composite parent) {
this.container = new Composite(parent, SWT.NONE);
this.setControl(this.container);
this.container.setLayout(new GridLayout(5, false));
tableViewer = new TableViewer(container, SWT.CHECK | SWT.FULL_SELECTION);
tableViewer.setContentProvider(ArrayContentProvider.getInstance());
table = tableViewer.getTable();
GridData gd_t = new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1);
gd_t.widthHint = 554;
table.setLayoutData(gd_t);
table.setLinesVisible(true);
final TableColumn column1 = new TableColumn(table, SWT.CENTER);
column1.setResizable(false);
column1.setText(" ");
column1.setWidth(40);
final TableColumn column2 = new TableColumn(table, SWT.LEFT);
column2.setText("Name");
column2.setWidth(180);
final TableColumn column3 = new TableColumn(table, SWT.LEFT);
column3.setResizable(false);
column3.setText("Property");
column3.setWidth(180);
table.setHeaderVisible(true);
tableViewer.setLabelProvider(new ITableLabelProvider() {
@Override
public void addListener(ILabelProviderListener listener) {
// TODO Auto-generated method stub
}
@Override
public void dispose() {
// TODO Auto-generated method stub
}
@Override
public boolean isLabelProperty(Object element, String property) {
// TODO Auto-generated method stub
return false;
}
@Override
public void removeListener(ILabelProviderListener listener) {
// TODO Auto-generated method stub
}
@Override
public Image getColumnImage(Object element, int columnIndex) {
// TODO Auto-generated method stub
return null;
}
@Override
public String getColumnText(Object element, int columnIndex) {
if (element == null) {
return null;
}
if (!(element instanceof Object[]) || columnIndex >= ((Object[]) element).length) {
return null;
}
Object col = ((Object[]) element)[columnIndex];
if (col instanceof Comment) {
return ((Comment) col).getComment().replaceFirst("^/+\\s*", "");
}
if (col instanceof Rule) {
return NodeModelUtils.findActualNodeFor((Rule) col).getText().trim();
}
return null;
}
});
table.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent arg0) {
AnalyzeWizardPage1.this.getContainer().updateButtons();
}
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
// TODO Auto-generated method stub
}
});
container.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
super.controlResized(e);
Rectangle area = container.getClientArea();
Point size = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
ScrollBar vBar = table.getVerticalBar();
int width = area.width - table.computeTrim(0, 0, 0, 0).width
- vBar.getSize().x;
if (size.y > area.height + table.getHeaderHeight()) {
// Subtract the scrollbar width from the total column width
// if a vertical scrollbar will be required
Point vBarSize = vBar.getSize();
width -= vBarSize.x;
}
Point oldSize = table.getSize();
if (oldSize.x > area.width) {
// table is getting smaller so make the columns
// smaller first and then resize the table to
// match the client area width
column3.setWidth(width - column1.getWidth()
- column2.getWidth());
table.setSize(area.width, area.height);
} else {
// table is getting bigger so make the table
// bigger first and then make the columns wider
// to match the client area width
table.setSize(area.width, area.height);
column3.setWidth(width - column1.getWidth()
- column2.getWidth());
}
}
});
tableViewer.setInput(tableData);
// String[] tableData = data.split("//");
// for (String string : tableData) {
// if (!string.isEmpty()) {
// String[] tableSubData = string.split("\n", 2);
// if (tableSubData.length > 1) {
// addTableItem(tableSubData[0].trim(), tableSubData[1].trim());
// } else {
// addTableItem(tableSubData[0].trim(), "");
// }
// }
// }
Button btnSelectAll = new Button(container, SWT.NONE);
btnSelectAll.setText("Select All");
btnSelectAll.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent arg0) {
for (TableItem item : table.getItems()) {
item.setChecked(true);
}
AnalyzeWizardPage1.this.getContainer().updateButtons();
}
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
// TODO Auto-generated method stub
}
});
Button btnDeselectAll = new Button(container, SWT.NONE);
btnDeselectAll.setText("Deselect All");
btnDeselectAll.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent arg0) {
for (TableItem item : table.getItems()) {
item.setChecked(false);
}
AnalyzeWizardPage1.this.getContainer().updateButtons();
}
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
// TODO Auto-generated method stub
}
});
Button btnAdd = new Button(container, SWT.NONE);
btnAdd.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false,
1, 1));
btnAdd.setText("Add");
btnAdd.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent arg0) {
EditPropertiesWizard wizard = new EditPropertiesWizard(
resource, null, null);
WizardDialog wizardDialog = new WizardDialog(container
.getShell(), wizard);
wizardDialog.create();
wizardDialog.setBlockOnOpen(true);
if (wizardDialog.open() == Window.OK) {
addTableItem(wizard.getKey(), wizard.getValue());
}
}
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
// TODO Auto-generated method stub
}
});
Button btnEdit = new Button(container, SWT.NONE);
btnEdit.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false,
1, 1));
btnEdit.setText("Edit");
btnEdit.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent arg0) {
if (table.getSelectionIndex() == -1) {
return;
}
Object[] item = tableData.get(table.getSelectionIndex());
EditPropertiesWizard wizard = new EditPropertiesWizard(
resource, (Comment) item[1], (Rule) item[2]);
WizardDialog wizardDialog = new WizardDialog(container.getShell(), wizard);
wizardDialog.create();
wizardDialog.setBlockOnOpen(true);
if (wizardDialog.open() == Window.OK) {
editTableItem(table.getSelectionIndex(), wizard.getKey(),
wizard.getValue());
}
}
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
// TODO Auto-generated method stub
}
});
Button btnDelete = new Button(container, SWT.NONE);
btnDelete.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
false, 1, 1));
btnDelete.setText("Delete");
btnDelete.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent arg0) {
if (table.getSelectionIndex() == -1) {
return;
}
deleteTableItem(table.getSelectionIndex());
AnalyzeWizardPage1.this.getContainer().updateButtons();
}
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
// TODO Auto-generated method stub
}
});
}
public void setProperties(final HashMap<String, Object> properties) {
ArrayList<String> propsNames = new ArrayList<String>();
ArrayList<String> props = new ArrayList<String>();
for (TableItem item : table.getItems()) {
if (item.getChecked()) {
propsNames.add(item.getText(1));
props.add(item.getText(2));
}
}
properties.put("analyzePropertyNames", propsNames);
properties.put("analyzeProperties", props);
}
@Override
public boolean isPageComplete() {
this.setErrorMessage(null);
for (TableItem tableItem : table.getItems()) {
if (tableItem.getChecked()) {
return true;
}
}
this.setErrorMessage("Please select at least one property.");
return false;
}
}
|
UTF-8
|
Java
| 15,463 |
java
|
AnalyzeWizardPage1.java
|
Java
|
[] | null |
[] |
package de.uni_stuttgart.iste.cowolf.ui.model.ctmc.analyze;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
import org.eclipse.xtext.resource.XtextResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.uni_stuttgart.iste.cowolf.model.ctmc.xtext.pCTL.Comment;
import de.uni_stuttgart.iste.cowolf.model.ctmc.xtext.pCTL.Fragment;
import de.uni_stuttgart.iste.cowolf.model.ctmc.xtext.pCTL.PCTLFactory;
import de.uni_stuttgart.iste.cowolf.model.ctmc.xtext.pCTL.Rule;
import de.uni_stuttgart.iste.cowolf.model.ctmc.xtext.pCTL.Start;
public class AnalyzeWizardPage1 extends WizardPage {
private final static Logger LOGGER = LoggerFactory
.getLogger(AnalyzeWizardPage1.class);
private Composite container;
private Resource resource;
Table table;
TableViewer tableViewer;
private List<Object[]> tableData;
private XtextResource pctlRes;
protected AnalyzeWizardPage1(final String pageName, final Resource res) {
super(pageName);
this.resource = res;
this.setTitle("Analyze a ctmc model");
this.setDescription("Select properties to analyze.");
this.tableData = new LinkedList<>();
loadPCTL();
}
private void loadPCTL() {
IFile modelfile = ResourcesPlugin.getWorkspace().getRoot()
.getFile(new Path(resource.getURI().toPlatformString(true)));
IFile resultfile = ResourcesPlugin.getWorkspace().getRoot()
.getFile(modelfile.getFullPath().addFileExtension("pctl"));
ResourceSet resSet = new ResourceSetImpl();
if (!resultfile.exists()) {
try {
resultfile.create(new ByteArrayInputStream(new byte[0]), true, null);
} catch (CoreException e) {
LOGGER.error("Could not create pctl file", e);
}
pctlRes = (XtextResource) resSet.createResource(URI.createPlatformResourceURI(resultfile.getFullPath().toString(), false));
} else {
pctlRes = (XtextResource) resSet.getResource(URI.createPlatformResourceURI(resultfile.getFullPath().toString(), false), true);
}
try {
pctlRes.load(Collections.EMPTY_MAP);
} catch (IOException e) {
LOGGER.error("Could not load pctl file", e);
}
if (pctlRes.getContents().size() == 0 || !(pctlRes.getContents().get(0) instanceof Start)) {
return;
}
readTableData();
}
private void readTableData() {
tableData.clear();
Iterator<Fragment> it = ((Start)pctlRes.getContents().get(0)).getRule().iterator();
Comment comment = null;
while (it.hasNext()) {
Fragment current = it.next();
if (current instanceof Comment) {
comment = (Comment) current;
} else if (current instanceof Rule) {
tableData.add(new Object[] {null, comment, (Rule) current});
comment = null;
}
}
}
public void addTableItem(Comment key, Rule value) {
tableData.add(new Object[] { null, key, value });
tableViewer.setInput(tableData);
tableViewer.refresh();
// When a new file is created, Start seems to be missing.
if (pctlRes.getContents().size() == 0) {
pctlRes.getContents().add(PCTLFactory.eINSTANCE.createStart());
}
if (key != null && !key.getComment().matches("^/*\\s*$")) {
((Start) pctlRes.getContents().get(0)).getRule().add(key);
}
if (value != null) {
((Start) pctlRes.getContents().get(0)).getRule().add(value);
}
save();
}
public void editTableItem(Integer index, Comment key, Rule value) {
if (tableData.size() <= index) {
return;
}
Start start = (Start) pctlRes.getContents().get(0);
Set<Integer> selection = this.getCheckedItems();
if (tableData.get(index)[1] == null) {
if (!key.getComment().matches("^/*\\s*$")) {
// Add comment.
start.getRule().add(start.getRule().indexOf(tableData.get(index)[2]), key);
tableData.get(index)[1] = key;
}
} else if (key.getComment().matches("^/*\\s*$")) {
//remove comment.
start.getRule().remove(tableData.get(index)[1]);
tableData.get(index)[1] = null;
} else {
//update comment.
((Comment) tableData.get(index)[1]).setComment(key.getComment());
}
int oldIndex = start.getRule().indexOf(tableData.get(index)[2]);
//ICompositeNode node = NodeModelUtils.getNode((EObject) tableData.get(index)[2]);
//pctlRes.update(node.getOffset(), node.getLength(), NodeModelUtils.getNode(value).getText().trim());
start.getRule().set(oldIndex, value);
save();
start = (Start) pctlRes.getContents().get(0);
tableData.get(index)[2] = start.getRule().get(oldIndex);
this.readTableData();
tableViewer.setInput(tableData);
tableViewer.refresh();
table.redraw();
this.setCheckedItems(selection);
}
private void setCheckedItems(Set<Integer> selection) {
if (selection == null) {
return;
}
for (int i : selection) {
if (i < table.getItemCount()) {
table.getItem(i).setChecked(true);
}
}
}
private Set<Integer> getCheckedItems() {
Set<Integer> result = new TreeSet<>();
for (int i=0; i<table.getItemCount();i++) {
if (table.getItem(i).getChecked()) {
result.add(i);
}
}
return result;
}
public void deleteTableItem(int index) {
Start start = (Start) pctlRes.getContents().get(0);
if (tableData.get(index)[1] != null) {
start.getRule().remove(tableData.get(index)[1]);
}
if (tableData.get(index)[2] != null) {
start.getRule().remove(tableData.get(index)[2]);
}
save();
tableData.remove(index);
tableViewer.setInput(tableData);
tableViewer.refresh();
table.redraw();
}
public void save() {
try {
pctlRes.save(Collections.EMPTY_MAP);
} catch (IOException e) {
LOGGER.error("Could not save PCTL file.", e);
}
}
@Override
public void createControl(final Composite parent) {
this.container = new Composite(parent, SWT.NONE);
this.setControl(this.container);
this.container.setLayout(new GridLayout(5, false));
tableViewer = new TableViewer(container, SWT.CHECK | SWT.FULL_SELECTION);
tableViewer.setContentProvider(ArrayContentProvider.getInstance());
table = tableViewer.getTable();
GridData gd_t = new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1);
gd_t.widthHint = 554;
table.setLayoutData(gd_t);
table.setLinesVisible(true);
final TableColumn column1 = new TableColumn(table, SWT.CENTER);
column1.setResizable(false);
column1.setText(" ");
column1.setWidth(40);
final TableColumn column2 = new TableColumn(table, SWT.LEFT);
column2.setText("Name");
column2.setWidth(180);
final TableColumn column3 = new TableColumn(table, SWT.LEFT);
column3.setResizable(false);
column3.setText("Property");
column3.setWidth(180);
table.setHeaderVisible(true);
tableViewer.setLabelProvider(new ITableLabelProvider() {
@Override
public void addListener(ILabelProviderListener listener) {
// TODO Auto-generated method stub
}
@Override
public void dispose() {
// TODO Auto-generated method stub
}
@Override
public boolean isLabelProperty(Object element, String property) {
// TODO Auto-generated method stub
return false;
}
@Override
public void removeListener(ILabelProviderListener listener) {
// TODO Auto-generated method stub
}
@Override
public Image getColumnImage(Object element, int columnIndex) {
// TODO Auto-generated method stub
return null;
}
@Override
public String getColumnText(Object element, int columnIndex) {
if (element == null) {
return null;
}
if (!(element instanceof Object[]) || columnIndex >= ((Object[]) element).length) {
return null;
}
Object col = ((Object[]) element)[columnIndex];
if (col instanceof Comment) {
return ((Comment) col).getComment().replaceFirst("^/+\\s*", "");
}
if (col instanceof Rule) {
return NodeModelUtils.findActualNodeFor((Rule) col).getText().trim();
}
return null;
}
});
table.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent arg0) {
AnalyzeWizardPage1.this.getContainer().updateButtons();
}
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
// TODO Auto-generated method stub
}
});
container.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
super.controlResized(e);
Rectangle area = container.getClientArea();
Point size = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
ScrollBar vBar = table.getVerticalBar();
int width = area.width - table.computeTrim(0, 0, 0, 0).width
- vBar.getSize().x;
if (size.y > area.height + table.getHeaderHeight()) {
// Subtract the scrollbar width from the total column width
// if a vertical scrollbar will be required
Point vBarSize = vBar.getSize();
width -= vBarSize.x;
}
Point oldSize = table.getSize();
if (oldSize.x > area.width) {
// table is getting smaller so make the columns
// smaller first and then resize the table to
// match the client area width
column3.setWidth(width - column1.getWidth()
- column2.getWidth());
table.setSize(area.width, area.height);
} else {
// table is getting bigger so make the table
// bigger first and then make the columns wider
// to match the client area width
table.setSize(area.width, area.height);
column3.setWidth(width - column1.getWidth()
- column2.getWidth());
}
}
});
tableViewer.setInput(tableData);
// String[] tableData = data.split("//");
// for (String string : tableData) {
// if (!string.isEmpty()) {
// String[] tableSubData = string.split("\n", 2);
// if (tableSubData.length > 1) {
// addTableItem(tableSubData[0].trim(), tableSubData[1].trim());
// } else {
// addTableItem(tableSubData[0].trim(), "");
// }
// }
// }
Button btnSelectAll = new Button(container, SWT.NONE);
btnSelectAll.setText("Select All");
btnSelectAll.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent arg0) {
for (TableItem item : table.getItems()) {
item.setChecked(true);
}
AnalyzeWizardPage1.this.getContainer().updateButtons();
}
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
// TODO Auto-generated method stub
}
});
Button btnDeselectAll = new Button(container, SWT.NONE);
btnDeselectAll.setText("Deselect All");
btnDeselectAll.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent arg0) {
for (TableItem item : table.getItems()) {
item.setChecked(false);
}
AnalyzeWizardPage1.this.getContainer().updateButtons();
}
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
// TODO Auto-generated method stub
}
});
Button btnAdd = new Button(container, SWT.NONE);
btnAdd.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false,
1, 1));
btnAdd.setText("Add");
btnAdd.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent arg0) {
EditPropertiesWizard wizard = new EditPropertiesWizard(
resource, null, null);
WizardDialog wizardDialog = new WizardDialog(container
.getShell(), wizard);
wizardDialog.create();
wizardDialog.setBlockOnOpen(true);
if (wizardDialog.open() == Window.OK) {
addTableItem(wizard.getKey(), wizard.getValue());
}
}
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
// TODO Auto-generated method stub
}
});
Button btnEdit = new Button(container, SWT.NONE);
btnEdit.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false,
1, 1));
btnEdit.setText("Edit");
btnEdit.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent arg0) {
if (table.getSelectionIndex() == -1) {
return;
}
Object[] item = tableData.get(table.getSelectionIndex());
EditPropertiesWizard wizard = new EditPropertiesWizard(
resource, (Comment) item[1], (Rule) item[2]);
WizardDialog wizardDialog = new WizardDialog(container.getShell(), wizard);
wizardDialog.create();
wizardDialog.setBlockOnOpen(true);
if (wizardDialog.open() == Window.OK) {
editTableItem(table.getSelectionIndex(), wizard.getKey(),
wizard.getValue());
}
}
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
// TODO Auto-generated method stub
}
});
Button btnDelete = new Button(container, SWT.NONE);
btnDelete.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
false, 1, 1));
btnDelete.setText("Delete");
btnDelete.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent arg0) {
if (table.getSelectionIndex() == -1) {
return;
}
deleteTableItem(table.getSelectionIndex());
AnalyzeWizardPage1.this.getContainer().updateButtons();
}
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
// TODO Auto-generated method stub
}
});
}
public void setProperties(final HashMap<String, Object> properties) {
ArrayList<String> propsNames = new ArrayList<String>();
ArrayList<String> props = new ArrayList<String>();
for (TableItem item : table.getItems()) {
if (item.getChecked()) {
propsNames.add(item.getText(1));
props.add(item.getText(2));
}
}
properties.put("analyzePropertyNames", propsNames);
properties.put("analyzeProperties", props);
}
@Override
public boolean isPageComplete() {
this.setErrorMessage(null);
for (TableItem tableItem : table.getItems()) {
if (tableItem.getChecked()) {
return true;
}
}
this.setErrorMessage("Please select at least one property.");
return false;
}
}
| 15,463 | 0.69676 | 0.690487 | 539 | 27.688313 | 24.017527 | 129 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.805195 | false | false |
12
|
d65c511bf14201d8907bcc0e48a445874c6c1336
| 21,165,598,866,780 |
2089374ceab9f27eedb597498203b03929a1ad0b
|
/src/main/java/mengka/ketama_01/Tbb.java
|
3f15ba486ace7a159735dca1dbf928ba7bc33d70
|
[] |
no_license
|
hyy044101331/mkHangdian
|
https://github.com/hyy044101331/mkHangdian
|
b1cf3b257f4520de140d4e8109c924cd7398f13d
|
cfcb61d08f0cef3972aff5f7d6b01679de22e78c
|
refs/heads/master
| 2016-09-15T13:34:38.952000 | 2016-04-19T12:05:47 | 2016-04-19T12:05:47 | 7,022,489 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package mengka.ketama_01;
import mengka.ketama_01.common.HashAlgorithm;
import mengka.ketama_01.common.Node;
import mengka.ketama_01.common.NodeUtil;
import java.util.List;
/**
* 根据key获取key对应的节点Node
*
* Created by xiafeng on 16/1/28.
*/
public class Tbb {
/**
* 节点个数
*/
private static final Integer NODE_COUNT = 50;
/**
* 虚拟节点的个数
*/
private static final Integer VIRTUAL_NODE_COUNT = 160;
public static void main(String[] args){
String key = "mengka_bb";
//返回node列表,[node1,node50]
List<Node> allNodes = NodeUtil.getNodes(NODE_COUNT);
//获取ketamaLocator
KetamaNodeLocator ketamaLocator = new KetamaNodeLocator(allNodes, HashAlgorithm.KETAMA_HASH, VIRTUAL_NODE_COUNT);
//返回key对应的节点
Node node = ketamaLocator.getPrimary(key);
if (node != null) {
System.out.println("-----------, node = "+node.getName());
}
}
}
|
GB18030
|
Java
| 1,018 |
java
|
Tbb.java
|
Java
|
[
{
"context": "st;\n\n/**\n * 根据key获取key对应的节点Node\n *\n * Created by xiafeng on 16/1/28.\n */\npublic class Tbb {\n\n /**\n ",
"end": 228,
"score": 0.9994983673095703,
"start": 221,
"tag": "USERNAME",
"value": "xiafeng"
},
{
"context": " void main(String[] args){\n\n String key = \"mengka_bb\";\n\n //返回node列表,[node1,node50]\n List",
"end": 513,
"score": 0.9994114637374878,
"start": 504,
"tag": "KEY",
"value": "mengka_bb"
}
] | null |
[] |
package mengka.ketama_01;
import mengka.ketama_01.common.HashAlgorithm;
import mengka.ketama_01.common.Node;
import mengka.ketama_01.common.NodeUtil;
import java.util.List;
/**
* 根据key获取key对应的节点Node
*
* Created by xiafeng on 16/1/28.
*/
public class Tbb {
/**
* 节点个数
*/
private static final Integer NODE_COUNT = 50;
/**
* 虚拟节点的个数
*/
private static final Integer VIRTUAL_NODE_COUNT = 160;
public static void main(String[] args){
String key = "mengka_bb";
//返回node列表,[node1,node50]
List<Node> allNodes = NodeUtil.getNodes(NODE_COUNT);
//获取ketamaLocator
KetamaNodeLocator ketamaLocator = new KetamaNodeLocator(allNodes, HashAlgorithm.KETAMA_HASH, VIRTUAL_NODE_COUNT);
//返回key对应的节点
Node node = ketamaLocator.getPrimary(key);
if (node != null) {
System.out.println("-----------, node = "+node.getName());
}
}
}
| 1,018 | 0.624211 | 0.602105 | 40 | 22.75 | 25.098557 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false |
12
|
a785c6d0c68b99d7bd5d10ef841c3f22ef06d3c9
| 37,580,963,876,591 |
8d55d3697953f819c52da7e1ce1f01fd0d5c5e6b
|
/app/src/main/java/com/example/doannv/duan2_doannv_cuongnv/model/ViewPage.java
|
6a694b6722196b2e4d6c75e08c0cf5331c8345fa
|
[] |
no_license
|
Doanchelsea/DuAn2_DoanNV_CuongNV
|
https://github.com/Doanchelsea/DuAn2_DoanNV_CuongNV
|
a7b5c16563f8e6692fa62627a60b2882982e75af
|
8e12c660809fc27ed4ea88788261c1b5014f3958
|
refs/heads/master
| 2020-06-10T19:29:57.858000 | 2019-06-25T14:21:51 | 2019-06-25T14:21:51 | 193,722,625 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.doannv.duan2_doannv_cuongnv.model;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.Log;
import com.example.doannv.duan2_doannv_cuongnv.fragment.BanbeFragment;
import com.example.doannv.duan2_doannv_cuongnv.fragment.BangtinFragment;
import com.example.doannv.duan2_doannv_cuongnv.fragment.CaNhanFragment;
import com.example.doannv.duan2_doannv_cuongnv.fragment.MenuFragment;
import com.example.doannv.duan2_doannv_cuongnv.fragment.ThongbaoFragment;
public class ViewPage extends FragmentPagerAdapter {
public ViewPage(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int i) {
switch (i){
case 0:
BangtinFragment bangtinFragment = new BangtinFragment();
return bangtinFragment;
case 1:
BanbeFragment banbeFragment = new BanbeFragment();
return banbeFragment;
case 2:
CaNhanFragment caNhanFragment = new CaNhanFragment();
return caNhanFragment;
case 3:
ThongbaoFragment thongbaoFragment = new ThongbaoFragment();
return thongbaoFragment;
case 4:
MenuFragment menuFragment = new MenuFragment();
return menuFragment;
default:
return null;
}
}
@Override
public int getCount() {
return 5;
}
}
|
UTF-8
|
Java
| 1,590 |
java
|
ViewPage.java
|
Java
|
[] | null |
[] |
package com.example.doannv.duan2_doannv_cuongnv.model;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.Log;
import com.example.doannv.duan2_doannv_cuongnv.fragment.BanbeFragment;
import com.example.doannv.duan2_doannv_cuongnv.fragment.BangtinFragment;
import com.example.doannv.duan2_doannv_cuongnv.fragment.CaNhanFragment;
import com.example.doannv.duan2_doannv_cuongnv.fragment.MenuFragment;
import com.example.doannv.duan2_doannv_cuongnv.fragment.ThongbaoFragment;
public class ViewPage extends FragmentPagerAdapter {
public ViewPage(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int i) {
switch (i){
case 0:
BangtinFragment bangtinFragment = new BangtinFragment();
return bangtinFragment;
case 1:
BanbeFragment banbeFragment = new BanbeFragment();
return banbeFragment;
case 2:
CaNhanFragment caNhanFragment = new CaNhanFragment();
return caNhanFragment;
case 3:
ThongbaoFragment thongbaoFragment = new ThongbaoFragment();
return thongbaoFragment;
case 4:
MenuFragment menuFragment = new MenuFragment();
return menuFragment;
default:
return null;
}
}
@Override
public int getCount() {
return 5;
}
}
| 1,590 | 0.65283 | 0.643396 | 49 | 31.44898 | 24.543224 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.489796 | false | false |
12
|
1b2ce81d8a2ce6c57e918ed6183db6d5532cb2b0
| 36,464,272,384,526 |
45e1bc1d57f6b9771f6c5bd30d7a6904a733e0df
|
/src/lk/Asiri/asirisupermarket/view/Employee.java
|
4eef99cac488048b48b9fd754d63e9bbd8d7e4a3
|
[] |
no_license
|
harsard7/AsiriSMS
|
https://github.com/harsard7/AsiriSMS
|
65322f24cab927e15b0a65b55801459567251211
|
2bbe1bca1f354a4415d6cf348c45f8b3764d2755
|
refs/heads/master
| 2020-03-12T20:02:32.427000 | 2018-04-24T05:44:39 | 2018-04-24T05:44:39 | 130,796,871 | 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 lk.ijse.asirisupermarket.view;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import lk.ijse.asirisupermarket.controller.ManageBatchController;
import lk.ijse.asirisupermarket.core.dto.BatchDTO;
/**
*
* @author Hafees
*/
public class Employee extends javax.swing.JFrame {
/**
* Creates new form Employee
*/
public Employee() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
txt_name = new javax.swing.JTextField();
txt_lastname = new javax.swing.JTextField();
txt_address = new javax.swing.JTextField();
btn_save = new javax.swing.JToggleButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
btn_save.setText("Save");
btn_save.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_saveActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(227, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txt_name, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
.addComponent(txt_lastname)
.addComponent(txt_address))
.addGap(49, 49, 49))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(btn_save)
.addGap(21, 21, 21))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(63, 63, 63)
.addComponent(txt_name, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(txt_lastname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(txt_address, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(35, 35, 35)
.addComponent(btn_save)
.addContainerGap(83, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btn_saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_saveActionPerformed
// try {
// String bid=txt_name.getText();
// String sid=txt_lastname.getText();
// String date=txt_address.getText();
//
// BatchDTO batch=new BatchDTO(bid,sid,date);
//
// boolean success=ManageBatchController.batchDAO.add(batch);
//
//
// if(success){
//
// JOptionPane.showMessageDialog(this, " Successfully added ");
// }else{
//
// JOptionPane.showMessageDialog(this, "PLEASE RECHECK THE CODE AGAIN");
//
// }
// } catch (Exception ex) {
// Logger.getLogger(Employee.class.getName()).log(Level.SEVERE, null, ex);
// }
}//GEN-LAST:event_btn_saveActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Employee.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Employee.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Employee.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Employee.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Employee().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JToggleButton btn_save;
private javax.swing.JPanel jPanel1;
private javax.swing.JTextField txt_address;
private javax.swing.JTextField txt_lastname;
private javax.swing.JTextField txt_name;
// End of variables declaration//GEN-END:variables
}
|
UTF-8
|
Java
| 7,410 |
java
|
Employee.java
|
Java
|
[
{
"context": "isupermarket.core.dto.BatchDTO;\n\n/**\n *\n * @author Hafees\n */\npublic class Employee extends javax.swing.JFr",
"end": 464,
"score": 0.9623849987983704,
"start": 458,
"tag": "NAME",
"value": "Hafees"
}
] | 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 lk.ijse.asirisupermarket.view;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import lk.ijse.asirisupermarket.controller.ManageBatchController;
import lk.ijse.asirisupermarket.core.dto.BatchDTO;
/**
*
* @author Hafees
*/
public class Employee extends javax.swing.JFrame {
/**
* Creates new form Employee
*/
public Employee() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
txt_name = new javax.swing.JTextField();
txt_lastname = new javax.swing.JTextField();
txt_address = new javax.swing.JTextField();
btn_save = new javax.swing.JToggleButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
btn_save.setText("Save");
btn_save.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_saveActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap(227, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txt_name, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
.addComponent(txt_lastname)
.addComponent(txt_address))
.addGap(49, 49, 49))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(btn_save)
.addGap(21, 21, 21))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(63, 63, 63)
.addComponent(txt_name, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(txt_lastname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(txt_address, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(35, 35, 35)
.addComponent(btn_save)
.addContainerGap(83, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btn_saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_saveActionPerformed
// try {
// String bid=txt_name.getText();
// String sid=txt_lastname.getText();
// String date=txt_address.getText();
//
// BatchDTO batch=new BatchDTO(bid,sid,date);
//
// boolean success=ManageBatchController.batchDAO.add(batch);
//
//
// if(success){
//
// JOptionPane.showMessageDialog(this, " Successfully added ");
// }else{
//
// JOptionPane.showMessageDialog(this, "PLEASE RECHECK THE CODE AGAIN");
//
// }
// } catch (Exception ex) {
// Logger.getLogger(Employee.class.getName()).log(Level.SEVERE, null, ex);
// }
}//GEN-LAST:event_btn_saveActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Employee.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Employee.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Employee.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Employee.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Employee().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JToggleButton btn_save;
private javax.swing.JPanel jPanel1;
private javax.swing.JTextField txt_address;
private javax.swing.JTextField txt_lastname;
private javax.swing.JTextField txt_name;
// End of variables declaration//GEN-END:variables
}
| 7,410 | 0.635088 | 0.626586 | 161 | 45.024845 | 38.670925 | 183 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.614907 | false | false |
12
|
c655d880710aef060edb706192f9154bfb16b444
| 38,345,468,050,346 |
23109e5c1b3fd40b58b3672fda094eb6987f0657
|
/src/main/java/com/dongguan/trip/modules/sys/repository/TgEntityRepository.java
|
3f31a68ba7df692717f751744b53d70090d16ae3
|
[] |
no_license
|
shisismile/trip
|
https://github.com/shisismile/trip
|
f09fd12ad1c40ec89b0ce683d2cc3af95d2dcd03
|
f0bfb1dee17046ab48310873a7a1bd7bcb17d9ca
|
refs/heads/master
| 2020-05-04T23:17:15.159000 | 2019-04-26T05:23:37 | 2019-04-26T05:23:37 | 179,538,945 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.dongguan.trip.modules.sys.repository;
import com.dongguan.trip.modules.sys.entity.TgEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface TgEntityRepository extends JpaRepository<TgEntity, Long>,JpaSpecificationExecutor<TgEntity> {
@Query(value = "select * from sys_tg where active=?1 limit 0,4",nativeQuery = true)
List<TgEntity> findAllWithCondition(Integer active);
}
|
UTF-8
|
Java
| 640 |
java
|
TgEntityRepository.java
|
Java
|
[] | null |
[] |
package com.dongguan.trip.modules.sys.repository;
import com.dongguan.trip.modules.sys.entity.TgEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface TgEntityRepository extends JpaRepository<TgEntity, Long>,JpaSpecificationExecutor<TgEntity> {
@Query(value = "select * from sys_tg where active=?1 limit 0,4",nativeQuery = true)
List<TgEntity> findAllWithCondition(Integer active);
}
| 640 | 0.820313 | 0.815625 | 16 | 39 | 33.911652 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false |
12
|
20bd32ba23dd1d3ec2cdde210003ed81b6a51e19
| 18,992,345,406,106 |
c9a0aa86b0705f593152567d0179b0701beea3a5
|
/javafour/src/com/lixin/ch1/Emp.java
|
1067a98dea038871fcafb942b327b76212723f24
|
[] |
no_license
|
dagf113225/javase
|
https://github.com/dagf113225/javase
|
10360af98a666ccf59900dc447dceb65961065be
|
308945826581a62d4862788c2155a883b6873ea9
|
refs/heads/master
| 2020-04-04T16:29:57.544000 | 2018-12-19T08:59:44 | 2018-12-19T08:59:44 | 156,080,651 | 2 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.lixin.ch1;
public class Emp extends Person
{
Emp(String name, int age)
{
super(name, age);
// TODO Auto-generated constructor stub
}
@Override
public void content()
{
// TODO Auto-generated method stub
System.out.println(this.name+",工人说,我的年龄是:"+this.age);
}
}
|
GB18030
|
Java
| 308 |
java
|
Emp.java
|
Java
|
[] | null |
[] |
package com.lixin.ch1;
public class Emp extends Person
{
Emp(String name, int age)
{
super(name, age);
// TODO Auto-generated constructor stub
}
@Override
public void content()
{
// TODO Auto-generated method stub
System.out.println(this.name+",工人说,我的年龄是:"+this.age);
}
}
| 308 | 0.681507 | 0.678082 | 19 | 14.368421 | 16.585379 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.157895 | false | false |
12
|
aca099744b10a120ce339dfa0630cd293f3f2cec
| 26,809,185,872,668 |
f737803dc09f8111f1d1addac8917addf00cf5b6
|
/day16_shiro/src/main/java/com/yuanheng/openAdminPlatform/mapper/AdminUserMapper.java
|
3565d64506ca15b3a764af14f8471566d1e482bc
|
[] |
no_license
|
yuanhengwcn/Design
|
https://github.com/yuanhengwcn/Design
|
cc2d136c20f4632110487b2ec4b1417a454f8c55
|
fc97e6c25f1a74b58c26b8d733cca4f6ac98b33b
|
refs/heads/master
| 2023-01-04T05:23:12.738000 | 2020-10-29T12:52:30 | 2020-10-29T12:52:30 | 303,057,836 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.yuanheng.openAdminPlatform.mapper;
import com.yuanheng.openAdminPlatform.pojo.AdminUser;
import com.yuanheng.openAdminPlatform.pojo.AdminUserExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @BelongsProject: Design
* @BelongsPackage: com.yuanheng.openAdminPlatform.mapper
* @Author: yuanhengwcn@gmail.com
* @CreateTime: 2020-10-29 15:52
*/
public interface AdminUserMapper {
long countByExample(AdminUserExample example);
int deleteByExample(AdminUserExample example);
int deleteByPrimaryKey(Integer id);
int insert(AdminUser record);
int insertSelective(AdminUser record);
List<AdminUser> selectByExample(AdminUserExample example);
AdminUser selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") AdminUser record, @Param("example") AdminUserExample example);
int updateByExample(@Param("record") AdminUser record, @Param("example") AdminUserExample example);
int updateByPrimaryKeySelective(AdminUser record);
int updateByPrimaryKey(AdminUser record);
}
|
UTF-8
|
Java
| 1,086 |
java
|
AdminUserMapper.java
|
Java
|
[
{
"context": " com.yuanheng.openAdminPlatform.mapper\n * @Author: yuanhengwcn@gmail.com\n * @CreateTime: 2020-10-29 15:52\n */\npublic inter",
"end": 354,
"score": 0.9999233484268188,
"start": 333,
"tag": "EMAIL",
"value": "yuanhengwcn@gmail.com"
}
] | null |
[] |
package com.yuanheng.openAdminPlatform.mapper;
import com.yuanheng.openAdminPlatform.pojo.AdminUser;
import com.yuanheng.openAdminPlatform.pojo.AdminUserExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @BelongsProject: Design
* @BelongsPackage: com.yuanheng.openAdminPlatform.mapper
* @Author: <EMAIL>
* @CreateTime: 2020-10-29 15:52
*/
public interface AdminUserMapper {
long countByExample(AdminUserExample example);
int deleteByExample(AdminUserExample example);
int deleteByPrimaryKey(Integer id);
int insert(AdminUser record);
int insertSelective(AdminUser record);
List<AdminUser> selectByExample(AdminUserExample example);
AdminUser selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") AdminUser record, @Param("example") AdminUserExample example);
int updateByExample(@Param("record") AdminUser record, @Param("example") AdminUserExample example);
int updateByPrimaryKeySelective(AdminUser record);
int updateByPrimaryKey(AdminUser record);
}
| 1,072 | 0.779006 | 0.767956 | 38 | 27.578947 | 29.24725 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.473684 | false | false |
12
|
5575a52a812861612fae3ced4873eca305aaf587
| 26,809,185,871,122 |
09e08059bde6e7f7eeee95c65464a67a3d97dd42
|
/src/main/java/application/service/AvoirBudgetProjetDao.java
|
9c753070fc5f2655e66e3c12262a2c4fe1f6b09f
|
[] |
no_license
|
ikrambahmed/back_PFE
|
https://github.com/ikrambahmed/back_PFE
|
2ecdd3355e42ee512c9d1b991ee358d6accb4d13
|
e1e991b49674359609c1019eee4b6ff67eb9bb1c
|
refs/heads/master
| 2023-04-08T12:47:48.339000 | 2019-05-31T11:33:01 | 2019-05-31T11:33:01 | 188,308,614 | 0 | 0 | null | false | 2023-03-27T22:15:22 | 2019-05-23T21:23:02 | 2019-05-31T11:33:45 | 2023-03-27T22:15:18 | 187 | 0 | 0 | 2 |
Java
| false | false |
package application.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import application.model.AvoirBudget;
import application.model.AvoirBudgetProjet;
import application.repository.AvoirBudgetProjetRepository;
@Service
@Primary
public class AvoirBudgetProjetDao implements IAvoirBudgetProjet{
@Autowired
AvoirBudgetProjetRepository avoirBudgetRep ;
@Override
public List<AvoirBudgetProjet> findAll() {
return avoirBudgetRep.findAll();
}
public List<AvoirBudgetProjet> getbugetPBydept(String code) {
return avoirBudgetRep.findBugetPByDept(code);
}
@Override
public AvoirBudgetProjet addBudgetProjet(AvoirBudgetProjet a) {
return avoirBudgetRep.save(a) ;
}
public AvoirBudgetProjet updateBudgetProjet(AvoirBudgetProjet a) {
// TODO Auto-generated method stub
return avoirBudgetRep.save(a);
}
}
|
UTF-8
|
Java
| 959 |
java
|
AvoirBudgetProjetDao.java
|
Java
|
[] | null |
[] |
package application.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import application.model.AvoirBudget;
import application.model.AvoirBudgetProjet;
import application.repository.AvoirBudgetProjetRepository;
@Service
@Primary
public class AvoirBudgetProjetDao implements IAvoirBudgetProjet{
@Autowired
AvoirBudgetProjetRepository avoirBudgetRep ;
@Override
public List<AvoirBudgetProjet> findAll() {
return avoirBudgetRep.findAll();
}
public List<AvoirBudgetProjet> getbugetPBydept(String code) {
return avoirBudgetRep.findBugetPByDept(code);
}
@Override
public AvoirBudgetProjet addBudgetProjet(AvoirBudgetProjet a) {
return avoirBudgetRep.save(a) ;
}
public AvoirBudgetProjet updateBudgetProjet(AvoirBudgetProjet a) {
// TODO Auto-generated method stub
return avoirBudgetRep.save(a);
}
}
| 959 | 0.831074 | 0.831074 | 35 | 26.428572 | 23.509617 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.657143 | false | false |
12
|
62b23ce658358dd5d2e27a58d010cdae5a402663
| 29,540,785,068,388 |
52e364c61206c25ad06bc503171fb48e9a0d6e89
|
/Lista 5/Zadanie2E/src/pakiet/Stala.java
|
a5606a54c07b7be8d2124c471eff2c440cb27cf0
|
[] |
no_license
|
MariuszBielecki288728/PO-II
|
https://github.com/MariuszBielecki288728/PO-II
|
ba8013ff9adedc98d51f807120b625afe2ca30b3
|
447ed97e0ca9e3b5567436c1e623a75b66c29110
|
refs/heads/master
| 2021-03-22T03:35:21.690000 | 2017-06-23T15:56:04 | 2017-06-23T15:56:04 | 86,098,143 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package pakiet;
public class Stala extends Wyrazenie{
int x;
Stala(int x){
this.x = x;
}
public String toString(){
return ""+x;
}
public int oblicz(){
return this.x;
}
}
|
UTF-8
|
Java
| 184 |
java
|
Stala.java
|
Java
|
[] | null |
[] |
package pakiet;
public class Stala extends Wyrazenie{
int x;
Stala(int x){
this.x = x;
}
public String toString(){
return ""+x;
}
public int oblicz(){
return this.x;
}
}
| 184 | 0.63587 | 0.63587 | 14 | 12.142858 | 10.439329 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.285714 | false | false |
12
|
334c9fa0611bd786c389aa2ad7a362b5fca5569b
| 1,391,569,411,026 |
af8a6e2014736aba023cf915d0615f9d6d2a71bc
|
/src/test/java/com/course/lessons/ui/RozetkaTest.java
|
ed2afdde1a975989f699289750caa1ad9bf30ef7
|
[] |
no_license
|
dkaravashkin/qa_automation_courses
|
https://github.com/dkaravashkin/qa_automation_courses
|
de76d17b2e81096e56f4b5761e8b33cf63e3fab6
|
df8624aab6069487c469d1636e0d091933b35020
|
refs/heads/main
| 2023-02-28T20:58:24.412000 | 2021-02-08T20:38:31 | 2021-02-08T20:38:31 | 317,311,131 | 0 | 0 | null | false | 2020-12-07T17:45:57 | 2020-11-30T18:27:49 | 2020-12-07T17:35:32 | 2020-12-07T17:45:57 | 6 | 0 | 0 | 0 |
Java
| false | false |
package com.course.lessons.ui;
import com.course.lessons.BaseTest;
import com.course.pageobjects.rozetka.pages.CheckoutPage;
import com.course.pageobjects.rozetka.pages.RozetkaNotebooksPage;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class RozetkaTest extends BaseTest {
@Test
public void loginTest() {
rozetkaHomePage.getPage();
rozetkaHomePage.pressLogin();
rozetkaHomePage.signInComponent.login(userName, password);
System.out.println("User Name: " + userName + " " + "Password: " + password);
}
/* @Test
public void buySmth() throws InterruptedException {
rozetkaHomePage.getPage();
RozetkaNotebooksPage rozetkaNotebooksPage = rozetkaHomePage.openNotebooksCategory();
rozetkaNotebooksPage.filterProducts();
rozetkaNotebooksPage.selectMacBook();
rozetkaNotebooksPage.productComponent.buyProduct();
CheckoutPage checkoutPage = rozetkaNotebooksPage.basketComponent.clickSubmitButton();
Assert.assertEquals("Оформлення замовлення", checkoutPage.getCheckoutHeading());
}*/
}
|
UTF-8
|
Java
| 1,179 |
java
|
RozetkaTest.java
|
Java
|
[
{
"context": "sword);\n System.out.println(\"User Name: \" + userName + \" \" + \"Password: \" + password);\n }\n\n/* @T",
"end": 575,
"score": 0.872699499130249,
"start": 567,
"tag": "USERNAME",
"value": "userName"
}
] | null |
[] |
package com.course.lessons.ui;
import com.course.lessons.BaseTest;
import com.course.pageobjects.rozetka.pages.CheckoutPage;
import com.course.pageobjects.rozetka.pages.RozetkaNotebooksPage;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
public class RozetkaTest extends BaseTest {
@Test
public void loginTest() {
rozetkaHomePage.getPage();
rozetkaHomePage.pressLogin();
rozetkaHomePage.signInComponent.login(userName, password);
System.out.println("User Name: " + userName + " " + "Password: " + password);
}
/* @Test
public void buySmth() throws InterruptedException {
rozetkaHomePage.getPage();
RozetkaNotebooksPage rozetkaNotebooksPage = rozetkaHomePage.openNotebooksCategory();
rozetkaNotebooksPage.filterProducts();
rozetkaNotebooksPage.selectMacBook();
rozetkaNotebooksPage.productComponent.buyProduct();
CheckoutPage checkoutPage = rozetkaNotebooksPage.basketComponent.clickSubmitButton();
Assert.assertEquals("Оформлення замовлення", checkoutPage.getCheckoutHeading());
}*/
}
| 1,179 | 0.742019 | 0.742019 | 30 | 37.633335 | 28.602428 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
12
|
e520fe175fea72a428d7e8f60ca68c25e36b2543
| 22,256,520,568,157 |
af6410ed46dd5a4879684f708317deb6c3622127
|
/src/main/java/com/zqx/utils/MySpecialListener.java
|
c7b4c3710e50631460a4848f30278ff2db185245
|
[] |
no_license
|
13600418432/SSM-CRUD
|
https://github.com/13600418432/SSM-CRUD
|
2018833c71dc070215e9147701ee2d4486b9d78e
|
a09fa12760cc3020662102922ecf92f599346a54
|
refs/heads/master
| 2023-06-06T16:49:35.618000 | 2021-07-20T14:14:04 | 2021-07-20T14:14:04 | 387,813,354 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zqx.utils;
import com.mysql.cj.jdbc.AbandonedConnectionCleanupThread;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Enumeration;
public class MySpecialListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent sce) {
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
AbandonedConnectionCleanupThread.checkedShutdown();
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Enumeration<Driver> drivers = DriverManager.getDrivers();
while (drivers.hasMoreElements()){
Driver driver = drivers.nextElement();
if (driver.getClass().getClassLoader() == loader){
try {
System.out.println("Deregistering JDBC driver {}");
DriverManager.deregisterDriver(driver);
} catch (SQLException e) {
System.out.println("Error deregistering JDBC driver {}");
e.printStackTrace();
}
}else {
System.out.println("Not deregistering JDBC driver {} as it does not belong to this webapp's ClassLoader");
}
}
}
}
|
UTF-8
|
Java
| 1,383 |
java
|
MySpecialListener.java
|
Java
|
[] | null |
[] |
package com.zqx.utils;
import com.mysql.cj.jdbc.AbandonedConnectionCleanupThread;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Enumeration;
public class MySpecialListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent sce) {
}
@Override
public void contextDestroyed(ServletContextEvent sce) {
AbandonedConnectionCleanupThread.checkedShutdown();
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Enumeration<Driver> drivers = DriverManager.getDrivers();
while (drivers.hasMoreElements()){
Driver driver = drivers.nextElement();
if (driver.getClass().getClassLoader() == loader){
try {
System.out.println("Deregistering JDBC driver {}");
DriverManager.deregisterDriver(driver);
} catch (SQLException e) {
System.out.println("Error deregistering JDBC driver {}");
e.printStackTrace();
}
}else {
System.out.println("Not deregistering JDBC driver {} as it does not belong to this webapp's ClassLoader");
}
}
}
}
| 1,383 | 0.652205 | 0.652205 | 40 | 33.575001 | 28.749685 | 122 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.425 | false | false |
12
|
6b761b1c8efc4ceb50a6ff090afc6c5504eabc73
| 12,180,527,253,782 |
b0f70c8a4de2bb61e502ac9ade71e58f09139ec8
|
/src/test/java/com/noctarius/snowcast/SnowcastSequenceUtilsTestCase.java
|
15ad3ed4fe9d52e869b94076a47f27f3a7816b24
|
[
"Apache-2.0"
] |
permissive
|
noctarius/snowcast
|
https://github.com/noctarius/snowcast
|
229748b691e4ca96d33ac9f55e383d9ddb99b16b
|
5f4fd2636a0881127b8ffb0ed4337a913e2ad1bc
|
refs/heads/master
| 2020-04-09T02:37:24.664000 | 2017-02-08T07:17:15 | 2017-02-08T07:17:15 | 27,859,802 | 55 | 18 |
Apache-2.0
| false | 2018-03-04T20:47:15 | 2014-12-11T07:40:44 | 2018-02-21T14:28:25 | 2017-11-27T12:29:54 | 1,279 | 48 | 14 | 5 |
Java
| false | null |
/*
* Copyright (c) 2015-2017, Christoph Engelbert (aka noctarius) and
* contributors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.noctarius.snowcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.test.HazelcastTestSupport;
import com.hazelcast.test.TestHazelcastInstanceFactory;
import com.noctarius.snowcast.impl.SnowcastConstants;
import org.junit.Test;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.Comparator;
import static com.noctarius.snowcast.impl.InternalSequencerUtils.*;
import static junit.framework.TestCase.assertEquals;
public class SnowcastSequenceUtilsTestCase
extends HazelcastTestSupport {
@Test
public void test_compareSequence_first_higher_by_timestamp() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(9999, 1, 1, shifting);
assertEquals(1, SnowcastSequenceUtils.compareSequence(sequence1, sequence2));
}
@Test
public void test_compareSequence_first_lower_by_timestamp() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(10001, 1, 1, shifting);
assertEquals(-1, SnowcastSequenceUtils.compareSequence(sequence1, sequence2));
}
@Test
public void test_compareSequence_first_higher_by_counter() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 2, shifting);
long sequence2 = generateSequenceId(10000, 1, 1, shifting);
assertEquals(1, SnowcastSequenceUtils.compareSequence(sequence1, sequence2));
}
@Test
public void test_compareSequence_first_lower_by_counter() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(10000, 1, 2, shifting);
assertEquals(-1, SnowcastSequenceUtils.compareSequence(sequence1, sequence2));
}
@Test
public void test_compareSequence_equal() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(10000, 2, 1, shifting);
assertEquals(0, SnowcastSequenceUtils.compareSequence(sequence1, sequence2));
}
@Test
public void test_compareTimestamp_first_higher_by_timestamp() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(9999, 1, 1, shifting);
assertEquals(1, SnowcastSequenceUtils.compareTimestamp(sequence1, sequence2));
}
@Test
public void test_compareTimestamp_first_lower_by_timestamp() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(10001, 1, 1, shifting);
assertEquals(-1, SnowcastSequenceUtils.compareTimestamp(sequence1, sequence2));
}
@Test
public void test_compareTimestamp_equal() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(10000, 2, 1, shifting);
assertEquals(0, SnowcastSequenceUtils.compareTimestamp(sequence1, sequence2));
}
@Test
public void test_couter_value() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence = generateSequenceId(10000, 1, 100, shifting);
assertEquals(100, SnowcastSequenceUtils.counterValue(sequence));
}
@Test(expected = SnowcastException.class)
public void test_couter_value_exception_too_large() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
generateSequenceId(10000, 1, 1025, shifting);
}
@Test
public void test_logical_node_id() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence = generateSequenceId(10000, 100, 1, shifting);
assertEquals(100, SnowcastSequenceUtils.logicalNodeId(sequence));
}
@Test
public void test_timestamp_value() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence = generateSequenceId(10000, 100, 1, shifting);
assertEquals(10000, SnowcastSequenceUtils.timestampValue(sequence));
}
@Test
public void test_comparator_first_higher_by_timestamp()
throws Exception {
TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
HazelcastInstance hazelcastInstance = factory.newHazelcastInstance();
try {
Snowcast snowcast = SnowcastSystem.snowcast(hazelcastInstance);
SnowcastSequencer sequencer = buildSnowcastSequencer(snowcast);
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(9999, 1, 1, shifting);
Comparator<Long> comparator = SnowcastSequenceUtils.snowcastSequenceComparator(sequencer);
assertEquals(1, comparator.compare(sequence1, sequence2));
} finally {
factory.shutdownAll();
}
}
@Test
public void test_comparator_first_lower_by_timestamp()
throws Exception {
TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
HazelcastInstance hazelcastInstance = factory.newHazelcastInstance();
try {
Snowcast snowcast = SnowcastSystem.snowcast(hazelcastInstance);
SnowcastSequencer sequencer = buildSnowcastSequencer(snowcast);
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(10001, 1, 1, shifting);
Comparator<Long> comparator = SnowcastSequenceUtils.snowcastSequenceComparator(sequencer);
assertEquals(-1, comparator.compare(sequence1, sequence2));
} finally {
factory.shutdownAll();
}
}
@Test
public void test_comparator_first_higher_by_counter()
throws Exception {
TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
HazelcastInstance hazelcastInstance = factory.newHazelcastInstance();
try {
Snowcast snowcast = SnowcastSystem.snowcast(hazelcastInstance);
SnowcastSequencer sequencer = buildSnowcastSequencer(snowcast);
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 2, shifting);
long sequence2 = generateSequenceId(10000, 1, 1, shifting);
Comparator<Long> comparator = SnowcastSequenceUtils.snowcastSequenceComparator(sequencer);
assertEquals(1, comparator.compare(sequence1, sequence2));
} finally {
factory.shutdownAll();
}
}
@Test
public void test_comparator_first_lower_by_counter()
throws Exception {
TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
HazelcastInstance hazelcastInstance = factory.newHazelcastInstance();
try {
Snowcast snowcast = SnowcastSystem.snowcast(hazelcastInstance);
SnowcastSequencer sequencer = buildSnowcastSequencer(snowcast);
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(10000, 1, 2, shifting);
Comparator<Long> comparator = SnowcastSequenceUtils.snowcastSequenceComparator(sequencer);
assertEquals(-1, comparator.compare(sequence1, sequence2));
} finally {
factory.shutdownAll();
}
}
@Test
public void test_comparator_equal()
throws Exception {
TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
HazelcastInstance hazelcastInstance = factory.newHazelcastInstance();
try {
Snowcast snowcast = SnowcastSystem.snowcast(hazelcastInstance);
SnowcastSequencer sequencer = buildSnowcastSequencer(snowcast);
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(10000, 2, 1, shifting);
Comparator<Long> comparator = SnowcastSequenceUtils.snowcastSequenceComparator(sequencer);
assertEquals(0, comparator.compare(sequence1, sequence2));
} finally {
factory.shutdownAll();
}
}
private SnowcastSequencer buildSnowcastSequencer(Snowcast snowcast) {
// Build the custom epoch
SnowcastEpoch epoch = buildEpoch();
return buildSnowcastSequencer(snowcast, epoch);
}
private SnowcastSequencer buildSnowcastSequencer(Snowcast snowcast, SnowcastEpoch epoch) {
String sequencerName = "SimpleSequencer";
int maxLogicalNodeCount = SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS;
// Create a sequencer for ID generation
return snowcast.createSequencer(sequencerName, epoch, maxLogicalNodeCount);
}
private SnowcastEpoch buildEpoch() {
ZonedDateTime utc = ZonedDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC);
return SnowcastEpoch.byInstant(utc.toInstant());
}
}
|
UTF-8
|
Java
| 12,588 |
java
|
SnowcastSequenceUtilsTestCase.java
|
Java
|
[
{
"context": "/*\n * Copyright (c) 2015-2017, Christoph Engelbert (aka noctarius) and\n * contributors. All rights r",
"end": 50,
"score": 0.9998486638069153,
"start": 31,
"tag": "NAME",
"value": "Christoph Engelbert"
}
] | null |
[] |
/*
* Copyright (c) 2015-2017, <NAME> (aka noctarius) and
* contributors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.noctarius.snowcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.test.HazelcastTestSupport;
import com.hazelcast.test.TestHazelcastInstanceFactory;
import com.noctarius.snowcast.impl.SnowcastConstants;
import org.junit.Test;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.Comparator;
import static com.noctarius.snowcast.impl.InternalSequencerUtils.*;
import static junit.framework.TestCase.assertEquals;
public class SnowcastSequenceUtilsTestCase
extends HazelcastTestSupport {
@Test
public void test_compareSequence_first_higher_by_timestamp() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(9999, 1, 1, shifting);
assertEquals(1, SnowcastSequenceUtils.compareSequence(sequence1, sequence2));
}
@Test
public void test_compareSequence_first_lower_by_timestamp() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(10001, 1, 1, shifting);
assertEquals(-1, SnowcastSequenceUtils.compareSequence(sequence1, sequence2));
}
@Test
public void test_compareSequence_first_higher_by_counter() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 2, shifting);
long sequence2 = generateSequenceId(10000, 1, 1, shifting);
assertEquals(1, SnowcastSequenceUtils.compareSequence(sequence1, sequence2));
}
@Test
public void test_compareSequence_first_lower_by_counter() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(10000, 1, 2, shifting);
assertEquals(-1, SnowcastSequenceUtils.compareSequence(sequence1, sequence2));
}
@Test
public void test_compareSequence_equal() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(10000, 2, 1, shifting);
assertEquals(0, SnowcastSequenceUtils.compareSequence(sequence1, sequence2));
}
@Test
public void test_compareTimestamp_first_higher_by_timestamp() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(9999, 1, 1, shifting);
assertEquals(1, SnowcastSequenceUtils.compareTimestamp(sequence1, sequence2));
}
@Test
public void test_compareTimestamp_first_lower_by_timestamp() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(10001, 1, 1, shifting);
assertEquals(-1, SnowcastSequenceUtils.compareTimestamp(sequence1, sequence2));
}
@Test
public void test_compareTimestamp_equal() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(10000, 2, 1, shifting);
assertEquals(0, SnowcastSequenceUtils.compareTimestamp(sequence1, sequence2));
}
@Test
public void test_couter_value() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence = generateSequenceId(10000, 1, 100, shifting);
assertEquals(100, SnowcastSequenceUtils.counterValue(sequence));
}
@Test(expected = SnowcastException.class)
public void test_couter_value_exception_too_large() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
generateSequenceId(10000, 1, 1025, shifting);
}
@Test
public void test_logical_node_id() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence = generateSequenceId(10000, 100, 1, shifting);
assertEquals(100, SnowcastSequenceUtils.logicalNodeId(sequence));
}
@Test
public void test_timestamp_value() {
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence = generateSequenceId(10000, 100, 1, shifting);
assertEquals(10000, SnowcastSequenceUtils.timestampValue(sequence));
}
@Test
public void test_comparator_first_higher_by_timestamp()
throws Exception {
TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
HazelcastInstance hazelcastInstance = factory.newHazelcastInstance();
try {
Snowcast snowcast = SnowcastSystem.snowcast(hazelcastInstance);
SnowcastSequencer sequencer = buildSnowcastSequencer(snowcast);
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(9999, 1, 1, shifting);
Comparator<Long> comparator = SnowcastSequenceUtils.snowcastSequenceComparator(sequencer);
assertEquals(1, comparator.compare(sequence1, sequence2));
} finally {
factory.shutdownAll();
}
}
@Test
public void test_comparator_first_lower_by_timestamp()
throws Exception {
TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
HazelcastInstance hazelcastInstance = factory.newHazelcastInstance();
try {
Snowcast snowcast = SnowcastSystem.snowcast(hazelcastInstance);
SnowcastSequencer sequencer = buildSnowcastSequencer(snowcast);
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(10001, 1, 1, shifting);
Comparator<Long> comparator = SnowcastSequenceUtils.snowcastSequenceComparator(sequencer);
assertEquals(-1, comparator.compare(sequence1, sequence2));
} finally {
factory.shutdownAll();
}
}
@Test
public void test_comparator_first_higher_by_counter()
throws Exception {
TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
HazelcastInstance hazelcastInstance = factory.newHazelcastInstance();
try {
Snowcast snowcast = SnowcastSystem.snowcast(hazelcastInstance);
SnowcastSequencer sequencer = buildSnowcastSequencer(snowcast);
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 2, shifting);
long sequence2 = generateSequenceId(10000, 1, 1, shifting);
Comparator<Long> comparator = SnowcastSequenceUtils.snowcastSequenceComparator(sequencer);
assertEquals(1, comparator.compare(sequence1, sequence2));
} finally {
factory.shutdownAll();
}
}
@Test
public void test_comparator_first_lower_by_counter()
throws Exception {
TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
HazelcastInstance hazelcastInstance = factory.newHazelcastInstance();
try {
Snowcast snowcast = SnowcastSystem.snowcast(hazelcastInstance);
SnowcastSequencer sequencer = buildSnowcastSequencer(snowcast);
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(10000, 1, 2, shifting);
Comparator<Long> comparator = SnowcastSequenceUtils.snowcastSequenceComparator(sequencer);
assertEquals(-1, comparator.compare(sequence1, sequence2));
} finally {
factory.shutdownAll();
}
}
@Test
public void test_comparator_equal()
throws Exception {
TestHazelcastInstanceFactory factory = new TestHazelcastInstanceFactory(1);
HazelcastInstance hazelcastInstance = factory.newHazelcastInstance();
try {
Snowcast snowcast = SnowcastSystem.snowcast(hazelcastInstance);
SnowcastSequencer sequencer = buildSnowcastSequencer(snowcast);
int boundedNodeCount = calculateBoundedMaxLogicalNodeCount(SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS);
int shifting = calculateLogicalNodeShifting(boundedNodeCount);
long sequence1 = generateSequenceId(10000, 1, 1, shifting);
long sequence2 = generateSequenceId(10000, 2, 1, shifting);
Comparator<Long> comparator = SnowcastSequenceUtils.snowcastSequenceComparator(sequencer);
assertEquals(0, comparator.compare(sequence1, sequence2));
} finally {
factory.shutdownAll();
}
}
private SnowcastSequencer buildSnowcastSequencer(Snowcast snowcast) {
// Build the custom epoch
SnowcastEpoch epoch = buildEpoch();
return buildSnowcastSequencer(snowcast, epoch);
}
private SnowcastSequencer buildSnowcastSequencer(Snowcast snowcast, SnowcastEpoch epoch) {
String sequencerName = "SimpleSequencer";
int maxLogicalNodeCount = SnowcastConstants.DEFAULT_MAX_LOGICAL_NODES_13_BITS;
// Create a sequencer for ID generation
return snowcast.createSequencer(sequencerName, epoch, maxLogicalNodeCount);
}
private SnowcastEpoch buildEpoch() {
ZonedDateTime utc = ZonedDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC);
return SnowcastEpoch.byInstant(utc.toInstant());
}
}
| 12,575 | 0.720051 | 0.691849 | 288 | 42.708332 | 37.539307 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.916667 | false | false |
12
|
9c3002a02ecfcb8f206539ee02f662fbacee9c55
| 2,851,858,347,347 |
73e063cce9604b2acc3df3af89755b6c187bdabe
|
/org.cumulus4j/org.cumulus4j.keymanager.back.shared/src/test/java/org/cumulus4j/keymanager/back/shared/test/IdentifierUtilTest.java
|
9dbc816253deb7d430b28aa70a92b2036128005e
|
[] |
no_license
|
cumulus4j/cumulus4j
|
https://github.com/cumulus4j/cumulus4j
|
27c27f5ea70a644c5043f60a75152373ecb35366
|
db5d88a801353f2651a291426cc2134d9c728347
|
refs/heads/master
| 2021-01-18T22:42:32.839000 | 2016-05-30T08:43:10 | 2016-05-30T08:43:10 | 24,971,251 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.cumulus4j.keymanager.back.shared.test;
import java.util.HashSet;
import java.util.Set;
import junit.framework.Assert;
import org.cumulus4j.keymanager.back.shared.IdentifierUtil;
import org.junit.Test;
public class IdentifierUtilTest {
/**
* This test generates multiple times a big bunch (100000) of random IDs with a certain length (8 characters) using
* {@link IdentifierUtil#createRandomID()}. It expects that there is no collision in each bunch.
*/
@Test
public void simpleUniquenessTest() {
// How many characters shall each randomID have?
final int randomIDLength = 8;
// How many randomIDs are generated (and must be unique) per run?
final int randomIDQtyPerRun = 100000;
// How many runs are performed?
final int runQty = 10;
for (int run = 0; run < runQty; ++run) {
Set<String> generated = new HashSet<String>(randomIDQtyPerRun);
for (int i = 0; i < randomIDQtyPerRun; ++i) {
String randomID = IdentifierUtil.createRandomID(randomIDLength);
if (!generated.add(randomID))
Assert.fail("Duplicate randomID! run=" + run + " i=" + i);
}
}
}
}
|
UTF-8
|
Java
| 1,114 |
java
|
IdentifierUtilTest.java
|
Java
|
[] | null |
[] |
package org.cumulus4j.keymanager.back.shared.test;
import java.util.HashSet;
import java.util.Set;
import junit.framework.Assert;
import org.cumulus4j.keymanager.back.shared.IdentifierUtil;
import org.junit.Test;
public class IdentifierUtilTest {
/**
* This test generates multiple times a big bunch (100000) of random IDs with a certain length (8 characters) using
* {@link IdentifierUtil#createRandomID()}. It expects that there is no collision in each bunch.
*/
@Test
public void simpleUniquenessTest() {
// How many characters shall each randomID have?
final int randomIDLength = 8;
// How many randomIDs are generated (and must be unique) per run?
final int randomIDQtyPerRun = 100000;
// How many runs are performed?
final int runQty = 10;
for (int run = 0; run < runQty; ++run) {
Set<String> generated = new HashSet<String>(randomIDQtyPerRun);
for (int i = 0; i < randomIDQtyPerRun; ++i) {
String randomID = IdentifierUtil.createRandomID(randomIDLength);
if (!generated.add(randomID))
Assert.fail("Duplicate randomID! run=" + run + " i=" + i);
}
}
}
}
| 1,114 | 0.71544 | 0.697487 | 36 | 29.944445 | 29.256475 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.694444 | false | false |
12
|
3683c1a79d33473add4dc119aa3f4c760107d2b3
| 6,322,191,860,246 |
d661dc74491613029701f8c36351c5ffb4e27b0b
|
/Cinema/src/GUI/CadastrarSessao.java
|
116a40fbf409c4ae6f37999b82b8f5b7a081dffb
|
[] |
no_license
|
rafael146/workufal
|
https://github.com/rafael146/workufal
|
d0d1b1507eab709dc67a056a5d6bee03231a9b67
|
f17de5dcfe057df28e956213737a95321693e848
|
refs/heads/master
| 2021-01-15T19:28:12.854000 | 2015-04-23T13:21:08 | 2015-04-23T13:21:08 | 34,455,348 | 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 GUI;
import CinemaDataBase.BancoFilme;
import CinemaDataBase.BancoSala;
import CinemaDataBase.BancoSessao;
import cinema.Filme;
import cinema.Sala;
import cinema.Sessao;
import cinema.User;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDesktopPane;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
/**
*
* @author lamp
*/
public class CadastrarSessao extends javax.swing.JInternalFrame {
/**
* Creates new form CadastrarSessao
*/
private User usuario;
private JMenuItem menuCadastroPropaganda;
private JDesktopPane jDesktopPane1;
private JMenuItem menuExibirFilmes;
public CadastrarSessao(JMenuItem jMenuItem3,JMenuItem jMenuItem11, User usuario, JDesktopPane painel) {
initComponents();
this.usuario=usuario;
this.menuCadastroPropaganda=jMenuItem3;
this.jDesktopPane1 = painel;
this.menuExibirFilmes=jMenuItem3;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabelFilme = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jLabelSala = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jFormattedTextFieldHorario = new javax.swing.JFormattedTextField();
jFormattedTextFieldData = new javax.swing.JFormattedTextField();
setIconifiable(true);
setMaximizable(true);
setTitle("CadastrarSessao");
jLabel1.setText("Filme:");
jLabel2.setText("Sala:");
jLabel3.setText("Horario:");
jLabel4.setText("Data:");
jLabelFilme.setText("__________________");
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/IMAGES/Search.png"))); // NOI18N
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jLabelSala.setText("__________________");
jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/IMAGES/Search.png"))); // NOI18N
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("Cadastrar");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setText("Cancelar");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
try {
jFormattedTextFieldHorario.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##:##")));
} catch (java.text.ParseException ex) {
ex.printStackTrace();
}
try {
jFormattedTextFieldData.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
} catch (java.text.ParseException ex) {
ex.printStackTrace();
}
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(49, 49, 49)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jLabel3))
.addGap(27, 27, 27)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jFormattedTextFieldHorario, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jFormattedTextFieldData, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addGap(32, 32, 32)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabelSala)
.addGap(27, 27, 27)
.addComponent(jButton2))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabelFilme)
.addGap(27, 27, 27)
.addComponent(jButton1))))))
.addContainerGap(107, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabelFilme))
.addComponent(jButton1))
.addGap(27, 27, 27)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabelSala))
.addComponent(jButton2))
.addGap(11, 11, 11)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jFormattedTextFieldHorario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jFormattedTextFieldData, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton3)
.addComponent(jButton4))
.addContainerGap(70, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
ExibirFilmes exibir = new ExibirFilmes(menuExibirFilmes, jLabelFilme);//passar o Menu para o construtor
jDesktopPane1.add(exibir);
menuExibirFilmes.setEnabled(false);
exibir.setVisible(true);
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
ExibirSalas exibir = new ExibirSalas(menuExibirFilmes, jLabelSala);//passar o Menu para o construtor
jDesktopPane1.add(exibir);
menuExibirFilmes.setEnabled(false);
exibir.setVisible(true);
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
Filme filme = new BancoFilme().getObject(jLabelFilme.getText().split(" / ")[1]);
Sala sala = new BancoSala().getObject(jLabelSala.getText().split(" / ")[0]);
String horario = jFormattedTextFieldHorario.getText().replace(":","");
String data = jFormattedTextFieldData.getText().replace("/", "");
Sessao sessao = new Sessao(filme, sala , horario, data, usuario);
new BancoSessao().saveObject(sessao);
JOptionPane.showMessageDialog(null, "Sessao cadastrada com sucesso!");
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
dispose();
menuCadastroPropaganda.setEnabled(true);
}//GEN-LAST:event_jButton4ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JFormattedTextField jFormattedTextFieldData;
private javax.swing.JFormattedTextField jFormattedTextFieldHorario;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabelFilme;
private javax.swing.JLabel jLabelSala;
// End of variables declaration//GEN-END:variables
}
|
UTF-8
|
Java
| 11,344 |
java
|
CadastrarSessao.java
|
Java
|
[
{
"context": "import javax.swing.JOptionPane;\n\n/**\n *\n * @author lamp\n */\npublic class CadastrarSessao extends javax.sw",
"end": 512,
"score": 0.9994721412658691,
"start": 508,
"tag": "USERNAME",
"value": "lamp"
}
] | null |
[] |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package GUI;
import CinemaDataBase.BancoFilme;
import CinemaDataBase.BancoSala;
import CinemaDataBase.BancoSessao;
import cinema.Filme;
import cinema.Sala;
import cinema.Sessao;
import cinema.User;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JDesktopPane;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
/**
*
* @author lamp
*/
public class CadastrarSessao extends javax.swing.JInternalFrame {
/**
* Creates new form CadastrarSessao
*/
private User usuario;
private JMenuItem menuCadastroPropaganda;
private JDesktopPane jDesktopPane1;
private JMenuItem menuExibirFilmes;
public CadastrarSessao(JMenuItem jMenuItem3,JMenuItem jMenuItem11, User usuario, JDesktopPane painel) {
initComponents();
this.usuario=usuario;
this.menuCadastroPropaganda=jMenuItem3;
this.jDesktopPane1 = painel;
this.menuExibirFilmes=jMenuItem3;
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabelFilme = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jLabelSala = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jFormattedTextFieldHorario = new javax.swing.JFormattedTextField();
jFormattedTextFieldData = new javax.swing.JFormattedTextField();
setIconifiable(true);
setMaximizable(true);
setTitle("CadastrarSessao");
jLabel1.setText("Filme:");
jLabel2.setText("Sala:");
jLabel3.setText("Horario:");
jLabel4.setText("Data:");
jLabelFilme.setText("__________________");
jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/IMAGES/Search.png"))); // NOI18N
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jLabelSala.setText("__________________");
jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/IMAGES/Search.png"))); // NOI18N
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jButton3.setText("Cadastrar");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jButton4.setText("Cancelar");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
try {
jFormattedTextFieldHorario.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##:##")));
} catch (java.text.ParseException ex) {
ex.printStackTrace();
}
try {
jFormattedTextFieldData.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
} catch (java.text.ParseException ex) {
ex.printStackTrace();
}
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(49, 49, 49)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jLabel3))
.addGap(27, 27, 27)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jFormattedTextFieldHorario, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jFormattedTextFieldData, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addGap(32, 32, 32)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabelSala)
.addGap(27, 27, 27)
.addComponent(jButton2))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabelFilme)
.addGap(27, 27, 27)
.addComponent(jButton1))))))
.addContainerGap(107, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabelFilme))
.addComponent(jButton1))
.addGap(27, 27, 27)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(jLabelSala))
.addComponent(jButton2))
.addGap(11, 11, 11)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(jFormattedTextFieldHorario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jFormattedTextFieldData, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton3)
.addComponent(jButton4))
.addContainerGap(70, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
ExibirFilmes exibir = new ExibirFilmes(menuExibirFilmes, jLabelFilme);//passar o Menu para o construtor
jDesktopPane1.add(exibir);
menuExibirFilmes.setEnabled(false);
exibir.setVisible(true);
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
ExibirSalas exibir = new ExibirSalas(menuExibirFilmes, jLabelSala);//passar o Menu para o construtor
jDesktopPane1.add(exibir);
menuExibirFilmes.setEnabled(false);
exibir.setVisible(true);
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
Filme filme = new BancoFilme().getObject(jLabelFilme.getText().split(" / ")[1]);
Sala sala = new BancoSala().getObject(jLabelSala.getText().split(" / ")[0]);
String horario = jFormattedTextFieldHorario.getText().replace(":","");
String data = jFormattedTextFieldData.getText().replace("/", "");
Sessao sessao = new Sessao(filme, sala , horario, data, usuario);
new BancoSessao().saveObject(sessao);
JOptionPane.showMessageDialog(null, "Sessao cadastrada com sucesso!");
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
dispose();
menuCadastroPropaganda.setEnabled(true);
}//GEN-LAST:event_jButton4ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JFormattedTextField jFormattedTextFieldData;
private javax.swing.JFormattedTextField jFormattedTextFieldHorario;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabelFilme;
private javax.swing.JLabel jLabelSala;
// End of variables declaration//GEN-END:variables
}
| 11,344 | 0.637694 | 0.62403 | 237 | 46.864979 | 36.933723 | 180 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.64557 | false | false |
12
|
c1b9913bb7191cdf7a4c51566ad3abaf13045554
| 6,322,191,862,850 |
fa91450deb625cda070e82d5c31770be5ca1dec6
|
/Diff-Raw-Data/27/27_230b8c8cdf6f60d96ff4a9ed9a722d70f6d56bbe/OpenImport/27_230b8c8cdf6f60d96ff4a9ed9a722d70f6d56bbe_OpenImport_s.java
|
4a4cfc970120f330fad7b636d8e4da8b540dcd18
|
[] |
no_license
|
zhongxingyu/Seer
|
https://github.com/zhongxingyu/Seer
|
48e7e5197624d7afa94d23f849f8ea2075bcaec0
|
c11a3109fdfca9be337e509ecb2c085b60076213
|
refs/heads/master
| 2023-07-06T12:48:55.516000 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | false | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | 2023-06-21T00:53:27 | 2023-06-22T07:55:57 | 2,849,868 | 2 | 2 | 0 | null | false | false |
/*
* Created on May 2, 2006
* by aavis
*
*/
package ca.strangebrew;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.List;
public class OpenImport {
private String fileType = "";
private Recipe myRecipe;
private List<Recipe> recipes = null;
private String checkFileType(File f) {
if (f.getPath().endsWith(".rec"))
return "promash";
// let's open it up and have a peek
// we'll only read 10 lines
if (f.getPath().endsWith(".qbrew") || (f.getPath().endsWith(".xml"))) {
try {
FileReader in = new FileReader(f);
BufferedReader inb = new BufferedReader(in);
String c;
int i = 0;
while ((c = inb.readLine()) != null && i < 10) {
if (c.indexOf("BeerXML Format") > -1)
return "beerxml";
if (c.indexOf("STRANGEBREWRECIPE") > -1)
return "sb";
if ((c.indexOf("generator=\"qbrew\"") > -1) || (c.indexOf("application=\"qbrew\"") > -1))
return "qbrew";
i++;
}
} catch (Exception e) {
e.printStackTrace();
}
}
return "";
}
public String getFileType() {
return fileType;
}
public List<Recipe> getRecipes() {
return recipes;
}
public Recipe openFile(File f) {
fileType = checkFileType(f);
Debug.print("File type: " + fileType);
if (fileType.equals("promash")) {
PromashImport imp = new PromashImport();
myRecipe = imp.readRecipe(f);
} else if (fileType.equals("sb") || fileType.equals("qbrew")) {
ImportXml imp = new ImportXml(f.toString(), "recipe");
myRecipe = imp.handler.getRecipe();
} else if (fileType.equals("beerxml")) {
ImportXml imp = new ImportXml(f.toString(), "beerXML");
myRecipe = imp.beerXmlHandler.getRecipe();
recipes = imp.beerXmlHandler.getRecipes();
} else {
// unrecognized type, just return a new blank recipe
myRecipe = new Recipe();
}
return myRecipe;
}
}
|
UTF-8
|
Java
| 1,960 |
java
|
27_230b8c8cdf6f60d96ff4a9ed9a722d70f6d56bbe_OpenImport_s.java
|
Java
|
[
{
"context": " /*\n * Created on May 2, 2006\n * by aavis\n *\n */\n package ca.strangebrew;\n \n import java.",
"end": 43,
"score": 0.9965529441833496,
"start": 38,
"tag": "USERNAME",
"value": "aavis"
}
] | null |
[] |
/*
* Created on May 2, 2006
* by aavis
*
*/
package ca.strangebrew;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.List;
public class OpenImport {
private String fileType = "";
private Recipe myRecipe;
private List<Recipe> recipes = null;
private String checkFileType(File f) {
if (f.getPath().endsWith(".rec"))
return "promash";
// let's open it up and have a peek
// we'll only read 10 lines
if (f.getPath().endsWith(".qbrew") || (f.getPath().endsWith(".xml"))) {
try {
FileReader in = new FileReader(f);
BufferedReader inb = new BufferedReader(in);
String c;
int i = 0;
while ((c = inb.readLine()) != null && i < 10) {
if (c.indexOf("BeerXML Format") > -1)
return "beerxml";
if (c.indexOf("STRANGEBREWRECIPE") > -1)
return "sb";
if ((c.indexOf("generator=\"qbrew\"") > -1) || (c.indexOf("application=\"qbrew\"") > -1))
return "qbrew";
i++;
}
} catch (Exception e) {
e.printStackTrace();
}
}
return "";
}
public String getFileType() {
return fileType;
}
public List<Recipe> getRecipes() {
return recipes;
}
public Recipe openFile(File f) {
fileType = checkFileType(f);
Debug.print("File type: " + fileType);
if (fileType.equals("promash")) {
PromashImport imp = new PromashImport();
myRecipe = imp.readRecipe(f);
} else if (fileType.equals("sb") || fileType.equals("qbrew")) {
ImportXml imp = new ImportXml(f.toString(), "recipe");
myRecipe = imp.handler.getRecipe();
} else if (fileType.equals("beerxml")) {
ImportXml imp = new ImportXml(f.toString(), "beerXML");
myRecipe = imp.beerXmlHandler.getRecipe();
recipes = imp.beerXmlHandler.getRecipes();
} else {
// unrecognized type, just return a new blank recipe
myRecipe = new Recipe();
}
return myRecipe;
}
}
| 1,960 | 0.604082 | 0.596939 | 79 | 23.797468 | 20.15659 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.455696 | false | false |
12
|
891c3b710d268e7461cb5cbac0871724e005c408
| 30,614,526,911,015 |
a07df5c3e191a3b383ffc4144cc3d884589ad09a
|
/app/src/main/java/ru/scientisttothefuture/myapplication/AnimalDao.java
|
a4a1f740d408c4bf5cec52ac30feb4d115e6cbdc
|
[] |
no_license
|
levvvchik/android
|
https://github.com/levvvchik/android
|
6b0ea2fe8660fba894d10a0894d54298d9b225e1
|
bd3d3b7b7a04457ab5140d2bd9ab27dd0de7fdaf
|
refs/heads/master
| 2020-04-07T20:29:46.684000 | 2018-12-14T13:28:15 | 2018-12-14T13:28:15 | 158,690,385 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ru.scientisttothefuture.myapplication;
import java.util.List;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
@Dao
public interface AnimalDao {
@Query("SELECT * FROM animals")
List<Animal> getAll();
@Query("SELECT * FROM animals WHERE id = :id")
Animal getById(long id);
@Insert
long insertAnimal(Animal animal);
}
|
UTF-8
|
Java
| 386 |
java
|
AnimalDao.java
|
Java
|
[] | null |
[] |
package ru.scientisttothefuture.myapplication;
import java.util.List;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
@Dao
public interface AnimalDao {
@Query("SELECT * FROM animals")
List<Animal> getAll();
@Query("SELECT * FROM animals WHERE id = :id")
Animal getById(long id);
@Insert
long insertAnimal(Animal animal);
}
| 386 | 0.717617 | 0.717617 | 19 | 19.368422 | 16.361734 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421053 | false | false |
12
|
4beee84052f505407c372e9405b9fbaae69d7848
| 25,615,184,954,730 |
3258fe74d823ee6935d88dbd3d742665d9b68932
|
/src/main/java/observable/TestCondition.java
|
f65e6edc3b6c81597830d58dd944599140e0f0ed
|
[] |
no_license
|
Pantsu-It/RxJavaPractice
|
https://github.com/Pantsu-It/RxJavaPractice
|
2086721399b2f36849f454de14334cf5c77775a0
|
9eb474c7a76789c536230ceb1d0caffce8a12fbc
|
refs/heads/master
| 2022-12-24T15:53:22.142000 | 2020-09-29T10:25:57 | 2020-09-29T10:25:57 | 299,581,030 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package observable;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
public class TestCondition {
public static void main(String[] args) throws Exception {
// only first observable emits all data-stream
// amb();
// defaultIfEmpty();
switchIfEmpty();
// skip();
// skipWhileAndUtil();
// take();
// takeWhileAndUtil();
Thread.sleep(100000);
}
private static void takeWhileAndUtil() {
Observable
.intervalRange(1, 20, 0, 200, TimeUnit.MILLISECONDS)
.takeWhile(longValue -> longValue < 10)
.takeUntil(longValue -> longValue == 9)
.takeUntil(Observable.timer(1, TimeUnit.SECONDS))
.subscribe(value -> System.out.print(value + " "));
}
private static void take() {
Observable
.intervalRange(1, 20, 0, 200, TimeUnit.MILLISECONDS)
// take与takeLast互斥
.take(5)
// .takeLast(5)
.subscribe(value -> System.out.print(value + " "));
}
private static void amb() throws Exception {
Observable
.amb(
((Callable<Iterable<Observable<Object>>>) () -> {
List<Observable<Object>> list = new ArrayList<>();
list.add(Observable
.range(0, 10)
.cast(Object.class)
.delay(1, TimeUnit.MILLISECONDS)
);
list.add(Observable
.range(-10, 10)
.cast(Object.class)
.delay(2, TimeUnit.MILLISECONDS)
);
return list;
}).call()
)
.subscribe(value -> System.out.print(value + " "));
}
private static void defaultIfEmpty() {
Observable
.empty()
.defaultIfEmpty("it is default-item")
.subscribe(value -> System.out.print(value + " "));
}
private static void switchIfEmpty() {
Observable
.empty()
.switchIfEmpty(Observable.timer(2000, TimeUnit.MILLISECONDS).map(ignore -> "no data"))
.subscribe(any -> System.out.println(any));
}
private static void skip() {
Observable
.intervalRange(1, 20, 0, 1000, TimeUnit.MILLISECONDS)
.skip(3)
.skip(5, TimeUnit.SECONDS)
.skipLast(2)
.subscribe(value -> System.out.print(value + " "));
}
private static void skipWhileAndUtil() {
Observable
.intervalRange(1, 20, 0, 1000, TimeUnit.MILLISECONDS)
.skipUntil(Observable.timer(2, TimeUnit.SECONDS))
.skipWhile(longValue -> longValue <= 5)
.subscribe(value -> System.out.print(value + " "));
}
}
|
UTF-8
|
Java
| 2,700 |
java
|
TestCondition.java
|
Java
|
[] | null |
[] |
package observable;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
public class TestCondition {
public static void main(String[] args) throws Exception {
// only first observable emits all data-stream
// amb();
// defaultIfEmpty();
switchIfEmpty();
// skip();
// skipWhileAndUtil();
// take();
// takeWhileAndUtil();
Thread.sleep(100000);
}
private static void takeWhileAndUtil() {
Observable
.intervalRange(1, 20, 0, 200, TimeUnit.MILLISECONDS)
.takeWhile(longValue -> longValue < 10)
.takeUntil(longValue -> longValue == 9)
.takeUntil(Observable.timer(1, TimeUnit.SECONDS))
.subscribe(value -> System.out.print(value + " "));
}
private static void take() {
Observable
.intervalRange(1, 20, 0, 200, TimeUnit.MILLISECONDS)
// take与takeLast互斥
.take(5)
// .takeLast(5)
.subscribe(value -> System.out.print(value + " "));
}
private static void amb() throws Exception {
Observable
.amb(
((Callable<Iterable<Observable<Object>>>) () -> {
List<Observable<Object>> list = new ArrayList<>();
list.add(Observable
.range(0, 10)
.cast(Object.class)
.delay(1, TimeUnit.MILLISECONDS)
);
list.add(Observable
.range(-10, 10)
.cast(Object.class)
.delay(2, TimeUnit.MILLISECONDS)
);
return list;
}).call()
)
.subscribe(value -> System.out.print(value + " "));
}
private static void defaultIfEmpty() {
Observable
.empty()
.defaultIfEmpty("it is default-item")
.subscribe(value -> System.out.print(value + " "));
}
private static void switchIfEmpty() {
Observable
.empty()
.switchIfEmpty(Observable.timer(2000, TimeUnit.MILLISECONDS).map(ignore -> "no data"))
.subscribe(any -> System.out.println(any));
}
private static void skip() {
Observable
.intervalRange(1, 20, 0, 1000, TimeUnit.MILLISECONDS)
.skip(3)
.skip(5, TimeUnit.SECONDS)
.skipLast(2)
.subscribe(value -> System.out.print(value + " "));
}
private static void skipWhileAndUtil() {
Observable
.intervalRange(1, 20, 0, 1000, TimeUnit.MILLISECONDS)
.skipUntil(Observable.timer(2, TimeUnit.SECONDS))
.skipWhile(longValue -> longValue <= 5)
.subscribe(value -> System.out.print(value + " "));
}
}
| 2,700 | 0.578693 | 0.556422 | 100 | 25.950001 | 21.796961 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.49 | false | false |
12
|
94890b2824f89d67bbc609f77502548c5c3dd5cd
| 19,335,942,769,423 |
4cf35281b05dc56443eed1e17e8b118ed9894de4
|
/Day6_PolymorphinsDemo/src/com/Polymorphins/BasePlusCommission.java
|
6a8e9825dbbb41b31324a05223f57731f1ce9d88
|
[] |
no_license
|
CristianBildea/TechnoTutors
|
https://github.com/CristianBildea/TechnoTutors
|
6ebc10018a5f816ddbd2ce368cd4504ab015c073
|
090030f7630087fed5466cbec2a4537acacfed6f
|
refs/heads/master
| 2020-04-24T05:00:12.876000 | 2019-02-21T18:00:01 | 2019-02-21T18:00:01 | 171,722,552 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.Polymorphins;
public class BasePlusCommission extends CommissionEmployee {
private double baseSalary; // getter and setter
public double getBaseSalary() {
return baseSalary;
}
public void setBaseSalary(double baseSalary) {
this.baseSalary = baseSalary;
}
//constructor-----
public BasePlusCommission(String firstName, String lastName, String socialSecurityNumber, double grossSales, double commissionRate, double baseSalary) {
super(firstName, lastName, socialSecurityNumber,grossSales,commissionRate);
this.baseSalary=baseSalary;
}
@Override
public double earning() {
return getBaseSalary() +super.earning(); //is coming from commission employee care este pt asta superclass
}
@Override
public String toString() {
return String .format("BasePlusCommission Employee: %s%n%s: $%.2f",super.toString(), "Base Salary",getBaseSalary());
}
}
|
UTF-8
|
Java
| 905 |
java
|
BasePlusCommission.java
|
Java
|
[
{
"context": "onstructor-----\r\n\tpublic BasePlusCommission(String firstName, String lastName, String socialSecurityNumber, do",
"end": 357,
"score": 0.7961225509643555,
"start": 348,
"tag": "NAME",
"value": "firstName"
},
{
"context": "public BasePlusCommission(String firstName, String lastName, String socialSecurityNumber, double grossSales, ",
"end": 374,
"score": 0.5275696516036987,
"start": 366,
"tag": "NAME",
"value": "lastName"
},
{
"context": "ble commissionRate, double baseSalary) {\r\n\t\tsuper(firstName, lastName, socialSecurityNumber,grossSales,commis",
"end": 486,
"score": 0.8713715672492981,
"start": 477,
"tag": "NAME",
"value": "firstName"
},
{
"context": "sionRate, double baseSalary) {\r\n\t\tsuper(firstName, lastName, socialSecurityNumber,grossSales,commissionRate);",
"end": 496,
"score": 0.8469028472900391,
"start": 488,
"tag": "NAME",
"value": "lastName"
}
] | null |
[] |
package com.Polymorphins;
public class BasePlusCommission extends CommissionEmployee {
private double baseSalary; // getter and setter
public double getBaseSalary() {
return baseSalary;
}
public void setBaseSalary(double baseSalary) {
this.baseSalary = baseSalary;
}
//constructor-----
public BasePlusCommission(String firstName, String lastName, String socialSecurityNumber, double grossSales, double commissionRate, double baseSalary) {
super(firstName, lastName, socialSecurityNumber,grossSales,commissionRate);
this.baseSalary=baseSalary;
}
@Override
public double earning() {
return getBaseSalary() +super.earning(); //is coming from commission employee care este pt asta superclass
}
@Override
public String toString() {
return String .format("BasePlusCommission Employee: %s%n%s: $%.2f",super.toString(), "Base Salary",getBaseSalary());
}
}
| 905 | 0.745856 | 0.744751 | 27 | 31.518518 | 39.449329 | 153 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.703704 | false | false |
12
|
46f57abe41b2a93f444c1b53cde6fc8b09313cbc
| 4,896,262,785,794 |
5d2e58915e243d68fa576fb951fc15036e5bbaff
|
/SampleProject/src/main/Printer.java
|
897454e01c144f0763c31ec129b619d43f75c6de
|
[] |
no_license
|
hurnajo/-Polymorphism
|
https://github.com/hurnajo/-Polymorphism
|
705167fd0e966c2b2d148b94a2afad82ddabdadc
|
16422ecff8b07bab1f13a5bfd7a1995c645e30b5
|
refs/heads/main
| 2022-12-24T05:08:53.921000 | 2020-10-06T09:20:21 | 2020-10-06T09:20:21 | 301,663,903 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package main;
//initialize the parent class PrintingMachine
class PrintingMachine {
public void printing() {
System.out.println("Printing...\n");
}
}
//initialize ColoredPrinter with Printer as its parent class
class ColoredPrinter extends PrintingMachine {
@Override
public void printing() {//Overriden Method
System.out.println("Detecting Colored Text...\nPrinting...\n");
}
}
//initialize BlackAndWhitePrinter with Printer as its parent class
class BlackAndWhitePrinter extends PrintingMachine {
@Override
public void printing() {//Overriden Method
System.out.println("Can only Print Black Text...\nPrinting Black...");
}
}
public class Printer {
public static void main(String[] args) {
//initialize printingMachine as a original PrintingMachine
PrintingMachine printingMachine = new PrintingMachine();
printingMachine.printing();
//initialize coloredPrinter as a ColoredPrinter
PrintingMachine coloredPrinter = new ColoredPrinter();
coloredPrinter.printing();
//initialize blackAndWhitePrinter as a BlackAndWhitePrinter
PrintingMachine blackAndWhitePrinter = new BlackAndWhitePrinter();
blackAndWhitePrinter.printing();
}
}
|
UTF-8
|
Java
| 1,271 |
java
|
Printer.java
|
Java
|
[] | null |
[] |
package main;
//initialize the parent class PrintingMachine
class PrintingMachine {
public void printing() {
System.out.println("Printing...\n");
}
}
//initialize ColoredPrinter with Printer as its parent class
class ColoredPrinter extends PrintingMachine {
@Override
public void printing() {//Overriden Method
System.out.println("Detecting Colored Text...\nPrinting...\n");
}
}
//initialize BlackAndWhitePrinter with Printer as its parent class
class BlackAndWhitePrinter extends PrintingMachine {
@Override
public void printing() {//Overriden Method
System.out.println("Can only Print Black Text...\nPrinting Black...");
}
}
public class Printer {
public static void main(String[] args) {
//initialize printingMachine as a original PrintingMachine
PrintingMachine printingMachine = new PrintingMachine();
printingMachine.printing();
//initialize coloredPrinter as a ColoredPrinter
PrintingMachine coloredPrinter = new ColoredPrinter();
coloredPrinter.printing();
//initialize blackAndWhitePrinter as a BlackAndWhitePrinter
PrintingMachine blackAndWhitePrinter = new BlackAndWhitePrinter();
blackAndWhitePrinter.printing();
}
}
| 1,271 | 0.712825 | 0.712825 | 41 | 30.024391 | 26.478235 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.243902 | false | false |
12
|
901cef0e48fdecae330962aa6a224d0778d964ed
| 33,595,234,248,403 |
4cc1b1edddc3087743a0bd90f3b91d4e9c5d5926
|
/src/main/java/com/mixram/telegram/bot/services/domain/InputMedia.java
|
55022815cf0125065e504b299079dae84e4f86c1
|
[] |
no_license
|
mixram/universal-bot
|
https://github.com/mixram/universal-bot
|
a370126f98e36a7359f9d829317f2d84f8de2b6b
|
546034637188e1f1bb048315193afcc5a5554214
|
refs/heads/master
| 2023-06-27T03:22:29.486000 | 2021-11-18T16:29:23 | 2021-11-18T16:29:23 | 130,359,278 | 0 | 0 | null | false | 2022-09-01T23:05:23 | 2018-04-20T12:28:23 | 2021-11-18T16:30:07 | 2022-09-01T23:05:22 | 378 | 0 | 0 | 1 |
Java
| false | false |
package com.mixram.telegram.bot.services.domain;
import javax.annotation.Nullable;
/**
* @author mixram on 2021-02-17.
* @since 1.8.8.0
*/
public interface InputMedia extends TelegramApiEntity {
@Nullable
String getCaption();
}
|
UTF-8
|
Java
| 242 |
java
|
InputMedia.java
|
Java
|
[
{
"context": "\nimport javax.annotation.Nullable;\n\n/**\n * @author mixram on 2021-02-17.\n * @since 1.8.8.0\n */\npublic inter",
"end": 106,
"score": 0.9994634985923767,
"start": 100,
"tag": "USERNAME",
"value": "mixram"
}
] | null |
[] |
package com.mixram.telegram.bot.services.domain;
import javax.annotation.Nullable;
/**
* @author mixram on 2021-02-17.
* @since 1.8.8.0
*/
public interface InputMedia extends TelegramApiEntity {
@Nullable
String getCaption();
}
| 242 | 0.719008 | 0.669421 | 13 | 17.615385 | 18.524572 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.230769 | false | false |
12
|
7a50aaf90b7580525af2f8f16e3978839a8eae1b
| 16,200,616,703,996 |
79ddb3c09197a8307e6c1f3d7072fb4b9c605b62
|
/app/src/main/java/test/logon/MainActivity.java
|
ff1019439bc0ca00cdc6adb3cfad1d7de5633ecd
|
[] |
no_license
|
monkeyZZH/Logon
|
https://github.com/monkeyZZH/Logon
|
382c4842d25941b5f261a7b61caea6705a02f431
|
b84518445aaa6b9f2015bca1b9f9e8aa9d0b1781
|
refs/heads/master
| 2021-06-28T14:15:50.622000 | 2017-09-15T13:25:42 | 2017-09-15T13:25:42 | 103,660,067 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package test.logon;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.andy.share.QQOauthUtils;
import com.bumptech.glide.Glide;
public class MainActivity extends AppCompatActivity{
private ImageView image;
private QQOauthUtils mQQOauthUtils;
private TextView name1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
image= (ImageView) findViewById(R.id.image);
name1 = (TextView) findViewById(R.id.name);
mQQOauthUtils=new QQOauthUtils(this, new QQOauthUtils.IUserPhoto() {
@Override
public void userPhoto(String userPhoto,String name) {
Glide.with(MainActivity.this).load(userPhoto).into(image);
name1.setText(name);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
mQQOauthUtils.onActivityResult(requestCode,resultCode,data);
}
public void but(View v) {
mQQOauthUtils.qqLogin();
}
}
|
UTF-8
|
Java
| 1,324 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package test.logon;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.andy.share.QQOauthUtils;
import com.bumptech.glide.Glide;
public class MainActivity extends AppCompatActivity{
private ImageView image;
private QQOauthUtils mQQOauthUtils;
private TextView name1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
image= (ImageView) findViewById(R.id.image);
name1 = (TextView) findViewById(R.id.name);
mQQOauthUtils=new QQOauthUtils(this, new QQOauthUtils.IUserPhoto() {
@Override
public void userPhoto(String userPhoto,String name) {
Glide.with(MainActivity.this).load(userPhoto).into(image);
name1.setText(name);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
mQQOauthUtils.onActivityResult(requestCode,resultCode,data);
}
public void but(View v) {
mQQOauthUtils.qqLogin();
}
}
| 1,324 | 0.69864 | 0.695619 | 41 | 31.317074 | 23.277163 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.731707 | false | false |
12
|
076e18e43fee9ce86ae1bb6a03decffad6a9ba44
| 1,125,281,483,519 |
cd54f9cda9cc70f861a72321fbe8658d30dfc0c8
|
/src/mytest/basicTest/initDetail/Person.java
|
30cb1fd4d601840269f779c7f91f1a56d00d021e
|
[] |
no_license
|
imcheney/LearnJava
|
https://github.com/imcheney/LearnJava
|
c818ff85090c7b89637ee32b9592e8fe262cf81b
|
bde83f2012c36c466e8ad28af646fe8378a53e62
|
refs/heads/master
| 2021-01-18T20:20:15.674000 | 2017-05-02T00:44:37 | 2017-05-02T00:44:37 | 86,956,994 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package mytest.basicTest.initDetail;
/**
* Created by Chen on 02/05/2017.
*/
public class Person {
private int i = 1;
static {
System.out.println("Father's static code block");
}
static String staticName = "LiuDong";
public Person() {
System.out.println("P");
}
public void print() {
System.out.println(i);
}
}
|
UTF-8
|
Java
| 373 |
java
|
Person.java
|
Java
|
[
{
"context": "ge mytest.basicTest.initDetail;\n\n/**\n * Created by Chen on 02/05/2017.\n */\npublic class Person {\n priv",
"end": 60,
"score": 0.9996453523635864,
"start": 56,
"tag": "NAME",
"value": "Chen"
},
{
"context": "e block\");\n }\n\n static String staticName = \"LiuDong\";\n\n public Person() {\n System.out.print",
"end": 242,
"score": 0.9997932314872742,
"start": 235,
"tag": "NAME",
"value": "LiuDong"
}
] | null |
[] |
package mytest.basicTest.initDetail;
/**
* Created by Chen on 02/05/2017.
*/
public class Person {
private int i = 1;
static {
System.out.println("Father's static code block");
}
static String staticName = "LiuDong";
public Person() {
System.out.println("P");
}
public void print() {
System.out.println(i);
}
}
| 373 | 0.58445 | 0.560322 | 21 | 16.761906 | 16.282928 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false |
12
|
ccd83ffdfae19583ed607409810426f0998a02c4
| 13,365,938,236,905 |
f545120969fe48d867c6c1f02e6ab14692657658
|
/src/main/java/com/expleague/sensearch/features/QURLItem.java
|
df2f783fe8be5e513867f19ef8c50abd85e9fcad
|
[] |
no_license
|
solariq/sensearch
|
https://github.com/solariq/sensearch
|
7f93ba8e7f6c6210f5bf3106fdfa8ab1cc7aeb00
|
95ef056ccb4ac3a480434f97cc7624210825ff5f
|
refs/heads/master
| 2022-11-18T15:03:59.954000 | 2019-12-21T14:07:18 | 2019-12-21T14:07:18 | 150,838,031 | 4 | 4 | null | false | 2022-11-16T11:32:04 | 2018-09-29T07:35:14 | 2019-12-21T14:07:28 | 2022-11-16T11:32:00 | 53,754 | 7 | 0 | 21 |
Java
| false | false |
package com.expleague.sensearch.features;
import com.expleague.ml.meta.GroupedDSItem;
import com.expleague.sensearch.Page;
import com.expleague.sensearch.query.Query;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.net.URI;
@JsonPropertyOrder({"query", "uri"})
public class QURLItem extends GroupedDSItem.Stub {
private final String query;
private final URI uri;
private transient Page pageCache;
private transient Query queryCache;
@JsonCreator
private QURLItem(@JsonProperty("query") String query, @JsonProperty("uri") String uri) {
this.query = query;
this.uri = URI.create(uri);
}
public QURLItem(Page page, Query query) {
this.query = query.text();
this.uri = page.uri();
pageCache = page;
queryCache = query;
}
@JsonProperty("query")
public String getQuery() {
return query;
}
@JsonProperty("uri")
public URI getUri() {
return uri;
}
public Page pageCache() {
return pageCache;
}
public Query queryCache() {
return queryCache;
}
@Override
public String id() {
return query + "::" + uri.toString();
}
@Override
public String groupId() {
return query;
}
@Override
public int hashCode() {
return (query + uri.toString()).hashCode();
}
}
|
UTF-8
|
Java
| 1,391 |
java
|
QURLItem.java
|
Java
|
[] | null |
[] |
package com.expleague.sensearch.features;
import com.expleague.ml.meta.GroupedDSItem;
import com.expleague.sensearch.Page;
import com.expleague.sensearch.query.Query;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.net.URI;
@JsonPropertyOrder({"query", "uri"})
public class QURLItem extends GroupedDSItem.Stub {
private final String query;
private final URI uri;
private transient Page pageCache;
private transient Query queryCache;
@JsonCreator
private QURLItem(@JsonProperty("query") String query, @JsonProperty("uri") String uri) {
this.query = query;
this.uri = URI.create(uri);
}
public QURLItem(Page page, Query query) {
this.query = query.text();
this.uri = page.uri();
pageCache = page;
queryCache = query;
}
@JsonProperty("query")
public String getQuery() {
return query;
}
@JsonProperty("uri")
public URI getUri() {
return uri;
}
public Page pageCache() {
return pageCache;
}
public Query queryCache() {
return queryCache;
}
@Override
public String id() {
return query + "::" + uri.toString();
}
@Override
public String groupId() {
return query;
}
@Override
public int hashCode() {
return (query + uri.toString()).hashCode();
}
}
| 1,391 | 0.696621 | 0.696621 | 65 | 20.4 | 18.701542 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.430769 | false | false |
12
|
1814a6bcd2f5d593052dc6676fef6f730c64b616
| 18,811,956,804,240 |
52f3eb45eca073768c5fcd6f85163adedf56a699
|
/TRMS Service/src/test/java/org/atouma/DaoTests/EmployeeDaoTests.java
|
6d9e6ddfce5e4388bb3a095fbf06943a82a66aeb
|
[] |
no_license
|
chielo9513/TRMS-Service
|
https://github.com/chielo9513/TRMS-Service
|
b2d9737dd125d3035a01eee6a35b63a8c768edf4
|
986214be46420b19ec15f7719a0467fb8145b421
|
refs/heads/main
| 2023-04-18T08:53:59.610000 | 2021-05-07T16:05:56 | 2021-05-07T16:05:56 | 365,285,699 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.atouma.DaoTests;
public class EmployeeDaoTests {
}
|
UTF-8
|
Java
| 70 |
java
|
EmployeeDaoTests.java
|
Java
|
[] | null |
[] |
package org.atouma.DaoTests;
public class EmployeeDaoTests {
}
| 70 | 0.728571 | 0.728571 | 5 | 12 | 14.324803 | 31 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false |
12
|
a1540f57125d6104fd75f0de89b14c5bbd6b43de
| 1,477,468,752,939 |
e9e9d4793155244045518a05003ab0309dffde80
|
/src/main/java/com/jade/service/SubSkillService.java
|
724388f157e9ca0aae3bdc99831d1ccaf60e52bc
|
[] |
no_license
|
jadewangqiang/StaffManagementV01
|
https://github.com/jadewangqiang/StaffManagementV01
|
50217cc35a866542c15fb363d0226058bcd80b32
|
064ec08e1b3592fd959f7a4d6c6d72b007f1516e
|
refs/heads/master
| 2021-07-06T14:43:41.210000 | 2017-09-26T07:58:48 | 2017-09-26T07:58:48 | 104,855,081 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jade.service;
import java.util.List;
import com.jade.pojo.SubSkill;
public interface SubSkillService {
public List<SubSkill> getAllSubSK();
public List<SubSkill> getAB0Skill();
public List<SubSkill> getAB1Skill();
public List<SubSkill> getDI0Skill();
public List<SubSkill> getDI1Skill();
public List<SubSkill> getSK0Skill();
}
|
UTF-8
|
Java
| 346 |
java
|
SubSkillService.java
|
Java
|
[] | null |
[] |
package com.jade.service;
import java.util.List;
import com.jade.pojo.SubSkill;
public interface SubSkillService {
public List<SubSkill> getAllSubSK();
public List<SubSkill> getAB0Skill();
public List<SubSkill> getAB1Skill();
public List<SubSkill> getDI0Skill();
public List<SubSkill> getDI1Skill();
public List<SubSkill> getSK0Skill();
}
| 346 | 0.774566 | 0.760116 | 12 | 27.833334 | 13.177211 | 37 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.25 | false | false |
12
|
89380e22b3d805c54e1f4434c128492dba0faa32
| 1,477,468,752,506 |
eac038c1889aba97dfe26d9c84157307b232041e
|
/app/src/main/java/com/complaints/jd/h2h/CropAdapter.java
|
eae63898c5934eaf749a45563da0a7c815422a37
|
[] |
no_license
|
nitin3156/Hack2Help
|
https://github.com/nitin3156/Hack2Help
|
63d604d71bbba4f4c740f67930f4794e3fcc9433
|
7778de91b9271770c82f6c4bbc4df66ca5d5f860
|
refs/heads/master
| 2020-12-30T16:02:32.646000 | 2017-05-11T08:22:44 | 2017-05-11T08:22:44 | 90,955,455 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.complaints.jd.h2h;
/**
* Created by Nitin Tonger on 25-03-2017.
*/
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.service.voice.VoiceInteractionSession;
import android.support.v7.widget.CardView;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.bumptech.glide.Glide;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CropAdapter extends RecyclerView.Adapter<CropAdapter.MyViewHolder> {
private Context mContext;
private List<Crop> albumList;
public class MyViewHolder extends RecyclerView.ViewHolder {
public TextView title, count,msp,centerkiitem,comid;
public ImageView thumbnail, overflow;
CardView cardView;
public MyViewHolder(View view) {
super(view);
title = (TextView) view.findViewById(R.id.center1);
count = (TextView) view.findViewById(R.id.quantity);
thumbnail = (ImageView) view.findViewById(R.id.cropimage);
msp=(TextView)view.findViewById(R.id.msp);
centerkiitem=(TextView)view.findViewById(R.id.centerid);
cardView=(CardView)view.findViewById(R.id.card);
comid=(TextView)view.findViewById(R.id.comid);
cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Context context=view.getContext();
Intent intent=new Intent(context,MakeBiddingActivity.class);
intent.putExtra("msp",msp.getText().toString());
intent.putExtra("quan",count.getText().toString());
intent.putExtra("com",comid.getText().toString());
intent.putExtra("cid",centerkiitem.getText().toString());
context.startActivity(intent);
}
});
}
}
String user_email;
public CropAdapter(Context mContext, List<Crop> albumList) {
this.mContext = mContext;
this.albumList = albumList;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.crop_card, parent, false);
return new MyViewHolder(itemView);
}
Crop album;
@Override
public void onBindViewHolder(final MyViewHolder holder, final int position) {
album = albumList.get(position);
holder.title.setText(album.getproduct());
holder.count.setText(album.getPrice());
Glide.with(mContext).load("http://kmzenon.pe.hu/app/wheat.jpg").into(holder.thumbnail);
holder.msp.setText("₹"+album.getBarcode());
holder.comid.setText(album.getcompany());
holder.centerkiitem.setText(album.getId());
holder.centerkiitem.setVisibility(View.INVISIBLE);
//holder.item.setVisibility(View.INVISIBLE);
}
String dataid;
@Override
public int getItemCount() {
return albumList.size();
}
}
|
UTF-8
|
Java
| 3,738 |
java
|
CropAdapter.java
|
Java
|
[
{
"context": "package com.complaints.jd.h2h;\n\n/**\n * Created by Nitin Tonger on 25-03-2017.\n */\nimport android.app.Dialog;\nimp",
"end": 62,
"score": 0.999851405620575,
"start": 50,
"tag": "NAME",
"value": "Nitin Tonger"
}
] | null |
[] |
package com.complaints.jd.h2h;
/**
* Created by <NAME> on 25-03-2017.
*/
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.service.voice.VoiceInteractionSession;
import android.support.v7.widget.CardView;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.bumptech.glide.Glide;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CropAdapter extends RecyclerView.Adapter<CropAdapter.MyViewHolder> {
private Context mContext;
private List<Crop> albumList;
public class MyViewHolder extends RecyclerView.ViewHolder {
public TextView title, count,msp,centerkiitem,comid;
public ImageView thumbnail, overflow;
CardView cardView;
public MyViewHolder(View view) {
super(view);
title = (TextView) view.findViewById(R.id.center1);
count = (TextView) view.findViewById(R.id.quantity);
thumbnail = (ImageView) view.findViewById(R.id.cropimage);
msp=(TextView)view.findViewById(R.id.msp);
centerkiitem=(TextView)view.findViewById(R.id.centerid);
cardView=(CardView)view.findViewById(R.id.card);
comid=(TextView)view.findViewById(R.id.comid);
cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Context context=view.getContext();
Intent intent=new Intent(context,MakeBiddingActivity.class);
intent.putExtra("msp",msp.getText().toString());
intent.putExtra("quan",count.getText().toString());
intent.putExtra("com",comid.getText().toString());
intent.putExtra("cid",centerkiitem.getText().toString());
context.startActivity(intent);
}
});
}
}
String user_email;
public CropAdapter(Context mContext, List<Crop> albumList) {
this.mContext = mContext;
this.albumList = albumList;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.crop_card, parent, false);
return new MyViewHolder(itemView);
}
Crop album;
@Override
public void onBindViewHolder(final MyViewHolder holder, final int position) {
album = albumList.get(position);
holder.title.setText(album.getproduct());
holder.count.setText(album.getPrice());
Glide.with(mContext).load("http://kmzenon.pe.hu/app/wheat.jpg").into(holder.thumbnail);
holder.msp.setText("₹"+album.getBarcode());
holder.comid.setText(album.getcompany());
holder.centerkiitem.setText(album.getId());
holder.centerkiitem.setVisibility(View.INVISIBLE);
//holder.item.setVisibility(View.INVISIBLE);
}
String dataid;
@Override
public int getItemCount() {
return albumList.size();
}
}
| 3,732 | 0.680139 | 0.67666 | 107 | 33.925232 | 24.272095 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.757009 | false | false |
12
|
57f7f3136e38f5e0ce7e80c905682142990cd11c
| 28,389,733,880,150 |
b33e79b0f8b54e63b9398067e992820612286d66
|
/wxpj/src/dao/weixiurenDao.java
|
cf966b5dc489fac8e349caf5d926332e819749e3
|
[] |
no_license
|
WikingMarch/wxpj
|
https://github.com/WikingMarch/wxpj
|
99a9074baa489ce864c35fd92035cc27a0f9bdee
|
925bdec32dad5de30cbe8413212c6ee663f2dd0f
|
refs/heads/master
| 2020-03-17T02:57:40.963000 | 2018-05-13T07:35:48 | 2018-05-13T07:35:48 | 133,157,623 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package dao;
import java.util.List;
import entity.userEntity;
import entity.weixiurenEntity;
public interface weixiurenDao {
public void saveOrupdate(weixiurenEntity entity);
public boolean isExistByPhone(String phone);
public weixiurenEntity findByPhone(String phone);
public weixiurenEntity findByTelandPassWord(String tel,String password );
public List<weixiurenEntity> findListByAddress(String xuexiao,String xiaoqu);
public weixiurenEntity findById(String wid);
}
|
UTF-8
|
Java
| 492 |
java
|
weixiurenDao.java
|
Java
|
[] | null |
[] |
package dao;
import java.util.List;
import entity.userEntity;
import entity.weixiurenEntity;
public interface weixiurenDao {
public void saveOrupdate(weixiurenEntity entity);
public boolean isExistByPhone(String phone);
public weixiurenEntity findByPhone(String phone);
public weixiurenEntity findByTelandPassWord(String tel,String password );
public List<weixiurenEntity> findListByAddress(String xuexiao,String xiaoqu);
public weixiurenEntity findById(String wid);
}
| 492 | 0.806911 | 0.806911 | 17 | 26.941177 | 25.09856 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.764706 | false | false |
12
|
df029a5f4c3db1fcca3d250ef0c6678127db84fc
| 163,208,827,027 |
6a33ca83e7c9829fa25d80a67004810195c6f5b3
|
/app/src/main/java/com/dinesh/sawari/CabsModel.java
|
d7ea3e638bc106aef36b096d88118705dc32093b
|
[] |
no_license
|
DukeDineshBhatt/Sawari
|
https://github.com/DukeDineshBhatt/Sawari
|
5947fe552e8d99ddbcfa3b088d935433e407937f
|
20dd79e206819c4deb08f01f3c5a8f73da7e18ee
|
refs/heads/master
| 2023-03-12T12:50:37.901000 | 2021-02-25T20:37:30 | 2021-02-25T20:37:30 | 338,900,650 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.dinesh.sawari;
public class CabsModel {
public CabsModel() {
}
String name,type,ac;
String bags,seats,price;
public CabsModel(String name, String type, String ac, String bags, String seats, String price) {
this.name = name;
this.type = type;
this.ac = ac;
this.bags = bags;
this.seats = seats;
this.price = price;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getSeats() {
return seats;
}
public void setSeats(String seats) {
this.seats = seats;
}
public String getBags() {
return bags;
}
public void setBags(String bags) {
this.bags = bags;
}
public String getAc() {
return ac;
}
public void setAc(String ac) {
this.ac = ac;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
}
|
UTF-8
|
Java
| 1,186 |
java
|
CabsModel.java
|
Java
|
[] | null |
[] |
package com.dinesh.sawari;
public class CabsModel {
public CabsModel() {
}
String name,type,ac;
String bags,seats,price;
public CabsModel(String name, String type, String ac, String bags, String seats, String price) {
this.name = name;
this.type = type;
this.ac = ac;
this.bags = bags;
this.seats = seats;
this.price = price;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getSeats() {
return seats;
}
public void setSeats(String seats) {
this.seats = seats;
}
public String getBags() {
return bags;
}
public void setBags(String bags) {
this.bags = bags;
}
public String getAc() {
return ac;
}
public void setAc(String ac) {
this.ac = ac;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
}
| 1,186 | 0.546374 | 0.546374 | 67 | 16.701492 | 16.636602 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.447761 | false | false |
12
|
70cfff686ae3b4c1b3ce549478881642a19653fe
| 11,192,684,831,789 |
98373bcf25243128f7add9274bdf6fd05c1f2468
|
/spring5/spring5_anno_ioc/src/main/java/com/lb/Service/impl/AccountServiceImpl.java
|
b3a94ffb6dd20c3d1a15c680e96e0ef82c394c99
|
[] |
no_license
|
WRCoding/spring
|
https://github.com/WRCoding/spring
|
42290fb89d5238994025f8b6b9c05bd7d4791328
|
b9aecc23be46c9463c15cf2e6706f992c09bf8e6
|
refs/heads/master
| 2022-07-11T16:48:22.038000 | 2019-06-18T11:45:47 | 2019-06-18T11:45:47 | 192,368,916 | 0 | 0 | null | false | 2022-06-21T01:18:10 | 2019-06-17T15:04:49 | 2019-06-18T11:44:23 | 2022-06-21T01:18:07 | 143 | 0 | 0 | 15 |
Java
| false | false |
package com.lb.Service.impl;
import com.lb.Service.IAccountService;
import com.lb.dao.IAccountDao;
import com.lb.dao.impl.AccountDaoImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* @author LB
* @create 2019-05-29 15:03
* 四类注解:
* 用于创建对象的:
* 作用与在XML配置中编写一个bean标签实现的功能是一样的
* ` @Component:
* 作用:用于把当前对象存入spring容器中
* 属性:value:指定id,默认为类名首字母小写
* @Controller:一般用于表现层
* @Service: 一般用于业务层
* @Repository:一般用于持久层
* 以上的注解作用于属性与component相同
* 是spring为三层架构提供的注解
* 用于注入数据的
* 作用与在XML配置中ean标签中的<property></property>的作用是一样的实现的功能是一样的
* @ Autowired:自动按照类型注入,只要容器中有唯一的一个bean对象类型和注入的变量类型匹配,如果没有匹配,则报错,就可以注入成功
* 出现的位置可以是变量上,也可以是方法上
* @ Qualifier:在按照类中注入的基础之上再按照名称注入,它在给类成员注入时不能单独使用
* @ Resource:直接按照bean的id注入,属性name:用于指定bean的id
* 属性:value:用于指定注入bean的id
* 以上注解都只能注入其他bean类型的数据,而基本数据类型和String类型无法使用以上注解注入,集合类型的注入只能通过xml实现
* @ value:用于注入基本数据类型和String类型,属性value用于指定数据的值
* 用于改变作用范围的
* 作用与bean标签中的<scope></scope>的作用是一样的
* 和生命周期相关的
*/
@Component(value = "accountService")
public class AccountServiceImpl implements IAccountService {
// @Autowired
// @Qualifier("accountDao2")
@Resource(name = "accountDao2")
private IAccountDao accountDao;
public AccountServiceImpl() {
System.out.println("对象创建了");
}
@Override
public void saveAccount() {
accountDao.saveAccount();
}
}
|
UTF-8
|
Java
| 2,452 |
java
|
AccountServiceImpl.java
|
Java
|
[
{
"context": "import javax.annotation.Resource;\n\n\n/**\n * @author LB\n * @create 2019-05-29 15:03\n * 四类注解:\n * 用于创建对象的:\n",
"end": 368,
"score": 0.9899799823760986,
"start": 366,
"tag": "USERNAME",
"value": "LB"
}
] | null |
[] |
package com.lb.Service.impl;
import com.lb.Service.IAccountService;
import com.lb.dao.IAccountDao;
import com.lb.dao.impl.AccountDaoImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* @author LB
* @create 2019-05-29 15:03
* 四类注解:
* 用于创建对象的:
* 作用与在XML配置中编写一个bean标签实现的功能是一样的
* ` @Component:
* 作用:用于把当前对象存入spring容器中
* 属性:value:指定id,默认为类名首字母小写
* @Controller:一般用于表现层
* @Service: 一般用于业务层
* @Repository:一般用于持久层
* 以上的注解作用于属性与component相同
* 是spring为三层架构提供的注解
* 用于注入数据的
* 作用与在XML配置中ean标签中的<property></property>的作用是一样的实现的功能是一样的
* @ Autowired:自动按照类型注入,只要容器中有唯一的一个bean对象类型和注入的变量类型匹配,如果没有匹配,则报错,就可以注入成功
* 出现的位置可以是变量上,也可以是方法上
* @ Qualifier:在按照类中注入的基础之上再按照名称注入,它在给类成员注入时不能单独使用
* @ Resource:直接按照bean的id注入,属性name:用于指定bean的id
* 属性:value:用于指定注入bean的id
* 以上注解都只能注入其他bean类型的数据,而基本数据类型和String类型无法使用以上注解注入,集合类型的注入只能通过xml实现
* @ value:用于注入基本数据类型和String类型,属性value用于指定数据的值
* 用于改变作用范围的
* 作用与bean标签中的<scope></scope>的作用是一样的
* 和生命周期相关的
*/
@Component(value = "accountService")
public class AccountServiceImpl implements IAccountService {
// @Autowired
// @Qualifier("accountDao2")
@Resource(name = "accountDao2")
private IAccountDao accountDao;
public AccountServiceImpl() {
System.out.println("对象创建了");
}
@Override
public void saveAccount() {
accountDao.saveAccount();
}
}
| 2,452 | 0.685542 | 0.677108 | 56 | 28.642857 | 21.001215 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.196429 | false | false |
12
|
7765024c9441199aefee88d7f378c9857d1889d0
| 15,427,522,591,075 |
db7e5c2f2b30afe2d62e7eb02443a154eab1074e
|
/src/main/java/y/a/MatrixChainMultiplier.java
|
76d3687ebfe93f9ddd04963e940bf0952e14beac
|
[
"Apache-2.0"
] |
permissive
|
arun-y/algo-ds
|
https://github.com/arun-y/algo-ds
|
7e0760413736a71f75171017259e51c9acc9d441
|
eacee9878a41bca597830f1610b1e28a7a761a34
|
refs/heads/master
| 2021-05-27T11:30:35.770000 | 2014-07-09T17:51:48 | 2014-07-09T17:51:48 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package y.a;
public class MatrixChainMultiplier {
public static void main(String[] argv) {
// int[] p = new int[] {2,3,4,1,5};
int[] p = new int[] {30,35,15,5,10,20,25};
MatrixChainMultiplier mcm = new MatrixChainMultiplier(p);
mcm.martixChainOrder();
System.out.println(mcm.printOptimalOrder(0, 5));
System.out.println(mcm.m[0][5]);
}
final int[] p;
final int n;
final int[][] m;
final int[][] s;
public MatrixChainMultiplier(final int[] p) {
n = p.length - 1;
this.p = p;
m = new int[n][n];
s = new int[n][n];
}
public void martixChainOrder() {
for (int l = 2; l <= n; l++) {
for (int i = 0; i < n - l + 1; i++) {
int j = i + l - 1;
m[i][j] = Integer.MAX_VALUE;
for (int k = i; k < j; k++) {
int q = m[i][k] + m[k+1][j] + (p[i] * p[k+1] * p[j+1]);
if (q < m[i][j]) {
m[i][j] = q;
s[i][j] = k;
}
}
}
}
}
public String printOptimalOrder(final int i, final int j) {
if (j > i) {
String x = printOptimalOrder(i, s[i][j]);
String y = printOptimalOrder(s[i][j] + 1, j);
return "(" + x + "*" + y + ")";
} else {
return "A"+i;
}
}
}
|
UTF-8
|
Java
| 1,151 |
java
|
MatrixChainMultiplier.java
|
Java
|
[] | null |
[] |
package y.a;
public class MatrixChainMultiplier {
public static void main(String[] argv) {
// int[] p = new int[] {2,3,4,1,5};
int[] p = new int[] {30,35,15,5,10,20,25};
MatrixChainMultiplier mcm = new MatrixChainMultiplier(p);
mcm.martixChainOrder();
System.out.println(mcm.printOptimalOrder(0, 5));
System.out.println(mcm.m[0][5]);
}
final int[] p;
final int n;
final int[][] m;
final int[][] s;
public MatrixChainMultiplier(final int[] p) {
n = p.length - 1;
this.p = p;
m = new int[n][n];
s = new int[n][n];
}
public void martixChainOrder() {
for (int l = 2; l <= n; l++) {
for (int i = 0; i < n - l + 1; i++) {
int j = i + l - 1;
m[i][j] = Integer.MAX_VALUE;
for (int k = i; k < j; k++) {
int q = m[i][k] + m[k+1][j] + (p[i] * p[k+1] * p[j+1]);
if (q < m[i][j]) {
m[i][j] = q;
s[i][j] = k;
}
}
}
}
}
public String printOptimalOrder(final int i, final int j) {
if (j > i) {
String x = printOptimalOrder(i, s[i][j]);
String y = printOptimalOrder(s[i][j] + 1, j);
return "(" + x + "*" + y + ")";
} else {
return "A"+i;
}
}
}
| 1,151 | 0.511729 | 0.484796 | 56 | 19.553572 | 17.904428 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.803571 | false | false |
12
|
41e6f63d670bfc2862a991e47df62917c251ab96
| 29,403,346,108,796 |
33d60ce7a12ec8dbaee179f7507924f483f09d82
|
/app-back/src/main/java/jp/co/sint/webshop/web/action/back/service/MemberInfoMoveAction.java
|
868e250b60aedea9b663999b7d5031c68361082c
|
[] |
no_license
|
mqiy/ec_test
|
https://github.com/mqiy/ec_test
|
e342fbfb660aeabdb71f1299f94ac1dd624c99bb
|
7b4495c3f219a1e000b479e2b3932302a0b79ddd
|
refs/heads/master
| 2016-09-05T23:14:39.801000 | 2015-02-09T11:05:07 | 2015-02-09T11:05:07 | 30,531,830 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package jp.co.sint.webshop.web.action.back.service;
import jp.co.sint.webshop.data.dto.InquiryHeader;
import jp.co.sint.webshop.data.dto.OrderHeader;
import jp.co.sint.webshop.data.dto.ShippingHeader;
import jp.co.sint.webshop.service.CustomerService;
import jp.co.sint.webshop.service.OrderService;
import jp.co.sint.webshop.service.ServiceLocator;
import jp.co.sint.webshop.utility.StringUtil;
import jp.co.sint.webshop.web.action.WebActionResult;
import jp.co.sint.webshop.web.action.back.BackActionResult;
import jp.co.sint.webshop.web.action.back.WebBackAction;
import jp.co.sint.webshop.web.bean.back.service.MemberInfoBean;
import jp.co.sint.webshop.web.message.WebMessage;
import jp.co.sint.webshop.web.message.back.ServiceErrorMessage;
import jp.co.sint.webshop.web.text.back.Messages;
import jp.co.sint.webshop.web.webutility.DisplayTransition;
public class MemberInfoMoveAction extends WebBackAction<MemberInfoBean> {
/**
* ログインユーザの権限を確認し、このアクションの実行を認可するかどうかを返します。
*
* @return アクションの実行を認可する場合はtrue
*/
@Override
public boolean authorize() {
return true;
}
/**
* データモデルに格納された入力値の妥当性を検証します。
*
* @return 入力値にエラーがなければtrue
*/
@Override
public boolean validate() {
if (StringUtil.hasValue(targetPage())) {
return true;
}
return false;
}
/**
* アクションを実行します。
*
* @return アクションの実行結果
*/
@Override
public WebActionResult callService() {
String targetPage = targetPage();
// String customerCode = getBean().getCustomerInfo().getCustomerCode();
// String customerCode ="0000000000010002";
// 20111209 lirong add start
String customerCode = getCustomerCode();
// 20111209 lirong add end
CustomerService customerService = ServiceLocator.getCustomerService(getLoginInfo());
OrderService orderService = ServiceLocator.getOrderService(getLoginInfo());
if (targetPage.equals("edit") || targetPage.equals("address") || targetPage.equals("inquiryEdit")) {
// 会员存在验证
if (StringUtil.isNullOrEmpty(customerCode) || customerService.isNotFound(customerCode)) {
setNextUrl("/app/service/member_info/init/delete");
setRequestBean(getBean());
return BackActionResult.RESULT_SUCCESS;
}
// 会员已退会时
if (customerService.isWithdrawed(customerCode)) {
addErrorMessage(Messages.getString("web.action.back.service.MemberInfoInitAction.1"));
setRequestBean(getBean());
return BackActionResult.RESULT_SUCCESS;
}
}
if (targetPage.equals("edit")) {
setNextUrl("/app/customer/customer_edit/select/" + customerCode);
} else if (targetPage.equals("address")) {
setNextUrl("/app/customer/address_list/init/" + customerCode);
} else if (targetPage.equals("inquiryEdit")) {
setNextUrl("/app/service/inquiry_edit/init/" + customerCode);
} else if (targetPage.equals("order")) {
// 订单编号存在验证
OrderHeader orderHeader = orderService.getOrderHeader(targetNo());
if (orderHeader == null) {
addErrorMessage(WebMessage.get(ServiceErrorMessage.NO_DATA_ERROR, Messages
.getString("web.action.back.service.MemberInfoMoveAction.1")));
setRequestBean(getBean());
return BackActionResult.RESULT_SUCCESS;
}
setNextUrl("/app/order/order_detail/init/" + targetNo());
} else if (targetPage.equals("shipping")) {
// 发货编号存在验证
ShippingHeader shippingHeader = orderService.getShippingHeader(targetNo());
if (shippingHeader == null) {
addErrorMessage(WebMessage.get(ServiceErrorMessage.NO_DATA_ERROR, Messages
.getString("web.action.back.service.MemberInfoMoveAction.2")));
setRequestBean(getBean());
return BackActionResult.RESULT_SUCCESS;
}
setNextUrl("/app/order/shipping_detail/init/" + targetNo());
} else if (targetPage.equals("member")) {
setNextUrl("/app/service/member_info/init");
} else if (targetPage.equals("inquiry")) {
setNextUrl("/app/service/inquiry_list/init");
} else if (targetPage.equals("inquiryDetail")) {
// 咨询编号存在验证
InquiryHeader inquiryHeader = customerService.getInquiryHeader(targetNo());
if (inquiryHeader == null) {
addErrorMessage(WebMessage.get(ServiceErrorMessage.NO_DATA_ERROR, Messages
.getString("web.action.back.service.MemberInfoMoveAction.3")));
setRequestBean(getBean());
return BackActionResult.RESULT_SUCCESS;
}
setNextUrl("/app/service/inquiry_detail/init/" + targetNo());
} else if (targetPage.equals("new")) {
setNextUrl("/app/order/neworder_commodity");
// 20131106 txw add start
} else if (targetPage.equals("refund")) {
setNextUrl("/app/service/card_refund/init/" + targetNo());
// 20131106 txw add end
} else {
return BackActionResult.SERVICE_ERROR;
}
// 前画面情報設定
DisplayTransition.add(getBean(), "/app/service/member_info/history_back/" + getBean().getDisplayHistoryMode(),
getSessionContainer());
return BackActionResult.RESULT_SUCCESS;
}
/**
* 从URL取得迁移画面。<BR>
*
* @return targetPage
*/
private String targetPage() {
String[] tmpArgs = getRequestParameter().getPathArgs();
if (tmpArgs.length > 0) {
return tmpArgs[0];
} else {
return "";
}
}
// 20111209 lirong add start
/**
* URLから顧客コードを取得します。<BR>
*
* @return customerCode
*/
private String getCustomerCode() {
String[] tmpArgs = getRequestParameter().getPathArgs();
if (tmpArgs.length > 1) {
return tmpArgs[1];
} else {
return "";
}
}
// 20111209 lirong add end
/**
* 从URL取得订单编号、发货编号。<BR>
*
* @return targetNo
*/
private String targetNo() {
String[] tmpArgs = getRequestParameter().getPathArgs();
if (tmpArgs.length > 1) {
return tmpArgs[1];
} else {
return "";
}
}
/**
* Action名の取得
*
* @return Action名
*/
public String getActionName() {
return Messages.getString("web.action.back.service.MemberInfoMoveAction.0");
}
/**
* オペレーションコードの取得
*
* @return オペレーションコード
*/
public String getOperationCode() {
return "8109011005";
}
}
|
UTF-8
|
Java
| 6,843 |
java
|
MemberInfoMoveAction.java
|
Java
|
[] | null |
[] |
package jp.co.sint.webshop.web.action.back.service;
import jp.co.sint.webshop.data.dto.InquiryHeader;
import jp.co.sint.webshop.data.dto.OrderHeader;
import jp.co.sint.webshop.data.dto.ShippingHeader;
import jp.co.sint.webshop.service.CustomerService;
import jp.co.sint.webshop.service.OrderService;
import jp.co.sint.webshop.service.ServiceLocator;
import jp.co.sint.webshop.utility.StringUtil;
import jp.co.sint.webshop.web.action.WebActionResult;
import jp.co.sint.webshop.web.action.back.BackActionResult;
import jp.co.sint.webshop.web.action.back.WebBackAction;
import jp.co.sint.webshop.web.bean.back.service.MemberInfoBean;
import jp.co.sint.webshop.web.message.WebMessage;
import jp.co.sint.webshop.web.message.back.ServiceErrorMessage;
import jp.co.sint.webshop.web.text.back.Messages;
import jp.co.sint.webshop.web.webutility.DisplayTransition;
public class MemberInfoMoveAction extends WebBackAction<MemberInfoBean> {
/**
* ログインユーザの権限を確認し、このアクションの実行を認可するかどうかを返します。
*
* @return アクションの実行を認可する場合はtrue
*/
@Override
public boolean authorize() {
return true;
}
/**
* データモデルに格納された入力値の妥当性を検証します。
*
* @return 入力値にエラーがなければtrue
*/
@Override
public boolean validate() {
if (StringUtil.hasValue(targetPage())) {
return true;
}
return false;
}
/**
* アクションを実行します。
*
* @return アクションの実行結果
*/
@Override
public WebActionResult callService() {
String targetPage = targetPage();
// String customerCode = getBean().getCustomerInfo().getCustomerCode();
// String customerCode ="0000000000010002";
// 20111209 lirong add start
String customerCode = getCustomerCode();
// 20111209 lirong add end
CustomerService customerService = ServiceLocator.getCustomerService(getLoginInfo());
OrderService orderService = ServiceLocator.getOrderService(getLoginInfo());
if (targetPage.equals("edit") || targetPage.equals("address") || targetPage.equals("inquiryEdit")) {
// 会员存在验证
if (StringUtil.isNullOrEmpty(customerCode) || customerService.isNotFound(customerCode)) {
setNextUrl("/app/service/member_info/init/delete");
setRequestBean(getBean());
return BackActionResult.RESULT_SUCCESS;
}
// 会员已退会时
if (customerService.isWithdrawed(customerCode)) {
addErrorMessage(Messages.getString("web.action.back.service.MemberInfoInitAction.1"));
setRequestBean(getBean());
return BackActionResult.RESULT_SUCCESS;
}
}
if (targetPage.equals("edit")) {
setNextUrl("/app/customer/customer_edit/select/" + customerCode);
} else if (targetPage.equals("address")) {
setNextUrl("/app/customer/address_list/init/" + customerCode);
} else if (targetPage.equals("inquiryEdit")) {
setNextUrl("/app/service/inquiry_edit/init/" + customerCode);
} else if (targetPage.equals("order")) {
// 订单编号存在验证
OrderHeader orderHeader = orderService.getOrderHeader(targetNo());
if (orderHeader == null) {
addErrorMessage(WebMessage.get(ServiceErrorMessage.NO_DATA_ERROR, Messages
.getString("web.action.back.service.MemberInfoMoveAction.1")));
setRequestBean(getBean());
return BackActionResult.RESULT_SUCCESS;
}
setNextUrl("/app/order/order_detail/init/" + targetNo());
} else if (targetPage.equals("shipping")) {
// 发货编号存在验证
ShippingHeader shippingHeader = orderService.getShippingHeader(targetNo());
if (shippingHeader == null) {
addErrorMessage(WebMessage.get(ServiceErrorMessage.NO_DATA_ERROR, Messages
.getString("web.action.back.service.MemberInfoMoveAction.2")));
setRequestBean(getBean());
return BackActionResult.RESULT_SUCCESS;
}
setNextUrl("/app/order/shipping_detail/init/" + targetNo());
} else if (targetPage.equals("member")) {
setNextUrl("/app/service/member_info/init");
} else if (targetPage.equals("inquiry")) {
setNextUrl("/app/service/inquiry_list/init");
} else if (targetPage.equals("inquiryDetail")) {
// 咨询编号存在验证
InquiryHeader inquiryHeader = customerService.getInquiryHeader(targetNo());
if (inquiryHeader == null) {
addErrorMessage(WebMessage.get(ServiceErrorMessage.NO_DATA_ERROR, Messages
.getString("web.action.back.service.MemberInfoMoveAction.3")));
setRequestBean(getBean());
return BackActionResult.RESULT_SUCCESS;
}
setNextUrl("/app/service/inquiry_detail/init/" + targetNo());
} else if (targetPage.equals("new")) {
setNextUrl("/app/order/neworder_commodity");
// 20131106 txw add start
} else if (targetPage.equals("refund")) {
setNextUrl("/app/service/card_refund/init/" + targetNo());
// 20131106 txw add end
} else {
return BackActionResult.SERVICE_ERROR;
}
// 前画面情報設定
DisplayTransition.add(getBean(), "/app/service/member_info/history_back/" + getBean().getDisplayHistoryMode(),
getSessionContainer());
return BackActionResult.RESULT_SUCCESS;
}
/**
* 从URL取得迁移画面。<BR>
*
* @return targetPage
*/
private String targetPage() {
String[] tmpArgs = getRequestParameter().getPathArgs();
if (tmpArgs.length > 0) {
return tmpArgs[0];
} else {
return "";
}
}
// 20111209 lirong add start
/**
* URLから顧客コードを取得します。<BR>
*
* @return customerCode
*/
private String getCustomerCode() {
String[] tmpArgs = getRequestParameter().getPathArgs();
if (tmpArgs.length > 1) {
return tmpArgs[1];
} else {
return "";
}
}
// 20111209 lirong add end
/**
* 从URL取得订单编号、发货编号。<BR>
*
* @return targetNo
*/
private String targetNo() {
String[] tmpArgs = getRequestParameter().getPathArgs();
if (tmpArgs.length > 1) {
return tmpArgs[1];
} else {
return "";
}
}
/**
* Action名の取得
*
* @return Action名
*/
public String getActionName() {
return Messages.getString("web.action.back.service.MemberInfoMoveAction.0");
}
/**
* オペレーションコードの取得
*
* @return オペレーションコード
*/
public String getOperationCode() {
return "8109011005";
}
}
| 6,843 | 0.652758 | 0.639475 | 195 | 30.815384 | 25.933382 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false |
12
|
f3a9aa2b4c8968cb313c0f4e6e1b91636365d3c9
| 2,680,059,603,408 |
0f4320b01f2da1e84e581f2f434fdb4ed3a68611
|
/src/main/java/com/mycompany/pizzaparlour/StaffList.java
|
103594fea788030dc44c412c3579aac60be7fffb
|
[] |
no_license
|
nthnt/ICS4U-Project
|
https://github.com/nthnt/ICS4U-Project
|
5054b32b4be2b97a77b8cc4d7cac141a29b7a441
|
1f24b451e5e1559e79e09844f85b9773c0d3ffdc
|
refs/heads/master
| 2023-02-16T05:01:12.656000 | 2021-01-16T02:33:50 | 2021-01-16T02:33:50 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mycompany.pizzaparlour;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Date;
import java.util.Scanner;
/**
* StaffList
* Date: 17/01/2020
* School: Northview Heights Secondary School
*
* The following class manipulates all instances of Staff and their details.
* This includes reading and writing from text files. Saving to and Loading from
* byte files, sorting arraylists of staff (by Manager OR Employee properties)
* and searching for customers in arraylists using Staff names or IDs. This
* mimics the characteristics of real life Staff working at a pizza parlour.
*
*
* @author Nathan Tang
* @version 1.0
*/
public class StaffList implements Serializable {
/*
implementing serializable allows objects in this class to be converted into a byte stream and
loaded onto a file (.dat file) that is saved everytime the program is finished running and loaded
everytime the program begins to run.
Example of/Related to: FILE INPUT/OUTPUT
*/
protected ArrayList<Staff> list = new ArrayList<>();
//ARRAY(LIST)OF OBJECTS
protected File file = new File("staff.txt");
protected File file2 = new File("logs.txt");
//indicates the text file to write the Staff details to
protected Path path = Paths.get("staff.txt");
protected Path path2 = Paths.get("logs.txt");
//indicates the text file to read Staff details from
protected Date date = new Date();
//records the date
/**
* writes the details of the arraylist of Staff to a text file using a
* FileWriter
*
* Example of/Related to: FILE INPUT/OUTPUT
*/
public void writeToStaff() {
try {
FileWriter fr = new FileWriter(file);
for (int i = 0; i < list.size(); i++) {
fr.write((list.get(i)).toString());
}
fr.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* reads the details of the specified text file line by line using a Scanner
* and prints it to console
*
* Example of/Related to: FILE INPUT/OUTPUT
*/
public void readFromStaff() {
try {
Scanner scan = new Scanner(path);
while (scan.hasNextLine()) {
String line = scan.nextLine();
System.out.println(line);
}
scan.close();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Saves the entire arraylist of Staff to a byte file. This used used after
* every program run in order to save everything for future logins and uses.
*
* Example of/Related to: FILE INPUT/OUTPUT
*/
public void saveStaff() {
try {
ObjectOutputStream hannah;
hannah = new ObjectOutputStream(new FileOutputStream("staffing.dat"));
hannah.writeObject(this.list);
hannah.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Reads the entire arraylist of Staff from specified byte file. This used
* used at the beginning of the program run in order to get previously saved
* and manipulated data.
*
* Example of/Related to: FILE INPUT/OUTPUT
*/
public void loadStaff() {
try {
ObjectInputStream nathan = new ObjectInputStream(new FileInputStream("staffing.dat"));
this.list = (ArrayList<Staff>) nathan.readObject();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Writes the who logged in and at what exact moment they logged in to a
* text file using a FileWriter.
*
* @param staff The staff member that logged in
*/
public void addLogin(Staff staff) {
try {
FileWriter fr = new FileWriter(file2, true);
fr.write(staff.getName() + " logged in on " + date.toString() + "\n");
fr.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* reads the details of the specified text file line by line using a Scanner
* and prints it to console
*
* Example of/Related to: FILE INPUT/OUTPUT
*/
public void loadLogin() {
try {
Scanner scan = new Scanner(path2);
while (scan.hasNextLine()) {
String line = scan.nextLine();
System.out.println(line);
}
scan.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Adds a Staff to the Staff arraylist of this class to be manipulated
*
* @param staff The Staff to be added to the arraylist of this class
*/
public void addStaff(Staff staff) {
(this.list).add(staff);
}
/**
* Removes a Staff from the Staff arraylist of this class.
*
* @param IndexOfRemoval The index of the Staff to be removed from the
* arraylist of this class
*/
public void removeStaff(int IndexOfRemoval) {
(this.list).remove(IndexOfRemoval);
}
/**
* The following searching algorithm searches for a Staff with a specified
* staffID and returns it. (linear search)
*
* Example of/Related to: SEARCHING
*
* @param staffID The staffID that corresponds to the Staff Member
* @return Staff The Staff Member
*/
public Staff findUsingID(int staffID) {
for (int i = 0; i < list.size(); i++) {
if ((list.get(i)).getStaffID() == staffID) {
return list.get(i);
}
}
return null;
}
/**
* The following searching algorithm searches for a Staff with a specified
* name and returns it. (linear search)
*
* Example of/Related to: SEARCHING
*
* @param fullName The full name that corresponds to the Staff Member
* @return Staff The Staff Member
*/
public Staff findUsingName(String fullName) {
String name = fullName.toUpperCase();
for (int a = 0; a < list.size(); a++) {
if ((list.get(a)).getName().equals(name)) {
return list.get(a);
}
}
return null;
}
/**
* The following method sorts the arraylist of Staff Members by alphabetical
* order using insertion sort Insertion sort is better for larger sets of
* elements, and because a Staff Member object is made quite often, it is
* more efficient to use insertion sort as there will be many elements as
* more Staff Members are made.
*
* The following is a VARIATION of insertion sort and instead of comparing
* direct numerical values, the names are compares LEXICOGRAPHICALLY
* instead. This allows for strings to be compared and if a positive value
* is returned, string1 comes alphabetically AFTER.
*
* e.g. string1.compareTo(String2) > 0
*
* Example of/Related to: SORTING
*/
public void sortAlphabetically() {
int i, j;
Staff key;
for (j = 1; j < list.size(); j++) {
key = list.get(j);
i = j - 1;
while (i >= 0) {
if (key.getName().compareTo(list.get(i).getName()) > 0) {
break;
}
Staff temp = list.get(i + 1);
list.set(i + 1, list.get(i));
list.set(i, temp);
i--;
}
}
}
/**
* The following method sorts the arraylist of Staff Members by number of
* Shifts using insertion sort Insertion sort is better for larger sets of
* elements, and because a Staff Member object is made quite often, it is
* more efficient to use insertion sort as there will be many elements as
* more Staff Members are made.
*
* Example of/Related to: SORTING
*/
public void sortNumShifts() {
for (int i = 1; i < list.size(); i++) {
Staff value = ((list.get(i)));
int j = i - 1;
while (j >= 0 && (list.get(j).getNumShifts()) > (list.get(i).getNumShifts())) {
list.set(j + 1, list.get(j));
j--;
}
list.set(j + 1, value);
}
}
/**
* The following method compiles all instances of Employee and stores them
* in an arraylist. This method makes it easier to sort Employees by their
* own unique characteristics that Managers may not have (such as hourly
* wage). This method then calls on the sortingHourlyWage method and passes
* off the new smaller arraylist of employees to be sorted. This method then
* prints out the details of the sorted arraylist.
*
* Example of/Related to: SORTING, POLYMORPHISM
*/
public void compilingEmps() {
ArrayList<Employee> temp = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
if (list.get(i) instanceof Employee) {
temp.add((Employee) list.get(i));
//Casting needed to convert Staff Objects to Employee Objects to be stored in the Employee arraylist
}
}
sortingHourlyWage(temp);
for (int a = 0; a < temp.size(); a++) {
System.out.println((temp.get(a)).toString());
}
}
/**
* The following method uses the arraylist of Employees and sorts them by
* selection sort. We decided to use selection sort because it is the most
* efficient for the following number of elements. Because the number of
* Employees is less than the overall number of Staff members, selection
* sort was used because it is more efficient when used with small sets of
* elements.
*
* @param emp The ArrayList of Employees needed to be sorted
*/
public void sortingHourlyWage(ArrayList<Employee> emp) {
int iPos;
int iMin;
for (iPos = 0; iPos < emp.size(); iPos++) {
iMin = iPos;
for (int i = iPos + 1; i < emp.size(); i++) {
if (((emp.get(i)).getHourlyWage()) > ((emp.get(iMin)).getHourlyWage())) {
iMin = i;
}
}
if (iMin != iPos) {
Employee temp = emp.get(iPos);
emp.set(iPos, emp.get(iMin));
emp.set(iMin, (temp));
}
}
}
/**
* The following method compiles all instances of Manager and stores them in
* an arraylist. This method makes it easier to sort Managers by their own
* unique characteristics that Employees may not have (such as rating). This
* method then calls on the sortingRating method and passes off the new
* smaller arraylist of managers to be sorted. This method then prints out
* the details of the sorted arraylist.
*
* Example of/Related to: SORTING, POLYMORPHISM
*/
public void compilingManagers() {
ArrayList<Manager> temp = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
if (list.get(i) instanceof Manager) {
temp.add((Manager) list.get(i));
//Casting needed to convert Staff Objects to Manager Objects to be stored in the Manager arraylist
}
}
sortingRating(temp);
for (int a = 0; a < temp.size(); a++) {
System.out.println((temp.get(a)).toString());
}
}
/**
* The following method uses the arraylist of Managers and sorts them by
* selection sort. We decided to use selection sort because it is the most
* efficient for the following number of elements. Because the number of
* Managers is less than the overall number of Staff members, selection sort
* was used because it is more efficient when used with small sets of
* elements.
*
* @param mng The arraylist of managers to be sorted
*/
public void sortingRating(ArrayList<Manager> mng) {
int iPos;
int iMin;
for (iPos = 0; iPos < mng.size(); iPos++) {
iMin = iPos;
for (int i = iPos + 1; i < mng.size(); i++) {
if (((mng.get(i)).getRating()) > ((mng.get(iMin)).getRating())) {
iMin = i;
}
}
if (iMin != iPos) {
Manager temp = mng.get(iPos);
mng.set(iPos, mng.get(iMin));
mng.set(iMin, (temp));
}
}
}
/**
* The following method adds the hourly wages of each employee and returns
* average hourly wage.
*
* @return double The average hourly wage of employees
*/
public double averageHourlyWage() {
double pay = 0;
int numEmployees = 0;
for (int i = 0; i < list.size(); i++) {
if ((list.get(i)) instanceof Employee) {
pay += ((Employee) (list.get(i))).getHourlyWage();
//Casting needed to convert Staff Objects to Employee Objects to use method .getHourlyWage()
numEmployees++;
}
}
return pay / numEmployees;
}
}
|
UTF-8
|
Java
| 13,960 |
java
|
StaffList.java
|
Java
|
[
{
"context": "ff working at a pizza parlour.\r\n *\r\n *\r\n * @author Nathan Tang\r\n * @version 1.0\r\n */\r\n\r\npublic class StaffList i",
"end": 945,
"score": 0.9998459815979004,
"start": 934,
"tag": "NAME",
"value": "Nathan Tang"
}
] | null |
[] |
package com.mycompany.pizzaparlour;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Date;
import java.util.Scanner;
/**
* StaffList
* Date: 17/01/2020
* School: Northview Heights Secondary School
*
* The following class manipulates all instances of Staff and their details.
* This includes reading and writing from text files. Saving to and Loading from
* byte files, sorting arraylists of staff (by Manager OR Employee properties)
* and searching for customers in arraylists using Staff names or IDs. This
* mimics the characteristics of real life Staff working at a pizza parlour.
*
*
* @author <NAME>
* @version 1.0
*/
public class StaffList implements Serializable {
/*
implementing serializable allows objects in this class to be converted into a byte stream and
loaded onto a file (.dat file) that is saved everytime the program is finished running and loaded
everytime the program begins to run.
Example of/Related to: FILE INPUT/OUTPUT
*/
protected ArrayList<Staff> list = new ArrayList<>();
//ARRAY(LIST)OF OBJECTS
protected File file = new File("staff.txt");
protected File file2 = new File("logs.txt");
//indicates the text file to write the Staff details to
protected Path path = Paths.get("staff.txt");
protected Path path2 = Paths.get("logs.txt");
//indicates the text file to read Staff details from
protected Date date = new Date();
//records the date
/**
* writes the details of the arraylist of Staff to a text file using a
* FileWriter
*
* Example of/Related to: FILE INPUT/OUTPUT
*/
public void writeToStaff() {
try {
FileWriter fr = new FileWriter(file);
for (int i = 0; i < list.size(); i++) {
fr.write((list.get(i)).toString());
}
fr.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* reads the details of the specified text file line by line using a Scanner
* and prints it to console
*
* Example of/Related to: FILE INPUT/OUTPUT
*/
public void readFromStaff() {
try {
Scanner scan = new Scanner(path);
while (scan.hasNextLine()) {
String line = scan.nextLine();
System.out.println(line);
}
scan.close();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Saves the entire arraylist of Staff to a byte file. This used used after
* every program run in order to save everything for future logins and uses.
*
* Example of/Related to: FILE INPUT/OUTPUT
*/
public void saveStaff() {
try {
ObjectOutputStream hannah;
hannah = new ObjectOutputStream(new FileOutputStream("staffing.dat"));
hannah.writeObject(this.list);
hannah.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Reads the entire arraylist of Staff from specified byte file. This used
* used at the beginning of the program run in order to get previously saved
* and manipulated data.
*
* Example of/Related to: FILE INPUT/OUTPUT
*/
public void loadStaff() {
try {
ObjectInputStream nathan = new ObjectInputStream(new FileInputStream("staffing.dat"));
this.list = (ArrayList<Staff>) nathan.readObject();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Writes the who logged in and at what exact moment they logged in to a
* text file using a FileWriter.
*
* @param staff The staff member that logged in
*/
public void addLogin(Staff staff) {
try {
FileWriter fr = new FileWriter(file2, true);
fr.write(staff.getName() + " logged in on " + date.toString() + "\n");
fr.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* reads the details of the specified text file line by line using a Scanner
* and prints it to console
*
* Example of/Related to: FILE INPUT/OUTPUT
*/
public void loadLogin() {
try {
Scanner scan = new Scanner(path2);
while (scan.hasNextLine()) {
String line = scan.nextLine();
System.out.println(line);
}
scan.close();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Adds a Staff to the Staff arraylist of this class to be manipulated
*
* @param staff The Staff to be added to the arraylist of this class
*/
public void addStaff(Staff staff) {
(this.list).add(staff);
}
/**
* Removes a Staff from the Staff arraylist of this class.
*
* @param IndexOfRemoval The index of the Staff to be removed from the
* arraylist of this class
*/
public void removeStaff(int IndexOfRemoval) {
(this.list).remove(IndexOfRemoval);
}
/**
* The following searching algorithm searches for a Staff with a specified
* staffID and returns it. (linear search)
*
* Example of/Related to: SEARCHING
*
* @param staffID The staffID that corresponds to the Staff Member
* @return Staff The Staff Member
*/
public Staff findUsingID(int staffID) {
for (int i = 0; i < list.size(); i++) {
if ((list.get(i)).getStaffID() == staffID) {
return list.get(i);
}
}
return null;
}
/**
* The following searching algorithm searches for a Staff with a specified
* name and returns it. (linear search)
*
* Example of/Related to: SEARCHING
*
* @param fullName The full name that corresponds to the Staff Member
* @return Staff The Staff Member
*/
public Staff findUsingName(String fullName) {
String name = fullName.toUpperCase();
for (int a = 0; a < list.size(); a++) {
if ((list.get(a)).getName().equals(name)) {
return list.get(a);
}
}
return null;
}
/**
* The following method sorts the arraylist of Staff Members by alphabetical
* order using insertion sort Insertion sort is better for larger sets of
* elements, and because a Staff Member object is made quite often, it is
* more efficient to use insertion sort as there will be many elements as
* more Staff Members are made.
*
* The following is a VARIATION of insertion sort and instead of comparing
* direct numerical values, the names are compares LEXICOGRAPHICALLY
* instead. This allows for strings to be compared and if a positive value
* is returned, string1 comes alphabetically AFTER.
*
* e.g. string1.compareTo(String2) > 0
*
* Example of/Related to: SORTING
*/
public void sortAlphabetically() {
int i, j;
Staff key;
for (j = 1; j < list.size(); j++) {
key = list.get(j);
i = j - 1;
while (i >= 0) {
if (key.getName().compareTo(list.get(i).getName()) > 0) {
break;
}
Staff temp = list.get(i + 1);
list.set(i + 1, list.get(i));
list.set(i, temp);
i--;
}
}
}
/**
* The following method sorts the arraylist of Staff Members by number of
* Shifts using insertion sort Insertion sort is better for larger sets of
* elements, and because a Staff Member object is made quite often, it is
* more efficient to use insertion sort as there will be many elements as
* more Staff Members are made.
*
* Example of/Related to: SORTING
*/
public void sortNumShifts() {
for (int i = 1; i < list.size(); i++) {
Staff value = ((list.get(i)));
int j = i - 1;
while (j >= 0 && (list.get(j).getNumShifts()) > (list.get(i).getNumShifts())) {
list.set(j + 1, list.get(j));
j--;
}
list.set(j + 1, value);
}
}
/**
* The following method compiles all instances of Employee and stores them
* in an arraylist. This method makes it easier to sort Employees by their
* own unique characteristics that Managers may not have (such as hourly
* wage). This method then calls on the sortingHourlyWage method and passes
* off the new smaller arraylist of employees to be sorted. This method then
* prints out the details of the sorted arraylist.
*
* Example of/Related to: SORTING, POLYMORPHISM
*/
public void compilingEmps() {
ArrayList<Employee> temp = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
if (list.get(i) instanceof Employee) {
temp.add((Employee) list.get(i));
//Casting needed to convert Staff Objects to Employee Objects to be stored in the Employee arraylist
}
}
sortingHourlyWage(temp);
for (int a = 0; a < temp.size(); a++) {
System.out.println((temp.get(a)).toString());
}
}
/**
* The following method uses the arraylist of Employees and sorts them by
* selection sort. We decided to use selection sort because it is the most
* efficient for the following number of elements. Because the number of
* Employees is less than the overall number of Staff members, selection
* sort was used because it is more efficient when used with small sets of
* elements.
*
* @param emp The ArrayList of Employees needed to be sorted
*/
public void sortingHourlyWage(ArrayList<Employee> emp) {
int iPos;
int iMin;
for (iPos = 0; iPos < emp.size(); iPos++) {
iMin = iPos;
for (int i = iPos + 1; i < emp.size(); i++) {
if (((emp.get(i)).getHourlyWage()) > ((emp.get(iMin)).getHourlyWage())) {
iMin = i;
}
}
if (iMin != iPos) {
Employee temp = emp.get(iPos);
emp.set(iPos, emp.get(iMin));
emp.set(iMin, (temp));
}
}
}
/**
* The following method compiles all instances of Manager and stores them in
* an arraylist. This method makes it easier to sort Managers by their own
* unique characteristics that Employees may not have (such as rating). This
* method then calls on the sortingRating method and passes off the new
* smaller arraylist of managers to be sorted. This method then prints out
* the details of the sorted arraylist.
*
* Example of/Related to: SORTING, POLYMORPHISM
*/
public void compilingManagers() {
ArrayList<Manager> temp = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
if (list.get(i) instanceof Manager) {
temp.add((Manager) list.get(i));
//Casting needed to convert Staff Objects to Manager Objects to be stored in the Manager arraylist
}
}
sortingRating(temp);
for (int a = 0; a < temp.size(); a++) {
System.out.println((temp.get(a)).toString());
}
}
/**
* The following method uses the arraylist of Managers and sorts them by
* selection sort. We decided to use selection sort because it is the most
* efficient for the following number of elements. Because the number of
* Managers is less than the overall number of Staff members, selection sort
* was used because it is more efficient when used with small sets of
* elements.
*
* @param mng The arraylist of managers to be sorted
*/
public void sortingRating(ArrayList<Manager> mng) {
int iPos;
int iMin;
for (iPos = 0; iPos < mng.size(); iPos++) {
iMin = iPos;
for (int i = iPos + 1; i < mng.size(); i++) {
if (((mng.get(i)).getRating()) > ((mng.get(iMin)).getRating())) {
iMin = i;
}
}
if (iMin != iPos) {
Manager temp = mng.get(iPos);
mng.set(iPos, mng.get(iMin));
mng.set(iMin, (temp));
}
}
}
/**
* The following method adds the hourly wages of each employee and returns
* average hourly wage.
*
* @return double The average hourly wage of employees
*/
public double averageHourlyWage() {
double pay = 0;
int numEmployees = 0;
for (int i = 0; i < list.size(); i++) {
if ((list.get(i)) instanceof Employee) {
pay += ((Employee) (list.get(i))).getHourlyWage();
//Casting needed to convert Staff Objects to Employee Objects to use method .getHourlyWage()
numEmployees++;
}
}
return pay / numEmployees;
}
}
| 13,955 | 0.561819 | 0.558739 | 419 | 31.312649 | 27.213907 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.341289 | false | false |
12
|
67c36a0e8a3d2bc32f74f4dd418c005ce2703cac
| 24,378,234,425,444 |
5fa363391cb4271cdfa6a89a56684d689648d673
|
/src/main/java/基础类/String_01.java
|
2fe8fac3c510c8b654665fdf8667d645680e9aad
|
[] |
no_license
|
YukunSun/concurrent
|
https://github.com/YukunSun/concurrent
|
63c8b017df683577f4d3efcc58766216f593037c
|
b54b6c6125397b2b198c3a5db562c0590573c6f7
|
refs/heads/master
| 2021-06-11T18:42:17.789000 | 2021-06-10T15:32:48 | 2021-06-10T15:32:48 | 75,477,941 | 1 | 0 | null | false | 2020-12-22T02:42:42 | 2016-12-03T14:18:20 | 2020-12-22T02:42:08 | 2020-12-22T02:42:06 | 77 | 0 | 0 | 0 |
Java
| false | false |
package 基础类;
/**
* Author: sun.yukun@foxmail.com
* Time: 2017/10/27 下午10:30
* Blog: coderdaily.net
*/
public class String_01 {
public static void main(String[] args) {
String str = "abcd";
System.out.println(str.replace('d', 'D'));
System.out.println(str);
String str1 = "hello world";
String str2 = new String("hello world");
String str3 = "hello world";
String str4 = new String("hello world");
System.out.println(str1 == str2);
System.out.println(str1 == str3);
System.out.println(str2 == str4);
/*链接:https://www.nowcoder.com/questionTerminal/17068b08ab1c4c50a012397ec9a272a6?toCommentId=421749
来源:牛客网
String str1 = "hello";
这里的str1指的是方法区中的字符串常量池中的“hello”,编译时期就知道的;
String str2 = "he" + new String("llo");
这里的str2必须在运行时才知道str2是什么,所以它是指向的是堆里定义的字符串“hello”,所以这两个引用是不一样的。
如果用str1.equal(str2),那么返回的是true;因为String类重写了equals()方法。
编译器没那么智能,它不知道"he" + new String("llo")的内容是什么,所以才不敢贸然把"hello"这个对象的引用赋给str2.
如果语句改为:"he"+"llo"这样就是true了。
*/
String str5 = "hello";
String str6 = "he" + new String("llo");
System.out.println(str5 == str6);//false
String str7 = new String("hello");
String str8 = new String("hello");
System.out.println(str7 == str8);
}
}
|
UTF-8
|
Java
| 1,692 |
java
|
String_01.java
|
Java
|
[
{
"context": "package 基础类;\n\n/**\n * Author: sun.yukun@foxmail.com\n * Time: 2017/10/27 下午10:30\n * Blog: coderdaily.n",
"end": 50,
"score": 0.9998966455459595,
"start": 29,
"tag": "EMAIL",
"value": "sun.yukun@foxmail.com"
}
] | null |
[] |
package 基础类;
/**
* Author: <EMAIL>
* Time: 2017/10/27 下午10:30
* Blog: coderdaily.net
*/
public class String_01 {
public static void main(String[] args) {
String str = "abcd";
System.out.println(str.replace('d', 'D'));
System.out.println(str);
String str1 = "hello world";
String str2 = new String("hello world");
String str3 = "hello world";
String str4 = new String("hello world");
System.out.println(str1 == str2);
System.out.println(str1 == str3);
System.out.println(str2 == str4);
/*链接:https://www.nowcoder.com/questionTerminal/17068b08ab1c4c50a012397ec9a272a6?toCommentId=421749
来源:牛客网
String str1 = "hello";
这里的str1指的是方法区中的字符串常量池中的“hello”,编译时期就知道的;
String str2 = "he" + new String("llo");
这里的str2必须在运行时才知道str2是什么,所以它是指向的是堆里定义的字符串“hello”,所以这两个引用是不一样的。
如果用str1.equal(str2),那么返回的是true;因为String类重写了equals()方法。
编译器没那么智能,它不知道"he" + new String("llo")的内容是什么,所以才不敢贸然把"hello"这个对象的引用赋给str2.
如果语句改为:"he"+"llo"这样就是true了。
*/
String str5 = "hello";
String str6 = "he" + new String("llo");
System.out.println(str5 == str6);//false
String str7 = new String("hello");
String str8 = new String("hello");
System.out.println(str7 == str8);
}
}
| 1,678 | 0.623785 | 0.572924 | 47 | 27.446808 | 23.651556 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.468085 | false | false |
12
|
49fa43409bb0584614db07636a81e077739b900b
| 6,244,882,491,645 |
6644d0bed2987ad6429623d0686a945b6f900aae
|
/OracleDemo/src/main/java/OracleDemo/OracleDemo/App.java
|
ebbfae7ff572934e0ecf9d579cd684bb74b5651c
|
[] |
no_license
|
VineySidhu/Silenium
|
https://github.com/VineySidhu/Silenium
|
18b4f081d34137afe1323d07912bce74e25ceea8
|
5ca18054eb4ecfd84149d388724493616193ff74
|
refs/heads/master
| 2022-11-20T15:59:40.788000 | 2020-02-12T06:32:35 | 2020-02-12T06:32:35 | 228,194,404 | 0 | 0 | null | false | 2022-11-16T05:35:08 | 2019-12-15T14:06:36 | 2020-02-12T06:32:40 | 2022-11-16T05:35:05 | 2,815 | 0 | 0 | 15 |
HTML
| false | false |
package OracleDemo.OracleDemo;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args ) throws SQLException
{
String dbUrl = "jdbc:oracle:thin:@10.51.11.165:1590/EEOCMPD1DR.tdeprdcl.internal";
////Database Username
String username = "EOC_READ";
//Database Password
String password = "eoc_read";
//Query to Execute
String query = "SELECT * FROM EOC.OM_ORDER_HEADER_POSTPAID WHERE STATUS='O_R_ERR' Fetch first 2 rows only";
List<String> myList = new ArrayList<String>();
//Create Connection to DB
Connection con = DriverManager.getConnection(dbUrl,username,password);
//Create Statement Object
Statement stmt = con.createStatement();
// Execute the SQL Query. Store results in ResultSet
ResultSet rs= stmt.executeQuery(query);
// While Loop to iterate through all data and print results
while (rs.next()){
String myAge = rs.getString(2);
String orderId=rs.getString(2);
String order=rs.getString("CWORDERID");
myList.add("'"+orderId+"'");
System. out.println(order+" "+myAge);
}
System. out.println(myList);
// closing DB Connection
con.close();
}
}
|
UTF-8
|
Java
| 1,597 |
java
|
App.java
|
Java
|
[
{
"context": "n\r\n {\r\n \t String dbUrl = \"jdbc:oracle:thin:@10.51.11.165:1590/EEOCMPD1DR.tdeprdcl.internal\";\t\t\t\t\t\r\n\r\n\t\t\t//",
"end": 415,
"score": 0.9996926188468933,
"start": 403,
"tag": "IP_ADDRESS",
"value": "10.51.11.165"
},
{
"context": "\t\t\t////Database Username\t\t\r\n\t\t\tString username = \"EOC_READ\";\t\r\n \r\n\t\t\t//Database Password\t\t\r\n\t\t\tString p",
"end": 518,
"score": 0.9968381524085999,
"start": 510,
"tag": "USERNAME",
"value": "EOC_READ"
},
{
"context": "\r\n\t\t\t//Database Password\t\t\r\n\t\t\tString password = \"eoc_read\";\t\t\t\t\r\n\r\n\t\t\t//Query to Execute\t\t\r\n\t\t\tString query",
"end": 587,
"score": 0.9994310736656189,
"start": 579,
"tag": "PASSWORD",
"value": "eoc_read"
}
] | null |
[] |
package OracleDemo.OracleDemo;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args ) throws SQLException
{
String dbUrl = "jdbc:oracle:thin:@10.51.11.165:1590/EEOCMPD1DR.tdeprdcl.internal";
////Database Username
String username = "EOC_READ";
//Database Password
String password = "<PASSWORD>";
//Query to Execute
String query = "SELECT * FROM EOC.OM_ORDER_HEADER_POSTPAID WHERE STATUS='O_R_ERR' Fetch first 2 rows only";
List<String> myList = new ArrayList<String>();
//Create Connection to DB
Connection con = DriverManager.getConnection(dbUrl,username,password);
//Create Statement Object
Statement stmt = con.createStatement();
// Execute the SQL Query. Store results in ResultSet
ResultSet rs= stmt.executeQuery(query);
// While Loop to iterate through all data and print results
while (rs.next()){
String myAge = rs.getString(2);
String orderId=rs.getString(2);
String order=rs.getString("CWORDERID");
myList.add("'"+orderId+"'");
System. out.println(order+" "+myAge);
}
System. out.println(myList);
// closing DB Connection
con.close();
}
}
| 1,599 | 0.599249 | 0.588604 | 56 | 26.517857 | 24.904812 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.339286 | false | false |
12
|
afd30b0a95a2339b80d791276fd8451811d587e2
| 4,690,104,336,383 |
5f89ca07a709cda1ae001557228ea7e7bc7db0df
|
/hap/src/com/hand/hap/intergration/util/HapInvokeExceptionUtils.java
|
7b965dd225eb80a92efabf82350393080e3b4e4c
|
[] |
no_license
|
wang18140673019/orderhap
|
https://github.com/wang18140673019/orderhap
|
c4b437785a6ce08cfd96f1b70bd11c4bc38b120a
|
d7302221aed69717eb302a7971329fc8b4160d8d
|
refs/heads/master
| 2019-04-23T14:21:31.077000 | 2017-06-07T03:44:36 | 2017-06-07T03:44:36 | 93,586,444 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hand.hap.intergration.util;
import org.apache.commons.lang.exception.ExceptionUtils;
/**
* Created by Qixiangyu on 2017/2/21.
*/
public class HapInvokeExceptionUtils {
private static final int DEFAULT_LINE = 30;
/**
* 截取root cause的前n行信息
* update 固定使用 DEFAULT_LINE ,参数n不在起作用
* @return
*/
public static String getRootCauseStackTrace(Throwable throwable){
String [] stackTraces = ExceptionUtils.getRootCauseStackTrace(throwable);
String root = null;
//固定30行
int line = DEFAULT_LINE;
if(stackTraces !=null && stackTraces.length >0) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < line && i<stackTraces.length; i++) {
sb.append(stackTraces[i]+"\n");
}
root = sb.toString();
}
return root;
}
}
|
UTF-8
|
Java
| 925 |
java
|
HapInvokeExceptionUtils.java
|
Java
|
[
{
"context": ".lang.exception.ExceptionUtils;\n\n/**\n * Created by Qixiangyu on 2017/2/21.\n */\npublic class HapInvokeExcepti",
"end": 124,
"score": 0.6799263954162598,
"start": 117,
"tag": "USERNAME",
"value": "Qixiang"
},
{
"context": "ception.ExceptionUtils;\n\n/**\n * Created by Qixiangyu on 2017/2/21.\n */\npublic class HapInvokeException",
"end": 126,
"score": 0.5989841222763062,
"start": 124,
"tag": "NAME",
"value": "yu"
}
] | null |
[] |
package com.hand.hap.intergration.util;
import org.apache.commons.lang.exception.ExceptionUtils;
/**
* Created by Qixiangyu on 2017/2/21.
*/
public class HapInvokeExceptionUtils {
private static final int DEFAULT_LINE = 30;
/**
* 截取root cause的前n行信息
* update 固定使用 DEFAULT_LINE ,参数n不在起作用
* @return
*/
public static String getRootCauseStackTrace(Throwable throwable){
String [] stackTraces = ExceptionUtils.getRootCauseStackTrace(throwable);
String root = null;
//固定30行
int line = DEFAULT_LINE;
if(stackTraces !=null && stackTraces.length >0) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < line && i<stackTraces.length; i++) {
sb.append(stackTraces[i]+"\n");
}
root = sb.toString();
}
return root;
}
}
| 925 | 0.600454 | 0.585698 | 32 | 26.53125 | 23.615387 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false |
12
|
faa2cd748914c5f1169b774de58a3f184f9b32a3
| 28,991,029,315,698 |
22df0d7d68db13e444cdd1add5a04d41d5cfd5a5
|
/simplTests/test/legacy/tests/person/StudentDirectory.java
|
e6f9cd5ac028cf985c7b257b7aa8327b7f343df1
|
[] |
no_license
|
ecologylab/simplJava
|
https://github.com/ecologylab/simplJava
|
3b6ef9e8ff0462d01eafa8e0d56b41f7576c5f0d
|
e35cf976b8339336345e4389f74a346e11c7bd3c
|
refs/heads/master
| 2021-01-22T07:47:59.363000 | 2017-06-13T08:05:19 | 2017-06-13T08:05:19 | 7,779,996 | 1 | 2 | null | false | 2016-03-19T08:06:54 | 2013-01-23T17:37:10 | 2015-03-09T17:11:32 | 2015-03-09T17:11:29 | 35,789 | 1 | 3 | 60 |
Java
| null | null |
package legacy.tests.person;
import java.util.ArrayList;
import legacy.tests.TestCase;
import legacy.tests.TestingUtils;
import ecologylab.serialization.SIMPLTranslationException;
import ecologylab.serialization.SimplTypesScope;
import ecologylab.serialization.annotations.Hint;
import ecologylab.serialization.annotations.simpl_collection;
import ecologylab.serialization.annotations.simpl_hints;
import ecologylab.serialization.annotations.simpl_nowrap;
import ecologylab.serialization.annotations.simpl_scalar;
import ecologylab.serialization.formatenums.Format;
public class StudentDirectory implements TestCase
{
@simpl_nowrap
@simpl_collection("student")
private ArrayList<Student> students = new ArrayList<Student>();
@simpl_hints(Hint.XML_LEAF)
@simpl_scalar
String test = null;
public StudentDirectory()
{
this.setStudents(new ArrayList<Student>());
}
public void setStudents(ArrayList<Student> students)
{
this.students = students;
}
public ArrayList<Student> getStudents()
{
return students;
}
public void initializeDirectory()
{
students.add(new Student("nabeel", "234342"));
students.add(new Student("yin", "423423"));
students.add(new Student("bill", "4234234"));
students.add(new Student("sashi", "5454"));
students.add(new Student("jon", "656565"));
test = "nabel";
}
@Override
public void runTest() throws SIMPLTranslationException
{
StudentDirectory s = new StudentDirectory();
s.initializeDirectory();
SimplTypesScope translationScope = SimplTypesScope.get("studentDirectoryTScope", Person.class, Student.class,
StudentDirectory.class);
TestingUtils.test(s, translationScope, Format.XML);
TestingUtils.test(s, translationScope, Format.JSON);
TestingUtils.test(s, translationScope, Format.TLV);
}
}
|
UTF-8
|
Java
| 1,868 |
java
|
StudentDirectory.java
|
Java
|
[
{
"context": "t(\"yin\", \"423423\"));\r\n\t\tstudents.add(new Student(\"bill\", \"4234234\"));\r\n\t\tstudents.add(new Student(\"sashi",
"end": 1251,
"score": 0.986689031124115,
"start": 1247,
"tag": "NAME",
"value": "bill"
},
{
"context": "\"bill\", \"4234234\"));\r\n\t\tstudents.add(new Student(\"sashi\", \"5454\"));\r\n\t\tstudents.add(new Student(\"jon\", \"6",
"end": 1301,
"score": 0.718519926071167,
"start": 1296,
"tag": "NAME",
"value": "sashi"
},
{
"context": "t(\"sashi\", \"5454\"));\r\n\t\tstudents.add(new Student(\"jon\", \"656565\"));\r\n\t\t\r\n\t\ttest = \"nabel\";\r\n\t\t\r\n\t}\r\n\r\n\t",
"end": 1346,
"score": 0.982377290725708,
"start": 1343,
"tag": "NAME",
"value": "jon"
}
] | null |
[] |
package legacy.tests.person;
import java.util.ArrayList;
import legacy.tests.TestCase;
import legacy.tests.TestingUtils;
import ecologylab.serialization.SIMPLTranslationException;
import ecologylab.serialization.SimplTypesScope;
import ecologylab.serialization.annotations.Hint;
import ecologylab.serialization.annotations.simpl_collection;
import ecologylab.serialization.annotations.simpl_hints;
import ecologylab.serialization.annotations.simpl_nowrap;
import ecologylab.serialization.annotations.simpl_scalar;
import ecologylab.serialization.formatenums.Format;
public class StudentDirectory implements TestCase
{
@simpl_nowrap
@simpl_collection("student")
private ArrayList<Student> students = new ArrayList<Student>();
@simpl_hints(Hint.XML_LEAF)
@simpl_scalar
String test = null;
public StudentDirectory()
{
this.setStudents(new ArrayList<Student>());
}
public void setStudents(ArrayList<Student> students)
{
this.students = students;
}
public ArrayList<Student> getStudents()
{
return students;
}
public void initializeDirectory()
{
students.add(new Student("nabeel", "234342"));
students.add(new Student("yin", "423423"));
students.add(new Student("bill", "4234234"));
students.add(new Student("sashi", "5454"));
students.add(new Student("jon", "656565"));
test = "nabel";
}
@Override
public void runTest() throws SIMPLTranslationException
{
StudentDirectory s = new StudentDirectory();
s.initializeDirectory();
SimplTypesScope translationScope = SimplTypesScope.get("studentDirectoryTScope", Person.class, Student.class,
StudentDirectory.class);
TestingUtils.test(s, translationScope, Format.XML);
TestingUtils.test(s, translationScope, Format.JSON);
TestingUtils.test(s, translationScope, Format.TLV);
}
}
| 1,868 | 0.741435 | 0.72591 | 68 | 25.5 | 24.316843 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.691176 | false | false |
12
|
44e40158df39ff7203135ba307be63749daca8e4
| 21,234,318,378,351 |
a6b644803fdb5d8be508bc17586e7865c3799ff5
|
/app/src/main/java/com/rachel/neteaselearning2019/过滤数据/Test.java
|
269308e7ea960f1f81ffc09475efc33b6cb9b8e8
|
[] |
no_license
|
Rachel-hsw/NetEaseLearning2019
|
https://github.com/Rachel-hsw/NetEaseLearning2019
|
563be2077076b20c497a71a837374eb4823cb44d
|
5056faa0c4ea752f6ba5ea678262a9354baf8cae
|
refs/heads/master
| 2020-09-01T08:19:11.860000 | 2019-12-27T08:04:46 | 2019-12-27T08:04:46 | 218,918,431 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.rachel.neteaselearning2019.过滤数据;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 过滤数据
* https://www.cnblogs.com/wanghao1874/p/10115553.html
* 请问一个比较小白的问题,list<book> listbook只知道book的bookname,怎么找出该书名的位置,我用listbook.indexof(bookname)返回一直是-1
* 详情查看对话记录
*/
public class Test {
public static void main(String[] args) {
// 需要过滤出排除姓名为张三的数据
List<book> bookList = new ArrayList<>();
bookList.add(new book(99, "大帝姬", 18));
bookList.add(new book(4, "剑来", 11));
bookList.add(new book(1, "大道朝天", 18));
bookList.add(new book(3, "雪中悍刀行", 18));
bookList.add(new book(2, "剑来", 16));
bookList.add(new book(8, "剑来", 12));
System.out.println("所有数据:" + bookList);
// 主要过滤运用了8中Lambda表达式和filter这个方法
System.out.println("过滤后的数据:" + bookList.stream().filter(u -> u.getBookName() == "剑来").collect(Collectors.toList()));
List<book> books = bookList.stream().filter(u -> u.getBookName() == "剑来").collect(Collectors.toList());
if (books.size() != 0) {
int index = bookList.indexOf(books.get(0));
System.out.println("位置:" + index);
}
}
}
|
UTF-8
|
Java
| 1,449 |
java
|
Test.java
|
Java
|
[
{
"context": "llectors;\n\n/**\n * 过滤数据\n * https://www.cnblogs.com/wanghao1874/p/10115553.html\n * 请问一个比较小白的问题,list<book> listboo",
"end": 184,
"score": 0.9996371865272522,
"start": 173,
"tag": "USERNAME",
"value": "wanghao1874"
}
] | null |
[] |
package com.rachel.neteaselearning2019.过滤数据;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 过滤数据
* https://www.cnblogs.com/wanghao1874/p/10115553.html
* 请问一个比较小白的问题,list<book> listbook只知道book的bookname,怎么找出该书名的位置,我用listbook.indexof(bookname)返回一直是-1
* 详情查看对话记录
*/
public class Test {
public static void main(String[] args) {
// 需要过滤出排除姓名为张三的数据
List<book> bookList = new ArrayList<>();
bookList.add(new book(99, "大帝姬", 18));
bookList.add(new book(4, "剑来", 11));
bookList.add(new book(1, "大道朝天", 18));
bookList.add(new book(3, "雪中悍刀行", 18));
bookList.add(new book(2, "剑来", 16));
bookList.add(new book(8, "剑来", 12));
System.out.println("所有数据:" + bookList);
// 主要过滤运用了8中Lambda表达式和filter这个方法
System.out.println("过滤后的数据:" + bookList.stream().filter(u -> u.getBookName() == "剑来").collect(Collectors.toList()));
List<book> books = bookList.stream().filter(u -> u.getBookName() == "剑来").collect(Collectors.toList());
if (books.size() != 0) {
int index = bookList.indexOf(books.get(0));
System.out.println("位置:" + index);
}
}
}
| 1,449 | 0.623248 | 0.591096 | 32 | 36.90625 | 29.898117 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.90625 | false | false |
12
|
b596df50baa6d1ff7cea7f28f83c7082df387f66
| 13,108,240,246,839 |
48ae361c2896c363e443e8ea53ad5c3c22c494ff
|
/src/main/java/com/atypon/literatumproject/accesscontrol/licenses/License.java
|
b8014a72c4be35ea2b008c1f2647d830fc6194ac
|
[] |
no_license
|
MohammadAbuMayyaleh/literatum-project
|
https://github.com/MohammadAbuMayyaleh/literatum-project
|
16948481257e4b59e4837d4bbb6abf02c17f2a5d
|
9ae288b57ffd8aabadeda3febf781f5bd0e1f9b4
|
refs/heads/master
| 2020-04-12T12:43:06.301000 | 2018-12-19T23:05:20 | 2018-12-19T23:05:20 | 162,500,224 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.atypon.literatumproject.accesscontrol.licenses;
public interface License {
public boolean isStillValid();
}
|
UTF-8
|
Java
| 126 |
java
|
License.java
|
Java
|
[] | null |
[] |
package com.atypon.literatumproject.accesscontrol.licenses;
public interface License {
public boolean isStillValid();
}
| 126 | 0.793651 | 0.793651 | 6 | 20 | 22.037846 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
12
|
b6bb77beb7de3052ef16b4cf7245d65bd779aca1
| 6,124,623,392,191 |
38b87baf149d67cfd070ac176c5104919af132fe
|
/src/org/lindev/androkom/text/CreateTextTask.java
|
a2f31bd4c9eb6a9bd02db38671c428e4d85c19a1
|
[] |
no_license
|
pajp/androkom
|
https://github.com/pajp/androkom
|
a2b63d6dc657ce8003a454035fc9dd43abfb76b2
|
101ab8306aab92f6b3cdaff52e519fc1893030a2
|
refs/heads/master
| 2021-01-21T00:29:41.026000 | 2012-02-12T20:06:30 | 2012-02-12T20:06:30 | 1,119,802 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.lindev.androkom.text;
import java.io.IOException;
import java.util.List;
import nu.dll.lyskom.AuxItem;
import nu.dll.lyskom.Text;
import nu.dll.lyskom.TextStat;
import org.lindev.androkom.ConferencePrefs;
import org.lindev.androkom.KomServer;
import org.lindev.androkom.R;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.AsyncTask;
import android.util.Log;
public class CreateTextTask extends AsyncTask<Void, Void, Object> {
private static final String TAG = "Androkom CreateTextTask";
private final ProgressDialog mDialog;
private final Context mContext;
private final KomServer mKom;
private final String mSubject;
private final double mLat;
private final double mLon;
private final double mPrecision;
private final String mBody;
private final byte[] imgData;
private final int mInReplyTo;
private final List<Recipient> mRecipients;
private final CreateTextRunnable mRunnable;
private boolean mUserIsMemberOfSomeConf;
public interface CreateTextRunnable {
public void run(final Text text);
}
public CreateTextTask(final Context context, final KomServer kom, final String subject, final String body,
final double loc_lat, final double loc_lon, final double loc_precision,
final int inReplyTo, final List<Recipient> recipients, final CreateTextRunnable runnable) {
this.mDialog = new ProgressDialog(context);
this.mContext = context;
this.mKom = kom;
this.mSubject = subject;
this.mLat = loc_lat;
this.mLon = loc_lon;
this.mPrecision = loc_precision;
this.mBody = body;
this.imgData = null;
this.mInReplyTo = inReplyTo;
this.mRecipients = recipients;
this.mRunnable = runnable;
this.mUserIsMemberOfSomeConf = false;
}
public CreateTextTask(final Context context, final KomServer kom, final String subject, final String body,
final int inReplyTo, final List<Recipient> recipients, final CreateTextRunnable runnable) {
this.mDialog = new ProgressDialog(context);
this.mContext = context;
this.mKom = kom;
this.mSubject = subject;
this.mLat = 0;
this.mLon = 0;
this.mPrecision = 0;
this.mBody = body;
this.imgData = null;
this.mInReplyTo = inReplyTo;
this.mRecipients = recipients;
this.mRunnable = runnable;
this.mUserIsMemberOfSomeConf = false;
}
public CreateTextTask(final Context context, final KomServer kom, final String subject, final byte[] imgdata,
final int inReplyTo, final List<Recipient> recipients, final CreateTextRunnable runnable) {
this.mDialog = new ProgressDialog(context);
this.mContext = context;
this.mKom = kom;
this.mSubject = subject;
this.mLat = 0;
this.mLon = 0;
this.mPrecision = 0;
this.mBody = "";
this.imgData = imgdata;
this.mInReplyTo = inReplyTo;
this.mRecipients = recipients;
this.mRunnable = runnable;
this.mUserIsMemberOfSomeConf = false;
}
@Override
protected void onPreExecute() {
mDialog.setCancelable(false);
mDialog.setIndeterminate(true);
mDialog.setMessage(mContext.getString(R.string.CTT_creating_text));
mDialog.show();
}
@SuppressWarnings("deprecation")
@Override
protected Object doInBackground(final Void... args) {
final Text text = new Text();
if (mInReplyTo > 0) {
text.addCommented(mInReplyTo);
}
for (final Recipient recipient : mRecipients) {
try {
switch (recipient.type) {
case RECP_TO:
text.addRecipient(recipient.recipientId);
break;
case RECP_CC:
text.addCcRecipient(recipient.recipientId);
break;
case RECP_BCC:
if (text.getStat().hasRecipient(recipient.recipientId)) {
throw new IllegalArgumentException(recipient.recipientId + mContext.getString(R.string.CTT_already_recipient));
}
text.addMiscInfoEntry(TextStat.miscBccRecpt, recipient.recipientId);
break;
}
if (mKom.getSession().isMemberOf(recipient.recipientId)) {
mUserIsMemberOfSomeConf = true;
}
}
catch (final IOException e) {
return "IOException";
}
catch (final IllegalArgumentException e) {
// Conference is already recipient. Just ignore.
}
}
if (imgData == null) {
// Regular text
final byte[] subjectBytes = mSubject.getBytes();
final byte[] bodyBytes = mBody.getBytes();
byte[] contents = new byte[subjectBytes.length + bodyBytes.length
+ 1];
System.arraycopy(subjectBytes, 0, contents, 0, subjectBytes.length);
System.arraycopy(bodyBytes, 0, contents, subjectBytes.length + 1,
bodyBytes.length);
contents[subjectBytes.length] = (byte) '\n';
text.setContents(contents);
text.getStat().setAuxItem(
new AuxItem(AuxItem.tagContentType,
"text/x-kom-basic;charset=utf-8"));
} else {
// image
final byte[] subjectBytes = mSubject.getBytes();
byte[] contents = new byte[subjectBytes.length + imgData.length + 1];
System.arraycopy(subjectBytes, 0, contents, 0, subjectBytes.length);
System.arraycopy(imgData, 0, contents, subjectBytes.length + 1,
imgData.length);
contents[subjectBytes.length] = (byte) '\n';
text.setContents(contents);
text.getStat().setAuxItem(
new AuxItem(AuxItem.tagContentType,
"image/jpeg; name=dummy.jpg"));
}
if((ConferencePrefs.getIncludeLocation(mContext)) &&
(mPrecision>0.0)) {
String tagvalue = ""+mLat+" "+mLon+" "+mPrecision;
Log.i(TAG, "aux pos="+tagvalue);
text.getStat().setAuxItem(new AuxItem(AuxItem.tagCreationLocation, tagvalue));
}
return text;
}
@Override
protected void onPostExecute(final Object arg) {
mDialog.dismiss();
if (arg instanceof String) {
final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setTitle((String) arg);
builder.setPositiveButton(mContext.getString(R.string.alert_dialog_ok), null);
builder.create().show();
}
final Text text = (Text) arg;
if (mUserIsMemberOfSomeConf) {
if (mRunnable != null) {
mRunnable.run(text);
}
}
else {
final OnClickListener listener = new OnClickListener() {
public void onClick(final DialogInterface dialog, final int which) {
if (which == AlertDialog.BUTTON_NEUTRAL) {
return;
}
if (which == AlertDialog.BUTTON_POSITIVE) {
text.addRecipient(mKom.getUserId());
}
if (mRunnable != null) {
mRunnable.run(text);
}
}
};
final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setTitle(mContext.getString(R.string.CTT_not_member));
builder.setPositiveButton(mContext.getString(R.string.yes), listener);
builder.setNegativeButton(mContext.getString(R.string.no), listener);
builder.setNeutralButton(mContext.getString(R.string.cancel), listener);
builder.create().show();
}
}
}
|
UTF-8
|
Java
| 8,269 |
java
|
CreateTextTask.java
|
Java
|
[] | null |
[] |
package org.lindev.androkom.text;
import java.io.IOException;
import java.util.List;
import nu.dll.lyskom.AuxItem;
import nu.dll.lyskom.Text;
import nu.dll.lyskom.TextStat;
import org.lindev.androkom.ConferencePrefs;
import org.lindev.androkom.KomServer;
import org.lindev.androkom.R;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.AsyncTask;
import android.util.Log;
public class CreateTextTask extends AsyncTask<Void, Void, Object> {
private static final String TAG = "Androkom CreateTextTask";
private final ProgressDialog mDialog;
private final Context mContext;
private final KomServer mKom;
private final String mSubject;
private final double mLat;
private final double mLon;
private final double mPrecision;
private final String mBody;
private final byte[] imgData;
private final int mInReplyTo;
private final List<Recipient> mRecipients;
private final CreateTextRunnable mRunnable;
private boolean mUserIsMemberOfSomeConf;
public interface CreateTextRunnable {
public void run(final Text text);
}
public CreateTextTask(final Context context, final KomServer kom, final String subject, final String body,
final double loc_lat, final double loc_lon, final double loc_precision,
final int inReplyTo, final List<Recipient> recipients, final CreateTextRunnable runnable) {
this.mDialog = new ProgressDialog(context);
this.mContext = context;
this.mKom = kom;
this.mSubject = subject;
this.mLat = loc_lat;
this.mLon = loc_lon;
this.mPrecision = loc_precision;
this.mBody = body;
this.imgData = null;
this.mInReplyTo = inReplyTo;
this.mRecipients = recipients;
this.mRunnable = runnable;
this.mUserIsMemberOfSomeConf = false;
}
public CreateTextTask(final Context context, final KomServer kom, final String subject, final String body,
final int inReplyTo, final List<Recipient> recipients, final CreateTextRunnable runnable) {
this.mDialog = new ProgressDialog(context);
this.mContext = context;
this.mKom = kom;
this.mSubject = subject;
this.mLat = 0;
this.mLon = 0;
this.mPrecision = 0;
this.mBody = body;
this.imgData = null;
this.mInReplyTo = inReplyTo;
this.mRecipients = recipients;
this.mRunnable = runnable;
this.mUserIsMemberOfSomeConf = false;
}
public CreateTextTask(final Context context, final KomServer kom, final String subject, final byte[] imgdata,
final int inReplyTo, final List<Recipient> recipients, final CreateTextRunnable runnable) {
this.mDialog = new ProgressDialog(context);
this.mContext = context;
this.mKom = kom;
this.mSubject = subject;
this.mLat = 0;
this.mLon = 0;
this.mPrecision = 0;
this.mBody = "";
this.imgData = imgdata;
this.mInReplyTo = inReplyTo;
this.mRecipients = recipients;
this.mRunnable = runnable;
this.mUserIsMemberOfSomeConf = false;
}
@Override
protected void onPreExecute() {
mDialog.setCancelable(false);
mDialog.setIndeterminate(true);
mDialog.setMessage(mContext.getString(R.string.CTT_creating_text));
mDialog.show();
}
@SuppressWarnings("deprecation")
@Override
protected Object doInBackground(final Void... args) {
final Text text = new Text();
if (mInReplyTo > 0) {
text.addCommented(mInReplyTo);
}
for (final Recipient recipient : mRecipients) {
try {
switch (recipient.type) {
case RECP_TO:
text.addRecipient(recipient.recipientId);
break;
case RECP_CC:
text.addCcRecipient(recipient.recipientId);
break;
case RECP_BCC:
if (text.getStat().hasRecipient(recipient.recipientId)) {
throw new IllegalArgumentException(recipient.recipientId + mContext.getString(R.string.CTT_already_recipient));
}
text.addMiscInfoEntry(TextStat.miscBccRecpt, recipient.recipientId);
break;
}
if (mKom.getSession().isMemberOf(recipient.recipientId)) {
mUserIsMemberOfSomeConf = true;
}
}
catch (final IOException e) {
return "IOException";
}
catch (final IllegalArgumentException e) {
// Conference is already recipient. Just ignore.
}
}
if (imgData == null) {
// Regular text
final byte[] subjectBytes = mSubject.getBytes();
final byte[] bodyBytes = mBody.getBytes();
byte[] contents = new byte[subjectBytes.length + bodyBytes.length
+ 1];
System.arraycopy(subjectBytes, 0, contents, 0, subjectBytes.length);
System.arraycopy(bodyBytes, 0, contents, subjectBytes.length + 1,
bodyBytes.length);
contents[subjectBytes.length] = (byte) '\n';
text.setContents(contents);
text.getStat().setAuxItem(
new AuxItem(AuxItem.tagContentType,
"text/x-kom-basic;charset=utf-8"));
} else {
// image
final byte[] subjectBytes = mSubject.getBytes();
byte[] contents = new byte[subjectBytes.length + imgData.length + 1];
System.arraycopy(subjectBytes, 0, contents, 0, subjectBytes.length);
System.arraycopy(imgData, 0, contents, subjectBytes.length + 1,
imgData.length);
contents[subjectBytes.length] = (byte) '\n';
text.setContents(contents);
text.getStat().setAuxItem(
new AuxItem(AuxItem.tagContentType,
"image/jpeg; name=dummy.jpg"));
}
if((ConferencePrefs.getIncludeLocation(mContext)) &&
(mPrecision>0.0)) {
String tagvalue = ""+mLat+" "+mLon+" "+mPrecision;
Log.i(TAG, "aux pos="+tagvalue);
text.getStat().setAuxItem(new AuxItem(AuxItem.tagCreationLocation, tagvalue));
}
return text;
}
@Override
protected void onPostExecute(final Object arg) {
mDialog.dismiss();
if (arg instanceof String) {
final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setTitle((String) arg);
builder.setPositiveButton(mContext.getString(R.string.alert_dialog_ok), null);
builder.create().show();
}
final Text text = (Text) arg;
if (mUserIsMemberOfSomeConf) {
if (mRunnable != null) {
mRunnable.run(text);
}
}
else {
final OnClickListener listener = new OnClickListener() {
public void onClick(final DialogInterface dialog, final int which) {
if (which == AlertDialog.BUTTON_NEUTRAL) {
return;
}
if (which == AlertDialog.BUTTON_POSITIVE) {
text.addRecipient(mKom.getUserId());
}
if (mRunnable != null) {
mRunnable.run(text);
}
}
};
final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setTitle(mContext.getString(R.string.CTT_not_member));
builder.setPositiveButton(mContext.getString(R.string.yes), listener);
builder.setNegativeButton(mContext.getString(R.string.no), listener);
builder.setNeutralButton(mContext.getString(R.string.cancel), listener);
builder.create().show();
}
}
}
| 8,269 | 0.595477 | 0.593058 | 217 | 37.105991 | 26.056175 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.792627 | false | false |
12
|
961ff2516f49783f0029ba1ba2965796cb1c0f54
| 11,312,943,926,122 |
34ab658ac9f2463e1d224bdddb638713363f3d0a
|
/src/main/java/Models/Book.java
|
42a694c62e275f12e80b7f51bff97ee1efdba10a
|
[
"Apache-2.0"
] |
permissive
|
j-williams1/ElsevierBookStore
|
https://github.com/j-williams1/ElsevierBookStore
|
4bb4be6427bf58ab063dd64831b692391303840d
|
286dfd9b874fed07ccd33e4d1cd6056d560671b2
|
refs/heads/master
| 2021-01-24T14:33:10.304000 | 2016-07-18T19:21:58 | 2016-07-18T19:21:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Models;
import java.util.Date;
import java.util.List;
/**
* Created by GRAY1 on 7/14/2016.
*/
public class Book {
public int ID;
public String title;
public List<String> authors;
public List<Genre> genres;
public String publisher;
public Date datePublished;
public float price;
public String ISBN;
public String edition;
public List<BookFormat> formats;
public int numberOfPages;
public String description;
}
|
UTF-8
|
Java
| 470 |
java
|
Book.java
|
Java
|
[
{
"context": "il.Date;\nimport java.util.List;\n\n/**\n * Created by GRAY1 on 7/14/2016.\n */\npublic class Book {\n public ",
"end": 87,
"score": 0.9996075630187988,
"start": 82,
"tag": "USERNAME",
"value": "GRAY1"
}
] | null |
[] |
package Models;
import java.util.Date;
import java.util.List;
/**
* Created by GRAY1 on 7/14/2016.
*/
public class Book {
public int ID;
public String title;
public List<String> authors;
public List<Genre> genres;
public String publisher;
public Date datePublished;
public float price;
public String ISBN;
public String edition;
public List<BookFormat> formats;
public int numberOfPages;
public String description;
}
| 470 | 0.693617 | 0.676596 | 23 | 19.434782 | 11.893827 | 36 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.652174 | false | false |
12
|
82f2c6abbdebf899287bb16e1dcaa980cbd5d54e
| 5,858,335,420,512 |
7773ea6f465ffecfd4f9821aad56ee1eab90d97a
|
/plugins/junit/src/com/intellij/execution/junit/codeInsight/references/JUnitReferenceContributor.java
|
4a675c3958d9fe9a56854cd154e0e07fcd467244
|
[
"Apache-2.0"
] |
permissive
|
aghasyedbilal/intellij-community
|
https://github.com/aghasyedbilal/intellij-community
|
5fa14a8bb62a037c0d2764fb172e8109a3db471f
|
fa602b2874ea4eb59442f9937b952dcb55910b6e
|
refs/heads/master
| 2023-04-10T20:55:27.988000 | 2020-05-03T22:00:26 | 2020-05-03T22:26:23 | 261,074,802 | 2 | 0 |
Apache-2.0
| true | 2020-05-04T03:48:36 | 2020-05-04T03:48:35 | 2020-05-04T03:48:32 | 2020-05-03T23:01:03 | 3,386,775 | 0 | 0 | 0 | null | false | false |
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.execution.junit.codeInsight.references;
import com.intellij.patterns.InitialPatternCondition;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.patterns.PsiElementPattern;
import com.intellij.patterns.PsiJavaElementPattern;
import com.intellij.psi.*;
import com.intellij.psi.filters.ElementFilter;
import com.intellij.psi.filters.position.FilterPattern;
import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.ObjectUtils;
import com.intellij.util.ProcessingContext;
import com.siyeh.ig.junit.JUnitCommonClassNames;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class JUnitReferenceContributor extends PsiReferenceContributor {
private static PsiElementPattern.Capture<PsiLiteral> getElementPattern(String annotation, String paramName) {
return PlatformPatterns.psiElement(PsiLiteral.class).and(new FilterPattern(new TestAnnotationFilter(annotation, paramName)));
}
private static PsiElementPattern.Capture<PsiLiteral> getEnumSourceNamesPattern() {
return getElementPattern(JUnitCommonClassNames.ORG_JUNIT_JUPITER_PARAMS_ENUM_SOURCE, "names")
.withAncestor(4, PlatformPatterns.psiElement(PsiAnnotation.class).and(new PsiJavaElementPattern<>(new InitialPatternCondition<PsiAnnotation>(PsiAnnotation.class) {
@Override
public boolean accepts(@Nullable Object o, ProcessingContext context) {
if (o instanceof PsiAnnotation) {
PsiAnnotationMemberValue mode = ((PsiAnnotation)o).findAttributeValue("mode");
if (mode instanceof PsiReferenceExpression) {
String referenceName = ((PsiReferenceExpression)mode).getReferenceName();
return "INCLUDE".equals(referenceName) || "EXCLUDE".equals(referenceName);
}
}
return false;
}
})));
}
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(getElementPattern(JUnitCommonClassNames.ORG_JUNIT_JUPITER_PARAMS_PROVIDER_METHOD_SOURCE, "value"), new PsiReferenceProvider() {
@Override
public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement element, @NotNull final ProcessingContext context) {
return new MethodSourceReference[]{new MethodSourceReference((PsiLiteral)element)};
}
});
registrar.registerReferenceProvider(getEnumSourceNamesPattern(), new PsiReferenceProvider() {
@Override
public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement element, @NotNull final ProcessingContext context) {
return new EnumSourceReference[] {new EnumSourceReference((PsiLiteral)element)};
}
});
registrar.registerReferenceProvider(getElementPattern(JUnitCommonClassNames.ORG_JUNIT_JUPITER_PARAMS_PROVIDER_CSV_FILE_SOURCE, "resources"), new PsiReferenceProvider() {
@Override
public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement element, @NotNull final ProcessingContext context) {
return FileReferenceSet.createSet(element, false, false, false).getAllReferences();
}
});
}
private static class TestAnnotationFilter implements ElementFilter {
private final String myAnnotation;
private final String myParameterName;
TestAnnotationFilter(String annotation, @NotNull @NonNls String parameterName) {
myAnnotation = annotation;
myParameterName = parameterName;
}
@Override
public boolean isAcceptable(Object element, PsiElement context) {
PsiNameValuePair pair = PsiTreeUtil.getParentOfType(context, PsiNameValuePair.class, false, PsiMember.class, PsiStatement.class, PsiCall.class);
if (pair == null) return false;
String name = ObjectUtils.notNull(pair.getName(), PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME);
if (!myParameterName.equals(name)) return false;
PsiAnnotation annotation = PsiTreeUtil.getParentOfType(pair, PsiAnnotation.class);
if (annotation == null) return false;
return myAnnotation.equals(annotation.getQualifiedName());
}
@Override
public boolean isClassAcceptable(Class hintClass) {
return PsiLiteral.class.isAssignableFrom(hintClass);
}
}
}
|
UTF-8
|
Java
| 4,548 |
java
|
JUnitReferenceContributor.java
|
Java
|
[] | null |
[] |
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.execution.junit.codeInsight.references;
import com.intellij.patterns.InitialPatternCondition;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.patterns.PsiElementPattern;
import com.intellij.patterns.PsiJavaElementPattern;
import com.intellij.psi.*;
import com.intellij.psi.filters.ElementFilter;
import com.intellij.psi.filters.position.FilterPattern;
import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.ObjectUtils;
import com.intellij.util.ProcessingContext;
import com.siyeh.ig.junit.JUnitCommonClassNames;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class JUnitReferenceContributor extends PsiReferenceContributor {
private static PsiElementPattern.Capture<PsiLiteral> getElementPattern(String annotation, String paramName) {
return PlatformPatterns.psiElement(PsiLiteral.class).and(new FilterPattern(new TestAnnotationFilter(annotation, paramName)));
}
private static PsiElementPattern.Capture<PsiLiteral> getEnumSourceNamesPattern() {
return getElementPattern(JUnitCommonClassNames.ORG_JUNIT_JUPITER_PARAMS_ENUM_SOURCE, "names")
.withAncestor(4, PlatformPatterns.psiElement(PsiAnnotation.class).and(new PsiJavaElementPattern<>(new InitialPatternCondition<PsiAnnotation>(PsiAnnotation.class) {
@Override
public boolean accepts(@Nullable Object o, ProcessingContext context) {
if (o instanceof PsiAnnotation) {
PsiAnnotationMemberValue mode = ((PsiAnnotation)o).findAttributeValue("mode");
if (mode instanceof PsiReferenceExpression) {
String referenceName = ((PsiReferenceExpression)mode).getReferenceName();
return "INCLUDE".equals(referenceName) || "EXCLUDE".equals(referenceName);
}
}
return false;
}
})));
}
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(getElementPattern(JUnitCommonClassNames.ORG_JUNIT_JUPITER_PARAMS_PROVIDER_METHOD_SOURCE, "value"), new PsiReferenceProvider() {
@Override
public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement element, @NotNull final ProcessingContext context) {
return new MethodSourceReference[]{new MethodSourceReference((PsiLiteral)element)};
}
});
registrar.registerReferenceProvider(getEnumSourceNamesPattern(), new PsiReferenceProvider() {
@Override
public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement element, @NotNull final ProcessingContext context) {
return new EnumSourceReference[] {new EnumSourceReference((PsiLiteral)element)};
}
});
registrar.registerReferenceProvider(getElementPattern(JUnitCommonClassNames.ORG_JUNIT_JUPITER_PARAMS_PROVIDER_CSV_FILE_SOURCE, "resources"), new PsiReferenceProvider() {
@Override
public PsiReference @NotNull [] getReferencesByElement(@NotNull PsiElement element, @NotNull final ProcessingContext context) {
return FileReferenceSet.createSet(element, false, false, false).getAllReferences();
}
});
}
private static class TestAnnotationFilter implements ElementFilter {
private final String myAnnotation;
private final String myParameterName;
TestAnnotationFilter(String annotation, @NotNull @NonNls String parameterName) {
myAnnotation = annotation;
myParameterName = parameterName;
}
@Override
public boolean isAcceptable(Object element, PsiElement context) {
PsiNameValuePair pair = PsiTreeUtil.getParentOfType(context, PsiNameValuePair.class, false, PsiMember.class, PsiStatement.class, PsiCall.class);
if (pair == null) return false;
String name = ObjectUtils.notNull(pair.getName(), PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME);
if (!myParameterName.equals(name)) return false;
PsiAnnotation annotation = PsiTreeUtil.getParentOfType(pair, PsiAnnotation.class);
if (annotation == null) return false;
return myAnnotation.equals(annotation.getQualifiedName());
}
@Override
public boolean isClassAcceptable(Class hintClass) {
return PsiLiteral.class.isAssignableFrom(hintClass);
}
}
}
| 4,548 | 0.764292 | 0.761873 | 91 | 48.978024 | 45.465595 | 173 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.736264 | false | false |
12
|
29932ac69494b148db6fad60181e2d430ce6f89b
| 19,344,532,740,112 |
8f29fde5456bbf8eddd258e2fd8a46614b6f6cdb
|
/src/main/java/com/simple/quoridor/model/MovePlayerModel.java
|
35e39f16cda00c7428fd152fa2491d0e358bbe57
|
[] |
no_license
|
Jung-hyelim/SimpleQuoridor
|
https://github.com/Jung-hyelim/SimpleQuoridor
|
de71214d456bfb4380f329763724cf8cbe23537a
|
6a511eec2e41cb4a44bfc0d0d64affcd8ee5fd11
|
refs/heads/develop
| 2021-01-09T06:30:14.594000 | 2018-03-24T13:25:26 | 2018-03-24T13:25:26 | 80,997,516 | 2 | 0 | null | false | 2018-02-06T06:17:46 | 2017-02-05T14:18:10 | 2017-02-09T15:43:14 | 2018-02-06T06:17:46 | 38 | 0 | 0 | 2 |
Java
| false | null |
package com.simple.quoridor.model;
import java.util.List;
import lombok.Data;
@Data
public class MovePlayerModel {
private Integer resultStatus; // 결과 상태[0(이동불가능)/1(이동가능)/2(게임끝)]
private String resultReason; // 이동 불가능 이유
private List<Integer> map; // 맵
private String nextPlayer; // 다음 차례
}
|
UTF-8
|
Java
| 357 |
java
|
MovePlayerModel.java
|
Java
|
[] | null |
[] |
package com.simple.quoridor.model;
import java.util.List;
import lombok.Data;
@Data
public class MovePlayerModel {
private Integer resultStatus; // 결과 상태[0(이동불가능)/1(이동가능)/2(게임끝)]
private String resultReason; // 이동 불가능 이유
private List<Integer> map; // 맵
private String nextPlayer; // 다음 차례
}
| 357 | 0.727575 | 0.717608 | 13 | 22.153847 | 19.599239 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.307692 | false | false |
12
|
ba3a2e5c7eca187618d50a4549221f3a103cad9a
| 35,716,948,033,579 |
51804b112f6be42e0d7bc43ad2958e01ada34062
|
/src/com/futureinternet/netspeedtest/service/DownloadService.java
|
ffe9ce074670d235e25f41b98275e5e703ff041e
|
[] |
no_license
|
lovesick/throughputtest
|
https://github.com/lovesick/throughputtest
|
7be68b043b2988dea8f5dd6a37b96da20d9e88c4
|
6fc5cfe8a2bf366b73336371f5e800a6bf713d34
|
refs/heads/master
| 2020-02-28T19:48:52.316000 | 2015-07-22T10:30:06 | 2015-07-22T10:30:06 | 39,134,847 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.futureinternet.netspeedtest.service;
import com.alibaba.sdk.android.oss.OSSService;
import com.alibaba.sdk.android.oss.OSSServiceProvider;
import com.alibaba.sdk.android.oss.callback.GetFileCallback;
import com.alibaba.sdk.android.oss.model.AccessControlList;
import com.alibaba.sdk.android.oss.model.AuthenticationType;
import com.alibaba.sdk.android.oss.model.OSSException;
import com.alibaba.sdk.android.oss.model.TokenGenerator;
import com.alibaba.sdk.android.oss.storage.OSSBucket;
import com.alibaba.sdk.android.oss.storage.OSSFile;
import com.alibaba.sdk.android.oss.storage.TaskHandler;
import com.alibaba.sdk.android.oss.util.OSSToolKit;
import com.futureinternet.netspeedtest.data.Data;
import com.futureinternet.netspeedtest.util.GetSDPath;
import android.R.bool;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
public class DownloadService extends Service {
private String accessKey = "IYGDHcI2qtULimr3";
private String secretKey = "aeW5MZhk6nj2hycnSvNqxskWZ7OcEg";
private GetSDPath getSDPath = new GetSDPath();
private Intent testIntent = new Intent("testStateFlag");
private Message msg = new Message();
private boolean flag = true;
Data data = new Data();
Handler handler;
@Override
public void onStart(Intent intent, int startId) {
data.setDownloadFlag(1);
}
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
OSSService ossService = OSSServiceProvider.getService();
ossService.setApplicationContext(Data.getContext());
ossService.setGlobalDefaultHostId("oss-cn-hangzhou.aliyuncs.com");
ossService.setAuthenticationType(AuthenticationType.ORIGIN_AKSK);
ossService.setGlobalDefaultTokenGenerator(new TokenGenerator() {
@Override
public String generateToken(String httpMethod, String md5,
String type, String date, String ossHeaders, String resource) {
String content = httpMethod + "\n" + md5 + "\n" + type + "\n"
+ date + "\n" + ossHeaders + resource;
return OSSToolKit.generateToken(accessKey, secretKey, content);
}
});
OSSBucket downloadBucket = ossService.getOssBucket("downloadlte");
downloadBucket.setBucketACL(AccessControlList.PRIVATE); // 声明该Bucket的访问权限
final OSSFile ossFile = ossService.getOssFile(downloadBucket,
"download.zip");
Thread downloadThread = new Thread(new Runnable() {
@Override
public void run() {
Log.d("DownloadService", "开启成功");
onProgressThread.start();
final TaskHandler tHandler = ossFile.downloadToInBackground(
getSDPath.getSDPath()
+ "/ThroughputTest/download/download.zip",
new GetFileCallback() {
@Override
public void onSuccess(String objectKey,
String filePath) {
flag = false;
testIntent.putExtra("stateFlag", 5);
sendBroadcast(testIntent);
Log.d("DownloadService", "下载成功");
}
@Override
public void onProgress(String objectKey,
int byteCount, int totalSize) {
}
@Override
public void onFailure(String objectKey,
OSSException ossException) {
flag = false;
testIntent.putExtra("stateFlag", 4);
sendBroadcast(testIntent);
Log.d("DownloadService", "下载取消");
}
});
Looper.prepare();
handler = new Handler() {
@Override
public void handleMessage(Message msg) {
if (msg.what == 0) {
tHandler.cancel();
Log.d("DownloadService", "停止成功");
}
}
};
Looper.loop();
}
});
downloadThread.start();
return super.onStartCommand(intent, flags, startId);
}
@Override
public void onDestroy() {
msg.what = 0;
handler.sendMessage(msg);
data.setDownloadFlag(0);
Log.d("DownloadService", "销毁成功");
}
Thread onProgressThread = new Thread(new Runnable() {
@Override
public void run() {
while (flag) {
testIntent.putExtra("stateFlag", 3);
sendBroadcast(testIntent);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
});
}
|
UTF-8
|
Java
| 4,386 |
java
|
DownloadService.java
|
Java
|
[
{
"context": "e extends Service {\n\n\tprivate String accessKey = \"IYGDHcI2qtULimr3\";\n\tprivate String secretKey = \"aeW5MZhk6nj2hycnSv",
"end": 1074,
"score": 0.9983312487602234,
"start": 1058,
"tag": "KEY",
"value": "IYGDHcI2qtULimr3"
},
{
"context": " \"IYGDHcI2qtULimr3\";\n\tprivate String secretKey = \"aeW5MZhk6nj2hycnSvNqxskWZ7OcEg\";\n\n\tprivate GetSDPath getSDPath = new GetSDPath()",
"end": 1136,
"score": 0.9992979764938354,
"start": 1106,
"tag": "KEY",
"value": "aeW5MZhk6nj2hycnSvNqxskWZ7OcEg"
}
] | null |
[] |
package com.futureinternet.netspeedtest.service;
import com.alibaba.sdk.android.oss.OSSService;
import com.alibaba.sdk.android.oss.OSSServiceProvider;
import com.alibaba.sdk.android.oss.callback.GetFileCallback;
import com.alibaba.sdk.android.oss.model.AccessControlList;
import com.alibaba.sdk.android.oss.model.AuthenticationType;
import com.alibaba.sdk.android.oss.model.OSSException;
import com.alibaba.sdk.android.oss.model.TokenGenerator;
import com.alibaba.sdk.android.oss.storage.OSSBucket;
import com.alibaba.sdk.android.oss.storage.OSSFile;
import com.alibaba.sdk.android.oss.storage.TaskHandler;
import com.alibaba.sdk.android.oss.util.OSSToolKit;
import com.futureinternet.netspeedtest.data.Data;
import com.futureinternet.netspeedtest.util.GetSDPath;
import android.R.bool;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
public class DownloadService extends Service {
private String accessKey = "<KEY>";
private String secretKey = "<KEY>";
private GetSDPath getSDPath = new GetSDPath();
private Intent testIntent = new Intent("testStateFlag");
private Message msg = new Message();
private boolean flag = true;
Data data = new Data();
Handler handler;
@Override
public void onStart(Intent intent, int startId) {
data.setDownloadFlag(1);
}
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
OSSService ossService = OSSServiceProvider.getService();
ossService.setApplicationContext(Data.getContext());
ossService.setGlobalDefaultHostId("oss-cn-hangzhou.aliyuncs.com");
ossService.setAuthenticationType(AuthenticationType.ORIGIN_AKSK);
ossService.setGlobalDefaultTokenGenerator(new TokenGenerator() {
@Override
public String generateToken(String httpMethod, String md5,
String type, String date, String ossHeaders, String resource) {
String content = httpMethod + "\n" + md5 + "\n" + type + "\n"
+ date + "\n" + ossHeaders + resource;
return OSSToolKit.generateToken(accessKey, secretKey, content);
}
});
OSSBucket downloadBucket = ossService.getOssBucket("downloadlte");
downloadBucket.setBucketACL(AccessControlList.PRIVATE); // 声明该Bucket的访问权限
final OSSFile ossFile = ossService.getOssFile(downloadBucket,
"download.zip");
Thread downloadThread = new Thread(new Runnable() {
@Override
public void run() {
Log.d("DownloadService", "开启成功");
onProgressThread.start();
final TaskHandler tHandler = ossFile.downloadToInBackground(
getSDPath.getSDPath()
+ "/ThroughputTest/download/download.zip",
new GetFileCallback() {
@Override
public void onSuccess(String objectKey,
String filePath) {
flag = false;
testIntent.putExtra("stateFlag", 5);
sendBroadcast(testIntent);
Log.d("DownloadService", "下载成功");
}
@Override
public void onProgress(String objectKey,
int byteCount, int totalSize) {
}
@Override
public void onFailure(String objectKey,
OSSException ossException) {
flag = false;
testIntent.putExtra("stateFlag", 4);
sendBroadcast(testIntent);
Log.d("DownloadService", "下载取消");
}
});
Looper.prepare();
handler = new Handler() {
@Override
public void handleMessage(Message msg) {
if (msg.what == 0) {
tHandler.cancel();
Log.d("DownloadService", "停止成功");
}
}
};
Looper.loop();
}
});
downloadThread.start();
return super.onStartCommand(intent, flags, startId);
}
@Override
public void onDestroy() {
msg.what = 0;
handler.sendMessage(msg);
data.setDownloadFlag(0);
Log.d("DownloadService", "销毁成功");
}
Thread onProgressThread = new Thread(new Runnable() {
@Override
public void run() {
while (flag) {
testIntent.putExtra("stateFlag", 3);
sendBroadcast(testIntent);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
});
}
| 4,350 | 0.70739 | 0.703002 | 158 | 26.405064 | 22.045132 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.132911 | false | false |
12
|
755c7190d85c90846d5c6e30cfbf107cb4ae890c
| 25,116,968,812,235 |
e4516bc1ef2407c524af95f5b6754b3a3c37b3cc
|
/answers/leetcode/Wiggle Subsequence/Wiggle Subsequence.java
|
fd867b2f9ca5b5884b195261c2a9b22b45f87a14
|
[
"MIT"
] |
permissive
|
FeiZhan/Algo-Collection
|
https://github.com/FeiZhan/Algo-Collection
|
7102732d61f324ffe5509ee48c5015b2a96cd58d
|
9ecfe00151aa18e24846e318c8ed7bea9af48a57
|
refs/heads/master
| 2023-06-10T17:36:53.473000 | 2023-06-02T01:33:59 | 2023-06-02T01:33:59 | 3,762,869 | 4 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
class Solution {
public int wiggleMaxLength(int[] nums) {
int length = 0;
if (nums.length > 0) {
length = 1;
}
Boolean increase = null;
for (int i = 1; i < nums.length; i++) {
if ((increase == null || increase) && nums[i] < nums[i - 1]) {
length++;
increase = false;
} else if ((increase == null || !increase) && nums[i] > nums[i - 1]) {
length++;
increase = true;
}
}
return length;
}
}
|
UTF-8
|
Java
| 563 |
java
|
Wiggle Subsequence.java
|
Java
|
[] | null |
[] |
class Solution {
public int wiggleMaxLength(int[] nums) {
int length = 0;
if (nums.length > 0) {
length = 1;
}
Boolean increase = null;
for (int i = 1; i < nums.length; i++) {
if ((increase == null || increase) && nums[i] < nums[i - 1]) {
length++;
increase = false;
} else if ((increase == null || !increase) && nums[i] > nums[i - 1]) {
length++;
increase = true;
}
}
return length;
}
}
| 563 | 0.412078 | 0.401421 | 19 | 28.68421 | 20.716261 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.736842 | false | false |
12
|
fc0b820a286c5b0e2485226b20b04bb4d8ff385b
| 11,493,332,512,149 |
2d5e01375bf27ab0ad1f66152e94b8843ae67251
|
/src/main/java/com/itmo/client/controllers/InfoController.java
|
6a157e0582a5bfcf2f18c8d3adcf08a2c3c9224f
|
[] |
no_license
|
Sergio931/Project_App
|
https://github.com/Sergio931/Project_App
|
14cfe00ae0b33b03973d575aca174da6dcd56afa
|
20f6dc24b493a83b4ed00f87d3249f56600aa710
|
refs/heads/main
| 2023-06-03T03:59:15.879000 | 2021-06-25T12:13:14 | 2021-06-25T12:13:14 | 379,743,861 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.itmo.client.controllers;
import com.itmo.client.UIMain;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import java.net.URL;
import java.util.ResourceBundle;
public class InfoController implements Initializable {
@FXML
private Label infoLabel;
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
infoLabel.setText(UIMain.mainController.getInfo());
}
}
|
UTF-8
|
Java
| 465 |
java
|
InfoController.java
|
Java
|
[] | null |
[] |
package com.itmo.client.controllers;
import com.itmo.client.UIMain;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import java.net.URL;
import java.util.ResourceBundle;
public class InfoController implements Initializable {
@FXML
private Label infoLabel;
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
infoLabel.setText(UIMain.mainController.getInfo());
}
}
| 465 | 0.765591 | 0.765591 | 19 | 23.473684 | 20.58709 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.526316 | false | false |
12
|
29f97836f8c27b4d314f6317b65918454d9fb2f5
| 34,668,976,019,564 |
0edd06cf2729cbee6175130f2af0a1060a2c3bdb
|
/src/ru/spbau/kononenko/drunkgame/police/reporters/Streetlight.java
|
c17b9bb4c8e1217e09bffea43758a132dc57541e
|
[] |
no_license
|
vasily-knk/DrunkGame
|
https://github.com/vasily-knk/DrunkGame
|
c15af27246054f3dd85211e47e42555acc058cac
|
cf84d794beaf40d7d1fb4c147124accbd73a3ba0
|
refs/heads/master
| 2021-01-20T02:19:46.415000 | 2012-06-23T15:05:10 | 2012-06-23T15:05:10 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ru.spbau.kononenko.drunkgame.police.reporters;
import ru.spbau.kononenko.drunkgame.common.field.Coord;
import ru.spbau.kononenko.drunkgame.common.field.Field;
import ru.spbau.kononenko.drunkgame.drunks.Drunk;
import ru.spbau.kononenko.drunkgame.common.algorithms.BFS;
import ru.spbau.kononenko.drunkgame.common.field.objects.FieldObject;
import ru.spbau.kononenko.drunkgame.common.field.objects.FieldObjectProperty;
import ru.spbau.kononenko.drunkgame.common.field.objects.SelfAwareFieldObject;
import ru.spbau.kononenko.drunkgame.police.arrestable.Arrestable;
public class Streetlight extends SelfAwareFieldObject implements ArrestableReporter {
private final int radius;
public Streetlight(Field field, Coord coord, int radius) {
super (field, coord);
this.radius = radius;
}
public Arrestable search() {
final Arrestable[] res = new Arrestable[1];
res[0] = null;
BFS bfs = new BFS(getField(), getCoord()) {
@Override
public CheckState check(Record r) {
FieldObject object = getField().getObject(r.coord);
if (object != null && object.getProperty(Drunk.sleepingDrunkProperty) && (object instanceof Arrestable))
{
res[0] = (Arrestable)object;
return CheckState.STOP;
}
if (r.depth >= radius)
return CheckState.CUT;
return CheckState.CONTINUE;
}
};
bfs.run();
return res[0];
}
@Override
public boolean getProperty(FieldObjectProperty property) {
return false;
}
@Override
public char getChar() {
return 'Ф';
}
}
|
UTF-8
|
Java
| 1,825 |
java
|
Streetlight.java
|
Java
|
[] | null |
[] |
package ru.spbau.kononenko.drunkgame.police.reporters;
import ru.spbau.kononenko.drunkgame.common.field.Coord;
import ru.spbau.kononenko.drunkgame.common.field.Field;
import ru.spbau.kononenko.drunkgame.drunks.Drunk;
import ru.spbau.kononenko.drunkgame.common.algorithms.BFS;
import ru.spbau.kononenko.drunkgame.common.field.objects.FieldObject;
import ru.spbau.kononenko.drunkgame.common.field.objects.FieldObjectProperty;
import ru.spbau.kononenko.drunkgame.common.field.objects.SelfAwareFieldObject;
import ru.spbau.kononenko.drunkgame.police.arrestable.Arrestable;
public class Streetlight extends SelfAwareFieldObject implements ArrestableReporter {
private final int radius;
public Streetlight(Field field, Coord coord, int radius) {
super (field, coord);
this.radius = radius;
}
public Arrestable search() {
final Arrestable[] res = new Arrestable[1];
res[0] = null;
BFS bfs = new BFS(getField(), getCoord()) {
@Override
public CheckState check(Record r) {
FieldObject object = getField().getObject(r.coord);
if (object != null && object.getProperty(Drunk.sleepingDrunkProperty) && (object instanceof Arrestable))
{
res[0] = (Arrestable)object;
return CheckState.STOP;
}
if (r.depth >= radius)
return CheckState.CUT;
return CheckState.CONTINUE;
}
};
bfs.run();
return res[0];
}
@Override
public boolean getProperty(FieldObjectProperty property) {
return false;
}
@Override
public char getChar() {
return 'Ф';
}
}
| 1,825 | 0.616228 | 0.614035 | 52 | 33.076923 | 26.957834 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.538462 | false | false |
12
|
8e44d5910195f4fdc7b1abea425d098ae2bcd22a
| 34,668,976,021,377 |
986c8e0d7643aad20fa8e15dfdd2e84a6ec5d64f
|
/src/com/UI/MainToppanel.java
|
79a579392b38f1cd9ea0809df29b68a1d61e863b
|
[] |
no_license
|
Lxiangrong/MyDoc
|
https://github.com/Lxiangrong/MyDoc
|
5bd84aedc927d7b245371bce9e18ffc3b20efdcb
|
1ebbb07b06c8948176f78752c4e0b9d1ad5c5e6b
|
refs/heads/master
| 2020-03-24T21:20:38.806000 | 2018-08-31T08:37:11 | 2018-08-31T08:37:11 | 143,026,863 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.UI;
import javax.swing.JPanel;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.*;
public class MainToppanel extends JPanel
{
private JPanel Lpanel,Rpanel;
private FlowLayout flowLayout;
public static int height,width;
public MainToppanel()
{
// TODO Auto-generated constructor stub
/* flowLayout = new FlowLayout();
flowLayout.setVgap(0);
flowLayout.setHgap(0);
setLayout(flowLayout);
// setBackground(Color.green);
Lpanel = new MainTopLpanel();
Lpanel.setPreferredSize(new Dimension(MainTopLpanel.width+353, MainTopLpanel.height));
Rpanel = new MainTopRpanel();
Rpanel.setPreferredSize(new Dimension(MainTopRpanel.width+125, MainTopLpanel.height));
height = Lpanel.HEIGHT;
add(Lpanel,flowLayout.LEFT);
add(Rpanel);*/
}
}
//¶¥²¿Óұ߿ò
class MainTopLpanel extends JPanel
{
//
private Image bImage;
private ImageIcon bImageIcon;
public static int width,height;
public MainTopLpanel()
{
// TODO Auto-generated constructor stub
bImageIcon = new ImageIcon("Images/logo.jpg");
bImage = bImageIcon.getImage();
width =bImageIcon.getIconWidth();
height=bImageIcon.getIconHeight();
}
@Override
protected void paintComponent(Graphics g) {
// TODO Auto-generated method stub
super.paintComponent(g);
g.drawImage(bImage, 0, 0, this.getWidth(), this.getHeight(), this);
}
}
//¶¥²¿Óұ߿ò
class MainTopRpanel extends JPanel
{
private Image bImage;
private ImageIcon bImageIcon;
public static int width,height;
public MainTopRpanel()
{
// TODO Auto-generated constructor stub
bImageIcon = new ImageIcon("Images/top_right.jpg");
bImage = bImageIcon.getImage();
width=bImageIcon.getIconWidth();
height=bImageIcon.getIconHeight();
//setBackground(Color.yellow);
}
@Override
protected void paintComponent(Graphics g) {
// TODO Auto-generated method stub
super.paintComponent(g);
g.drawImage(bImage, 0, 0, this.getWidth(), this.getHeight(), this);
}
}
|
WINDOWS-1252
|
Java
| 2,138 |
java
|
MainToppanel.java
|
Java
|
[] | null |
[] |
package com.UI;
import javax.swing.JPanel;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.*;
public class MainToppanel extends JPanel
{
private JPanel Lpanel,Rpanel;
private FlowLayout flowLayout;
public static int height,width;
public MainToppanel()
{
// TODO Auto-generated constructor stub
/* flowLayout = new FlowLayout();
flowLayout.setVgap(0);
flowLayout.setHgap(0);
setLayout(flowLayout);
// setBackground(Color.green);
Lpanel = new MainTopLpanel();
Lpanel.setPreferredSize(new Dimension(MainTopLpanel.width+353, MainTopLpanel.height));
Rpanel = new MainTopRpanel();
Rpanel.setPreferredSize(new Dimension(MainTopRpanel.width+125, MainTopLpanel.height));
height = Lpanel.HEIGHT;
add(Lpanel,flowLayout.LEFT);
add(Rpanel);*/
}
}
//¶¥²¿Óұ߿ò
class MainTopLpanel extends JPanel
{
//
private Image bImage;
private ImageIcon bImageIcon;
public static int width,height;
public MainTopLpanel()
{
// TODO Auto-generated constructor stub
bImageIcon = new ImageIcon("Images/logo.jpg");
bImage = bImageIcon.getImage();
width =bImageIcon.getIconWidth();
height=bImageIcon.getIconHeight();
}
@Override
protected void paintComponent(Graphics g) {
// TODO Auto-generated method stub
super.paintComponent(g);
g.drawImage(bImage, 0, 0, this.getWidth(), this.getHeight(), this);
}
}
//¶¥²¿Óұ߿ò
class MainTopRpanel extends JPanel
{
private Image bImage;
private ImageIcon bImageIcon;
public static int width,height;
public MainTopRpanel()
{
// TODO Auto-generated constructor stub
bImageIcon = new ImageIcon("Images/top_right.jpg");
bImage = bImageIcon.getImage();
width=bImageIcon.getIconWidth();
height=bImageIcon.getIconHeight();
//setBackground(Color.yellow);
}
@Override
protected void paintComponent(Graphics g) {
// TODO Auto-generated method stub
super.paintComponent(g);
g.drawImage(bImage, 0, 0, this.getWidth(), this.getHeight(), this);
}
}
| 2,138 | 0.692635 | 0.686025 | 90 | 21.555555 | 19.820366 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.6 | false | false |
12
|
1d73334c9ddf37f180fb4023feeb2b08e93dcdc3
| 30,897,994,737,430 |
80e651525aa5dfeabec151d9b1cf0514579cee8b
|
/src/com/company/logics/SortingSentenceImpl.java
|
7c06e09862957017301a5ea34b6f62697f3c21a9
|
[] |
no_license
|
maidanok/Lab2
|
https://github.com/maidanok/Lab2
|
beb4060401fa72dc5e5bf9ae2f2ed7063eec1dcb
|
1da460223e71d083801629cad84f24172501d32f
|
refs/heads/master
| 2020-12-31T00:11:50.991000 | 2017-04-03T11:12:27 | 2017-04-03T11:12:27 | 86,549,027 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.company.logics;
import com.company.model.Punctuation;
import com.company.model.SentenceElement;
import com.company.model.Word;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by Pasha on 03.04.2017.
*/
public class SortingSentenceImpl implements SortingSentence{
private Pattern punctuation = Pattern.compile("([\"!()«»,.\\]\\[}{;:])", Pattern.UNICODE_CHARACTER_CLASS);
/* данные паттерны необходимы для поиска знаков препинания
по принципу выставления пробелов до и после знака.
Перед открывающими скобками пробел надо, а после них не надо.
Перед всеми остальными пробел не ставится.
Например: точка или запятая.
*/
private Pattern punctNotNeedSpaseAfter = Pattern.compile("[»,;\\]:}).!?>]");
private Pattern openingBracket = Pattern.compile("[\"\\{\\(\\[\\<«]");
private boolean aheadOpeningBracked = false;
/*с помощю данного метдода собираем массив элементов предложения
и выясняем как они должны расставлять пробелы перед собой
по умолчанию все перед собой пробел ставят
*/
@Override
public SentenceElement whoIsWho(String applicant, boolean isStartSent) {
boolean isfirstWord = isStartSent;
Punctuation punct;
Word word;
Matcher findElementMather = punctuation.matcher(applicant);
boolean firsWorldinSent=true;
//нашли слово
if ((applicant.length() > 2) || (!findElementMather.find())) {
word = new Word(applicant);
if ((aheadOpeningBracked)) {
word.setNeedSpaseAfrer(false);//если впереди открывающая скобка то перед ней пробел не ставим
}
if (isfirstWord){
word.setNeedSpaseAfrer(true);
isfirstWord = false;
}
aheadOpeningBracked = false;
return word;
// нашли пунктуацию
} else {
punct = new Punctuation(applicant);
//выясняем к какому типу пуктуации элемент относится
Matcher needSpase = punctNotNeedSpaseAfter.matcher(applicant);
if (needSpase.find()) {
punct.setNeedSpaseAfrer(false);
}
Matcher findOpeningBracket = openingBracket.matcher(applicant);
if (findOpeningBracket.find()) {
aheadOpeningBracked = true;
} else {
aheadOpeningBracked = false;
}
return punct;
}
}
}
|
UTF-8
|
Java
| 2,940 |
java
|
SortingSentenceImpl.java
|
Java
|
[
{
"context": "import java.util.regex.Pattern;\n\n/**\n * Created by Pasha on 03.04.2017.\n */\npublic class SortingSentenceIm",
"end": 229,
"score": 0.9993196129798889,
"start": 224,
"tag": "NAME",
"value": "Pasha"
}
] | null |
[] |
package com.company.logics;
import com.company.model.Punctuation;
import com.company.model.SentenceElement;
import com.company.model.Word;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by Pasha on 03.04.2017.
*/
public class SortingSentenceImpl implements SortingSentence{
private Pattern punctuation = Pattern.compile("([\"!()«»,.\\]\\[}{;:])", Pattern.UNICODE_CHARACTER_CLASS);
/* данные паттерны необходимы для поиска знаков препинания
по принципу выставления пробелов до и после знака.
Перед открывающими скобками пробел надо, а после них не надо.
Перед всеми остальными пробел не ставится.
Например: точка или запятая.
*/
private Pattern punctNotNeedSpaseAfter = Pattern.compile("[»,;\\]:}).!?>]");
private Pattern openingBracket = Pattern.compile("[\"\\{\\(\\[\\<«]");
private boolean aheadOpeningBracked = false;
/*с помощю данного метдода собираем массив элементов предложения
и выясняем как они должны расставлять пробелы перед собой
по умолчанию все перед собой пробел ставят
*/
@Override
public SentenceElement whoIsWho(String applicant, boolean isStartSent) {
boolean isfirstWord = isStartSent;
Punctuation punct;
Word word;
Matcher findElementMather = punctuation.matcher(applicant);
boolean firsWorldinSent=true;
//нашли слово
if ((applicant.length() > 2) || (!findElementMather.find())) {
word = new Word(applicant);
if ((aheadOpeningBracked)) {
word.setNeedSpaseAfrer(false);//если впереди открывающая скобка то перед ней пробел не ставим
}
if (isfirstWord){
word.setNeedSpaseAfrer(true);
isfirstWord = false;
}
aheadOpeningBracked = false;
return word;
// нашли пунктуацию
} else {
punct = new Punctuation(applicant);
//выясняем к какому типу пуктуации элемент относится
Matcher needSpase = punctNotNeedSpaseAfter.matcher(applicant);
if (needSpase.find()) {
punct.setNeedSpaseAfrer(false);
}
Matcher findOpeningBracket = openingBracket.matcher(applicant);
if (findOpeningBracket.find()) {
aheadOpeningBracked = true;
} else {
aheadOpeningBracked = false;
}
return punct;
}
}
}
| 2,940 | 0.633535 | 0.629899 | 68 | 35.39706 | 26.398607 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.544118 | false | false |
12
|
eff5b9f67630bcd6ef057220e002d2b469dde8d5
| 2,001,454,805,122 |
2c1046111f2e65a18e305142c3829315e1ceeb67
|
/src/main/java/hansung/jaeyoung/webdicegame/Controller/ResultController.java
|
bcdff14cac1a9e5fdf43c8a1ca5ce8a07e426167
|
[] |
no_license
|
kjygo109/WebDiceGame
|
https://github.com/kjygo109/WebDiceGame
|
c10ad0654fa193ecca14319501c9821f2a384d9a
|
2280cd703d086216329481cca28a6a56739fc7f2
|
refs/heads/master
| 2020-01-23T21:59:03.941000 | 2016-11-25T04:45:24 | 2016-11-25T04:45:24 | 74,720,069 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package hansung.jaeyoung.webdicegame.Controller;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class ResultController {
@RequestMapping(value = "/result", method = RequestMethod.POST)
public String Result(HttpServletRequest request, Model model){
return "result";
}
}
|
UTF-8
|
Java
| 510 |
java
|
ResultController.java
|
Java
|
[] | null |
[] |
package hansung.jaeyoung.webdicegame.Controller;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@Controller
public class ResultController {
@RequestMapping(value = "/result", method = RequestMethod.POST)
public String Result(HttpServletRequest request, Model model){
return "result";
}
}
| 510 | 0.817647 | 0.817647 | 17 | 29 | 25.174685 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.941176 | false | false |
12
|
a422975d7bde6bf91a52579b7f49e6a371fc8651
| 10,050,223,537,455 |
940edd63e33c9a1526d1d81b2cc58898be643daa
|
/src/main/java/com/sensiple/lms/mapper/PreCompOffRequestRowMapper.java
|
c2425e6e69c7679a2c3b1cd7eb77733a0369ffdc
|
[] |
no_license
|
naranarayana/LMS
|
https://github.com/naranarayana/LMS
|
f4cee590c42b8f74ed7e051132baf005a8dc3eb6
|
8520838c55b17e7f6b11d256e51c6032ba49a620
|
refs/heads/master
| 2018-03-28T11:23:40.578000 | 2017-04-07T07:02:50 | 2017-04-07T07:02:50 | 87,514,678 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.sensiple.lms.mapper;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;
import com.sensiple.lms.model.LeaveStatus;
import com.sensiple.lms.model.PreCompOffRequest;
public class PreCompOffRequestRowMapper implements RowMapper<PreCompOffRequest> {
@Override
public PreCompOffRequest mapRow(ResultSet rs, int rowNum) throws SQLException {
PreCompOffRequest preCompOffRequest = new PreCompOffRequest();
preCompOffRequest.setPreWorkRequestId(rs.getLong("PreWorkRequestId"));
preCompOffRequest.setFromDate(rs.getString("FromDate"));
preCompOffRequest.setComments(rs.getString("comments"));
preCompOffRequest.setEmployeeId(rs.getLong("EmployeeId"));
preCompOffRequest.setApprovedBy(rs.getLong("ApprovedBy"));
preCompOffRequest.setStatus(LeaveStatus.getByValue(rs.getString("status")));
preCompOffRequest.setApproverDescription(rs.getString("ApproverDescription"));
return preCompOffRequest;
}
}
|
UTF-8
|
Java
| 1,007 |
java
|
PreCompOffRequestRowMapper.java
|
Java
|
[] | null |
[] |
package com.sensiple.lms.mapper;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;
import com.sensiple.lms.model.LeaveStatus;
import com.sensiple.lms.model.PreCompOffRequest;
public class PreCompOffRequestRowMapper implements RowMapper<PreCompOffRequest> {
@Override
public PreCompOffRequest mapRow(ResultSet rs, int rowNum) throws SQLException {
PreCompOffRequest preCompOffRequest = new PreCompOffRequest();
preCompOffRequest.setPreWorkRequestId(rs.getLong("PreWorkRequestId"));
preCompOffRequest.setFromDate(rs.getString("FromDate"));
preCompOffRequest.setComments(rs.getString("comments"));
preCompOffRequest.setEmployeeId(rs.getLong("EmployeeId"));
preCompOffRequest.setApprovedBy(rs.getLong("ApprovedBy"));
preCompOffRequest.setStatus(LeaveStatus.getByValue(rs.getString("status")));
preCompOffRequest.setApproverDescription(rs.getString("ApproverDescription"));
return preCompOffRequest;
}
}
| 1,007 | 0.798411 | 0.798411 | 26 | 36.73077 | 29.888971 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.423077 | false | false |
12
|
d559d1744617b7d81e582302722961beb3e9db13
| 9,010,841,389,746 |
97085a1230311ae63e3354dd2245e0f5809ba7c5
|
/src/test/java/test/marshalling.java
|
0142dd69503b8f03461be179a1e951c06d976a2c
|
[] |
no_license
|
canadarodrigo/eGaugeWebservice
|
https://github.com/canadarodrigo/eGaugeWebservice
|
d03a88ef3e43fab52df6275e24bf1b6287808c20
|
ed9486c3fc83fb2f750dbc17bd9163b0a7b924f3
|
refs/heads/master
| 2021-01-19T20:11:17.422000 | 2016-05-25T22:42:10 | 2016-05-25T22:42:10 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package test;
import com.slc.egauge.entities.instataneous.Data;
import com.slc.egauge.entities.instataneous.Register;
import com.slc.egauge.entities.storeddata.Group;
import com.slc.egauge.entities.teamstat.Status;
import java.io.StringReader;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.transform.stream.StreamSource;
/**
*
* @author srostantkritikos06
*/
public class marshalling {
public static void main(String[] args) throws JAXBException
{
JAXBContext jc = JAXBContext.newInstance(Data.class);
// List<Register> registers = new ArrayList<Register>();
// Data data = new Data();
// data.setSerial("189731");
// TimeStamp timeStamp = new TimeStamp();
// timeStamp.setTime(1234456789L);
// Register register = new Register();
// register.setType("P");
// register.setName("SOLAR");
// Value value = new Value();
// value.setValue(new BigInteger("1234566"));
// RateOfChange roc = new RateOfChange();
// roc.setRate(new BigInteger("12312414124"));
// register.setValue(value);
// register.setRate(roc);
// registers.add(register);
// data.setTimeStamp(timeStamp);
// data.setRegisters(registers);
// Available available = new Available();
// available.setAvailable(1);
// Name name = new Name();
// name.setName("Grid");
// MaxRate rate = new MaxRate();
// rate.setValue(123980123L);
// LastUpdate lastUp = new LastUpdate();
// lastUp.setValue(123123123L);
// LastValue lastVal = new LastValue();
// lastVal.setValue(new BigInteger("123156"));
// LeakRate leak = new LeakRate();
// leak.setValue(12312983);
// Excess excess = new Excess();
// excess.setValue(new BigInteger("12312312312"));
// Reg register = new Reg();
// register.setAvailable(available);
// register.setExcess(excess);
// register.setLastUpdate(lastUp);
// register.setLastValue(lastVal);
// register.setLeakRate(leak);
// register.setMaxRate(rate);
// register.setName(name);
// Lag lag = new Lag();
// lag.setUnit("ms");
// lag.setValue(123);
// Status status = new Status();
// status.setRegister(register);
// status.setLag(lag);
//
//
Marshaller marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
// marshaller.marshal(status, System.out);
// TESTING UNMARSHALLING
Unmarshaller um = jc.createUnmarshaller();
Data data = null; // for inst requests
Group group = null; // for stored data request
Status status = null; // for noteam reuquest
//FROM STRINGS
StringBuffer xmlStr = new StringBuffer("");
//FROM URLS
try {
URL url = new URL("http://egauge5593.egaug.es/cgi-bin/egauge?inst");
data = (Data) um.unmarshal(url);
} catch (MalformedURLException ex) {
Logger.getLogger(marshalling.class.getName()).log(Level.SEVERE, null, ex);
}
marshaller.marshal(data, System.out);
}
}
|
UTF-8
|
Java
| 3,785 |
java
|
marshalling.java
|
Java
|
[
{
"context": ".transform.stream.StreamSource;\n\n/**\n *\n * @author srostantkritikos06\n */\npublic class marshalling {\n public static ",
"end": 862,
"score": 0.9993976950645447,
"start": 844,
"tag": "USERNAME",
"value": "srostantkritikos06"
}
] | 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 test;
import com.slc.egauge.entities.instataneous.Data;
import com.slc.egauge.entities.instataneous.Register;
import com.slc.egauge.entities.storeddata.Group;
import com.slc.egauge.entities.teamstat.Status;
import java.io.StringReader;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.transform.stream.StreamSource;
/**
*
* @author srostantkritikos06
*/
public class marshalling {
public static void main(String[] args) throws JAXBException
{
JAXBContext jc = JAXBContext.newInstance(Data.class);
// List<Register> registers = new ArrayList<Register>();
// Data data = new Data();
// data.setSerial("189731");
// TimeStamp timeStamp = new TimeStamp();
// timeStamp.setTime(1234456789L);
// Register register = new Register();
// register.setType("P");
// register.setName("SOLAR");
// Value value = new Value();
// value.setValue(new BigInteger("1234566"));
// RateOfChange roc = new RateOfChange();
// roc.setRate(new BigInteger("12312414124"));
// register.setValue(value);
// register.setRate(roc);
// registers.add(register);
// data.setTimeStamp(timeStamp);
// data.setRegisters(registers);
// Available available = new Available();
// available.setAvailable(1);
// Name name = new Name();
// name.setName("Grid");
// MaxRate rate = new MaxRate();
// rate.setValue(123980123L);
// LastUpdate lastUp = new LastUpdate();
// lastUp.setValue(123123123L);
// LastValue lastVal = new LastValue();
// lastVal.setValue(new BigInteger("123156"));
// LeakRate leak = new LeakRate();
// leak.setValue(12312983);
// Excess excess = new Excess();
// excess.setValue(new BigInteger("12312312312"));
// Reg register = new Reg();
// register.setAvailable(available);
// register.setExcess(excess);
// register.setLastUpdate(lastUp);
// register.setLastValue(lastVal);
// register.setLeakRate(leak);
// register.setMaxRate(rate);
// register.setName(name);
// Lag lag = new Lag();
// lag.setUnit("ms");
// lag.setValue(123);
// Status status = new Status();
// status.setRegister(register);
// status.setLag(lag);
//
//
Marshaller marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
// marshaller.marshal(status, System.out);
// TESTING UNMARSHALLING
Unmarshaller um = jc.createUnmarshaller();
Data data = null; // for inst requests
Group group = null; // for stored data request
Status status = null; // for noteam reuquest
//FROM STRINGS
StringBuffer xmlStr = new StringBuffer("");
//FROM URLS
try {
URL url = new URL("http://egauge5593.egaug.es/cgi-bin/egauge?inst");
data = (Data) um.unmarshal(url);
} catch (MalformedURLException ex) {
Logger.getLogger(marshalling.class.getName()).log(Level.SEVERE, null, ex);
}
marshaller.marshal(data, System.out);
}
}
| 3,785 | 0.625627 | 0.602642 | 108 | 34.046295 | 18.805231 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.777778 | false | false |
12
|
12bbaae6ddb6b99cf1637aa81cf10e22e74beb1c
| 11,295,764,055,201 |
f290e91fd684ddffb2eb9fe86cc4ceafade0da9a
|
/src/main/java/com/lycz/dao/ExaminerMapper.java
|
61ee44d3b0acd97b165b2f67504b4b49cc1a3fdb
|
[] |
no_license
|
LuoYuChenZhou/online-exam
|
https://github.com/LuoYuChenZhou/online-exam
|
0deaf8e7397b45a2fc5b1c3926c6714de328c524
|
38b972f5c0b2f551a3cb4ed423cb6dbb1fcd5623
|
refs/heads/master
| 2021-09-26T10:35:15.917000 | 2018-10-29T12:14:24 | 2018-10-29T12:14:24 | 113,963,246 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.lycz.dao;
import com.lycz.model.Examiner;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
@Repository
public interface ExaminerMapper extends Mapper<Examiner> {
}
|
UTF-8
|
Java
| 218 |
java
|
ExaminerMapper.java
|
Java
|
[] | null |
[] |
package com.lycz.dao;
import com.lycz.model.Examiner;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
@Repository
public interface ExaminerMapper extends Mapper<Examiner> {
}
| 218 | 0.825688 | 0.825688 | 9 | 23.333334 | 20.84333 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.444444 | false | false |
12
|
cfee6ead0efd684868ca3f7d1b83415daecc9c7a
| 446,676,602,345 |
4d1f447a856dc916b1eb4654b7c4e7d188fbb367
|
/src/main/java/ua/artcode/utils/SpringContext.java
|
26dee96993c9aeefc58d3bf4ea9104bb42cea1bf
|
[] |
no_license
|
presly808/StudyArt
|
https://github.com/presly808/StudyArt
|
d5abe1802cd76c1219f80db23af4f124c3ddd974
|
0b132216bbff36518ff2444aebd40139161390bb
|
refs/heads/master
| 2020-04-06T15:51:08.432000 | 2018-01-14T11:49:56 | 2018-01-14T11:49:56 | 45,138,866 | 1 | 2 | null | false | 2020-07-23T10:50:27 | 2015-10-28T20:08:43 | 2018-01-14T11:50:12 | 2018-01-14T11:50:09 | 8,431 | 0 | 1 | 0 |
JavaScript
| false | false |
package ua.artcode.utils;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* Created by Razer on 01.12.15.
*/
public class SpringContext {
private static ApplicationContext context = null;
public static ApplicationContext getContext() {
if (context == null) {
context = new ClassPathXmlApplicationContext("classpath:app-context.xml");
}
return context;
}
}
|
UTF-8
|
Java
| 496 |
java
|
SpringContext.java
|
Java
|
[
{
"context": "ClassPathXmlApplicationContext;\n\n/**\n * Created by Razer on 01.12.15.\n */\npublic class SpringContext {\n\n ",
"end": 181,
"score": 0.9906069040298462,
"start": 176,
"tag": "NAME",
"value": "Razer"
}
] | null |
[] |
package ua.artcode.utils;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* Created by Razer on 01.12.15.
*/
public class SpringContext {
private static ApplicationContext context = null;
public static ApplicationContext getContext() {
if (context == null) {
context = new ClassPathXmlApplicationContext("classpath:app-context.xml");
}
return context;
}
}
| 496 | 0.71371 | 0.701613 | 19 | 25.105263 | 26.367634 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.315789 | false | false |
12
|
6b6dcd95916255675cdea6c5954ea59ee7abd581
| 7,627,861,985,358 |
fa9e8d1c09cd9319b3f4be5cd0ed3968a377c4e2
|
/indexed-log/src/main/java/io/joshworks/ilog/SegmentFactory.java
|
542f2d2bf71095aca106eaa2ffd780a6c4fed3f5
|
[] |
no_license
|
josueeduardo/fstore
|
https://github.com/josueeduardo/fstore
|
b8fdb1e1ea31889473acb0643a2da532ad48dd55
|
005445d9900e8aec81ecdddd1c5d22ba20e6ccee
|
refs/heads/master
| 2022-08-11T05:37:20.412000 | 2021-06-06T12:22:17 | 2021-06-06T12:22:17 | 123,340,102 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package io.joshworks.ilog;
import io.joshworks.ilog.index.RowKey;
import io.joshworks.ilog.lsm.SSTable;
import io.joshworks.ilog.record.RecordPool;
import java.io.File;
@FunctionalInterface
public interface SegmentFactory<T extends Segment> {
T create(File file, RecordPool pool, long maxSize, long maxEntries);
static SegmentFactory<IndexedSegment> indexed(RowKey rowKey) {
return (file, pool, maxSize, maxEntries) -> new IndexedSegment(file, pool, rowKey, maxEntries);
}
static SegmentFactory<SSTable> sstable(RowKey rowKey) {
return (file, pool, maxSize, maxEntries) -> new SSTable(file, pool, rowKey, maxEntries);
}
}
|
UTF-8
|
Java
| 666 |
java
|
SegmentFactory.java
|
Java
|
[] | null |
[] |
package io.joshworks.ilog;
import io.joshworks.ilog.index.RowKey;
import io.joshworks.ilog.lsm.SSTable;
import io.joshworks.ilog.record.RecordPool;
import java.io.File;
@FunctionalInterface
public interface SegmentFactory<T extends Segment> {
T create(File file, RecordPool pool, long maxSize, long maxEntries);
static SegmentFactory<IndexedSegment> indexed(RowKey rowKey) {
return (file, pool, maxSize, maxEntries) -> new IndexedSegment(file, pool, rowKey, maxEntries);
}
static SegmentFactory<SSTable> sstable(RowKey rowKey) {
return (file, pool, maxSize, maxEntries) -> new SSTable(file, pool, rowKey, maxEntries);
}
}
| 666 | 0.737237 | 0.737237 | 23 | 27.956522 | 32.142994 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
12
|
d41aafd08c43a52c83fad13420c71810fb08465e
| 7,636,451,852,908 |
f8f75928dc2d6a56c2f4bc15cf5c9b9fe7313912
|
/test/food/BaconTest.java
|
f3295ac06ae8f4851e19c34c9da37b937dd9f206
|
[] |
no_license
|
dannydoggy/ReciCalc
|
https://github.com/dannydoggy/ReciCalc
|
4d2087be57620a7887572735c2c851db30cd044f
|
c096449fbd95f8c36ce57f104a41b558bad2f096
|
refs/heads/master
| 2020-12-24T17:26:40.181000 | 2014-09-11T04:32:16 | 2014-09-11T04:32:16 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package food;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
public class BaconTest {
private Food f;
@Before
public void setUp()
{
f= new Bacon();
}
@Test
public void testGetPrice()
{
assertTrue(f.getPrice()==0.24);
}
}
|
UTF-8
|
Java
| 275 |
java
|
BaconTest.java
|
Java
|
[] | null |
[] |
package food;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
public class BaconTest {
private Food f;
@Before
public void setUp()
{
f= new Bacon();
}
@Test
public void testGetPrice()
{
assertTrue(f.getPrice()==0.24);
}
}
| 275 | 0.672727 | 0.661818 | 22 | 11.5 | 11.412712 | 33 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.954545 | false | false |
12
|
67989e86bcacb0df2cc2b045ad5f5b4b60bf94f6
| 19,593,640,812,229 |
ae8c2d6754c2da204326561bc251acc07f4bbfb9
|
/ProViligeResource/src/main/java/com/provigil/cost/resource/ProvigilCostCalculatorResource2.java
|
dc07cb6ab61aaa41c88870d935e691693c16e24c
|
[] |
no_license
|
sujit24061991/RepoAssignment
|
https://github.com/sujit24061991/RepoAssignment
|
60642cdfabcc00b3fdd2f57b78b59b6ae1e2aa54
|
37b2842d1793bda25c25edc1e93e521c1e1fb379
|
refs/heads/master
| 2022-12-27T10:43:17.351000 | 2020-10-02T17:20:41 | 2020-10-02T17:20:41 | 300,377,280 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.provigil.cost.resource;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.provigil.cost.resource.dto.SubscriberRequestDto;
import com.provigil.cost.resource.dto.SubscriberResponse;
import com.provigil.cost.resource.dto.SubscriberResponseDto;
import com.provigil.cost.resource.dto.Subscription;
@Path("/calculate")
public class ProvigilCostCalculatorResource2 {
@POST
@Produces(MediaType.APPLICATION_XML)
@Consumes(MediaType.APPLICATION_XML)
@Path("/costInfo")
public SubscriberResponse survillanceCostCalculate(Subscription subscription) {
SubscriberResponseDto subscriberResponseDto = null;
SubscriberResponse subscriberResponse = null;
List<SubscriberRequestDto> subscriberLists = subscription.getSubscriberRequestDto();
SubscriberRequestDto subscriberRequestDto = null;
List<SubscriberResponseDto> list = new ArrayList<SubscriberResponseDto>();
subscriberResponseDto = new SubscriberResponseDto();
subscriberResponse = new SubscriberResponse();
for (SubscriberRequestDto subscriberRequestDto1 : subscriberLists) {
subscriberRequestDto = subscriberRequestDto1;
if (subscriberRequestDto.getArea() <= 2500 && subscriberRequestDto.getPlan().equals("monthly")
&& subscriberRequestDto.getLocation().equals("indoor")) {
int cost = (int) (subscriberRequestDto.getArea() * 2);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() <= 2500 && subscriberRequestDto.getPlan().equals("yearly")
&& subscriberRequestDto.getLocation().equals("indoor")) {
int cost = (int) (subscriberRequestDto.getArea() * 1.5);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() <= 2500 && subscriberRequestDto.getPlan().equals("monthly")
&& subscriberRequestDto.getLocation().equals("outdoor")) {
int cost = (int) (subscriberRequestDto.getArea() * 2.5);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() <= 2500 && subscriberRequestDto.getPlan().equals("yearly")
&& subscriberRequestDto.getLocation().equals("outdoor")) {
int cost = (int) (subscriberRequestDto.getArea() * 2);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 2500 && subscriberRequestDto.getArea() <= 5000
&& subscriberRequestDto.getPlan().equals("monthly")
&& subscriberRequestDto.getLocation().equals("indoor")) {
int cost = (int) (2500 * 2 + (subscriberRequestDto.getArea() - 2500) * 1.5);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 2500 && subscriberRequestDto.getArea() <= 5000
&& subscriberRequestDto.getPlan().equals("yearly")
&& subscriberRequestDto.getLocation().equals("indoor")) {
int cost = (int) (2500 * 1.5 + (subscriberRequestDto.getArea() - 2500) * 1);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 2500 && subscriberRequestDto.getArea() <= 5000
&& subscriberRequestDto.getPlan().equals("monthly")
&& subscriberRequestDto.getLocation().equals("outdoor")) {
int cost = (int) (2500 * 2.5 + (subscriberRequestDto.getArea() - 2500) * 1.5);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 2500 && subscriberRequestDto.getArea() <= 5000
&& subscriberRequestDto.getPlan().equals("yearly")
&& subscriberRequestDto.getLocation().equals("outdoor")) {
int cost = (int) (2500 * 2 + (subscriberRequestDto.getArea() - 2500) * 1);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 5000 && subscriberRequestDto.getArea() < 50000
&& subscriberRequestDto.getPlan().equals("monthly")
&& subscriberRequestDto.getLocation().equals("indoor")) {
int cost = (int) ((2500 * 2) + (2500 * 1.5) + ((subscriberRequestDto.getArea() - 5000) * 1));
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 5000 && subscriberRequestDto.getArea() < 50000
&& subscriberRequestDto.getPlan().equals("monthly")
&& subscriberRequestDto.getLocation().equals("outdoor")) {
int cost = (int) (2500 * 2 + 2500 * 1.5 + (subscriberRequestDto.getArea() - 5000) * 1.2);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 5000 && subscriberRequestDto.getArea() < 50000
&& subscriberRequestDto.getPlan().equals("yearly")
&& subscriberRequestDto.getLocation().equals("indoor")) {
int cost = (int) (2500 * 2 + 2500 * 1.5 + (subscriberRequestDto.getArea() - 5000) * 0.6);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 5000 && subscriberRequestDto.getArea() < 50000
&& subscriberRequestDto.getPlan().equals("yearly")
&& subscriberRequestDto.getLocation().equals("outdoor")) {
int cost = (int) (2500 * 2 + 2500 * 1.5 + (subscriberRequestDto.getArea() - 5000) * 0.8);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 50000 && subscriberRequestDto.getPlan().equals("monthly")
&& subscriberRequestDto.getLocation().equals("indoor")) {
int cost = (int) (2500 * 2 + 2500 * 1.5 + 45000 * 1 + (subscriberRequestDto.getArea() - 50000) * 0.8);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 50000 && subscriberRequestDto.getPlan().equals("monthly")
&& subscriberRequestDto.getLocation().equals("outdoor")) {
int cost = (int) (2500 * 2 + 2500 * 1.5 + 45000 * 1.2 + (subscriberRequestDto.getArea() - 50000) * 0.8);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 50000 && subscriberRequestDto.getPlan().equals("yearly")
&& subscriberRequestDto.getLocation().equals("indoor")) {
int cost = (int) (2500 * 2 + 2500 * 1.5 + 45000 * 0.6 + (subscriberRequestDto.getArea() - 50000) * 0.5);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 50000 && subscriberRequestDto.getPlan().equals("yearly")
&& subscriberRequestDto.getLocation().equals("outdoor")) {
int cost = (int) (2500 * 2 + 2500 * 1.5 + 45000 * 0.8 + (subscriberRequestDto.getArea() - 50000) * 0.5);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
subscriberResponse.setListSubscriberResponse(list);
}
return subscriberResponse;
}
}
|
UTF-8
|
Java
| 8,403 |
java
|
ProvigilCostCalculatorResource2.java
|
Java
|
[] | null |
[] |
package com.provigil.cost.resource;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.provigil.cost.resource.dto.SubscriberRequestDto;
import com.provigil.cost.resource.dto.SubscriberResponse;
import com.provigil.cost.resource.dto.SubscriberResponseDto;
import com.provigil.cost.resource.dto.Subscription;
@Path("/calculate")
public class ProvigilCostCalculatorResource2 {
@POST
@Produces(MediaType.APPLICATION_XML)
@Consumes(MediaType.APPLICATION_XML)
@Path("/costInfo")
public SubscriberResponse survillanceCostCalculate(Subscription subscription) {
SubscriberResponseDto subscriberResponseDto = null;
SubscriberResponse subscriberResponse = null;
List<SubscriberRequestDto> subscriberLists = subscription.getSubscriberRequestDto();
SubscriberRequestDto subscriberRequestDto = null;
List<SubscriberResponseDto> list = new ArrayList<SubscriberResponseDto>();
subscriberResponseDto = new SubscriberResponseDto();
subscriberResponse = new SubscriberResponse();
for (SubscriberRequestDto subscriberRequestDto1 : subscriberLists) {
subscriberRequestDto = subscriberRequestDto1;
if (subscriberRequestDto.getArea() <= 2500 && subscriberRequestDto.getPlan().equals("monthly")
&& subscriberRequestDto.getLocation().equals("indoor")) {
int cost = (int) (subscriberRequestDto.getArea() * 2);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() <= 2500 && subscriberRequestDto.getPlan().equals("yearly")
&& subscriberRequestDto.getLocation().equals("indoor")) {
int cost = (int) (subscriberRequestDto.getArea() * 1.5);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() <= 2500 && subscriberRequestDto.getPlan().equals("monthly")
&& subscriberRequestDto.getLocation().equals("outdoor")) {
int cost = (int) (subscriberRequestDto.getArea() * 2.5);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() <= 2500 && subscriberRequestDto.getPlan().equals("yearly")
&& subscriberRequestDto.getLocation().equals("outdoor")) {
int cost = (int) (subscriberRequestDto.getArea() * 2);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 2500 && subscriberRequestDto.getArea() <= 5000
&& subscriberRequestDto.getPlan().equals("monthly")
&& subscriberRequestDto.getLocation().equals("indoor")) {
int cost = (int) (2500 * 2 + (subscriberRequestDto.getArea() - 2500) * 1.5);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 2500 && subscriberRequestDto.getArea() <= 5000
&& subscriberRequestDto.getPlan().equals("yearly")
&& subscriberRequestDto.getLocation().equals("indoor")) {
int cost = (int) (2500 * 1.5 + (subscriberRequestDto.getArea() - 2500) * 1);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 2500 && subscriberRequestDto.getArea() <= 5000
&& subscriberRequestDto.getPlan().equals("monthly")
&& subscriberRequestDto.getLocation().equals("outdoor")) {
int cost = (int) (2500 * 2.5 + (subscriberRequestDto.getArea() - 2500) * 1.5);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 2500 && subscriberRequestDto.getArea() <= 5000
&& subscriberRequestDto.getPlan().equals("yearly")
&& subscriberRequestDto.getLocation().equals("outdoor")) {
int cost = (int) (2500 * 2 + (subscriberRequestDto.getArea() - 2500) * 1);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 5000 && subscriberRequestDto.getArea() < 50000
&& subscriberRequestDto.getPlan().equals("monthly")
&& subscriberRequestDto.getLocation().equals("indoor")) {
int cost = (int) ((2500 * 2) + (2500 * 1.5) + ((subscriberRequestDto.getArea() - 5000) * 1));
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 5000 && subscriberRequestDto.getArea() < 50000
&& subscriberRequestDto.getPlan().equals("monthly")
&& subscriberRequestDto.getLocation().equals("outdoor")) {
int cost = (int) (2500 * 2 + 2500 * 1.5 + (subscriberRequestDto.getArea() - 5000) * 1.2);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 5000 && subscriberRequestDto.getArea() < 50000
&& subscriberRequestDto.getPlan().equals("yearly")
&& subscriberRequestDto.getLocation().equals("indoor")) {
int cost = (int) (2500 * 2 + 2500 * 1.5 + (subscriberRequestDto.getArea() - 5000) * 0.6);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 5000 && subscriberRequestDto.getArea() < 50000
&& subscriberRequestDto.getPlan().equals("yearly")
&& subscriberRequestDto.getLocation().equals("outdoor")) {
int cost = (int) (2500 * 2 + 2500 * 1.5 + (subscriberRequestDto.getArea() - 5000) * 0.8);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 50000 && subscriberRequestDto.getPlan().equals("monthly")
&& subscriberRequestDto.getLocation().equals("indoor")) {
int cost = (int) (2500 * 2 + 2500 * 1.5 + 45000 * 1 + (subscriberRequestDto.getArea() - 50000) * 0.8);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 50000 && subscriberRequestDto.getPlan().equals("monthly")
&& subscriberRequestDto.getLocation().equals("outdoor")) {
int cost = (int) (2500 * 2 + 2500 * 1.5 + 45000 * 1.2 + (subscriberRequestDto.getArea() - 50000) * 0.8);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 50000 && subscriberRequestDto.getPlan().equals("yearly")
&& subscriberRequestDto.getLocation().equals("indoor")) {
int cost = (int) (2500 * 2 + 2500 * 1.5 + 45000 * 0.6 + (subscriberRequestDto.getArea() - 50000) * 0.5);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
if (subscriberRequestDto.getArea() > 50000 && subscriberRequestDto.getPlan().equals("yearly")
&& subscriberRequestDto.getLocation().equals("outdoor")) {
int cost = (int) (2500 * 2 + 2500 * 1.5 + 45000 * 0.8 + (subscriberRequestDto.getArea() - 50000) * 0.5);
subscriberResponseDto.setCost(cost);
subscriberResponseDto.setSubscription_id(subscriberRequestDto.getSubscriber_id());
list.add(subscriberResponseDto);
}
subscriberResponse.setListSubscriberResponse(list);
}
return subscriberResponse;
}
}
| 8,403 | 0.732596 | 0.694157 | 167 | 49.317364 | 31.79954 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.532934 | false | false |
12
|
70c1bca8191ba33fa849e65604f5a0add8f3cfd0
| 20,847,771,284,897 |
16ac155ad69851cdd8d6c7b3a9170fff650297a5
|
/java/zasellaid/src/zasellaid/module/client/entity/UserLoginStatus.java
|
e7ed496191e7ff142c73030ee89d897ba388ce46
|
[] |
no_license
|
13770344697/nanjingzhongan
|
https://github.com/13770344697/nanjingzhongan
|
d95dd60c2458be6df1bd38608efb039f7f4095a4
|
630ab2e9002163c2f750d91c6d02b320a36eb935
|
refs/heads/master
| 2018-10-14T19:30:19.923000 | 2018-07-19T09:57:28 | 2018-07-19T09:57:28 | 130,321,070 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package zasellaid.module.client.entity;
public class UserLoginStatus {
private String token;
private String userId;
private String realname;
private String phone;
private long loginTime;
private int ifSuperadmin;
private int ifAdmin;
private int maintainIs;
public String getUserId() {
return userId;
}
public String getPhone() {
return phone;
}
public long getLoginTime() {
return loginTime;
}
public int getIfSuperadmin() {
return ifSuperadmin;
}
public int getIfAdmin() {
return ifAdmin;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getRealname() {
return realname;
}
public void setRealname(String realname) {
this.realname = realname;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public void setLoginTime(long loginTime) {
this.loginTime = loginTime;
}
public void setIfSuperadmin(int ifSuperadmin) {
this.ifSuperadmin = ifSuperadmin;
}
public void setIfAdmin(int ifAdmin) {
this.ifAdmin = ifAdmin;
}
public int getMaintainIs() {
return maintainIs;
}
public void setMaintainIs(int maintainIs) {
this.maintainIs = maintainIs;
}
}
|
UTF-8
|
Java
| 1,353 |
java
|
UserLoginStatus.java
|
Java
|
[] | null |
[] |
package zasellaid.module.client.entity;
public class UserLoginStatus {
private String token;
private String userId;
private String realname;
private String phone;
private long loginTime;
private int ifSuperadmin;
private int ifAdmin;
private int maintainIs;
public String getUserId() {
return userId;
}
public String getPhone() {
return phone;
}
public long getLoginTime() {
return loginTime;
}
public int getIfSuperadmin() {
return ifSuperadmin;
}
public int getIfAdmin() {
return ifAdmin;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getRealname() {
return realname;
}
public void setRealname(String realname) {
this.realname = realname;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public void setLoginTime(long loginTime) {
this.loginTime = loginTime;
}
public void setIfSuperadmin(int ifSuperadmin) {
this.ifSuperadmin = ifSuperadmin;
}
public void setIfAdmin(int ifAdmin) {
this.ifAdmin = ifAdmin;
}
public int getMaintainIs() {
return maintainIs;
}
public void setMaintainIs(int maintainIs) {
this.maintainIs = maintainIs;
}
}
| 1,353 | 0.677753 | 0.677753 | 77 | 15.571428 | 14.711449 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.25974 | false | false |
12
|
3f9c12e2b54c5b9aedd8f18a1a502ae025fc0763
| 28,355,374,118,550 |
8d3ad1ab0672e7577721cd79e49aa323d76a6385
|
/src/main/java/com/domain/ReviewCategory.java
|
8f52ecf9f844a4657599ecc4b4384dd8505d13b7
|
[] |
no_license
|
atantri/resfinder
|
https://github.com/atantri/resfinder
|
3f72ea0a1e56d44f9a0f81586241f9ddc9781c85
|
2e91b7b748eb1e8304db3cadde3d49ea1f86c082
|
refs/heads/master
| 2021-01-25T04:53:01.733000 | 2013-11-01T02:31:56 | 2013-11-01T02:31:56 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package domain;
public enum ReviewCategory {
BAD,
GOOD,
EXCELLENT
};
|
UTF-8
|
Java
| 73 |
java
|
ReviewCategory.java
|
Java
|
[] | null |
[] |
package domain;
public enum ReviewCategory {
BAD,
GOOD,
EXCELLENT
};
| 73 | 0.726027 | 0.726027 | 7 | 9.428572 | 8.877856 | 28 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
12
|
74fe8cce389741122ec0a267663cb18426072baa
| 8,220,567,425,683 |
106921a7db2e260096acbb4988b1d54d63500571
|
/04-LuceneAnalyzer/src/org/itat/lucene/util/MySameTokenFilter.java
|
f80574ff7347307572f287a696a2c220f312cdd8
|
[] |
no_license
|
Wang-Jun-Chao/Lucene
|
https://github.com/Wang-Jun-Chao/Lucene
|
d7db562120c8e75fe633dd4cc09059a01c67fafb
|
ea02b85c34b20edb4fa75ad0f80278825b9e4d29
|
refs/heads/master
| 2020-04-30T05:56:20.293000 | 2015-09-23T00:47:42 | 2015-09-23T00:47:42 | 41,586,289 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.itat.lucene.util;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.util.AttributeSource;
import java.io.IOException;
import java.util.*;
/**
* Author: 王俊超
* Date: 2015-09-01
* Time: 08:54
* Declaration: All Rights Reserved !!!
*/
public class MySameTokenFilter extends TokenFilter {
private CharTermAttribute cta = null;
private PositionIncrementAttribute pia = null;
private AttributeSource.State current;
private Deque<String> sames = null;
private SameWordContext sameWordContext;
protected MySameTokenFilter(TokenStream input, SameWordContext sameWordContext) {
super(input);
cta = input.addAttribute(CharTermAttribute.class);
pia = input.addAttribute(PositionIncrementAttribute.class);
sames = new LinkedList<>();
this.sameWordContext = sameWordContext;
}
@Override
public final boolean incrementToken() throws IOException {
// 有单词进行处理,处理同义词
// String[] sames = getSameWord(cta.toString());
// if (sames != null) {
// System.out.println(Arrays.toString(sames));
// }
// String[] sws = getSameWord(cta.toString());
// if (sws != null) {
// // 捕获当前状态
// current = captureState();
//
// // 处理同义词
// for (String s : sws) {
// cta.setEmpty();
// cta.append(s);
// }
// }
// 此处处理上一个元素的同义词
while (sames.size() > 0) {
// 将元素出栈,并且获取这个同义词
String str = sames.pop();
// 还原状态
restoreState(current);
// System.out.println("===" + cta);
cta.setEmpty();
cta.append(str);
// 设置位置为0
pia.setPositionIncrement(0);
return true;
}
// 没有元素
if (!input.incrementToken()) {
return false;
}
// 准备当前元素的的同义词
if (addSames(cta.toString())) {
// 如果有同义词,将当前状态保存
current = captureState();
}
return true;
}
private boolean addSames(String key) {
String[] sws = sameWordContext.getSameWords(key);
if (sws != null) {
for (String s : sws) {
sames.push(s);
}
return true;
}
return false;
}
}
|
UTF-8
|
Java
| 2,749 |
java
|
MySameTokenFilter.java
|
Java
|
[
{
"context": ".IOException;\nimport java.util.*;\n\n/**\n * Author: 王俊超\n * Date: 2015-09-01\n * Time: 08:54\n * Declaration",
"end": 387,
"score": 0.9994713664054871,
"start": 384,
"tag": "NAME",
"value": "王俊超"
}
] | null |
[] |
package org.itat.lucene.util;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
import org.apache.lucene.util.AttributeSource;
import java.io.IOException;
import java.util.*;
/**
* Author: 王俊超
* Date: 2015-09-01
* Time: 08:54
* Declaration: All Rights Reserved !!!
*/
public class MySameTokenFilter extends TokenFilter {
private CharTermAttribute cta = null;
private PositionIncrementAttribute pia = null;
private AttributeSource.State current;
private Deque<String> sames = null;
private SameWordContext sameWordContext;
protected MySameTokenFilter(TokenStream input, SameWordContext sameWordContext) {
super(input);
cta = input.addAttribute(CharTermAttribute.class);
pia = input.addAttribute(PositionIncrementAttribute.class);
sames = new LinkedList<>();
this.sameWordContext = sameWordContext;
}
@Override
public final boolean incrementToken() throws IOException {
// 有单词进行处理,处理同义词
// String[] sames = getSameWord(cta.toString());
// if (sames != null) {
// System.out.println(Arrays.toString(sames));
// }
// String[] sws = getSameWord(cta.toString());
// if (sws != null) {
// // 捕获当前状态
// current = captureState();
//
// // 处理同义词
// for (String s : sws) {
// cta.setEmpty();
// cta.append(s);
// }
// }
// 此处处理上一个元素的同义词
while (sames.size() > 0) {
// 将元素出栈,并且获取这个同义词
String str = sames.pop();
// 还原状态
restoreState(current);
// System.out.println("===" + cta);
cta.setEmpty();
cta.append(str);
// 设置位置为0
pia.setPositionIncrement(0);
return true;
}
// 没有元素
if (!input.incrementToken()) {
return false;
}
// 准备当前元素的的同义词
if (addSames(cta.toString())) {
// 如果有同义词,将当前状态保存
current = captureState();
}
return true;
}
private boolean addSames(String key) {
String[] sws = sameWordContext.getSameWords(key);
if (sws != null) {
for (String s : sws) {
sames.push(s);
}
return true;
}
return false;
}
}
| 2,749 | 0.569645 | 0.563792 | 98 | 25.153061 | 20.191608 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.397959 | false | false |
12
|
b76ba642bc68e3f5b01253c329cd0470fd441ad3
| 20,822,001,497,083 |
d808a8bd7d4a5e71b266a14bd1e5368a6501010b
|
/src/filesStreams/ExtractIntegers.java
|
ae90358f001bc612f217d2819ed11b167ad2430e
|
[] |
no_license
|
rositsabodurova/ProblemSolving
|
https://github.com/rositsabodurova/ProblemSolving
|
10e08bb41498e4915cc92754a06b9e61e74294c0
|
040997628de520cb54d5ec905b8b14b2d4117082
|
refs/heads/master
| 2021-03-29T16:07:17.640000 | 2020-06-07T15:39:11 | 2020-06-07T15:39:11 | 247,966,382 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package filesStreams;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;
public class ExtractIntegers {
public static void main(String[] args) throws FileNotFoundException {
String path = "files-resources\\input.txt";
String output = "files-resources\\04.ExtractIntegersOutput.txt";
FileInputStream fis = new FileInputStream(path);
Scanner scanner = new Scanner(fis);
PrintWriter printWriter = new PrintWriter(output);
try {
FileOutputStream fos = new FileOutputStream(output);
while(scanner.hasNext()){
if(scanner.hasNextInt()){
int oneInt = scanner.nextInt();
printWriter.println(oneInt);
printWriter.flush();
} else {
scanner.next();
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
printWriter.close();
scanner.close();
}
}
|
UTF-8
|
Java
| 1,118 |
java
|
ExtractIntegers.java
|
Java
|
[] | null |
[] |
package filesStreams;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;
public class ExtractIntegers {
public static void main(String[] args) throws FileNotFoundException {
String path = "files-resources\\input.txt";
String output = "files-resources\\04.ExtractIntegersOutput.txt";
FileInputStream fis = new FileInputStream(path);
Scanner scanner = new Scanner(fis);
PrintWriter printWriter = new PrintWriter(output);
try {
FileOutputStream fos = new FileOutputStream(output);
while(scanner.hasNext()){
if(scanner.hasNextInt()){
int oneInt = scanner.nextInt();
printWriter.println(oneInt);
printWriter.flush();
} else {
scanner.next();
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
printWriter.close();
scanner.close();
}
}
| 1,118 | 0.591234 | 0.589445 | 37 | 29.216217 | 21.020113 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.513514 | false | false |
12
|
f3b49fcd96d2b691465dabded515fd346688b231
| 20,340,965,133,246 |
5506e9307dada63c20d92c24feac70b9e5516d83
|
/Java/80.RemoveDuplicatesFromSortedArray2/Solution.java
|
05ee3ea228becafd8c4ca26ad6d360730f103824
|
[] |
no_license
|
chris-zhang-procore/leetcode
|
https://github.com/chris-zhang-procore/leetcode
|
c62b506dcd03bd33a92fa654ab2168c0fb8b05af
|
821dd2ae538e51a9ba370dda6b7f0fd482f6fda3
|
refs/heads/master
| 2021-06-28T13:11:28.331000 | 2017-09-19T04:32:58 | 2017-09-19T04:32:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Solution {
public int removeDuplicates(int[] nums) {
int end = 1, cur = 1;
int count = 1;//Count the number of repeating elements
while(cur < nums.length) {
if(nums[cur] == nums[cur-1]) {
count++;
nums[end] = nums[cur];
if(count == 2) end++;
} else {
count = 1;
nums[end++] = nums[cur];
}
cur++;
}
return end;
}
}
|
UTF-8
|
Java
| 432 |
java
|
Solution.java
|
Java
|
[] | null |
[] |
public class Solution {
public int removeDuplicates(int[] nums) {
int end = 1, cur = 1;
int count = 1;//Count the number of repeating elements
while(cur < nums.length) {
if(nums[cur] == nums[cur-1]) {
count++;
nums[end] = nums[cur];
if(count == 2) end++;
} else {
count = 1;
nums[end++] = nums[cur];
}
cur++;
}
return end;
}
}
| 432 | 0.474537 | 0.460648 | 19 | 21.789474 | 14.709749 | 59 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.052632 | false | false |
12
|
da04940a01123c7ef8dc685f4a8af134860dd4c7
| 30,820,685,353,642 |
806a8c9fcf03de861f7a078a2eeedc671a58f0eb
|
/AutoBlackTest/AutoBlackTest/lib/jmockit/main/src/mockit/integration/testng/package-info.java
|
2022bd616134663a8f93eddeb841aeb62974917c
|
[
"MIT"
] |
permissive
|
SoftwareEngineeringToolDemos/ICSE-2011-AutoBlackTest
|
https://github.com/SoftwareEngineeringToolDemos/ICSE-2011-AutoBlackTest
|
0fd43513b3209cce2d087aedb7407f5167df29c0
|
5aa5e57cfdf368ffe0eec44d040aa999ce478047
|
refs/heads/master
| 2021-01-17T06:54:57.152000 | 2016-06-24T17:15:15 | 2016-06-24T17:15:15 | 43,281,584 | 4 | 4 | null | false | 2015-10-22T22:08:35 | 2015-09-28T05:26:27 | 2015-10-12T22:39:47 | 2015-10-22T22:08:35 | 22,009 | 0 | 2 | 5 |
HTML
| null | null |
/*
* Copyright (c) 2006-2011 Rogério Liesenfeld
* This file is subject to the terms of the MIT license (see LICENSE.txt).
*/
/**
* Provides integration with <em>TestNG</em> test runners, for versions 5.14+.
* Contains the {@link mockit.integration.testng.Initializer} test listener class that can be specified to TestNG at
* startup, as well as the "startup mock" implementation for integration with the TestNG test runner.
* <p/>
* This integration provides the same benefits to test code as the one for JUnit 4:
* <ol>
* <li>
* Unexpected invocations specified through the Mockups or the Expectations API are automatically verified just before
* the execution of a test ends (specifically, immediately after the execution of the test method).
* </li>
* <li>
* Any mock classes applied with the Mockups API from inside a method annotated as a {@code @Test} or a
* {@code @BeforeMethod} will be discarded right after the execution of the test or the test method, respectively.
* </li>
* <li>
* Any {@linkplain mockit.MockClass mock class} set up for the whole test class (either through a call to
* {@link mockit.Mockit#setUpMocks} from inside a {@code @BeforeClass} method, or by annotating the test class with
* {@link mockit.UsingMocksAndStubs}) will only apply to the tests in this same test class.
* That is, you should not explicitly tell JMockit to restore the mocked classes in an {@code @AfterClass} method.
* </li>
* <li>
* Test methods will accept <em>mock parameters</em>, whose values are mocked instances automatically created by JMockit
* and passed by the test runner when the test method gets executed.
* </li>
* </ol>
*/
package mockit.integration.testng;
|
UTF-8
|
Java
| 1,706 |
java
|
package-info.java
|
Java
|
[
{
"context": "/*\n * Copyright (c) 2006-2011 Rogério Liesenfeld\n * This file is subject to the terms of the MIT l",
"end": 48,
"score": 0.9998626708984375,
"start": 30,
"tag": "NAME",
"value": "Rogério Liesenfeld"
}
] | null |
[] |
/*
* Copyright (c) 2006-2011 <NAME>
* This file is subject to the terms of the MIT license (see LICENSE.txt).
*/
/**
* Provides integration with <em>TestNG</em> test runners, for versions 5.14+.
* Contains the {@link mockit.integration.testng.Initializer} test listener class that can be specified to TestNG at
* startup, as well as the "startup mock" implementation for integration with the TestNG test runner.
* <p/>
* This integration provides the same benefits to test code as the one for JUnit 4:
* <ol>
* <li>
* Unexpected invocations specified through the Mockups or the Expectations API are automatically verified just before
* the execution of a test ends (specifically, immediately after the execution of the test method).
* </li>
* <li>
* Any mock classes applied with the Mockups API from inside a method annotated as a {@code @Test} or a
* {@code @BeforeMethod} will be discarded right after the execution of the test or the test method, respectively.
* </li>
* <li>
* Any {@linkplain mockit.MockClass mock class} set up for the whole test class (either through a call to
* {@link mockit.Mockit#setUpMocks} from inside a {@code @BeforeClass} method, or by annotating the test class with
* {@link mockit.UsingMocksAndStubs}) will only apply to the tests in this same test class.
* That is, you should not explicitly tell JMockit to restore the mocked classes in an {@code @AfterClass} method.
* </li>
* <li>
* Test methods will accept <em>mock parameters</em>, whose values are mocked instances automatically created by JMockit
* and passed by the test runner when the test method gets executed.
* </li>
* </ol>
*/
package mockit.integration.testng;
| 1,693 | 0.739589 | 0.732551 | 33 | 50.666668 | 47.108944 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.242424 | false | false |
12
|
b0a7a73ef41254b07d50c761686d1d4fbb5b9b8a
| 5,351,529,268,291 |
35a84e1980110c9287d1f8c4de76c125fa650adf
|
/commons/src/main/java/fr/recolnat/database/utils/TagUtils.java
|
1fedba14c6db922ef830850ffc2c6f03ece0a0c8
|
[] |
no_license
|
e-ReColNat/recolnat-lab
|
https://github.com/e-ReColNat/recolnat-lab
|
7bf2141f6571774ff9873151be2f9c00edd9e01e
|
66a90d3763134ec7cccadab5ab3ac2c047e003fb
|
refs/heads/master
| 2021-06-16T20:56:10.265000 | 2017-05-09T16:35:09 | 2017-05-09T16:35:09 | 104,355,819 | 1 | 0 | null | true | 2017-09-21T14:04:27 | 2017-09-21T14:04:27 | 2016-01-21T15:14:35 | 2017-05-09T16:35:53 | 1,795 | 0 | 0 | 0 | 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 fr.recolnat.database.utils;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.impls.orient.OrientEdge;
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph;
import com.tinkerpop.blueprints.impls.orient.OrientVertex;
import fr.recolnat.database.model.DataModel;
import java.util.Date;
import java.util.Iterator;
/**
*
* @author dmitri
*/
public class TagUtils {
public static OrientVertex createTagDefinition(String key, String value, String creatorId, OrientBaseGraph g) {
OrientVertex vTag = g.addVertex("class:" + DataModel.Classes.tag);
vTag.setProperty(DataModel.Properties.id, "TAGDEF-" + CreatorUtils.newVertexUUID(g));
vTag.setProperty(DataModel.Properties.key, key);
vTag.setProperty(DataModel.Properties.value, value);
vTag.setProperty(DataModel.Properties.creationDate, (new Date()).getTime());
return vTag;
}
public static OrientVertex tagEntity(OrientVertex vEntity, OrientVertex vTag, String creatorId, OrientBaseGraph g) {
OrientVertex vAssociation = g.addVertex("class:" + DataModel.Classes.tagging);
vAssociation.setProperty(DataModel.Properties.id, "TAG-" + CreatorUtils.newVertexUUID(g));
vAssociation.setProperty(DataModel.Properties.creationDate, (new Date()).getTime());
UpdateUtils.link(vEntity, vAssociation, DataModel.Links.isTagged, creatorId, g);
UpdateUtils.link(vAssociation, vTag, DataModel.Links.hasDefinition, creatorId, g);
return vAssociation;
}
public static OrientVertex getTagDefinition(String uid, OrientBaseGraph g) {
Iterator<Vertex> itTagDefs = g.getVertices(DataModel.Classes.tag, new String[] {DataModel.Properties.id}, new Object[]{uid}).iterator();
return AccessUtils.findLatestVersion(itTagDefs, g);
}
public static OrientVertex findTag(String key, String value, OrientBaseGraph g) {
Iterator<Vertex> itTagDefs = g.getVertices(DataModel.Classes.tag, new String[] {DataModel.Properties.key, DataModel.Properties.value}, new Object[] {key, value}).iterator();
return AccessUtils.findLatestVersion(itTagDefs, g);
}
public static Iterable<Vertex> listTagsByKey(String key, OrientBaseGraph g) {
return g.getVertices(DataModel.Classes.tag, new String[] {DataModel.Properties.key}, new Object[] {key});
}
}
|
UTF-8
|
Java
| 2,488 |
java
|
TagUtils.java
|
Java
|
[
{
"context": "ate;\nimport java.util.Iterator;\n\n/**\n *\n * @author dmitri\n */\npublic class TagUtils {\n public static Orien",
"end": 560,
"score": 0.9747632145881653,
"start": 554,
"tag": "USERNAME",
"value": "dmitri"
}
] | 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 fr.recolnat.database.utils;
import com.tinkerpop.blueprints.Vertex;
import com.tinkerpop.blueprints.impls.orient.OrientEdge;
import com.tinkerpop.blueprints.impls.orient.OrientBaseGraph;
import com.tinkerpop.blueprints.impls.orient.OrientVertex;
import fr.recolnat.database.model.DataModel;
import java.util.Date;
import java.util.Iterator;
/**
*
* @author dmitri
*/
public class TagUtils {
public static OrientVertex createTagDefinition(String key, String value, String creatorId, OrientBaseGraph g) {
OrientVertex vTag = g.addVertex("class:" + DataModel.Classes.tag);
vTag.setProperty(DataModel.Properties.id, "TAGDEF-" + CreatorUtils.newVertexUUID(g));
vTag.setProperty(DataModel.Properties.key, key);
vTag.setProperty(DataModel.Properties.value, value);
vTag.setProperty(DataModel.Properties.creationDate, (new Date()).getTime());
return vTag;
}
public static OrientVertex tagEntity(OrientVertex vEntity, OrientVertex vTag, String creatorId, OrientBaseGraph g) {
OrientVertex vAssociation = g.addVertex("class:" + DataModel.Classes.tagging);
vAssociation.setProperty(DataModel.Properties.id, "TAG-" + CreatorUtils.newVertexUUID(g));
vAssociation.setProperty(DataModel.Properties.creationDate, (new Date()).getTime());
UpdateUtils.link(vEntity, vAssociation, DataModel.Links.isTagged, creatorId, g);
UpdateUtils.link(vAssociation, vTag, DataModel.Links.hasDefinition, creatorId, g);
return vAssociation;
}
public static OrientVertex getTagDefinition(String uid, OrientBaseGraph g) {
Iterator<Vertex> itTagDefs = g.getVertices(DataModel.Classes.tag, new String[] {DataModel.Properties.id}, new Object[]{uid}).iterator();
return AccessUtils.findLatestVersion(itTagDefs, g);
}
public static OrientVertex findTag(String key, String value, OrientBaseGraph g) {
Iterator<Vertex> itTagDefs = g.getVertices(DataModel.Classes.tag, new String[] {DataModel.Properties.key, DataModel.Properties.value}, new Object[] {key, value}).iterator();
return AccessUtils.findLatestVersion(itTagDefs, g);
}
public static Iterable<Vertex> listTagsByKey(String key, OrientBaseGraph g) {
return g.getVertices(DataModel.Classes.tag, new String[] {DataModel.Properties.key}, new Object[] {key});
}
}
| 2,488 | 0.758039 | 0.758039 | 55 | 44.236362 | 42.389091 | 177 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.127273 | false | false |
12
|
c288c3f7ea68dc6cd714b818cb1867183d6f1344
| 15,195,594,293,467 |
e966e880a23bedb4cb8bd1f05d877943719e4b2f
|
/src/java/enterprise/business/Users.java
|
6092c54b049cd1f4bdd6f2e748196d36e1f7e93a
|
[] |
no_license
|
smwanzia/E-Voting
|
https://github.com/smwanzia/E-Voting
|
25eb0e8ea3e8ff01099e1d8a3988a80f83669cb3
|
91025cb74992bebeb264bbd8b5a1508cdd9a04fd
|
refs/heads/master
| 2020-03-28T21:10:20.406000 | 2018-09-15T18:22:19 | 2018-09-15T18:22:19 | 149,135,086 | 1 | 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 enterprise.business;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
*
* @author xmore mmohz
*/
public class Users extends Person implements Serializable {
private String roleid;
private String password;
//@Id
// @GeneratedValue(strategy=GenerationType.AUTO)
private String userid;
public Users(){
super();
roleid="";
userid="";
password="";
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public String getRoleid() {
return roleid;
}
public void setRoleid(String roleid) {
this.roleid = roleid;
}
}
|
UTF-8
|
Java
| 1,190 |
java
|
Users.java
|
Java
|
[
{
"context": "e;\nimport javax.persistence.Id;\n\n/**\n *\n * @author xmore mmohz\n */\n\npublic class Users extends Person implements",
"end": 418,
"score": 0.9994961023330688,
"start": 407,
"tag": "USERNAME",
"value": "xmore mmohz"
},
{
"context": "assword(String password) {\n this.password = password;\n }\n\n public String getUserid() {\n r",
"end": 891,
"score": 0.6608113050460815,
"start": 883,
"tag": "PASSWORD",
"value": "password"
}
] | 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 enterprise.business;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
*
* @author xmore mmohz
*/
public class Users extends Person implements Serializable {
private String roleid;
private String password;
//@Id
// @GeneratedValue(strategy=GenerationType.AUTO)
private String userid;
public Users(){
super();
roleid="";
userid="";
password="";
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = <PASSWORD>;
}
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
public String getRoleid() {
return roleid;
}
public void setRoleid(String roleid) {
this.roleid = roleid;
}
}
| 1,192 | 0.643698 | 0.643698 | 58 | 19.517241 | 18.203108 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.37931 | false | false |
12
|
a0a77bb131f5c95e7f78dc44ad42209b04be8dee
| 30,468,498,067,250 |
e112b14845dbca066595c6c7852211fbeadcdefe
|
/src/application/MainProgram.java
|
78ee433b4944bd55ceca716b7328fe1122683f09
|
[] |
no_license
|
CarlosLaurine/MySQL-JDBC-CRUD-Data-Selection
|
https://github.com/CarlosLaurine/MySQL-JDBC-CRUD-Data-Selection
|
88bc43cada2fe7663371f1c6980fcbce7063d61e
|
83955e61930a49b4bda428050e242a71521c4ec5
|
refs/heads/main
| 2023-03-22T13:09:45.692000 | 2021-03-17T06:07:26 | 2021-03-17T06:07:26 | 348,597,279 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package application;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import db.DB;
public class MainProgram {
public static void main(String[] args) {
//Initiating null variables with the JDBC Class-Types needed for selection
Connection con = null;
PreparedStatement pst = null;
ResultSet rs = null;
try {
con = DB.getConnection();
//OBS1: No case sensitivity at the command string
pst = con.prepareStatement("select * from department");
pst.executeQuery();
rs = pst.getResultSet();
while(rs.next()) {
System.out.print(rs.getInt(1) + ", ");
System.out.println(rs.getString(2));
}
}
catch (SQLException e) {
e.getMessage();
e.printStackTrace();
}
/*Since Connection, PreparedStatement and ResultSet are
external resources (not controlled by Java JVM), it is
important to close manually each of them in a finally clause*/
finally {
//Calling the specific closing methods in order to avoid multiple try catches
DB.closeResultSet(rs);
//Upcast in closeStatement as PreparedStatement pst is passed as a Statement parameter
DB.closeStatement(pst);
DB.closeConnection();
}
}
}
|
UTF-8
|
Java
| 1,272 |
java
|
MainProgram.java
|
Java
|
[] | null |
[] |
package application;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import db.DB;
public class MainProgram {
public static void main(String[] args) {
//Initiating null variables with the JDBC Class-Types needed for selection
Connection con = null;
PreparedStatement pst = null;
ResultSet rs = null;
try {
con = DB.getConnection();
//OBS1: No case sensitivity at the command string
pst = con.prepareStatement("select * from department");
pst.executeQuery();
rs = pst.getResultSet();
while(rs.next()) {
System.out.print(rs.getInt(1) + ", ");
System.out.println(rs.getString(2));
}
}
catch (SQLException e) {
e.getMessage();
e.printStackTrace();
}
/*Since Connection, PreparedStatement and ResultSet are
external resources (not controlled by Java JVM), it is
important to close manually each of them in a finally clause*/
finally {
//Calling the specific closing methods in order to avoid multiple try catches
DB.closeResultSet(rs);
//Upcast in closeStatement as PreparedStatement pst is passed as a Statement parameter
DB.closeStatement(pst);
DB.closeConnection();
}
}
}
| 1,272 | 0.689465 | 0.687107 | 61 | 19.852459 | 22.300362 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.065574 | false | false |
12
|
02e60cb71d6b05b8a356040a4cc9024da239c05d
| 20,950,850,536,808 |
039fd2fddb8ce256816f5f84f4f8820ddaf00843
|
/treaty-eclipse-tests/treaty-eclipse-voc-owl-tests/src/net/java/treaty/eclipse/vocabulary/owl/tests/Tests.java
|
83e7ca34dfb2fd257c69208874ddd3b9af9229fd
|
[] |
no_license
|
zmughal/treaty
|
https://github.com/zmughal/treaty
|
96305b778332b0b8b21e9651dcefcb2dfb9c85a0
|
ac58f10f9892df6f1511c563fe74548a616fe9eb
|
refs/heads/master
| 2021-01-10T19:03:40.651000 | 2010-02-21T23:11:59 | 2010-02-21T23:11:59 | 40,022,647 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* Copyright (C) 2008 Jens Dietrich
* 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 net.java.treaty.eclipse.vocabulary.owl.tests;
import java.net.URI;
import net.java.treaty.ExistsCondition;
import net.java.treaty.Resource;
import net.java.treaty.VerificationException;
import net.java.treaty.eclipse.EclipseConnector;
import net.java.treaty.eclipse.EclipseExtension;
import net.java.treaty.eclipse.EclipsePlugin;
import net.java.treaty.eclipse.vocabulary.owl.Activator;
import net.java.treaty.eclipse.vocabulary.owl.OWLVocabulary;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.junit.*;
import org.osgi.framework.Bundle;
/**
* Tests for Java vocabulary.
*
* @author Jens Dietrich
* @deprecated The {@link OWLVocabulary} plug-in and its tests have been
* deprecated since the Treaty core now supports a built-in OWL
* vocabulary itself.
*/
@Deprecated
public class Tests {
private OWLVocabulary VOC = null;
private EclipsePlugin plugin = null;
private EclipseConnector connector = null;
@Before
public void setUp() throws Exception {
VOC = new OWLVocabulary();
String id = Activator.PLUGIN_ID;
Bundle bundle = org.eclipse.core.runtime.Platform.getBundle(id);
plugin = new EclipsePlugin(bundle);
IExtensionRegistry registry =
org.eclipse.core.runtime.Platform.getExtensionRegistry();
IExtension x =
registry.getExtension("net.java.treaty.eclipse.vocabulary.owl");
connector = new EclipseExtension(plugin, x);
}
@After
public void tearDown() throws Exception {
VOC = null;
plugin = null;
connector = null;
}
private Resource getResource(String type, String name) throws Exception {
Resource r = new Resource();
r.setType(new URI(type));
r.setName(name);
String id = Activator.PLUGIN_ID;
Bundle bundle = org.eclipse.core.runtime.Platform.getBundle(id);
// note: load does not work, Bundle#getEntry does not load resources from
// fragments
// but getResource does
// this seems to contradict
// http://www.eclipsezone.com/eclipse/forums/t101557.rhtml
Object value = bundle.getResource(name);
r.setValue(value);
return r;
}
@Test
public void testTypes1() throws Exception {
Resource r = this.getResource(VOC.ONTOLOGY, "/testdata/owl.owl");
ExistsCondition c = new ExistsCondition();
c.setResource(r);
VOC.check(c);
}
@Test(expected = VerificationException.class)
public void testTypes2() throws Exception {
Resource r = this.getResource(VOC.ONTOLOGY, "/testdata/owl-i-1.owl");
ExistsCondition c = new ExistsCondition();
c.setResource(r);
VOC.check(c);
}
@Test(expected = VerificationException.class)
public void testTypes3() throws Exception {
Resource r = this.getResource(VOC.ONTOLOGY, "/testdata/doesnotexist.owl");
ExistsCondition c = new ExistsCondition();
c.setResource(r);
VOC.check(c);
}
}
|
UTF-8
|
Java
| 3,410 |
java
|
Tests.java
|
Java
|
[
{
"context": "/*\n * Copyright (C) 2008 Jens Dietrich\n * Licensed under the Apache License, Version 2.0",
"end": 38,
"score": 0.9998704195022583,
"start": 25,
"tag": "NAME",
"value": "Jens Dietrich"
},
{
"context": "\n\n/**\n * Tests for Java vocabulary.\n * \n * @author Jens Dietrich\n * @deprecated The {@link OWLVocabulary} plug-in ",
"end": 1256,
"score": 0.9998745918273926,
"start": 1243,
"tag": "NAME",
"value": "Jens Dietrich"
}
] | null |
[] |
/*
* Copyright (C) 2008 <NAME>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and limitations under the License.
*/
package net.java.treaty.eclipse.vocabulary.owl.tests;
import java.net.URI;
import net.java.treaty.ExistsCondition;
import net.java.treaty.Resource;
import net.java.treaty.VerificationException;
import net.java.treaty.eclipse.EclipseConnector;
import net.java.treaty.eclipse.EclipseExtension;
import net.java.treaty.eclipse.EclipsePlugin;
import net.java.treaty.eclipse.vocabulary.owl.Activator;
import net.java.treaty.eclipse.vocabulary.owl.OWLVocabulary;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.junit.*;
import org.osgi.framework.Bundle;
/**
* Tests for Java vocabulary.
*
* @author <NAME>
* @deprecated The {@link OWLVocabulary} plug-in and its tests have been
* deprecated since the Treaty core now supports a built-in OWL
* vocabulary itself.
*/
@Deprecated
public class Tests {
private OWLVocabulary VOC = null;
private EclipsePlugin plugin = null;
private EclipseConnector connector = null;
@Before
public void setUp() throws Exception {
VOC = new OWLVocabulary();
String id = Activator.PLUGIN_ID;
Bundle bundle = org.eclipse.core.runtime.Platform.getBundle(id);
plugin = new EclipsePlugin(bundle);
IExtensionRegistry registry =
org.eclipse.core.runtime.Platform.getExtensionRegistry();
IExtension x =
registry.getExtension("net.java.treaty.eclipse.vocabulary.owl");
connector = new EclipseExtension(plugin, x);
}
@After
public void tearDown() throws Exception {
VOC = null;
plugin = null;
connector = null;
}
private Resource getResource(String type, String name) throws Exception {
Resource r = new Resource();
r.setType(new URI(type));
r.setName(name);
String id = Activator.PLUGIN_ID;
Bundle bundle = org.eclipse.core.runtime.Platform.getBundle(id);
// note: load does not work, Bundle#getEntry does not load resources from
// fragments
// but getResource does
// this seems to contradict
// http://www.eclipsezone.com/eclipse/forums/t101557.rhtml
Object value = bundle.getResource(name);
r.setValue(value);
return r;
}
@Test
public void testTypes1() throws Exception {
Resource r = this.getResource(VOC.ONTOLOGY, "/testdata/owl.owl");
ExistsCondition c = new ExistsCondition();
c.setResource(r);
VOC.check(c);
}
@Test(expected = VerificationException.class)
public void testTypes2() throws Exception {
Resource r = this.getResource(VOC.ONTOLOGY, "/testdata/owl-i-1.owl");
ExistsCondition c = new ExistsCondition();
c.setResource(r);
VOC.check(c);
}
@Test(expected = VerificationException.class)
public void testTypes3() throws Exception {
Resource r = this.getResource(VOC.ONTOLOGY, "/testdata/doesnotexist.owl");
ExistsCondition c = new ExistsCondition();
c.setResource(r);
VOC.check(c);
}
}
| 3,396 | 0.743695 | 0.738416 | 108 | 30.574074 | 26.84634 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.444444 | false | false |
12
|
e1dfd6378a65ef411d56daf0f9f09fb840fbc3d7
| 6,090,263,664,381 |
e4e041c9d487a57337f69772418f3e19b7d740e9
|
/src/Gui/MainForm.java
|
1aae04b6e1a204fdc77108bbea8aa7093a568878
|
[
"MIT"
] |
permissive
|
Zylius/grafai
|
https://github.com/Zylius/grafai
|
a5e02c8a15e890a48cf423a926778e1fe80d491d
|
54975174bffa91d1160229e432c5ef306c117c61
|
refs/heads/master
| 2021-01-19T08:23:14.397000 | 2014-12-08T08:42:49 | 2014-12-08T08:42:49 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Gui;
import Atvaizdavimas.Controller.Mouse;
import Atvaizdavimas.Drawers.OpenGL.OpenGL;
import Classes.Map;
import Classes.Point;
import Classes.ShortestEdgeMap;
import Intefaces.IMap;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;
public class MainForm extends JFrame{
private JButton drawButton;
private JButton loadButton;
private JButton generateButton;
private JPanel MainPanel;
private JTextField pointNumberField;
private JLabel loadErrorText;
private JLabel generateErrorText;
private JComboBox algorithmBox;
private JLabel algorithmLabel;
private JPanel OpenGLPanel;
private JDesktopPane desktopPane;
private IMap defaultMap = new Map();
private IMap edgeMap = new ShortestEdgeMap();
private IMap map;
public MainForm(){
super("Grafai");
setContentPane(MainPanel);
pack();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
generateErrorText.setVisible(false);
loadErrorText.setVisible(false);
// graph drawing
drawButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String selectedAlgorithm = algorithmBox.getSelectedItem().toString();
if(selectedAlgorithm.equals("Kriskal"))
{
map = defaultMap;
System.out.print(defaultMap);
System.out.println(String.format("================= %15s: %4.2f =================", "Medzio ilgis Dijkstra", defaultMap.TreeSize()));
}
else if(selectedAlgorithm.equals("Prim"))
{
map = edgeMap;
System.out.print(edgeMap);
System.out.println(String.format("================= %15s: %4.2f =================","Medzio ilgis salinimas", edgeMap.TreeSize()));
}
OpenGL drawer = new OpenGL();
drawer.setMap(map);
desktopPane.removeAll();
addGraph(drawer.getCanvas());
new Mouse(drawer);
}
});
// graph loading from file
loadButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser();
int returnVal = fc.showOpenDialog(MainForm.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
boolean noError;
defaultMap = new Map();
edgeMap = new ShortestEdgeMap();
noError = defaultMap.readFromFile(file);
if(noError){
defaultMap.generateTree(0);
defaultMap.returnTree();
edgeMap.setPoints(defaultMap.getPoints());
edgeMap.generateTree(0);
edgeMap.returnTree();
drawButton.setEnabled(true);
loadErrorText.setVisible(false);
}
else
{
loadErrorText.setVisible(true);
drawButton.setEnabled(false);
}
}
}
});
// graph generation
generateButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
int numPoints = Integer.parseInt(pointNumberField.getText());
defaultMap = new Map();
edgeMap = new ShortestEdgeMap();
defaultMap.generateMap(numPoints);
defaultMap.generateTree(0);
defaultMap.returnTree();
edgeMap.setPoints(defaultMap.getPoints());
//edgeMap.generateMap(numPoints);
edgeMap.generateTree(0);
edgeMap.returnTree();
drawButton.setEnabled(true);
generateErrorText.setVisible(false);
} catch (NumberFormatException name)
{
generateErrorText.setVisible(true);
drawButton.setEnabled(false);
}
}
});
setVisible(true);
}
public void addGraph(OpenGL canvas)
{
final JInternalFrame Frame = new JInternalFrame();
Frame.setVisible(true);
Frame.setSize(710, 500);
Frame.setLocation(-5,-28);
Frame.setTitle("Grafas");
Frame.add(canvas, BorderLayout.CENTER);
Frame.setVisible(true);
desktopPane.add(Frame);
}
}
|
UTF-8
|
Java
| 5,095 |
java
|
MainForm.java
|
Java
|
[
{
"context": "============= %15s: %4.2f =================\", \"Medzio ilgis Dijkstra\", defaultMap.TreeSize()));\n ",
"end": 1761,
"score": 0.5859261155128479,
"start": 1758,
"tag": "NAME",
"value": "zio"
},
{
"context": "============== %15s: %4.2f =================\",\"Medzio ilgis salinimas\", edgeMap.TreeSize()));\n ",
"end": 2091,
"score": 0.5295632481575012,
"start": 2088,
"tag": "NAME",
"value": "zio"
}
] | null |
[] |
package Gui;
import Atvaizdavimas.Controller.Mouse;
import Atvaizdavimas.Drawers.OpenGL.OpenGL;
import Classes.Map;
import Classes.Point;
import Classes.ShortestEdgeMap;
import Intefaces.IMap;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;
public class MainForm extends JFrame{
private JButton drawButton;
private JButton loadButton;
private JButton generateButton;
private JPanel MainPanel;
private JTextField pointNumberField;
private JLabel loadErrorText;
private JLabel generateErrorText;
private JComboBox algorithmBox;
private JLabel algorithmLabel;
private JPanel OpenGLPanel;
private JDesktopPane desktopPane;
private IMap defaultMap = new Map();
private IMap edgeMap = new ShortestEdgeMap();
private IMap map;
public MainForm(){
super("Grafai");
setContentPane(MainPanel);
pack();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
generateErrorText.setVisible(false);
loadErrorText.setVisible(false);
// graph drawing
drawButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String selectedAlgorithm = algorithmBox.getSelectedItem().toString();
if(selectedAlgorithm.equals("Kriskal"))
{
map = defaultMap;
System.out.print(defaultMap);
System.out.println(String.format("================= %15s: %4.2f =================", "Medzio ilgis Dijkstra", defaultMap.TreeSize()));
}
else if(selectedAlgorithm.equals("Prim"))
{
map = edgeMap;
System.out.print(edgeMap);
System.out.println(String.format("================= %15s: %4.2f =================","Medzio ilgis salinimas", edgeMap.TreeSize()));
}
OpenGL drawer = new OpenGL();
drawer.setMap(map);
desktopPane.removeAll();
addGraph(drawer.getCanvas());
new Mouse(drawer);
}
});
// graph loading from file
loadButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser();
int returnVal = fc.showOpenDialog(MainForm.this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fc.getSelectedFile();
boolean noError;
defaultMap = new Map();
edgeMap = new ShortestEdgeMap();
noError = defaultMap.readFromFile(file);
if(noError){
defaultMap.generateTree(0);
defaultMap.returnTree();
edgeMap.setPoints(defaultMap.getPoints());
edgeMap.generateTree(0);
edgeMap.returnTree();
drawButton.setEnabled(true);
loadErrorText.setVisible(false);
}
else
{
loadErrorText.setVisible(true);
drawButton.setEnabled(false);
}
}
}
});
// graph generation
generateButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
try {
int numPoints = Integer.parseInt(pointNumberField.getText());
defaultMap = new Map();
edgeMap = new ShortestEdgeMap();
defaultMap.generateMap(numPoints);
defaultMap.generateTree(0);
defaultMap.returnTree();
edgeMap.setPoints(defaultMap.getPoints());
//edgeMap.generateMap(numPoints);
edgeMap.generateTree(0);
edgeMap.returnTree();
drawButton.setEnabled(true);
generateErrorText.setVisible(false);
} catch (NumberFormatException name)
{
generateErrorText.setVisible(true);
drawButton.setEnabled(false);
}
}
});
setVisible(true);
}
public void addGraph(OpenGL canvas)
{
final JInternalFrame Frame = new JInternalFrame();
Frame.setVisible(true);
Frame.setSize(710, 500);
Frame.setLocation(-5,-28);
Frame.setTitle("Grafas");
Frame.add(canvas, BorderLayout.CENTER);
Frame.setVisible(true);
desktopPane.add(Frame);
}
}
| 5,095 | 0.541708 | 0.537586 | 156 | 31.660257 | 24.4877 | 153 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.621795 | false | false |
12
|
9194ea8ca7dbc0547f79f3da4f8e18f7f917ea9a
| 14,156,212,211,861 |
8adad19ae9f7a6fc7678f07a47a2387561945bed
|
/webapps/wiki/src/com/enjoyf/wiki/util/UploadQiniuUtil.java
|
e57a458d3eeeec08fd44b1961f73af96c5357561
|
[] |
no_license
|
liu67224657/toolsplatform
|
https://github.com/liu67224657/toolsplatform
|
542231a60170c175a9933eaf159ef236be5ce60e
|
18b628ae2695fdfd0b111a6470437a50041cfdeb
|
refs/heads/master
| 2021-07-24T12:39:05.916000 | 2017-11-04T18:38:02 | 2017-11-04T18:38:02 | 109,519,814 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.enjoyf.wiki.util;
import com.enjoyf.util.FileUtil;
import com.enjoyf.util.HttpClientManager;
import com.enjoyf.util.HttpParameter;
import com.enjoyf.util.HttpResult;
import com.enjoyf.wiki.container.PropertiesContainer;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
/**
* Created by zhimingli on 2015/5/26.
*/
public class UploadQiniuUtil {
private static String UOLOAD_URL = "http://up001.joyme.com/json/upload/qiniu";
private static String getPath() {
return PropertiesContainer.getInstance().getCacheFolder() + "/cardopionin";
}
public static String uploadQiniu(MultipartFile file) {
if (file == null) {
return null;
}
String retuenURL = null;
String fileLocalPath = null;
try {
String path = getPath();
if (!FileUtil.isFileOrDirExist(path)) {
FileUtil.createDirectory(path);
}
fileLocalPath = path + "/" + file.getOriginalFilename();
File file1 = new File(fileLocalPath);
CommonsMultipartFile commonsMultipartFile = (CommonsMultipartFile) file;
commonsMultipartFile.transferTo(file1);
HttpResult result = new HttpClientManager().postMultipart(UOLOAD_URL,
new HttpParameter[]{
new HttpParameter("Filedata", file1),
new HttpParameter("at", "joymeplatform"),
new HttpParameter("filetype", "original")
});
if (result.getReponseCode() == 200) {
//{"status_code":"1","billingStatus":false,"msg":"上传成功","result":["http://joymepic.qiniudn.com/qiniu/original/2015/05/92/68faa9920503d04f0e0be7d07d29b6992581.png"]}
JSONObject object = JSONObject.fromObject(result.getResult());
if (object.containsKey("result")) {
retuenURL = (String) ((JSONArray) object.get("result")).get(0);
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
FileUtil.deleteFileOrDir(fileLocalPath);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
return retuenURL;
}
}
|
UTF-8
|
Java
| 2,641 |
java
|
UploadQiniuUtil.java
|
Java
|
[
{
"context": "on;\nimport java.io.IOException;\n\n/**\n * Created by zhimingli on 2015/5/26.\n */\npublic class UploadQiniuUtil {\n",
"end": 537,
"score": 0.9996769428253174,
"start": 528,
"tag": "USERNAME",
"value": "zhimingli"
}
] | null |
[] |
package com.enjoyf.wiki.util;
import com.enjoyf.util.FileUtil;
import com.enjoyf.util.HttpClientManager;
import com.enjoyf.util.HttpParameter;
import com.enjoyf.util.HttpResult;
import com.enjoyf.wiki.container.PropertiesContainer;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
/**
* Created by zhimingli on 2015/5/26.
*/
public class UploadQiniuUtil {
private static String UOLOAD_URL = "http://up001.joyme.com/json/upload/qiniu";
private static String getPath() {
return PropertiesContainer.getInstance().getCacheFolder() + "/cardopionin";
}
public static String uploadQiniu(MultipartFile file) {
if (file == null) {
return null;
}
String retuenURL = null;
String fileLocalPath = null;
try {
String path = getPath();
if (!FileUtil.isFileOrDirExist(path)) {
FileUtil.createDirectory(path);
}
fileLocalPath = path + "/" + file.getOriginalFilename();
File file1 = new File(fileLocalPath);
CommonsMultipartFile commonsMultipartFile = (CommonsMultipartFile) file;
commonsMultipartFile.transferTo(file1);
HttpResult result = new HttpClientManager().postMultipart(UOLOAD_URL,
new HttpParameter[]{
new HttpParameter("Filedata", file1),
new HttpParameter("at", "joymeplatform"),
new HttpParameter("filetype", "original")
});
if (result.getReponseCode() == 200) {
//{"status_code":"1","billingStatus":false,"msg":"上传成功","result":["http://joymepic.qiniudn.com/qiniu/original/2015/05/92/68faa9920503d04f0e0be7d07d29b6992581.png"]}
JSONObject object = JSONObject.fromObject(result.getResult());
if (object.containsKey("result")) {
retuenURL = (String) ((JSONArray) object.get("result")).get(0);
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
FileUtil.deleteFileOrDir(fileLocalPath);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
return retuenURL;
}
}
| 2,641 | 0.605773 | 0.586403 | 73 | 35.041096 | 29.91927 | 180 | false | false | 0 | 0 | 0 | 0 | 66 | 0.025066 | 0.561644 | false | false |
12
|
972547e12f0bb41ccbca59bd11d1d92937948019
| 22,995,254,929,930 |
42cad16063209f67df045777df79b183fe2b29a9
|
/src/link/DetectCycle.java
|
a847413007d83edd5bc62556a420f6febb0a2b08
|
[] |
no_license
|
hyhcoder/leetcode
|
https://github.com/hyhcoder/leetcode
|
6c145f21d3ad7c603f148880b76a0d7e6ea14193
|
48fb28326d349f37a69a84fda1926a71fa5c9998
|
refs/heads/master
| 2021-05-23T15:50:58.461000 | 2020-10-19T13:44:00 | 2020-10-19T13:44:00 | 253,368,705 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package link;
/**
* @author hyhcoder
* @date 2020/3/19 7:58
*
* 环形链表 II
*
*/
public class DetectCycle {
public static void main(String[] args) {
ListNode listNode1 = new ListNode(1);
ListNode listNode2 = new ListNode(2);
ListNode listNode3 = new ListNode(3);
ListNode listNode4 = new ListNode(4);
listNode1.next = listNode2;
listNode2.next = listNode3;
listNode3.next = listNode4;
listNode4.next = listNode2;
DetectCycle detectCycle = new DetectCycle();
ListNode listNode = detectCycle.detectCycle(listNode1);
System.out.println(listNode);
}
public ListNode detectCycle(ListNode head) {
if (head == null || head.next == null || head.next.next == null) {
return null;
}
ListNode qlistNode = head.next.next;
ListNode slistNode = head.next;
while (qlistNode != slistNode) {
if (qlistNode == null ||qlistNode.next == null) {
return null;
}
qlistNode = qlistNode.next.next;
slistNode = slistNode.next;
}
// 这个时候把快指针置为头指针
qlistNode = head;
while (qlistNode != slistNode) {
qlistNode = qlistNode.next;
slistNode = slistNode.next;
}
return qlistNode;
}
}
|
UTF-8
|
Java
| 1,191 |
java
|
DetectCycle.java
|
Java
|
[
{
"context": "package link;\n\n/**\n * @author hyhcoder\n * @date 2020/3/19 7:58\n *\n * 环形链表 II\n *\n */\npub",
"end": 38,
"score": 0.9996383786201477,
"start": 30,
"tag": "USERNAME",
"value": "hyhcoder"
}
] | null |
[] |
package link;
/**
* @author hyhcoder
* @date 2020/3/19 7:58
*
* 环形链表 II
*
*/
public class DetectCycle {
public static void main(String[] args) {
ListNode listNode1 = new ListNode(1);
ListNode listNode2 = new ListNode(2);
ListNode listNode3 = new ListNode(3);
ListNode listNode4 = new ListNode(4);
listNode1.next = listNode2;
listNode2.next = listNode3;
listNode3.next = listNode4;
listNode4.next = listNode2;
DetectCycle detectCycle = new DetectCycle();
ListNode listNode = detectCycle.detectCycle(listNode1);
System.out.println(listNode);
}
public ListNode detectCycle(ListNode head) {
if (head == null || head.next == null || head.next.next == null) {
return null;
}
ListNode qlistNode = head.next.next;
ListNode slistNode = head.next;
while (qlistNode != slistNode) {
if (qlistNode == null ||qlistNode.next == null) {
return null;
}
qlistNode = qlistNode.next.next;
slistNode = slistNode.next;
}
// 这个时候把快指针置为头指针
qlistNode = head;
while (qlistNode != slistNode) {
qlistNode = qlistNode.next;
slistNode = slistNode.next;
}
return qlistNode;
}
}
| 1,191 | 0.663786 | 0.640449 | 55 | 20.036364 | 17.594383 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.163636 | false | false |
12
|
14a682654c8ad1fcfe87aa4ef90569ea9e7ef672
| 2,808,908,633,559 |
a481d9bf66c877517330ab3f096e679e7bf83d22
|
/src/main/java/com/xtf/aggregatepay/BeetlGenCode.java
|
90ed22d4ee850fb70b4d014ce89994ef306ac7e5
|
[] |
no_license
|
yuhaihui3435/aggregate-pay
|
https://github.com/yuhaihui3435/aggregate-pay
|
85393fdb161c4e0a46a0b47986b4fe20e114f9ab
|
af041dc0cad63b1f04f023e8427459a77bef559a
|
refs/heads/master
| 2020-03-27T21:56:41.023000 | 2019-05-12T23:02:07 | 2019-05-12T23:02:07 | 147,189,272 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.xtf.aggregatepay;
import com.xtf.aggregatepay.util.DelSuffixConversion;
import org.beetl.sql.core.*;
import org.beetl.sql.core.db.DBStyle;
import org.beetl.sql.core.db.MySqlStyle;
import org.beetl.sql.ext.DebugInterceptor;
import org.beetl.sql.ext.gen.GenConfig;
public class BeetlGenCode {
public static void main(String[] args) throws Exception {
ConnectionSource source = ConnectionSourceHelper.getSimple("com.mysql.jdbc.Driver", "jdbc:mysql://47.75.135.105:53306/aggregate_pay_pro_db?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull", "root", "SLsO9P2vX1m#Z!");
DBStyle mysql = new MySqlStyle();
SQLLoader loader = new ClasspathLoader("/sql");
DelSuffixConversion nc = new DelSuffixConversion();
SQLManager sqlManager = new SQLManager(mysql, loader, source, nc,new Interceptor[]{new DebugInterceptor()});
GenConfig config = new GenConfig();
config.setIgnorePrefix("_t");
config.preferBigDecimal(true);
config.setBaseClass("com.xtf.aggregatepay.core.BaseEntity");
String table="channel_sub_info";
sqlManager.genPojoCode(table,"com.xtf.aggregatepay.entity",config);
sqlManager.genSQLFile(table,config);
}
}
|
UTF-8
|
Java
| 1,290 |
java
|
BeetlGenCode.java
|
Java
|
[
{
"context": ".getSimple(\"com.mysql.jdbc.Driver\", \"jdbc:mysql://47.75.135.105:53306/aggregate_pay_pro_db?useUnicode=true&charac",
"end": 488,
"score": 0.999713659286499,
"start": 475,
"tag": "IP_ADDRESS",
"value": "47.75.135.105"
},
{
"context": "e&zeroDateTimeBehavior=convertToNull\", \"root\", \"SLsO9P2vX1m#Z!\");\n DBStyle mysql = new MySqlStyle();\n ",
"end": 647,
"score": 0.7726693749427795,
"start": 636,
"tag": "PASSWORD",
"value": "sO9P2vX1m#Z"
}
] | null |
[] |
package com.xtf.aggregatepay;
import com.xtf.aggregatepay.util.DelSuffixConversion;
import org.beetl.sql.core.*;
import org.beetl.sql.core.db.DBStyle;
import org.beetl.sql.core.db.MySqlStyle;
import org.beetl.sql.ext.DebugInterceptor;
import org.beetl.sql.ext.gen.GenConfig;
public class BeetlGenCode {
public static void main(String[] args) throws Exception {
ConnectionSource source = ConnectionSourceHelper.getSimple("com.mysql.jdbc.Driver", "jdbc:mysql://172.16.17.32:53306/aggregate_pay_pro_db?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull", "root", "SL<PASSWORD>!");
DBStyle mysql = new MySqlStyle();
SQLLoader loader = new ClasspathLoader("/sql");
DelSuffixConversion nc = new DelSuffixConversion();
SQLManager sqlManager = new SQLManager(mysql, loader, source, nc,new Interceptor[]{new DebugInterceptor()});
GenConfig config = new GenConfig();
config.setIgnorePrefix("_t");
config.preferBigDecimal(true);
config.setBaseClass("com.xtf.aggregatepay.core.BaseEntity");
String table="channel_sub_info";
sqlManager.genPojoCode(table,"com.xtf.aggregatepay.entity",config);
sqlManager.genSQLFile(table,config);
}
}
| 1,288 | 0.730233 | 0.715504 | 29 | 43.482758 | 52.543983 | 282 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
12
|
efb63179295ce8aa544cffa475df1a4966a4daa6
| 19,473,381,750,281 |
9649dfeb469e43c7944c0db1037ee3d9e2cdc281
|
/src/main/java/com/numtoword/service/NTWConverterInputService.java
|
99b3908f086046f960252801ec89890b56d1cde4
|
[] |
no_license
|
kalpanaatp/NTWConverters
|
https://github.com/kalpanaatp/NTWConverters
|
5b7142f79b2804461b20062ff8334144f7ab0869
|
25c287a49adff4f10d6437376e27dfdfe535b88c
|
refs/heads/master
| 2020-07-17T22:19:38.955000 | 2019-09-03T15:56:10 | 2019-09-03T15:56:10 | 206,111,723 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.numtoword.service;
import com.numtoword.exception.NTWConverterException;
public interface NTWConverterInputService {
int read() throws NTWConverterException;
}
|
UTF-8
|
Java
| 176 |
java
|
NTWConverterInputService.java
|
Java
|
[] | null |
[] |
package com.numtoword.service;
import com.numtoword.exception.NTWConverterException;
public interface NTWConverterInputService {
int read() throws NTWConverterException;
}
| 176 | 0.835227 | 0.835227 | 7 | 24 | 21.407608 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.571429 | false | false |
12
|
ae223ab48f2cbd429d456b7c7854a1e9a5f01b62
| 19,636,590,530,683 |
06dd0a597a00de6c1399bc99829be652e8766c32
|
/core/nuts-runtime/src/main/java/net/thevpc/nuts/runtime/standalone/util/iter/ErrorHandlerIterator.java
|
1856505c36340e28eecebc6a3b1375e1c136bdaf
|
[
"Apache-2.0"
] |
permissive
|
thevpc/nuts
|
https://github.com/thevpc/nuts
|
8703455fb84663e006012856ab34de230869d596
|
d3b9aed973c7604362439484098fd4c313623b69
|
refs/heads/master
| 2023-08-19T10:15:26.234000 | 2023-08-18T14:59:30 | 2023-08-18T14:59:30 | 98,169,854 | 107 | 4 |
NOASSERTION
| false | 2023-08-15T17:41:23 | 2017-07-24T08:51:47 | 2023-07-27T15:12:57 | 2023-08-15T17:41:22 | 272,236 | 96 | 4 | 17 |
Java
| false | false |
/*
* 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 net.thevpc.nuts.runtime.standalone.util.iter;
import net.thevpc.nuts.*;
import net.thevpc.nuts.elem.NElement;
import net.thevpc.nuts.util.NDescribables;
import net.thevpc.nuts.log.NLogOp;
import net.thevpc.nuts.log.NLogVerb;
import net.thevpc.nuts.util.NMsg;
import java.util.Iterator;
import java.util.logging.Level;
/**
*
* @author thevpc
*/
public class ErrorHandlerIterator<T> extends NIteratorBase<T> {
private IteratorErrorHandlerType type;
private Iterator<T> base;
private RuntimeException ex;
private NSession session;
public ErrorHandlerIterator(IteratorErrorHandlerType type, Iterator<T> base, NSession session) {
this.base = base;
this.type = type;
this.session = session;
}
@Override
public NElement describe(NSession session) {
return NDescribables.resolveOrDestructAsObject(base, session)
.builder()
.set("onError",type.toString().toLowerCase())
.build();
}
@Override
public boolean hasNext() {
try {
boolean v = base.hasNext();
ex = null;
return v;
} catch (RuntimeException ex) {
NLogOp.of(IndexFirstIterator.class,session)
.verb(NLogVerb.WARNING)
.level(Level.FINEST)
.log(NMsg.ofC("error evaluating Iterator 'hasNext()' : %s", ex));
switch (type) {
case IGNORE: {
// do nothing
return false;
}
case POSTPONE: {
// do nothing
this.ex = ex;
return true;
}
case THROW: {
throw ex;
}
}
}
throw new UnsupportedOperationException();
}
@Override
public T next() {
if (ex != null) {
throw ex;
}
return base.next();
}
@Override
public void remove() {
if (ex != null) {
throw ex;
}
base.remove();
}
@Override
public String toString() {
switch (type){
case THROW:return "ThrowOnError("+ base +")";
case POSTPONE:return "PostponeError("+ base +")";
case IGNORE:return "IgnoreError("+ base +")";
}
return "ErrorHandlerIterator(" +
"type=" + type +
", base=" + base +
')';
}
}
|
UTF-8
|
Java
| 2,713 |
java
|
ErrorHandlerIterator.java
|
Java
|
[
{
"context": "import java.util.logging.Level;\n\n/**\n *\n * @author thevpc\n */\npublic class ErrorHandlerIterator<T> extends ",
"end": 538,
"score": 0.9993894100189209,
"start": 532,
"tag": "USERNAME",
"value": "thevpc"
}
] | 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 net.thevpc.nuts.runtime.standalone.util.iter;
import net.thevpc.nuts.*;
import net.thevpc.nuts.elem.NElement;
import net.thevpc.nuts.util.NDescribables;
import net.thevpc.nuts.log.NLogOp;
import net.thevpc.nuts.log.NLogVerb;
import net.thevpc.nuts.util.NMsg;
import java.util.Iterator;
import java.util.logging.Level;
/**
*
* @author thevpc
*/
public class ErrorHandlerIterator<T> extends NIteratorBase<T> {
private IteratorErrorHandlerType type;
private Iterator<T> base;
private RuntimeException ex;
private NSession session;
public ErrorHandlerIterator(IteratorErrorHandlerType type, Iterator<T> base, NSession session) {
this.base = base;
this.type = type;
this.session = session;
}
@Override
public NElement describe(NSession session) {
return NDescribables.resolveOrDestructAsObject(base, session)
.builder()
.set("onError",type.toString().toLowerCase())
.build();
}
@Override
public boolean hasNext() {
try {
boolean v = base.hasNext();
ex = null;
return v;
} catch (RuntimeException ex) {
NLogOp.of(IndexFirstIterator.class,session)
.verb(NLogVerb.WARNING)
.level(Level.FINEST)
.log(NMsg.ofC("error evaluating Iterator 'hasNext()' : %s", ex));
switch (type) {
case IGNORE: {
// do nothing
return false;
}
case POSTPONE: {
// do nothing
this.ex = ex;
return true;
}
case THROW: {
throw ex;
}
}
}
throw new UnsupportedOperationException();
}
@Override
public T next() {
if (ex != null) {
throw ex;
}
return base.next();
}
@Override
public void remove() {
if (ex != null) {
throw ex;
}
base.remove();
}
@Override
public String toString() {
switch (type){
case THROW:return "ThrowOnError("+ base +")";
case POSTPONE:return "PostponeError("+ base +")";
case IGNORE:return "IgnoreError("+ base +")";
}
return "ErrorHandlerIterator(" +
"type=" + type +
", base=" + base +
')';
}
}
| 2,713 | 0.532621 | 0.532621 | 101 | 25.861385 | 20.347977 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.435644 | false | false |
12
|
8b68fdc64624d12fc301680fb9e344bc84a97cb6
| 11,493,332,486,573 |
685b234bb56cfbff855c221999bc4bd41d418256
|
/src/interviewbit/Ninja/DeterministicFiniteAutomaton.java
|
3805fe4fdf75d839ebcc4e45190d650eba5749e8
|
[] |
no_license
|
maximbu/coding
|
https://github.com/maximbu/coding
|
1c81a20ceb258d530b37a4159bfb54933ba658b8
|
9be1f394babc4a0d37f0bfc91f8772adb7148ea9
|
refs/heads/master
| 2021-04-09T13:18:15.432000 | 2020-02-15T13:24:50 | 2020-02-20T20:58:41 | 125,671,705 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package interviewbit.Ninja;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Deterministic finite automaton(DFA) is a finite state machine that accepts/rejects finite strings of symbols and only produces a unique computation (or run) of the automation for each input string.
*
* DFAs can be represented using state diagrams. For example, in the automaton shown below, there are three states: S0, S1, and S2 (denoted graphically by circles). The automaton takes a finite sequence of 0s and 1s as input. For each state, there is a transition arrow leading out to a next state for both 0 and 1. Upon reading a symbol, a DFA jumps deterministically from a state to another by following the transition arrow. For example, if the automaton is currently in state S0 and current input symbol is 1 then it deterministically jumps to state S1. A DFA has a start state (denoted graphically by an arrow coming in from nowhere) where computations begin, and a set of accept states (denoted graphically by a double circle) which help define when a computation is successful.
*
* img
*
* These are some strings above DFA accepts,
*
* 0
* 00
* 000
* 11
* 110
* 1001
* You are given a DFA in input and an integer N. You have to tell how many distinct strings of length N the given DFA accepts. Return answer modulo 109+7.
*
* Notes
*
* Assume each state has two outgoing edges(one for 0 and one for 1). Both outgoing edges won’t go to the same state.
* There could be multiple accept states, but only one start state.
* A start state could also be an accept state.
* Input format
*
* States are numbered from 0 to K-1, where K is total number of states in DFA.
* You are given three arrays A, B, C and two integers D and N.
* Array A denotes a 0 edge from state numbered i to state A[i], for all 0 ≤ i ≤ K-1
* Array B denotes a 1 edge from state numbered i to state B[i], for all 0 ≤ i ≤ K-1
* Array C contains indices of all accept states.
* Integer D denotes the start state.
* Integer N denotes you have to count how many distinct strings of length N the given DFA accepts.
* Constraints
* 1 ≤ K ≤ 50
* 1 ≤ N ≤ 104
*
* Example :
*
* For the DFA shown in image, input is
* A = [0, 2, 1]
* B = [1, 0, 2]
* C = [0]
* D = 0
*
* Input 1
* -------
* N = 2
* Strings '00' and '11' are only strings on length 2 which are accepted. So, answer is 2.
*
* Input 2
* -------
* N = 1
* String '0' is the only string. Answer is 1.
*/
public class DeterministicFiniteAutomaton {
int MODULO = 1000000007;
public int automataRec(ArrayList<Integer> A, ArrayList<Integer> B, ArrayList<Integer> C, int D, int E) {
if (E == 0) {
if (C.contains(D)) {
return 1;
}
return 0;
}
int zeroTrans = automataRec(A, B, C, A.get(D), E - 1) % MODULO;
int oneTrans = automataRec(A, B, C, B.get(D), E - 1) % MODULO;
return (zeroTrans + oneTrans) % MODULO;
}
public int automata(ArrayList<Integer> A, ArrayList<Integer> B, ArrayList<Integer> C, int D, int E) {
if (E == 0) {
if (C.contains(D)) {
return 1;
}
return 0;
}
HashMap<Integer, Long> map = new HashMap<>();
map.put(D, 1L);
while (E > 0) {
HashMap<Integer, Long> tmp = new HashMap<>();
for (int state : map.keySet()) {
long zeroTrans = tmp.getOrDefault(A.get(state), 0L) + map.get(state) % MODULO;
long oneTrans = tmp.getOrDefault(B.get(state), 0L) + map.get(state) % MODULO;
tmp.put(A.get(state), zeroTrans);
tmp.put(B.get(state), oneTrans);
}
map = tmp;
E--;
}
long total = 0;
for (int state : C) {
total = (total + map.getOrDefault(state, 0L)) % MODULO;
}
return (int) total;
}
}
|
UTF-8
|
Java
| 3,768 |
java
|
DeterministicFiniteAutomaton.java
|
Java
|
[] | null |
[] |
package interviewbit.Ninja;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Deterministic finite automaton(DFA) is a finite state machine that accepts/rejects finite strings of symbols and only produces a unique computation (or run) of the automation for each input string.
*
* DFAs can be represented using state diagrams. For example, in the automaton shown below, there are three states: S0, S1, and S2 (denoted graphically by circles). The automaton takes a finite sequence of 0s and 1s as input. For each state, there is a transition arrow leading out to a next state for both 0 and 1. Upon reading a symbol, a DFA jumps deterministically from a state to another by following the transition arrow. For example, if the automaton is currently in state S0 and current input symbol is 1 then it deterministically jumps to state S1. A DFA has a start state (denoted graphically by an arrow coming in from nowhere) where computations begin, and a set of accept states (denoted graphically by a double circle) which help define when a computation is successful.
*
* img
*
* These are some strings above DFA accepts,
*
* 0
* 00
* 000
* 11
* 110
* 1001
* You are given a DFA in input and an integer N. You have to tell how many distinct strings of length N the given DFA accepts. Return answer modulo 109+7.
*
* Notes
*
* Assume each state has two outgoing edges(one for 0 and one for 1). Both outgoing edges won’t go to the same state.
* There could be multiple accept states, but only one start state.
* A start state could also be an accept state.
* Input format
*
* States are numbered from 0 to K-1, where K is total number of states in DFA.
* You are given three arrays A, B, C and two integers D and N.
* Array A denotes a 0 edge from state numbered i to state A[i], for all 0 ≤ i ≤ K-1
* Array B denotes a 1 edge from state numbered i to state B[i], for all 0 ≤ i ≤ K-1
* Array C contains indices of all accept states.
* Integer D denotes the start state.
* Integer N denotes you have to count how many distinct strings of length N the given DFA accepts.
* Constraints
* 1 ≤ K ≤ 50
* 1 ≤ N ≤ 104
*
* Example :
*
* For the DFA shown in image, input is
* A = [0, 2, 1]
* B = [1, 0, 2]
* C = [0]
* D = 0
*
* Input 1
* -------
* N = 2
* Strings '00' and '11' are only strings on length 2 which are accepted. So, answer is 2.
*
* Input 2
* -------
* N = 1
* String '0' is the only string. Answer is 1.
*/
public class DeterministicFiniteAutomaton {
int MODULO = 1000000007;
public int automataRec(ArrayList<Integer> A, ArrayList<Integer> B, ArrayList<Integer> C, int D, int E) {
if (E == 0) {
if (C.contains(D)) {
return 1;
}
return 0;
}
int zeroTrans = automataRec(A, B, C, A.get(D), E - 1) % MODULO;
int oneTrans = automataRec(A, B, C, B.get(D), E - 1) % MODULO;
return (zeroTrans + oneTrans) % MODULO;
}
public int automata(ArrayList<Integer> A, ArrayList<Integer> B, ArrayList<Integer> C, int D, int E) {
if (E == 0) {
if (C.contains(D)) {
return 1;
}
return 0;
}
HashMap<Integer, Long> map = new HashMap<>();
map.put(D, 1L);
while (E > 0) {
HashMap<Integer, Long> tmp = new HashMap<>();
for (int state : map.keySet()) {
long zeroTrans = tmp.getOrDefault(A.get(state), 0L) + map.get(state) % MODULO;
long oneTrans = tmp.getOrDefault(B.get(state), 0L) + map.get(state) % MODULO;
tmp.put(A.get(state), zeroTrans);
tmp.put(B.get(state), oneTrans);
}
map = tmp;
E--;
}
long total = 0;
for (int state : C) {
total = (total + map.getOrDefault(state, 0L)) % MODULO;
}
return (int) total;
}
}
| 3,768 | 0.6584 | 0.6344 | 103 | 35.39806 | 82.148849 | 784 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.660194 | false | false |
12
|
22d5a8698dd07bcb5b6b92ace8d59424662dafcd
| 24,919,400,309,766 |
4be57d270257556e8403c2123df76d82700a5bb4
|
/app/src/main/java/com/example/projectandroid/ui/systemManager/FixClientActivity.java
|
6dbf9f53c91a731786de2c0fa884151811361209
|
[] |
no_license
|
lehongphong08648/qlp-khasan
|
https://github.com/lehongphong08648/qlp-khasan
|
3f55c8075c38d10c3722cca10ca37b71c415f7d2
|
d097ccb35f7a09d1bd2ed709199d26f6ede11716
|
refs/heads/master
| 2022-06-14T11:38:31.300000 | 2020-05-07T11:35:57 | 2020-05-07T11:35:57 | 246,955,148 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.projectandroid.ui.systemManager;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatSpinner;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.Toast;
import com.example.projectandroid.R;
import com.example.projectandroid.model.Client;
import com.example.projectandroid.model.QuocTich;
import com.example.projectandroid.model.Rooms;
import com.example.projectandroid.repository.ClientRepo;
import com.example.projectandroid.repository.RoomRepo;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
public class FixClientActivity extends AppCompatActivity {
EditText edt_fix_nameClient, edt_fix_idCard, edt_fix_location, edt_fix_sdt, edt_fix_ngaySinh, edt_fix_vip, edt_fix_email;
AppCompatSpinner sp_fix_quocTich_client;
Button btn_fix_client, btn_cancel_fix_client;
List<QuocTich> listQuocTich;
String idClient;
Client client;
ClientRepo clientRepo;
Date date;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fix_client);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
edt_fix_nameClient = findViewById(R.id.edt_fix_nameClient);
edt_fix_idCard = findViewById(R.id.edt_fix_idCard);
edt_fix_location = findViewById(R.id.edt_fix_location);
edt_fix_sdt = findViewById(R.id.edt_fix_sdt);
edt_fix_ngaySinh = findViewById(R.id.edt_fix_ngaySinh);
edt_fix_vip = findViewById(R.id.edt_fix_vip);
edt_fix_email = findViewById(R.id.edt_fix_email);
btn_fix_client = findViewById(R.id.btn_fix_client);
btn_cancel_fix_client = findViewById(R.id.btn_cancel_fix_client);
sp_fix_quocTich_client = findViewById(R.id.sp_fix_quocTich_client);
showQuocTich();
edt_fix_ngaySinh.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showDateDialog(edt_fix_ngaySinh);
}
});
Intent intent = getIntent();
Bundle bundle = intent.getExtras();
edt_fix_nameClient.setText(bundle.getString("nameClient"));
edt_fix_idCard.setText(bundle.getString("idCard"));
edt_fix_location.setText(bundle.getString("Address"));
edt_fix_sdt.setText(bundle.getString("PhoneNumber"));
edt_fix_ngaySinh.setText(bundle.getString("ns"));
edt_fix_vip.setText(bundle.getString("vip"));
edt_fix_email.setText(bundle.getString("Email"));
idClient = bundle.getString("Id");
}
public void showQuocTich(){
//set spiner quốc tịch
listQuocTich = new ArrayList<>();
QuocTich quocTich = new QuocTich("Việt Nam");
QuocTich quocTich1 = new QuocTich("Úc");
QuocTich quocTich2 = new QuocTich("Anh Quốc");
QuocTich quocTich3 = new QuocTich("Mỹ");
QuocTich quocTich4 = new QuocTich("Thái Lan");
QuocTich quocTich5 = new QuocTich("Trung Quốc");
QuocTich quocTich6 = new QuocTich("Nga");
QuocTich quocTich7 = new QuocTich("Nhật Bản");
QuocTich quocTich8 = new QuocTich("Hàn Quốc");
QuocTich quocTich9 = new QuocTich("khác");
listQuocTich.add(quocTich);listQuocTich.add(quocTich1);listQuocTich.add(quocTich2);
listQuocTich.add(quocTich3);listQuocTich.add(quocTich4);listQuocTich.add(quocTich5);
listQuocTich.add(quocTich6);listQuocTich.add(quocTich7);listQuocTich.add(quocTich8);listQuocTich.add(quocTich9);
ArrayAdapter<QuocTich> kindOfRoomArrayAdapter = new ArrayAdapter<>(FixClientActivity.this,android.R.layout.simple_spinner_item,listQuocTich);
kindOfRoomArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sp_fix_quocTich_client.setAdapter(kindOfRoomArrayAdapter);
}
private void showDateDialog(final EditText edt_date){
final Calendar calendar = Calendar.getInstance();
DatePickerDialog.OnDateSetListener onDateSetListener = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
calendar.set(Calendar.YEAR,year);
calendar.set(Calendar.MONTH,month);
calendar.set(Calendar.DAY_OF_MONTH,dayOfMonth);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MM-yyyy ");
edt_date.setText(simpleDateFormat.format(calendar.getTime()));
}
};
new DatePickerDialog(FixClientActivity.this,onDateSetListener,calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH),calendar.get(Calendar.DAY_OF_MONTH)).show();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.delete,menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
if (id == R.id.delete){
String nameClient = edt_fix_nameClient.getText().toString();
String idCard = edt_fix_idCard.getText().toString();
String location = edt_fix_location.getText().toString();
String sdt = edt_fix_sdt.getText().toString();
String ngaySinh = edt_fix_ngaySinh.getText().toString();
String vip = edt_fix_vip.getText().toString();
String email = edt_fix_email.getText().toString();
QuocTich mQuocTich = (QuocTich) sp_fix_quocTich_client.getSelectedItem();
String quocTich = mQuocTich.getQuocTich();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MM-yyyy");
try {
date = simpleDateFormat.parse(ngaySinh);
} catch (ParseException e) {
e.printStackTrace();
}
clientRepo = new ClientRepo(FixClientActivity.this);
client = new Client(nameClient,idCard,quocTich,location,Integer.parseInt(sdt),Integer.parseInt(vip),date,email);
client.setId(Integer.parseInt(idClient));
clientRepo.delete(client);
startActivity(new Intent(FixClientActivity.this,ClientActivity.class));
Toast.makeText(FixClientActivity.this,"Đã xóa",Toast.LENGTH_SHORT).show();
}
return super.onOptionsItemSelected(item);
}
}
|
UTF-8
|
Java
| 6,990 |
java
|
FixClientActivity.java
|
Java
|
[] | null |
[] |
package com.example.projectandroid.ui.systemManager;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatSpinner;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.Toast;
import com.example.projectandroid.R;
import com.example.projectandroid.model.Client;
import com.example.projectandroid.model.QuocTich;
import com.example.projectandroid.model.Rooms;
import com.example.projectandroid.repository.ClientRepo;
import com.example.projectandroid.repository.RoomRepo;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
public class FixClientActivity extends AppCompatActivity {
EditText edt_fix_nameClient, edt_fix_idCard, edt_fix_location, edt_fix_sdt, edt_fix_ngaySinh, edt_fix_vip, edt_fix_email;
AppCompatSpinner sp_fix_quocTich_client;
Button btn_fix_client, btn_cancel_fix_client;
List<QuocTich> listQuocTich;
String idClient;
Client client;
ClientRepo clientRepo;
Date date;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fix_client);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
edt_fix_nameClient = findViewById(R.id.edt_fix_nameClient);
edt_fix_idCard = findViewById(R.id.edt_fix_idCard);
edt_fix_location = findViewById(R.id.edt_fix_location);
edt_fix_sdt = findViewById(R.id.edt_fix_sdt);
edt_fix_ngaySinh = findViewById(R.id.edt_fix_ngaySinh);
edt_fix_vip = findViewById(R.id.edt_fix_vip);
edt_fix_email = findViewById(R.id.edt_fix_email);
btn_fix_client = findViewById(R.id.btn_fix_client);
btn_cancel_fix_client = findViewById(R.id.btn_cancel_fix_client);
sp_fix_quocTich_client = findViewById(R.id.sp_fix_quocTich_client);
showQuocTich();
edt_fix_ngaySinh.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showDateDialog(edt_fix_ngaySinh);
}
});
Intent intent = getIntent();
Bundle bundle = intent.getExtras();
edt_fix_nameClient.setText(bundle.getString("nameClient"));
edt_fix_idCard.setText(bundle.getString("idCard"));
edt_fix_location.setText(bundle.getString("Address"));
edt_fix_sdt.setText(bundle.getString("PhoneNumber"));
edt_fix_ngaySinh.setText(bundle.getString("ns"));
edt_fix_vip.setText(bundle.getString("vip"));
edt_fix_email.setText(bundle.getString("Email"));
idClient = bundle.getString("Id");
}
public void showQuocTich(){
//set spiner quốc tịch
listQuocTich = new ArrayList<>();
QuocTich quocTich = new QuocTich("Việt Nam");
QuocTich quocTich1 = new QuocTich("Úc");
QuocTich quocTich2 = new QuocTich("Anh Quốc");
QuocTich quocTich3 = new QuocTich("Mỹ");
QuocTich quocTich4 = new QuocTich("Thái Lan");
QuocTich quocTich5 = new QuocTich("Trung Quốc");
QuocTich quocTich6 = new QuocTich("Nga");
QuocTich quocTich7 = new QuocTich("Nhật Bản");
QuocTich quocTich8 = new QuocTich("Hàn Quốc");
QuocTich quocTich9 = new QuocTich("khác");
listQuocTich.add(quocTich);listQuocTich.add(quocTich1);listQuocTich.add(quocTich2);
listQuocTich.add(quocTich3);listQuocTich.add(quocTich4);listQuocTich.add(quocTich5);
listQuocTich.add(quocTich6);listQuocTich.add(quocTich7);listQuocTich.add(quocTich8);listQuocTich.add(quocTich9);
ArrayAdapter<QuocTich> kindOfRoomArrayAdapter = new ArrayAdapter<>(FixClientActivity.this,android.R.layout.simple_spinner_item,listQuocTich);
kindOfRoomArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sp_fix_quocTich_client.setAdapter(kindOfRoomArrayAdapter);
}
private void showDateDialog(final EditText edt_date){
final Calendar calendar = Calendar.getInstance();
DatePickerDialog.OnDateSetListener onDateSetListener = new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
calendar.set(Calendar.YEAR,year);
calendar.set(Calendar.MONTH,month);
calendar.set(Calendar.DAY_OF_MONTH,dayOfMonth);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MM-yyyy ");
edt_date.setText(simpleDateFormat.format(calendar.getTime()));
}
};
new DatePickerDialog(FixClientActivity.this,onDateSetListener,calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH),calendar.get(Calendar.DAY_OF_MONTH)).show();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.delete,menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
if (id == R.id.delete){
String nameClient = edt_fix_nameClient.getText().toString();
String idCard = edt_fix_idCard.getText().toString();
String location = edt_fix_location.getText().toString();
String sdt = edt_fix_sdt.getText().toString();
String ngaySinh = edt_fix_ngaySinh.getText().toString();
String vip = edt_fix_vip.getText().toString();
String email = edt_fix_email.getText().toString();
QuocTich mQuocTich = (QuocTich) sp_fix_quocTich_client.getSelectedItem();
String quocTich = mQuocTich.getQuocTich();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd-MM-yyyy");
try {
date = simpleDateFormat.parse(ngaySinh);
} catch (ParseException e) {
e.printStackTrace();
}
clientRepo = new ClientRepo(FixClientActivity.this);
client = new Client(nameClient,idCard,quocTich,location,Integer.parseInt(sdt),Integer.parseInt(vip),date,email);
client.setId(Integer.parseInt(idClient));
clientRepo.delete(client);
startActivity(new Intent(FixClientActivity.this,ClientActivity.class));
Toast.makeText(FixClientActivity.this,"Đã xóa",Toast.LENGTH_SHORT).show();
}
return super.onOptionsItemSelected(item);
}
}
| 6,990 | 0.687868 | 0.685284 | 158 | 43.082279 | 30.666018 | 171 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.93038 | false | false |
12
|
2e8f2bafd72dec04a5b0c30f2cb0b9f706b6c74d
| 22,608,707,864,172 |
d16f17f3b9d0aa12c240d01902a41adba20fad12
|
/src/leetcode/leetcode13xx/leetcode1312/Solution.java
|
202afaa2310e3ee022ab04b2e9d8f705b9d149bf
|
[] |
no_license
|
redsun9/leetcode
|
https://github.com/redsun9/leetcode
|
79f9293b88723d2fd123d9e10977b685d19b2505
|
67d6c16a1b4098277af458849d352b47410518ee
|
refs/heads/master
| 2023-06-23T19:37:42.719000 | 2023-06-09T21:11:39 | 2023-06-09T21:11:39 | 242,967,296 | 38 | 3 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package leetcode.leetcode13xx.leetcode1312;
public class Solution {
public int minInsertions(String s) {
int n = s.length();
char[] a = s.toCharArray();
int[] prev = new int[n + 1], next = new int[n + 1], tmp;
for (int l = 0; l < n; l++) {
for (int i = 0, r = n - 1; i < n; i++, r--)
next[i + 1] = a[l] == a[r] ? prev[i] + 1 : Math.max(prev[i + 1], next[i]);
tmp = prev;
prev = next;
next = tmp;
}
return n - prev[n];
}
}
|
UTF-8
|
Java
| 544 |
java
|
Solution.java
|
Java
|
[] | null |
[] |
package leetcode.leetcode13xx.leetcode1312;
public class Solution {
public int minInsertions(String s) {
int n = s.length();
char[] a = s.toCharArray();
int[] prev = new int[n + 1], next = new int[n + 1], tmp;
for (int l = 0; l < n; l++) {
for (int i = 0, r = n - 1; i < n; i++, r--)
next[i + 1] = a[l] == a[r] ? prev[i] + 1 : Math.max(prev[i + 1], next[i]);
tmp = prev;
prev = next;
next = tmp;
}
return n - prev[n];
}
}
| 544 | 0.439338 | 0.413603 | 18 | 29.222221 | 23.11939 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
12
|
e68e1a780bbb94ab45d1d45abef1a879e4c54265
| 13,520,557,110,044 |
ad6434dc113e22e64f0709c95099babe6b2cc854
|
/src/SuperUglyNumber/SuperUglyNumber.java
|
1c88661559a14b3652a97e91b85c18aa824abff6
|
[] |
no_license
|
shiyanch/Leetcode_Java
|
https://github.com/shiyanch/Leetcode_Java
|
f8b7807fbbc0174d45127b65b7b48d836887983c
|
20df421f44b1907af6528578baf53efddfee48b1
|
refs/heads/master
| 2023-05-28T00:40:30.569000 | 2023-05-17T03:51:34 | 2023-05-17T03:51:34 | 48,945,641 | 9 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package SuperUglyNumber;
import java.util.PriorityQueue;
/**
* 313. Super Ugly Number
*
* Write a program to find the nth super ugly number.
* Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k.
* For example, [1, 2, 4, 7, 8, 13, 14, 16, 19, 26, 28, 32] is the sequence
* of the first 12 super ugly numbers given primes = [2, 7, 13, 19] of size 4.
*
* Note:
* (1) 1 is a super ugly number for any given primes.
* (2) The given numbers in primes are in ascending order.
* (3) 0 < k ≤ 100, 0 < n ≤ 106, 0 < primes[i] < 1000.
*/
public class SuperUglyNumber {
public int nthSuperUglyNumber(int n, int[] primes) {
int len = primes.length;
int[] index = new int[len];
int[] ugly = new int[n];
ugly[0] = 1;
for(int i=1;i<n;i++) {
int min = Integer.MAX_VALUE;
for(int j=0;j<len;j++) {
min = Math.min(min, ugly[index[j]]*primes[j]);
}
ugly[i] = min;
for(int j=0;j<len;j++)
if(ugly[i] % primes[j] == 0)
index[j]++;
}
return ugly[n-1];
}
public int nthSuperUglyNumber2(int n, int[] primes) {
if(n == 1)
return 1;
PriorityQueue<Long> pq = new PriorityQueue<>();
pq.add(1l);
for(int i=1;i<n;i++) {
long temp = pq.poll();
while(!pq.isEmpty() && temp == pq.peek())
pq.poll();
for(int prime:primes) {
pq.add(temp * prime);
}
}
return pq.poll().intValue();
}
}
|
UTF-8
|
Java
| 1,657 |
java
|
SuperUglyNumber.java
|
Java
|
[] | null |
[] |
package SuperUglyNumber;
import java.util.PriorityQueue;
/**
* 313. Super Ugly Number
*
* Write a program to find the nth super ugly number.
* Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k.
* For example, [1, 2, 4, 7, 8, 13, 14, 16, 19, 26, 28, 32] is the sequence
* of the first 12 super ugly numbers given primes = [2, 7, 13, 19] of size 4.
*
* Note:
* (1) 1 is a super ugly number for any given primes.
* (2) The given numbers in primes are in ascending order.
* (3) 0 < k ≤ 100, 0 < n ≤ 106, 0 < primes[i] < 1000.
*/
public class SuperUglyNumber {
public int nthSuperUglyNumber(int n, int[] primes) {
int len = primes.length;
int[] index = new int[len];
int[] ugly = new int[n];
ugly[0] = 1;
for(int i=1;i<n;i++) {
int min = Integer.MAX_VALUE;
for(int j=0;j<len;j++) {
min = Math.min(min, ugly[index[j]]*primes[j]);
}
ugly[i] = min;
for(int j=0;j<len;j++)
if(ugly[i] % primes[j] == 0)
index[j]++;
}
return ugly[n-1];
}
public int nthSuperUglyNumber2(int n, int[] primes) {
if(n == 1)
return 1;
PriorityQueue<Long> pq = new PriorityQueue<>();
pq.add(1l);
for(int i=1;i<n;i++) {
long temp = pq.poll();
while(!pq.isEmpty() && temp == pq.peek())
pq.poll();
for(int prime:primes) {
pq.add(temp * prime);
}
}
return pq.poll().intValue();
}
}
| 1,657 | 0.512402 | 0.476104 | 63 | 25.238094 | 24.023609 | 112 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.730159 | false | false |
12
|
cec159cca0fd1422a9298c170cede7530cb8a249
| 32,091,995,667,644 |
c4531dbdeb8bbe7471d99aa3bc20ce2512186554
|
/Version 1.5/soaint-toolbox-services/src/main/java/co/com/soaint/toolbox/portal/services/web/api/rest/role/v1/impl/RoleSoadocApiImp.java
|
9138cd8caae5ca8dff7adc208884f918962b60e7
|
[] |
no_license
|
yodavidgutierrez/soa-toolbox
|
https://github.com/yodavidgutierrez/soa-toolbox
|
64dce8bbf256c913c575b80d9e1f1f6fe607a01e
|
0a2e7282aff5b7d45de578c909b9b48119def1be
|
refs/heads/master
| 2023-02-03T11:50:27.989000 | 2019-10-09T13:33:19 | 2019-10-09T13:33:19 | 213,926,635 | 0 | 0 | null | false | 2023-01-24T00:43:29 | 2019-10-09T13:30:21 | 2019-10-09T13:34:12 | 2023-01-24T00:43:28 | 7,476 | 0 | 0 | 36 |
CSS
| false | false |
package co.com.soaint.toolbox.portal.services.web.api.rest.role.v1.impl;
import co.com.soaint.toolbox.portal.services.adapter.specific.api.module.firstapi.CorrespondenciaApiCliente;
import co.com.soaint.toolbox.portal.services.adapter.specific.api.module.firstapi.FuncionarioApiCliente;
import co.com.soaint.toolbox.portal.services.adapter.specific.domain.FuncionarioDTO;
import co.com.soaint.toolbox.portal.services.commons.constants.api.role.EndpointRoleApi;
import co.com.soaint.toolbox.portal.services.commons.domains.generic.RoleDTO;
import co.com.soaint.toolbox.portal.services.commons.domains.generic.UserDTO;
import co.com.soaint.toolbox.portal.services.commons.enums.TransactionState;
import co.com.soaint.toolbox.portal.services.web.api.rest.role.v1.RoleApi;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
@Log4j2
@RestController
@RequestMapping(value = EndpointRoleApi.ROLE_API)
@CrossOrigin(origins = "*", methods = {RequestMethod.DELETE, RequestMethod.GET, RequestMethod.POST, RequestMethod.PUT})
public class RoleSoadocApiImp implements RoleApi {
final private CorrespondenciaApiCliente correspondenciaApiCliente;
@Value("${roles.soadoc}")
public String ROL_SOADOC;
@Value("${roles.digitalizacion}")
public String ROL_DIGITALIZACION;
@Value("${roles.kpi}")
public String ROL_KPI;
@Value("${roles.toolbox}")
public String ROL_TOOLBOX;
@Value("${roles.gaf}")
public String ROL_GAF;
@Value("${roles.instrumentos}")
public String ROL_INSTRUMENTOS;
@Autowired
public RoleSoadocApiImp(CorrespondenciaApiCliente correspondenciaApiCliente) {
this.correspondenciaApiCliente = correspondenciaApiCliente;
}
@GetMapping(EndpointRoleApi.FIND_USERS_BY_ROLE)
public Object findUsersByRole(@PathVariable("id_role") final String id, HttpServletRequest request) {
log.info("Buscando Users por id de Rol: " + id);
List<UserDTO> userDTO = correspondenciaApiCliente.listarFuncionarioByRol(id);
return userDTO;
}
@GetMapping(EndpointRoleApi.LISTA_ROLES_BY_APPLICATION)
public List<RoleDTO> ListaRoleByApplication(@PathVariable("id_app") final String id, HttpServletRequest request){
log.info("listar role por id: " + id);
String roles ="";
switch (id){
case "1":
roles = ROL_SOADOC;
break;
case "2":
roles = ROL_DIGITALIZACION;
break;
case "3":
roles = ROL_KPI;
break;
case "4":
roles = ROL_TOOLBOX;
break;
case "5":
roles = ROL_GAF;
break;
case "6":
roles = ROL_INSTRUMENTOS;
break;
}
List<RoleDTO> lista = new ArrayList<>();
if(!StringUtils.isEmpty(roles))
for(String role: roles.split(",")){
lista.add(RoleDTO.builder()
.name(role)
.idApplication(id)
.build());
}
return lista;
}
}
|
UTF-8
|
Java
| 3,603 |
java
|
RoleSoadocApiImp.java
|
Java
|
[] | null |
[] |
package co.com.soaint.toolbox.portal.services.web.api.rest.role.v1.impl;
import co.com.soaint.toolbox.portal.services.adapter.specific.api.module.firstapi.CorrespondenciaApiCliente;
import co.com.soaint.toolbox.portal.services.adapter.specific.api.module.firstapi.FuncionarioApiCliente;
import co.com.soaint.toolbox.portal.services.adapter.specific.domain.FuncionarioDTO;
import co.com.soaint.toolbox.portal.services.commons.constants.api.role.EndpointRoleApi;
import co.com.soaint.toolbox.portal.services.commons.domains.generic.RoleDTO;
import co.com.soaint.toolbox.portal.services.commons.domains.generic.UserDTO;
import co.com.soaint.toolbox.portal.services.commons.enums.TransactionState;
import co.com.soaint.toolbox.portal.services.web.api.rest.role.v1.RoleApi;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
@Log4j2
@RestController
@RequestMapping(value = EndpointRoleApi.ROLE_API)
@CrossOrigin(origins = "*", methods = {RequestMethod.DELETE, RequestMethod.GET, RequestMethod.POST, RequestMethod.PUT})
public class RoleSoadocApiImp implements RoleApi {
final private CorrespondenciaApiCliente correspondenciaApiCliente;
@Value("${roles.soadoc}")
public String ROL_SOADOC;
@Value("${roles.digitalizacion}")
public String ROL_DIGITALIZACION;
@Value("${roles.kpi}")
public String ROL_KPI;
@Value("${roles.toolbox}")
public String ROL_TOOLBOX;
@Value("${roles.gaf}")
public String ROL_GAF;
@Value("${roles.instrumentos}")
public String ROL_INSTRUMENTOS;
@Autowired
public RoleSoadocApiImp(CorrespondenciaApiCliente correspondenciaApiCliente) {
this.correspondenciaApiCliente = correspondenciaApiCliente;
}
@GetMapping(EndpointRoleApi.FIND_USERS_BY_ROLE)
public Object findUsersByRole(@PathVariable("id_role") final String id, HttpServletRequest request) {
log.info("Buscando Users por id de Rol: " + id);
List<UserDTO> userDTO = correspondenciaApiCliente.listarFuncionarioByRol(id);
return userDTO;
}
@GetMapping(EndpointRoleApi.LISTA_ROLES_BY_APPLICATION)
public List<RoleDTO> ListaRoleByApplication(@PathVariable("id_app") final String id, HttpServletRequest request){
log.info("listar role por id: " + id);
String roles ="";
switch (id){
case "1":
roles = ROL_SOADOC;
break;
case "2":
roles = ROL_DIGITALIZACION;
break;
case "3":
roles = ROL_KPI;
break;
case "4":
roles = ROL_TOOLBOX;
break;
case "5":
roles = ROL_GAF;
break;
case "6":
roles = ROL_INSTRUMENTOS;
break;
}
List<RoleDTO> lista = new ArrayList<>();
if(!StringUtils.isEmpty(roles))
for(String role: roles.split(",")){
lista.add(RoleDTO.builder()
.name(role)
.idApplication(id)
.build());
}
return lista;
}
}
| 3,603 | 0.679156 | 0.675548 | 101 | 34.673267 | 28.695433 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.564356 | false | false |
12
|
5cff35c472b467b801ffb30db4f519bddda3e5d4
| 20,100,446,970,659 |
6e34b995d8a7da28712e6e46976c8f2201a33a7c
|
/simulator/src/main/java/viewer/MarioLevelViewer.java
|
3b5ce62e44156f0ef9583bb0ade1e8639b7026da
|
[
"MIT"
] |
permissive
|
LukeZeller/SMBPCG
|
https://github.com/LukeZeller/SMBPCG
|
023b70ef938633e39aa5358f4bade11ab20450b0
|
2f6034073c3215c3a4fc51c4cf5400ab71205973
|
refs/heads/master
| 2023-03-11T03:48:01.599000 | 2019-07-30T09:13:12 | 2019-07-30T09:13:12 | 186,933,870 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package viewer;
import static reader.JsonReader.JsonToDoubleArray;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.imageio.ImageIO;
import ch.idsia.ai.tasks.ProgressTask;
import ch.idsia.mario.engine.LevelRenderer;
import ch.idsia.mario.engine.level.Level;
import ch.idsia.mario.engine.level.LevelParser;
import ch.idsia.tools.CmdLineOptions;
import ch.idsia.tools.EvaluationOptions;
import reader.JsonReader;
/**
* This file allows you to generate a level image for any latent vector
* or your choice. The vector must have a length of 32 numbers separated
* by commas enclosed in square brackets [ ]. For example,
* [0.9881835842209917, -0.9986077315374948, 0.9995512051242508, 0.9998643432807639, -0.9976165917284504, -0.9995247114230822, -0.9997001909358728, 0.9995694511739592, -0.9431036754879115, 0.9998155541290887, 0.9997863689962382, -0.8761392912669269, -0.999843833016589, 0.9993230720045649, 0.9995470247917402, -0.9998847606084427, -0.9998322053148382, 0.9997707200294411, -0.9998905141832997, -0.9999512510490688, -0.9533512808031753, 0.9997703088007039, -0.9992229823819915, 0.9953917828622341, 0.9973473366437476, 0.9943030781608361, 0.9995290290713732, -0.9994945079679955, 0.9997109900652238, -0.9988379572928884, 0.9995070647543864, 0.9994132207570211]
*
*/
public class MarioLevelViewer {
public static final int BLOCK_SIZE = 16;
public static final int LEVEL_HEIGHT = 14;
/**
* Return an image of the level, excluding
* the background, Mario, and enemy sprites.
* @param level
* @return
*/
public static BufferedImage getLevelImage(Level level, boolean excludeBufferRegion) {
EvaluationOptions options = new CmdLineOptions(new String[0]);
ProgressTask task = new ProgressTask(options);
// Added to change level
options.setLevel(level);
task.setOptions(options);
int relevantWidth = (level.width - (excludeBufferRegion ? 2*LevelParser.BUFFER_WIDTH : 0)) * BLOCK_SIZE;
BufferedImage image = new BufferedImage(relevantWidth, LEVEL_HEIGHT*BLOCK_SIZE, BufferedImage.TYPE_INT_RGB);
// Skips buffer zones at start and end of level
LevelRenderer.renderArea((Graphics2D) image.getGraphics(), level, 0, 0, excludeBufferRegion ? LevelParser.BUFFER_WIDTH*BLOCK_SIZE : 0, 0, relevantWidth, LEVEL_HEIGHT*BLOCK_SIZE);
return image;
}
/**
* Save level as an image
* @param level Mario Level
* @param name Filename, not including jpg extension
* @param clipBuffer Whether to exclude the buffer region we add to all levels
* @throws IOException
*/
public static void saveLevel(Level level, String name, boolean clipBuffer) throws IOException {
BufferedImage image = getLevelImage(level, clipBuffer);
File file = new File(name + ".jpg");
ImageIO.write(image, "jpg", file);
}
}
|
UTF-8
|
Java
| 3,023 |
java
|
MarioLevelViewer.java
|
Java
|
[] | null |
[] |
package viewer;
import static reader.JsonReader.JsonToDoubleArray;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.imageio.ImageIO;
import ch.idsia.ai.tasks.ProgressTask;
import ch.idsia.mario.engine.LevelRenderer;
import ch.idsia.mario.engine.level.Level;
import ch.idsia.mario.engine.level.LevelParser;
import ch.idsia.tools.CmdLineOptions;
import ch.idsia.tools.EvaluationOptions;
import reader.JsonReader;
/**
* This file allows you to generate a level image for any latent vector
* or your choice. The vector must have a length of 32 numbers separated
* by commas enclosed in square brackets [ ]. For example,
* [0.9881835842209917, -0.9986077315374948, 0.9995512051242508, 0.9998643432807639, -0.9976165917284504, -0.9995247114230822, -0.9997001909358728, 0.9995694511739592, -0.9431036754879115, 0.9998155541290887, 0.9997863689962382, -0.8761392912669269, -0.999843833016589, 0.9993230720045649, 0.9995470247917402, -0.9998847606084427, -0.9998322053148382, 0.9997707200294411, -0.9998905141832997, -0.9999512510490688, -0.9533512808031753, 0.9997703088007039, -0.9992229823819915, 0.9953917828622341, 0.9973473366437476, 0.9943030781608361, 0.9995290290713732, -0.9994945079679955, 0.9997109900652238, -0.9988379572928884, 0.9995070647543864, 0.9994132207570211]
*
*/
public class MarioLevelViewer {
public static final int BLOCK_SIZE = 16;
public static final int LEVEL_HEIGHT = 14;
/**
* Return an image of the level, excluding
* the background, Mario, and enemy sprites.
* @param level
* @return
*/
public static BufferedImage getLevelImage(Level level, boolean excludeBufferRegion) {
EvaluationOptions options = new CmdLineOptions(new String[0]);
ProgressTask task = new ProgressTask(options);
// Added to change level
options.setLevel(level);
task.setOptions(options);
int relevantWidth = (level.width - (excludeBufferRegion ? 2*LevelParser.BUFFER_WIDTH : 0)) * BLOCK_SIZE;
BufferedImage image = new BufferedImage(relevantWidth, LEVEL_HEIGHT*BLOCK_SIZE, BufferedImage.TYPE_INT_RGB);
// Skips buffer zones at start and end of level
LevelRenderer.renderArea((Graphics2D) image.getGraphics(), level, 0, 0, excludeBufferRegion ? LevelParser.BUFFER_WIDTH*BLOCK_SIZE : 0, 0, relevantWidth, LEVEL_HEIGHT*BLOCK_SIZE);
return image;
}
/**
* Save level as an image
* @param level Mario Level
* @param name Filename, not including jpg extension
* @param clipBuffer Whether to exclude the buffer region we add to all levels
* @throws IOException
*/
public static void saveLevel(Level level, String name, boolean clipBuffer) throws IOException {
BufferedImage image = getLevelImage(level, clipBuffer);
File file = new File(name + ".jpg");
ImageIO.write(image, "jpg", file);
}
}
| 3,023 | 0.736024 | 0.551439 | 67 | 44.134327 | 82.544403 | 657 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.19403 | false | false |
12
|
dbafa75ea50f613029369f0f13c10e9ae0f7094c
| 23,141,283,818,574 |
cf4ceab353bf7cfe3edb1c355d0ba44a4623b674
|
/Client/Desktop/src/main/java/com/example/tin/dto/RejectAccountsRequest.java
|
cfee12c3b0ea06ccc0d3bd35a67cc662ef1d3026
|
[] |
no_license
|
kacperwnuk/Consultation_manager__team_work
|
https://github.com/kacperwnuk/Consultation_manager__team_work
|
163ee0b0d705c6feaea0e7a038bb59f304ba9b5a
|
e2eafd97e83810f62816335f1ccc01e4c5cc8a6c
|
refs/heads/master
| 2023-04-29T19:05:09.075000 | 2019-06-02T21:22:48 | 2019-06-02T21:22:48 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.tin.dto;
import com.example.tin.entity.Login;
import java.util.ArrayList;
import java.util.List;
public class RejectAccountsRequest {
String type = "RejectAccountsRequest";
List<Login> logins = new ArrayList<>();
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List<Login> getLogins() {
return logins;
}
public void setLogins(List<Login> logins) {
this.logins = logins;
}
}
|
UTF-8
|
Java
| 585 |
java
|
RejectAccountsRequest.java
|
Java
|
[] | null |
[] |
package com.example.tin.dto;
import com.example.tin.entity.Login;
import java.util.ArrayList;
import java.util.List;
public class RejectAccountsRequest {
String type = "RejectAccountsRequest";
List<Login> logins = new ArrayList<>();
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List<Login> getLogins() {
return logins;
}
public void setLogins(List<Login> logins) {
this.logins = logins;
}
}
| 585 | 0.577778 | 0.577778 | 27 | 20.629629 | 17.196356 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.37037 | false | false |
12
|
44f2c30235ab43794cfa7845564966f76703ca49
| 25,494,925,908,091 |
d0c8d9cd3675df3daa345ed3473fc5e8631f985e
|
/app/src/main/java/qorda_projects/tracktive/DeleteDataDialogFragment.java
|
01fbd4293e56ca253ed6b66c28db559c48ae9cf6
|
[] |
no_license
|
SolviQorda/Capstone-Project
|
https://github.com/SolviQorda/Capstone-Project
|
73115f2c53728605ff56e0f2506a9e18a676cad0
|
a1cd749d473412ffa8c27e199d4b723084355127
|
refs/heads/master
| 2021-01-13T12:17:51.733000 | 2017-03-02T09:13:42 | 2017-03-02T09:13:42 | 78,221,294 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package qorda_projects.tracktive;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.DialogFragment;
import qorda_projects.tracktive.data.CardsContract;
/**
* Created by sorengoard on 25/02/2017.
*/
public class DeleteDataDialogFragment extends DialogFragment {
private final String DELETE_TAG = "delete_cards_dialog";
private final String DELETE_STRING = "delete_all";
public interface deleteDialogListener {
void recreateActivityAfterDeleteCall();
}
private deleteDialogListener mDeleteListener;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
//verify that host activity implements the callback interface
try {
//instantiate the listener so that we can send events to the host
mDeleteListener = (deleteDialogListener) activity;
} catch (ClassCastException e) {
// if this happens the activity doesn't implement the interface so throw an exception
throw new ClassCastException(activity.toString() + " must implement deleteDialogListener");
}
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(getString(R.string.delete_confirmation))
.setPositiveButton(getString(R.string.delete), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
getActivity().getContentResolver().delete(CardsContract.CardEntry.CONTENT_URI, null, null);
// clear sharedPrefs
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
SharedPreferences.Editor editor = prefs.edit();
editor.clear().commit();
mDeleteListener.recreateActivityAfterDeleteCall();
}
})
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
});
return builder.create();
}
}
|
UTF-8
|
Java
| 2,565 |
java
|
DeleteDataDialogFragment.java
|
Java
|
[
{
"context": "s.tracktive.data.CardsContract;\n\n/**\n * Created by sorengoard on 25/02/2017.\n */\n\npublic class DeleteDataDialog",
"end": 405,
"score": 0.9996389150619507,
"start": 395,
"tag": "USERNAME",
"value": "sorengoard"
}
] | null |
[] |
package qorda_projects.tracktive;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.DialogFragment;
import qorda_projects.tracktive.data.CardsContract;
/**
* Created by sorengoard on 25/02/2017.
*/
public class DeleteDataDialogFragment extends DialogFragment {
private final String DELETE_TAG = "delete_cards_dialog";
private final String DELETE_STRING = "delete_all";
public interface deleteDialogListener {
void recreateActivityAfterDeleteCall();
}
private deleteDialogListener mDeleteListener;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
//verify that host activity implements the callback interface
try {
//instantiate the listener so that we can send events to the host
mDeleteListener = (deleteDialogListener) activity;
} catch (ClassCastException e) {
// if this happens the activity doesn't implement the interface so throw an exception
throw new ClassCastException(activity.toString() + " must implement deleteDialogListener");
}
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage(getString(R.string.delete_confirmation))
.setPositiveButton(getString(R.string.delete), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
getActivity().getContentResolver().delete(CardsContract.CardEntry.CONTENT_URI, null, null);
// clear sharedPrefs
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
SharedPreferences.Editor editor = prefs.edit();
editor.clear().commit();
mDeleteListener.recreateActivityAfterDeleteCall();
}
})
.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
});
return builder.create();
}
}
| 2,565 | 0.660819 | 0.65731 | 70 | 35.642857 | 32.457901 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.442857 | false | false |
12
|
4ac880ca95069e18a75060760f9a807ed45e6a52
| 8,246,337,242,974 |
82ebfdfda42972544b156ddaffce7f9ecabb1423
|
/smartcacherxjava2calladapter/src/main/java/com/tizisolutions/smartcacherxjava2calladapter/CachedResult.java
|
6de50f76e2f7f94fc2647a426280fd18cfba1cdf
|
[] |
no_license
|
maxoreli/boilerplate-mvp
|
https://github.com/maxoreli/boilerplate-mvp
|
a79e5afbff8e3ab6ddf4756c355a40540d844c73
|
4d0f6636a3acb562d48ac5c802c062767857df1a
|
refs/heads/master
| 2021-01-20T00:37:38.567000 | 2019-03-13T06:42:55 | 2019-03-13T06:42:55 | 89,164,087 | 7 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.tizisolutions.smartcacherxjava2calladapter;
import java.io.IOException;
import java.util.List;
import io.reactivex.ObservableSource;
import io.reactivex.Observer;
import io.reactivex.annotations.Nullable;
import retrofit2.Response;
/**
* The result of executing an HTTP request.
*/
public final class CachedResult<T> implements ObservableSource<CachedResult<T>> {
@SuppressWarnings("ConstantConditions") // Guarding public API nullability.
public static <T> CachedResult<T> error(Throwable error) {
if (error == null) throw new NullPointerException("error == null");
return new CachedResult<>(null, error);
}
@SuppressWarnings("ConstantConditions") // Guarding public API nullability.
public static <T> CachedResult<T> response(Response<T> response) {
if (response == null) throw new NullPointerException("response == null");
return new CachedResult<>(response, null);
}
public static <T> CachedResult<T> response(Response<T> response, boolean cached, boolean cacheExists) {
if (response == null) throw new NullPointerException("response == null");
return new CachedResult<>(response, null, cached, cacheExists);
}
private final @Nullable
Response<T> response;
private final @Nullable
Throwable error;
private @Nullable
Boolean cachedResponse;
private Boolean cacheExists;
private CachedResult(@Nullable Response<T> response, @Nullable Throwable error) {
this.response = response;
this.error = error;
}
private CachedResult(@Nullable Response<T> response, @Nullable Throwable error, Boolean cachedResponse,
Boolean cacheExists) {
this.response = response;
this.error = error;
this.cachedResponse = cachedResponse;
this.cacheExists = cacheExists;
}
/**
* The flag to tells if is cached response or not
*/
public Boolean isCached() {
return cachedResponse;
}
/**
* The flag to tells if is cached response or not
*/
public Boolean isCacheExists() {
return cacheExists;
}
/**
* The response received from executing an HTTP request. Only present when {@link #isError()} is
* false, null otherwise.
*/
public @Nullable
Response<T> response() {
return response;
}
/**
* The error experienced while attempting to execute an HTTP request. Only present when {@link
* #isError()} is true, null otherwise.
* <p>
* If the error is an {@link IOException} then there was a problem with the transport to the
* remote server. Any other exception type indicates an unexpected failure and should be
* considered fatal (configuration error, programming error, etc.).
*/
public @Nullable
Throwable error() {
return error;
}
/**
* {@code true} if the request resulted in an error. See {@link #error()} for the cause.
*/
public boolean isError() {
return error != null;
}
@Override
public void subscribe(Observer<? super CachedResult<T>> observer) {
observer.onNext(this);
observer.onComplete();
}
}
|
UTF-8
|
Java
| 2,958 |
java
|
CachedResult.java
|
Java
|
[] | null |
[] |
package com.tizisolutions.smartcacherxjava2calladapter;
import java.io.IOException;
import java.util.List;
import io.reactivex.ObservableSource;
import io.reactivex.Observer;
import io.reactivex.annotations.Nullable;
import retrofit2.Response;
/**
* The result of executing an HTTP request.
*/
public final class CachedResult<T> implements ObservableSource<CachedResult<T>> {
@SuppressWarnings("ConstantConditions") // Guarding public API nullability.
public static <T> CachedResult<T> error(Throwable error) {
if (error == null) throw new NullPointerException("error == null");
return new CachedResult<>(null, error);
}
@SuppressWarnings("ConstantConditions") // Guarding public API nullability.
public static <T> CachedResult<T> response(Response<T> response) {
if (response == null) throw new NullPointerException("response == null");
return new CachedResult<>(response, null);
}
public static <T> CachedResult<T> response(Response<T> response, boolean cached, boolean cacheExists) {
if (response == null) throw new NullPointerException("response == null");
return new CachedResult<>(response, null, cached, cacheExists);
}
private final @Nullable
Response<T> response;
private final @Nullable
Throwable error;
private @Nullable
Boolean cachedResponse;
private Boolean cacheExists;
private CachedResult(@Nullable Response<T> response, @Nullable Throwable error) {
this.response = response;
this.error = error;
}
private CachedResult(@Nullable Response<T> response, @Nullable Throwable error, Boolean cachedResponse,
Boolean cacheExists) {
this.response = response;
this.error = error;
this.cachedResponse = cachedResponse;
this.cacheExists = cacheExists;
}
/**
* The flag to tells if is cached response or not
*/
public Boolean isCached() {
return cachedResponse;
}
/**
* The flag to tells if is cached response or not
*/
public Boolean isCacheExists() {
return cacheExists;
}
/**
* The response received from executing an HTTP request. Only present when {@link #isError()} is
* false, null otherwise.
*/
public @Nullable
Response<T> response() {
return response;
}
/**
* The error experienced while attempting to execute an HTTP request. Only present when {@link
* #isError()} is true, null otherwise.
* <p>
* If the error is an {@link IOException} then there was a problem with the transport to the
* remote server. Any other exception type indicates an unexpected failure and should be
* considered fatal (configuration error, programming error, etc.).
*/
public @Nullable
Throwable error() {
return error;
}
/**
* {@code true} if the request resulted in an error. See {@link #error()} for the cause.
*/
public boolean isError() {
return error != null;
}
@Override
public void subscribe(Observer<? super CachedResult<T>> observer) {
observer.onNext(this);
observer.onComplete();
}
}
| 2,958 | 0.720419 | 0.719743 | 107 | 26.654205 | 29.125929 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.457944 | false | false |
12
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.