blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
1d6082f0bbb6bffc6a686558b0afd3645f048900
6f0d6cbbaac7c85c758bf08586844043b9e2e7af
/src/com/example/sidekick_offline_try2/Fragment3.java
b8120d8a24b01f128ff7ae577290a86c06947ff2
[]
no_license
an0nym0us-Droid/Sidekick_GH
6938330ebf294b1cbba31676d60db0d32a22d0bf
369390bb14f98e18254fc193fc6608ebd1e9b034
refs/heads/master
2020-12-24T16:50:24.155229
2014-04-08T06:31:38
2014-04-08T06:31:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,784
java
package com.example.sidekick_offline_try2; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Date; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ListView; import android.widget.TextView; import com.actionbarsherlock.app.SherlockFragment; import com.actionbarsherlock.app.SherlockFragmentActivity; public class Fragment3 extends SherlockFragment { ArrayList<String> chanListContent; RemRecWatchAdapter chanAdapter; ArrayList<ShowsList> showNameDesc; ListView watchList; @Override public SherlockFragmentActivity getSherlockActivity() { return super.getSherlockActivity(); } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Get the view from fragmenttab3.xml View view = inflater.inflate(R.layout.fragmenttab3, container, false); watchList = (ListView) view.findViewById(R.id.watchlv); TextView noWatch = (TextView) view.findViewById(R.id.noWatch); showNameDesc = MainActivity.datasource.retListItemsForWatchlist(); if(showNameDesc.size()==0){ watchList.setVisibility(View.GONE); noWatch.setVisibility(View.VISIBLE); }else{ watchList.setVisibility(View.VISIBLE); noWatch.setVisibility(View.GONE); } if(showNameDesc!=null){ Comparator<ShowsList> comp = new Comparator<ShowsList>(){ public int compare(ShowsList ob1,ShowsList ob2){ Date c1= ob1.getStartTime(); Date c2 = ob2.getStartTime(); return (int)(c1.getTime()-c2.getTime()); } }; Collections.sort(showNameDesc, comp); chanAdapter.reload(showNameDesc); } watchList.setAdapter(chanAdapter); chanAdapter.notifyDataSetChanged(); return view; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ML.log("Frag", "oncreate fragment CALLED"); showNameDesc = new ArrayList<ShowsList>(); chanListContent = new ArrayList<String>(); showNameDesc = MainActivity.datasource.retListItemsForWatchlist(); chanAdapter = new RemRecWatchAdapter(getSherlockActivity(),showNameDesc); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); setUserVisibleHint(true); } }
[ "an0nym0us.droid.4.2@gmail.com" ]
an0nym0us.droid.4.2@gmail.com
7c770762a23121a504dd0e3f46b9022d12c4ea49
c3039d190f406d29a18a787e707c1cf3d4e11d0f
/hz-task-master/src/main/java/com/hz/task/master/core/service/impl/DidCollectionAccountServiceImpl.java
d5d146d58978b1c227d7c53db4f0bfd248a555c5
[]
no_license
hzhuazhi/hz-task
3e6c2addbcf6cc0a398376ac96805d49d5d6058b
f3d554f0826788bc3b0a23931194aa5ead2bd27c
refs/heads/master
2022-12-18T18:59:35.184254
2020-09-03T14:40:55
2020-09-03T14:40:55
271,976,042
0
0
null
null
null
null
UTF-8
Java
false
false
3,780
java
package com.hz.task.master.core.service.impl; import com.hz.task.master.core.common.dao.BaseDao; import com.hz.task.master.core.common.service.impl.BaseServiceImpl; import com.hz.task.master.core.mapper.DidCollectionAccountMapper; import com.hz.task.master.core.model.did.DidCollectionAccountModel; import com.hz.task.master.core.service.DidCollectionAccountService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * @Description 用户的收款账号的Service层的实现层 * @Author yoko * @Date 2020/5/15 14:02 * @Version 1.0 */ @Service public class DidCollectionAccountServiceImpl<T> extends BaseServiceImpl<T> implements DidCollectionAccountService<T> { /** * 5分钟. */ public long FIVE_MIN = 300; public long TWO_HOUR = 2; @Autowired private DidCollectionAccountMapper didCollectionAccountMapper; public BaseDao<T> getDao() { return didCollectionAccountMapper; } @Override public void updateBasic(DidCollectionAccountModel model) { didCollectionAccountMapper.updateBasic(model); } @Override public void updateDidCollectionAccount(DidCollectionAccountModel model) { didCollectionAccountMapper.updateDidCollectionAccount(model); } @Override public int updateDidCollectionAccountTotalSwitch(DidCollectionAccountModel model) { return didCollectionAccountMapper.updateDidCollectionAccountTotalSwitch(model); } @Override public int updateDidCollectionAccountCheckData(DidCollectionAccountModel model) { return didCollectionAccountMapper.updateDidCollectionAccountCheckData(model); } @Override public int updateDidCollectionAccountCheckDataByFail(DidCollectionAccountModel model) { return didCollectionAccountMapper.updateDidCollectionAccountCheckDataByFail(model); } @Override public DidCollectionAccountModel getDidCollectionAccountByWxIdAndWxName(DidCollectionAccountModel model) { return didCollectionAccountMapper.getDidCollectionAccountByWxIdAndWxName(model); } @Override public int updateDidCollectionAccountByWxData(DidCollectionAccountModel model) { return didCollectionAccountMapper.updateDidCollectionAccountByWxData(model); } @Override public DidCollectionAccountModel getDidCollectionAccountByWxGroupId(DidCollectionAccountModel model) { return didCollectionAccountMapper.getDidCollectionAccountByWxGroupId(model); } @Override public DidCollectionAccountModel getDidCollectionAccountByWxGroupIdOrWxGroupNameAndYn(DidCollectionAccountModel model) { return didCollectionAccountMapper.getDidCollectionAccountByWxGroupIdOrWxGroupNameAndYn(model); } @Override public int updateDidCollectionAccountRedPackNumOrInvalid(DidCollectionAccountModel model) { return didCollectionAccountMapper.updateDidCollectionAccountRedPackNumOrInvalid(model); } @Override public List<DidCollectionAccountModel> getEffectiveDidCollectionAccountList(DidCollectionAccountModel model) { return didCollectionAccountMapper.getEffectiveDidCollectionAccountList(model); } @Override public int updateCheckByAcNum(DidCollectionAccountModel model) { return didCollectionAccountMapper.updateCheckByAcNum(model); } @Override public int updateLoginType(DidCollectionAccountModel model) { return didCollectionAccountMapper.updateLoginType(model); } @Override public List<DidCollectionAccountModel> getEffectiveDidCollectionAccountByWxGroup(DidCollectionAccountModel model) { return didCollectionAccountMapper.getEffectiveDidCollectionAccountByWxGroup(model); } }
[ "duanfeng_1712@qq.com" ]
duanfeng_1712@qq.com
5001d2bf2f51430c15ecbc2c48653511d5c38d8b
d59ffa0745f4f940dcce64121044f15d76d14785
/client/src/main/java/me/retrodaredevil/solarthing/config/databases/implementations/InfluxDbDatabaseSettings.java
3d515308285012cc71736f04e9020d890b4bf389
[ "MIT" ]
permissive
CapnJackOff/solarthing
d9990318d5c76fc9a2afb98a91b9b3d2ab86d7a7
c77bc800bf0bc47d520d7d4886b3c0502cc278bc
refs/heads/master
2021-04-22T20:41:50.765486
2020-12-25T22:33:30
2020-12-25T22:33:30
268,702,374
0
0
MIT
2020-06-02T04:40:32
2020-06-02T04:40:31
null
UTF-8
Java
false
false
4,707
java
package me.retrodaredevil.solarthing.config.databases.implementations; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeName; import com.fasterxml.jackson.annotation.JsonUnwrapped; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import me.retrodaredevil.influxdb.InfluxProperties; import me.retrodaredevil.okhttp3.OkHttpProperties; import me.retrodaredevil.solarthing.config.databases.DatabaseSettings; import me.retrodaredevil.solarthing.config.databases.DatabaseType; import me.retrodaredevil.solarthing.config.databases.SimpleDatabaseType; import me.retrodaredevil.solarthing.influxdb.retention.RetentionPolicySetting; import me.retrodaredevil.solarthing.util.frequency.FrequentObject; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import static java.util.Objects.requireNonNull; @JsonTypeName("influxdb") @JsonDeserialize(builder = InfluxDbDatabaseSettings.Builder.class) public final class InfluxDbDatabaseSettings implements DatabaseSettings { public static final DatabaseType TYPE = new SimpleDatabaseType("influxdb"); private final InfluxProperties influxProperties; private final OkHttpProperties okHttpProperties; private final String databaseName; private final String measurementName; private final List<FrequentObject<RetentionPolicySetting>> frequentStatusRetentionPolicyList; private final RetentionPolicySetting eventRetentionPolicySetting; public InfluxDbDatabaseSettings(InfluxProperties influxProperties, OkHttpProperties okHttpProperties, String databaseName, String measurementName, Collection<FrequentObject<RetentionPolicySetting>> frequentRetentionPolicies, RetentionPolicySetting eventRetentionPolicySetting) { this.influxProperties = requireNonNull(influxProperties); this.okHttpProperties = requireNonNull(okHttpProperties); this.databaseName = databaseName; this.measurementName = measurementName; this.frequentStatusRetentionPolicyList = Collections.unmodifiableList(new ArrayList<>(frequentRetentionPolicies)); this.eventRetentionPolicySetting = eventRetentionPolicySetting; } @Override public DatabaseType getDatabaseType() { return TYPE; } public InfluxProperties getInfluxProperties(){ return influxProperties; } public OkHttpProperties getOkHttpProperties() { return okHttpProperties; } /** * @return The database name, or null to use */ public String getDatabaseName(){ return databaseName; } public String getMeasurementName() { return measurementName; } public List<FrequentObject<RetentionPolicySetting>> getFrequentStatusRetentionPolicyList() { return frequentStatusRetentionPolicyList; } public RetentionPolicySetting getEventRetentionPolicy(){ return eventRetentionPolicySetting; } @JsonPOJOBuilder public static class Builder { private InfluxProperties influxProperties; private OkHttpProperties okHttpProperties; private String databaseName; private String measurementName; private Collection<FrequentObject<RetentionPolicySetting>> frequentStatusRetentionPolicies; private RetentionPolicySetting eventRetentionPolicySetting; // TODO fix this https://github.com/FasterXML/jackson-databind/issues/1061 @JsonUnwrapped public Builder setInfluxProperties(InfluxProperties influxProperties) { this.influxProperties = influxProperties; return this; } @JsonUnwrapped public Builder setOkHttpProperties(OkHttpProperties okHttpProperties) { this.okHttpProperties = okHttpProperties; return this; } @JsonProperty("database") public Builder setDatabaseName(String databaseName) { this.databaseName = databaseName; return this; } @JsonProperty("measurement") public Builder setMeasurementName(String measurementName) { this.measurementName = measurementName; return this; } @JsonProperty("status_retention_policies") @JsonDeserialize(as = ArrayList.class) public Builder setFrequentStatusRetentionPolicies(Collection<FrequentObject<RetentionPolicySetting>> frequentStatusRetentionPolicies) { this.frequentStatusRetentionPolicies = frequentStatusRetentionPolicies; return this; } @JsonProperty("event_retention_policy") public Builder setEventRetentionPolicySetting(RetentionPolicySetting eventRetentionPolicySetting) { this.eventRetentionPolicySetting = eventRetentionPolicySetting; return this; } public InfluxDbDatabaseSettings build() { return new InfluxDbDatabaseSettings(influxProperties, okHttpProperties, databaseName, measurementName, frequentStatusRetentionPolicies, eventRetentionPolicySetting); } } }
[ "retrodaredevil@gmail.com" ]
retrodaredevil@gmail.com
baea761a7405406289a7e5021f729f093bb8e3dc
ed2c7fc7018157640bae1442cfa6d25a0973a34b
/viikko3/LoginCucumber/src/main/java/ohtu/services/AuthenticationService.java
9e94b925b84c09af87c0ad03b9ebc82082b65e48
[]
no_license
Ghenshrot/ohtu-tehtavat
c2809777100e98e942124d5accb8208fe09cd802
b5979ed836ca4181c17e13fcb23ae9ba4d079f69
refs/heads/master
2020-08-30T12:22:47.165223
2019-12-14T08:35:46
2019-12-14T08:35:46
218,379,303
0
0
null
null
null
null
UTF-8
Java
false
false
1,473
java
package ohtu.services; import ohtu.domain.User; import ohtu.data_access.UserDao; public class AuthenticationService { private UserDao userDao; public AuthenticationService(UserDao userDao) { this.userDao = userDao; } public boolean logIn(String username, String password) { for (User user : userDao.listAll()) { if (user.getUsername().equals(username) && user.getPassword().equals(password)) { return true; } } return false; } public boolean createUser(String username, String password) { if (userDao.findByName(username) != null) { return false; } if (invalid(username, password)) { return false; } userDao.add(new User(username, password)); return true; } private boolean invalid(String username, String password) { // validity check of username and password if (username.length() < 3) { return true; } if (!username.matches("^[a-z]*$")) { return true; } if (password.length() < 8) { return true; } if (stringContainsOnlyLetters(password)) { return true; } return false; } private boolean stringContainsOnlyLetters(String string) { return string.matches("^\\p{IsAlphabetic}*$"); } }
[ "joni.yrjana@helsinki.fi" ]
joni.yrjana@helsinki.fi
ca2066a3c01ecc75e9cca38b70ec58bc60c119be
cd24c3c79be8ae1815d53902f3d6ef5ee8f241dc
/src/Automobile.java
b3cfaac31ff178485b29eb4fb88323e367025076
[]
no_license
Sans-coder/transportV4
e813c77c1ab43e1305c98dbf5256e37affeb4ce7
ee90c310d6e2b88cca96544b6b4c79597c4f76d2
refs/heads/master
2022-08-21T10:32:58.498547
2020-05-15T16:28:35
2020-05-15T16:28:35
264,240,820
0
0
null
null
null
null
UTF-8
Java
false
false
310
java
public class Automobile extends Transport{ public Automobile(){} public Automobile(String id){ super(id); } public void drivingMethod(){ super.drivingMethod(); System.out.println("驾驶Automobile!!"); } public void show() { super.show(); } }
[ "1261076063@qq.com" ]
1261076063@qq.com
89a10e0cb4c7a32d997c5bc469df2c7b2be0c396
49fcc8e9f5433d1015b99cefe9a53472ce480bb9
/kingdom/src/main/java/com/kingdom/store/model/TOnline.java
97b1976cbb899c3fc16797475558820373365a8d
[]
no_license
eideo/jxc
dbddfb34c57f9b7a5feea71d04f7f102066d30f4
660abc9205628b15f6d9744941709c0b38ec5ff4
refs/heads/master
2021-01-22T10:33:53.062866
2014-02-19T14:12:15
2014-02-19T14:12:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,747
java
package com.kingdom.store.model; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; /** * Tonline entity. @author MyEclipse Persistence Tools */ @Entity @Table(name = "T_ONLINE", schema = "") @DynamicInsert(true) @DynamicUpdate(true) public class TOnline implements java.io.Serializable { // Fields private String id; private String loginName; private String ip; private Date loginDatetime; // Constructors /** default constructor */ public TOnline() { } /** full constructor */ public TOnline(String id, String loginName, String ip, Date loginDatetime) { this.id = id; this.loginName = loginName; this.ip = ip; this.loginDatetime = loginDatetime; } // Property accessors @Id @Column(name = "ID", nullable = false, length = 36) public String getId() { return this.id; } public void setId(String id) { this.id = id; } @Column(name = "LOGIN_NAME", nullable = false, length = 100) public String getLoginName() { return this.loginName; } public void setLoginName(String loginName) { this.loginName = loginName; } @Column(name = "IP", nullable = false, length = 50) public String getIp() { return this.ip; } public void setIp(String ip) { this.ip = ip; } @Temporal(TemporalType.TIMESTAMP) @Column(name = "LOGIN_DATETIME", nullable = false, length = 7) public Date getLoginDatetime() { return this.loginDatetime; } public void setLoginDatetime(Date loginDatetime) { this.loginDatetime = loginDatetime; } }
[ "kingdom1028@hotmail.com" ]
kingdom1028@hotmail.com
55207a2f82423d94105c5a7da859dd49cfe5e4b8
659534e35d6fb1a3cc53a025802c20f806c79c4c
/src/main/java/com/eu/ensup/partielspring/SpringWebAppApplication.java
f30841a5eab5db552c7f7b06f99b0dd6bb48fab2
[]
no_license
ahmadlo/partiel-client-spring-thymeleaf
91fc67df7fdf95ff168dd832b088d91487ecfcc2
c042bc47539f78f994f2e924e491849ff5f1dfe9
refs/heads/main
2023-05-30T09:15:17.095027
2021-05-01T23:17:07
2021-05-01T23:17:07
362,506,709
0
1
null
2021-04-29T14:57:25
2021-04-28T14:53:13
CSS
UTF-8
Java
false
false
566
java
package com.eu.ensup.partielspring; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration; @SpringBootApplication //@EnableAutoConfiguration(exclude = {ErrorMvcAutoConfiguration.class}) public class SpringWebAppApplication { public static void main(String[] args) { SpringApplication.run(SpringWebAppApplication.class, args); } }
[ "ahmadou.lo@orange.com" ]
ahmadou.lo@orange.com
7bf316e216dfe6a46cbd62b421218531e8fe0dc2
5aee3dcb75fc190988a3e826414efa5e4e206417
/chauvet/src/com/chauvet/utils/StringUtil.java
d1773291837724e72b77ecebec8f55db91027da9
[]
no_license
chauvet-wang/chauvet
d0ef8f3f3f5901ae9d2e12ae05e7a58f3ee5363e
2003327119dc03182693b0e1c4bd89c88d57fd8d
refs/heads/master
2023-04-14T08:47:09.625649
2023-04-06T08:30:19
2023-04-06T08:30:19
70,579,966
0
0
null
null
null
null
UTF-8
Java
false
false
2,377
java
package com.chauvet.utils; import org.apache.commons.lang.StringUtils; /*** * 字符串处理类 * @author WXW * */ public class StringUtil { /** * 获取一个字符串的缩略信息 * @return String * 返回的字符串(“这是一个***字符串”) */ public static String getStringSimple(String str){ if(StringUtils.isBlank(str)){ return str; } return str.substring(0,4) + "***" + str.substring(str.length()-4); } /** *将半角的符号转换成全角符号.(即英文字符转中文字符) * * @param str * 源字符串 * @return String */ public static String changeToFull(String str) { String source = "1234567890!@#$%^&*()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_=+\\|[];:'\",<.>/?"; String[] decode = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "!", "@", "#", "$", "%", "︿", "&", "*", "(", ")", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "-", "_", "=", "+", "\", "|", "【", "】", ";", ":", "'", "\"", ",", "〈", "。", "〉", "/", "?" }; String result = ""; for (int i = 0; i < str.length(); i++) { int pos = source.indexOf(str.charAt(i)); if (pos != -1) { result += decode[pos]; } else { result += str.charAt(i); } } return result; } /*** * 反转字符串 * @param str * @return */ public static String reverse(String str) { if (StringUtils.isBlank(str)) { return null; } return new StringBuilder(str).reverse().toString(); } public static void main(String[] args) { System.out.println(StringUtil.reverse("asfwew221scx11")); } }
[ "68550148@qq.com" ]
68550148@qq.com
23add96c5165a6d0640d9a93e61f3afcfe703fcc
cc7f063a9db9f473ba47e5e0d8372f0537f01a71
/KinesisProcessor/src/com/hypermindr/processor/tailer/KinesisTailerListener.java
fc0689f3e1e1aee7455f16f2b963a01e0bdb79f3
[]
no_license
fcopello/FileMonitor
ee95874adb4f8a9bb6e80a14fc26e0520d423a58
3ecaf8742d82359de452d8238d47a2980cff0c76
refs/heads/master
2020-12-26T04:38:43.386579
2015-05-27T19:03:46
2015-05-27T19:03:46
36,935,981
1
0
null
2015-06-05T14:05:25
2015-06-05T14:05:25
null
UTF-8
Java
false
false
7,302
java
package com.hypermindr.processor.tailer; import java.nio.ByteBuffer; import java.util.ArrayList; import org.apache.commons.io.input.Tailer; import org.apache.commons.io.input.TailerListener; import org.apache.log4j.Logger; import com.amazonaws.services.kinesis.model.PutRecordsRequest; import com.amazonaws.services.kinesis.model.PutRecordsRequestEntry; import com.google.gson.Gson; import com.hypermindr.processor.KinesisRawUploader; import com.hypermindr.processor.KinesisUploader; import com.hypermindr.processor.main.KinesisLogTailer; import com.hypermindr.processor.model.PerformanceLineModel; import com.hypermindr.processor.util.KinesisIntegrationUtil; /** * Custom tail listener for Hypermindr API / Barbante log files * This class is instantiated for each monitored file, handling every line wrote of file. * Those lines are uploaded to Kinesis using the proper Stream (performance or raw) * * @author ricardo * */ public class KinesisTailerListener implements TailerListener { private KinesisUploader k = new KinesisUploader(); private KinesisRawUploader kraw = new KinesisRawUploader(); private static Gson gson = new Gson(); private int MAX_RECORDS_SIZE = 400; private ArrayList<PutRecordsRequestEntry> listItens = new ArrayList<PutRecordsRequestEntry>(); private ArrayList<PutRecordsRequestEntry> listRawItens = new ArrayList<PutRecordsRequestEntry>(); private boolean debug = false; private boolean checkPerformanceSintaxModel = false; private boolean rawEnabled = true; private static Logger log = Logger.getLogger(KinesisTailerListener.class .getName()); private long lastTimeFired = System.currentTimeMillis(); private long lastTimeFiredRaw = System.currentTimeMillis(); private long TIME_FRAME = 60000; private String awsKinesisStream; private String awsKinesisRawStream; public KinesisTailerListener(TailerContext context) { log.info("Building KinesisTailerListener. Context: " + context.getName()); k.setKinesisClient(KinesisLogTailer.getKinesisClient()); kraw.setKinesisClient(KinesisLogTailer.getKinesisClient()); log.info("KinesisTailerListener construction complete."); awsKinesisStream = context.getPerformanceStreamName(); awsKinesisRawStream = context.getRawStreamName(); try { rawEnabled = Boolean.parseBoolean(context.getRawEnabled().trim()); } catch (Exception e) { } try { MAX_RECORDS_SIZE = Integer.parseInt(context.getTailerBufferSize() .trim()); } catch (NumberFormatException nfe) { } try { debug = Boolean.parseBoolean(context.isDebug()); } catch (NumberFormatException nfe) { } k.setDebug(debug); kraw.setDebug(debug); } @Override public void fileNotFound() { // TODO Auto-generated method stub } @Override public void fileRotated() { // TODO Auto-generated method stub } /** * Method to deal with each captured line. TODO: Enhance valid log line * detection */ @Override public void handle(String line) { String rawLine = new String(line); line = line.trim(); if (line != null && line.length() > 0) { //CHECK IF INCOMMING LINE IS A PERFORMANCE LINE if (KinesisIntegrationUtil.isPerformanceLine(line)) { int openBracketIndex = line .indexOf(KinesisIntegrationUtil.OPEN_BRACKET); if (openBracketIndex != -1) { line = line .substring( openBracketIndex, line.lastIndexOf(KinesisIntegrationUtil.CLOSE_BRACKET) + 1); try { if (checkPerformanceSintaxModel) { PerformanceLineModel model = gson.fromJson(line, PerformanceLineModel.class); if (debug) { log.trace(model); } } // Partition Key must be tracerid to keep pairing and // ordering records PutRecordsRequestEntry putRecordsRequestEntry = new PutRecordsRequestEntry(); putRecordsRequestEntry.setData(ByteBuffer.wrap(line .getBytes())); putRecordsRequestEntry .setPartitionKey(returnTracerId(line)); listItens.add(putRecordsRequestEntry); // Enrich raw with performance information PutRecordsRequestEntry putRecordsRequestEntryRaw = new PutRecordsRequestEntry(); putRecordsRequestEntryRaw.setData(ByteBuffer .wrap(rawLine.getBytes())); putRecordsRequestEntryRaw.setPartitionKey(String .valueOf(System.currentTimeMillis())); listRawItens.add(putRecordsRequestEntryRaw); if (listItens.size() >= MAX_RECORDS_SIZE || (lastTimeFired + TIME_FRAME) < System .currentTimeMillis()) { if (listItens.size() > 0) { if (debug) { log.debug("About to send PERFORMANCE lines to kinesis."); } k.handle(new PutRecordsRequest().withRecords( listItens).withStreamName( this.getAwsKinesisStream())); listItens.clear(); listItens.trimToSize(); System.gc(); lastTimeFired = System.currentTimeMillis(); } else { if (debug) { log.debug("No records to send."); } } } } catch (com.google.gson.JsonSyntaxException ex) { PutRecordsRequestEntry putRecordsRequestEntry = new PutRecordsRequestEntry(); putRecordsRequestEntry.setData(ByteBuffer.wrap(line .getBytes())); putRecordsRequestEntry.setPartitionKey(String .valueOf(System.currentTimeMillis())); listRawItens.add(putRecordsRequestEntry); System.gc(); return; } } } else if (!line.contains(KinesisIntegrationUtil.AWS_STR) && this.isRawEnabled()) { PutRecordsRequestEntry putRecordsRequestEntry = new PutRecordsRequestEntry(); putRecordsRequestEntry .setData(ByteBuffer.wrap(line.getBytes())); putRecordsRequestEntry.setPartitionKey(String.valueOf(System .currentTimeMillis())); listRawItens.add(putRecordsRequestEntry); if (listRawItens.size() >= MAX_RECORDS_SIZE || (lastTimeFiredRaw + TIME_FRAME) < System .currentTimeMillis()) { if (listItens.size() > 0) { if (debug) { log.debug("About to send RAW lines to kinesis."); } kraw.handle(new PutRecordsRequest().withRecords( listRawItens).withStreamName( this.getAwsKinesisRawStream())); listRawItens.clear(); System.gc(); lastTimeFiredRaw = System.currentTimeMillis(); } else { if (debug) { log.debug("No records to send."); } } } } } } @Override public void handle(Exception arg0) { // TODO Auto-generated method stub } @Override public void init(Tailer arg0) { // TODO Auto-generated method stub } // Naive method, but fast for the job public String returnTracerId(String line) { int mark = line.indexOf("tracerid"); return line.substring(mark + 11, mark + 43); } public String getAwsKinesisStream() { return awsKinesisStream; } public void setAwsKinesisStream(String awsKinesisStream) { this.awsKinesisStream = awsKinesisStream; } public String getAwsKinesisRawStream() { return awsKinesisRawStream; } public void setAwsKinesisRawStream(String awsKinesisRawStream) { this.awsKinesisRawStream = awsKinesisRawStream; } public boolean isRawEnabled() { return rawEnabled; } public void setRawEnabled(boolean rawEnabled) { this.rawEnabled = rawEnabled; } }
[ "ricardo@hypermindr.com" ]
ricardo@hypermindr.com
5b9309165c78e464700cbdb59fbbde92c04856f4
5ea055d66084e6278eaf5e0437879dd556eb5adc
/Strings/Spacing/Put spaces between words starting with capital letters.java
0f6261ced7d07cc2a48f432d2defd2fcbf0555aa
[]
no_license
divyajalikoppa/Leetcode
c50b038580ca434383f797643dfdd67568dd5fdf
85d6cca4d7c0c193adf06119790578cbb5da6d4a
refs/heads/master
2023-08-31T04:05:51.296068
2021-05-15T14:44:38
2021-05-15T14:44:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,222
java
/* Question: You are given an array of characters which is basically a sentence. However there is no space between different words and the first letter of every word is in uppercase. You need to print this sentence after following amendments: (i) Put a single space between these words. (ii) Convert the uppercase letters to lowercase. Examples: Input : BruceWayneIsBatman Output : bruce wayne is batman Input : You Output : you */ //Solution 1 import java.util.*; import java.lang.*; import java.io.*; class bjjvjh { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); sc.nextLine(); while(t-->0){ String s = sc.nextLine(); StringBuilder sb=new StringBuilder(); for(int i=0;i<s.length();i++) { if(!Character.isUpperCase(s.charAt(i))) sb.append(s.charAt(i)); else {sb.append(" "); sb.append(Character.toLowerCase(s.charAt(i)));} } System.out.println(sb.toString()); }}} //Solution(o(n) time and o(1) space) // Java program to put spaces between words starting // with capital letters. import java.util.*; import java.lang.*; import java.io.*; class AddSpaceinSentence { // Function to amend the sentence public static void amendSentence(String sstr) { char[] str=sstr.toCharArray(); // Traverse the string for (int i=0; i < str.length; i++) { // Convert to lowercase if its // an uppercase character if (str[i]>='A' && str[i]<='Z') { str[i] = (char)(str[i]+32); // Print space before it // if its an uppercase character if (i != 0) System.out.print(" "); // Print the character System.out.print(str[i]); } // if lowercase character // then just print else System.out.print(str[i]); } } // Driver Code public static void main (String[] args) { String str ="BruceWayneIsBatman"; amendSentence(str); } }
[ "noreply@github.com" ]
divyajalikoppa.noreply@github.com
78d329717a4154b5f2501e8a444036fad68a8612
f8b2e2c2cb84f730eaa927f5e62c6de30f42bd4a
/src/main/java/org/unbiquitous/driver/execution/remoteExecution/CallValues.java
c4a1eb6954a6b93840d3c86b06ad5fb8cb5c43a9
[]
no_license
UnBiquitous/uos-execution
66aebdb2f4e651f9af5f4c4c097ca0eed4d529d0
c6ffbaa2bc31fea7235b7624113d9ebf9822a3a7
refs/heads/master
2020-04-05T14:55:34.265838
2015-09-16T20:08:36
2015-09-16T20:08:36
4,081,196
0
1
null
2015-09-16T20:08:51
2012-04-19T23:15:41
Java
UTF-8
Java
false
false
843
java
package org.unbiquitous.driver.execution.remoteExecution; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class CallValues { private HashMap<Long, HashMap<String, String>> values = new HashMap<Long, HashMap<String,String>>(); public void setValue(long id, String key, String value) { if (values.get(id) == null){ values.put(id, new HashMap<String, String>()); } values.get(id).put(key, value); } public String getValue(long id, String key) { if (values.get(id) == null){ return null; } return values.get(id). get(key); } public List<String> getKeys(long id) { if (values.get(id) == null){ return null; } ArrayList<String> keys = new ArrayList<String>(); keys.addAll(values.get(id).keySet()); return keys; } public void clearValues() { values.clear(); } }
[ "nuk.anime13@gmail.com" ]
nuk.anime13@gmail.com
5cf0c56f47d4c69a7a485db3cb8c3b541fa77bd3
6f352fef60e61d329f48848e1ba1cd37cfb65d91
/kattis/HoneyHelper.java
729ac0ede24249b892275b0d55dd0d2a8736cdd0
[]
no_license
ericdand/programming-problems
a25de18b589550ac479eecc7081d4a6a1c7c290b
5f7a1d13e8785edced5d069785c5d7ae2b66a070
refs/heads/master
2021-01-15T23:34:56.382644
2017-09-16T23:04:53
2017-09-16T23:04:53
14,997,207
0
1
null
null
null
null
UTF-8
Java
false
false
1,191
java
public class HoneyHelper { static int walk(int x, int y, int n) { if (n == 0) { // Did we make it back to the origin? if (x == 0 && y == 0) return 1; return 0; } // Short-circuit: are we too far away to make it back in n steps? if (x > n || -x > n || y > n || -y > n) return 0; int sum = 0; if (y % 2 == 0) { // even-numbered honeycomb row // We can travel up, down, left, right, AND up-right and down-right. sum += walk(x, y+1, n-1); // up sum += walk(x, y-1, n-1); // down sum += walk(x-1, y, n-1); // left sum += walk(x+1, y, n-1); // right sum += walk(x+1, y+1, n-1); // up-right sum += walk(x+1, y-1, n-1); // down-right } else { // odd-numbered honeycomb row // We can travel up, down, left, right, AND up-left and down-left. sum += walk(x, y+1, n-1); // up sum += walk(x, y-1, n-1); // down sum += walk(x-1, y, n-1); // left sum += walk(x+1, y, n-1); // right sum += walk(x-1, y+1, n-1); // up-left sum += walk(x-1, y-1, n-1); // down-left } return sum; } public static void main(String[] args) { for(int i = 1; i < 15; i++) { System.out.printf("%d, ", walk(0, 0, i)); } System.out.println(); } }
[ "eric.c.dand@gmail.com" ]
eric.c.dand@gmail.com
5479327fb7bab3e0c9dc1ea8cdfc5fabe62f46d4
1a698d98de240fa09c9c9e0f1b0c7eea41275372
/src/hackathon/Test.java
6753e97a2f93d60b5be3dcf6ab2de9eb961bed1b
[]
no_license
xuhao890627/triple-hao
7f16023a05adc51fd763bc01496b2e5686cdc1e8
e66265d2075adebfa2305714edfdf37e6b43b621
refs/heads/master
2021-09-01T05:59:58.840055
2017-12-25T05:43:47
2017-12-25T05:43:47
115,317,153
0
0
null
2017-12-25T07:33:38
2017-12-25T07:33:37
null
UTF-8
Java
false
false
2,979
java
package hackathon; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.util.Random; public class Test { public static void main(String[] args) throws Exception { System.out.println("--------------1"); exportCsv(); System.out.println("--------------2"); } public static <T> void exportCsv() throws Exception { File file = new File("/Users/jascao/Documents/test.csv"); OutputStreamWriter ow = new OutputStreamWriter(new FileOutputStream(file), "utf-8"); String spilt = ","; StringBuffer t = new StringBuffer(); t.append("ID").append(spilt); t.append("姓名").append(spilt); t.append("手机").append(spilt); t.append("性别").append(spilt); t.append("生日年").append(spilt); t.append("生日月").append(spilt); t.append("生日天").append(spilt); t.append("省份").append(spilt); t.append("城市").append(spilt); t.append("字段1").append(spilt); t.append("字段2").append(spilt); t.append("字段3").append(spilt); t.append("字段4").append(spilt); t.append("字段5").append(spilt); t.append("字段6").append(spilt); t.append("字段7").append(spilt); t.append("字段8").append(spilt); t.append("字段9").append(spilt); t.append("字段10"); ow.write(t.toString()); ow.write("\r\n"); for (int i = 1; i < 11; i++) { User user = getUser(i); StringBuffer sb = new StringBuffer(); sb.append(user.getId()).append(spilt); sb.append(user.getName()).append(spilt); sb.append(user.getMobile()).append(spilt); sb.append(user.getGender()).append(spilt); sb.append(user.getBirthyear()).append(spilt); sb.append(user.getBirthmonth()).append(spilt); sb.append(user.getBirthday()).append(spilt); sb.append(user.getProvince()).append(spilt); sb.append(user.getCity()).append(spilt); sb.append("t1").append(spilt); sb.append("t2").append(spilt); sb.append("t3").append(spilt); sb.append("t4").append(spilt); sb.append("t5").append(spilt); sb.append("t6").append(spilt); sb.append("t7").append(spilt); sb.append("t8").append(spilt); sb.append("t9").append(spilt); sb.append("t10"); ow.write(sb.toString()); ow.write("\r\n"); } ow.flush(); ow.close(); } private static String[] GENDER = new String[] { "M", "F" }; private static User getUser(int id) { User u = new User(); u.setId(id); u.setName("name" + id); u.setGender(GENDER[getRandom(0, 2)]); u.setMobile(String.valueOf((long) (Math.random() * 90000000000l) + 10000000000l)); u.setBirthyear(String.valueOf(getRandom(1950, 2010))); u.setBirthmonth(String.valueOf(getRandom(1, 12))); u.setBirthday(String.valueOf(getRandom(1, 31))); u.setProvince(String.valueOf(getRandom(1, 34))); u.setCity(String.valueOf(getRandom(1, 200))); return u; } private static int getRandom(int min, int max) { Random random = new Random(); int result = random.nextInt(max) % (max - min + 1) + min; return result; } }
[ "jason.cao@acxiom.com" ]
jason.cao@acxiom.com
090a22abb9afa0266207a5456c104bffbdc8340f
e1c4d584db8835db212dfdd52c13c212e623bad7
/app/src/main/java/cn/dennishucd/result/FriendInfoResult.java
402102a85ea6374886f8fce81e200b3923c2d978
[ "Apache-2.0" ]
permissive
riahtu/LifeEnergy
b50b798caf7babc0275778d1c0cc7ba53d2a2f7c
5b6fb30fb871f03ad52e4c5f823fd9af1aead469
refs/heads/master
2023-07-23T17:13:51.030663
2018-12-19T13:18:33
2018-12-19T13:18:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,779
java
package cn.dennishucd.result; import android.os.Parcel; import android.os.Parcelable; /** * 好友资料数据的数据实体 * * */ public class FriendInfoResult implements Parcelable { /** * 好友的姓名 */ private String name; /** * 好友的头像路径 */ private String avatar; /** * 好友的性别 */ private int gender; /** * 好友的星座 */ private String constellation; /** * 好友的签名 */ private String signature; /** * 好友的照片个数 */ private int photo_count; /** * 好友的日记个数 */ private int diary_count; /** * 好友的好友个数 */ private int friend_count; /** * 好友的访问者个数 */ private int visitor_count; /** * 好友的背景编号 */ private int wallpager; /** * 好友的生日 */ private String date; /** * 好友的家乡 */ private String hometown; public String getHometown() { return hometown; } public void setHometown(String hometown) { this.hometown = hometown; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getTelephone() { return telephone; } public void setTelephone(String telephone) { this.telephone = telephone; } public String getEducation() { return education; } public void setEducation(String education) { this.education = education; } public String getExperience() { return experience; } public void setExperience(String experience) { this.experience = experience; } /** * 好友的现居住地 */ private String address; /** * 好友的手机 */ private String telephone; /** * 好友的教育背景 */ private String education; /** * 好友的工作经历 */ private String experience; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getAvatar() { return avatar; } public void setAvatar(String avatar) { this.avatar = avatar; } public int getGender() { return gender; } public void setGender(int gender) { this.gender = gender; } public String getConstellation() { return constellation; } public void setConstellation(String constellation) { this.constellation = constellation; } public String getSignature() { return signature; } public void setSignature(String signature) { this.signature = signature; } public int getPhoto_count() { return photo_count; } public void setPhoto_count(int photo_count) { this.photo_count = photo_count; } public int getDiary_count() { return diary_count; } public void setDiary_count(int diary_count) { this.diary_count = diary_count; } public int getFriend_count() { return friend_count; } public void setFriend_count(int friend_count) { this.friend_count = friend_count; } public int getVisitor_count() { return visitor_count; } public void setVisitor_count(int visitor_count) { this.visitor_count = visitor_count; } public int getWallpager() { return wallpager; } public void setWallpager(int wallpager) { this.wallpager = wallpager; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public int describeContents() { return 0; } public void writeToParcel(Parcel dest, int flags) { dest.writeString(name); dest.writeString(constellation); dest.writeString(signature); dest.writeString(date); dest.writeString(avatar); dest.writeInt(gender); dest.writeInt(photo_count); dest.writeInt(diary_count); dest.writeInt(friend_count); dest.writeInt(visitor_count); dest.writeInt(wallpager); } public static final Parcelable.Creator<FriendInfoResult> CREATOR = new Parcelable.Creator<FriendInfoResult>() { public FriendInfoResult createFromParcel(Parcel source) { FriendInfoResult result = new FriendInfoResult(); result.setName(source.readString()); result.setConstellation(source.readString()); result.setSignature(source.readString()); result.setDate(source.readString()); result.setAvatar(source.readString()); result.setGender(source.readInt()); result.setPhoto_count(source.readInt()); result.setDiary_count(source.readInt()); result.setFriend_count(source.readInt()); result.setVisitor_count(source.readInt()); result.setWallpager(source.readInt()); return result; } public FriendInfoResult[] newArray(int size) { return new FriendInfoResult[size]; } }; }
[ "qblee.zju@gmail.com" ]
qblee.zju@gmail.com
2b5498117ce69d5b461f048705c7a70c78ac0319
52f39bb78396f184ceadc21c825cc7ad23d47b98
/usermanager/usermanager-ejb/src/main/java/com/example/usermanager/impl/ejb/UserManagerBean.java
f751a1e72159734412a05a88837a51b81d97f73d
[]
no_license
rogersuen/JEE4WAD
110b992e1c612d7145464db7f9c76927ef32b27c
56c33b35f128c5ba3e2ad2855dbcd9761a2e4dd6
refs/heads/master
2016-09-05T22:51:51.425671
2015-04-29T03:27:55
2015-04-29T03:27:55
34,647,489
0
1
null
null
null
null
UTF-8
Java
false
false
1,675
java
package com.example.usermanager.impl.ejb; import com.example.usermanager.model.User; import com.example.usermanager.model.UserException; import com.example.usermanager.model.UserManager; import java.util.List; import javax.ejb.Remote; import javax.ejb.Stateless; import javax.jws.WebMethod; import javax.jws.WebService; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; @WebService @Stateless @Remote(UserManager.class) public class UserManagerBean implements UserManager { @PersistenceContext private EntityManager em; @WebMethod @Override public List<User> getAllUsers() { TypedQuery<User> query = em.createNamedQuery("User.getAllUsers", User.class); return query.getResultList(); } @WebMethod @Override public User findUserByEmail(String email) { if (email == null) { throw new IllegalArgumentException("email cannot be null"); } TypedQuery<User> query = em.createNamedQuery("User.findUserByEmail", User.class); query.setParameter("email", email); List<User> list = query.getResultList(); if (list.isEmpty()) { return null; } else { return list.get(0); } } @Override public User addUser(User user) { if (user == null) { throw new IllegalArgumentException("user cannot be null."); } if (findUserByEmail(user.getEmail()) != null) { throw new UserException("A user with the email address already exists."); } em.persist(user); return user; } }
[ "rogersuen@live.com" ]
rogersuen@live.com
1bb3185a3de8661ea8111aa3ee374b301591ebb8
d1a6d1e511df6db8d8dd0912526e3875c7e1797d
/genny_JavaWithoutLambdasApi21/applicationModule/src/main/java/applicationModulepackageJava8/Foo592.java
76ef0282ec324b6a0750624bba9026ca0d7ea9d4
[]
no_license
NikitaKozlov/generated-project-for-desugaring
0bc1443ab3ddc84cd289331c726761585766aea7
81506b3711004185070ca4bb9a93482b70011d36
refs/heads/master
2020-03-20T00:35:06.996525
2018-06-12T09:30:37
2018-06-12T09:30:37
137,049,317
0
0
null
null
null
null
UTF-8
Java
false
false
346
java
package applicationModulepackageJava8; public class Foo592 { public void foo0() { new applicationModulepackageJava8.Foo591().foo5(); } public void foo1() { foo0(); } public void foo2() { foo1(); } public void foo3() { foo2(); } public void foo4() { foo3(); } public void foo5() { foo4(); } }
[ "nikita.e.kozlov@gmail.com" ]
nikita.e.kozlov@gmail.com
a6191975934703a782154f7ac75aaf4f53b6dfe8
240d651ff3ddb535d4ceec0c74ee9f3cec095c49
/src/test/md/tekwill/jf4/homework/Exercise6Test.java
b5971b33dba85b371038db483923eea1a53e1ca0
[]
no_license
cavl/jf-4-homework
0127ccf866ce797f7b93de97b758499209577f68
9370d21e6920e3651078e4de8e6e760fbf657a96
refs/heads/master
2021-05-02T00:22:24.000378
2018-02-11T22:11:54
2018-02-11T22:11:54
120,942,735
0
0
null
2018-02-09T18:47:36
2018-02-09T18:47:36
null
UTF-8
Java
false
false
325
java
package md.tekwill.jf4.homework; import org.junit.Assert; import org.junit.Test; import static org.junit.Assert.*; public class Exercise6Test { @Test public void calcExpr() { Exercise6 Ex = new Exercise6(); Assert.assertEquals(2.138888888888889,Ex.calcExpr(25.5,3.5,3.5,3.5,40.5,4.5),0.0); } }
[ "calmycov.vlad@gmail.com" ]
calmycov.vlad@gmail.com
59be1147777e93a2c9114324d8c25a2624dc1bdd
99fcb3e9515799059273d3af0e0a88c9515831ad
/orion-ucenter/src/main/java/com/swin/orion/ucenter/core/Service.java
911312275007335c0b1b0c5c6ae5d4f481a4837b
[ "Apache-2.0" ]
permissive
heatre/orion
d2c08f01685560438c1708e72bc14c0c60e57b33
993910bdff80ee7c35f373e0fef468a07fc40d2a
refs/heads/master
2021-01-19T13:41:16.023739
2017-08-22T13:01:01
2017-08-22T13:01:01
100,855,393
0
0
null
null
null
null
UTF-8
Java
false
false
946
java
package com.swin.orion.ucenter.core; import org.apache.ibatis.exceptions.TooManyResultsException; import tk.mybatis.mapper.entity.Condition; import java.util.List; /** * Service层基础接口,其他Service 接口 请继承该接口 */ public interface Service<T> { void save(T model);//持久化 void save(List<T> models);//批量持久化 void deleteById(Integer id);//通过主鍵刪除 void deleteByIds(String ids);//批量刪除 eg:ids -> “1,2,3,4” void update(T model);//更新 T findById(Integer id);//通过ID查找 //通过Model中某个成员变量名称(非数据表中column的名称)查找,value需符合unique约束 T findBy(String fieldName, Object value) throws TooManyResultsException; List<T> findByIds(String ids);//通过多个ID查找//eg:ids -> “1,2,3,4” List<T> findByCondition(Condition condition);//根据条件查找 List<T> findAll();//获取所有 }
[ "heatre@126.com" ]
heatre@126.com
9e6af086612550c84e29a88b7e1bdfb9399248e3
1af17e2a221a5de4c39f4c32a9e696a18bf7c95c
/src/hot/org/domain/monedaliquidacion/session/BindbList.java
38a0c254f4ad14b06b38d09edc9ab12d8774a2a5
[]
no_license
TKSISSOFTWARE/monedaliquidacion
5434e1c789377f05e15e2a475751edef8431ba4b
13a3faad02af50ee35cacb953423488201f62e9b
refs/heads/master
2021-01-20T16:28:15.206680
2015-10-29T22:18:24
2015-10-29T22:18:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
998
java
package org.domain.monedaliquidacion.session; import org.domain.monedaliquidacion.entity.*; import org.jboss.seam.annotations.Name; import org.jboss.seam.framework.EntityQuery; import java.util.Arrays; @Name("bindbList") public class BindbList extends EntityQuery<Bindb> { private static final String EJBQL = "select bindb from Bindb bindb"; private static final String[] RESTRICTIONS = { "lower(bindb.bin) like lower(concat(#{bindbList.bindb.bin},'%'))", "lower(bindb.nombrebanco) like lower(concat(#{bindbList.bindb.nombrebanco},'%'))", "lower(bindb.pais) like lower(concat(#{bindbList.bindb.pais},'%'))", "lower(bindb.ciudad) like lower(concat(#{bindbList.bindb.ciudad},'%'))", "lower(bindb.producto) like lower(concat(#{bindbList.bindb.producto},'%'))", }; private Bindb bindb = new Bindb(); public BindbList() { setEjbql(EJBQL); setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS)); setMaxResults(25); } public Bindb getBindb() { return bindb; } }
[ "desarrollo@monedafrontera.com" ]
desarrollo@monedafrontera.com
e674a0a0a3a4470d4aea1b834f2c1ef3eaa3f386
ac8a9baa2a48504b6cb8b85d2ee76533a2297c82
/app/src/test/java/com/example/architectureexampleii/ExampleUnitTest.java
e9fbbd587aab9f9dfe4a90aaf25175b0f6df7f37
[]
no_license
canseray/Architecture-Example-II-MVVM
3ab503710026f25e03a536a072955e5a6e66f5cd
48174d967b86b42ba08982e9400ad52b0cf1324b
refs/heads/master
2020-09-20T17:00:42.534526
2019-11-28T22:18:01
2019-11-28T22:18:01
224,542,480
0
0
null
null
null
null
UTF-8
Java
false
false
394
java
package com.example.architectureexampleii; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "canseraytufan@gmail.com" ]
canseraytufan@gmail.com
1fe9c6a4e8bdb132fe5ab1dd4c54d25dc14dd008
fe0ec701335b625126af7d67971e0dd865e50975
/src/com/lamfire/jspp/JSPP.java
824daf14fb5bcedf73cae148cb8fe441f7c2c259
[]
no_license
guzhixiong/jspp
7e4aa195e5545e7a05985d792664f92b20a81b6c
a67c7d2969bac92c15f5ba29f4bc365b7577ae4f
refs/heads/master
2020-12-14T00:22:16.934110
2014-03-07T07:55:07
2014-03-07T07:55:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,484
java
package com.lamfire.jspp; import com.lamfire.json.JSON; import com.lamfire.jspp.serializer.JSPPSerializer; import com.lamfire.jspp.serializer.Serializer; import java.util.Map; /** * JSPP抽象类 * User: lamfire * Date: 13-11-13 * Time: 下午4:13 * To change this template use File | Settings | File Templates. */ public abstract class JSPP extends JSON { private static Serializer serializer = new JSPPSerializer(); public static final String JSPP_TYPE_PREFIX_IQ = "iq"; public static final String JSPP_TYPE_PREFIX_MESSAGE = "message"; public static final String JSPP_TYPE_PREFIX_PRESENCE = "presence"; private ERROR error; public String getType() { return (String)get("type"); } public void setType(String type) { put("type",type); } public String getFrom() { return (String)get("from"); } public void setFrom(String from) { put("from",from); } public String getTo() { return (String)get("to"); } public void setTo(String to) { put("to",to); } public String getId() { return (String)get("id"); } public void setId(String id) { put("id",id); } public String getBody() { return (String)get("body"); } public void setBody(String body) { put("body",body); } public ERROR getError() { if(error != null){ return error; } Map<String,Object> map = ( Map<String,Object>)get("error"); if(map == null){ return null; } error = new ERROR(); error.setCode((Integer)map.get("code")); error.setBody((String)map.get("body")); return error; } public void setError(ERROR error) { this.error = error; put("error",error); } public static ProtocolType getProtocolType(JSPP jspp){ if(jspp instanceof MESSAGE){ return ProtocolType.MESSAGE; } if(jspp instanceof IQ){ return ProtocolType.IQ; } if(jspp instanceof PRESENCE){ return ProtocolType.PRESENCE; } return null; } public static byte[] serialize(JSPP jspp){ return serializer.encode(jspp); } public static JSPP deserialize(byte[] bytes){ return serializer.decode(bytes); } }
[ "hayash@163.com" ]
hayash@163.com
9537e879173c6a02394b6a7bafbdaf78d9d97168
bb41dd2a71065a2e19cc0f9898014cff9a8eaf72
/no.hib.dpf.uconstraint/src/no/hib/dpf/uconstraint/presentation/EnumeratorCombo.java
dfc97d9d0b35e34f84c2d054434b285196c05ec9
[]
no_license
dpf-hq/dpf
72cfecb30af037b76d396922b983d7c6eea8fc1a
2f06c493fddc20f97e1833139cfaf0d42cbcb893
refs/heads/master
2020-12-10T19:04:03.083048
2016-08-28T20:32:35
2016-08-28T20:32:35
26,583,472
0
0
null
null
null
null
UTF-8
Java
false
false
1,485
java
package no.hib.dpf.uconstraint.presentation; import org.eclipse.core.runtime.Assert; import org.eclipse.emf.common.util.Enumerator; import org.eclipse.jface.viewers.ComboViewer; import org.eclipse.jface.viewers.IContentProvider; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; public class EnumeratorCombo extends ComboViewer{ private final IContentProvider contentProvider = new IStructuredContentProvider() { @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } @Override public void dispose() { } @Override public Object[] getElements(Object inputElement) { Assert.isTrue(inputElement instanceof Enumerator[]); return (Enumerator[])inputElement; } }; private final ILabelProvider labelProvider = new LabelProvider(){ public String getText(Object element) { Assert.isTrue(element instanceof Enumerator); return ((Enumerator)element).getLiteral(); } }; public EnumeratorCombo(Composite parent, int style) { super(parent, style); GridData gridData = new GridData(GridData.BEGINNING, GridData.FILL, false, false); gridData.horizontalSpan = 2; getControl().setLayoutData(gridData); setContentProvider(contentProvider); setLabelProvider(labelProvider); } }
[ "wxlfrank@gmail.com" ]
wxlfrank@gmail.com
80d77977431a6de8a4c6d45f0df502af5b09c521
bfbe58a33ec41655dfce6d77d9fb378f42e6afa2
/concurrency-demo/src/main/java/hu/evosoft/javasetraining/multithreading/customexamples/ReadWriteLockExample.java
d602b541ee3ec272f3fe4da5089d6041a3f0d16b
[]
no_license
zbalogh92/evo0415
dbff45e4c12f012240112b7eebb355ef2f6dcf44
4c6635ede50dd0c6ad8d788c540006a489fa33d2
refs/heads/master
2020-05-19T09:02:53.163713
2019-04-23T14:13:19
2019-04-23T14:13:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,179
java
package hu.evosoft.javasetraining.multithreading.customexamples; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.locks.ReentrantReadWriteLock; public class ReadWriteLockExample { public static void main(String[] args) { ExecutorService es = Executors.newFixedThreadPool(2); ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); Map<String, String> map = new HashMap<>(); es.submit(() -> { lock.writeLock().lock(); try { Thread.sleep(2000); System.out.println("Writer thread name: "+Thread.currentThread().getName()); map.put("a", "b"); } catch (Exception e) { e.printStackTrace(); } finally { lock.writeLock().unlock(); } }); Runnable readTask = () -> { lock.readLock().lock(); try { System.out.println("Reader thread name: "+Thread.currentThread().getName()+"/"+map.get("a")); Thread.sleep(2000); } catch (Exception e) { e.printStackTrace(); } finally { lock.readLock().unlock(); } }; es.submit(readTask); es.submit(readTask); es.shutdown(); } }
[ "attila.balogh86@gmail.com" ]
attila.balogh86@gmail.com
9ad9a27a156536ed029a665c202f2f6b2ed889b2
98cc63e0fdd58a54a979d00dd2ca739f467659f0
/libjava/fileaccessor/RubyFile.java
bad8057a9919e87427148d3e2a13f30122c68ae1
[]
no_license
simojenki/rspecjava
a8d1aef66e84225cfc74202d50671378f3271c88
8ce3cfd1da453aa89fea23d324e745c9e8f5586e
refs/heads/master
2016-09-05T22:39:00.422106
2007-12-31T07:12:20
2007-12-31T07:12:20
11,320
1
0
null
null
null
null
UTF-8
Java
false
false
80
java
/** * */ package fileaccessor; public interface RubyFile { Object open(); }
[ "simon@vadar.(none)" ]
simon@vadar.(none)
305042ae27677b7c107d6e38e24b21e98cf4e9ad
372ced47bce0105545d47e637e28662daf089fa0
/src/main/java/com/shapes/model/Triangle.java
a7b6164d6799eed031f20b11e6882252365ac412
[]
no_license
SimonasKa/shapes-console-app
5afaf4f191aa72251d3df20b97f187ff54cbbeef
544471d19ffbf829371e115b5b9987448ccbad28
refs/heads/master
2020-03-24T22:57:27.385823
2018-08-01T05:59:15
2018-08-01T05:59:15
142,350,015
0
0
null
null
null
null
UTF-8
Java
false
false
1,979
java
package com.shapes.model; import java.util.ArrayList; public class Triangle extends Shape{ private int inputCount = 7; private ArrayList<Coordinate> vertices; public Triangle(){} public Triangle(ArrayList<Coordinate> vertices) { this.vertices = vertices; } public void setVertices(ArrayList<Coordinate> vertices) { this.vertices = vertices; } public ArrayList<Coordinate> getVertices() { return this.vertices; } public String getCreationText() { return "triangle with vertice 1 at (" + this.vertices.get(0).getX() + ", " + this.vertices.get(0).getY() + ") and" + " vertice 2 at (" + this.vertices.get(1).getX() + ", " + this.vertices.get(1).getY() +") and" + " vertice 3 at (" + this.vertices.get(2).getX() + ", " + this.vertices.get(2).getY() +")"; } public double getS() { return vertices.get(0).getX()*(vertices.get(1).getY() - vertices.get(2).getY()) + vertices.get(1).getX()*(vertices.get(2).getY() - vertices.get(0).getY()) + vertices.get(2).getX()*(vertices.get(0).getY() - vertices.get(1).getY()); } public void isCoordinateInArea(Coordinate coordinate) { double w1 = ( vertices.get(0).getX()*( vertices.get(2).getY()-vertices.get(0).getY() ) + ( coordinate.getY() - vertices.get(0).getY() ) * ( vertices.get(2).getX() - vertices.get(0).getX() ) - coordinate.getX() * ( vertices.get(2).getY() - vertices.get(0).getY() ) ) / ( ( vertices.get(1).getY() - vertices.get(0).getY() ) * ( vertices.get(2).getX() - vertices.get(0).getX() ) - ( vertices.get(1).getX() - vertices.get(0).getX() ) * ( vertices.get(2).getY() - vertices.get(0).getY() ) ); double w2 = ( coordinate.getY() - vertices.get(0).getY() - w1 * ( vertices.get(1).getY() - vertices.get(0).getY() ) ) / ( vertices.get(2).getY() - vertices.get(0).getY() ); if(w1 >= 0 && w2 >= 0 && (w1 + w2 ) <= 1) { this.result = true; } else { this.result = false; } } public int getInputCount() { return inputCount; } }
[ "Kakanauskas@gmail.com" ]
Kakanauskas@gmail.com
f5015eb8229c4fd61717b8515b39de88a6db4627
7ca1506b87ef973bb31c3c8b2745380e3a2aa552
/src/com/SystemeEnchere/metier/Offer.java
e151330699abc6d2c3a029e1b214e62d78296a07
[]
no_license
GROUPE-4A-NICLOUX-BUDIN-EL-OUARIEGHLI/Projet_java
bf71354bb4dfc18383b3b254436c31e46a89cea9
7de8303ad2d3a530b65aec3125c84e439ccc9bcc
refs/heads/master
2020-04-29T10:40:36.350144
2014-03-25T22:05:41
2014-03-25T22:05:41
null
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
858
java
package com.SystemeEnchere.metier; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import com.SystemeEnchere.metier.SimpleUserFactory.User; public class Offer implements IOffer { private double amount = 0.00; private IUser user; private Date date; private DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); public Offer(IUser user, double amount) { this.amount = amount; this.user = user; Calendar calendar = Calendar.getInstance(); this.date = calendar.getTime(); } public double getAmount() { return this.amount; } public IUser getSender() { return this.user; } public Date getDate() { return this.date; } public String toString() { return dateFormat.format(this.date) + " " + user.getLogin() + " " + this.amount + "€"; } }
[ "budin@et.esiea.fr" ]
budin@et.esiea.fr
ed846c622d5f0e8a7fbaf781863c9ca02359daad
9ba42ae9c263a40631761fc9ff66e92c0cbd7ae5
/src/main/java/com/fatp/enums/DelStatus.java
76121672891cf36df0e5f74cb0f1ae6851bea731
[]
no_license
skyflyczy/fatp
6254dcbc9613be191172970b8094cb98248d4656
bbd4b5fece1c211f0f8860029fc7cf3db914f52e
refs/heads/master
2020-03-20T13:29:41.012267
2018-08-17T07:32:29
2018-08-17T07:32:29
137,457,521
0
0
null
null
null
null
UTF-8
Java
false
false
173
java
package com.fatp.enums; public enum DelStatus { 正常(1), 删除(0); public int value; private DelStatus(Integer value) { this.value = value; } }
[ "zhiya.chai@192.168.56.1" ]
zhiya.chai@192.168.56.1
07f309e3dee04a41369bbd3948174c0d77590c3b
25b360302efe12b426438e6df253766c021e4ba5
/src/no/ntnu/item/ttm4160/sunspot/runtime/util/LocalMessageEventType.java
367194467c84092298defdd85f7cb9c5fbc7c7d5
[]
no_license
jornane/ttm4160
03d4fe8daedb532dfd8fe91935571d00fcb2a2a4
ff5913ff26707a35a54055c203ade77d3a3a4092
refs/heads/master
2016-09-06T19:42:25.910267
2013-11-21T19:53:34
2013-11-21T19:53:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,731
java
package no.ntnu.item.ttm4160.sunspot.runtime.util; import no.ntnu.item.ttm4160.example.CommunicatingStateMachine; import no.ntnu.item.ttm4160.sunspot.communication.Message; import no.ntnu.item.ttm4160.sunspot.runtime.Event; import no.ntnu.item.ttm4160.sunspot.runtime.IEventType; /** * EventType to indicate interest in a LocalMessageEvent. * This should be used by a state machine to either indicate interest in messages directly sent to it, * or to indicate interest in broadcast messages. * However, it can also be used to intercept messages to other state machines, * if the state machine object is available to the interscepting state machine. */ public class LocalMessageEventType implements IEventType { /** * EventType which indicates interest in messages which have broadcast as recipient. */ public final static IEventType BROADCAST = new LocalMessageEventType(); /** * This EventType matches messages with this machine as the recipient. * If null, it matches messages with broadcast as recipient (see {@link #BROADCAST}). */ public final CommunicatingStateMachine machine; /** * Construct a new MessageEvent Type. * It will match on a receiver. * * @param machine the receiver */ public LocalMessageEventType(CommunicatingStateMachine machine) { if (machine == null) throw new NullPointerException(); this.machine = machine; } private LocalMessageEventType() { machine = null; } public boolean matches(Event event) { return event instanceof LocalMessageEvent && (machine == null ? Message.BROADCAST_ADDRESS : (CommunicatingStateMachine.getMacAddress()+":"+machine.hashCode()) ).equals(((LocalMessageEvent)event).message.getReceiver()) ; } }
[ "git@yorn.priv.no" ]
git@yorn.priv.no
e64e0c07310aceff565ee8cf88865b299b413afe
c0df0d8f5f474b009949149aa261454c5b6a7e89
/src/main/java/com/example/alok/kilkari/Register.java
f3b6fea595c007a89d7fc44f62f58ed1dd3a67f3
[]
no_license
alokrkmv/1000-Days
acb97c23b8dfd33ad5f6d9ad86b67e3d58a798ba
6dd09d86b5a9bf0699d9e074395c01bb34de4673
refs/heads/master
2021-01-24T11:45:14.801894
2020-11-08T07:12:05
2020-11-08T07:12:05
123,098,451
0
0
null
null
null
null
UTF-8
Java
false
false
4,561
java
package com.example.alok.kilkari; import android.app.FragmentTransaction; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.EditText; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; public class Register extends AppCompatActivity { private EditText nameField; private EditText phonenoField; private EditText emailField; private EditText passwordField; private EditText duedateField; private FirebaseAuth mAuth; private DatabaseReference mDatabase; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); nameField=(EditText)findViewById(R.id.name); phonenoField=(EditText)findViewById(R.id.phoneno); emailField=(EditText)findViewById(R.id.email); passwordField=(EditText)findViewById(R.id.password); duedateField=(EditText)findViewById(R.id.dueDate); String name= nameField.getText().toString().trim(); String email= emailField.getText().toString().trim(); mAuth=FirebaseAuth.getInstance(); mDatabase= FirebaseDatabase.getInstance().getReference().child("Users"); } public void onStart(){ super.onStart(); EditText txtDate=(EditText)findViewById(R.id.dueDate); txtDate.setOnFocusChangeListener(new View.OnFocusChangeListener(){ public void onFocusChange(View view, boolean hasfocus){ if(hasfocus){ DateDialog dialog=new DateDialog(view); FragmentTransaction ft =getFragmentManager().beginTransaction(); dialog.show(ft, "DatePicker"); } } }); } public void registerButtonClicked(View view){ final String name= nameField.getText().toString().trim(); final String phoneno= phonenoField.getText().toString().trim(); final String email= emailField.getText().toString().trim(); final String password= passwordField.getText().toString().trim(); final String duedate= duedateField.getText().toString().trim(); Users user=new Users(); user.setEmail(email); user.setName(name); if(!TextUtils.isEmpty(name) && !TextUtils.isEmpty(email) && !TextUtils.isEmpty(phoneno) && !TextUtils.isEmpty(password)){ mAuth.createUserWithEmailAndPassword(email,password).addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if(task.isSuccessful()){ String user_id=mAuth.getCurrentUser().getUid(); DatabaseReference current_user_db=mDatabase.child(user_id); current_user_db.child("Name").setValue(name); current_user_db.child("Image").setValue("default"); current_user_db.child("Email").setValue(email); Toast.makeText(Register.this,"Registration Successfull",Toast.LENGTH_LONG).show(); Intent mainIntent=new Intent(Register.this,Login.class); mainIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(mainIntent); } else { Toast.makeText(Register.this,"You are already Registerd",Toast.LENGTH_LONG).show(); } } }); } else{ Toast.makeText(Register.this,"Complusory Fields can't be empty",Toast.LENGTH_LONG).show(); } } public void saveInfo(View view){ SharedPreferences sharedPreferences=getSharedPreferences("userInfo", Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString("username",nameField.getText().toString()); editor.putString("email",emailField.getText().toString()); editor.apply(); } }
[ "alokrkmv12@gmail.com" ]
alokrkmv12@gmail.com
bdcb7bef6bf14672e5edbf3851504e2440a96d5a
a2493706a4e7b2e12dd824c4a56e125097c1bb45
/src/main/java/com/wisely/ch9_1/domain/SysUser.java
5c3269f5e8f47c3837461a5c000ac782b8301789
[]
no_license
Ma5k/SpringStudy_9_1
d96d7053ed4966499e17fc3d5b62871a13ba20da
1db2bbee37890cfaa8de1be850221e3c6f03fe47
refs/heads/master
2020-04-08T08:04:37.698120
2018-11-26T12:13:25
2018-11-26T12:13:25
159,164,068
0
0
null
null
null
null
UTF-8
Java
false
false
2,146
java
package com.wisely.ch9_1.domain; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.ManyToMany; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; @Entity public class SysUser implements UserDetails { //1、让我们的用户实体实现UserDetails接口,我们的用户实体即为SpringSecurity所使用的用户。 private static final long serialVersionUID = 1L; @Id @GeneratedValue private Long id; private String username; private String password; @ManyToMany(cascade= {CascadeType.REFRESH}, fetch=FetchType.EAGER) //2、配置用户和角色的多对多关系。 private List<SysRole> roles; public Collection<? extends GrantedAuthority> getAuthorities() { //3、重写getAuthorities方法,将用户的角色作为权限 List<GrantedAuthority> auths = new ArrayList<GrantedAuthority>(); List<SysRole> roles = this.getRoles(); for(SysRole role:roles) { auths.add(new SimpleGrantedAuthority(role.getName())); } return auths; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public List<SysRole> getRoles() { return roles; } public void setRoles(List<SysRole> roles) { this.roles = roles; } public boolean isAccountNonExpired() { return true; } public boolean isAccountNonLocked() { return true; } public boolean isCredentialsNonExpired() { return true; } public boolean isEnabled() { return true; } }
[ "2421697126@qq.com" ]
2421697126@qq.com
b8a0168ec0744c2658a087e9b016335155914830
4e91e0220cfc734491b69fe8f33a29ffa62ce966
/jOOQ/src/main/java/org/jooq/impl/SetCommand.java
37830b5e02f9f1d25105de21df214c3a31a64fe5
[ "Apache-2.0" ]
permissive
elenaem26/jOOQ
7dc4108a4e917d3bc7b59324a415145d9af087a3
56dda2b08d420c64469a9ac7bc7d3fb15e842919
refs/heads/main
2023-01-19T20:03:58.947915
2020-11-18T16:32:45
2020-11-18T16:32:45
313,946,107
0
0
NOASSERTION
2020-11-18T13:39:07
2020-11-18T13:39:06
null
UTF-8
Java
false
false
2,020
java
/* * 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. * * Other licenses: * ----------------------------------------------------------------------------- * Commercial licenses for this work are available. These replace the above * ASL 2.0 and offer limited warranties, support, maintenance, and commercial * database integrations. * * For more information, please visit: http://www.jooq.org/licenses * * * * * * * * * * * * * * * * */ package org.jooq.impl; import static org.jooq.impl.Keywords.K_SET; import org.jooq.Configuration; import org.jooq.Context; import org.jooq.Name; import org.jooq.Param; /** * A <code>SET</code> command. * * @author Lukas Eder */ final class SetCommand extends AbstractRowCountQuery { /** * Generated UID */ private static final long serialVersionUID = -6018875346107141474L; private final Name name; private final Param<?> value; SetCommand(Configuration configuration, Name name, Param<?> value) { super(configuration); this.name = name; this.value = value; } final Name $name() { return name; } final Param<?> $value() { return value; } // ------------------------------------------------------------------------ // XXX: QueryPart API // ------------------------------------------------------------------------ @Override public final void accept(Context<?> ctx) { ctx.visit(K_SET).sql(' ').visit(name).sql(" = ").visit(value); } }
[ "lukas.eder@gmail.com" ]
lukas.eder@gmail.com
121d06bbaab9301809c6420185b6907691298de2
cf84bf23935428796f6d3a4139f20f92bab7d9a6
/Java/Java-Spring/Counter/src/main/java/com/ghazal/counter/CounterApplication.java
9dc34d58b9f15c198ac974d86a23063e55204cd8
[]
no_license
Ghazalsal/Java-Stack
b45580a7ff64250dbffda32d4d4467ca44c5c065
5554d0fe5e653b35d6930657f555e92a691da7c2
refs/heads/master
2023-06-11T19:54:47.184205
2021-07-03T07:27:41
2021-07-03T07:27:41
375,278,836
2
0
null
null
null
null
UTF-8
Java
false
false
313
java
package com.ghazal.counter; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class CounterApplication { public static void main(String[] args) { SpringApplication.run(CounterApplication.class, args); } }
[ "g_antar_n@hotmail.com" ]
g_antar_n@hotmail.com
12365be8d4c337a300c6f8e7a67b617f9929dde2
3f8b769f67b30722af70fb0030c90f68bb1d0103
/src/main/java/programing2/wallet/Person.java
97bd52709611cca4a4e28b2bc369b20253273677
[]
no_license
rimmugygr/SDAJava
61fff94e2d113a8892b9502bc1f3f980769790df
6b612b12a123e75c89d83620fccd1e08c5e7c93a
refs/heads/master
2022-12-11T22:32:52.009948
2020-09-21T15:47:36
2020-09-21T15:47:36
236,321,105
1
0
null
2022-11-23T11:26:44
2020-01-26T14:10:57
HTML
UTF-8
Java
false
false
6,100
java
package programing2.wallet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.*; import java.util.stream.Collectors; public class Person { private static final Logger LOGGER = LoggerFactory.getLogger(Main.class); private String firstName; private String lastName; private Wallet wallet; private Set<String> itemsHave; private Set<Offer> itemsToBuy; private Set<Offer> itemsToSell; public Person(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; this.wallet = new Wallet(); this.itemsHave = new HashSet<>(); this.itemsToBuy = new HashSet<>(); this.itemsToSell = new HashSet<>(); } public Person(String firstName, String lastName, Wallet wallet) { this(firstName,lastName); this.wallet = wallet; } public void addItem(String name){ LOGGER.info(this.firstName + " add item: " + name); this.itemsHave.add(name); this.itemsToBuy.remove(new Offer(name,null)); } public void addItemToBuy(Offer offer){ LOGGER.info(this.firstName + " add offer: " + offer); this.itemsToBuy.add(offer); } public void addItemToSell(Offer offer){ if (this.itemsHave.contains(offer.getName())) { this.itemsToSell.add(offer); } else { LOGGER.warn(this.firstName + " dont add offer because dont have item: " + offer.getName()); } } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public boolean transactionAllItem(Person sellingPerson) { // check is items to trade Set<String> itemsName = this.itemsToBuy.stream() .map(Offer::getName) .filter(sellingPerson::isItemToSell) .collect(Collectors.toSet()); // if no items to transaction return false if (itemsName.isEmpty()) return false; // check offer Map<String, Cash> resultTransaction = Offer.getSucceedOfferOnItem(itemsName, this.itemsToBuy, sellingPerson.getItemsToSell()); // if person have not enough money to give return transactionMoneysAndItems(sellingPerson, resultTransaction); } public boolean transactionItem(Person sellingPerson, String item) { if (item==null) return false; // check offer Map<String, Cash> resultTransaction = Offer.getSucceedOfferOnItem(Set.of(item), this.itemsToBuy, sellingPerson.getItemsToSell()); return transactionMoneysAndItems(sellingPerson, resultTransaction); } private boolean transactionMoneysAndItems(Person sellingPerson, Map<String, Cash> resultTransaction) { // if person have not enough money to give if (resultTransaction.isEmpty()) return false; // trade accepted money for item for (String name : resultTransaction.keySet()) { transactionMoneyAndItem(sellingPerson, resultTransaction.get(name), name); } return true; } private void transactionMoneyAndItem(Person sellingPerson, Cash cashGiven, String name) { // check is enough money in wallet if (this.giveCashTo( sellingPerson, cashGiven)) { // when not give item then take money back if(sellingPerson.removeItem(name)){ this.addItem(name); } else { sellingPerson.giveCashTo(this, cashGiven);// todo } } } private boolean removeItem(String name) { LOGGER.info(this.firstName + " remove item: " + name); boolean result = this.itemsHave.remove(name); this.itemsToSell.remove(new Offer(name,null)); return result; } public boolean isItemToSell(String name){ return this.itemsToSell.stream().map(Offer::getName).anyMatch(name::equals); } private boolean transactionMoney(Person sourcePerson, Person targetPerson, Cash cashGiven) { boolean isRemovedFromSourcePerson = sourcePerson.removeMoney(cashGiven); if (isRemovedFromSourcePerson) { targetPerson.addMoney(cashGiven); LOGGER.info(sourcePerson.getFirstName() + " give to " + targetPerson.getFirstName() + " " + cashGiven.toString()); return true; } else { LOGGER.info(sourcePerson.getFirstName() + " not give to " + targetPerson.getFirstName() + " " + cashGiven.toString()); return false; } } public boolean giveCashTo(Person targetPerson, Cash cashGiven) { return this.transactionMoney(this, targetPerson, cashGiven); } public boolean removeCashFrom(Person sourcePerson, Cash cashGiven) { return this.transactionMoney(sourcePerson, this, cashGiven); } public boolean addMoney(Cash cash) { if(this.wallet.addCash(cash)){ LOGGER.info(this.getFirstName() + " get " + cash.toString()); return true; } else { LOGGER.warn(this.getFirstName() + " dont get " + cash.toString()); return false; } } public boolean removeMoney(Cash cash) { if(this.wallet.removeCash(cash)){ LOGGER.info(this.getFirstName() + " remove " + cash.toString() + " from wallet"); return true; } else { LOGGER.warn(this.getFirstName() + " dont have " + cash.toString()); return false; } } public Wallet getWallet() { return wallet; } public void setWallet(Wallet wallet) { this.wallet = wallet; } public Set<Offer> getItemsToBuy() { return itemsToBuy; } public Set<Offer> getItemsToSell() { return itemsToSell; } @Override public String toString() { return "Person " + "firstName " + firstName + " wallet " + wallet + " itemsHave " + itemsHave + " itemsToBuy " + itemsToBuy + " itemsToSell " + itemsToSell; } }
[ "rimmugygr@gmail.com" ]
rimmugygr@gmail.com
dfa4d6b2251f1ec956ac5bf5f1c6d9197ba164bc
50120f7029a982ca66d6c45b5daef455994fb299
/oops/CellosignaturePen.java
1fde824f6de842cdacdc901b8fafbe238f2ec111
[]
no_license
Ushamuni/core_java
a32bd8f365cacb45b04fad5ea5fb0da01b0f9205
79d69488772bb7918d5164b10b1df16830885059
refs/heads/main
2023-08-02T08:16:26.039377
2021-10-01T10:09:03
2021-10-01T10:09:03
407,140,773
0
0
null
null
null
null
UTF-8
Java
false
false
829
java
package com.xworkz.oops; public class CellosignaturePen { public static void main(String[] args) { Pen Cellopen =new Pen(); Cellopen.brand="Cello"; Cellopen.price=200; Cellopen.color="blue"; Cellopen.model="pen"; System.out.println(Cellopen.brand); System.out.println(Cellopen.price); System.out.println(Cellopen.color); System.out.println(Cellopen.model); Cellopen.write(); System.out.println(""); Pen Cellopen_1 =new Pen(); Cellopen_1.brand="Inkpen"; Cellopen_1.price=100; Cellopen_1.color="black"; Cellopen_1.model="pen"; System.out.println(Cellopen_1.brand); System.out.println(Cellopen_1.price); System.out.println(Cellopen_1.color); System.out.println(Cellopen_1.model); Cellopen_1.write(); } }
[ "noreply@github.com" ]
Ushamuni.noreply@github.com
cf520363a19a29f0da97f6ba97dd8aa829efa839
47e870f42f5c979f22294d094bdbaf1eb8241c3a
/app/src/test/java/com/example/android/blablarobot/ExampleUnitTest.java
5f14e7b03ea358ab6c33254a7d638f3b8fa28334
[]
no_license
pr0gr/LearnToRead
05d6d224aebaed8adee40d3b078d7dd93614d3f6
264b221479ff4286515e90659dc1913af9ff6fee
refs/heads/master
2021-01-10T05:18:39.679679
2015-11-08T19:42:51
2015-11-08T19:42:51
45,789,783
0
0
null
null
null
null
UTF-8
Java
false
false
324
java
package com.example.android.blablarobot; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "rrrominus@gmail.com" ]
rrrominus@gmail.com
39456205a11a19b92fde8b9dcb3c50cd0436d782
32017cae62d4bda13e9e7506ee3e417db9b47204
/service-proxy/src/test/java/com/microService/demo/ServiceProxyApplicationTests.java
b167a498ac15b49e09808feb201953fbbfbe6ff2
[]
no_license
LamiaMessaoudi/DemoMicroServices
b78d4a8620affb91e7750cbe25ac14f186674a8e
9c863e194429b11503d427292fd29a7b96c96482
refs/heads/master
2021-01-05T00:40:25.150218
2020-02-16T02:18:12
2020-02-16T02:18:12
240,817,941
0
0
null
null
null
null
UTF-8
Java
false
false
219
java
package com.microService.demo; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class ServiceProxyApplicationTests { @Test void contextLoads() { } }
[ "Lamyyamessaoudi@gmail.com" ]
Lamyyamessaoudi@gmail.com
0a648d20987a5ab801f6555ede27f037cdbdc2e6
934cfdcbdb10c6c0e5c78129c1f5fdfeb8f46953
/system_management/src/main/java/com/sicnu/system_management/pojo/PatentRange.java
61b1a975bacc54d3e58453f18750ee76583cc437
[]
no_license
kin-dep/scientific_management_cloud
5f3d7a6989c7b7b7a29e8ad870f111cee8128e89
31e6f7c1661558ee0bfd4cf2e1fd8811cdea8a71
refs/heads/master
2023-02-17T07:52:04.327623
2021-01-17T11:04:51
2021-01-17T11:04:51
330,103,106
0
0
null
null
null
null
UTF-8
Java
false
false
626
java
package com.sicnu.system_management.pojo; /** * 专利范围 */ public class PatentRange { private Integer pr_id; private String pr_name; public Integer getPr_id() { return pr_id; } public void setPr_id(Integer pr_id) { this.pr_id = pr_id; } public String getPr_name() { return pr_name; } public void setPr_name(String pr_name) { this.pr_name = pr_name; } @Override public String toString() { return "PatentRange{" + "pr_id=" + pr_id + ", pr_name='" + pr_name + '\'' + '}'; } }
[ "1102537075@qq.com" ]
1102537075@qq.com
6d475f0b4b7513aade896b4e9bfaeb05982fbd46
f6aae7ccb45336b5d796f41ab60d5df285e8631f
/src/strings/UsingStringBuilder.java
806454b3fc177e901d693aadfd9b7c7d94476215
[]
no_license
Ptoyamegg/TinJava
1f81f35bc431c917e0127d909a2c4016f3fab21e
1c044dd5fa5a551c9398220b602d7cc6dda363a2
refs/heads/master
2020-07-03T02:30:02.206073
2020-02-18T06:20:58
2020-02-18T06:20:58
201,757,205
1
0
null
null
null
null
UTF-8
Java
false
false
675
java
package strings; import java.util.Random; /** * @author PhotoYamEgg * @date 2019/9/8 - 14:46 */ public class UsingStringBuilder { public static Random random = new Random(47); public String toString(){ StringBuilder result = new StringBuilder("["); for (int i = 0; i < 25; i++) { result.append(random.nextInt(100)); result.append(", "); } result.delete(result.length() - 2, result.length()); result.append("]"); return result.toString(); } public static void main(String[] args) { UsingStringBuilder usb = new UsingStringBuilder(); System.out.println(usb); } }
[ "1345133130@qq.com" ]
1345133130@qq.com
97654ff0b70a830b6c43d79a3673545b66c108d5
4f89f18fd9a435d39d4f37539381e4bfa52ca4c3
/Portafolios/src/main/java/ar/com/federicomorenorodriguez/sitio/repository/RoleRepository.java
6872c88cae415791c1356c169ec9d3d69f6ce184
[]
no_license
FedeMR21/portafolios-mvc
a6a5b8a2f690491ee04438448eccd105769bafb6
bfb2ef36c4980d818393e9eafaad63a5e73ea8b0
refs/heads/main
2023-03-31T11:41:44.580231
2021-04-10T04:27:15
2021-04-10T04:27:15
354,423,324
0
0
null
null
null
null
UTF-8
Java
false
false
360
java
package ar.com.federicomorenorodriguez.sitio.repository; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import ar.com.federicomorenorodriguez.sitio.entity.Role; @Repository public interface RoleRepository extends CrudRepository<Role, Long> { public Role findByName(String name); }
[ "72584280+FedeMR21@users.noreply.github.com" ]
72584280+FedeMR21@users.noreply.github.com
710b0f999e7a5b76008a4ef9cd1e22ecca30ae01
f0a2e8fb8f46da4d022dbd96539a385a0749931d
/YarnApplication/src/main/java/com/example/yarnapplication/helpers/Consts.java
847a76105dd82cbbcb8d22773bd631ad80080ee8
[]
no_license
aqib1/spring-yarn-application
569668d94dc2cadfc3b2ca161841526a10f71479
365a3418e443f389baa8d882820dfba1bd0e8ed5
refs/heads/master
2020-08-04T13:00:11.831474
2019-10-04T04:32:49
2019-10-04T04:32:49
212,144,155
1
0
null
null
null
null
UTF-8
Java
false
false
1,039
java
package com.example.yarnapplication.helpers; import java.util.Objects; public class Consts { public static final String HEADER_OF_FILE = "id,date_time,site_name,posa_continent,user_location_country,user_location_region,user_location_city,orig_destination_distance,user_id,is_mobile,is_package,channel,srch_ci,srch_co,srch_adults_cnt,srch_children_cnt,srch_rm_cnt,srch_destination_id,srch_destination_type_id,hotel_continent,hotel_country,hotel_market"; public static final String SORTED_DIR = "_SORTED"; public static final String RESULT_MR_RESULT_NAME = "part-r-00000"; public static final int INDEX_SRCH_ADULTS_CNT = 14; public static final int INDEX_HOTEL_CONTINENT = 19; public static final int INDEX_HOTEL_COUNTRY = 20; public static final int INDEX_HOTEL_MARKET = 21; public static <T> boolean isNullOrEmptyArray(T [] arr) { return Objects.isNull(arr) || arr.length == 0; } public static final boolean isNullOrEmptyString(String val) { return Objects.isNull(val) || val.isEmpty(); } private Consts() { } }
[ "aqibbutt3078@gmail.com" ]
aqibbutt3078@gmail.com
e6aba20fe66e8206b8c438777611ad27e24c0a18
dcc16939ec9b9985a3d51ccc2dfcbd073ec5e63b
/src/j03GenericCollection/CollectionMethodsTest.java
578f02c90bf88edbc440a316a38ade60c48d1973
[]
no_license
emnglang/java-lab
f7660661dbcb17960bad1bd3ddea01859b629c9b
fd5071c155657149d122d713d95a604e4e8fd16d
refs/heads/master
2020-03-23T18:49:42.628664
2018-07-24T13:16:04
2018-07-24T13:16:04
141,933,960
0
0
null
null
null
null
UTF-8
Java
false
false
2,111
java
package j03GenericCollection; import java.util.*; import static j03GenericCollection.StaticTestData.*; public class CollectionMethodsTest { public static void main(String[] args) { mondayTasks.add(new PhoneTask("Ruth", "567 1234")); assert mondayTasks.toString().equals( "[code logic, phone Mike, phone Ruth]"); Collection<Task> allTasks = new ArrayList<Task>(mondayTasks); allTasks.addAll(tuesdayTasks); assert allTasks.toString().equals( "[code logic, phone Mike, phone Ruth, code db, code gui, phone Paul]"); boolean wasPresent = mondayTasks.remove(mikePhone); assert wasPresent; assert mondayTasks.toString().equals("[code logic, phone Ruth]"); mondayTasks.clear(); assert mondayTasks.toString().equals("[]"); Collection<Task> tuesdayNonphoneTasks = new ArrayList<Task>(tuesdayTasks); tuesdayNonphoneTasks.removeAll(phoneTasks); assert tuesdayNonphoneTasks.toString().equals("[code db, code gui]"); Collection<Task> phoneTuesdayTasks = new ArrayList<Task>(tuesdayTasks); phoneTuesdayTasks.retainAll(phoneTasks); assert phoneTuesdayTasks.toString().equals("[phone Paul]"); Collection<PhoneTask> tuesdayPhoneTasks = new ArrayList<PhoneTask>(phoneTasks); tuesdayPhoneTasks.retainAll(tuesdayTasks); assert tuesdayPhoneTasks.toString().equals("[phone Paul]"); assert tuesdayPhoneTasks.contains(paulPhone); assert tuesdayTasks.containsAll(tuesdayPhoneTasks); assert mondayTasks.isEmpty(); assert mondayTasks.size() == 0; // throws ConcurrentModificationException for (Task t : tuesdayTasks) { if (t instanceof PhoneTask) { tuesdayTasks.remove(t); } } // throws ConcurrentModificationException for (Iterator<Task> it = tuesdayTasks.iterator() ; it.hasNext() ; ) { Task t = it.next(); if (t instanceof PhoneTask) { tuesdayTasks.remove(t); } } for (Iterator<Task> it = tuesdayTasks.iterator() ; it.hasNext() ; ) { Task t = it.next(); if (t instanceof PhoneTask) { it.remove(); } } } }
[ "38192988+jameslin168@users.noreply.github.com" ]
38192988+jameslin168@users.noreply.github.com
364ca7ef5fd6c204a6257456a89c7104d4f0e815
59661e918d9cd1a569bfff8e7b875317a3c1c788
/MMALL_Category_Service/src/main/java/com/mmall/dao/CategoryMapper.java
3365138fad1473eeae0f296d3509bbf4c5bddc22
[]
no_license
zry0225/MMALL_SOA
da8834128b72baf42eafec57a42f07c24599e91d
6d1fb852ba657e6ea3827ae5b1153d6de093e785
refs/heads/master
2023-07-27T18:37:40.988121
2021-09-14T13:57:07
2021-09-14T13:57:07
406,334,996
0
0
null
null
null
null
UTF-8
Java
false
false
844
java
package com.mmall.dao; import com.google.common.collect.Lists; import com.mmall.pojo.Category; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface CategoryMapper { int deleteByPrimaryKey(Integer id); int insert(Category record); int insertSelective(Category record); // Category selectByPrimaryKey(Integer id); int updateByPrimaryKeySelective(Category record); int updateByPrimaryKey(Category record); List<Category> getCategory(int categoryId); int addCategory(@Param("parentId") Integer parentId,@Param("categoryName") String categoryName); int setCategoryName(@Param("categoryId") Integer categoryId,@Param("categoryName") String categoryName); List<String> getDeepCategory(Integer categoryId); }
[ "15738484566@163.com" ]
15738484566@163.com
20dc5a456fb294fc2d083fd82751d987a970db50
5e00748d5f4d89fd2b215609fe3460b2fdb7f9d9
/src/textmatching/alignmentverification/VerifiedAlignment.java
d8afc625886ba29e751dc2f2df67b17c585218ae
[]
no_license
hanvanderaa/inconsistenciesmodeltext
74614042fd26d752787f04eb6acd5573d56bdb30
007a1e3909d75305ef0729f56d0c715978a446fa
refs/heads/master
2020-09-25T00:02:28.152874
2016-08-22T00:28:14
2016-08-22T00:28:14
66,227,386
0
0
null
null
null
null
UTF-8
Java
false
false
2,405
java
package textmatching.alignmentverification; import java.io.Serializable; import java.util.HashMap; import java.util.Map; import java.util.Set; import textmatching.matching.config.MatchingConfig; import textmatching.processmodel.Activity; public class VerifiedAlignment implements Serializable { /** * */ private static final long serialVersionUID = -8397636607731562501L; Map<Activity, ActivityVerification> verificationMap; String name; MatchingConfig config; public VerifiedAlignment(String name, MatchingConfig config) { this.name = name; this.config = config; verificationMap = new HashMap<Activity, ActivityVerification>(); } public void addVerification(ActivityVerification verification) { verificationMap.put(verification.getActivity(), verification); } public Set<Activity> getActivities() { return verificationMap.keySet(); } public ActivityVerification getVerification(Activity activity) { return verificationMap.get(activity); } public int getActivityCount() { return verificationMap.size(); } public int countStatus(VerificationStatus status) { int n = 0; for (ActivityVerification verif : verificationMap.values()) { if (verif.getStatus().equals(status)) { n++; } } return n; } public int getAlignedActivitiesCount() { return countStatus(VerificationStatus.CORRECTMATCH) + countStatus(VerificationStatus.FALSEMATCH) + countStatus(VerificationStatus.WRONGSENTENCE); } public int correctAligned() { return countStatus(VerificationStatus.CORRECTMATCH); } public int totalAligned() { return getAlignedActivitiesCount(); } public int shouldbeAligned() { return correctAligned() + countStatus(VerificationStatus.WRONGSENTENCE) + countStatus(VerificationStatus.MISSEDMATCH); } public double getPrecision() { if (totalAligned() > 0) { return 1.0 * correctAligned() / totalAligned(); } return 0.0; } public double getRecall() { if (shouldbeAligned() > 0) { return 1.0 * correctAligned()/ shouldbeAligned(); } return 0.0; } public double getFmeasure() { double precision = getPrecision(); double recall = getRecall(); if (precision > 0.0 && recall > 0.0) { return 2 * (precision * recall) / (precision + recall); } return 0.0; } public String getName() { return name; } public MatchingConfig getConfig() { return config; } }
[ "han@Hans-MacBook-Pro.local" ]
han@Hans-MacBook-Pro.local
876c02741da4af655a330af7a07bc42be23c809a
fa7e9ebdebf90371ad35c7b6851cce4e51098d95
/src/Red.java
f642e5c0085591a2ea565db2784e2165760c0602
[]
no_license
zhangxin818/AirCombatSystem
0451d62296c475ce8962bda12e506cd6c582ecb9
23d27a54ef8c94ed263a66129a29597028b3bfd3
refs/heads/master
2020-03-12T21:19:25.749183
2018-04-24T09:02:04
2018-04-24T09:02:04
130,825,874
0
0
null
null
null
null
UTF-8
Java
false
false
7,754
java
/** * Created by Administrator on 2017/12/27. */ /** * @Author zhangxin * @Date 2017-12-27 15:17:00 * @Desciption 红军类 **/ enum statusForRed{ startR, flyToT, intercepted, bombsuccess, flyToR, stopR ; } enum routeForRed{ //针对红军基地,红军机群有3条路线分别为R1--T1,R2--T1,R2--T2 R1T1, R2T1, R2T2; } public class Red { statusForRed status; //红军轰炸机状态 startR--未起飞,flyToT--飞向军事目标, bombsuccess--轰炸成功, intercepted--被拦截,flyToR--返航,stopR--返航成功 R r; //红军基地 T t; //军事目标 double x; //红军x坐标 double y; // 红军y坐标 double startTime; //起飞时间 int number; //红军机群数量 int speed; //红军机群速度 double currentTime; //当前时间 double xTmp; //暂时存储下一时间节点红军的坐标 double yTmp; //暂时存储下一时间节点红军的坐标 int disturbSuccess = 0;//干扰成功次数 int bombSuccess = 0;//轰炸成功次数 /** * @Author zhangxin * @Date 2017-12-27 16:27:46 * @Desciption //红军集群构造函数 **/ Red(R r, T t, int number, double startTime, int speed) { status = statusForRed.startR; //初始化为未起飞 this.number = number; this.startTime = startTime; this.speed = speed; this.r = r; this.t = t; this.x = 0; this.y = 0; this.currentTime = 0.0; } /** * @Author zhangxin * @Date 2017-12-27 20:08:50 * @Desciption 改变红军机群的x,y坐标 **/ public void changeXY(double timeSlot, double currentTime){ if((startTime <= currentTime) && status == statusForRed.startR && number != 0){ status = statusForRed.flyToT; } if(bombSuccess()){ status = statusForRed.flyToR; } if(status.equals(statusForRed.intercepted)){ return; } calcuteXY(timeSlot); //计算出下一时间节点的坐标 switch (getRouteNum()){ case 0: if(xTmp > t.getxForRoute1()){ status = statusForRed.flyToR; calcuteXY(timeSlot); } break; case 1: if(xTmp > t.getxForRoute2()){ status = statusForRed.flyToR; calcuteXY(timeSlot); } break; case 2: if(xTmp > t.getxForRoute3()){ status = statusForRed.flyToR; calcuteXY(timeSlot); } break; } x = xTmp; y = yTmp; if((x <= 0.0) && (status != statusForRed.startR)){ status = statusForRed.stopR; } if(bombSuccess()){ status = statusForRed.bombsuccess; } // System.out.println(r.name + " " + status + " " + number + "x: " + x + " y: " + y); // System.out.println(x + " " + y); } /** * @Author zhangxin * @Date 2017-12-27 17:23:06 * @Desciption //计算红军机群这一时刻的x,y坐标,根据基地和攻击点的不同公分为6中情况。分别为 * R1--T1 攻击 * R1--T1 返航 * R2--T1 攻击 * R2--T1 返航 * R2--T2 攻击 * R2--T3 返航 **/ public void calcuteXY(double timeSlot){ if(status == statusForRed.flyToT){ //攻击方向前进 xTmp = x + timeSlot * speed; } else if(status == statusForRed.flyToR) { //返航方向 xTmp = x - timeSlot * speed; if(xTmp < 0.0){ xTmp = 0.0; } } if(t.getName().equals("T1") && r.getName().equals("R1")){//基地为R1,攻击T1 if(status == statusForRed.flyToT){ //攻击方向 yTmp = Math.sqrt((1 - Math.pow((xTmp - 15.5), 2) / Math.pow(15.5, 2)) * 25); } else if(status == statusForRed.flyToR){ //返航方向 yTmp = - Math.sqrt((1 - Math.pow((xTmp - 15.5), 2) / Math.pow(15.5, 2)) * 25); } } if(t.getName().equals("T1") && r.getName().equals("R2")){//基地为R2,攻击T1 if(status == statusForRed.flyToT) { //攻击方向 yTmp = Math.sqrt((1 - Math.pow((xTmp - 20.5), 2) / Math.pow(20.5, 2)) * 25); } else if(status == statusForRed.flyToR){ //返航方向 yTmp = - Math.sqrt((1 - Math.pow((xTmp - 20.5), 2) / Math.pow(20.5, 2)) * 25); } } if(t.getName().equals("T2") && r.getName().equals("R2")){ if(status == statusForRed.flyToT){ //攻击方向 yTmp = Math.sqrt((1 - Math.pow((xTmp - 14.5), 2) / Math.pow(14.5, 2)) * 25); } else if(status == statusForRed.flyToR){ yTmp = -Math.sqrt((1 - Math.pow((xTmp - 14.5), 2) / Math.pow(14.5, 2)) * 25); } } if(yTmp == -0.0){ yTmp = 0.0; } // System.out.println(xTmp); } public boolean bombSuccess(){ double length = 0.0; switch (getRouteNum()){ case 0: length = AirWarSystem.calTwoPointsLength(x, y, t.getxForRoute1(), t.getyForRoute1()); break; case 1: length = AirWarSystem.calTwoPointsLength(x, y, t.getxForRoute2(), t.getyForRoute2()); break; case 2: length = AirWarSystem.calTwoPointsLength(x, y, t.getxForRoute3(), t.getyForRoute3()); break; } if(length <= 1.0){ bombSuccess++; return true; } return false; } /** * @Author zhangxin * @Date 2017-12-27 21:17:30 * @Desciption 返回路线的编号 0,1,2 **/ public int getRouteNum(){ String route = getBase() + getTarget(); for(routeForRed r: routeForRed.values()){ if(route.equals(r.toString())) return r.ordinal(); } return 4; } /** * @Author zhangxin * @Date 2017/12/29 16:32 * @Description 红军被拦截 **/ public void interceptSuccess(){ number--; if(number == 0){ status = statusForRed.intercepted; //若红军数量为0,则该批红军被拦截成功 } } /** * @Author zhangxin * @Date 17/12/30 16:38 * @Description 返回红军机群的飞机数 **/ public int getNumber(){ return number; } public String toString(){ if(status.equals(statusForRed.intercepted)){ return "Base: " + r.getName() + " Target: " + t.getName() + " Status: " + status + " numberLeft: " + number; } return "Base: " + r.getName() + " Target: " + t.getName() + " Status: " + status + " Speed: " + speed + " x: "+ x + " y: " +y +" numberLeft: " + number; } /** * @Author zhangxin * @Date 2017-12-27 21:05:59 * @Desciption 返回红军机群的目标 **/ public String getTarget(){ return t.getName(); } /** * @Author zhangxin * @Date 2017-12-27 21:06:18 * @Desciption 返回红军基地 **/ public String getBase(){ return r.getName(); } public double getStartTime(){ return startTime; } public statusForRed getStatus(){ return status; } public double getX(){ return x; } public double getY(){ return y; } public double getxTmp(){ return xTmp; } public double getyTmp(){ return yTmp; } }
[ "zhangxin_xidian@163.com" ]
zhangxin_xidian@163.com
3a83b4a456aac0aecbfa53d3b7d7579e13f5a450
1f6005ea4629810ae1da30e39f1f23034f58a9f9
/12_decorator/SideBorder.java
6a7e2c772260a58dfe987706a4c6d398d57fe46c
[]
no_license
KimiyukiYamauchi/DesignPattern.2018
78aefb509f2241b3c422515579b570258f42b5a6
7a68534f505edbf3f21b2c43cef346043bbb66bb
refs/heads/master
2020-04-01T20:32:37.878687
2019-07-17T08:13:42
2019-07-17T08:13:42
153,608,593
0
0
null
null
null
null
UTF-8
Java
false
false
484
java
public class SideBorder extends Border { private char borderChar; public SideBorder(Display display, char ch) { super(display); this.borderChar = ch; } @Override public int getColumns() { return 1 + display.getColumns() + 1; } @Override public int getRows() { return display.getRows(); } @Override public String getRowText(int row) { return borderChar + display.getRowText(row) + borderChar; } }
[ "yamauchi@std.it-college.ac.jp" ]
yamauchi@std.it-college.ac.jp
aa7208c37e2a17dd47925018df99a3236eabd1e3
e5938c209955aad6fd1155b6976d4add12600f1e
/client/src/main/java/x/Result.java
d9b0f94a586af2c18be5b3eac99a56e74cdec130
[]
no_license
wcurrie/java-ssl-perf-test
d114abd43b41af46bc420d194a0f3c18d2ca2f26
6ddd1732ad016818ec088e8ad190253e09e0863c
refs/heads/master
2021-01-19T08:11:27.374151
2014-05-28T21:52:00
2014-05-28T21:52:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,515
java
package x; public class Result implements Comparable<Result> { private final long start; private final Throwable fail; private final long end; private final long connectTime; public Result(long start, long end, long connectTime) { this.start = start; this.end = end; this.connectTime = connectTime; this.fail = null; } public Result(long start, Throwable fail) { this.start = start; this.end = -1; this.connectTime = -1; this.fail = fail; } public boolean isSuccess() { return fail == null; } public long getStart() { return start; } public long getEnd() { return end; } public long getRtt() { return end == -1 ? -1 : end - start; } public long getConnectTime() { return connectTime; } public String getOutcome() { return isSuccess() ? "success" : fail.toString(); } @Override public int compareTo(Result o) { return compare(this.getStart(), o.getStart()); } // provide jdk 1.6 support ... private static int compare(long x, long y) { return (x < y) ? -1 : ((x == y) ? 0 : 1); } @Override public String toString() { return "Result{" + "start=" + start + ", end=" + end + ", rtt=" + getRtt() + ", connectTime=" + connectTime + ", fail=" + fail + '}'; } }
[ "will@currie.id.au" ]
will@currie.id.au
994a1537ba72736e214be2ee1f8cdfbabed4375d
33d1ec19acda1288ac2608f1ed8c1c4445ffc118
/src/Hippodrome.java
cad49d74fb647755f97822cfdd31bae107335ad0
[]
no_license
DimaGalchenko/Multithreaded-Game-Hippodrome
edd8cb4ae39501bec33bfae39220816aaa518f57
abbcde827cbd94b6fa9641227f31e7b8f6abe192
refs/heads/main
2023-01-14T10:12:30.433497
2020-11-15T10:51:07
2020-11-15T10:51:07
313,010,040
0
0
null
null
null
null
UTF-8
Java
false
false
1,592
java
import java.util.ArrayList; import java.util.List; public class Hippodrome { public static Hippodrome game; private List<Horse> horses; public Hippodrome(List<Horse> horses){ this.horses = horses; } public static void main(String[] args) throws InterruptedException { game = new Hippodrome(new ArrayList<>()); Horse horse1 = new Horse("Jenya",3,0); Horse horse2 = new Horse("Polina",3,0); Horse horse3 = new Horse("Andrey",3,0); game.horses = new ArrayList<>(); game.horses.add(horse1); game.horses.add(horse2); game.horses.add(horse3); game.run(); game.printWinner(); } public List<Horse> getHorses(){ return horses; } public void run() throws InterruptedException { for(int i = 1;i<101;i++){ move(); print(); Thread.sleep(200); } } public void move(){ for(Horse iter: horses){ iter.move(); } } public void print(){ for(Horse iter: horses){ iter.print(); } for(int i=0;i<11;i++){ System.out.println(""); } } public Horse getWinner(){ double max=0; Horse winner = null; for(Horse iter: horses){ if(iter.getDistance()>max){ max=iter.getDistance(); winner = iter; } } return winner; } public void printWinner(){ System.out.println("Winner is " + getWinner().getName()+"!"); } }
[ "67041075+DimaGalchenko@users.noreply.github.com" ]
67041075+DimaGalchenko@users.noreply.github.com
902a80bf13176f15a85ca338670790a407ae3ba8
5a64552580b1f8e4b613ce944d16fa6e967706ca
/client-new-features/src/main/java/com/example/cache/controller/StudentController.java
fb8281d87eb3847d1e126a29be8d8a8f143b37e1
[ "Apache-2.0" ]
permissive
alvarolop/datagrid-client
4a752ddf1678e8451ebc3904d944e00a205ae0e5
8c5f771d898f5f79620458774620782e8dbcfcf7
refs/heads/master
2022-05-01T10:18:06.960500
2019-12-17T15:36:54
2019-12-17T15:36:54
167,025,394
0
0
Apache-2.0
2022-03-31T18:59:06
2019-01-22T16:16:01
Java
UTF-8
Java
false
false
1,601
java
package com.example.cache.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.CacheManager; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.server.ResponseStatusException; import com.example.cache.model.Student; import com.example.cache.repository.StudentRepo; @RestController public class StudentController { @Autowired StudentRepo studentRepo; @Autowired CacheManager cacheManager; @PostMapping(path = "/student", consumes = "application/json") public Student postStudent(@RequestBody Student student) { return studentRepo.putStudent(student); } @GetMapping(path = "/student/{id}") public Student findStudentById(@PathVariable String id) { try { return studentRepo.getStudentByID(id); } catch (StudentNotFoundException ex) { throw new ResponseStatusException(HttpStatus.NOT_FOUND, ex.getMessage(), ex); } } @DeleteMapping(path = "/student/{id}") public void evictStudentById(@PathVariable String id) { studentRepo.evictStudentByID(id); } @DeleteMapping(path = "/student") public void evictStudents() { studentRepo.evictStudents(); } }
[ "alopezme@redhat.com" ]
alopezme@redhat.com
7a87257d6c1c0f5c7b40121687627c4fcb431d7c
e788e0ea7fca863dff7741a840b573a151e8c0c1
/screenshot-maven-plugin-parent/swingset3-demo-app/src/test/java/com/sun/swingset3/demos/button/ButtonDemoTest.java
b2f36ef74d135fc4e91f9ff2fe69952ceb3f1d1d
[]
no_license
chanylee/screenshot-maven-plugin
20245459d5a8d7227de854f1bbfeccd69eb8041a
6430ce31a6fa58927e1d3e2c97003a453e4caa2b
refs/heads/master
2020-12-24T18:12:51.020971
2013-12-18T08:11:01
2013-12-18T08:11:01
41,456,851
0
0
null
null
null
null
UTF-8
Java
false
false
1,447
java
package com.sun.swingset3.demos.button; import javax.swing.JComponent; import javax.swing.LookAndFeel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import se.bluebrim.maven.plugin.screenshot.Screenshot; import com.sun.swingset3.demos.table.TableDemo; import com.sun.swingset3.demos.togglebutton.ToggleButtonDemo; import com.sun.swingset3.demos.tree.TreeDemo; /** * Demonstrates how to create various screen shots of components in the SwingSet3 application * * @author Goran Stack * */ public class ButtonDemoTest { @Screenshot public JComponent createButtonDemoScreenShot() { return new ButtonDemo(); } @Screenshot (scene = "laf-nimbus") public JComponent createNimbusButtonDemoScreenshot() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { LookAndFeel laf = UIManager.getLookAndFeel(); UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); ButtonDemo buttonDemo = new ButtonDemo(); UIManager.setLookAndFeel(laf); return buttonDemo; } @Screenshot public JComponent createToogleButtonDemoScreenshot() { return new ToggleButtonDemo(); } @Screenshot public JComponent createTableDemoScreenshot() { return new TableDemo(); } @Screenshot public JComponent createTreeDemoScreenshot() { return new TreeDemo(); } }
[ "goran.stack@665c6c9b-6b17-18b1-5103-0a9df7e29ab1" ]
goran.stack@665c6c9b-6b17-18b1-5103-0a9df7e29ab1
ec8411b67d4d2fc9ad6d5d2011b260409eddd410
2a6a9d73de14f4fa76036ceac5750f47c48157f1
/pm-backend/src/main/java/cn/edu/cidp/project/monitor/service/ISysJobLogService.java
f0c3850e6355fbc7ddfcf70a711d4b6a8c4cca75
[ "MIT" ]
permissive
gaoquansheng/gs-project
06b45b8f2147b7bac29d49e48e0f355ceb33c25f
a8a0ee09095508badeb3374649905c9e5d51d213
refs/heads/main
2023-05-30T07:27:03.571389
2021-06-09T07:27:58
2021-06-09T07:27:58
374,635,278
0
0
null
null
null
null
UTF-8
Java
false
false
1,205
java
package cn.edu.cidp.project.monitor.service; import java.util.List; import cn.edu.cidp.project.monitor.domain.SysJobLog; /** * 定时任务调度日志信息信息 服务层 * */ public interface ISysJobLogService { /** * 获取quartz调度器日志的计划任务 * * @param jobLog 调度日志信息 * @return 调度任务日志集合 */ public List<SysJobLog> selectJobLogList(SysJobLog jobLog); /** * 通过调度任务日志ID查询调度信息 * * @param jobLogId 调度任务日志ID * @return 调度任务日志对象信息 */ public SysJobLog selectJobLogById(Long jobLogId); /** * 新增任务日志 * * @param jobLog 调度日志信息 */ public void addJobLog(SysJobLog jobLog); /** * 批量删除调度日志信息 * * @param logIds 需要删除的日志ID * @return 结果 */ public int deleteJobLogByIds(Long[] logIds); /** * 删除任务日志 * * @param jobId 调度日志ID * @return 结果 */ public int deleteJobLogById(Long jobId); /** * 清空任务日志 */ public void cleanJobLog(); }
[ "962338171@qq.com" ]
962338171@qq.com
b766412a39bbf869ee85ebca9c498adf70bc9662
24760037d6ca246c9cb4c3af1fb11fbb2b5161ad
/euler/2.java
1a1343bcddb600f23be556752c86d578bc092e3c
[ "MIT" ]
permissive
jmankhan/ACM
f58422edd346784983481a7dd9ab00b4b81b89ac
5e55c64e0481bca69f23b0f1f47755558a1f9e42
refs/heads/master
2020-12-28T23:16:00.343259
2015-06-14T22:01:48
2015-06-14T22:01:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
294
java
import java.util.*; import java.io.*; public class Main { static Scanner in; public static void main(String[] args){ int a = 0,b = 1,temp, ans = 0; while(b<4000000){ temp = a + b; if((temp&1) == 0){ ans += temp; } a = b; b = temp; } System.out.println(ans); } }
[ "szhang92@gatech.edu" ]
szhang92@gatech.edu
256c49aa810df5acf015df1bb17c813d77eab307
614c2dc5ae027283f37ec15c12e9acdf60ead011
/voltTable2/procedures/SelectItem_24.java
46996cdba1ea5fa3d630ee2b77737b3804372246
[]
no_license
junshiguo/hybrid
d5f04e97706ff702773ecc589569af68aff27df7
7574e2243e77e5f912576157b2dddf74750abdba
refs/heads/master
2021-03-19T11:13:13.843164
2015-07-26T16:09:17
2015-07-26T16:09:17
21,557,559
0
0
null
null
null
null
UTF-8
Java
false
false
375
java
import org.voltdb.*; public class SelectItem_24 extends VoltProcedure { public final SQLStmt sql = new SQLStmt("SELECT * FROM item24 WHERE tenant_id = ? AND is_insert = ? AND is_update = ?"); public VoltTable[] run(int tenant_id, int is_insert, int is_update) throws VoltAbortException { voltQueueSQL(sql, tenant_id, is_insert, is_update); return voltExecuteSQL(); } }
[ "junshiguo@126.com" ]
junshiguo@126.com
b39d4f8b484d17deaae86c5219fad445607bc7e8
75747e1807a2f4109e5ac04fea490034c600e75f
/android/app/src/main/java/com/pmtpush/MainApplication.java
ee55b40b18546c2819396e26b61bc9a23b683aee
[]
no_license
PhutiM/Plus-Health-Medical
c0d6c8de836d9923788a7946ea4c9f9958e325e6
155b89a1e580af61c6f9dc5e5371c68d7ccc8b13
refs/heads/master
2023-01-22T03:28:34.923408
2020-01-10T12:14:28
2020-01-10T12:14:28
222,102,445
0
0
null
2023-01-05T00:59:50
2019-11-16T13:21:13
JavaScript
UTF-8
Java
false
false
2,274
java
package com.pmtpush; import android.app.Application; import android.content.Context; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.lang.reflect.InvocationTargetException; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List<ReactPackage> packages = new PackageList(this).getPackages(); // Packages that cannot be autolinked yet can be added manually here, for example: // packages.add(new MyReactNativePackage()); return packages; } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); initializeFlipper(this); // Remove this line if you don't want Flipper enabled } /** * Loads Flipper in React Native templates. * * @param context */ private static void initializeFlipper(Context context) { if (BuildConfig.DEBUG) { try { /* We use reflection here to pick up the class that initializes Flipper, since Flipper library is not available in release mode */ Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper"); aClass.getMethod("initializeFlipper", Context.class).invoke(null, context); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } }
[ "noreply@github.com" ]
PhutiM.noreply@github.com
492590ded668a82ff8ace90625dbde03cbc019ef
c4cb7fc135d40b5064177f7edfdd200c239aa0e8
/src/main/java/com/mosman/tutorfinderapp/payload/response/UserDtoResponse.java
dbea6e8f1a65c956077052039419f6aaa497be7e
[]
no_license
mosman-team/tutor-finder
e82ce94923a54ca06766690beaff156ccd70349c
adea3bf6f376d24a7b107a03e4b743b437a1516f
refs/heads/master
2023-01-10T04:31:42.521185
2020-05-10T19:26:41
2020-05-10T19:26:41
246,851,313
0
1
null
2023-01-05T09:51:00
2020-03-12T14:11:58
Vue
UTF-8
Java
false
false
307
java
package com.mosman.tutorfinderapp.payload.response; public class UserDtoResponse { private String img; public UserDtoResponse(String img) { this.img = img; } public String getImg() { return img; } public void setImg(String img) { this.img = img; } }
[ "omir.musradin.99@gmail.com" ]
omir.musradin.99@gmail.com
eb0e64550f9dc2c6f12ad081ab38b87a7d005b11
b231725fadb07112fe963fafe36d9c5d233ea7e4
/src/test/java/steps/StepsHooks.java
1396951407cebbc74ddebe02afa4263250cba90b
[]
no_license
madonix994/Cucumber-REST-framework
997f0467febc6d4d90a1e15a0d18f89e79462b92
7823545320b3b36976c42584b6a1ddcedf210a47
refs/heads/main
2023-02-17T23:45:03.778311
2021-01-18T12:16:43
2021-01-18T12:16:43
330,173,471
0
0
null
null
null
null
UTF-8
Java
false
false
2,187
java
package steps; import cucumber.api.Scenario; import cucumber.api.java.After; import cucumber.api.java.Before; import org.apache.commons.lang3.StringUtils; import java.io.File; import java.io.IOException; import java.nio.file.Files; import static helpers.ConnectionManager.ConnectionManager.emptyMessageStorage; import static helpers.ConnectionManager.ConnectionManager.initCounter; import static helpers.RandomGenerator.GenerateRandomString; public class StepsHooks { public static String featureName = ""; public static String scenarioName = ""; public static int scenarioCounter = 0; public static String buildCode = ""; /** * Method that runs before each scenario * * @param scenario * @throws IOException */ @Before public void beforeScenario(Scenario scenario) throws IOException { if (StringUtils.isEmpty(buildCode)) { emptyMessageStorage(); buildCode = GenerateRandomString(20); } initCounter(); scenarioName = scenario.getName(); String rawFeatureName = scenario.getId().split(";")[0].replace("-", " "); featureName = featureName + rawFeatureName.substring(0, 1).toUpperCase() + rawFeatureName.substring(1); scenarioCounter++; System.out.println("\n ------------------ Scenario: " + scenario.getName() + " was started ------------------\n\n"); } /** * Method that runs after each scenario */ @After public void afterScenario(Scenario scenario) throws Exception { try { File folder = new File("messageStorage/" + scenarioCounter + "_" + scenarioName + "/"); File[] fileList = folder.listFiles(); if (fileList != null) { for (File file : fileList) { if (file.toPath().toString().contains(".json")) { scenario.embed(Files.readAllBytes(file.toPath()), "application/json"); } else if (file.toPath().toString().contains(".html")) { scenario.embed(Files.readAllBytes(file.toPath()), "text/html"); } } } } catch (Exception e) { throw new Exception("There was an issue while trying to embed file." + e); } finally { System.out.println("\n -------- Scenario: " + scenario.getName() + " is completed. Status: " + scenario.getStatus().toUpperCase() + " --------\n\n"); } } }
[ "madonix994@gmail.com" ]
madonix994@gmail.com
59306ce2016b91eb8c57366f08c071023d906a34
a08ecf1cdb1310f902b025e537d87242227884a1
/app/src/androidTest/java/com/example/android/laliga2018/ExampleInstrumentedTest.java
789dda4529c0e3307048e178373a3eac835f8db4
[]
no_license
cotoflux/LaLiga2018
da209f5390ae2b562ba0a370086211ed73ce7f6b
9f0737622dbc3257defb5465bb8b18f9fd9c4b29
refs/heads/master
2021-03-31T00:50:42.644814
2019-11-02T23:22:23
2019-11-02T23:22:23
124,943,785
0
1
null
null
null
null
UTF-8
Java
false
false
761
java
package com.example.android.laliga2018; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.android.laliga2018", appContext.getPackageName()); } }
[ "tramuntana@github.com" ]
tramuntana@github.com
d097b6eb35894aa0c3184297b367dbde69019cdf
3a4df1b77ecf9ecaf2e96acaeb8e4c874898814c
/CINEMA I/src/main/java/edu/eci/arsw/cinema/persistence/CinemaPersistenceException.java
d275ff788cc2e279e83d0873b6068457ea796d57
[]
no_license
srubianof/ARSW-LAB-3
5258031df473de3ab51a544faffc5d9467ec4b44
3ab5e4682bb0bf931d811485a47f958115207690
refs/heads/master
2022-12-06T20:47:10.586116
2020-09-02T01:14:06
2020-09-02T01:14:06
290,563,673
0
0
null
null
null
null
UTF-8
Java
false
false
516
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package edu.eci.arsw.cinema.persistence; /** * @author cristian */ public class CinemaPersistenceException extends Exception { public CinemaPersistenceException(String message) { super(message); } public CinemaPersistenceException(String message, Throwable cause) { super(message, cause); } }
[ "srubianof@icloud.com" ]
srubianof@icloud.com
51fa7e41a3f25b3b37ba46cbec414f3300cfb363
da1d96a107b0055afcb9f088d87c48ec14e38301
/src/main/java/AreaXMLOutputter.java
c5a42bbf17c58760672b2965a9d1de4cffa48a68
[]
no_license
monkin77/feup_lpoo_area_calculator
5e29cae3308d5208159cde568f2e7f6ecf425453
d9ab9e5264236e0060928a514c34aca796eb59a3
refs/heads/master
2023-03-28T04:29:42.012942
2021-03-19T16:19:56
2021-03-19T16:19:56
349,456,910
0
0
null
null
null
null
UTF-8
Java
false
false
265
java
public class AreaXMLOutputter { private SumProvider sumProvider; public AreaXMLOutputter(SumProvider sumProvider){ this.sumProvider = sumProvider; } public String output() { return "<Area>" + sumProvider.sum() + "</Area>"; } }
[ "monkinsmurf@gmail.com" ]
monkinsmurf@gmail.com
569e80755893e8d3347fdc9f2aec4cfe199b1a67
457697693b298681a39e995fa3934d2f9a0ae299
/src/chapter15/exercise09/MapExample.java
6009ec2ca5b1e7db233ffb27a5db1b12d3731633
[]
no_license
sebaek/java20180418
b061cecfe09ec7c13a5c44b9835fb06e93df2a38
969c21526bdb66390261bfa8bd3771fd4622ae21
refs/heads/master
2020-03-14T22:14:54.504838
2018-05-21T03:32:13
2018-05-21T03:32:13
131,816,722
0
1
null
null
null
null
UTF-8
Java
false
false
682
java
package chapter15.exercise09; import java.util.HashMap; import java.util.Map; public class MapExample { public static void main(String[] args) { Map<String, Integer> map = new HashMap<>(); map.put("blue", 96); map.put("hong", 86); map.put("white", 92); String name = null; int maxScore = 0; int totalScore = 0; for (String key : map.keySet()) { int value = map.get(key); totalScore += value; if (value > maxScore) { maxScore = value; name = key; } } System.out.println("평균점수: " + totalScore / map.size()); System.out.println("최고점수: " + maxScore); System.out.println("최고점수 아이디: " + name); } }
[ "choongang402@choongang402" ]
choongang402@choongang402
d665a2f5154db69d715c216f727cb578f70af19b
c474b03758be154e43758220e47b3403eb7fc1fc
/apk/decompiled/com.tinder_2018-07-26_source_from_JADX/sources/com/tinder/data/profile/C13075b.java
0b4454ac50c6bbe00509c9cf154d4b033d080b00
[]
no_license
EstebanDalelR/tinderAnalysis
f80fe1f43b3b9dba283b5db1781189a0dd592c24
941e2c634c40e5dbf5585c6876ef33f2a578b65c
refs/heads/master
2020-04-04T09:03:32.659099
2018-11-23T20:41:28
2018-11-23T20:41:28
155,805,042
0
0
null
2018-11-18T16:02:45
2018-11-02T02:44:34
null
UTF-8
Java
false
false
1,188
java
package com.tinder.data.profile; import com.tinder.api.TinderUserApi; import com.tinder.data.profile.adapter.C10915e; import dagger.internal.Factory; import javax.inject.Provider; /* renamed from: com.tinder.data.profile.b */ public final class C13075b implements Factory<C8753a> { /* renamed from: a */ private final Provider<TinderUserApi> f41648a; /* renamed from: b */ private final Provider<C10915e> f41649b; public /* synthetic */ Object get() { return m50889a(); } public C13075b(Provider<TinderUserApi> provider, Provider<C10915e> provider2) { this.f41648a = provider; this.f41649b = provider2; } /* renamed from: a */ public C8753a m50889a() { return C13075b.m50887a(this.f41648a, this.f41649b); } /* renamed from: a */ public static C8753a m50887a(Provider<TinderUserApi> provider, Provider<C10915e> provider2) { return new C8753a((TinderUserApi) provider.get(), (C10915e) provider2.get()); } /* renamed from: b */ public static C13075b m50888b(Provider<TinderUserApi> provider, Provider<C10915e> provider2) { return new C13075b(provider, provider2); } }
[ "jdguzmans@hotmail.com" ]
jdguzmans@hotmail.com
8c0e192b29270fda4b986c2b6f41d95b47a53332
2d659a53f1b1ea4472737691b80ad9354f1e4db4
/android/support/v4/widget/C0106g.java
8a92612cabc0270c27778f8ffcfe423251199a1d
[]
no_license
sydneyli/bylock_src
52117e0e419f4d57f352547c5e5c597228247a93
226d54fdafb14dfd3bab48c1a343c83a5544e060
refs/heads/master
2021-04-29T18:11:57.792778
2018-02-15T23:05:02
2018-02-15T23:05:02
121,687,542
0
0
null
null
null
null
UTF-8
Java
false
false
234
java
package android.support.v4.widget; import android.view.View; /* compiled from: MyApp */ public interface C0106g { void m892a(int i); void m893a(View view); void m894a(View view, float f); void m895b(View view); }
[ "sydney@eff.org" ]
sydney@eff.org
14db7d527c37501cbf538000677ff4ee1435cabc
ae51f28ef58a75cffc23ecad1c07ae9859b21f87
/Desktop/library-bachelor-thesis/server/src/main/java/com/example/library/model/extensions/Status.java
4afea4d5b818754846b99f9c58840c949e874f62
[]
no_license
AdaBr/inzynier
83415426f51dc9e431fc8123a7210bb9a89626fb
8f7cf23a0896ea3b6ccae7221b95009b78f62bce
refs/heads/master
2020-04-15T00:22:47.607545
2019-01-27T23:17:21
2019-01-27T23:17:21
164,207,127
1
0
null
null
null
null
UTF-8
Java
false
false
112
java
package com.example.library.model.extensions; public enum Status { DOWNLOADED, WAITING, FAVORITE }
[ "brzozowska.adrianna95@gmail.com" ]
brzozowska.adrianna95@gmail.com
0555ca32e995ec17eb3d696afd126dcc061d8a70
463fae7baa8f6d946ddff1817f040b5a6573102e
/Module-1/Activity-27/Exercise-AddMenu/T02.02-Exercise-AddMenu/app/src/main/java/com/example/android/datafrominternet/MainActivity.java
8abe5e54753ddebb2849c056092eab6fdfb35052
[]
no_license
khyathimsit/Mobile-Programming
e63b3d84974b2e654296d4860557fbe16b9545e3
9f926110bc751bd1ca22c06dfd01e2b6bea945c1
refs/heads/master
2020-04-28T03:08:40.951411
2019-03-23T15:34:06
2019-03-23T15:34:06
174,925,128
0
0
null
null
null
null
UTF-8
Java
false
false
3,363
java
/* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.android.datafrominternet; import android.content.Context; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { private EditText mSearchBoxEditText; private TextView mUrlDisplayTextView; private TextView mSearchResultsTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mSearchBoxEditText = (EditText) findViewById(R.id.et_search_box); mUrlDisplayTextView = (TextView) findViewById(R.id.tv_url_display); mSearchResultsTextView = (TextView) findViewById(R.id.tv_github_search_results_json); } // Do 2 - 7 in main.xml /////////////////////////////////////////////////////////////////////// // TODO (2) Create a menu xml called 'main.xml' in the res->menu folder // TODO (3) Add one menu item to your menu // TODO (4) Give the menu item an id of @+id/action_search // TODO (5) Set the orderInCategory to 1 // TODO (6) Show this item if there is room (use app:showAsAction, not android:showAsAction) // TODO (7) Set the title to the search string ("Search") from strings.xml // Do 2 - 7 in main.xml /////////////////////////////////////////////////////////////////////// // TODO (8) Override onCreateOptionsMenu @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } // TODO (9) Within onCreateOptionsMenu, use getMenuInflater().inflate to inflate the menu // TODO (10) Return true to display your menu // TODO (11) Override onOptionsItemSelected // TODO (12) Within onOptionsItemSelected, get the ID of the item that was selected // TODO (13) If the item's ID is R.id.action_search, show a Toast and return true to tell Android that you've handled this menu click // TODO (14) Don't forgot to call .show() on your Toast // TODO (15) If you do NOT handle the menu click, return super.onOptionsItemSelected to let Android handle the menu click @Override public boolean onOptionsItemSelected(MenuItem item) { int menuItemThatWasSelected = item.getItemId(); if(menuItemThatWasSelected == R.id.action_search) { Context context = MainActivity.this; String message = "Search Clicked"; Toast.makeText(context,"message", Toast.LENGTH_SHORT).show(); } return super.onOptionsItemSelected(item); } }
[ "khyathi17@msitprogram.net" ]
khyathi17@msitprogram.net
7e99ed7ab54091c10996b8e4b87df5a551c466a1
d7da99487cd2765b745552773c8d4878d7ae58d8
/src/com/buynow/tag/IteratorTag.java
892727d057c811194bc3b0e44db5147de8f94d88
[]
no_license
buynowdev/ServletDemo
29f6b8adf502b4372862eb554ba6612b4a5f6bf7
65602454e3c1b78efd10290ed7efa646e9b84971
refs/heads/master
2023-03-10T16:15:19.677380
2016-08-07T06:31:07
2016-08-07T06:31:07
null
0
0
null
null
null
null
GB18030
Java
false
false
462
java
package com.buynow.tag; import java.io.IOException; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.SimpleTagSupport; /** * 循环标签体内部的内容 * @author Zhao * */ public class IteratorTag extends SimpleTagSupport { private int count; @Override public void doTag() throws JspException, IOException { } public int getCount() { return count; } public void setCount(int count) { this.count = count; } }
[ "zhaozhaozhao1996@163.com" ]
zhaozhaozhao1996@163.com
7337fd94b2f893a70afb57143a4dbfbe1e212397
8363da69c415522405343e2d6280077626a08dde
/javautil/fileIO/fileCopy/FileCopyUtils.java
c903635b8ce3a4cd340159315681317c28d840c2
[]
no_license
fanshui/javalearn
65475d2d579d2e3c5f58e46565e30d654b8076ef
de3d0cf620db77fd662a5869d3e79428bb3668bb
refs/heads/master
2020-03-14T01:58:07.674757
2018-05-27T09:18:36
2018-05-27T09:18:36
131,388,279
0
0
null
null
null
null
UTF-8
Java
false
false
6,118
java
package fileIO.fileCopy; import java.io.*; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; public class FileCopyUtils { /** * * @param fromFile 被复制的文件 * @param toFile 复制的文件目录 * @param rewrite 是否重新创建文件 * * <p>文件复制 把文件复制到指定目录</p> */ public static void copyfile(File fromFile,File toFile,Boolean rewrite) { if (!canCopy(fromFile)) return; if (!toFile.getParentFile().exists()) { toFile.getParentFile().mkdirs(); } if (toFile.exists() && rewrite) { toFile.delete(); } try { FileInputStream fosfrom = new FileInputStream(fromFile); FileOutputStream fosto = new FileOutputStream(toFile); byte[] bt = new byte[1024]; int c; while ((c = fosfrom.read(bt)) > 0) { fosto.write(bt,0,c); } fosfrom.close(); fosto.close(); } catch (IOException e) { e.printStackTrace(); } } /** *单线程文件复制 * @param source 被复制的文件 * @param target 复制到 * * <p>使用nio channel transferTo方法</p> * <p>不考虑多线程优化,单线程文件复制最快的方法是(文件越大该方法越有优势,一般比常用方法快30+%</p> */ public static void nioTransferCopy(File source, File target) { if (!canCopy(source)) return; FileChannel in = null; FileChannel out = null; FileInputStream inStream = null; FileOutputStream outStream = null; try { inStream = new FileInputStream(source); outStream = new FileOutputStream(target); in = inStream.getChannel(); out = outStream.getChannel(); in.transferTo(0, in.size(), out); } catch (IOException e) { e.printStackTrace(); } finally { close(in,out,inStream,outStream); } } /** * 文件复制 可通过buffer监测复制进度 * @param source 被复制的文件 * @param target 目标文件 * @param capacity buffer大小(4096) * *<p>如果需要监测复制进度,可以用第二快的方法(留意buffer的大小,对速度有很大影响)</p> * <p>使用nio channel buffer</p> * */ public static void nioBufferCopy(File source, File target, int capacity) { if (!canCopy(source)) return; FileChannel in = null; FileChannel out = null; FileInputStream inStream = null; FileOutputStream outStream = null; try { inStream = new FileInputStream(source); outStream = new FileOutputStream(target); in = inStream.getChannel(); out = outStream.getChannel(); ByteBuffer buffer = ByteBuffer.allocate(capacity); buffer.clear(); // int count = 0; while (in.read(buffer) >= 0 || buffer.position() != 0) { buffer.flip(); out.write(buffer); // System.out.println(buffer.toString()); // System.out.println("This is " + count++ + "th " + "byte[" + capacity + "]"); buffer.compact(); } } catch (IOException e) { e.printStackTrace(); } finally { close(in, out, inStream, outStream); } } /** * 多线程复制单个文件 * @param source 源文件 * @param target 目标文件 * @param numOfThread 线程数量 */ public static void mtTransferCopySingleFile(File source, File target, int numOfThread) { if(!canCopy(source)) return; long len = source.length(); long lenOfEveryTh = len / numOfThread; for(int i = 0; i < numOfThread - 1; i++) { Thread t = new Thread(new MultThreadCopySingleFileRunnable(source,target,lenOfEveryTh * i, lenOfEveryTh * (i + 1)), i + "th CopyThread"); t.start(); } Thread ct = new Thread(new MultThreadCopySingleFileRunnable(source,target,lenOfEveryTh * (numOfThread - 1),len)); ct.start(); } /** * 多线程复制多个文件 ,其中每个线程复制一个文件 * @param sources 源文件数组 * @param targetDir 目标目录 */ public static void mtTransferCopyMultiFiles(File[] sources,File targetDir) { for (File source : sources) { if(!canCopy(source)) return; } if (!targetDir.exists() || !targetDir.isDirectory()) return; for(int i = 0; i < sources.length; i++) { Thread t = new Thread(new SimpleFileCopyRunnable(sources[i],new File(targetDir,sources[i].getName())), sources[i].getName() + " copy thread"); t.start(); } } public static void close(FileChannel in, FileChannel out, FileInputStream inStream, FileOutputStream outStream) { try { if (out != null) out.close(); if (in != null)in.close(); if (outStream != null)outStream.close(); if (inStream != null)inStream.close(); } catch (IOException e) { e.printStackTrace(); } } public static void close(FileChannel in, FileChannel out, RandomAccessFile inStream, RandomAccessFile outStream) { try { if (out != null) out.close(); if (in != null)in.close(); if (outStream != null)outStream.close(); if (inStream != null)inStream.close(); } catch (IOException e) { e.printStackTrace(); } } public static boolean canCopy(File fromFile) { if (!fromFile.exists()) { return false; } if (!fromFile.isFile()) { return false; } if (!fromFile.canRead()) { return false; } return true; } }
[ "fh006007@163.com" ]
fh006007@163.com
bcddfee55d1f04e5f874c246669780b6dea2a566
407616a069f710b2be8b377aaa4459d354e6bf30
/10_ZannoTaxi/test/zannotaxi/model/tests/TariffaADistanzaTests.java
81f0396c76c88db255fb09a96855d11ea8e31949
[]
no_license
Ale-Allegretti/Java-Learn
19b69acf7a56be683ee2bd912d21e0802f45ef0d
050f4faa9a4edc4fd127b52c3725eb67491966ae
refs/heads/main
2023-08-18T00:43:05.793804
2021-09-22T17:36:42
2021-09-22T17:36:42
354,257,336
0
0
null
null
null
null
UTF-8
Java
false
false
1,314
java
package zannotaxi.model.tests; import static org.junit.jupiter.api.Assertions.*; import java.util.Optional; import org.junit.jupiter.api.*; import zannotaxi.model.*; public class TariffaADistanzaTests { private TariffaADistanza td; @BeforeEach public void setUp() { td = new TariffaADistanza("T1", 27, Integer.MAX_VALUE, 0, 10, 25, 100); } @Test public void testGetNome() { assertEquals("T1", td.getNome()); } @Test public void testGetValoreScattoInEuroCent() { assertEquals(25, td.getValoreScatto(), 0.0001); } @Test public void testGetScattoDaContabilizzare() { Optional<Scatto> scatto = td.getScattoCorrente(50, 600, 1.0); assertTrue(scatto.isPresent()); scatto = td.getScattoCorrente(100, 600, 1.0); assertFalse(scatto.isPresent()); } @Test public void testGetVelocitaMinima() { assertEquals(27, td.getVelocitaMinima(), 0.0001); } @Test public void testGetVelocitaMassima() { assertEquals(Integer.MAX_VALUE, td.getVelocitaMassima(), 0.0001); } @Test public void testGetCostoMinimo() { assertEquals(0, td.getCostoMinimo(), 0.0001); } @Test public void testGetCostoMassimo() { assertEquals(10, td.getCostoMassimo(), 0.0001); } @Test public void testGetDistanzaDiScatto() { assertEquals(100, td.getDistanzaDiScatto(), 0.0001); } }
[ "User@DESKTOP-HFUJQA1.station" ]
User@DESKTOP-HFUJQA1.station
e25ebd45d433fbba3a11835eb8e5b5a6f3ef7d7d
fcc7035d1a5501889c0abdae7b41ec15de50a493
/src/com/symcs/cRPG/utils/Hitboxes/HitboxCollection.java
2218aebb6aa54813e7fc770b609ca63d0b9a5274
[]
no_license
yurippe/cRPGv2
31f72217df0317040452214e31cf117c5e32519f
cc5864b145a07d32ccd84e194dfc3f7aa0f79f91
refs/heads/master
2020-04-11T09:42:13.081222
2015-04-16T11:15:52
2015-04-16T11:15:52
33,619,597
0
0
null
null
null
null
UTF-8
Java
false
false
533
java
package com.symcs.cRPG.utils.Hitboxes; import java.util.List; import org.bukkit.entity.LivingEntity; import com.symcs.cRPG.cRPG; //fake hitbox for convenience, always returns it's list public class HitboxCollection extends Hitbox{ private List<? extends LivingEntity> ents; public HitboxCollection(cRPG plugin, List<? extends LivingEntity> list) { super(plugin); this.ents = list; } @SuppressWarnings("unchecked") @Override public List<LivingEntity> getEntitiesHit() { return (List<LivingEntity>)this.ents; } }
[ "yurippenet@gmail.com" ]
yurippenet@gmail.com
59592c8716e030b696ec03312dc1008457c02bf6
e3df657f6a17ba9f1f2346c64d12cb1b6c806c71
/sdk/src/main/java/com/zz/opensdk/sdk/domain/OpenAPIEntity.java
efe7c74248f722d321e1cc8abd3eb21f15360065
[]
no_license
zhangzui/my_opensdk
fa8d206195ee49ab31cd216fa06808e9d52e0092
af48b830ba7264e606317fe402c81fc7a3b23298
refs/heads/master
2020-03-27T12:41:13.985500
2018-09-10T08:57:11
2018-09-10T08:57:11
146,561,978
0
0
null
null
null
null
UTF-8
Java
false
false
2,911
java
package com.zz.opensdk.sdk.domain; /** * @author zhangzuizui * @date 2018/7/11 12:13 */ public class OpenAPIEntity { /** * 版本号 */ public String version; /** * appId */ public String appId; /** * timestamp * 发送请求的时间,格式"yyyy-MM-dd HH:mm:ss" */ public String timestamp; /** * 字符集GBK/UTF-8等 */ public String charset; /** * 交易类型 */ public String apiType; /** * 加密类型 */ public String encryptType; /** * 签名类型 */ public String signType; /** * 业务数据 */ public String data; /** * 商户号 */ private String merchantNo; /** * 所有数据签名 */ public String sign; public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } public String getAppId() { return appId; } public void setAppId(String appId) { this.appId = appId; } public String getTimestamp() { return timestamp; } public void setTimestamp(String timestamp) { this.timestamp = timestamp; } public String getCharset() { return charset; } public void setCharset(String charset) { this.charset = charset; } public String getApiType() { return apiType; } public void setApiType(String apiType) { this.apiType = apiType; } public String getEncryptType() { return encryptType; } public void setEncryptType(String encryptType) { this.encryptType = encryptType; } public String getSignType() { return signType; } public void setSignType(String signType) { this.signType = signType; } public String getData() { return data; } public void setData(String data) { this.data = data; } public String getMerchantNo() { return merchantNo; } public void setMerchantNo(String merchantNo) { this.merchantNo = merchantNo; } public String getSign() { return sign; } public void setSign(String sign) { this.sign = sign; } @Override public String toString() { return "BizEntity{" + "version='" + version + '\'' + ", appId='" + appId + '\'' + ", timestamp='" + timestamp + '\'' + ", charset='" + charset + '\'' + ", encryptType='" + encryptType + '\'' + ", signType='" + signType + '\'' + ", apiType='" + apiType + '\'' + ", data='" + data + '\'' + ", merchantNo='" + merchantNo + '\'' + ", sign='" + sign + '\'' + '}'; } }
[ "zhangzuizui@qq.com" ]
zhangzuizui@qq.com
ba464b71e2d82b09179fed1fe5dad4b994f9923a
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/JetBrains--intellij-community/b29c6a934c6e0cb03ba932c64a13a9ed0d799330/before/MoveClassesHandler.java
1d66c2dc106c476191e8b646cdc849b24bf4e792
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
1,932
java
package com.intellij.refactoring.move.moveClassesOrPackages; import com.intellij.psi.*; import com.intellij.psi.impl.source.jsp.jspJava.JspClass; import com.intellij.openapi.project.Project; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.ex.DataConstantsEx; import com.intellij.openapi.editor.Editor; import org.jetbrains.annotations.Nullable; public class MoveClassesHandler extends MoveClassesOrPackagesHandlerBase { public boolean canMove(final PsiElement[] elements, @Nullable final PsiElement targetContainer) { for(PsiElement element: elements) { if (element instanceof JspClass) return false; if (!(element instanceof PsiClass)) return false; if (!(element.getParent() instanceof PsiFile)) return false; } return super.canMove(elements, targetContainer); } public boolean isValidTarget(final PsiElement psiElement) { return psiElement instanceof PsiClass || MovePackagesHandler.isPackageOrDirectory(psiElement); } public boolean tryToMove(final PsiElement element, final Project project, final DataContext dataContext, final PsiReference reference, final Editor editor) { if (isReferenceInAnonymousClass(reference)) return false; if (element instanceof PsiClass && !(element instanceof PsiAnonymousClass) && element.getParent() instanceof PsiFile) { MoveClassesOrPackagesImpl.doMove(project, new PsiElement[]{element}, (PsiElement)dataContext.getData(DataConstantsEx.TARGET_PSI_ELEMENT), null); return true; } return false; } public static boolean isReferenceInAnonymousClass(@Nullable final PsiReference reference) { if (reference instanceof PsiJavaCodeReferenceElement && ((PsiJavaCodeReferenceElement)reference).getParent() instanceof PsiAnonymousClass) { return true; } return false; } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
d83e5c93bafe28ed77f0d498b3677e13728369b3
51c235943918299ea26c83dc96648f3c4bd27182
/Hackerrank.java
1df923230de752d627019e0bb04d7fc1131c287c
[]
no_license
abidhussain1997/hackerrank
c896377bd590020e7c759fb7f26d89788cbc00c9
c6e768b81efd57af1bb194f412c7d0a879356b7a
refs/heads/master
2021-06-20T18:49:17.314752
2021-01-30T14:03:47
2021-01-30T14:03:47
173,490,877
0
0
null
null
null
null
UTF-8
Java
false
false
804
java
import java.util.Scanner; import java.lang.*; class Hackerrank{ public static void main(String[] args) { Scanner scr = new Scanner (System.in); int num = scr.nextInt(); int [][] a = new int[num][num]; int sum1 = 0; int sum2 = 0; int diff; for (int i=0; i < num ; i++ ) { for (int j=0; j < num ; j++ ) { a[i][j] = scr.nextInt(); } } for (int i=0; i < num ; i++ ) { for (int j=0; j < num ; j++ ) { if (i == j) { sum1 = sum1 + a[i][j]; } if(j == num-1-i){ sum2 = sum2 + a[i][j]; } } } System.out.println("Sum1 is: " + sum1); System.out.println("Sum2 is: " + sum2); diff = sum1 - sum2; diff = Math.abs(diff); System.out.println("diff is: " + diff); } }
[ "abidhussain3008@gmail.com" ]
abidhussain3008@gmail.com
81e89e6dad4c6235d93926c4acc6e607ce8a26cc
dae435cce6874e7dae338e82cfac8304aadf64f0
/app/src/test/java/com/example/lathe/milemarker/ExampleUnitTest.java
1f6cf4b9ae970a9e7c051e43f7646d86fccb11e5
[ "BSD-2-Clause" ]
permissive
Gameoverdevelopement/MileMarker
94af8c7e056b1c1e00b5b7c1d5545a027fed6d0d
37a34501fb8ea9c5597e7a828cd9f38416cb101f
refs/heads/master
2021-08-20T05:42:28.202304
2017-11-28T09:16:59
2017-11-28T09:16:59
112,303,288
0
0
null
null
null
null
UTF-8
Java
false
false
406
java
package com.example.lathe.milemarker; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "lathe.elhafy89@gmail.com" ]
lathe.elhafy89@gmail.com
fcf6d1eb41d5b0be198119916378f3da3f083f0d
9ce77a3a22acb94c046246def0950f636b3fb197
/app/src/main/java/com/example/kbarbosa/myapp/model/Response.java
0c66b45f2cd5e8a1c176796da07a4e6caeeac85e
[]
no_license
klevs/music_app
2fc087a0bb305f758ca71c2392936578e9ca4e0e
71e2fa177e06add70abc1cc6ba5349df1072a5f8
refs/heads/master
2021-01-10T08:24:49.573076
2016-02-03T06:12:49
2016-02-03T06:12:49
49,919,063
0
1
null
2023-09-02T03:06:36
2016-01-19T02:06:23
Java
UTF-8
Java
false
false
465
java
package com.example.kbarbosa.myapp.model; /** * Created by kbarbosa on 8/01/2016. */ public class Response { private Status status; private Artist[] artists; public Status getStatus() { return status; } public void setStatus(Status status) { this.status = status; } public Artist[] getArtists() { return artists; } public void setArtists(Artist[] artists) { this.artists = artists; } }
[ "kleverson_raphael@yahoo.com.br" ]
kleverson_raphael@yahoo.com.br
81a507819e2cd8054369983db0270c87e78e304c
bca9af8c7b88bfd0c8bfc996f4db50664b1baafe
/app/src/main/java/com/sonu/app/splash/ui/favs/FavsModule.java
460569902db1bef74459bde67c083e4df531f355
[]
no_license
chandan1794/splash
b1b29d63fb09ef56fe47293cee476e769df3b1d1
bcfa356da253f780f67128f82d25a10081bac1c1
refs/heads/master
2021-04-27T20:02:11.014552
2018-02-18T17:07:22
2018-02-18T17:07:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
708
java
package com.sonu.app.splash.ui.favs; import com.sonu.app.splash.di.ActivityScoped; import com.sonu.app.splash.di.FragmentScoped; import com.sonu.app.splash.ui.downloads.DownloadsContract; import com.sonu.app.splash.ui.downloads.DownloadsFragment; import com.sonu.app.splash.ui.downloads.DownloadsPresenter; import dagger.Binds; import dagger.Module; import dagger.android.ContributesAndroidInjector; /** * Created by amanshuraikwar on 17/02/18. */ @Module public abstract class FavsModule { @FragmentScoped @ContributesAndroidInjector abstract FavsFragment getFavsFragment(); @ActivityScoped @Binds abstract FavsContract.Presenter getFavsPresenter(FavsPresenter presenter); }
[ "amanshuraikwar.in@gmail.com" ]
amanshuraikwar.in@gmail.com
40aee7b1b7ea6c765e6330a97196f91d3a28496b
7624dbe6b920c655fb431caa09598e15044ee925
/srv/src/main/java/eppm/cf/emcdemo/DemoApplication.java
fb7bdf4b05f7f05ade553ea3d6c7be2dbc191a27
[]
no_license
miaodada6666/Storedata
2436db3192c75de7d561d77b1c55d280cf14ffcc
b7f045244822666d888d84996e1ba38e02eafe47
refs/heads/master
2020-07-28T20:47:36.590182
2019-09-20T02:08:30
2019-09-20T02:08:30
209,532,889
1
0
null
null
null
null
UTF-8
Java
false
false
304
java
package eppm.cf.emcdemo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
[ "15839118821xx" ]
15839118821xx
1c22123eb233ca4bc36291ace6811c6d7b279f5e
629ab772402e70a92f7d4c358cf6403d5a5fe12a
/TimeManager/app/src/main/java/com/alibaba/fastjson/serializer/SerialWriterStringEncoder.java
8f300906ee44aa0b96a6c609da5adc34a541d7b8
[]
no_license
wesker8080/SystemAPK-AboutTime
cf69a15317f41a0044b35e8d05a53b035afb82ab
8f7b494b545dba290d7c095cbb0f240a52113533
refs/heads/master
2020-04-18T05:37:10.268969
2019-01-24T02:27:38
2019-01-24T02:27:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,331
java
package com.alibaba.fastjson.serializer; import com.alibaba.fastjson.JSONException; import java.lang.ref.SoftReference; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharacterCodingException; import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; import java.nio.charset.CoderResult; import java.nio.charset.CodingErrorAction; public class SerialWriterStringEncoder { private final CharsetEncoder encoder; public SerialWriterStringEncoder(Charset cs) { this(cs.newEncoder().onMalformedInput(CodingErrorAction.REPLACE).onUnmappableCharacter(CodingErrorAction.REPLACE)); } public SerialWriterStringEncoder(CharsetEncoder encoder) { this.encoder = encoder; } public byte[] encode(char[] chars, int off, int len) { if (len == 0) { return new byte[0]; } encoder.reset(); int bytesLength = scale(len, encoder.maxBytesPerChar()); byte[] bytes = getBytes(bytesLength); return encode(chars, off, len, bytes); } public CharsetEncoder getEncoder() { return encoder; } public byte[] encode(char[] chars, int off, int len, byte[] bytes) { ByteBuffer byteBuf = ByteBuffer.wrap(bytes); CharBuffer charBuf = CharBuffer.wrap(chars, off, len); try { CoderResult cr = encoder.encode(charBuf, byteBuf, true); if (!cr.isUnderflow()) { cr.throwException(); } cr = encoder.flush(byteBuf); if (!cr.isUnderflow()) { cr.throwException(); } } catch (CharacterCodingException x) { // Substitution is always enabled, // so this shouldn't happen throw new JSONException(x.getMessage(), x); } int bytesLength = byteBuf.position(); byte[] copy = new byte[bytesLength]; System.arraycopy(bytes, 0, copy, 0, bytesLength); return copy; } private static int scale(int len, float expansionFactor) { // We need to perform double, not float, arithmetic; otherwise // we lose low order bits when len is larger than 2**24. return (int) (len * (double) expansionFactor); } private final static ThreadLocal<SoftReference<byte[]>> bytesBufLocal = new ThreadLocal<SoftReference<byte[]>>(); public static void clearBytes() { bytesBufLocal.set(null); } public static byte[] getBytes(int length) { SoftReference<byte[]> ref = bytesBufLocal.get(); if (ref == null) { return allocateBytes(length); } byte[] bytes = ref.get(); if (bytes == null) { return allocateBytes(length); } if (bytes.length < length) { bytes = allocateBytes(length); } return bytes; } private static byte[] allocateBytes(int length) { final int minExp = 10; final int BYTES_CACH_MAX_SIZE = 1024 * 128; // 128k, 2^17; if(length > BYTES_CACH_MAX_SIZE) { return new byte[length]; } int allocateLength; { int part = length >>> minExp; if(part <= 0) { allocateLength = 1<< minExp; } else { allocateLength = 1 << 32 - Integer.numberOfLeadingZeros(length-1); } } byte[] chars = new byte[allocateLength]; bytesBufLocal.set(new SoftReference<byte[]>(chars)); return chars; } }
[ "wesker8080@foxmail.com" ]
wesker8080@foxmail.com
5431e3dcff49514f73cd7db58f08b52d6f2123d2
7a0a884a145381c8cb17d59db4cc96560dc598ee
/src/com/jhd/fangdazhongdianping/AllCategoryActivity.java
eb6b0c8e705a88689e391c49906afbb72085a368
[]
no_license
guikaiAndroid/Dazhongdianping
d8ec1e91364cd1cf77e78bcb1550af79ad679189
0c002d9bb9ebf6417d3dbcb795d78efc487dc2bb
refs/heads/master
2020-03-08T15:27:12.913723
2019-07-10T05:49:10
2019-07-10T05:49:10
128,212,297
2
1
null
null
null
null
UTF-8
Java
false
false
542
java
package com.jhd.fangdazhongdianping; import android.os.Bundle; import android.app.Activity; import android.view.Menu; public class AllCategoryActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_all_category); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.all_category, menu); return true; } }
[ "916126728@qq.com" ]
916126728@qq.com
3c62bdadb9fcdd98bad0f0b52c4159615e01611c
2f20dc59e04b459e5710b328e0d70daecbe74e4b
/src/main/java/banane/io/pdb/service/UserService.java
69ecc0ccecdb5483bf5fcb1c70cd8a8932be4bb0
[ "Apache-2.0" ]
permissive
thyrgle/PDB
529e6364b92f2f33ebc5a17db08e38373c1f9da3
b3e09c4fa6a244f082dbebc80b73a3422d62adb7
refs/heads/master
2020-04-26T14:48:44.895285
2018-08-27T00:41:11
2018-08-27T00:41:11
173,627,313
0
0
null
2019-03-03T20:40:46
2019-03-03T20:40:46
null
UTF-8
Java
false
false
168
java
package banane.io.pdb.service; import banane.io.pdb.model.User; public interface UserService { void save(User user); User findByUsername(String username); }
[ "marcandr.girard@gmail.com" ]
marcandr.girard@gmail.com
309d750fa8c7613034f3416a49a9633003ee15f1
27b51bbca0f4e687f175eade86c63775803fa01d
/app/src/main/java/com/chinadci/mel/mleo/ldb/TrackPatrolTable.java
73bd1b14bbc4e42717a55959c25068ec8426371c
[]
no_license
loveextra/MobileLawEnforcement
535b0ef6ffd6a80794f6e52fe27811b848c6bf96
43200094fe2f97401762e4e1ebe4b92d1780846e
refs/heads/master
2022-09-15T15:43:28.270503
2017-09-27T07:22:55
2017-09-27T07:22:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
311
java
package com.chinadci.mel.mleo.ldb; /** * * @ClassName TrackPatrolTable * @Description TODO * @author leix@geo-k.cn * @date 2014年7月9日 下午4:45:15 * */ public interface TrackPatrolTable extends PatrolTable { public final String name = "TRACK_PATROL"; public final String field_inUser = "inUser"; }
[ "791096983@qq.com" ]
791096983@qq.com
deefd65cd4d5b5ace4eccc0f01e1a8d60b4910c3
1c7984046277c6d82ba65001c0a99e028269007c
/app/src/main/java/com/rachitgoyal/testperpule/module/main/MainDataManager.java
d220144077a93cc9a44e215df49715c420b9fa39
[]
no_license
rayzone107/DataManagerAbstraction
1a3db8b7265009f3b99c10fe9f32fd28b1b48447
7f1dcbbd1e4af801ba35a2694809b6e0a5e864de
refs/heads/master
2020-04-16T23:02:38.564584
2019-01-16T07:36:45
2019-01-16T07:36:45
165,995,680
0
0
null
null
null
null
UTF-8
Java
false
false
627
java
package com.rachitgoyal.testperpule.module.main; import com.rachitgoyal.testperpule.model.TestModel; import io.reactivex.Observable; /** * Created by Rachit Goyal on 16/01/19. */ public class MainDataManager { private MainServiceApi mMainServiceApi; private MainPersistenceApi mMainPersistenceApi; public MainDataManager(MainServiceApi mainServiceApi, MainPersistenceApi mainPersistenceApi) { mMainServiceApi = mainServiceApi; mMainPersistenceApi = mainPersistenceApi; } public Observable<TestModel> getTest(String test) { return mMainServiceApi.getTestModels(test); } }
[ "rachit@perpule.com" ]
rachit@perpule.com
3d83fea015536bd036ed0ef3e6fcb924a3843267
8769d3e46b520fd53b84d1d4e0c01647f6f14592
/pawn_race_java/src/game/AI/AIRandomMover.java
50ad84423951a0b22488023ab959f7fc37b1508c
[ "MIT" ]
permissive
j-freddy/pawn-race
714e7da41124c8509154a12f757dd3771cce2f28
5e6a3d23b0bdfacde3c30e23f59c8cdf34692930
refs/heads/main
2023-06-12T03:25:51.622023
2021-07-06T21:59:25
2021-07-06T21:59:25
382,726,093
0
0
null
null
null
null
UTF-8
Java
false
false
683
java
package game.AI; import game.Board; import game.Game; import game.Player; import game.misc.Colour; import game.misc.Move; import lib.NodeTree; import java.util.List; import java.util.Random; public class AIRandomMover implements AI { private Random random = new Random(); private final Game game; private final Colour colour; public AIRandomMover(Game game, Colour colour) { this.game = game; this.colour = colour; } @Override public Colour getColour() { return colour; } @Override public Move chooseMove() { List<Move> validMoves = game.getPlayerTurn().getValidMoves(); return validMoves.get(random.nextInt(validMoves.size())); } }
[ "jtf.imperial@gmail.com" ]
jtf.imperial@gmail.com
0f236b20cae3af4ea67ca0484d800fddd0253869
dd51cae213162b7dead25d313766a4f59ede10dd
/src/main/java/org/apache/storm/windowing/CustomFieldWindowStrategy.java
07da9688279959b85e062c29a9f2d0f0290c59cc
[]
no_license
mir1128/kafka-storm-example
54154e3ec146599dd37c375c61e9b9d4e2e6750f
40042c14e3526cc336b204d734266a8847016906
refs/heads/master
2021-05-01T03:56:34.819667
2018-02-28T02:36:20
2018-02-28T02:36:20
121,195,466
0
0
null
null
null
null
UTF-8
Java
false
false
747
java
package org.apache.storm.windowing; import org.apache.storm.trident.windowing.config.WindowConfig; import org.apache.storm.trident.windowing.strategy.BaseWindowStrategy; public class CustomFieldWindowStrategy<T> extends BaseWindowStrategy<T> { public CustomFieldWindowStrategy(WindowConfig windowConfig) { super(windowConfig); } @Override public TriggerPolicy<T> getTriggerPolicy(TriggerHandler triggerHandler, EvictionPolicy<T> evictionPolicy) { return new TimeTriggerPolicy<>(windowConfig.getSlidingLength(), triggerHandler, evictionPolicy); } @Override public EvictionPolicy<T> getEvictionPolicy() { return new CustomFieldTimeEvictionPolicy<>(1, windowConfig.getWindowLength()); } }
[ "jieliu@thoughtworks.com" ]
jieliu@thoughtworks.com
1499fe8ae3d107573e70895b63db1dcc08a1ca9f
5113953a8fe1ef2ad6fc4c8dc9918137eab3bf57
/src/com/wechat/mp/bean/menu/WxMpGetSelfMenuInfoResult.java
cd30dcd49dd9bc2113e6496533adf0b95e545038
[]
no_license
masterleesinsys/-
49772872aca74895e12c9528d02e3d0d128e6fb0
e58b240dec248e94d5bdeb68386bfdc7741297f0
refs/heads/master
2020-03-07T00:00:59.573246
2018-03-29T14:45:41
2018-03-29T14:47:50
127,147,657
0
0
null
null
null
null
UTF-8
Java
false
false
765
java
package com.wechat.mp.bean.menu; import com.google.gson.annotations.SerializedName; import lombok.Data; import com.wechat.common.util.ToStringUtils; import com.wechat.common.util.json.WxGsonBuilder; import java.io.Serializable; @Data public class WxMpGetSelfMenuInfoResult implements Serializable { private static final long serialVersionUID = -5612495636936835166L; @SerializedName("selfmenu_info") private WxMpSelfMenuInfo selfMenuInfo; @SerializedName("is_menu_open") private Integer isMenuOpen; public static WxMpGetSelfMenuInfoResult fromJson(String json) { return WxGsonBuilder.create().fromJson(json, WxMpGetSelfMenuInfoResult.class); } @Override public String toString() { return ToStringUtils.toSimpleString(this); } }
[ "oschina_java@126.com" ]
oschina_java@126.com
0c48fb76043c316e9b849976760151988898c21c
1b1fba5adfbef7ef059399acf388e555dc940cab
/src/main/java/com/example/demo/service/KafkaService.java
896fb33d072034e9adbc8771108b1f11e4d7cef7
[ "MIT" ]
permissive
QinghangPeng/SpringBootDemo
dcf3b508eba6fe5531aeb737ed3e046647c365ef
a40353eb2bd4b2b31baf983591310cbe5c0df5c7
refs/heads/master
2022-06-22T20:58:58.802808
2019-08-30T08:11:14
2019-08-30T08:11:14
176,133,068
2
0
MIT
2022-06-17T02:09:30
2019-03-17T17:04:34
Java
UTF-8
Java
false
false
772
java
package com.example.demo.service; import com.example.demo.kafka.KafkaProducer; import com.example.demo.vo.Vehicle; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * @ClassName KafkaService * @Description * @Author jackson * @Date 2019/4/26 17:42 * @Version 1.0 **/ @Service public class KafkaService { @Autowired private KafkaProducer producer; public void sendVehInfo(String topic, Vehicle vehicle) throws Exception{ int i = 1; String vin = "ph_tboxId"; while (true) { vehicle.setVin(vin + i%5); vehicle.setTboxId(vin+i); producer.send(topic,vehicle); i++; // Thread.sleep(3000L); } } }
[ "hao.peng@nx-engine.com" ]
hao.peng@nx-engine.com
e07e57f58d89dda57ba11bdb30e87fdb63086fb1
effacbb53c5d82a24e17c59025c74b46a19e903e
/src/main/java/com/packt/webstore/controller/HomeController.java
b924d1177fbc6dd36aecc52b44ae2cdf4641af9e
[]
no_license
xxgw/webstore
181e57c781087fbaab843bb0c07e88b7adae44b8
4783bd37011d8094b53cd5e0137fb7e141ed37f5
refs/heads/master
2021-08-29T04:44:50.588507
2017-12-13T12:17:00
2017-12-13T12:17:00
111,417,767
0
0
null
null
null
null
UTF-8
Java
false
false
483
java
package com.packt.webstore.controller; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping("/") public class HomeController { @RequestMapping public String welcome(Model model) { model.addAttribute("greeting", "Welcome to Web Store"); model.addAttribute("tagline", "The one and only amazing web store"); return "welcome"; } }
[ "zhijun.yang@ccblife.com.cn" ]
zhijun.yang@ccblife.com.cn
5283cfcf1a5d493a734a0ada5af45831f4187307
685460b378ff0b3364f5d5722b5cc8bdb18306c3
/src/Inheritance/Son.java
86593b6b53543b3974d1ad7bf4c18d4e8700bdba
[]
no_license
VJSriram/JavaIntroduction
9e5ae546343fae86b9cdc152aa2756c66be330b1
fcb56373f0b486323a1b4883c0cef74371b415e9
refs/heads/master
2020-05-20T21:22:24.779093
2017-03-10T06:31:11
2017-03-10T06:31:11
84,526,927
0
0
null
null
null
null
UTF-8
Java
false
false
324
java
package Inheritance; public class Son extends Grandfather{ public static void main(String[] args) { // TODO Auto-generated method stub Son s=new Son(); //object s.city(); s.country(); System.out.println(s.i); } public void activities() { System.out.println("Playing Cricket"); } }
[ "vuijay@outlook.com" ]
vuijay@outlook.com
54553dc01285461a9d48b183c61a58cfeeb3ad96
834ead01368f740ef8d12124aff1d2c743158b63
/src/om/nawras/mediation/ussd/ajelbundle/csi/client/ws/CheckAddOnBalance.java
48ef8bd6c7bf1a9deed22f059972f251204b8c47
[]
no_license
rejithramesh/UssdAjel
f889f8b8ed97bb723b86d37d6b9efae4da62e791
df29da8adbcb4ba237a6268e9712138b59c30f1b
refs/heads/master
2021-01-20T20:57:35.566486
2017-01-24T10:38:24
2017-01-24T10:38:24
65,891,627
0
0
null
null
null
null
UTF-8
Java
false
false
2,613
java
package om.nawras.mediation.ussd.ajelbundle.csi.client.ws; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="eventSource" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="language" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="sendSMS" type="{http://www.w3.org/2001/XMLSchema}boolean"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "eventSource", "language", "sendSMS" }) @XmlRootElement(name = "CheckAddOnBalance") public class CheckAddOnBalance { protected String eventSource; protected String language; protected boolean sendSMS; /** * Gets the value of the eventSource property. * * @return * possible object is * {@link String } * */ public String getEventSource() { return eventSource; } /** * Sets the value of the eventSource property. * * @param value * allowed object is * {@link String } * */ public void setEventSource(String value) { this.eventSource = value; } /** * Gets the value of the language property. * * @return * possible object is * {@link String } * */ public String getLanguage() { return language; } /** * Sets the value of the language property. * * @param value * allowed object is * {@link String } * */ public void setLanguage(String value) { this.language = value; } /** * Gets the value of the sendSMS property. * */ public boolean isSendSMS() { return sendSMS; } /** * Sets the value of the sendSMS property. * */ public void setSendSMS(boolean value) { this.sendSMS = value; } }
[ "rejithramesh@gmail.com" ]
rejithramesh@gmail.com
2eb4bd0fb4cf3fbb31f3c65fc761602b7f1ebba7
041a6e5db521c6866b401022087f68f3d376c202
/proto.PebbleGo/src/com/example/proto/pebblego/journey.java
320adb76e501667ace6774ae4e1e67b80b507e20
[]
no_license
scottgoldwater/HackMIT
154b36634d384d55f468ce237bb0aed3f5d88d69
14bf39226815cb97bed1179c514ea099feb76376
refs/heads/master
2016-09-16T02:41:46.961783
2013-10-15T17:26:45
2013-10-15T17:26:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,233
java
package com.example.proto.pebblego; import java.util.ArrayList; public class journey { @Override public String toString() { return "journey [distance=" + distance + ", startPoint=" + startPoint + ", endPoint=" + endPoint + ", steps=" + steps + "]"; } public String getDistance() { return distance; } public void setDistance(String distance) { this.distance = distance; } public String getStartPoint() { return startPoint; } public void setStartPoint(String startPoint) { this.startPoint = startPoint; } public String getEndPoint() { return endPoint; } public void setEndPoint(String endPoint) { this.endPoint = endPoint; } public journey(String distance, String startPoint, String endPoint) { this.distance = distance; this.startPoint = startPoint; this.endPoint = endPoint; this.steps = new ArrayList<Step>(); } public ArrayList<Step> getSteps() { return steps; } public void setSteps(ArrayList<Step> steps) { this.steps = steps; } public String distance; public String startPoint; public String endPoint; public ArrayList<Step> steps; public void addStep(Step a) { steps.add(a); } }
[ "scottgoldwater@gmail.com" ]
scottgoldwater@gmail.com
ab2260f4f812980bc729eee3c08fb74fd3510c9a
ff18c9ef20d429d818bcc0936f3ef6c8c4bec4d5
/src/main/java/com/jw/spring/controller/UserController.java
6a6377e5c95dd8854d153f1eb9062a498337dfd7
[]
no_license
CoinerTao/spring_boot_test
1a2a3747865ffde2458642e6a5b4ce524b74320a
bc2f74ef74ddad1020452737c6bfc3eb0f6cc39b
refs/heads/master
2021-06-09T04:32:13.976889
2016-12-07T07:43:08
2016-12-07T07:43:08
76,036,683
1
0
null
2016-12-09T13:14:10
2016-12-09T13:14:10
null
UTF-8
Java
false
false
876
java
package com.jw.spring.controller; import com.jw.spring.entity.User; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.jw.spring.service.UserService; /** * Created by jw on 16-12-3. */ @Controller class UserController { private Logger logger = Logger.getLogger(UserController.class); @Autowired private UserService userService; @RequestMapping("/getUserInfo") @ResponseBody public User getUserInfo() { User user = userService.findUserInfo(); if (user != null) { System.out.println(user.getId()); logger.info("user:" + user.getName()); } return user; } }
[ "wei.jiang@17zuoye.com" ]
wei.jiang@17zuoye.com
cf3c623cf9d735c6b52be10f584a280341232695
2091b1ec8058e57c72d3970403129c77c05c5706
/src/main/java/com/odde/hangman/Application.java
0b6cd8a2863afd23fe88d90f2ac238bb56e7c3cc
[]
no_license
nerds-odd-e/hangman
2f7c47dd28144830d118fcf0c3aba7632b57c28c
2b51244583cd103dc73db2ebf694c88c0e590bee
refs/heads/master
2020-12-07T13:36:42.568654
2017-12-09T12:16:52
2017-12-09T12:16:52
95,574,860
10
3
null
null
null
null
UTF-8
Java
false
false
529
java
package com.odde.hangman; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration; @SpringBootApplication @EnableAutoConfiguration(exclude = MustacheAutoConfiguration.class) public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
[ "joseph.yao.ruozhou@gmail.com" ]
joseph.yao.ruozhou@gmail.com
5dc9daecca82f6ddd96ba20f1994db887807da54
9e452730e8b3905131e586b58b6ed9c6ba40c254
/Rose/src/main/java/egovframework/com/uss/ion/apu/Pagination.java
78459df4f2e8e1a45a2888a439390290a22c1ca5
[]
no_license
egovcenter/Rose
5b52731f7bc83fba8519c84942b246605da0aa69
d0621e9db1872a48b2b938f8f691237344cac140
refs/heads/master
2021-01-12T13:37:51.143180
2016-11-18T09:10:27
2016-11-18T09:10:27
68,989,565
0
0
null
null
null
null
UTF-8
Java
false
false
4,802
java
package egovframework.com.uss.ion.apu; public class Pagination { /** * 총 레코드 수 */ private int totalRecordCount = 0; /** * 한 페이지당 레코드 수 */ private int recordCountPerPage = 10; /** * 현재 페이지 번호 */ private int currentPageNo = 1; /** * 페이지 리스트에 보여지는 페이지 개수 */ private int pageSize = 10; /** * 전체 페이지 수 */ private int totalPageCount; /** * 페이지 리스트의 첫 페이지 번호 */ private int firstPageNoOnPageList; /** * 페이지 리스트의 마지막 페이지 번호 */ private int lastPageNoOnPageList; /** * 현재 페이지의 시작 레코드 번호(for DB SQL) */ private int firstRecordIndex; /** * 현재 페이지의 마지막 레코드 번호(for DB SQL) */ private int lastRecordIndex; /** * 현재 페이지의 시작 레코드 번호(for View) */ private int firstRecordIndexOnCurrentPage; /** * 현재 페이지의 마지막 레코드 번호(for View) */ private int lastRecordIndexOnCurrentPage; /** * 목록 정렬 컬럼 */ private String orderColumn; /** * 목록 정렬 방법(asc / desc) */ private String orderMethod; /** * 총 레코드 수 */ public int getTotalRecordCount() { return totalRecordCount; } /** * 총 레코드 수 */ public void setTotalRecordCount(int totalRecordCount) { this.totalRecordCount = totalRecordCount; } /** * 한 페이지당 레코드 수 */ public int getRecordCountPerPage() { return recordCountPerPage; } /** * 한 페이지당 레코드 수 */ public void setRecordCountPerPage(int recordCountPerPage) { this.recordCountPerPage = recordCountPerPage; } /** * 현재 페이지 번호 */ public int getCurrentPageNo() { return currentPageNo; } /** * 현재 페이지 번호 */ public void setCurrentPageNo(int currentPageNo) { this.currentPageNo = currentPageNo; } /** * 페이지 리스트에 보여지는 페이지 개수 */ public int getPageSize() { return pageSize; } /** * 페이지 리스트에 보여지는 페이지 개수 */ public void setPageSize(int pageSize) { this.pageSize = pageSize; } /** * 전체 페이지 수 */ public int getTotalPageCount() { totalPageCount = ((getTotalRecordCount()-1)/getRecordCountPerPage()) + 1; return totalPageCount; } /** * 페이지 리스트의 첫 페이지 번호 */ public int getFirstPageNoOnPageList() { firstPageNoOnPageList = ((getCurrentPageNo()-1)/getPageSize())*getPageSize() + 1; return firstPageNoOnPageList; } /** * 페이지 리스트의 마지막 페이지 번호 */ public int getLastPageNoOnPageList() { lastPageNoOnPageList = getFirstPageNoOnPageList() + getPageSize() - 1; if(lastPageNoOnPageList > getTotalPageCount()){ lastPageNoOnPageList = getTotalPageCount(); } return lastPageNoOnPageList; } /** * 현재 페이지의 시작 레코드 번호(for DB SQL) */ public int getFirstRecordIndex() { firstRecordIndex = (getCurrentPageNo() - 1) * getRecordCountPerPage() + 1; return firstRecordIndex; } /** * 현재 페이지의 마지막 레코드 번호(for DB SQL) */ public int getLastRecordIndex() { lastRecordIndex = getCurrentPageNo() * getRecordCountPerPage(); return lastRecordIndex; } /** * 현재 페이지의 시작 레코드 번호(for View) */ public int getFirstRecordIndexOnCurrentPage(){ if(totalRecordCount==0){ firstRecordIndexOnCurrentPage = 0; }else{ firstRecordIndexOnCurrentPage = getFirstRecordIndex(); } return firstRecordIndexOnCurrentPage; } /** * 현재 페이지의 마지막 레코드 번호(for View) */ public int getLastRecordIndexOnCurrentPage(){ if(recordCountPerPage >= totalRecordCount){ lastRecordIndexOnCurrentPage = totalRecordCount; }else if(recordCountPerPage < totalRecordCount){ if(getCurrentPageNo() < getTotalPageCount()){ lastRecordIndexOnCurrentPage = getLastRecordIndex(); }else if(getCurrentPageNo() == getTotalPageCount()){ lastRecordIndexOnCurrentPage = totalRecordCount; } } return lastRecordIndexOnCurrentPage; } /** * 목록 정렬 컬럼 */ public String getOrderColumn() { return orderColumn; } /** * 목록 정렬 컬럼 */ public void setOrderColumn(String orderColumn) { this.orderColumn = orderColumn; } /** * 목록 정렬 방법(asc / desc) */ public String getOrderMethod() { return orderMethod; } /** * 목록 정렬 방법(asc / desc) */ public void setOrderMethod(String orderMethod) { this.orderMethod = orderMethod; } }
[ "paul@thebridgesoft.kr" ]
paul@thebridgesoft.kr
cd3d3cd12fb490bb8b939fe9eafe1171068dba74
8250a2b1b001ecfaec0699bb6deaf8a3e35088e5
/src/game/games/DoublePlayerGame.java
62600bbd34ad35318daed84272223cd94e348520
[]
no_license
charlielin99/Battle-Tetromino
c4ef755f3214c9bb852721bb545c48a996118243
6a8123d8495679fb4dc2d367c39f7d47c7310414
refs/heads/master
2020-03-19T02:45:44.610178
2018-06-21T23:33:44
2018-06-21T23:33:44
135,658,398
2
2
null
null
null
null
UTF-8
Java
false
false
14,561
java
package game.games; import game.Tetromino; import game.gameboards.AIDoublePlayerGameBoard; import game.gameboards.DoublePlayerGameBoard; import game.gameboards.GameBoard; import game.queue.*; import javax.swing.*; import java.awt.*; /** * Created by bradh on 1/18/2017. */ abstract class DoublePlayerGame extends TetrisGame{ protected GameBoard opponentGameBoard; protected Tetromino opponentCurrentTetromino, opponentHoldTetromino = null; protected Queue<Tetromino> opponentTetrominoQueue = new Queue<Tetromino>(); protected boolean opponentReady, opponentGameOver, rewardMode; protected int opponentScore = 0, opponentLines = 0, tetrominoEnqueued = 0; protected JLabel opponentHoldLabel, opponentScoreLabel, opponentLineLabel, opponentIcon; protected JLabel[] opponentNextLabels = new JLabel[3]; protected boolean iWonLevel; public DoublePlayerGame(String nickName, String iconPath){ super(); setSize(1360, 768); setLocationRelativeTo(null); JLabel myIcon = new JLabel(nickName); myIcon.setFont(new Font("Segoe UI", Font.BOLD, 20)); myIcon.setBounds(180, 80, 300, 64); myIcon.setIcon(new ImageIcon(iconPath)); myIcon.setHorizontalAlignment(SwingConstants.LEFT); getContentPane().add(myIcon); opponentIcon = new JLabel(); opponentIcon.setFont(new Font("Segoe UI", Font.BOLD, 20)); opponentIcon.setBounds(1360 - 180 - 300, 80, 300, 64); opponentIcon.setHorizontalAlignment(SwingConstants.RIGHT); getContentPane().add(opponentIcon); iconLabel.setBounds(490, 39, 400, 50); levelLabel.setBounds(620, 100, 120, 36); JLabel lblHold = new JLabel("Hold"); lblHold.setFont(new Font("Tahoma", Font.PLAIN, 20)); lblHold.setBounds(680, 220, 170, 20); lblHold.setHorizontalAlignment(SwingConstants.CENTER); getContentPane().add(lblHold); opponentHoldLabel = new JLabel(""); ImageIcon img1 = new ImageIcon("resources/hold.png"); opponentHoldLabel.setIcon(img1); opponentHoldLabel.setBounds(53 + 680, 250, 64, 64); getContentPane().add(opponentHoldLabel); JLabel lblScore = new JLabel("Score"); lblScore.setHorizontalAlignment(SwingConstants.CENTER); lblScore.setFont(new Font("Tahoma", Font.PLAIN, 18)); lblScore.setBounds(680, 440, 170, 22); getContentPane().add(lblScore); opponentScoreLabel = new JLabel("0"); opponentScoreLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); opponentScoreLabel.setHorizontalAlignment(SwingConstants.CENTER); opponentScoreLabel.setBounds(680, 470, 170, 22); getContentPane().add(opponentScoreLabel); JLabel lblLines = new JLabel("Lines"); lblLines.setHorizontalAlignment(SwingConstants.CENTER); lblLines.setFont(new Font("Tahoma", Font.PLAIN, 18)); lblLines.setBounds(680, 525, 170, 22); getContentPane().add(lblLines); opponentLineLabel = new JLabel("0"); opponentLineLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); opponentLineLabel.setHorizontalAlignment(SwingConstants.CENTER); opponentLineLabel.setBounds(680, 555, 170, 22); getContentPane().add(opponentLineLabel); JLabel lblNext = new JLabel("Next"); lblNext.setHorizontalAlignment(SwingConstants.CENTER); lblNext.setFont(new Font("Tahoma", Font.PLAIN, 18)); lblNext.setBounds(509 + 680, 208, 170, 22); getContentPane().add(lblNext); opponentNextLabels[0] = new JLabel(""); opponentNextLabels[0].setBounds(562 + 680, 241, 64, 64); getContentPane().add(opponentNextLabels[0]); opponentNextLabels[1] = new JLabel(""); opponentNextLabels[1].setBounds(562 + 680, 316, 64, 64); getContentPane().add(opponentNextLabels[1]); opponentNextLabels[2] = new JLabel(""); opponentNextLabels[2].setBounds(562 + 680, 391, 64, 64); getContentPane().add(opponentNextLabels[2]); } public void run(){ setVisible(true); opponentReady = false; ready = false; requestFocus(); new Thread(this :: setupMyReadyScreen).start(); new Thread(this :: setupOpponentReadyScreen).start(); while (!(ready && opponentReady)){ try { Thread.sleep(100); } catch (InterruptedException e){ e.printStackTrace(); } } for (int i = 0; i < 5; i++){ requestTetromino(); } setupCountDownScreen(); repaint(); playing = true; gameOver = false; opponentGameOver = false; new Thread(this :: upDateLevel).start(); new Thread(this :: myGameGo).start(); new Thread(this :: opponentGameGo).start(); new Thread(this :: checkMyHold).start(); new Thread(this :: checkOpponentHold).start(); } protected void myGameGo() { int linesDisappeared; myCurrentTetromino = myTetrominoQueue.dequeue(); myGameBoard.newTetromino(myCurrentTetromino); Object[] tetrominos = myTetrominoQueue.peek(3); for (int i = 0; i < 3; i++) { myNextLabels[i].setIcon(((Tetromino) tetrominos[i]).getImg()); } gameLoop: while (!gameOver) { while (playing) { try { if (myGameBoard.isAtBottom()) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } if (myGameBoard.isAtBottom()) { myGameBoard.solidifyTetromino(); if (myGameBoard.gameOver()) { gameOver = true; break gameLoop; } tetrominoNum++; myScore += 10 * level; linesDisappeared = myGameBoard.checkDisapperance(); myLines += linesDisappeared; myScore += Math.pow(linesDisappeared, 2) * 100; try { ((DoublePlayerGameBoard) opponentGameBoard).addLinesOnTop(linesDisappeared - 1); } catch (ClassCastException e) { ((AIDoublePlayerGameBoard) opponentGameBoard).addLinesOnTop(linesDisappeared - 1); } myLineLabel.setText("" + myLines); myScoreLabel.setText("" + myScore); myCurrentTetromino = myTetrominoQueue.dequeue(); myGameBoard.newTetromino(myCurrentTetromino); requestTetromino(); tetrominos = myTetrominoQueue.peek(3); for (int i = 0; i < 3; i++) { myNextLabels[i].setIcon(((Tetromino) tetrominos[i]).getImg()); } if (linesDisappeared > 0) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } repaint(); } } myGameBoard.moveDown(); Thread.sleep(level < 7 ? (500 - level * 40) : (340 / (level - 5)) + 150); } catch (InterruptedException e) { e.printStackTrace(); } } while (!playing) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } } setupMyGameOverScreen(); } protected void opponentGameGo(){ int linesDisappeared; opponentCurrentTetromino = opponentTetrominoQueue.dequeue(); opponentGameBoard.newTetromino(opponentCurrentTetromino); Object[] tetrominos = opponentTetrominoQueue.peek(3); for (int i = 0; i < 3; i++){ opponentNextLabels[i].setIcon(((Tetromino)tetrominos[i]).getImg()); } gameLoop: while (!opponentGameOver){ while (playing){ try { if (opponentGameBoard.isAtBottom()){ try { Thread.sleep(100); } catch (InterruptedException e){ e.printStackTrace(); } if (opponentGameBoard.isAtBottom()) { opponentGameBoard.solidifyTetromino(); if (opponentGameBoard.gameOver()) { opponentGameOver = true; break gameLoop; } tetrominoNum++; opponentScore += 10 * level; linesDisappeared = opponentGameBoard.checkDisapperance(); opponentLines += linesDisappeared; opponentScore += Math.pow(linesDisappeared, 2) * 100; ((DoublePlayerGameBoard) myGameBoard).addLinesOnTop(linesDisappeared - 1); opponentLineLabel.setText("" + opponentLines); opponentScoreLabel.setText("" + opponentScore); opponentCurrentTetromino = opponentTetrominoQueue.dequeue(); opponentGameBoard.newTetromino(opponentCurrentTetromino); requestTetromino(); tetrominos = opponentTetrominoQueue.peek(3); for (int i = 0; i < 3; i++) { opponentNextLabels[i].setIcon(((Tetromino) tetrominos[i]).getImg()); } if (linesDisappeared > 0) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } repaint(); } } opponentGameBoard.moveDown(); Thread.sleep(level < 7 ? (500 - level * 40) : (340 / (level - 5)) + 150); } catch (InterruptedException e){ e.printStackTrace(); } } while (!playing){ try { Thread.sleep(500); } catch (InterruptedException e){ e.printStackTrace(); } } } setupOpponentGameOverScreen(); } public void enqueueTetromino(Tetromino tetromino){ myTetrominoQueue.enqueue(tetromino); opponentTetrominoQueue.enqueue(tetromino); tetrominoEnqueued++; } private void upDateLevel(){ int prevLevel = level, myPrevScore = 0, opponentPrevScore = 0, myLevelScore, opponentLevelScore; while (!(gameOver && opponentGameOver)){ level = tetrominoEnqueued / 8 + 1; levelLabel.setText("Level " + level); if (!(this instanceof OnlineBattleGame)){ if (level != prevLevel && !gameOver && !opponentGameOver){ playing = false; rewardMode = true; myLevelScore = myScore - myPrevScore; opponentLevelScore = opponentScore - opponentPrevScore; setupRewardModeScreen(myLevelScore, opponentLevelScore); while (rewardMode){ try { Thread.sleep(100); } catch (InterruptedException e){ e.printStackTrace(); } } prevLevel = level; myPrevScore = myScore; opponentPrevScore = opponentScore; repaint(); } } try { Thread.sleep(100); } catch (InterruptedException e){ e.printStackTrace(); } } } private void checkOpponentHold(){ while (!opponentGameOver){ try { Thread.sleep(10); } catch (InterruptedException e){ e.printStackTrace(); } if (opponentGameBoard.getHoldSwitch()){ if (opponentHoldTetromino == null){ opponentHoldTetromino = opponentTetrominoQueue.dequeue(); opponentTetrominoQueue.enqueue(new Tetromino()); requestTetromino(); Object[] tetrominos = opponentTetrominoQueue.peek(3); for (int i = 0; i < 3; i++){ opponentNextLabels[i].setIcon(((Tetromino)tetrominos[i]).getImg()); } } Tetromino buffer = opponentHoldTetromino; opponentHoldTetromino = opponentCurrentTetromino; opponentCurrentTetromino = buffer; opponentGameBoard.current = opponentCurrentTetromino; opponentGameBoard.replace(opponentCurrentTetromino); opponentHoldLabel.setIcon(opponentHoldTetromino.getImg()); repaint(); } } } /** * a semi-transparent screen that asks if the player is ready for the game */ abstract void setupOpponentReadyScreen(); /** * a semi-transparent screen that tells the player the information of the opponent after it is over */ abstract void setupOpponentGameOverScreen(); /** * reward screen */ abstract void setupRewardModeScreen(int myLevelScore, int opponentLevelScore); }
[ "hlin266@uwo.ca" ]
hlin266@uwo.ca
240eda30e1a7bd03fb75c2b57077145902af7128
fa5f4cfa98e26c7f94e6ec390172052ed6733765
/src/main/java/com/scottmarden/grouplanguages/models/Language.java
effd2604d51599890a926f4263a3d5e8f64e6230
[]
no_license
scottmarden/CD-java-springDataI-group_languages
fdd863b7461e88c1f30c63d32730fe0525ff86e9
b31a2646a92c55825649808b7577dcb5b3c80f3c
refs/heads/master
2021-01-15T21:14:53.395307
2017-08-09T22:05:56
2017-08-09T22:05:56
99,856,621
0
0
null
null
null
null
UTF-8
Java
false
false
781
java
package com.scottmarden.grouplanguages.models; import javax.validation.constraints.Size; public class Language { @Size(min = 2, max = 20) private String name; @Size(min = 2, max = 20) private String creator; private String version; public Language() { } public Language(String name, String creator, String version) { this.name = name; this.creator = creator; this.version = version; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getCreator() { return creator; } public void setCreator(String creator) { this.creator = creator; } public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } }
[ "marden.scott@gmail.com" ]
marden.scott@gmail.com
752ccf53257ef32b634f94e18130eb29f8824453
067f76a365a530ce0dcec520cb7e03623a9df12e
/lesson05/test/by/epam/javatraining/alekseev/lesson05/task01/model/logic/DragonLogicTest.java
d474206133d1c2069c01f8d4ee588683dea63f5b
[]
no_license
Oddy-Nuff-Da-Snow-Leopard/JavaTraining
c5988dcc64aa15f0a9107004cfe9e89eae0d5b37
71fda5d9881205da8695149f1c465a89585441cf
refs/heads/master
2020-05-25T23:21:01.291647
2019-06-21T14:29:26
2019-06-21T14:29:26
186,502,379
0
0
null
null
null
null
UTF-8
Java
false
false
2,213
java
package by.epam.javatraining.alekseev.lesson05.task01.model.logic; import org.junit.Test; import static org.junit.Assert.*; public class DragonLogicTest { @Test public void testCountHeadsNegative() { int age = -100; int expResult = 0; int result = DragonLogic.countHeads(age); assertEquals(expResult, result); } @Test public void testCountEyesNegative() { int age = -100; int expResult = 0; int result = DragonLogic.countEyes(age); assertEquals(expResult, result); } @Test public void testCountHeadsZero() { int age = 0; int expResult = 3; int result = DragonLogic.countHeads(age); assertEquals(expResult, result); } @Test public void testCountEyesZero() { int age = 0; int expResult = 6; int result = DragonLogic.countEyes(age); assertEquals(expResult, result); } @Test public void testCountHeadsFirstAgeLimit() { int age = 100; int expResult = 303; int result = DragonLogic.countHeads(age); assertEquals(expResult, result); } @Test public void testCountEyesFirstAgeLimit() { int age = 100; int expResult = 606; int result = DragonLogic.countEyes(age); assertEquals(expResult, result); } @Test public void testCountHeadsSecondAgeLimit() { int age = 250; int expResult = 703; int result = DragonLogic.countHeads(age); assertEquals(expResult, result); } @Test public void testCountEyesSecondAgeLimit() { int age = 250; int expResult = 1406; int result = DragonLogic.countEyes(age); assertEquals(expResult, result); } @Test public void testCountHeadsNoAgeLimit() { int age = 1000; int expResult = 1503; int result = DragonLogic.countHeads(age); assertEquals(expResult, result); } @Test public void testCountEyesNoAgeLimit() { int age = 1000; int expResult = 3006; int result = DragonLogic.countEyes(age); assertEquals(expResult, result); } }
[ "angry.school.boy@mail.ru" ]
angry.school.boy@mail.ru
4be19ae2cffc307539116f3d3cdba7a87182fc84
34fb1da005d1493000cfa7e7c6a02060e0788718
/orca-clouddriver/src/test/java/com/netflix/spinnaker/orca/clouddriver/tasks/providers/gce/SetStatefulDiskTaskTest.java
8464fc885bb22a3eeb2f4349e48c48b0c0fd7114
[ "Apache-2.0" ]
permissive
cerner/orca
2bc2a57113d642335ae0847c8a044d930dfe7791
37f36392011e1055ce81dbd6e957ead98706c61d
refs/heads/master
2021-01-13T04:56:25.084634
2019-06-20T18:51:38
2019-06-20T18:51:38
81,138,423
0
2
Apache-2.0
2018-08-03T17:18:16
2017-02-06T22:04:48
Groovy
UTF-8
Java
false
false
3,370
java
/* * * * Copyright 2019 Google, Inc. * * * * Licensed under the Apache License, Version 2.0 (the "License") * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * */ package com.netflix.spinnaker.orca.clouddriver.tasks.providers.gce; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.netflix.spinnaker.orca.TaskResult; import com.netflix.spinnaker.orca.clouddriver.KatoService; import com.netflix.spinnaker.orca.clouddriver.model.TaskId; import com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.support.TargetServerGroup; import com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.support.TargetServerGroupResolver; import com.netflix.spinnaker.orca.pipeline.model.Stage; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; import rx.Observable; @RunWith(JUnit4.class) public class SetStatefulDiskTaskTest { private SetStatefulDiskTask task; private KatoService katoService; private TargetServerGroupResolver resolver; @Before public void setUp() { katoService = mock(KatoService.class); resolver = mock(TargetServerGroupResolver.class); task = new SetStatefulDiskTask(katoService, resolver); } @Test public void success() { when(resolver.resolve(any())) .thenReturn( ImmutableList.of(new TargetServerGroup(ImmutableMap.of("name", "testapp-v000")))); when(katoService.requestOperations(any(), any())) .thenReturn(Observable.just(new TaskId("10111"))); Stage stage = new Stage(); stage.getContext().put("cloudProvider", "gce"); stage.getContext().put("credentials", "spinnaker-test"); stage.getContext().put("serverGroupName", "testapp-v000"); stage.getContext().put("region", "us-desertoasis1"); stage.getContext().put("deviceName", "testapp-v000-1"); TaskResult result = task.execute(stage); ImmutableMap<String, String> operationParams = ImmutableMap.of( "credentials", "spinnaker-test", "serverGroupName", "testapp-v000", "region", "us-desertoasis1", "deviceName", "testapp-v000-1"); verify(katoService) .requestOperations( "gce", ImmutableList.of(ImmutableMap.of("setStatefulDisk", operationParams))); assertThat(result.getContext().get("notification.type")).isEqualTo("setstatefuldisk"); assertThat(result.getContext().get("serverGroupName")).isEqualTo("testapp-v000"); assertThat(result.getContext().get("deploy.server.groups")) .isEqualTo(ImmutableMap.of("us-desertoasis1", ImmutableList.of("testapp-v000"))); } }
[ "jacobkiefer@google.com" ]
jacobkiefer@google.com
69fa1f8ef677c7b2cc2231e86f670e67b4826344
40c6d600ee6945702ac2ee853e809207e099691d
/app/src/main/java/cn/ysgroup/ysdai/EventBus/SubscriberMethodFinder.java
5eb133c0449ed6f442971a46952e5c3494301888
[]
no_license
niarehtni/ystz-android
e911899b50b8262bea425e67068fca902ebf14f5
83779248522aaead8c8037a2b53b3945b9f1e08a
refs/heads/master
2020-04-20T12:57:23.217192
2018-01-09T08:19:20
2018-01-09T08:19:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,317
java
/* * Copyright (C) 2012 Markus Junginger, greenrobot (http://greenrobot.de) * * 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 cn.ysgroup.ysdai.EventBus; import android.util.Log; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; class SubscriberMethodFinder { private static final String ON_EVENT_METHOD_NAME = "onEvent"; /* * In newer class files, compilers may add methods. Those are called bridge or synthetic methods. * EventBus must ignore both. There modifiers are not public but defined in the Java class file format: * http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.6-200-A.1 */ private static final int BRIDGE = 0x40; private static final int SYNTHETIC = 0x1000; private static final int MODIFIERS_IGNORE = Modifier.ABSTRACT | Modifier.STATIC | BRIDGE | SYNTHETIC; private static final Map<String, List<SubscriberMethod>> methodCache = new HashMap<String, List<SubscriberMethod>>(); private final Map<Class<?>, Class<?>> skipMethodVerificationForClasses; SubscriberMethodFinder(List<Class<?>> skipMethodVerificationForClassesList) { skipMethodVerificationForClasses = new ConcurrentHashMap<Class<?>, Class<?>>(); if (skipMethodVerificationForClassesList != null) { for (Class<?> clazz : skipMethodVerificationForClassesList) { skipMethodVerificationForClasses.put(clazz, clazz); } } } List<SubscriberMethod> findSubscriberMethods(Class<?> subscriberClass) { String key = subscriberClass.getName(); List<SubscriberMethod> subscriberMethods; synchronized (methodCache) { subscriberMethods = methodCache.get(key); } if (subscriberMethods != null) { return subscriberMethods; } subscriberMethods = new ArrayList<SubscriberMethod>(); Class<?> clazz = subscriberClass; HashSet<String> eventTypesFound = new HashSet<String>(); StringBuilder methodKeyBuilder = new StringBuilder(); while (clazz != null) { String name = clazz.getName(); if (name.startsWith("java.") || name.startsWith("javax.") || name.startsWith("android.")) { // Skip system classes, this just degrades performance break; } // Starting with EventBus 2.2 we enforced methods to be public (might change with annotations again) Method[] methods = clazz.getDeclaredMethods(); for (Method method : methods) { String methodName = method.getName(); if (methodName.startsWith(ON_EVENT_METHOD_NAME)) { int modifiers = method.getModifiers(); if ((modifiers & Modifier.PUBLIC) != 0 && (modifiers & MODIFIERS_IGNORE) == 0) { Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length == 1) { String modifierString = methodName.substring(ON_EVENT_METHOD_NAME.length()); ThreadMode threadMode; if (modifierString.length() == 0) { threadMode = ThreadMode.PostThread; } else if (modifierString.equals("MainThread")) { threadMode = ThreadMode.MainThread; } else if (modifierString.equals("BackgroundThread")) { threadMode = ThreadMode.BackgroundThread; } else if (modifierString.equals("Async")) { threadMode = ThreadMode.Async; } else { if (skipMethodVerificationForClasses.containsKey(clazz)) { continue; } else { throw new EventBusException("Illegal onEvent method, check for typos: " + method); } } Class<?> eventType = parameterTypes[0]; methodKeyBuilder.setLength(0); methodKeyBuilder.append(methodName); methodKeyBuilder.append('>').append(eventType.getName()); String methodKey = methodKeyBuilder.toString(); if (eventTypesFound.add(methodKey)) { // Only add if not already found in a sub class subscriberMethods.add(new SubscriberMethod(method, threadMode, eventType)); } } } else if (!skipMethodVerificationForClasses.containsKey(clazz)) { Log.d(EventBus.TAG, "Skipping method (not public, static or abstract): " + clazz + "." + methodName); } } } clazz = clazz.getSuperclass(); } if (subscriberMethods.isEmpty()) { throw new EventBusException("Subscriber " + subscriberClass + " has no public methods called " + ON_EVENT_METHOD_NAME); } else { synchronized (methodCache) { methodCache.put(key, subscriberMethods); } return subscriberMethods; } } static void clearCaches() { synchronized (methodCache) { methodCache.clear(); } } }
[ "yeyafei@yueshanggroup.cn" ]
yeyafei@yueshanggroup.cn
a2f6ee05a8d7403a1708cc216a83d95e54106355
a2affcb0c5a6d4a1798825ddbe8bcd30713b3cb6
/src/EV3main.java
f19dc800032235f7173c877f980f320af4125460
[]
no_license
MalenB/Roberta
d1abade6bceaf9675fc22bed16ae4092211b2d35
50c5617bc4e588341e0ae64c73240b88bbea2fcf
refs/heads/master
2020-03-21T06:19:40.163679
2018-08-14T13:19:31
2018-08-14T13:19:31
138,212,487
0
0
null
null
null
null
UTF-8
Java
false
false
4,418
java
import lejos.hardware.ev3.LocalEV3; import lejos.hardware.motor.EV3LargeRegulatedMotor; import lejos.hardware.motor.EV3MediumRegulatedMotor; import lejos.hardware.port.MotorPort; import lejos.hardware.sensor.EV3GyroSensor; import lejos.hardware.sensor.EV3UltrasonicSensor; import lejos.robotics.SampleProvider; import lejos.robotics.chassis.Chassis; import lejos.robotics.chassis.Wheel; import lejos.robotics.chassis.WheeledChassis; import lejos.robotics.localization.OdometryPoseProvider; import lejos.robotics.localization.PoseProvider; import lejos.robotics.navigation.MovePilot; import lejos.robotics.navigation.Navigator; public class EV3main extends Thread { private static EV3LargeRegulatedMotor mL; private static EV3LargeRegulatedMotor mR; private static EV3MediumRegulatedMotor mB; private static MovePilot pilot; private static PoseProvider poseProvider; private static double radius = 300; private static Data data; private static int numSamples=200; // Number of samples to record private static int numVariables=2; // Number of variables to record samples of private EV3GyroSensor gyroSensor; private static SampleProvider heading; private static float[] gyroSample; private EV3UltrasonicSensor distSensor; private static Navigator navigator; private static SampleProvider distance; private static float[] distSample; public EV3main() { // Sensors: // Get ports for sensors lejos.hardware.port.Port distPort = LocalEV3.get().getPort("S1"); lejos.hardware.port.Port gyroPort = LocalEV3.get().getPort("S4"); // Create new sensor objects distSensor = new EV3UltrasonicSensor(distPort); gyroSensor = new EV3GyroSensor(gyroPort); // Get a sample provider for these sensors in the specified measurement modes distance= distSensor.getDistanceMode(); heading= gyroSensor.getAngleMode(); // Create arrays for fetching samples (size specified by the sample provider). distSample = new float[distance.sampleSize()]; gyroSample = new float[heading.sampleSize()]; mL = new EV3LargeRegulatedMotor(MotorPort.A); // Left motor mR = new EV3LargeRegulatedMotor(MotorPort.D); // Right motor mB = new EV3MediumRegulatedMotor(MotorPort.B); // Motor controlling platform with the ultrasonic sensor // Chassis and pilot setup Chassis chassis; Wheel wheelL = WheeledChassis.modelWheel(mL, 0.042).offset(0.059).invert(true); Wheel wheelR = WheeledChassis.modelWheel(mR, 0.042).offset(-0.059).invert(true); chassis = new WheeledChassis(new Wheel[] { wheelL, wheelR }, WheeledChassis.TYPE_DIFFERENTIAL); pilot = new MovePilot(chassis); poseProvider = chassis.getPoseProvider(); radius = Math.max(radius, pilot.getMinRadius()); poseProvider = new OdometryPoseProvider(pilot); pilot.setLinearSpeed(pilot.getMaxLinearSpeed() / 4); pilot.setLinearAcceleration(pilot.getMaxLinearSpeed() / 6); pilot.setAngularSpeed(pilot.getMaxAngularSpeed() / 4); pilot.setAngularAcceleration(pilot.getMaxAngularSpeed() / 6); navigator=new Navigator(pilot, poseProvider); data=new Data(numSamples, numVariables); } public static void main(String[] args) { new EV3main(); Thread com = new EV3ComThread(data); com.start(); scan(); while(true) { if(data.getPathReady()) { followPath(data.getPath()); } } } public static void scan() { double[][] dataM = new double[data.getNumSaples()][data.getNumVariables()]; heading.fetchSample(gyroSample, 0); dataM[0][0]=poseProvider.getPose().getX(); dataM[0][1]=poseProvider.getPose().getY(); dataM[1][0]=gyroSample[0]; dataM[1][1]=poseProvider.getPose().getHeading(); System.out.println("X: "+dataM[0][0]+", Y: "+dataM[0][1]); System.out.println("Angle: "+dataM[1][0]+", Distance: "+dataM[1][1]); int i=2; if (Math.abs(mB.getTachoCount()-360)<5) { mB.rotateTo(0,true); }else if (Math.abs(mB.getTachoCount())<5) { mB.rotateTo(360,true); } while(mB.isMoving()) { distance.fetchSample(distSample, 0); dataM[i][0]=mB.getTachoCount(); dataM[i][1]=distSample[0]; System.out.println("Angle: "+dataM[i][0]+", Distance: "+dataM[i][1]); i++; } System.out.println(i); data.setData(dataM); } public static void followPath(double[][] points) { for (int i=0; i<=points.length;i++){ navigator.goTo((float)points[i][0], (float)points[i][1], (float)points[i][2]); while(navigator.isMoving()) {}; scan(); } } }
[ "malen_1995@hotmail.com" ]
malen_1995@hotmail.com
365e08d56054111718006fe01153a3cf29fd2ddb
e38dfe17b74c2358da11ee82e4b9e542ace9478b
/Marvin/Dependencies/Enzo/Lcd/src/main/java/eu/hansolo/enzo/lcd/LcdBuilder.java
b266a00f894e1fb2b8951001a527a71ad5a109e1
[ "Apache-2.0" ]
permissive
intel/Board-Instrumentation-Framework
51dc2f58fa8e1389a2214ac41967339688cbec73
198820b783e5652b943bc9189a05838aca1a18d8
refs/heads/master
2023-09-03T07:39:23.747378
2023-05-04T15:29:19
2023-05-04T15:29:19
105,209,045
19
19
Apache-2.0
2023-04-07T10:16:06
2017-09-28T23:34:35
Java
UTF-8
Java
false
false
22,759
java
/* * Copyright (c) 2015 by Gerrit Grunwald * * 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 eu.hansolo.enzo.lcd; import eu.hansolo.enzo.lcd.Lcd.LcdDesign; import javafx.beans.property.BooleanProperty; import javafx.beans.property.DoubleProperty; import javafx.beans.property.IntegerProperty; import javafx.beans.property.ObjectProperty; import javafx.beans.property.Property; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleDoubleProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import javafx.geometry.Dimension2D; import java.util.HashMap; /** * Created by * User: hansolo * Date: 14.03.12 * Time: 15:34 */ public class LcdBuilder<B extends LcdBuilder<B>> { private HashMap<String, Property> properties = new HashMap<>(); // ******************** Constructors ************************************** protected LcdBuilder() {} // ******************** Methods ******************************************* public static final LcdBuilder create() { return new LcdBuilder(); } public final B styleClass(final String STYLE_CLASS) { properties.put("styleClass", new SimpleStringProperty(STYLE_CLASS)); return (B) this; } public final B textMode(final boolean TEXT_MODE) { properties.put("textMode", new SimpleBooleanProperty(TEXT_MODE)); return (B) this; } public final B text(final String TEXT) { properties.put("text", new SimpleStringProperty(TEXT)); return (B) this; } public final B value(final double VALUE) { properties.put("value", new SimpleDoubleProperty(VALUE)); return (B) this; } public final B minValue(final double MIN_VALUE) { properties.put("minValue", new SimpleDoubleProperty(MIN_VALUE)); return (B) this; } public final B maxValue(final double MAX_VALUE) { properties.put("maxValue", new SimpleDoubleProperty(MAX_VALUE)); return (B) this; } public final B animated(final boolean ANIMATED) { properties.put("animated", new SimpleBooleanProperty(ANIMATED)); return (B) this; } public final B animationDurationInMs(final double ANIMATION_DURATION_IN_MS) { properties.put("animationDuration", new SimpleDoubleProperty(ANIMATION_DURATION_IN_MS)); return (B) this; } public final B threshold(final double THRESHOLD) { properties.put("threshold", new SimpleDoubleProperty(THRESHOLD)); return (B) this; } public final B decimals(final int DECIMALS) { properties.put("decimals", new SimpleIntegerProperty(DECIMALS)); return (B) this; } public final B keepAspect(final boolean KEEP_ASPECT) { properties.put("keepAspect", new SimpleBooleanProperty(KEEP_ASPECT)); return (B) this; } public final B noFrame(final boolean NO_FRAME) { properties.put("noFrame", new SimpleBooleanProperty(NO_FRAME)); return (B) this; } public final B backgroundVisible(final boolean BACKGROUND_VISIBLE) { properties.put("backgroundVisible", new SimpleBooleanProperty(BACKGROUND_VISIBLE)); return (B) this; } public final B crystalOverlayVisible(final boolean CRYSTAL_OVERLAY_VISIBLE) { properties.put("crystalOverlayVisible", new SimpleBooleanProperty(CRYSTAL_OVERLAY_VISIBLE)); return (B) this; } public final B mainInnerShadowVisible(final boolean MAIN_INNER_SHADOW_VISIBLE) { properties.put("mainInnerShadowVisible", new SimpleBooleanProperty(MAIN_INNER_SHADOW_VISIBLE)); return (B) this; } public final B foregroundShadowVisible(final boolean FOREGROUND_SHADOW_VISIBLE) { properties.put("foregroundShadowVisible", new SimpleBooleanProperty(FOREGROUND_SHADOW_VISIBLE)); return (B) this; } public final B minMeasuredValueVisible(final boolean MIN_MEASURED_VALUE_VISIBLE) { properties.put("minMeasuredValueVisible", new SimpleBooleanProperty(MIN_MEASURED_VALUE_VISIBLE)); return (B) this; } public final B minMeasuredValueDecimals(final int MIN_MEASURED_VALUE_DECIMALS) { properties.put("minMeasuredValueDecimals", new SimpleIntegerProperty(MIN_MEASURED_VALUE_DECIMALS)); return (B) this; } public final B maxMeasuredValueVisible(final boolean MAX_MEASURED_VALUE_VISIBLE) { properties.put("maxMeasuredValueVisible", new SimpleBooleanProperty(MAX_MEASURED_VALUE_VISIBLE)); return (B) this; } public final B maxMeasuredValueDecimals(final int MAX_MEASURED_VALUE_DECIMALS) { properties.put("maxMeasuredValueDecimals", new SimpleIntegerProperty(MAX_MEASURED_VALUE_DECIMALS)); return (B) this; } public final B lowerCenterText(final String LOWER_CENTER_TEXT) { properties.put("lowerCenterText", new SimpleStringProperty(LOWER_CENTER_TEXT)); return (B) this; } public final B lowerCenterTextVisible(final boolean LOWER_CENTER_TEXT_VISIBLE) { properties.put("lowerCenterTextVisible", new SimpleBooleanProperty(LOWER_CENTER_TEXT_VISIBLE)); return (B) this; } public final B formerValueVisible(final boolean FORMER_VALUE_VISIBLE) { properties.put("formerValueVisible", new SimpleBooleanProperty(FORMER_VALUE_VISIBLE)); return (B) this; } public final B title(final String TITLE) { properties.put("title", new SimpleStringProperty(TITLE)); return (B) this; } public final B titleVisible(final boolean TITLE_VISIBLE) { properties.put("titleVisible", new SimpleBooleanProperty(TITLE_VISIBLE)); return (B) this; } public final B unit(final String UNIT) { properties.put("unit", new SimpleStringProperty(UNIT)); return (B) this; } public final B unitVisible(final boolean UNIT_VISIBLE) { properties.put("unitVisible", new SimpleBooleanProperty(UNIT_VISIBLE)); return (B) this; } public final B lowerRightText(final String LOWER_RIGHT_TEXT) { properties.put("lowerRightText", new SimpleStringProperty(LOWER_RIGHT_TEXT)); return (B) this; } public final B lowerRightTextVisible(final boolean LOWER_RIGHT_TEXT_VISIBLE) { properties.put("lowerRightTextVisible", new SimpleBooleanProperty(LOWER_RIGHT_TEXT_VISIBLE)); return (B) this; } public final B upperLeftText(final String UPPER_LEFT_TEXT) { properties.put("upperLeftText", new SimpleStringProperty(UPPER_LEFT_TEXT)); return (B) this; } public final B upperLeftTextVisible(final boolean UPPER_LEFT_TEXT_VISIBLE) { properties.put("upperLeftTextVisible", new SimpleBooleanProperty(UPPER_LEFT_TEXT_VISIBLE)); return (B) this; } public final B upperRightText(final String UPPER_RIGHT_TEXT) { properties.put("upperRightText", new SimpleStringProperty(UPPER_RIGHT_TEXT)); return (B) this; } public final B upperRightTextVisible(final boolean UPPER_RIGHT_TEXT_VISIBLE) { properties.put("upperRightTextVisible", new SimpleBooleanProperty(UPPER_RIGHT_TEXT_VISIBLE)); return (B) this; } public final B trendVisible(final boolean TREND_VISIBLE) { properties.put("trendVisible", new SimpleBooleanProperty(TREND_VISIBLE)); return (B) this; } public final B trend(final Lcd.Trend TREND) { properties.put("trend", new SimpleObjectProperty<>(TREND)); return (B) this; } public final B batteryCharge(final double BATTERY_CHARGE) { properties.put("batteryCharge", new SimpleDoubleProperty(BATTERY_CHARGE)); return (B) this; } public final B batteryVisible(final boolean BATTERY_VISIBLE) { properties.put("batteryVisible", new SimpleBooleanProperty(BATTERY_VISIBLE)); return (B) this; } public final B signalStrength(final double SIGNAL_STRENGTH) { properties.put("signalStrength", new SimpleDoubleProperty(SIGNAL_STRENGTH)); return (B) this; } public final B signalVisible(final boolean SIGNAL_VISIBLE) { properties.put("signalVisible", new SimpleBooleanProperty(SIGNAL_VISIBLE)); return (B) this; } public final B alarmVisible(final boolean ALARM_VISIBLE) { properties.put("alarmVisible", new SimpleBooleanProperty(ALARM_VISIBLE)); return (B) this; } public final B thresholdVisible(final boolean THRESHOLD_VISIBLE) { properties.put("thresholdVisible", new SimpleBooleanProperty(THRESHOLD_VISIBLE)); return (B) this; } public final B thresholdBehaviorInverted(final boolean THRESHOLD_BEHAVIOR_INVERTED) { properties.put("thresholdBehaviorInverted", new SimpleBooleanProperty(THRESHOLD_BEHAVIOR_INVERTED)); return (B) this; } public final B numberSystem(final Lcd.NumberSystem NUMBER_SYSTEM) { properties.put("numberSystem", new SimpleObjectProperty<Lcd.NumberSystem>(NUMBER_SYSTEM)); return (B) this; } public final B numberSystemVisible(final boolean NUMBER_SYSTEM_VISIBLE) { properties.put("numberSystemVisible", new SimpleBooleanProperty(NUMBER_SYSTEM_VISIBLE)); return (B) this; } public final B titleFont(final String TITLE_FONT) { properties.put("titleFont", new SimpleStringProperty(TITLE_FONT)); return (B) this; } public final B unitFont(final String UNIT_FONT) { properties.put("unitFont", new SimpleStringProperty(UNIT_FONT)); return (B) this; } public final B valueFont(final Lcd.LcdFont VALUE_FONT) { properties.put("valueFont", new SimpleObjectProperty<Lcd.LcdFont>(VALUE_FONT)); return (B) this; } public final B smallFont(final String SMALL_FONT) { properties.put("smallFont", new SimpleStringProperty(SMALL_FONT)); return (B) this; } public final B lcdDesign(final LcdDesign LCD_DESIGN) { properties.put("lcdDesign", new SimpleObjectProperty<>(LCD_DESIGN)); return (B) this; } public final B prefSize(final double WIDTH, final double HEIGHT) { properties.put("prefSize", new SimpleObjectProperty<>(new Dimension2D(WIDTH, HEIGHT))); return (B)this; } public final B minSize(final double WIDTH, final double HEIGHT) { properties.put("minSize", new SimpleObjectProperty<>(new Dimension2D(WIDTH, HEIGHT))); return (B)this; } public final B maxSize(final double WIDTH, final double HEIGHT) { properties.put("maxSize", new SimpleObjectProperty<>(new Dimension2D(WIDTH, HEIGHT))); return (B)this; } public final B prefWidth(final double PREF_WIDTH) { properties.put("prefWidth", new SimpleDoubleProperty(PREF_WIDTH)); return (B)this; } public final B prefHeight(final double PREF_HEIGHT) { properties.put("prefHeight", new SimpleDoubleProperty(PREF_HEIGHT)); return (B)this; } public final B minWidth(final double MIN_WIDTH) { properties.put("minWidth", new SimpleDoubleProperty(MIN_WIDTH)); return (B)this; } public final B minHeight(final double MIN_HEIGHT) { properties.put("minHeight", new SimpleDoubleProperty(MIN_HEIGHT)); return (B)this; } public final B maxWidth(final double MAX_WIDTH) { properties.put("maxWidth", new SimpleDoubleProperty(MAX_WIDTH)); return (B)this; } public final B maxHeight(final double MAX_HEIGHT) { properties.put("maxHeight", new SimpleDoubleProperty(MAX_HEIGHT)); return (B)this; } public final B scaleX(final double SCALE_X) { properties.put("scaleX", new SimpleDoubleProperty(SCALE_X)); return (B)this; } public final B scaleY(final double SCALE_Y) { properties.put("scaleY", new SimpleDoubleProperty(SCALE_Y)); return (B)this; } public final B layoutX(final double LAYOUT_X) { properties.put("layoutX", new SimpleDoubleProperty(LAYOUT_X)); return (B)this; } public final B layoutY(final double LAYOUT_Y) { properties.put("layoutY", new SimpleDoubleProperty(LAYOUT_Y)); return (B)this; } public final B translateX(final double TRANSLATE_X) { properties.put("translateX", new SimpleDoubleProperty(TRANSLATE_X)); return (B)this; } public final B translateY(final double TRANSLATE_Y) { properties.put("translateY", new SimpleDoubleProperty(TRANSLATE_Y)); return (B)this; } public final Lcd build() { final Lcd CONTROL = new Lcd(); for (String key : properties.keySet()) { if ("prefSize".equals(key)) { Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get(); CONTROL.setPrefSize(dim.getWidth(), dim.getHeight()); } else if("minSize".equals(key)) { Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get(); CONTROL.setPrefSize(dim.getWidth(), dim.getHeight()); } else if("maxSize".equals(key)) { Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get(); CONTROL.setPrefSize(dim.getWidth(), dim.getHeight()); } else if("prefWidth".equals(key)) { CONTROL.setPrefWidth(((DoubleProperty) properties.get(key)).get()); } else if("prefHeight".equals(key)) { CONTROL.setPrefHeight(((DoubleProperty) properties.get(key)).get()); } else if("minWidth".equals(key)) { CONTROL.setMinWidth(((DoubleProperty) properties.get(key)).get()); } else if("minHeight".equals(key)) { CONTROL.setMinHeight(((DoubleProperty) properties.get(key)).get()); } else if("maxWidth".equals(key)) { CONTROL.setMaxWidth(((DoubleProperty) properties.get(key)).get()); } else if("maxHeight".equals(key)) { CONTROL.setMaxHeight(((DoubleProperty) properties.get(key)).get()); } else if("scaleX".equals(key)) { CONTROL.setScaleX(((DoubleProperty) properties.get(key)).get()); } else if("scaleY".equals(key)) { CONTROL.setScaleY(((DoubleProperty) properties.get(key)).get()); } else if ("layoutX".equals(key)) { CONTROL.setLayoutX(((DoubleProperty) properties.get(key)).get()); } else if ("layoutY".equals(key)) { CONTROL.setLayoutY(((DoubleProperty) properties.get(key)).get()); } else if ("translateX".equals(key)) { CONTROL.setTranslateX(((DoubleProperty) properties.get(key)).get()); } else if ("translateY".equals(key)) { CONTROL.setTranslateY(((DoubleProperty) properties.get(key)).get()); } else if("styleClass".equals(key)) { CONTROL.getStyleClass().setAll("lcd", ((StringProperty) properties.get(key)).get()); } else if("textMode".equals(key)) { CONTROL.setTextMode(((BooleanProperty) properties.get(key)).get()); } else if("text".equals(key)) { CONTROL.setText(((StringProperty) properties.get(key)).get()); } else if("value".equals(key)) { CONTROL.setValue(((DoubleProperty) properties.get(key)).get()); } else if("minValue".equals(key)) { CONTROL.setMinValue(((DoubleProperty) properties.get(key)).get()); } else if("maxValue".equals(key)) { CONTROL.setMaxValue(((DoubleProperty) properties.get(key)).get()); } else if("animated".equals(key)) { CONTROL.setAnimated(((BooleanProperty) properties.get(key)).get()); } else if ("animationDuration".equals(key)) { CONTROL.setAnimationDuration(((DoubleProperty) properties.get(key)).get()); } else if("threshold".equals(key)) { CONTROL.setThreshold(((DoubleProperty) properties.get(key)).get()); } else if("decimals".equals(key)) { CONTROL.setDecimals(((IntegerProperty) properties.get(key)).get()); } else if ("keepAspect".equals(key)) { CONTROL.setKeepAspect(((BooleanProperty) properties.get(key)).get()); } else if ("noFrame".equals(key)) { CONTROL.setNoFrame(((BooleanProperty) properties.get(key)).get()); } else if ("backgroundVisible".equals(key)) { CONTROL.setBackgroundVisible(((BooleanProperty) properties.get(key)).get()); } else if ("crystalOverlayVisible".equals(key)) { CONTROL.setCrystalOverlayVisible(((BooleanProperty) properties.get(key)).get()); } else if ("mainInnerShadowVisible".equals(key)) { CONTROL.setMainInnerShadowVisible(((BooleanProperty) properties.get(key)).get()); } else if ("foregroundShadowVisible".equals(key)) { CONTROL.setForegroundShadowVisible(((BooleanProperty) properties.get(key)).get()); } else if("minMeasuredValueVisible".equals(key)) { CONTROL.setMinMeasuredValueVisible(((BooleanProperty) properties.get(key)).get()); } else if("minMeasuredValueDecimals".equals(key)) { CONTROL.setMinMeasuredValueDecimals(((IntegerProperty) properties.get(key)).get()); } else if ("maxMeasuredValueVisible".equals(key)) { CONTROL.setMaxMeasuredValueVisible(((BooleanProperty) properties.get(key)).get()); } else if ("maxMeasuredValueDecimals".equals(key)) { CONTROL.setMaxMeasuredValueDecimals(((IntegerProperty) properties.get(key)).get()); } else if ("formerValueVisible".equals(key)) { CONTROL.setFormerValueVisible(((BooleanProperty) properties.get(key)).get()); } else if ("title".equals(key)) { CONTROL.setTitle(((StringProperty) properties.get(key)).get()); } else if ("titleVisible".equals(key)) { CONTROL.setTitleVisible(((BooleanProperty) properties.get(key)).get()); } else if ("unit".equals(key)) { CONTROL.setUnit(((StringProperty) properties.get(key)).get()); } else if ("unitVisible".equals(key)) { CONTROL.setUnitVisible(((BooleanProperty) properties.get(key)).get()); } else if("lowerCenterText".equals(key)) { CONTROL.setLowerCenterText(((StringProperty) properties.get(key)).get()); } else if("lowerCenterTextVisible".equals(key)) { CONTROL.setLowerCenterTextVisible(((BooleanProperty) properties.get(key)).get()); } else if ("lowerRightText".equals(key)) { CONTROL.setLowerRightText(((StringProperty) properties.get(key)).get()); } else if ("lowerRightTextVisible".equals(key)) { CONTROL.setLowerRightTextVisible(((BooleanProperty) properties.get(key)).get()); } else if ("upperLeftText".equals(key)) { CONTROL.setUpperLeftText(((StringProperty) properties.get(key)).get()); } else if ("upperLeftTextVisible".equals(key)) { CONTROL.setUpperLeftTextVisible(((BooleanProperty) properties.get(key)).get()); } else if ("upperRightText".equals(key)) { CONTROL.setUpperRightText(((StringProperty) properties.get(key)).get()); } else if ("upperRightTextVisible".equals(key)) { CONTROL.setUpperRightTextVisible(((BooleanProperty) properties.get(key)).get()); } else if ("trendVisible".equals(key)) { CONTROL.setTrendVisible(((BooleanProperty) properties.get(key)).get()); } else if ("trend".equals(key)) { CONTROL.setTrend(((ObjectProperty<Lcd.Trend>) properties.get(key)).get()); } else if ("batteryCharge".equals(key)) { CONTROL.setBatteryCharge(((DoubleProperty) properties.get(key)).get()); } else if ("batteryVisible".equals(key)) { CONTROL.setBatteryVisible(((BooleanProperty) properties.get(key)).get()); } else if ("signalStrength".equals(key)) { CONTROL.setSignalStrength(((DoubleProperty) properties.get(key)).get()); } else if ("signalVisible".equals(key)) { CONTROL.setSignalVisible(((BooleanProperty) properties.get(key)).get()); } else if ("alarmVisible".equals(key)) { CONTROL.setAlarmVisible(((BooleanProperty) properties.get(key)).get()); } else if ("thresholdVisible".equals(key)) { CONTROL.setThresholdVisible(((BooleanProperty) properties.get(key)).get()); } else if ("thresholdBehaviorInverted".equals(key)) { CONTROL.setThresholdBehaviorInverted(((BooleanProperty) properties.get(key)).get()); } else if("numberSystem".equals(key)) { CONTROL.setNumberSystem(((ObjectProperty<Lcd.NumberSystem>) properties.get(key)).get()); } else if ("numberSystemVisible".equals(key)) { CONTROL.setNumberSystemVisible(((BooleanProperty) properties.get(key)).get()); } else if ("unitFont".equals(key)) { CONTROL.setUnitFont(((StringProperty) properties.get(key)).get()); } else if ("titleFont".equals(key)) { CONTROL.setTitleFont(((StringProperty) properties.get(key)).get()); } else if ("valueFont".equals(key)) { CONTROL.setValueFont(((ObjectProperty<Lcd.LcdFont>) properties.get(key)).get()); } else if ("smallFont".equals(key)) { CONTROL.setSmallFont(((StringProperty) properties.get(key)).get()); } else if ("lcdDesign".equals(key)) { CONTROL.setLcdDesign(((ObjectProperty<LcdDesign>) properties.get(key)).get()); } } return CONTROL; } }
[ "pgkutch@IIFRAMEWORK.amr.corp.intel.com" ]
pgkutch@IIFRAMEWORK.amr.corp.intel.com
bf42653561158ac9fb5653c00051482765b18331
c19435aface677d3de0958c7fa8b0aa7e3b759f3
/base/api/src/main/java/org/artifactory/api/rest/blob/Parts.java
0bff91f49ecc481289b1f3b997aac2564bcd837a
[]
no_license
apaqi/jfrog-artifactory-5.11.0
febc70674b4a7b90f37f2dfd126af36b90784c28
6a4204ed9ce9334d3eb7a8cb89c1d9dc72d709c1
refs/heads/master
2020-03-18T03:13:41.286825
2018-05-21T06:57:30
2018-05-21T06:57:30
134,229,368
0
0
null
null
null
null
UTF-8
Java
false
false
528
java
package org.artifactory.api.rest.blob; import com.fasterxml.jackson.databind.PropertyNamingStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; import lombok.Data; import org.codehaus.jackson.annotate.JsonProperty; import java.util.List; import java.util.Map; @Data @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) public class Parts { @JsonProperty("parts_list") public List<PartsList> partsList; @JsonProperty("checksums_ordinal") public Map<String, Long> checksumsOrdinal; }
[ "wangpeixuan00@126.com" ]
wangpeixuan00@126.com
6810489e61463d19e5ab54bf37392f57a4842e3b
0f4966100155cc8f707c77da7f6d52b9f3b4bc1b
/src/org/knoesis/blooms/WikipediaArticleSearch.java
24d69992d9b69499f38dd5bdfa6ee162cec3d3ec
[ "Apache-2.0" ]
permissive
mcheatham/blooms_recreated
d0c8e79c9a79dfccd653f076a7c5f855e2c191a2
66ea2496ecbaff5bfa6e2964a7c29e86195b864c
refs/heads/master
2021-01-21T14:34:00.793626
2017-06-24T15:26:57
2017-06-24T15:26:57
95,305,623
0
0
null
null
null
null
UTF-8
Java
false
false
3,977
java
package org.knoesis.blooms; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.HashSet; /** * @author prateekjain * */ public class WikipediaArticleSearch { private static String ARTICLE_LINKS_URL = "https://en.wikipedia.org/w/api.php?action=query&" + "prop=links&titles="; private String url= ""; private String format = ""; private int resultLimit; private String term = ""; public WikipediaArticleSearch(String url, String term, String format, int resultLimit) { this.url = url; this.term = term.trim(); this.format = format; this.resultLimit = resultLimit; } public HashSet<String> invokeService() throws Exception { try { this.term = URLEncoder.encode(this.term, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } String serviceURL = this.url + this.term + "&" + this.format + "&srlimit=" + this.resultLimit; // System.out.println(serviceURL); InvokeWikipediaWebService invokeWS = new InvokeWikipediaWebService(serviceURL); String content = invokeWS.invokeWebService(); // System.out.println(content); HashSet<String> result = new HashSet<String>(); // Wikipedia disambiguation pages use the phrases "may refer to" or // "may stand for" in the first sentence, according to their style guide. // Checking for these words in the snippet allows us to save an API call // for each title (to get the categories). Note that this only expands // first-level disambiugation pages (i.e. if one disambiguation page // contains a link to another, the second level page will be added directly // rather than expanded). // for each article... String copy = new String(content); while (copy.contains("<p ns=\"0\"")) { int startIndex = copy.indexOf("<p ns=\"0\""); int endIndex = copy.indexOf("/>", startIndex); String entry = copy.substring(startIndex, endIndex); copy = copy.substring(endIndex); // System.out.println("\t" + entry); // get the title and snippet String title = getTagValue("title", entry); String snippet = getTagValue("snippet", entry); // System.out.println("\t\t" + title); // System.out.println("\t\t" + snippet); // if the snippet contains one of the magic words that // indicate this is a disambiguation page, if ((title != null && title.contains("disambiguation")) || (snippet != null && (snippet.contains("may refer to") || snippet.contains("may stand for") || snippet.contains("may also refer to")))) { // need to do another query to get all of the links (or page titles) // on this page String betterTitle = null; try { betterTitle = URLEncoder.encode(title, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } if (betterTitle == null) continue; String linksURL = ARTICLE_LINKS_URL + betterTitle + "&" + this.format; InvokeWikipediaWebService anotherWS = new InvokeWikipediaWebService(linksURL); String pageContent = anotherWS.invokeWebService(); String pageCopy = new String(pageContent); while (pageCopy.contains("<pl ns=\"0\"")) { int linkStart = pageCopy.indexOf("<pl ns=\"0\""); int linkEnd = pageCopy.indexOf("/>", linkStart); String link = pageCopy.substring(linkStart, linkEnd); pageCopy = pageCopy.substring(linkEnd); // get the title and snippet String linkTitle = getTagValue("title", link); result.add(linkTitle); } // if this isn't a disambiguation page, just add its title // to the list } else if (title != null) { result.add(title); } } return result; } private static String getTagValue(String tag, String content) { int tagStart = content.indexOf(tag + "=\"") + tag.length()+2; if (tagStart < 0) return null; int tagEnd = content.indexOf("\"", tagStart); if (tagEnd < tagStart) return null; return content.substring(tagStart, tagEnd).trim(); } }
[ "michelle.cheatham@gmail.com" ]
michelle.cheatham@gmail.com
4a4d12f8c94a7bfce38db81d29d6e72bbb1bef1b
ec9f9f08913a68a4bf08d418867b5a35003199d6
/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/BooterDeserializerStartupConfigurationTest.java
464cdfe51d20392da6df963c460a527ae84a5e78
[]
no_license
jusbrasil/maven-surefire
d0aa3235dd941157ebe759257172d9e82b78e025
3ad8cf4f5067f213b5c25ff10849d9f81da9a68f
refs/heads/trunk
2023-04-26T20:32:06.330387
2012-07-04T22:34:55
2012-07-04T22:34:55
4,927,671
0
0
null
2023-04-14T20:08:47
2012-07-06T16:22:07
Java
UTF-8
Java
false
false
7,796
java
package org.apache.maven.plugin.surefire.booterclient; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Properties; import org.apache.maven.surefire.booter.BooterDeserializer; import org.apache.maven.surefire.booter.ClassLoaderConfiguration; import org.apache.maven.surefire.booter.Classpath; import org.apache.maven.surefire.booter.ClasspathConfiguration; import org.apache.maven.surefire.booter.PropertiesWrapper; import org.apache.maven.surefire.booter.ProviderConfiguration; import org.apache.maven.surefire.booter.StartupConfiguration; import org.apache.maven.surefire.booter.SystemPropertyManager; import org.apache.maven.surefire.report.ReporterConfiguration; import org.apache.maven.surefire.testset.DirectoryScannerParameters; import org.apache.maven.surefire.testset.RunOrderParameters; import org.apache.maven.surefire.testset.TestArtifactInfo; import org.apache.maven.surefire.testset.TestRequest; import org.apache.maven.surefire.util.RunOrder; import junit.framework.TestCase; /** * Performs roundtrip testing of serialization/deserialization of The StartupConfiguration * * @author Kristian Rosenvold */ public class BooterDeserializerStartupConfigurationTest extends TestCase { private final ClasspathConfiguration classpathConfiguration = createClasspathConfiguration(); public void testProvider() throws IOException { assertEquals( "com.provider", getReloadedStartupConfiguration().getProviderClassName() ); } public void testClassPathConfiguration() throws IOException { ClasspathConfiguration reloadedClasspathConfiguration = getReloadedStartupConfiguration().getClasspathConfiguration(); assertEquals( classpathConfiguration, reloadedClasspathConfiguration ); } private void assertEquals( ClasspathConfiguration expectedConfiguration, ClasspathConfiguration actualConfiguration ) { assertEquals( expectedConfiguration.getTestClasspath().getClassPath(), actualConfiguration.getTestClasspath().getClassPath() ); Properties propertiesForExpectedConfiguration = getPropertiesForClasspathConfiguration( expectedConfiguration ); Properties propertiesForActualConfiguration = getPropertiesForClasspathConfiguration( actualConfiguration ); assertEquals( propertiesForExpectedConfiguration, propertiesForActualConfiguration ); } private Properties getPropertiesForClasspathConfiguration( ClasspathConfiguration configuration ) { Properties properties = new Properties(); configuration.setForkProperties( new PropertiesWrapper( properties ) ); return properties; } public void testClassLoaderConfiguration() throws IOException { assertFalse( getReloadedStartupConfiguration().isManifestOnlyJarRequestedAndUsable() ); } public void testClassLoaderConfigurationTrues() throws IOException { final StartupConfiguration testStartupConfiguration = getTestStartupConfiguration( getManifestOnlyJarForkConfiguration() ); boolean current = testStartupConfiguration.isManifestOnlyJarRequestedAndUsable(); assertEquals( current, saveAndReload( testStartupConfiguration ).isManifestOnlyJarRequestedAndUsable() ); } private ClasspathConfiguration createClasspathConfiguration() { Classpath testClassPath = new Classpath( Arrays.asList( new String[]{ "CP1", "CP2" } ) ); Classpath providerClasspath = new Classpath( Arrays.asList( new String[]{ "SP1", "SP2" } ) ); return new ClasspathConfiguration( testClassPath, providerClasspath, new Classpath(), true, true ); } public static ClassLoaderConfiguration getSystemClassLoaderConfiguration() { return new ClassLoaderConfiguration( true, false ); } public static ClassLoaderConfiguration getManifestOnlyJarForkConfiguration() { return new ClassLoaderConfiguration( true, true ); } private StartupConfiguration getReloadedStartupConfiguration() throws IOException { ClassLoaderConfiguration classLoaderConfiguration = getSystemClassLoaderConfiguration(); return saveAndReload( getTestStartupConfiguration( classLoaderConfiguration ) ); } private StartupConfiguration saveAndReload( StartupConfiguration startupConfiguration ) throws IOException { final ForkConfiguration forkConfiguration = ForkConfigurationTest.getForkConfiguration(); Properties props = new Properties(); BooterSerializer booterSerializer = new BooterSerializer( forkConfiguration, props ); String aTest = "aTest"; booterSerializer.serialize( getProviderConfiguration(), startupConfiguration, aTest, "never" ); final File propsTest = SystemPropertyManager.writePropertiesFile( props, forkConfiguration.getTempDirectory(), "propsTest", true ); BooterDeserializer booterDeserializer = new BooterDeserializer( new FileInputStream( propsTest ) ); return booterDeserializer.getProviderConfiguration(); } private ProviderConfiguration getProviderConfiguration() { File cwd = new File( "." ); DirectoryScannerParameters directoryScannerParameters = new DirectoryScannerParameters( cwd, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), Boolean.TRUE, "hourly" ); ReporterConfiguration reporterConfiguration = new ReporterConfiguration( cwd, Boolean.TRUE ); String aUserRequestedTest = "aUserRequestedTest"; String aUserRequestedTestMethod = "aUserRequestedTestMethod"; TestRequest testSuiteDefinition = new TestRequest( Arrays.asList( getSuiteXmlFileStrings() ), getTestSourceDirectory(), aUserRequestedTest, aUserRequestedTestMethod ); RunOrderParameters runOrderParameters = new RunOrderParameters( RunOrder.DEFAULT, null ); return new ProviderConfiguration( directoryScannerParameters, runOrderParameters, true, reporterConfiguration, new TestArtifactInfo( "5.0", "ABC" ), testSuiteDefinition, new Properties(), BooterDeserializerProviderConfigurationTest.aTestTyped ); } private StartupConfiguration getTestStartupConfiguration( ClassLoaderConfiguration classLoaderConfiguration ) { return new StartupConfiguration( "com.provider", classpathConfiguration, classLoaderConfiguration, "never", false ); } private File getTestSourceDirectory() { return new File( "TestSrc" ); } private Object[] getSuiteXmlFileStrings() { return new Object[]{ "A1", "A2" }; } }
[ "krosenvold@apache.org" ]
krosenvold@apache.org