blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 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
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
214bfb577bb4a6b2d8d59f001f3813a6f8d050e2 | 5e4560d3f74ea5faad12c449e902dd28782061b4 | /common/src/main/java/org/apache/abdera2/common/iri/IRISyntaxException.java | bd6134c07137dfe939cb13f39cf85776ccab1e67 | [] | no_license | Cybion-Italy/abdera2 | 0ff597672618bd3296b06616782ee1fa545feb59 | 4a651798774a53bd1b3edb1062809f993230ffff | refs/heads/master | 2021-01-22T03:13:56.039131 | 2012-11-27T09:35:08 | 2012-11-27T09:35:08 | 6,863,597 | 0 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,153 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. 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. For additional information regarding
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
package org.apache.abdera2.common.iri;
public class IRISyntaxException extends RuntimeException {
private static final long serialVersionUID = 5177739661976965423L;
IRISyntaxException(String message) {
super(message);
}
IRISyntaxException(Throwable cause) {
super(cause);
}
}
| [
"[email protected]"
] | |
6b12c2c2ba07a5a4f94839a37c32349db995773b | 8aff0cac6d42dffa7df666c5b3e80cdb8200ff8f | /src/main/java/app/guangda/repository/model/GdDeptExample.java | 5e8690747507adbb56fd4832be4c7a85cd21b337 | [] | no_license | little6/weixin_softwinner | 7eece904dd896245b9d48c0779bdc204ef0acb83 | fb8495668e9e9c926c8104223c3f0b64d1a6a4c1 | refs/heads/master | 2021-01-21T17:03:33.379237 | 2016-01-10T03:39:30 | 2016-01-10T03:39:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 27,757 | java | package app.guangda.repository.model;
import java.util.ArrayList;
import java.util.List;
public class GdDeptExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table gd_dept
*
* @mbggenerated Sat Jan 09 21:57:21 CST 2016
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table gd_dept
*
* @mbggenerated Sat Jan 09 21:57:21 CST 2016
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table gd_dept
*
* @mbggenerated Sat Jan 09 21:57:21 CST 2016
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table gd_dept
*
* @mbggenerated Sat Jan 09 21:57:21 CST 2016
*/
public GdDeptExample() {
oredCriteria = new ArrayList<Criteria>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table gd_dept
*
* @mbggenerated Sat Jan 09 21:57:21 CST 2016
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table gd_dept
*
* @mbggenerated Sat Jan 09 21:57:21 CST 2016
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table gd_dept
*
* @mbggenerated Sat Jan 09 21:57:21 CST 2016
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table gd_dept
*
* @mbggenerated Sat Jan 09 21:57:21 CST 2016
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table gd_dept
*
* @mbggenerated Sat Jan 09 21:57:21 CST 2016
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table gd_dept
*
* @mbggenerated Sat Jan 09 21:57:21 CST 2016
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table gd_dept
*
* @mbggenerated Sat Jan 09 21:57:21 CST 2016
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table gd_dept
*
* @mbggenerated Sat Jan 09 21:57:21 CST 2016
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table gd_dept
*
* @mbggenerated Sat Jan 09 21:57:21 CST 2016
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table gd_dept
*
* @mbggenerated Sat Jan 09 21:57:21 CST 2016
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table gd_dept
*
* @mbggenerated Sat Jan 09 21:57:21 CST 2016
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andPkidIsNull() {
addCriterion("pkid is null");
return (Criteria) this;
}
public Criteria andPkidIsNotNull() {
addCriterion("pkid is not null");
return (Criteria) this;
}
public Criteria andPkidEqualTo(String value) {
addCriterion("pkid =", value, "pkid");
return (Criteria) this;
}
public Criteria andPkidNotEqualTo(String value) {
addCriterion("pkid <>", value, "pkid");
return (Criteria) this;
}
public Criteria andPkidGreaterThan(String value) {
addCriterion("pkid >", value, "pkid");
return (Criteria) this;
}
public Criteria andPkidGreaterThanOrEqualTo(String value) {
addCriterion("pkid >=", value, "pkid");
return (Criteria) this;
}
public Criteria andPkidLessThan(String value) {
addCriterion("pkid <", value, "pkid");
return (Criteria) this;
}
public Criteria andPkidLessThanOrEqualTo(String value) {
addCriterion("pkid <=", value, "pkid");
return (Criteria) this;
}
public Criteria andPkidLike(String value) {
addCriterion("pkid like", value, "pkid");
return (Criteria) this;
}
public Criteria andPkidNotLike(String value) {
addCriterion("pkid not like", value, "pkid");
return (Criteria) this;
}
public Criteria andPkidIn(List<String> values) {
addCriterion("pkid in", values, "pkid");
return (Criteria) this;
}
public Criteria andPkidNotIn(List<String> values) {
addCriterion("pkid not in", values, "pkid");
return (Criteria) this;
}
public Criteria andPkidBetween(String value1, String value2) {
addCriterion("pkid between", value1, value2, "pkid");
return (Criteria) this;
}
public Criteria andPkidNotBetween(String value1, String value2) {
addCriterion("pkid not between", value1, value2, "pkid");
return (Criteria) this;
}
public Criteria andDeptCodeIsNull() {
addCriterion("dept_code is null");
return (Criteria) this;
}
public Criteria andDeptCodeIsNotNull() {
addCriterion("dept_code is not null");
return (Criteria) this;
}
public Criteria andDeptCodeEqualTo(String value) {
addCriterion("dept_code =", value, "deptCode");
return (Criteria) this;
}
public Criteria andDeptCodeNotEqualTo(String value) {
addCriterion("dept_code <>", value, "deptCode");
return (Criteria) this;
}
public Criteria andDeptCodeGreaterThan(String value) {
addCriterion("dept_code >", value, "deptCode");
return (Criteria) this;
}
public Criteria andDeptCodeGreaterThanOrEqualTo(String value) {
addCriterion("dept_code >=", value, "deptCode");
return (Criteria) this;
}
public Criteria andDeptCodeLessThan(String value) {
addCriterion("dept_code <", value, "deptCode");
return (Criteria) this;
}
public Criteria andDeptCodeLessThanOrEqualTo(String value) {
addCriterion("dept_code <=", value, "deptCode");
return (Criteria) this;
}
public Criteria andDeptCodeLike(String value) {
addCriterion("dept_code like", value, "deptCode");
return (Criteria) this;
}
public Criteria andDeptCodeNotLike(String value) {
addCriterion("dept_code not like", value, "deptCode");
return (Criteria) this;
}
public Criteria andDeptCodeIn(List<String> values) {
addCriterion("dept_code in", values, "deptCode");
return (Criteria) this;
}
public Criteria andDeptCodeNotIn(List<String> values) {
addCriterion("dept_code not in", values, "deptCode");
return (Criteria) this;
}
public Criteria andDeptCodeBetween(String value1, String value2) {
addCriterion("dept_code between", value1, value2, "deptCode");
return (Criteria) this;
}
public Criteria andDeptCodeNotBetween(String value1, String value2) {
addCriterion("dept_code not between", value1, value2, "deptCode");
return (Criteria) this;
}
public Criteria andDeptNameIsNull() {
addCriterion("dept_name is null");
return (Criteria) this;
}
public Criteria andDeptNameIsNotNull() {
addCriterion("dept_name is not null");
return (Criteria) this;
}
public Criteria andDeptNameEqualTo(String value) {
addCriterion("dept_name =", value, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameNotEqualTo(String value) {
addCriterion("dept_name <>", value, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameGreaterThan(String value) {
addCriterion("dept_name >", value, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameGreaterThanOrEqualTo(String value) {
addCriterion("dept_name >=", value, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameLessThan(String value) {
addCriterion("dept_name <", value, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameLessThanOrEqualTo(String value) {
addCriterion("dept_name <=", value, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameLike(String value) {
addCriterion("dept_name like", value, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameNotLike(String value) {
addCriterion("dept_name not like", value, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameIn(List<String> values) {
addCriterion("dept_name in", values, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameNotIn(List<String> values) {
addCriterion("dept_name not in", values, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameBetween(String value1, String value2) {
addCriterion("dept_name between", value1, value2, "deptName");
return (Criteria) this;
}
public Criteria andDeptNameNotBetween(String value1, String value2) {
addCriterion("dept_name not between", value1, value2, "deptName");
return (Criteria) this;
}
public Criteria andDeptAddressIsNull() {
addCriterion("dept_address is null");
return (Criteria) this;
}
public Criteria andDeptAddressIsNotNull() {
addCriterion("dept_address is not null");
return (Criteria) this;
}
public Criteria andDeptAddressEqualTo(String value) {
addCriterion("dept_address =", value, "deptAddress");
return (Criteria) this;
}
public Criteria andDeptAddressNotEqualTo(String value) {
addCriterion("dept_address <>", value, "deptAddress");
return (Criteria) this;
}
public Criteria andDeptAddressGreaterThan(String value) {
addCriterion("dept_address >", value, "deptAddress");
return (Criteria) this;
}
public Criteria andDeptAddressGreaterThanOrEqualTo(String value) {
addCriterion("dept_address >=", value, "deptAddress");
return (Criteria) this;
}
public Criteria andDeptAddressLessThan(String value) {
addCriterion("dept_address <", value, "deptAddress");
return (Criteria) this;
}
public Criteria andDeptAddressLessThanOrEqualTo(String value) {
addCriterion("dept_address <=", value, "deptAddress");
return (Criteria) this;
}
public Criteria andDeptAddressLike(String value) {
addCriterion("dept_address like", value, "deptAddress");
return (Criteria) this;
}
public Criteria andDeptAddressNotLike(String value) {
addCriterion("dept_address not like", value, "deptAddress");
return (Criteria) this;
}
public Criteria andDeptAddressIn(List<String> values) {
addCriterion("dept_address in", values, "deptAddress");
return (Criteria) this;
}
public Criteria andDeptAddressNotIn(List<String> values) {
addCriterion("dept_address not in", values, "deptAddress");
return (Criteria) this;
}
public Criteria andDeptAddressBetween(String value1, String value2) {
addCriterion("dept_address between", value1, value2, "deptAddress");
return (Criteria) this;
}
public Criteria andDeptAddressNotBetween(String value1, String value2) {
addCriterion("dept_address not between", value1, value2, "deptAddress");
return (Criteria) this;
}
public Criteria andDeptTypeIsNull() {
addCriterion("dept_type is null");
return (Criteria) this;
}
public Criteria andDeptTypeIsNotNull() {
addCriterion("dept_type is not null");
return (Criteria) this;
}
public Criteria andDeptTypeEqualTo(String value) {
addCriterion("dept_type =", value, "deptType");
return (Criteria) this;
}
public Criteria andDeptTypeNotEqualTo(String value) {
addCriterion("dept_type <>", value, "deptType");
return (Criteria) this;
}
public Criteria andDeptTypeGreaterThan(String value) {
addCriterion("dept_type >", value, "deptType");
return (Criteria) this;
}
public Criteria andDeptTypeGreaterThanOrEqualTo(String value) {
addCriterion("dept_type >=", value, "deptType");
return (Criteria) this;
}
public Criteria andDeptTypeLessThan(String value) {
addCriterion("dept_type <", value, "deptType");
return (Criteria) this;
}
public Criteria andDeptTypeLessThanOrEqualTo(String value) {
addCriterion("dept_type <=", value, "deptType");
return (Criteria) this;
}
public Criteria andDeptTypeLike(String value) {
addCriterion("dept_type like", value, "deptType");
return (Criteria) this;
}
public Criteria andDeptTypeNotLike(String value) {
addCriterion("dept_type not like", value, "deptType");
return (Criteria) this;
}
public Criteria andDeptTypeIn(List<String> values) {
addCriterion("dept_type in", values, "deptType");
return (Criteria) this;
}
public Criteria andDeptTypeNotIn(List<String> values) {
addCriterion("dept_type not in", values, "deptType");
return (Criteria) this;
}
public Criteria andDeptTypeBetween(String value1, String value2) {
addCriterion("dept_type between", value1, value2, "deptType");
return (Criteria) this;
}
public Criteria andDeptTypeNotBetween(String value1, String value2) {
addCriterion("dept_type not between", value1, value2, "deptType");
return (Criteria) this;
}
public Criteria andDeptPhoneIsNull() {
addCriterion("dept_phone is null");
return (Criteria) this;
}
public Criteria andDeptPhoneIsNotNull() {
addCriterion("dept_phone is not null");
return (Criteria) this;
}
public Criteria andDeptPhoneEqualTo(String value) {
addCriterion("dept_phone =", value, "deptPhone");
return (Criteria) this;
}
public Criteria andDeptPhoneNotEqualTo(String value) {
addCriterion("dept_phone <>", value, "deptPhone");
return (Criteria) this;
}
public Criteria andDeptPhoneGreaterThan(String value) {
addCriterion("dept_phone >", value, "deptPhone");
return (Criteria) this;
}
public Criteria andDeptPhoneGreaterThanOrEqualTo(String value) {
addCriterion("dept_phone >=", value, "deptPhone");
return (Criteria) this;
}
public Criteria andDeptPhoneLessThan(String value) {
addCriterion("dept_phone <", value, "deptPhone");
return (Criteria) this;
}
public Criteria andDeptPhoneLessThanOrEqualTo(String value) {
addCriterion("dept_phone <=", value, "deptPhone");
return (Criteria) this;
}
public Criteria andDeptPhoneLike(String value) {
addCriterion("dept_phone like", value, "deptPhone");
return (Criteria) this;
}
public Criteria andDeptPhoneNotLike(String value) {
addCriterion("dept_phone not like", value, "deptPhone");
return (Criteria) this;
}
public Criteria andDeptPhoneIn(List<String> values) {
addCriterion("dept_phone in", values, "deptPhone");
return (Criteria) this;
}
public Criteria andDeptPhoneNotIn(List<String> values) {
addCriterion("dept_phone not in", values, "deptPhone");
return (Criteria) this;
}
public Criteria andDeptPhoneBetween(String value1, String value2) {
addCriterion("dept_phone between", value1, value2, "deptPhone");
return (Criteria) this;
}
public Criteria andDeptPhoneNotBetween(String value1, String value2) {
addCriterion("dept_phone not between", value1, value2, "deptPhone");
return (Criteria) this;
}
public Criteria andDeptQrcodeIsNull() {
addCriterion("dept_qrcode is null");
return (Criteria) this;
}
public Criteria andDeptQrcodeIsNotNull() {
addCriterion("dept_qrcode is not null");
return (Criteria) this;
}
public Criteria andDeptQrcodeEqualTo(String value) {
addCriterion("dept_qrcode =", value, "deptQrcode");
return (Criteria) this;
}
public Criteria andDeptQrcodeNotEqualTo(String value) {
addCriterion("dept_qrcode <>", value, "deptQrcode");
return (Criteria) this;
}
public Criteria andDeptQrcodeGreaterThan(String value) {
addCriterion("dept_qrcode >", value, "deptQrcode");
return (Criteria) this;
}
public Criteria andDeptQrcodeGreaterThanOrEqualTo(String value) {
addCriterion("dept_qrcode >=", value, "deptQrcode");
return (Criteria) this;
}
public Criteria andDeptQrcodeLessThan(String value) {
addCriterion("dept_qrcode <", value, "deptQrcode");
return (Criteria) this;
}
public Criteria andDeptQrcodeLessThanOrEqualTo(String value) {
addCriterion("dept_qrcode <=", value, "deptQrcode");
return (Criteria) this;
}
public Criteria andDeptQrcodeLike(String value) {
addCriterion("dept_qrcode like", value, "deptQrcode");
return (Criteria) this;
}
public Criteria andDeptQrcodeNotLike(String value) {
addCriterion("dept_qrcode not like", value, "deptQrcode");
return (Criteria) this;
}
public Criteria andDeptQrcodeIn(List<String> values) {
addCriterion("dept_qrcode in", values, "deptQrcode");
return (Criteria) this;
}
public Criteria andDeptQrcodeNotIn(List<String> values) {
addCriterion("dept_qrcode not in", values, "deptQrcode");
return (Criteria) this;
}
public Criteria andDeptQrcodeBetween(String value1, String value2) {
addCriterion("dept_qrcode between", value1, value2, "deptQrcode");
return (Criteria) this;
}
public Criteria andDeptQrcodeNotBetween(String value1, String value2) {
addCriterion("dept_qrcode not between", value1, value2, "deptQrcode");
return (Criteria) this;
}
public Criteria andDeptSceneIdIsNull() {
addCriterion("dept_scene_id is null");
return (Criteria) this;
}
public Criteria andDeptSceneIdIsNotNull() {
addCriterion("dept_scene_id is not null");
return (Criteria) this;
}
public Criteria andDeptSceneIdEqualTo(String value) {
addCriterion("dept_scene_id =", value, "deptSceneId");
return (Criteria) this;
}
public Criteria andDeptSceneIdNotEqualTo(String value) {
addCriterion("dept_scene_id <>", value, "deptSceneId");
return (Criteria) this;
}
public Criteria andDeptSceneIdGreaterThan(String value) {
addCriterion("dept_scene_id >", value, "deptSceneId");
return (Criteria) this;
}
public Criteria andDeptSceneIdGreaterThanOrEqualTo(String value) {
addCriterion("dept_scene_id >=", value, "deptSceneId");
return (Criteria) this;
}
public Criteria andDeptSceneIdLessThan(String value) {
addCriterion("dept_scene_id <", value, "deptSceneId");
return (Criteria) this;
}
public Criteria andDeptSceneIdLessThanOrEqualTo(String value) {
addCriterion("dept_scene_id <=", value, "deptSceneId");
return (Criteria) this;
}
public Criteria andDeptSceneIdLike(String value) {
addCriterion("dept_scene_id like", value, "deptSceneId");
return (Criteria) this;
}
public Criteria andDeptSceneIdNotLike(String value) {
addCriterion("dept_scene_id not like", value, "deptSceneId");
return (Criteria) this;
}
public Criteria andDeptSceneIdIn(List<String> values) {
addCriterion("dept_scene_id in", values, "deptSceneId");
return (Criteria) this;
}
public Criteria andDeptSceneIdNotIn(List<String> values) {
addCriterion("dept_scene_id not in", values, "deptSceneId");
return (Criteria) this;
}
public Criteria andDeptSceneIdBetween(String value1, String value2) {
addCriterion("dept_scene_id between", value1, value2, "deptSceneId");
return (Criteria) this;
}
public Criteria andDeptSceneIdNotBetween(String value1, String value2) {
addCriterion("dept_scene_id not between", value1, value2, "deptSceneId");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table gd_dept
*
* @mbggenerated do_not_delete_during_merge Sat Jan 09 21:57:21 CST 2016
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table gd_dept
*
* @mbggenerated Sat Jan 09 21:57:21 CST 2016
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"[email protected]"
] | |
92fa4e565ecf3590494484b4f311b36b39539919 | 448c718d7b96129dd841f099a11e92fe253e296d | /spring-swing-test/src/main/java/org/cosinus/swing/test/boot/SpringSwingBootTestAnnotation.java | bb464d42771a1ac2f18c81363dba9a6398a8ba62 | [
"Apache-2.0",
"BSD-2-Clause"
] | permissive | cosinus-code/spring-swing | eb5d0a2d42732a9d4b671d53651c329b36b5bbde | bb036c2f5edd4e5ceb2b1667cf6ad8f2fbe1b87a | refs/heads/master | 2023-09-01T08:48:15.199500 | 2023-04-22T14:26:54 | 2023-04-22T14:28:42 | 242,805,178 | 3 | 0 | Apache-2.0 | 2023-08-23T17:54:13 | 2020-02-24T17:59:43 | Java | UTF-8 | Java | false | false | 2,419 | java | /*
* Copyright 2020 Cosinus Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.cosinus.swing.test.boot;
import org.jetbrains.annotations.NotNull;
import org.springframework.boot.test.context.SpringBootTest.UseMainMethod;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.test.context.ContextCustomizer;
import org.springframework.test.context.MergedContextConfiguration;
import java.util.Arrays;
import java.util.Objects;
import static java.util.Optional.ofNullable;
import static org.springframework.boot.test.context.SpringBootTest.UseMainMethod.NEVER;
public class SpringSwingBootTestAnnotation implements ContextCustomizer {
private static final String[] NO_ARGS = new String[0];
private final String[] args;
private final UseMainMethod useMainMethod;
public SpringSwingBootTestAnnotation(SpringSwingBootTest springSwingBootTestAnnotation) {
this.args = ofNullable(springSwingBootTestAnnotation)
.map(SpringSwingBootTest::args)
.orElse(NO_ARGS);
this.useMainMethod = ofNullable(springSwingBootTestAnnotation)
.map(SpringSwingBootTest::useMainMethod)
.orElse(NEVER);
}
@Override
public void customizeContext(
@NotNull ConfigurableApplicationContext context,
@NotNull MergedContextConfiguration mergedConfig) {
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SpringSwingBootTestAnnotation that = (SpringSwingBootTestAnnotation) o;
return Arrays.equals(args, that.args) && useMainMethod == that.useMainMethod;
}
@Override
public int hashCode() {
int result = Objects.hash(useMainMethod);
result = 31 * result + Arrays.hashCode(args);
return result;
}
}
| [
"[email protected]"
] | |
89f221d727b99c8451df1511b6f92db2b872b6cb | b5d37b4af7e514fe3647c319e2d7301a9e715b32 | /Java Tutorials/objectorientedprogramming/src/objectorientedprogramming/Objectorientedprogramming.java | becbf8e5bc4d600b7454f5b92381530fef7f370e | [] | no_license | WyldWilly/Dev_UPMCE_Udemy | adef31f5bfcb9b57c4132ad4815e1b7335671dcd | 3dc79b385a503ca23b433f0fa15c476c1e765111 | refs/heads/master | 2020-03-28T13:10:23.644144 | 2019-06-06T21:25:24 | 2019-06-06T21:25:24 | 148,371,932 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,174 | java | package objectorientedprogramming;
public class Objectorientedprogramming {
public static void main(String[] args) {
/*
Objects - containers that stores variables and functions thematically
connected to each other for easier future usage.
Classes - blueprint for creating instance (copies) of objects
Properties - features (part of something)
Methods - functions (
*/
Monitor monitor1 = new Monitor();
Monitor monitor2 = new Monitor();
monitor1.width = 1000;
monitor2.width = 20000;
// Prints out the width using SOUT
System.out.println("monitor1 width is " + monitor1.width);
// Prints out width using function in class/object
monitor1.getWidth();
monitor2.getWidth();
}
}
class Monitor
{
//Properties
int width;
int height;
int brightness;
//Functions
void changeBrightness()
{
/*
Place for instructions to be done
*/
}
void getWidth()
{
System.out.println(width);
}
}
| [
"[email protected]"
] | |
bc4a2563cd688bdb28e11171297648f9e58a99a1 | fa4dd981b79b0be45cb99ec5971120046e578d75 | /GiveAwayApp/app/src/main/java/com/angelhack/giveaway/giveaway/LoginActivity.java | a7cc4448753cb321fca8e9748b5a891abbd0cd52 | [] | no_license | yogeshpandey009/GiveAway | eccbd30d773313b8eb70a21c0abdaa63cf2b7f0b | 1fc925340731348d6c7531b9658ff6e5a2f28c84 | refs/heads/master | 2020-04-02T05:18:57.497026 | 2016-06-26T20:47:10 | 2016-06-26T20:47:10 | 62,007,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,876 | java | package com.angelhack.giveaway.giveaway;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class LoginActivity extends AppCompatActivity {
private static final String TAG = "LoginActivity";
private static final int REQUEST_SIGNUP = 0;
EditText _emailText;
EditText _passwordText;
Button _loginButton;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
_emailText = (EditText) findViewById(R.id.input_email);
_passwordText = (EditText) findViewById(R.id.input_password);
_loginButton = (Button) findViewById(R.id.btn_login);
_loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
login();
}
});
}
public void login() {
Log.d(TAG, "Login");
/*
if (!validate()) {
onLoginFailed();
return;
}
*/
_loginButton.setEnabled(false);
final ProgressDialog progressDialog = new ProgressDialog(LoginActivity.this);
progressDialog.setIndeterminate(true);
progressDialog.setMessage("Authenticating...");
progressDialog.show();
final String email = _emailText.getText().toString();
String password = _passwordText.getText().toString();
// TODO: Implement your own authentication logic here.
new android.os.Handler().postDelayed(
new Runnable() {
public void run() {
// On complete call either onLoginSuccess or onLoginFailed
onLoginSuccess(email);
// onLoginFailed();
progressDialog.dismiss();
}
}, 1500);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == REQUEST_SIGNUP) {
if (resultCode == RESULT_OK) {
// TODO: Implement successful signup logic here
// By default we just finish the Activity and log them in automatically
this.finish();
}
}
}
@Override
public void onBackPressed() {
// disable going back to the MainActivity
moveTaskToBack(true);
}
public void onLoginSuccess(String email) {
_loginButton.setEnabled(true);
//finish();
Intent i = new Intent(this, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
i.putExtra("user", email);
startActivity(i);
}
public void onLoginFailed() {
Toast.makeText(getBaseContext(), "Login failed", Toast.LENGTH_LONG).show();
_loginButton.setEnabled(true);
}
public boolean validate() {
boolean valid = true;
String email = _emailText.getText().toString();
String password = _passwordText.getText().toString();
if (email.isEmpty() || !android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
_emailText.setError("enter a valid email address");
valid = false;
} else {
_emailText.setError(null);
}
if (password.isEmpty() || password.length() < 4 || password.length() > 10) {
_passwordText.setError("between 4 and 10 alphanumeric characters");
valid = false;
} else {
_passwordText.setError(null);
}
return valid;
}
}
| [
"[email protected]"
] | |
bbc83a2bae37da07e22e84a511425fc3f207cfc0 | 58ea1ed51413bcfcf3ef5b2f644abb43d0b9b661 | /app/build/generated/source/buildConfig/debug/project/caixaeletronico/BuildConfig.java | 335371a22c883d19aab3db4b082f6fb9ef32d11f | [] | no_license | UsjtArqDeSisAndroid/ArqDesisAula17 | 910c11f6d0600781dd509b5591f8f80a21b716e0 | 435b6841427584083f4f85fbd4471a98e3e80daa | refs/heads/master | 2020-12-24T11:17:35.475269 | 2016-11-07T03:52:10 | 2016-11-07T03:52:10 | 73,040,464 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 463 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package project.caixaeletronico;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "arqdesis.com.usjt.caixaeletronico";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}
| [
"[email protected]"
] | |
b0e3f6a83c7d9614eb7392b0a47caf4f89003659 | c4c5cfb74bd3c01c96c3d2392d910d7466732642 | /src/main/java/rockets/model/Launch.java | e1816737ff76546249ee1c938b1379ad2af659e7 | [] | no_license | novikesumaningtyas/System-Validation | 6ef690d9a172abe3f17bbdbf62cebfa73c58363a | 78e86b69df6da72606878857e4bec0e97efc12cb | refs/heads/master | 2020-04-01T20:11:10.695304 | 2018-10-18T08:46:40 | 2018-10-18T08:46:40 | 153,592,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,356 | java | package rockets.model;
import org.neo4j.ogm.annotation.CompositeIndex;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Property;
import org.neo4j.ogm.annotation.Relationship;
import org.neo4j.ogm.annotation.typeconversion.DateLong;
import java.util.Date;
import java.util.Objects;
import java.util.Set;
import static org.apache.commons.lang3.Validate.notNull;
import static org.neo4j.ogm.annotation.Relationship.INCOMING;
@NodeEntity
@CompositeIndex(properties = {"launchDate", "launchVehicle", "launchSite", "orbit"}, unique = true)
public class Launch extends Entity {
public enum LaunchOutcome {
FAILED, SUCCESSFUL
}
@DateLong
private Date launchDate;
@Relationship(type = "PROVIDES", direction = INCOMING)
private Rocket launchVehicle;
private LaunchServiceProvider launchServiceProvider;
private Set<String> payload;
@Property(name = "launchSite")
private String launchSite;
@Property(name = "orbit")
private String orbit;
@Property(name = "function")
private String function;
@Property(name = "launchOutcome")
private LaunchOutcome launchOutcome;
@Property(name = "price")
private int price;
public Launch() {
super();
}
public Launch(Date launchDate, Rocket launchVehicle, LaunchServiceProvider launchServiceProvider, String launchSite, String orbit) throws IllegalArgumentException {
notNull(launchDate);
notNull(launchVehicle);
notNull(launchServiceProvider);
notNull(launchSite);
notNull(orbit);
this.launchDate = launchDate;
if (launchDate.getYear() < launchVehicle.getFirstYearFlight()) {
throw new IllegalArgumentException("Launch date cannot earlier than rocket first launch year.");
}
this.launchVehicle = launchVehicle;
this.launchServiceProvider = launchServiceProvider;
this.launchSite = launchSite;
this.orbit = orbit;
}
public Date getLaunchDate() {
return launchDate;
}
public Rocket getLaunchVehicle() {
return launchVehicle;
}
public LaunchServiceProvider getLaunchServiceProvider() {
return launchServiceProvider;
}
public Set<String> getPayload() {
return payload;
}
public String getLaunchSite() {
return launchSite;
}
public String getOrbit() {
return orbit;
}
public String getFunction() {
return function;
}
public LaunchOutcome getLaunchOutcome() {
return launchOutcome;
}
public void setPayload(Set<String> payload) {
this.payload = payload;
}
public void setLaunchSite(String launchSite) {
if ("" == launchSite){
throw new IllegalArgumentException("Launch site cannot be empty.");
}
this.launchSite = launchSite;
}
public void setFunction(String function) {
notNull(function);
if ("" == function){
throw new IllegalArgumentException("function cannot be empty.");
}
this.function = function;
}
public void setLaunchOutcome(LaunchOutcome launchOutcome) {
notNull(launchOutcome);
boolean isExistInEnum = false;
for (LaunchOutcome c : LaunchOutcome.values()) {
if (c.equals(launchOutcome)) {
isExistInEnum = true;
}
}
if (!isExistInEnum){
throw new IllegalArgumentException("Outcome must be FAILED or SUCCESSFUL.");
}
this.launchOutcome = launchOutcome;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Launch launch = (Launch) o;
return Objects.equals(launchDate, launch.launchDate) &&
Objects.equals(launchVehicle, launch.launchVehicle) &&
Objects.equals(launchServiceProvider, launch.launchServiceProvider) &&
Objects.equals(orbit, launch.orbit);
}
@Override
public int hashCode() {
return Objects.hash(launchDate, launchVehicle, launchServiceProvider, orbit);
}
}
| [
"[email protected]"
] | |
4d0d2ef4191c7c7a86e8ad59bef51f0fa3622ccf | 7ed99bc282c40a95f3a61ad82b3ea7eb6854eb2a | /app/src/main/java/com/menginar/foursquare/data/model/venueslist/LabeledLatLng.java | 35b6aa6e1c9569a958ee70180285045d6e182995 | [] | no_license | mengi/foursquare | d2d07e4aa21d33906100ff76ed6d4107e2684a50 | 7baa8f744d2eadfe929e8bc796a743007b31f75a | refs/heads/master | 2020-06-16T19:16:47.199698 | 2019-07-07T18:41:32 | 2019-07-07T18:41:32 | 195,676,159 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 762 | java |
package com.menginar.foursquare.data.model.venueslist;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class LabeledLatLng {
@SerializedName("label")
@Expose
private String label;
@SerializedName("lat")
@Expose
private Double lat;
@SerializedName("lng")
@Expose
private Double lng;
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Double getLat() {
return lat;
}
public void setLat(Double lat) {
this.lat = lat;
}
public Double getLng() {
return lng;
}
public void setLng(Double lng) {
this.lng = lng;
}
}
| [
"[email protected]"
] | |
0326994e300640604d573e5ee37f781ae0aeb8ca | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/mockito/2016/4/ReturnsDeepStubs.java | 54f2c3fd8c74de246a95a887ceceff116f6f8a7d | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | Java | false | false | 7,022 | java | /*
* Copyright (c) 2007 Mockito contributors
* This program is made available under the terms of the MIT License.
*/
package org.mockito.internal.stubbing.defaultanswers;
import org.mockito.MockSettings;
import org.mockito.Mockito;
import org.mockito.internal.InternalMockHandler;
import org.mockito.internal.MockitoCore;
import org.mockito.internal.creation.settings.CreationSettings;
import org.mockito.internal.stubbing.InvocationContainerImpl;
import org.mockito.internal.stubbing.StubbedInvocationMatcher;
import org.mockito.internal.util.MockUtil;
import org.mockito.internal.util.reflection.GenericMetadataSupport;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.mock.MockCreationSettings;
import org.mockito.stubbing.Answer;
import java.io.IOException;
import java.io.Serializable;
import static org.mockito.Mockito.withSettings;
/**
* Returning deep stub implementation.
*
* Will return previously created mock if the invocation matches.
*
* <p>Supports nested generic information, with this answer you can write code like this :
*
* <pre class="code"><code class="java">
* interface GenericsNest<K extends Comparable<K> & Cloneable> extends Map<K, Set<Number>> {}
*
* GenericsNest<?> mock = mock(GenericsNest.class, new ReturnsGenericDeepStubs());
* Number number = mock.entrySet().iterator().next().getValue().iterator().next();
* </code></pre>
* </p>
*
* @see org.mockito.Mockito#RETURNS_DEEP_STUBS
* @see org.mockito.Answers#RETURNS_DEEP_STUBS
*/
public class ReturnsDeepStubs implements Answer<Object>, Serializable {
private static final long serialVersionUID = -7105341425736035847L;
public Object answer(InvocationOnMock invocation) throws Throwable {
GenericMetadataSupport returnTypeGenericMetadata =
actualParameterizedType(invocation.getMock()).resolveGenericReturnType(invocation.getMethod());
Class<?> rawType = returnTypeGenericMetadata.rawType();
if (!mockitoCore().isTypeMockable(rawType)) {
return delegate().returnValueFor(rawType);
}
return deepStub(invocation, returnTypeGenericMetadata);
}
private Object deepStub(InvocationOnMock invocation, GenericMetadataSupport returnTypeGenericMetadata) throws Throwable {
InternalMockHandler<Object> handler = new MockUtil().getMockHandler(invocation.getMock());
InvocationContainerImpl container = (InvocationContainerImpl) handler.getInvocationContainer();
// matches invocation for verification
for (StubbedInvocationMatcher stubbedInvocationMatcher : container.getStubbedInvocations()) {
if (container.getInvocationForStubbing().matches(stubbedInvocationMatcher.getInvocation())) {
return stubbedInvocationMatcher.answer(invocation);
}
}
// record deep stub answer
return recordDeepStubAnswer(
newDeepStubMock(returnTypeGenericMetadata, invocation.getMock()),
container
);
}
/**
* Creates a mock using the Generics Metadata.
*
* <li>Finally as we want to mock the actual type, but we want to pass along the contextual generics meta-data
* that was resolved for the current return type, for this to happen we associate to the mock an new instance of
* {@link ReturnsDeepStubs} answer in which we will store the returned type generic metadata.
*
* @param returnTypeGenericMetadata The metadata to use to create the new mock.
* @param parentMock The parent of the current deep stub mock.
* @return The mock
*/
private Object newDeepStubMock(GenericMetadataSupport returnTypeGenericMetadata, Object parentMock) {
MockCreationSettings parentMockSettings = new MockUtil().getMockSettings(parentMock);
return mockitoCore().mock(
returnTypeGenericMetadata.rawType(),
withSettingsUsing(returnTypeGenericMetadata, parentMockSettings)
);
}
private MockSettings withSettingsUsing(GenericMetadataSupport returnTypeGenericMetadata, MockCreationSettings parentMockSettings) {
MockSettings mockSettings = returnTypeGenericMetadata.hasRawExtraInterfaces() ?
withSettings().extraInterfaces(returnTypeGenericMetadata.rawExtraInterfaces())
: withSettings();
return propagateSerializationSettings(mockSettings, parentMockSettings)
.defaultAnswer(returnsDeepStubsAnswerUsing(returnTypeGenericMetadata));
}
private MockSettings propagateSerializationSettings(MockSettings mockSettings, MockCreationSettings parentMockSettings) {
return mockSettings.serializable(parentMockSettings.getSerializableMode());
}
private ReturnsDeepStubs returnsDeepStubsAnswerUsing(final GenericMetadataSupport returnTypeGenericMetadata) {
return new ReturnsDeepStubsSerializationFallback(returnTypeGenericMetadata);
}
private Object recordDeepStubAnswer(final Object mock, InvocationContainerImpl container) throws Throwable {
container.addAnswer(new DeeplyStubbedAnswer(mock), false);
return mock;
}
protected GenericMetadataSupport actualParameterizedType(Object mock) {
CreationSettings mockSettings = (CreationSettings) new MockUtil().getMockHandler(mock).getMockSettings();
return GenericMetadataSupport.inferFrom(mockSettings.getTypeToMock());
}
private static class ReturnsDeepStubsSerializationFallback extends ReturnsDeepStubs implements Serializable {
@SuppressWarnings("serial") // not gonna be serialized
private final GenericMetadataSupport returnTypeGenericMetadata;
public ReturnsDeepStubsSerializationFallback(GenericMetadataSupport returnTypeGenericMetadata) {
this.returnTypeGenericMetadata = returnTypeGenericMetadata;
}
@Override
protected GenericMetadataSupport actualParameterizedType(Object mock) {
return returnTypeGenericMetadata;
}
private Object writeReplace() throws IOException {
return Mockito.RETURNS_DEEP_STUBS;
}
}
private static class DeeplyStubbedAnswer implements Answer<Object>, Serializable {
@SuppressWarnings("serial") // serialization will fail with a nice message if mock not serializable
private final Object mock;
DeeplyStubbedAnswer(Object mock) {
this.mock = mock;
}
public Object answer(InvocationOnMock invocation) throws Throwable {
return mock;
}
}
private static MockitoCore mockitoCore() {
return LazyHolder.MOCKITO_CORE;
}
private static ReturnsEmptyValues delegate() {
return LazyHolder.DELEGATE;
}
private static class LazyHolder {
private static final MockitoCore MOCKITO_CORE = new MockitoCore();
private static final ReturnsEmptyValues DELEGATE = new ReturnsEmptyValues();
}
}
| [
"[email protected]"
] | |
8519a72fc4bdf2e323483ccbe6839e5a3019c43a | 3f12041a7e94969518a04752d0b4c0d22b75fc09 | /src/main/java/com/ted/condition/context/Context.java | 06c2fdc56f442bc8c04b831cee519c299384898f | [] | no_license | seedman666/condition | 31ea587647718f245f7dc57c57f9a764159f5aca | a4a7f3c1ddf3581f32d5983b0ee9a06b64ba9586 | refs/heads/master | 2021-01-19T16:56:51.016907 | 2015-05-06T07:17:41 | 2015-05-06T07:17:41 | 35,142,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 141 | java | package com.ted.condition.context;
public interface Context {
String FIELD_SPLIT = "\\.";
Object getObject(String fieldName);
}
| [
"[email protected]"
] | |
ee2fb520e63936689351d4ea875bec2792eafa95 | caabfa77ac2008fe4fdd3902008b6eb892ec367a | /app/src/main/java/com/xwy/designmode/interfacesegregation/Segregation1.java | da521c35509f4dd028c9019cdb451de3be53034a | [] | no_license | xuweiyu/DesignMode | 66d747376aa6d1491226453191125e8e09e63785 | ab9a0ed272f2c46a35849ffc56b1539fb10ada21 | refs/heads/master | 2021-05-18T07:08:44.487458 | 2020-04-08T14:44:04 | 2020-04-08T14:44:04 | 251,172,473 | 0 | 0 | null | 2020-04-08T14:44:05 | 2020-03-30T01:32:42 | Java | UTF-8 | Java | false | false | 1,456 | java | package com.xwy.designmode.interfacesegregation;
/**
* Created by xuweiyu on 2020-03-31.
* email: [email protected]
* 简介:
*/
public class Segregation1 {
public static void main(String[] args) {
C1 c1 = new C1();
c1.dependence(new A1());
c1.dependence2(new A1());
}
}
class C1 {
public void dependence(Interface1 interface1) {
interface1.method1();
}
public void dependence2(Interface2 interface2) {
interface2.method2();
interface2.method3();
interface2.method1();
}
}
interface Interface1 {
void method1();
}
interface Interface2 extends Interface1 {
void method2();
void method3();
}
interface Interface3 extends Interface1 {
void method4();
void method5();
}
class A1 implements Interface2 {
@Override
public void method1() {
System.out.println("A1 实现了method1");
}
@Override
public void method2() {
System.out.println("A1 实现了method2");
}
@Override
public void method3() {
System.out.println("A1 实现了method3");
}
}
class B1 implements Interface3 {
@Override
public void method1() {
System.out.println("B1 实现了method1");
}
@Override
public void method4() {
System.out.println("B1 实现了method4");
}
@Override
public void method5() {
System.out.println("B1 实现了method5");
}
}
| [
"[email protected]"
] | |
adce8728af3fd681d782b07b79eef125cecb07ed | 8c171c09423e5429a3d596701962ddc8ff7bce96 | /tillerinobot/src/main/java/tillerino/tillerinobot/lang/ChineseSimple.java | ad337184f1f45504df1085e97dddc8cf00a5b37d | [] | no_license | XeKrOsu/Tillerinobot | 310314e8c92ea096aa4fdd78ef897f2e2f687cfa | 525adf49f07fe1e4f52ef4418070a7b7a840a047 | refs/heads/master | 2021-09-04T08:40:11.566094 | 2018-01-17T11:21:11 | 2018-01-17T11:21:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,550 | java | package tillerino.tillerinobot.lang;
import java.util.List;
import java.util.Random;
import org.tillerino.osuApiModel.Mods;
import org.tillerino.osuApiModel.OsuApiUser;
import tillerino.tillerinobot.CommandHandler.Action;
import tillerino.tillerinobot.CommandHandler.Message;
import tillerino.tillerinobot.CommandHandler.Response;
/**
* @author Deardrops [email protected] https://github.com/Deardrops https://osu.ppy.sh/u/1735252
*/
public class ChineseSimple implements Language {
static final Random rnd = new Random();
@Override
public String unknownBeatmap() {
return "抱歉,现在没有这张图的信息。这张图可能是Unranked,太新或者太难,不是osu!主模式的图。";
}
@Override
public String internalException(String marker) {
return "唔,看样子Tillerino把我给玩坏了。 ╮( ̄▽ ̄)╭"
+ " 如果短时间内没有修复,你可以在 [https://github.com/Tillerino/Tillerinobot/wiki/Contact 这里] 反馈!(错误信息: "
+ marker + ")";
}
@Override
public String externalException(String marker) {
return "喵喵喵?服务器上出现错误,你能告诉我发生了什么?0011101001010000"
+ " Tillerino:「别担心,再试一次!」"
+ " 如果还是有错误,请在 [https://github.com/Tillerino/Tillerinobot/wiki/Contact 这里] 反馈!(错误信息: "
+ marker + ")";
}
@Override
public String noInformationForModsShort() {
return "没有这个Mods的信息。";
}
@Override
public Response welcomeUser(OsuApiUser apiUser, long inactiveTime) {
if (inactiveTime < 60 * 1000) {
return new Message("嘟嘟噜~");
} else if (inactiveTime < 24 * 60 * 60 * 1000) {
return new Message("欢迎回来," + apiUser.getUserName() + "。");
} else if (inactiveTime > 7l * 24 * 60 * 60 * 1000) {
return new Message(apiUser.getUserName() + "...")
.then(new Message("是你么? 好久不见呢!"))
.then(new Message("很高兴再次见到你。需要我为你推荐歌曲么?"));
} else {
String[] messages = {
"你看起来需要我给你推荐图呢! (๑•̀ㅂ•́)و✧",
"很高兴再次见到你! <(* ̄▽ ̄*)/",
"你是我最喜欢的人! (*/ω\*)",
"这真是个意外的惊喜呢~ (>▽<)",
"我每天都在期待你的出现 (*/ω\*)",
"今天想做些什么呢? o( ̄▽ ̄)d",
};
Random random = new Random();
String message = messages[random.nextInt(messages.length)];
return new Message(apiUser.getUserName() + ", " + message);
}
}
@Override
public String unknownCommand(String command) {
return "错误的指令 \"" + command
+ "\". 请输入 !help 来查看可用指令!";
}
@Override
public String noInformationForMods() {
return "抱歉,现在没有这个Mods的信息。";
}
@Override
public String malformattedMods(String mods) {
return "咦?输入的Mod不对。Mods的缩写包括:DT HR HD HT EZ NC FL SO NF。可以任意组合或者使用其中一个。比如:!with HDHR, !with DTEZ";
}
@Override
public String noLastSongInfo() {
return "我不记得有给过你歌曲呢...Σ(っ °Д °;)っ";
}
@Override
public String tryWithMods() {
return "上Mod玩这张图试试?";
}
@Override
public String tryWithMods(List<Mods> mods) {
return "加上" + Mods.toShortNamesContinuous(mods) + "试试?";
}
@Override
public String excuseForError() {
return "很抱歉,刚刚我没注意听...可以再说一次你想做的事情么?";
}
@Override
public String complaint() {
return "你的反馈已经发送。Tillerino很快会收到你的反馈。";
}
@Override
public Response hug(OsuApiUser apiUser) {
return new Message("可以过来一下么?")
.then(new Action("抱 " + apiUser.getUserName()));
}
@Override
public String help() {
return "嗨!我是谋杀了Tillerino后使用他的账号的机器人。"
+ " [https://twitter.com/Tillerinobot TillerinoBot项目]"
+ " - [https://github.com/Tillerino/Tillerinobot/wiki 指令]"
+ " - [http://ppaddict.tillerino.org/ pp计算]"
+ " - [https://github.com/Tillerino/Tillerinobot/wiki/Contact 联系我]";
}
@Override
public String faq() {
return "[https://github.com/Tillerino/Tillerinobot/wiki/FAQ 常见问题]";
}
@Override
public String featureRankRestricted(String feature, int minRank, OsuApiUser user) {
return "抱歉,现在 " + feature + " 只能被Rank在 " + minRank + " 以上的人使用。";
}
@Override
public String mixedNomodAndMods() {
return "Nomod就是没有mod啦~";
}
@Override
public String outOfRecommendations() {
return "[https://github.com/Tillerino/Tillerinobot/wiki/FAQ#the-bot-says-its-out-of-recommendations-what-do"
+ " 我会把我知道的合适的图都推荐给你。]."
+ " 试试别的推荐算法,或者用 !reset 来重置推荐。如果你不确定应该如何使用,请输入 !help 来获取帮助";
}
@Override
public String notRanked() {
return "看起来这张图是Unranded图。";
}
@Override
public boolean isChanged() {
return false;
}
@Override
public void setChanged(boolean changed) {
}
@Override
public String invalidAccuracy(String acc) {
return "无效的Acc数值: \"" + acc + "\"";
}
@Override
public Response optionalCommentOnLanguage(OsuApiUser apiUser) {
/*
* TRANSLATION NOTE: This line is sent to the user right after they have
* chosen this Language implementation. The English version refers to
* itself as the default version ("just the way I am"), so translating
* the English message doesn't make any sense.
*
* Instead, we've been using the line
* "*Translator* helped me learn *Language*." in translations. Replace
* *Translator* with your osu name and *Language* with the name of the
* language that you are translating to, and translate the line into the
* new language. This serves two purposes: It shows that the language
* was changed and gives credit to the translator.
*
* You don't need to use the line above, and you don't have have to give
* yourself credit, but you should show that the language has changed.
* For example, in the German translation, I just used the line
* "Nichts leichter als das!", which translates literally to
* "Nothing easier than that!", which refers to German being my first
* language.
*
* Tillerino
*
* P.S. you can put a link to your profile into the line like this:
* [https://osu.ppy.sh/u/2070907 Tillerino]
*/
return new Message("是paraia教我中文的,请多关照。");
}
@Override
public String invalidChoice(String invalid, String choices) {
return "很抱歉, \"" + invalid
+ "\" 是不正确的。试试这个 " + choices + "!";
}
@Override
public String setFormat() {
return "请输入 !set option 数值 来设置变量。输入 !help 可以获得更多帮助。";
}
StringShuffler doSomething = new StringShuffler(rnd);
@Override
public String apiTimeoutException() {
final String message = "老板家的小霸王又被人拖走了,所以什么都做不了的说。 ";
return message + doSomething.get(
"说点什么好呢...你最后一次和奶奶说话是什么时候?",
"你要不要打扫一下房间再回来看看?",
"我想你现在应该去外面走走,去外面见见朋友。",
"我知道你现在有一堆其他事情要做。现在处理它们如何?",
"你看起来需要休息一会儿。",
"对了,你最近有看 [https://tieba.baidu.com/p/4817187865 藕酥轶闻录] 么?曲奇又FC了张难图。",
"让我们看看有没有谁正在 [http://live.bilibili.com/search/index/?keyword=osu 直播osu] !",
"瞧,这里有一个同样适合你的 [http://dagobah.net/flash/Cursor_Invisible.swf 游戏] 。",
"现在有充足的时间去学习如何使用 [https://github.com/Tillerino/Tillerinobot/wiki Tillerinobot]。",
"别担心,看看 [https://www.reddit.com/r/osugame reddit] 打发时间吧。",
"无聊的时候,来玩会儿 [http://gabrielecirulli.github.io/2048/ 2048] 吧!",
"提问:如果现在你的电脑硬件损坏,你会因此丢失多少个人资料?",
"你可以做点别的事情,或者我们保持安静,就这么相互看着对方。"
);
}
@Override
public String noRecentPlays() {
return "有一段时间没见面了呢。";
}
@Override
public String isSetId() {
return "这似乎是一个图包,不是一张图。";
}
}
| [
"[email protected]"
] | |
510832b9c49363f78c0d402412830e633de193c5 | ca91f3f8361a5ed71ca2a5cecb17f29e2ca48968 | /mbb-platform/src/main/java/com/mbb/mbbplatform/repos/InventoryRepository.java | faf1e1766dbb3c25c72d94be1ed1fd6bfaca0186 | [] | no_license | LohithaG/Backup-Projects | f7eaeb2d3b5866c2c86dba0074e2343fea97b450 | 9be9a4b0baa0d268d00d26bf51f7d5acf8573bc3 | refs/heads/master | 2023-01-27T15:43:08.612461 | 2019-09-20T05:21:51 | 2019-09-20T05:21:51 | 209,017,635 | 1 | 0 | null | 2023-01-12T11:59:53 | 2019-09-17T09:49:26 | JavaScript | UTF-8 | Java | false | false | 1,694 | java | package com.mbb.mbbplatform.repos;
import java.util.Collection;
import java.util.List;
import javax.validation.constraints.NotNull;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.web.bind.annotation.PathVariable;
import com.mbb.mbbplatform.domain.Inventory;
public interface InventoryRepository extends JpaRepository<Inventory, Long> {
Inventory findBySkuCode(String skuCode);
Inventory findBySkuCodeAndActive(String skuCode, Boolean active);
Inventory findByBarcodeId(@NotNull String barcodeId);
@Query(value = "SELECT * FROM mbbinventory.inventory ORDER BY sku_code ASC", nativeQuery = true)
Collection<Inventory> getBasedOnSorting();
@Query(value = "SELECT * FROM mbbinventory.inventory WHERE created_time >= ?1 AND created_time <= ?2 ", nativeQuery = true)
List<Inventory> findInventoryDetails(@NotNull String startDate, @NotNull String endDate);
Collection<Inventory> findBySerialNumberStatus(Boolean status);
List<Inventory> findByActive(Boolean active);
List<Inventory> findByActive(Boolean status, Pageable page);
@Query(value = "SELECT * FROM mbbinventory.inventory where active=:status AND (sku_code like %:search% or product_name like %:search%)", nativeQuery = true)
List<Inventory> findByActive(@PathVariable Boolean status, @PathVariable String search,
@PathVariable Pageable page);
@Query(value = "SELECT * FROM mbbinventory.inventory where active=:status AND (sku_code like %:search% or product_name like %:search%)", nativeQuery = true)
List<Inventory> findByActive(Boolean status, String search);
}
| [
"[email protected]"
] | |
c34d4ea041a81e1a35fbf09f57f2f18ffa8d1a55 | 08176e3b55b997ad0334ab7218f20a33d40f1b99 | /Branches/Proberen/ProjectSWOP20102011/src/projectswop20102011/domain/Firetruck.java | 3f82373d138da39ae543d9bab296a1dd9da537a4 | [] | no_license | KommuSoft/SwopKul1011 | df6cd650bd1cd3aa16ab44b330dfc79d6da77625 | f303b3340179f26ea791f39cc52dc8a92963e6cf | refs/heads/master | 2020-04-05T23:42:01.325054 | 2011-10-27T17:53:56 | 2011-10-27T17:53:56 | 9,194,044 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,719 | java | package projectswop20102011.domain;
import projectswop20102011.exceptions.InvalidFireSizeException;
import projectswop20102011.exceptions.InvalidLocationException;
import projectswop20102011.exceptions.InvalidSpeedException;
import projectswop20102011.exceptions.InvalidMapItemNameException;
import projectswop20102011.exceptions.InvalidWithdrawalException;
/**
* A class that represents a firetruck.
*
* @author Willem Van Onsem, Jonas Vanthornhout & Pieter-Jan Vuylsteke
*/
public class Firetruck extends Unit {
/**
* The maximal firesize the firetruck can handle.
*/
private FireSize maxSize;
/**
* Initialize a new firetruck with given parameters.
*
* @param name
* The name of the new firetruck.
* @param homeLocation
* The home location of the new firetruck.
* @param speed
* The speed of the new firetruck.
* @param maxSize
* The maximum size that this firetruck can handle.
* @effect The new firetruck is a unit with given name, home location, speed and maxSize.
* |super(name,homeLocation,speed)
* @effect The new firetruck can handle the given fire size.
* |this.maxSize.equals(maxSize)
* @effect The withdrawBehaviour of this firetruck is initialised.
* |setWithdrawBehavior(new NotWithdraw())
* @throws InvalidLocationException
* If the given location is an invalid location for a firetruck.
* @throws InvalidMapItemNameException
* If the given name is an invalid name for a firetruck.
* @throws InvalidSpeedException
* If the given speed is an invalid speed for a firetruck.
* @throws InvalidFireSizeException
* If the given maximum fire size is not effective.
*/
public Firetruck(String name, GPSCoordinate homeLocation, long speed, FireSize maxSize) throws InvalidLocationException, InvalidMapItemNameException, InvalidSpeedException, InvalidFireSizeException {
super(name, homeLocation, speed);
setMaxSize(maxSize);
}
/**
* Returns the maximum fire size the firetruck can handle.
* @return the maximum fire size the firetruck can handle.
*/
public FireSize getMaxSize() {
return maxSize;
}
/**
* Sets the maximum fire size to the given value.
* @param maxSize
* The new maximum fire size of this firetruck.
* @post This maximum fire size is equal to the given maximum size.
* |new.maxSize.equals(maxSize)
* @throws InvalidFireSizeException
* If the given maximum fire size is not effective.
*/
private void setMaxSize(FireSize maxSize) throws InvalidFireSizeException {
if (!isValidMaxFireSize(maxSize)) {
throw new InvalidFireSizeException("The given maximum fire size must be effective.");
}
this.maxSize = maxSize;
}
/**
* Tests if the given maximum fire size is a valid maximum fire size for a firetruck.
* @param maxFireSize
* The given maximum fire size.
* @return True if the given maximum fire size is effective, otherwise false.
*/
public static boolean isValidMaxFireSize(FireSize maxFireSize) {
return (maxFireSize != null);
}
/**
* Tests if this firetruck can handle a fire with a given fire size
* @param fireSize
* The fire size of the fire to test.
* @return True if the maximum fire size of this firetruck is larger or equal to the given fire size, otherwise false.
*/
public boolean canHandleFireSize(FireSize fireSize) {
return (this.getMaxSize().compareTo(fireSize) >= 0);
}
/**
* A method to withdraw this unit from the current Emergency.
* @throws InvalidWithdrawalException
* Always: A Firetruck can't be withdrawn from an Emergency.
*/
@Override
public void withdraw() throws InvalidWithdrawalException {
throw new InvalidWithdrawalException("This unit can't be withdrawn");
}
}
| [
"[email protected]"
] | |
fd41470e886bdf73dac2f457c9c01a918d85b6e5 | 618432fd4fba3bbd555e0b1a7d92620bc36a5664 | /java-project/src/test/java/PointTest.java | e71c83d13a2404fb44c4891292685d80d594996d | [] | no_license | sutantyo/tech_io_java_references | f9370d2d46bda3fb15c0a17bcf839cdf8a959782 | 9f586760c6f6ac6f33b9bbde1ff18516d5cc1cd4 | refs/heads/master | 2021-01-16T19:27:45.283237 | 2017-08-13T14:14:13 | 2017-08-13T14:14:13 | 100,171,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 182 | java | import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
public class PointTest {
@Test
public void testMain(){
Point.main(null);
}
}
| [
"[email protected]"
] | |
8b857fed8728a257834d0cd3c40e7fc4c6bf088a | 252216a652672d54b66acac595ecb4c8dbce3674 | /src/main/java/edu/xmu/test/hibernate/service/Client.java | 5f2fab3048ac92c92fa9e40b3842848db9f0f462 | [] | no_license | DavyJones2010/test-core | 96bfb658256b13aed16d3c63911fa3fe8d8456ad | 85fd6407758930084d146dffc1052b17702baa21 | refs/heads/master | 2023-08-17T02:28:30.097954 | 2023-08-09T14:08:30 | 2023-08-09T14:10:47 | 153,110,705 | 1 | 1 | null | 2022-12-10T02:23:50 | 2018-10-15T12:41:16 | Java | UTF-8 | Java | false | false | 797 | java | package edu.xmu.test.hibernate.service;
import org.apache.log4j.Logger;
import org.hibernate.Session;
import edu.xmu.test.hibernate.model.UserGenerator;
import edu.xmu.test.hibernate.util.SessionFactoryUtil;
public class Client {
private static final Logger logger = Logger.getLogger(Client.class);
private static final int USER_COUNT = 100;
public static void main(String[] args) {
Session session = SessionFactoryUtil.getSession();
try {
session.beginTransaction();
for (int i = 0; i < USER_COUNT; i++) {
session.save(UserGenerator.getUser());
}
session.getTransaction().commit();
} catch (Exception e) {
logger.error("Exception: ", e);
session.getTransaction().rollback();
} finally {
SessionFactoryUtil.closeSession(session);
}
System.exit(0);
}
}
| [
"[email protected]"
] | |
2ec9e24002b6894c77e98f4879ff8598c7645596 | bd7ef41954d63046d443c4bdf2e462b5a2200d95 | /src/cn/itcast/web/servlet/CheckCodeServlet.java | 455e55fe2fc91251346697ecc64cf88bf27324be | [] | no_license | IBM2017/Management_website | f4e562b4f2936e6dcc22158a88374c98358dbc47 | 40120dd8265d7e8c3f46656d57fb4ee74c3d7b4a | refs/heads/master | 2020-08-31T03:04:23.978410 | 2019-10-31T15:50:53 | 2019-10-31T15:50:53 | 218,567,657 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,393 | java | package cn.itcast.web.servlet;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;
@WebServlet("/checkCodeServlet")
public class CheckCodeServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
int width = 85;
int height = 35;
//1.创建一对象,在内存中图片(验证码图片对象)
BufferedImage image = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
//2.美化图片
//2.1 填充背景色
Graphics g = image.getGraphics();//画笔对象
g.setColor(Color.PINK);//设置画笔颜色
g.fillRect(0,0,width,height);
//2.2画边框
g.setColor(Color.BLUE);
g.drawRect(0,0,width - 1,height - 1);
String str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz0123456789";
//生成随机角标
Random ran = new Random();
StringBuilder stringBuilder = new StringBuilder();
for (int i = 1; i <= 4; i++) {
int index = ran.nextInt(str.length());
//获取字符
char ch = str.charAt(index);//随机字符
stringBuilder.append(ch);
//2.3写验证码
g.drawString(ch+"",width/5*i,height/2);
}
request.getSession().setAttribute("checkCode_session",stringBuilder.toString());
//2.4画干扰线
g.setColor(Color.GREEN);
//随机生成坐标点
for (int i = 0; i < 10; i++) {
int x1 = ran.nextInt(width);
int x2 = ran.nextInt(width);
int y1 = ran.nextInt(height);
int y2 = ran.nextInt(height);
g.drawLine(x1,y1,x2,y2);
}
//3.将图片输出到页面展示
ImageIO.write(image,"jpg",response.getOutputStream());
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
this.doPost(request,response);
}
}
| [
"[email protected]"
] | |
6763b5ab7d01a3867fcc1413aef0b33bf1d440d4 | 538e2a20bfef7b0fd7eefac419e2be9a18087352 | /app/src/main/java/com/example/praneethpj/handme/com/praneeth/Model/SessionManager.java | 9b50e28d1fcd86c803422e830e267a1ef3cdfa01 | [] | no_license | lakshitha1629/Safylite-AndroidApp | 11094e509d912b65b2a27b2f6be9fe6f7ab2a679 | 6f7e8942eec8a8c93d8e7b92954ea844b5d020fe | refs/heads/master | 2020-04-11T04:20:04.872923 | 2018-12-12T15:39:59 | 2018-12-12T15:39:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,373 | java | package com.example.praneethpj.handme.com.praneeth.Model;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.util.Log;
public class SessionManager {
// LogCat tag
private static String TAG = SessionManager.class.getSimpleName();
// Shared Preferences
SharedPreferences pref;
Editor editor;
Context _context;
// Shared pref mode
int PRIVATE_MODE = 0;
// Shared preferences file name
private static final String PREF_NAME = "AndroidHiveLogin";
private static final String KEY_IS_LOGGEDIN = "isLoggedIn";
public SessionManager(Context context) {
this._context = context;
pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE);
editor = pref.edit();
}
public void setKey(String key,String value) {
editor.putString(key,value);
// commit changes
editor.commit();
}
public String getKey(String key) {
return pref.getString(key,"");
}
public void setLogin(boolean isLoggedIn) {
editor.putBoolean(KEY_IS_LOGGEDIN, isLoggedIn);
// commit changes
editor.commit();
Log.d(TAG, "User login session modified!");
}
public boolean isLoggedIn(){
return pref.getBoolean(KEY_IS_LOGGEDIN, false);
}
} | [
"[email protected]"
] | |
bd927afa4cfd4618f85264069382c66c234d5eee | 94c4019e3bcb6b175aeda88e365c79ac9fc864d7 | /Algorithms/main/java/ladders/dataStructure/KClosestPoints.java | 7c21838e87ebfd6e6446959d2e5cd43f1c929e53 | [] | no_license | hanrick2000/Algorithm-1 | fcc34ca227a05982161afe681a6afdb1c0de4021 | 0389b6c588c3f21e7213bcfae93f3f34c287ba8b | refs/heads/master | 2021-09-16T15:36:30.891259 | 2018-06-22T03:41:21 | 2018-06-22T03:41:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,047 | java | package main.java.ladders.dataStructure;
import java.util.PriorityQueue;
/**
* 612. K Closest Points - Medium - Required
Given some points and a point origin in two dimensional space, find k points out of the some points
which are nearest to origin.
Return these points sorted by distance, if they are same with distance,
sorted by x-axis, otherwise sorted by y-axis.
Example
Given points = [[4,6],[4,7],[4,4],[2,5],[1,1]], origin = [0, 0], k = 3
return [[1,1],[2,5],[4,4]]
Tags: Heap LinkedIn Amazon
Related Problems
Medium Find K Closest Elements 23 %
* */
/**
* Definition for a point.
* class Point {
* int x;
* int y;
* Point() { x = 0; y = 0; }
* Point(int a, int b) { x = a; y = b; }
* }
*/
public class KClosestPoints {
/*
* @param points: a list of points
* @param origin: a point
* @param k: An integer
* @return: the k closest points
*/
private Point global_origin = null;
public Point[] kClosest(Point[] points, Point origin, int k) {
// Write your code here
global_origin = origin;
PriorityQueue<Point> pq = new PriorityQueue<Point> (k, new Comparator<Point> () {
@Override
public int compare(Point a, Point b) {
int diff = getDistance(b, global_origin) - getDistance(a, global_origin);
if (diff == 0)
diff = b.x - a.x;
if (diff == 0)
diff = b.y - a.y;
return diff;
}
});
for (int i = 0; i < points.length; i++) {
pq.offer(points[i]);
if (pq.size() > k)
pq.poll();
}
k = pq.size();
Point[] ret = new Point[k];
while (!pq.isEmpty())
ret[--k] = pq.poll();
return ret;
}
private int getDistance(Point a, Point b) {
return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
}
| [
"[email protected]"
] | |
39c470612724da8f84928a2db186ff2e43ce4ddf | 5120b826c0b659cc609e7cecdf9718aba243dfb0 | /b2b_acc/hybris/bin/platform/bootstrap/gensrc/de/hybris/platform/promotionengineservices/model/ExcludedCatForRuleModel.java | 5deaa92e0c9c1fe3013a4b66c6aad3855de5a545 | [] | no_license | miztli/hybris | 8447c85555676742b524aee901a5f559189a469a | ff84a5089a0d99899672e60c3a60436ab8bf7554 | refs/heads/master | 2022-10-26T07:21:44.657487 | 2019-05-28T20:30:10 | 2019-05-28T20:30:10 | 186,463,896 | 1 | 0 | null | 2022-09-16T18:38:27 | 2019-05-13T17:13:05 | Java | UTF-8 | Java | false | false | 5,358 | java | /*
* ----------------------------------------------------------------
* --- WARNING: THIS FILE IS GENERATED AND WILL BE OVERWRITTEN! ---
* --- Generated at May 28, 2019 3:18:54 PM ---
* ----------------------------------------------------------------
*
* [y] hybris Platform
* Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.promotionengineservices.model;
import de.hybris.bootstrap.annotations.Accessor;
import de.hybris.platform.core.model.ItemModel;
import de.hybris.platform.promotionengineservices.model.PromotionSourceRuleModel;
import de.hybris.platform.servicelayer.model.ItemModelContext;
/**
* Generated model class for type ExcludedCatForRule first defined at extension promotionengineservices.
* <p>
* Contains a relation between excluded category code and PromotionSourceRule in which that category code is used.
*/
@SuppressWarnings("all")
public class ExcludedCatForRuleModel extends ItemModel
{
/**<i>Generated model type code constant.</i>*/
public static final String _TYPECODE = "ExcludedCatForRule";
/** <i>Generated constant</i> - Attribute key of <code>ExcludedCatForRule.categoryCode</code> attribute defined at extension <code>promotionengineservices</code>. */
public static final String CATEGORYCODE = "categoryCode";
/** <i>Generated constant</i> - Attribute key of <code>ExcludedCatForRule.rule</code> attribute defined at extension <code>promotionengineservices</code>. */
public static final String RULE = "rule";
/**
* <i>Generated constructor</i> - Default constructor for generic creation.
*/
public ExcludedCatForRuleModel()
{
super();
}
/**
* <i>Generated constructor</i> - Default constructor for creation with existing context
* @param ctx the model context to be injected, must not be null
*/
public ExcludedCatForRuleModel(final ItemModelContext ctx)
{
super(ctx);
}
/**
* <i>Generated constructor</i> - Constructor with all mandatory attributes.
* @deprecated since 4.1.1 Please use the default constructor without parameters
* @param _categoryCode initial attribute declared by type <code>ExcludedCatForRule</code> at extension <code>promotionengineservices</code>
* @param _rule initial attribute declared by type <code>ExcludedCatForRule</code> at extension <code>promotionengineservices</code>
*/
@Deprecated
public ExcludedCatForRuleModel(final String _categoryCode, final PromotionSourceRuleModel _rule)
{
super();
setCategoryCode(_categoryCode);
setRule(_rule);
}
/**
* <i>Generated constructor</i> - for all mandatory and initial attributes.
* @deprecated since 4.1.1 Please use the default constructor without parameters
* @param _categoryCode initial attribute declared by type <code>ExcludedCatForRule</code> at extension <code>promotionengineservices</code>
* @param _owner initial attribute declared by type <code>Item</code> at extension <code>core</code>
* @param _rule initial attribute declared by type <code>ExcludedCatForRule</code> at extension <code>promotionengineservices</code>
*/
@Deprecated
public ExcludedCatForRuleModel(final String _categoryCode, final ItemModel _owner, final PromotionSourceRuleModel _rule)
{
super();
setCategoryCode(_categoryCode);
setOwner(_owner);
setRule(_rule);
}
/**
* <i>Generated method</i> - Getter of the <code>ExcludedCatForRule.categoryCode</code> attribute defined at extension <code>promotionengineservices</code>.
* @return the categoryCode
*/
@Accessor(qualifier = "categoryCode", type = Accessor.Type.GETTER)
public String getCategoryCode()
{
return getPersistenceContext().getPropertyValue(CATEGORYCODE);
}
/**
* <i>Generated method</i> - Getter of the <code>ExcludedCatForRule.rule</code> attribute defined at extension <code>promotionengineservices</code>.
* @return the rule - PromotionSourceRule containing the excluded category code
*/
@Accessor(qualifier = "rule", type = Accessor.Type.GETTER)
public PromotionSourceRuleModel getRule()
{
return getPersistenceContext().getPropertyValue(RULE);
}
/**
* <i>Generated method</i> - Initial setter of <code>ExcludedCatForRule.categoryCode</code> attribute defined at extension <code>promotionengineservices</code>. Can only be used at creation of model - before first save.
*
* @param value the categoryCode
*/
@Accessor(qualifier = "categoryCode", type = Accessor.Type.SETTER)
public void setCategoryCode(final String value)
{
getPersistenceContext().setPropertyValue(CATEGORYCODE, value);
}
/**
* <i>Generated method</i> - Initial setter of <code>ExcludedCatForRule.rule</code> attribute defined at extension <code>promotionengineservices</code>. Can only be used at creation of model - before first save.
*
* @param value the rule - PromotionSourceRule containing the excluded category code
*/
@Accessor(qualifier = "rule", type = Accessor.Type.SETTER)
public void setRule(final PromotionSourceRuleModel value)
{
getPersistenceContext().setPropertyValue(RULE, value);
}
}
| [
"[email protected]"
] | |
52a37d9151a0a6bd7ae670300f74773313497dcd | 66884071bc8928313136ef6766407832b1a13361 | /src/main/java/mf/uz/domain/Permission.java | ea252c16e0c47d09c5edda963efe43894268f94b | [] | no_license | Qurbonov/UserManagementAngular | 53b41752b103ddec092fa6434a684ef586a17b3e | fd77355733e611b6e4e297ba0e845fca9f80d65f | refs/heads/master | 2021-01-10T16:11:44.513135 | 2016-04-06T17:12:04 | 2016-04-06T17:12:04 | 49,048,154 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 311 | java | package mf.uz.domain;
import javax.persistence.*;
/**
* Created by qurbonov on 10/6/2015.
*/
@Entity
@Table(name = "Permission")
public class Permission {
@Id
@GeneratedValue
private Long id;
@Column(name = "permissionName", length = 50)
private String permissionName;
}
| [
"Qurbonov@myPC"
] | Qurbonov@myPC |
37ac7435c4257a40db570e2df3947f158c25d2d6 | deb78c56523fe452b7c5878308dfe1a3046e2f05 | /Picscore/src/com/score/pics/client/side4/SidePlace4.java | fa17312ed8ce757acc5e945bd99b7bce72047c46 | [] | no_license | dubiBerlin/GAE-GWT-data-store-app | f9044e4b0465c7ff36719532f9712089951b1a9a | 9ab3e5fa6241de00f2c8eefbf971b6324937cb38 | refs/heads/master | 2021-05-29T06:29:18.762562 | 2015-08-31T10:06:13 | 2015-08-31T10:06:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | package com.score.pics.client.side4;
import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
/*
* Place:
* */
public class SidePlace4 extends Place{
private final String token;
public SidePlace4(String id) {
this.token = id;
}
public String getToken(){
return token;
}
public static class SidePlaceTokenizer4 implements PlaceTokenizer<SidePlace4>{
@Override
public SidePlace4 getPlace(String id) {
return new SidePlace4(id);
}
@Override
public String getToken(SidePlace4 place) {
return place.getToken();
}
}
}
| [
"[email protected]"
] | |
53ead15810811ceab96c7b4fd1c319a52c03efd0 | 76de285319ad575ea74972d22357e3604ef12200 | /fly-master/src/main/java/com/tries/fly/config/shiro/UserRealm.java | 3f1d62f7bf45b1fe5cfb3d6a5efa5d0a82e10ea4 | [] | no_license | z549935084/zmy | f22e79fdb7be98ab5f9874030ef6af7b34b991ab | ce531d4f5210c0b4cc5bc385f90ae78b9da62415 | refs/heads/master | 2020-04-24T14:03:32.045223 | 2019-02-22T06:36:18 | 2019-02-22T06:36:18 | 172,007,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,725 | java | package com.tries.fly.config.shiro;
import com.alibaba.fastjson.JSONObject;
import com.tries.fly.service.LoginService;
import com.tries.fly.util.constants.Constants;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.*;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.PrincipalCollection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Collection;
/**
* @author: hxy
* @description: 自定义Realm
* @date: 2017/10/24 10:06
*/
public class UserRealm extends AuthorizingRealm {
private Logger logger = LoggerFactory.getLogger(UserRealm.class);
@Autowired
private LoginService loginService;
@Override
@SuppressWarnings("unchecked")
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
Session session = SecurityUtils.getSubject().getSession();
//查询用户的权限
JSONObject permission = (JSONObject) session.getAttribute(Constants.SESSION_USER_PERMISSION);
logger.info("permission的值为:" + permission);
logger.info("本用户权限为:" + permission.get("permissionList"));
//为当前用户设置角色和权限
SimpleAuthorizationInfo authorizationInfo = new SimpleAuthorizationInfo();
authorizationInfo.addStringPermissions((Collection<String>) permission.get("permissionList"));
return authorizationInfo;
}
/**
* 验证当前登录的Subject
* LoginController.login()方法中执行Subject.login()时 执行此方法
*/
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authcToken) throws AuthenticationException {
String loginName = (String) authcToken.getPrincipal();
// 获取用户密码
String password = new String((char[]) authcToken.getCredentials());
JSONObject user = loginService.getUser(loginName, password);
if (user == null) {
//没找到帐号
throw new UnknownAccountException();
}
//交给AuthenticatingRealm使用CredentialsMatcher进行密码匹配,如果觉得人家的不好可以自定义实现
SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo(
user.getString("username"),
user.getString("password"),
//ByteSource.Util.bytes("salt"), salt=username+salt,采用明文访问时,不需要此句
getName()
);
//session中不需要保存密码
user.remove("password");
//将用户信息放入session中
SecurityUtils.getSubject().getSession().setAttribute(Constants.SESSION_USER_INFO, user);
return authenticationInfo;
}
}
| [
"[email protected]"
] | |
095092e8ba78c7f4724fc093be23139e7b4d1638 | 4b58a3a59eb14c9a0c514a4c4cb39ead43a1cadf | /monitor/src/main/java/com/sandwich/util/io/FileMonitor.java | c71dc768e39e6cbfbacddc57e1d6b470bc67e3d3 | [
"Apache-2.0"
] | permissive | java-koans/koans-core | d3856d9b243627bdfb2a0a5af915752cbbb216bc | 1e5a1a41602b607a05d3821f5b0abcb9e24f2c99 | refs/heads/master | 2020-12-26T02:22:56.403914 | 2015-07-17T15:53:12 | 2015-07-17T15:53:12 | 38,798,456 | 1 | 2 | null | 2015-07-17T15:53:12 | 2015-07-09T05:09:00 | Java | UTF-8 | Java | false | false | 3,281 | java | /**
* Copyright 2015 Java Koans
*
* 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.sandwich.util.io;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Vector;
public class FileMonitor {
private final List<FileListener> listeners = new Vector<FileListener>();
private final DataFileHelper<Map<String, Long>> fileHashesHelper;
private final Map<String, Long> fileHashesByDirectory;
final File fileSystemPath;
public FileMonitor(File fileSystemPath, File dataFile) {
this.fileSystemPath = fileSystemPath;
if(!this.fileSystemPath.exists()){
throw new IllegalArgumentException(fileSystemPath+ " cannot be found.");
}
fileHashesHelper = new DataFileHelper<Map<String,Long>>(
dataFile, new HashMap<String,Long>());
fileHashesByDirectory = fileHashesHelper.read();
}
public String getFilesystemPath() {
return fileSystemPath.getAbsolutePath();
}
public void close(){
listeners.clear();
}
public void addFileSavedListener(FileListener listener){
listeners.add(listener);
}
public void removeFileSavedListener(FileListener listener){
listeners.remove(listener);
}
synchronized void notifyListeners(){
try {
Map<String, Long> currentHashes = getFilesystemHashes();
for(String fileName : currentHashes.keySet()){
Long currentHash = currentHashes.get(fileName);
Long previousHash = fileHashesByDirectory.get(fileName);
fileHashesByDirectory.put(fileName, currentHash);
File file = new File(fileName);
for(FileListener listener : listeners){
if(previousHash == null && currentHash != null){
listener.newFile(file);
}else if(currentHash == null && previousHash != null){
listener.fileDeleted(file);
}else if(!currentHash.equals(previousHash)){
listener.fileSaved(file);
}
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
Map<String, Long> getFilesystemHashes() throws IOException {
final HashMap<String,Long> fileHashes = new HashMap<String,Long>();
new ForEachFileAction(){
public void onFile(File src) throws IOException {
fileHashes.put(src.getAbsolutePath(), src.lastModified());
}
}.operate(fileSystemPath);
return fileHashes;
}
public boolean isFileModifiedSinceLastPoll(String filePath, Long lastModified) {
Long previousHash = fileHashesByDirectory.get(filePath);
return !lastModified.equals(previousHash);
}
public void updateFileSaveTime(File file) {
fileHashesByDirectory.put(file.getAbsolutePath(), file.lastModified());
}
public void writeChanges() {
try {
fileHashesHelper.write(getFilesystemHashes());
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
72ac23aa3581e510f8239fa0871bc130a56cd823 | 9254e7279570ac8ef687c416a79bb472146e9b35 | /alidns-20150109/src/main/java/com/aliyun/alidns20150109/models/DescribeInstanceDomainsResponseBody.java | 4a69f2af515ad78d8cce249aa7bb8974308a2da5 | [
"Apache-2.0"
] | permissive | lquterqtd/alibabacloud-java-sdk | 3eaa17276dd28004dae6f87e763e13eb90c30032 | 3e5dca8c36398469e10cdaaa34c314ae0bb640b4 | refs/heads/master | 2023-08-12T13:56:26.379027 | 2021-10-19T07:22:15 | 2021-10-19T07:22:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,793 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.alidns20150109.models;
import com.aliyun.tea.*;
public class DescribeInstanceDomainsResponseBody extends TeaModel {
@NameInMap("PageSize")
public Integer pageSize;
@NameInMap("RequestId")
public String requestId;
@NameInMap("PageNumber")
public Integer pageNumber;
@NameInMap("InstanceDomains")
public java.util.List<DescribeInstanceDomainsResponseBodyInstanceDomains> instanceDomains;
@NameInMap("TotalPages")
public Integer totalPages;
@NameInMap("TotalItems")
public Integer totalItems;
public static DescribeInstanceDomainsResponseBody build(java.util.Map<String, ?> map) throws Exception {
DescribeInstanceDomainsResponseBody self = new DescribeInstanceDomainsResponseBody();
return TeaModel.build(map, self);
}
public DescribeInstanceDomainsResponseBody setPageSize(Integer pageSize) {
this.pageSize = pageSize;
return this;
}
public Integer getPageSize() {
return this.pageSize;
}
public DescribeInstanceDomainsResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public DescribeInstanceDomainsResponseBody setPageNumber(Integer pageNumber) {
this.pageNumber = pageNumber;
return this;
}
public Integer getPageNumber() {
return this.pageNumber;
}
public DescribeInstanceDomainsResponseBody setInstanceDomains(java.util.List<DescribeInstanceDomainsResponseBodyInstanceDomains> instanceDomains) {
this.instanceDomains = instanceDomains;
return this;
}
public java.util.List<DescribeInstanceDomainsResponseBodyInstanceDomains> getInstanceDomains() {
return this.instanceDomains;
}
public DescribeInstanceDomainsResponseBody setTotalPages(Integer totalPages) {
this.totalPages = totalPages;
return this;
}
public Integer getTotalPages() {
return this.totalPages;
}
public DescribeInstanceDomainsResponseBody setTotalItems(Integer totalItems) {
this.totalItems = totalItems;
return this;
}
public Integer getTotalItems() {
return this.totalItems;
}
public static class DescribeInstanceDomainsResponseBodyInstanceDomains extends TeaModel {
@NameInMap("CreateTime")
public String createTime;
@NameInMap("DomainName")
public String domainName;
@NameInMap("CreateTimestamp")
public Long createTimestamp;
public static DescribeInstanceDomainsResponseBodyInstanceDomains build(java.util.Map<String, ?> map) throws Exception {
DescribeInstanceDomainsResponseBodyInstanceDomains self = new DescribeInstanceDomainsResponseBodyInstanceDomains();
return TeaModel.build(map, self);
}
public DescribeInstanceDomainsResponseBodyInstanceDomains setCreateTime(String createTime) {
this.createTime = createTime;
return this;
}
public String getCreateTime() {
return this.createTime;
}
public DescribeInstanceDomainsResponseBodyInstanceDomains setDomainName(String domainName) {
this.domainName = domainName;
return this;
}
public String getDomainName() {
return this.domainName;
}
public DescribeInstanceDomainsResponseBodyInstanceDomains setCreateTimestamp(Long createTimestamp) {
this.createTimestamp = createTimestamp;
return this;
}
public Long getCreateTimestamp() {
return this.createTimestamp;
}
}
}
| [
"[email protected]"
] | |
aa654012ab55c6130089d9b5a85b52e8f8f23ea8 | b4fea31700b19b605f008c730695b6de88b2ed0c | /jUnit/src/jUnit/JUnitTest.java | 0cedf649350d53080a2824602928773eaad658ca | [] | no_license | hales-michael/CIT360 | 321ae8282235238fbdf08e8b3c0352925e264ebb | c8c78b6b4e76f05335c0a6c4d0bdeeaf92e82c7a | refs/heads/master | 2020-08-04T19:19:15.583799 | 2020-04-09T20:11:51 | 2020-04-09T20:11:51 | 105,418,021 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,897 | java | package jUnit;
import static org.junit.Assert.*;
import org.junit.Test;
public class JUnitTest {
@Test
public void testSum1() {
int val = JUnit.add(4, 9);
assertEquals(val, 13);
}
@Test
public void testSum2() {
int val = JUnit.add(3, 2);
assertEquals(val, 9);
}
@Test
public void testSub1() {
int val = JUnit.sub(45, 27);
assertSame(val, 18);
}
@Test
public void testSub2() {
int val = JUnit.sub(5, 3);
assertEquals(val, 4);
}
@Test
public void testMult1() {
int val = JUnit.mult(4, 7);
assertEquals(val, 28);
}
@Test
public void testMult2() {
int val = JUnit.mult(15, 7);
assertEquals(val, 130);
}
@Test
public void testDiv1() {
int val = JUnit.div(9, 3);
assertEquals(val, 3);
}
@Test
public void testDiv2() {
int val = JUnit.div(25, 5);
assertEquals(val, 8);
}
@Test
public void testDiv3() {
int val = JUnit.div(2, 0);
assertEquals(val, 13);
}
@Test
public void testBoolean() {
boolean val = JUnit.login(true);
assertTrue(val);
}
@Test
public void testNull() {
String val = null;
assertNull(val);
}
@Test
public void testSame() {
int val1 = 5;
int val2 = 6;
assertSame(val1, val2);
}
@Test
public void testArrayEquals1() {
int[] familyAges = {2,4,44,45};
assertArrayEquals(familyAges, new int[]{2,4,44,45});
}
@Test
public void testArrayEquals2() {
int[] numberOfHotDogs = {1,2,2,3};
assertArrayEquals(numberOfHotDogs, new int[]{2,3,4,5});
}
@Test
public void testBoolean2() {
boolean val = JUnit.login(false);
assertFalse(val);
}
@Test
public void testNotNull() {
Object nullObject = null;
assertNotNull(nullObject);
}
@Test
public void testnotSame() {
int val1 = 8;
int val2 = 4;
assertNotSame(val1, val2);
}
}
| [
"[email protected]"
] | |
3ec10a9436a448d2dca241e6b29f76a0542b486e | 09ad7c7b7bae163f0cb5561a2ab0bf9f128a5301 | /app/src/main/java/com/scsvmv/ryan/appinovtask/ui/mapsmodule/MapsFragment.java | 0653cc5ae41a83265053864cfbfad3bdb54a0205 | [] | no_license | narayanansampath/Appinovtask | 95842dfaa911251f443b5231da6d9874fdbfe40f | 54316a6c04a47d90e1cae99764367e4dbc1ccb97 | refs/heads/master | 2020-04-12T20:04:24.812091 | 2018-12-24T09:52:15 | 2018-12-24T09:52:15 | 162,725,247 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,061 | java | package com.scsvmv.ryan.appinovtask.ui.mapsmodule;
import android.Manifest;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Criteria;
import android.location.Location;
//import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Build;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.google.android.gms.location.LocationListener;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.scsvmv.ryan.appinovtask.R;
import static android.content.Context.LOCATION_SERVICE;
public class MapsFragment extends SupportMapFragment implements OnMapReadyCallback,GoogleApiClient.ConnectionCallbacks,GoogleApiClient.OnConnectionFailedListener, com.google.android.gms.location.LocationListener {
GoogleMap mGoogleMap;
SupportMapFragment mapFrag;
LocationRequest mLocationRequest;
GoogleApiClient mGoogleApiClient;
Location mLastLocation;
Marker mCurrLocationMarker;
FloatingActionButton fabmap;
@Override
public void onResume() {
super.onResume();
setUpMapIfNeeded();
}
private void setUpMapIfNeeded() {
if (mGoogleMap == null) {
getMapAsync(this);
}
}
@Override
public void onPause() {
super.onPause();
//stop location updates when Activity is no longer active
if (mGoogleApiClient != null) {
LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this);
}
}
@Override
public void onMapReady(GoogleMap googleMap)
{
mGoogleMap=googleMap;
mGoogleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
//Initialize Google Play Services
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (ContextCompat.checkSelfPermission(getActivity(),
Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED) {
//Location Permission already granted
buildGoogleApiClient();
mGoogleMap.setMyLocationEnabled(true);
} else {
//Request Location Permission
checkLocationPermission();
}
}
else {
buildGoogleApiClient();
mGoogleMap.setMyLocationEnabled(true);
}
}
protected synchronized void buildGoogleApiClient() {
mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
mGoogleApiClient.connect();
}
@Override
public void onConnected(Bundle bundle) {
mLocationRequest = new LocationRequest();
mLocationRequest.setInterval(1000);
mLocationRequest.setFastestInterval(1000);
mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
if (ContextCompat.checkSelfPermission(getActivity(),
Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED) {
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
}
}
@Override
public void onConnectionSuspended(int i) {}
@Override
public void onConnectionFailed(ConnectionResult connectionResult) {}
@Override
public void onLocationChanged(Location location)
{
mLastLocation = location;
if (mCurrLocationMarker != null) {
mCurrLocationMarker.remove();
}
//Place current location marker
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
double loc_lat = location.getLatitude();
double loc_lon = location.getLongitude();
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(latLng);
markerOptions.title("Current Position");
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA));
mCurrLocationMarker = mGoogleMap.addMarker(markerOptions);
String uri = "http://maps.google.com/maps?daddr=" +loc_lat+","+loc_lon;
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
String ShareSub = "Here is my location";
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, ShareSub);
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, uri);
startActivity(Intent.createChooser(sharingIntent, "Share via"));
//move map camera
mGoogleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng,11));
}
public static final int MY_PERMISSIONS_REQUEST_LOCATION = 99;
private void checkLocationPermission() {
if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.shouldShowRequestPermissionRationale(getActivity(),
Manifest.permission.ACCESS_FINE_LOCATION)) {
new AlertDialog.Builder(getActivity())
.setTitle("Location Permission Needed")
.setMessage("This app needs the Location permission, please accept to use location functionality")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
//Prompt the user once explanation has been shown
ActivityCompat.requestPermissions(getActivity(),
new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
MY_PERMISSIONS_REQUEST_LOCATION );
}
})
.create()
.show();
} else {
// No explanation needed, we can request the permission.
ActivityCompat.requestPermissions(getActivity(),
new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
MY_PERMISSIONS_REQUEST_LOCATION );
}
}
}
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
switch (requestCode) {
case MY_PERMISSIONS_REQUEST_LOCATION: {
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0
&& grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// permission was granted, yay! Do the
// location-related task you need to do.
if (ContextCompat.checkSelfPermission(getActivity(),
Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED) {
if (mGoogleApiClient == null) {
buildGoogleApiClient();
}
mGoogleMap.setMyLocationEnabled(true);
}
} else {
// permission denied, boo! Disable the
// functionality that depends on this permission.
Toast.makeText(getActivity(), "permission denied", Toast.LENGTH_LONG).show();
}
return;
}
// other 'case' lines to check for other
// permissions this app might request
}
}
} | [
"[email protected]"
] | |
e3b47bf9bc6f0bba9cc14ed8f027ed1f4e43a3b6 | 4551f533243645c5af140be95e485d6da7340de5 | /src/main/java/no/hib/repository/SymptomRepo.java | 89e477fda78cb5c89e10654875c608223587a2fa | [] | no_license | fazlRabbi/msservice-hibernate | 42db840c6703607c324ac8bd3f1158bbf3980498 | 85827b0326f686434d205f0e80fdfd5e4d1c7f73 | refs/heads/master | 2020-03-25T23:22:42.102978 | 2018-08-10T11:04:56 | 2018-08-10T11:04:56 | 144,272,357 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | package no.hib.repository;
import no.hib.models.Symptom;
import java.util.List;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
public interface SymptomRepo extends CrudRepository<Symptom, Integer>{
@Query("SELECT t FROM Symptom t where t.severity != null")
public List<Symptom> getSymptoms();
@Query("SELECT t FROM Symptom t where t.uuid = :uuid")
public List<Symptom> getSymptomByUuid(@Param("uuid") String uuid);
}
| [
"[email protected]"
] | |
246b50f04a1035753b70ea6e69f95a897eaa4b61 | 67c6cc6f7d8accc5496eadfa82d65ce846305fc1 | /src/main/java/com/example/demo/service/MessageService.java | 9cedf4239490778891be2dd618f3103223f1674d | [] | no_license | ypzxm/origin | 2e7160002a5a38d7a24cabcafac80674ab549c2d | 8d43564f032dab8fca96c2f05e79290f8ea3f7ca | refs/heads/master | 2020-03-20T23:19:15.585725 | 2018-08-14T17:35:35 | 2018-08-14T17:35:35 | 137,840,651 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 169 | java | package com.example.demo.service;
/**
* @author zhangyanqing
* @desc
* @date 2018/08/05
*/
public interface MessageService {
String printMessage();
}
| [
"[email protected]"
] | |
393e45d78723802f424510faf0caf47c62cf37cb | 00cc8e19c5277632d809eb53d3d061f48273edfb | /studentManagementRest/src/main/java/fpt/training/studentManagementRest/repository/ClassRepository.java | bd7357472dd31af2687d90c8af082d262cfd6f97 | [] | no_license | ThuHa219/studentManagementApi | 3bc27d5f97b81636e2fd33457ac19d64c575ce43 | d6e16636d9de324a8b524905abfa2c3a79ec5d96 | refs/heads/master | 2023-05-13T20:15:22.882826 | 2021-06-08T10:19:12 | 2021-06-08T10:19:12 | 374,966,289 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,232 | java | package fpt.training.studentManagementRest.repository;
import java.util.List;
import java.util.Optional;
import javax.transaction.Transactional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import fpt.training.studentManagementRest.model.ClassEntity;
@Repository
public interface ClassRepository extends JpaRepository<ClassEntity, Long> {
@Query("FROM ClassEntity c WHERE c.subject.isDeleted != 1 AND isDeleted != 1")
public List<ClassEntity> findAll();
@Query("FROM ClassEntity c WHERE id = :id AND isDeleted != 1 AND c.subject.isDeleted != 1")
public Optional<ClassEntity> findById(@Param("id") long id);
@Transactional
@Modifying
@Query(value = "UPDATE class SET is_deleted = 1 WHERE id = :id", nativeQuery = true)
public void delete(@Param("id") long id);
@Query(value = "SELECT DISTINCT * FROM class c JOIN assignment a ON c.id = a.class_id WHERE student_id = :studentId AND is_deleted != 1;"
, nativeQuery = true)
List<ClassEntity> findByStudentId(long studentId);
}
| [
"[email protected]"
] | |
3787efc3f100071b2eebcac7aeaae794112ff54e | cf841c0addd67d3f12b8af101a2fe2a8ef94e4ca | /app/src/main/java/com/clakestudio/pc/everyday/showdays/ShowDaysActivity.java | 67d86277634293a1e2c7e3ed17739477591e543f | [
"Apache-2.0"
] | permissive | jstarczewski/everyday | c80f90df4f1e871c5bf4a9b7e2764aa1a1b18eee | 6e614fd643af6976afccec3f1d677e957e8de350 | refs/heads/master | 2020-03-27T15:22:31.350359 | 2019-02-17T14:06:27 | 2019-02-17T14:06:27 | 146,714,229 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,623 | java | package com.clakestudio.pc.everyday.showdays;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.clakestudio.pc.everyday.R;
import com.clakestudio.pc.everyday.data.DayDatabase;
import com.clakestudio.pc.everyday.data.DayRepository;
import com.clakestudio.pc.everyday.data.settings.SettingsRepository;
import com.clakestudio.pc.everyday.data.settings.SharedPreferencesSettings;
import com.clakestudio.pc.everyday.utils.BaseActivity;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class ShowDaysActivity extends BaseActivity {
private ShowDaysPresenter showDaysPresenter;
// This should actually change depends on region
private static final String pattern = "dd MM yyyy";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show_days);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ShowDaysFragment showDaysFragment = (ShowDaysFragment) getSupportFragmentManager().findFragmentById(R.id.contentFrame);
if (showDaysFragment == null) {
showDaysFragment = ShowDaysFragment.newInstance();
BaseActivity.addFragmentToActivity(getSupportFragmentManager(), showDaysFragment, R.id.contentFrame);
}
showDaysPresenter = new ShowDaysPresenter((DayRepository.getInstance(DayDatabase.getInstance(getApplicationContext()).dayDao())),
SettingsRepository.getInstance(SharedPreferencesSettings.getInstance(this))
,showDaysFragment
, new SimpleDateFormat(pattern)
, Calendar.getInstance()
);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_show_days, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
showDaysPresenter.loadShowSettingsActivity();
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"[email protected]"
] | |
13808336df60827d947a8ca8c6c47a80d6c849ad | 847c7ca7e9287de7550c2702790eac89738ce8d1 | /rcomp-examples/rcomp-examples/src/main/java/org/apache/karaf/rcomp/examples/mqtt/ByteArrayConverter.java | f9813460247f9b330c4bc27cfa869bb4a04916ee | [
"Apache-2.0"
] | permissive | apache/karaf-reactive-components | b0085e418ce348897f5cb6071d0b452acbaba31b | 8e55686852e3fefe61fbbc4b2db214ae09330a36 | refs/heads/master | 2023-08-24T04:06:31.640163 | 2017-10-25T07:12:51 | 2017-10-25T07:12:51 | 107,861,331 | 2 | 5 | Apache-2.0 | 2023-04-14T19:34:45 | 2017-10-22T11:51:17 | Java | UTF-8 | Java | false | false | 1,557 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.karaf.rcomp.examples.mqtt;
import java.nio.charset.Charset;
public class ByteArrayConverter {
public static String asString(byte[] ba) {
return new String(ba, Charset.forName("UTF-8"));
}
public static Integer asInteger(byte[] ba) {
return new Integer(asString(ba));
}
public static Double asDouble(byte[] ba) {
return new Double(asString(ba));
}
public static byte[] fromString(String in) {
return in.getBytes(Charset.forName("UTF-8"));
}
public static byte[] fromInteger(Integer in) {
return fromString(in.toString());
}
public static byte[] fromLong(Long in) {
return fromString(in.toString());
}
}
| [
"[email protected]"
] | |
eb11792029a18e3c56eddb2d5ef9a4927e34875c | ceaccacd2b92c980d690805701c942185ff9385a | /jbase-filter/src/main/java/br/jus/tre_pa/jbase/groovy/filter/PrepareStatement.java | 47c7f3afbe2e50b3c3ca939244ae22f4281ab8e9 | [] | no_license | jribacruz/jbase | 97b687eb056af6487e832f3509cf0423c6ce3bfe | 36d0a2ebd39d0f728cb89b8b57ad17a1df389aa1 | refs/heads/master | 2023-06-26T12:37:35.053006 | 2017-01-06T11:58:32 | 2017-01-06T11:58:32 | 56,334,748 | 0 | 0 | null | 2023-06-20T15:18:36 | 2016-04-15T16:34:13 | Java | UTF-8 | Java | false | false | 308 | java | package br.jus.tre_pa.jbase.groovy.filter;
import br.jus.tre_pa.jbase.groovy.filter.fragment.JPQLStatement;
/**
*
* @author jcruz
*
*/
public interface PrepareStatement {
/**
*
* @param statement
* @param filter
*/
<F extends Filterable> void prepare(JPQLStatement statement, F filter);
}
| [
"jcruz@jcruz"
] | jcruz@jcruz |
216da7d62c5aabc26a0e3e2076e1fe5c0b7b67e8 | 7b9188f2e30ffaf8ae41e6a4ab4c82ccb70d9da7 | /Turtles/JumpyTurtle.java | 0ab789ab2e1ac06b2cf55376a78bf4d98782e6b4 | [] | no_license | danielzilpa/Object-Oriented-Polymorphism-And-Exceptions | a32340a0d105afdbb5e253b44f7bb1f9ba2c8d6d | 408d937bcf777e644bd71f88504737ae93367eaf | refs/heads/master | 2022-10-24T04:19:58.568732 | 2020-06-17T16:11:27 | 2020-06-17T16:11:27 | 273,020,923 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,072 | java | import Turtle.*;
/**
* Jumpy turtle is a smart and faltering tortoise:
* as it progresses he goes on and off, the result is that when the tail is lowered it leaves a dashed line.
* @author Daniel and Olga
*/
public class JumpyTurtle extends SmartTurtle {
//down = true
//up = false
boolean tail_mode;
/**
* JumpyTurtle
* JumpyTurtle constructor.
*/
public JumpyTurtle() {
}
/**
* tailDown
* set the turtle tail down (override).
*/
public void tailDown () {
tail_mode = true;
super.tailDown();
}
/**
* tailUp
* set the turtle tail up (override).
*/
public void tailUp () {
tail_mode = false;
super.tailUp();
}
/**
* moveForward
* he goes on and off, the result is that when the tail is lowered it leaves a dashed line (override).
* @param distance - the distance
*/
public void moveForward (double distance) {
//if the tail is lowered it leaves a dashed line
if (tail_mode) {
//skips (tail up and down) of distances of 10
for (int i=0; i<distance; i=i+20) {
super.moveForward(10);
tailUp();
super.moveForward(10);
tailDown();
}
//if the tail is up he move forward without leaving trails
} else {
super.moveForward(distance);
}
}
/**
* drawSquare
* Draw a square in the given size (override).
* @param size - the side length
*/
public void drawSquare(double size) {
//if the size is a negative number, throw an error
if (size <= 0) {
throw new RuntimeException("Errordaniel - invalid size");
}
//by the saved word 'super' we call to 'tailDown' function in 'SimpleTurtle' class from that we inherit her
//take the turtle tail down so he will leave traces
super.tailDown();
//a square has 4 sides so the turtle should be rotated after 3 sides.
for (int i = 0; i < 3; i++) {
moveForward(size);
super.turnRight(90);
}
//paint the last side
moveForward(size);
}
/**
* drawPolygon
* draw a polygon in the given sides and size (override).
* @param sides - the number of sides
* @param size - the side length
*/
public void drawPolygon(int sides, double size) {
//if the sides is a negative number, throw an error
if (sides <= 0) {
throw new RuntimeException("Errordaniel - invalid sides");
//if the size is a negative number, throw an error
} else if (size <= 0) {
throw new RuntimeException("Errordaniel - invalid size");
}
//by the saved word 'super' we call to 'tailDown' function in 'SimpleTurtle' class from that we inherit her
//take the turtle tail down so he will leave traces
super.tailDown();
//calculate the degrees (total degrees in any form is 360)
int degrees = 360/sides;
//go into the loop as long as we have not reached the last side
while (sides > 1) {
moveForward(size); //draw the side
super.turnRight(degrees); //head toward the next side
sides--;
}
//paint the last side
moveForward(size);
}
}
| [
"[email protected]"
] | |
a0f239515e6d2df7cf425d0c800b9360e5cf88e7 | 5fddb9a3f85f50cdefe3bf29ca06b33ad44bcd62 | /src/main/java/com/syncleus/aethermud/game/core/collections/SingleEnumeration.java | ceb1477366a7f5ed2cd129e68771a5af8188721a | [
"Apache-2.0"
] | permissive | freemo/AetherMUD-coffee | da315ae8046d06069a058fb38723750a02f72853 | dbc091b3e1108aa6aff3640da4707ace4c6771e5 | refs/heads/master | 2021-01-19T22:34:29.830622 | 2017-08-26T14:01:24 | 2017-08-26T14:06:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,666 | java | /**
* Copyright 2017 Syncleus, Inc.
* with portions copyright 2004-2017 Bo Zimmerman
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.syncleus.aethermud.game.core.collections;
import java.util.Enumeration;
/*
Copyright 2012-2017 Bo Zimmerman
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
public class SingleEnumeration<K> implements Enumeration<K> {
private K k;
public SingleEnumeration(K k) {
this.k = k;
}
@Override
public boolean hasMoreElements() {
return k != null;
}
@Override
public K nextElement() {
final K o = k;
k = null;
return o;
}
}
| [
"[email protected]"
] | |
f470c21e5eedacfbc1370bcb18515ac1f2ec7030 | 4e3c5dc1cfd033b0e7c1bea625f9ee64ae12871a | /com/heyzap/common/video/VideoModelInterface.java | 6ce7380d8baeff0931f67d2a26775414d11dde7b | [] | no_license | haphan2014/idle_heroes | ced0f6301b7a618e470ebfa722bef3d4becdb6ba | 5bcc66f8e26bf9273a2a8da2913c27a133b7d60a | refs/heads/master | 2021-01-20T05:01:54.157508 | 2017-08-25T14:06:51 | 2017-08-25T14:06:51 | 101,409,563 | 1 | 4 | null | null | null | null | UTF-8 | Java | false | false | 591 | java | package com.heyzap.common.video;
import android.net.Uri;
import com.heyzap.common.cache.Entry;
import com.heyzap.internal.Constants.AdUnit;
public interface VideoModelInterface {
Entry getCacheEntry();
String getCreativeUniqueIdentifier();
Uri getStaticUri();
Uri getStreamingUri();
VideoDisplayOptions getVideoDisplayOptions();
Boolean isFileCached();
Boolean isReady();
void setAdUnit(AdUnit adUnit);
void setCacheEntry(Entry entry);
void setIsReady(Boolean bool);
void setPercentDownloaded(Integer num);
void setSize(int i);
}
| [
"[email protected]"
] | |
7067d04a1391bafe1a6b718d9558bff52b36ab8d | 19f9ad5dd16c8773e6201eb45de7d07c707e5864 | /app/org/sagebionetworks/bridge/validators/UploadSchemaValidator.java | b32a50025c1e42815d88b7c807679b9c76fac4e4 | [] | no_license | Hero1711/MobileHealthLongHuy-BridgePF | 6c2ce513eb5e0b54cd450bd13467807ba2609514 | 06b50a61e0fc4a39f9b8d94b4b2d2ec1480a0ad7 | refs/heads/master | 2016-08-12T21:34:51.894699 | 2015-05-26T03:50:23 | 2015-05-26T03:50:53 | 36,260,584 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,121 | java | package org.sagebionetworks.bridge.validators;
import java.util.List;
import com.google.common.base.Strings;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
import org.sagebionetworks.bridge.models.upload.UploadFieldDefinition;
import org.sagebionetworks.bridge.models.upload.UploadSchema;
/** Validator for {@link org.sagebionetworks.bridge.models.upload.UploadSchema} */
public class UploadSchemaValidator implements Validator {
/** Singleton instance of this validator. */
public static final UploadSchemaValidator INSTANCE = new UploadSchemaValidator();
/** {@inheritDoc} */
@Override
public boolean supports(Class<?> clazz) {
return UploadSchema.class.isAssignableFrom(clazz);
}
/**
* <p>
* Validates the given object as a valid UploadSchema instance. This will flag errors in the following
* conditions:
* <ul>
* <li>value is null or not an UploadSchema</li>
* <li>fieldDefinitions is null or empty</li>
* <li>fieldDefinitions contains null or invalid entries</li>
* <li>name is null or empty</li>
* <li>revision is negative</li>
* <li>schemaId is null or empty</li>
* <li>schemaType is null</li>
* </ul>
* </p>
*
* @see org.springframework.validation.Validator#validate
*/
@Override
public void validate(Object target, Errors errors) {
if (target == null) {
errors.rejectValue("uploadSchema", Validate.CANNOT_BE_NULL);
} else if (!(target instanceof UploadSchema)) {
errors.rejectValue("uploadSchema", Validate.WRONG_TYPE);
} else {
UploadSchema uploadSchema = (UploadSchema) target;
// fieldDefinitions
// We do not need to validate inside the elements of fieldDefinitions, because (1)
// UploadFieldDefinition is self-validating and (2) we copy this to an ImmutableList, which does not
// permit null values.
List<UploadFieldDefinition> fieldDefList = uploadSchema.getFieldDefinitions();
if (fieldDefList == null || fieldDefList.isEmpty()) {
errors.rejectValue("fieldDefinitions", Validate.CANNOT_BE_NULL_OR_EMPTY);
}
// name
if (Strings.isNullOrEmpty(uploadSchema.getName())) {
errors.rejectValue("name", Validate.CANNOT_BE_BLANK);
}
// revision must be non-negative. (0 is allowed if it's a new schema. revisions 1 and above are saved
// schemas)
if (uploadSchema.getRevision() < 0) {
errors.rejectValue("revision", Validate.CANNOT_BE_NEGATIVE);
}
// schema ID
if (Strings.isNullOrEmpty(uploadSchema.getSchemaId())) {
errors.rejectValue("schemaId", Validate.CANNOT_BE_BLANK);
}
// schema type
if (uploadSchema.getSchemaType() == null) {
errors.rejectValue("schemaType", Validate.CANNOT_BE_NULL);
}
}
}
}
| [
"[email protected]"
] | |
56d6bb242770ee4d8d427b9ab8cacc83dcc42289 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.qqlite/classes.jar/com/tencent/mobileqq/activity/PredownloadTest.java | afc5eb9899a80facda631c377c8ed38253f14a24 | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 2,202 | java | package com.tencent.mobileqq.activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import bbb;
import com.tencent.mobileqq.app.BaseActivity;
import com.tencent.mobileqq.app.QQAppInterface;
import com.tencent.mobileqq.pic.BaseStrategy;
import com.tencent.mobileqq.pic.PicPreDownloader;
public class PredownloadTest
extends BaseActivity
{
public static boolean a;
Button a;
public EditText a;
public EditText b;
public EditText c;
public EditText d;
public EditText e;
public EditText f;
static
{
jdField_a_of_type_Boolean = false;
}
private void c()
{
this.jdField_a_of_type_AndroidWidgetEditText = ((EditText)findViewById(2131298353));
this.b = ((EditText)findViewById(2131298354));
this.c = ((EditText)findViewById(2131298355));
this.d = ((EditText)findViewById(2131298356));
this.e = ((EditText)findViewById(2131298357));
this.f = ((EditText)findViewById(2131298358));
this.jdField_a_of_type_AndroidWidgetButton = ((Button)findViewById(2131298359));
PredownloadTest.ConfigInfo localConfigInfo = this.app.a().a.a();
this.jdField_a_of_type_AndroidWidgetEditText.setText(String.valueOf(localConfigInfo.a));
this.b.setText(String.valueOf(localConfigInfo.b));
this.c.setText(String.valueOf(localConfigInfo.c));
this.d.setText(String.valueOf(localConfigInfo.d));
this.e.setText(String.valueOf(localConfigInfo.e));
this.f.setText(String.valueOf(localConfigInfo.f));
this.jdField_a_of_type_AndroidWidgetButton.setOnClickListener(new bbb(this));
}
public long a(EditText paramEditText)
{
try
{
long l = Long.valueOf(paramEditText.getText().toString()).longValue();
return l;
}
catch (Exception paramEditText) {}
return -1L;
}
protected void onCreate(Bundle paramBundle)
{
super.onCreate(paramBundle);
setContentView(2130903523);
c();
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.qqlite\classes.jar
* Qualified Name: com.tencent.mobileqq.activity.PredownloadTest
* JD-Core Version: 0.7.0.1
*/ | [
"[email protected]"
] | |
8c691a213943309d00f6d3928ed1ca0d372f42c0 | 40665051fadf3fb75e5a8f655362126c1a2a3af6 | /ibinti-bugvm/776c1d17abf0adba0d64394ffa1821e8de6a8880/5304/EndOfBufferException.java | e1ea1741bdc736edb7af85edb3f68bbad9779d46 | [] | no_license | fermadeiral/StyleErrors | 6f44379207e8490ba618365c54bdfef554fc4fde | d1a6149d9526eb757cf053bc971dbd92b2bfcdf1 | refs/heads/master | 2020-07-15T12:55:10.564494 | 2019-10-24T02:30:45 | 2019-10-24T02:30:45 | 205,546,543 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,189 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.org.conscrypt;
import java.io.IOException;
/**
* This exception indicates that data could not be read from the stream because the underlying input
* stream reached its end.
*/
public class EndOfBufferException extends IOException {
private static final long serialVersionUID = 1838636631255369519L;
public EndOfBufferException() {
}
}
| [
"[email protected]"
] | |
3b69d66927be5ed9014c2da44d6f6a74646fcd50 | b0296d820c0400440232152485a0b3dff3e943be | /GTAS/Customers/Inovis/UserProcedure/Util/src/com/inovis/userproc/util/FileSpaceHandler.java | 06d0a157358c37d8a1cfdbbba2c78b0518ab54ad | [] | no_license | andytanoko/4.2.x_integration | 74536c8933a98373b0118eeac66678b72b00aa8e | 984842d92abaa797a19bd0f002ec45c9c37da288 | refs/heads/master | 2021-01-10T13:46:58.824451 | 2015-09-23T10:41:25 | 2015-09-23T10:41:25 | 46,325,977 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 9,437 | java | /**
* This software is the proprietary information of GridNode Pte Ltd.
* Use is subjected to license terms.
*
* Copyright 2001-2008 (C) GridNode Pte Ltd. All Rights Reserved.
*
* File: FileSpaceHandler.java
*
****************************************************************************
* Date Author Changes
****************************************************************************
* May 14, 2010 Tam Wei Xiang Created
* Jan 03, 2011 Tam Wei Xiang Allow the user to configure the UP to instantiate
* particular concrete TransformerFactory class.
*/
package com.inovis.userproc.util;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.InputStream;
import java.util.UUID;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import com.gridnode.util.SystemUtil;
/**
* The utility to remove the blank line in a file containing character.
*
* @author Tam Wei Xiang
* @since GT4.1.4.3
*/
public class FileSpaceHandler
{
// public void handleBlankLine(String filePath) throws Exception
// {
// File file = new File(filePath);
// if(! file.exists() )
// {
// throw new IllegalArgumentException("File space handling failed, the given file="+filePath+" is not exists.");
// }
// if(file.isDirectory())
// {
// throw new IllegalArgumentException("File space handling failed, the given file is a directory!");
// }
//
// File outFile = new File(getTempDirPath()+generateRandomFilename());
// FileReader reader = null;
// BufferedReader buffReader = null;
// FileWriter writer = null;
// BufferedWriter buffWriter = null;
//
// try
// {
// reader = new FileReader(file);
// buffReader = new BufferedReader(reader);
//
//
// writer = new FileWriter(outFile);
// buffWriter = new BufferedWriter(writer);
//
// String s = null;
// while( (s = buffReader.readLine()) != null)
// {
// if(! s.trim().equals(""))
// {
// buffWriter.write(s);
// buffWriter.newLine();
// }
// }
// }
// catch(Exception ex)
// {
// throw new Exception("File space handling failed, error in removing blankline from file="+filePath, ex);
// }
// finally
// {
// if(buffWriter != null)
// {
// buffWriter.close();
// }
//
// if(buffReader != null)
// {
// buffReader.close();
// }
// }
//
// file.delete();
//
// boolean isRenameSuccess = renameFile(file, outFile);
// if(! isRenameSuccess)
// {
// throw new Exception("File space handling failed, can not rename from "+outFile.getAbsolutePath()+" to "+file.getAbsolutePath());
// }
// }
//
public void handleBlankLineXml(String filePath, Boolean isIndent, String dtdDir) throws Exception
{
handleBlankLineXml(filePath, isIndent, dtdDir, null);
}
/**
* Remove the blank line in the xml file. Allow to set the concrete transformer factory implementation.
* @param filePath The full path to the xml document
* @param isIndent whether to set the indentation to the output xml
* @param dtdDir The DTD directory path
* @param transformerFactoryName The concrete transformer factory full qualify class name. The supported class includes
* i) com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl
* ii) com.icl.saxon.TransformerFactoryImpl
* iii) org.apache.xalan.processor.TransformerFactoryImpl. Not recommended to use as it corrupt the xml file containing special character.
* @throws Exception thrown if there is issue on removing the blank line.
*/
public void handleBlankLineXml(String filePath, Boolean isIndent, String dtdDir, String transformerFactoryName) throws Exception
{
File file = new File(filePath);
if(! file.exists() )
{
throw new IllegalArgumentException("File space handling failed, the given file="+filePath+" is not exists.");
}
if(file.isDirectory())
{
throw new IllegalArgumentException("File space handling failed, the given file is a directory!");
}
File outFile = new File(getTempDirPath()+generateRandomFilename());
FileInputStream in = null;
BufferedInputStream buffIn = null;
try
{
in = new FileInputStream(file);
buffIn = new BufferedInputStream(in);
Document xmlFile = parseXmlFile(buffIn, getWorkingDir()+"/"+dtdDir);
DocumentType docType = xmlFile.getDoctype();
removeWhitespace(xmlFile.getDocumentElement());
TransformerFactory tFactory = null;
if(transformerFactoryName == null || transformerFactoryName.trim().length() == 0)
{
tFactory = TransformerFactory.newInstance();
}
else
{
//System.setProperty("javax.xml.transform.TransformerFactory", transformerName);
//Note: we do not follow the recommended way to initiate the TransformerFactory instance
// option 1: set the System property
// option 2: set the META-INF/services/javax.xml.transform.TransformerFactory
// The reason is for option 1, it is setting the property in a global scope, which have potentially
// impacting those classes that depend on concrete TransformerFactory (SAXON impl or XALAN impl).
// We may run into trouble by setting the TransformerFactory into particular implementation.
// for option 2, there is no effect, the UP still initiate using the org Apache XALAN impl. It seem like
// the xalan.jar under the jboss/lib/endorsed is loaded first.
Class<? extends TransformerFactory> transFactoryClass = Class.forName(transformerFactoryName).asSubclass(TransformerFactory.class);
tFactory = transFactoryClass.newInstance();
}
Transformer serializer = tFactory.newTransformer();
if(isIndent)
{
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
}
if(docType != null)
{
serializer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, docType.getSystemId());
}
serializer.transform(new DOMSource(xmlFile), new StreamResult(outFile));
}
catch(Exception ex)
{
throw new Exception("File space handling failed, error in removing blankline from file="+filePath, ex);
}
finally
{
if(buffIn != null)
{
buffIn.close();
}
if(in != null)
{
in.close();
}
}
boolean isRenameSuccess = renameFile(file, outFile);
if(! isRenameSuccess)
{
throw new Exception("File space handling failed, can not rename from "+outFile.getAbsolutePath()+" to "+file.getAbsolutePath());
}
}
private String getTempDirPath()
{
return System.getProperty("java.io.tmpdir");
}
private String generateRandomFilename()
{
return UUID.randomUUID().toString();
}
private boolean renameFile(File sourceFile, File targetFile)
{
return targetFile.renameTo(sourceFile);
}
/**
*
* @param in
* @param systemId The location that is storing the dtd
* @return
* @throws Exception
*/
private Document parseXmlFile(BufferedInputStream in, String systemId) throws Exception
{
try
{
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
return db.parse(in, systemId);
} catch(Exception ex)
{
throw new Exception("Failed to parse xml file", ex);
}
}
//removing the while space, next line item, it will be no formatting
private static void removeWhitespace(Element parent) {
NodeList nodes = parent.getChildNodes();
for (int i = nodes.getLength()-1; i >= 0; i--) {
Node node = nodes.item(i);
if (node instanceof Element)
{
removeWhitespace((Element)node);
}
else if (node instanceof Text)
{
if (((Text)node).getData().trim().equals(""))
{
parent.removeChild(node);
}
}
}
}
private String getWorkingDir()
{
return SystemUtil.getWorkingDirPath();
}
public static void main(String[] args) throws Exception
{
String source = "c:/elemicaDoc.xml";
FileSpaceHandler handler = new FileSpaceHandler();
//handler.handleBlankLine(source);
handler.handleBlankLineXml(source, true, "","com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
}
}
| [
"[email protected]"
] | |
40d439870b052ba71458e333ef601d24259b1c5a | 94ec4014f50d2e47e5e0b2e8a1c24aac64d570c6 | /src/main/java/com/stackroute/goplaces/domain/Places.java | 2d27a2ea62406a75597fc977b3e8e98391608838 | [] | no_license | inthiyaz7876/spring-Application-with-mongo-databse-connection | 003363a687f2a7531b97bfe3fd4ea741be32c3e1 | 96e4e7b3dcf0701886aa36c87c6e3b6cdc25b331 | refs/heads/master | 2021-04-25T23:01:53.818813 | 2017-10-17T07:10:35 | 2017-10-17T07:10:35 | 107,230,691 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package com.stackroute.goplaces.domain;
import javax.persistence.Entity;
import javax.persistence.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Document(collection="places")
public class Places
{
@Id
private int id;
private String name;
private String address;
private String imageurl;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getImageurl() {
return imageurl;
}
public void setImageurl(String imageurl) {
this.imageurl = imageurl;
}
}
| [
"[email protected]"
] | |
527aa521911d0b027b39501fd142e9efed1a666c | ccf412d3a146a01e553aa26632fb57cb21e0ac9a | /app/src/main/java/nyc/muaadh_melhi_develpoer/andriodtest/MyViewHolder.java | 0a27f89fed3ebf8ee86084a5b8f867038e1b8ac6 | [] | no_license | MuaadhMelhi/AndriodTest | 1da46e2c43d8b016f4643a914184107206b52b3a | 9f7d04bf1ba9e52bdb5bc9cf01908cbce195a808 | refs/heads/master | 2021-08-23T23:35:39.944067 | 2017-12-07T03:11:26 | 2017-12-07T03:11:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,314 | java | package nyc.muaadh_melhi_develpoer.andriodtest;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
/**
* Created by c4q on 12/6/17.
*/
class MyViewHolder extends RecyclerView.ViewHolder {
private TextView textView;
public MyViewHolder(View itemView) {
super(itemView);
}
public void onBind(ModelData modelData) {
textView = itemView.findViewById(R.id.text_view_holder);
textView.setText("" + modelData.getNumber());
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
DisplayNumberFragment displayNumberFragment = new DisplayNumberFragment();
Bundle bundle = new Bundle();
bundle.putString("input", textView.getText().toString());
displayNumberFragment.setArguments(bundle);
MyAdapter.fragment.getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,displayNumberFragment ).addToBackStack("").commit();
}
});
}
}
| [
"[email protected]"
] | |
71f1758b04ba79ffa7032ef4f19f840b79f192ed | cf3ca447db7ad650758db27e8123a2f8b1ced90d | /lab-panos/src/test/java/com/codefellows/labpanos/LabPanosApplicationTests.java | eb83bffe826c63f278b13ec2cb3d22b54efb059b | [] | no_license | KumasakaPanos/13-uploading-files | 424f060ed6e54e4ce98883ddcecc8f8ad5ceac11 | c5a1982d2c3a5df73a2f8b17ec9deb15761afcf6 | refs/heads/master | 2020-03-28T16:36:22.589035 | 2018-09-14T05:35:44 | 2018-09-14T05:35:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package com.codefellows.labpanos;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class LabPanosApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
] | |
2729f8f5d35b80fc8bec7a6c575b67aae1521876 | 671c944cdb5f2e952b48471365e7f8a9cc29a180 | /app/src/main/java/com/orangeboston/magnetic/MagneticView.java | c0018b2a1e8998d9684e740beca34dd8fafd9e35 | [] | no_license | OrangeBoston/Magnetic | d585ac6783a2a69abf8756ae6139273ec47f91e4 | aac435041f8efec3022c7244b2df41c2aa248608 | refs/heads/master | 2021-05-22T01:36:10.201350 | 2020-04-04T05:41:37 | 2020-04-04T05:41:37 | 252,909,251 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,820 | java | package com.orangeboston.magnetic;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
public class MagneticView extends View {
private Paint mPaint;
private Path mPath;
private float[] mValues;
private boolean isMeasured;
private int mWidth, mHeight;
public MagneticView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public void init() {
mPaint = new Paint();
mPaint.setColor(getResources().getColor(R.color.colorSnow));
mPath = new Path();
}
@Override
protected void onDraw(Canvas canvas) {
initMeasure();
if (mValues != null) {
Log.e("TAG", "==" + (180 - mValues[0]));
canvas.rotate(180 - mValues[0], mWidth / 2, mHeight / 2);//180代表正南方
}
canvas.drawLine(0, mHeight / 2, mWidth, mHeight / 2, mPaint);
canvas.drawLine(mWidth / 2, 0, mWidth / 2, mHeight, mPaint);
canvas.drawPath(mPath, mPaint);
}
public void initMeasure() {
if (!isMeasured) {
isMeasured = true;
mWidth = getMeasuredWidth();
mHeight = getMeasuredHeight();
initPath(mWidth, mHeight);
}
}
public void initPath(int width, int height) {
mPath.reset();
mPath.moveTo(width / 2, height / 2 - 50);
mPath.lineTo(width / 2 - 20, height / 2 + 60);
mPath.lineTo(width / 2, height / 2 + 50);
mPath.lineTo(width / 2 + 20, height / 2 + 60);
mPath.close();
}
public void setValues(float[] mValues) {
this.mValues = mValues;
}
} | [
"[email protected]"
] | |
6de387601b7187ef9811e132770bf08548e3a7c6 | 0e79e88fd231866fc9eec501f0a5e22841b4b63f | /hesen-detail/hesen-web-client/src/main/java/com/hesen/web/WebApplication.java | 267fa697758198d76fa6398dc4539087957e8f38 | [] | no_license | blackhesen/hesen | 8adc0ee2faae4b16c0286a0588d0cfcb9d11a5f5 | 2902383018c3b740770b127022b16a1f69baad5e | refs/heads/master | 2021-08-29T21:28:33.445346 | 2017-12-15T02:44:41 | 2017-12-15T02:44:41 | 114,239,242 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,252 | java | package com.hesen.web;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.web.servlet.ErrorPage;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;
import org.springframework.http.HttpStatus;
/**
* Created by hesen on 2017-12-14
*/
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@ImportResource({"classpath:d*.xml"})//引入dubbo
public class WebApplication {
public static void main(String[] args) {
SpringApplication.run(WebApplication.class, args);
}
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
return container -> {
container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/error/404"));
container.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error/500"));
container.addErrorPages(new ErrorPage(Exception.class, "/error/500"));
};
}
}
| [
"[email protected]"
] | |
a53507cb295184da1296defa782df0c008971c93 | c6d9397b8b982449c3170acf690b4a280c8c0cb8 | /src/main/java/springtest/RockMusic.java | be59b88cecf57056106f70f4f5ea1dba4d4b39d7 | [] | no_license | EvjVlasov/SpringTest | db3586393933236206e941bc7099df11ecb369e5 | 6a1975817b016a09d49a6c188c9da3086842e9bd | refs/heads/master | 2022-12-24T08:03:14.048798 | 2019-10-18T17:46:08 | 2019-10-18T17:46:08 | 209,548,073 | 3 | 0 | null | 2022-12-16T05:06:54 | 2019-09-19T12:28:55 | Java | UTF-8 | Java | false | false | 150 | java | package springtest;
public class RockMusic implements Music {
@Override
public String getSong() {
return "We will rock you";
}
}
| [
"[email protected]"
] | |
b4f90d1327548f213568c0d22b751e5abe453a1c | 22bfa6052d2ce7f0fd8efeb0c5e6d83d665a1124 | /src/main/java/org/fireflow/model/resource/Form.java | 15d533ad6c197f6db1eb0a6c13944f1a991c155f | [] | no_license | fdtomn/app-fireflow | 1658fa6951dadae8a5a817bfe7f45eebf49af9ef | 021cbfc09dca00fa8a74b6e9d4fc5be7c7e93bbc | refs/heads/master | 2020-05-27T07:46:16.223836 | 2015-02-12T08:57:16 | 2015-02-12T08:57:16 | 30,693,529 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,003 | java | package org.fireflow.model.resource;
/**
* 表单。
* @author app
*
*/
public class Form extends AbstractResource {
/**
* 表单的地址。工作流引擎不处理该url,所以其格式只要业务系统能够解析即可。
*/
private String uri = null;
private String editFields = null;
private String hiddenFields = null;
private String operateButtons = null;
public String getOperateButtons() {
return operateButtons;
}
public void setOperateButtons(String operateButtons) {
this.operateButtons = operateButtons;
}
public String getEditFields() {
return editFields;
}
public void setEditFields(String editFields) {
this.editFields = editFields;
}
public String getHiddenFields() {
return hiddenFields;
}
public void setHiddenFields(String hiddenFields) {
this.hiddenFields = hiddenFields;
}
public Form(String name){
this.setName(name);
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
}
| [
"[email protected]"
] | |
45acfffecbfc2761a1576463cae787db5e66c0f7 | 4667d4766d05f25a5e3b146778cb7d46552fbda1 | /opjj/DZ12/src/hr/fer/zemris/java/tecaj_14/model/BlogUser.java | 694257ccf95d5ceef55b35523b9ac81b46b083eb | [
"MIT"
] | permissive | bobocop/fer | 332c9c8df84aba6417ab391f29f246ef1ff91f3d | 5d5d61d26f93db3c34e41e496f925f80ae259324 | refs/heads/master | 2020-05-26T19:21:59.000062 | 2015-06-10T18:45:22 | 2015-06-10T18:45:22 | 25,313,162 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,280 | java | package hr.fer.zemris.java.tecaj_14.model;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
/**
* Models a blog user. The application requires new users to atleast
* supply a unique nickname and password.
* @author karlo
*
*/
@Entity
@Table(name="blog_users")
public class BlogUser {
private long id;
private String firstName;
private String lastName;
private String nick;
private String email;
private String passwordHash;
private List<BlogEntry> blogEntries = new ArrayList<>();
public BlogUser() {}
@Id
@GeneratedValue
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@Column(length=32)
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@Column(length=64)
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
@Column(length=32, unique=true, nullable=false)
public String getNick() {
return nick;
}
public void setNick(String nick) {
this.nick = nick;
}
@Column(length=100, nullable=false)
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Column(nullable=false)
public String getPasswordHash() {
return passwordHash;
}
public void setPasswordHash(String passwordHash) {
this.passwordHash = passwordHash;
}
@OneToMany(mappedBy="creator", fetch=FetchType.LAZY, cascade=CascadeType.PERSIST, orphanRemoval=true)
public List<BlogEntry> getBlogEntries() {
return blogEntries;
}
public void setBlogEntries(List<BlogEntry> blogEntries) {
this.blogEntries = blogEntries;
}
@Override
public int hashCode() {
return Long.valueOf(id).hashCode();
}
@Override
public boolean equals(Object obj) {
if(this == obj) {
return true;
}
if(!(obj instanceof BlogUser)) {
return false;
}
BlogUser other = (BlogUser) obj;
return other.getId() == this.id;
}
}
| [
"[email protected]"
] | |
0796e566a8106fee4512469f26471186b7dc5e73 | d45afe2cd367811ec56643391a2aba747d42f87c | /GraphicComponent_GCPanel/settingPanel/ShapeSettingGCPanel.java | 3250dd7270dbfbcfdc5845d52b8270ebe4310677 | [] | no_license | JungSangHyeon/2019-Einstein-Desk | 321ed7a9de8321ddaf37c198cf8e762ea560d51b | 612f99e23d5bcd44dddce605f15a0cd357406de2 | refs/heads/master | 2022-12-01T17:48:12.832312 | 2020-07-06T04:15:39 | 2020-07-06T04:15:39 | 275,730,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,425 | java | package settingPanel;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import fPaint.FShadow;
import zStuff_GCPanel.NullPeekabooPanel;
import zStuff_GCPanel_ShapeSetting.CMCShapeSelectGCPanel;
import zStuff_GCPanel_ShapeSetting.PDRShapeSelectGCPanel;
public class ShapeSettingGCPanel extends NullPeekabooPanel{
private static final long serialVersionUID = -4033921725411864658L;
public ShapeSettingGCPanel() {
this.setBounds(1493, 50, 322, 215 + 52);
this.setPanelBackgroundColor(new Color(242,242,242));
this.setPanelBorderColor(new Color(204,204,204));
this.setborderThick(1);
PDRShapeSelectGCPanel pdrShapeSelectPanel = new PDRShapeSelectGCPanel();
pdrShapeSelectPanel.setGCLocation(this.getX() + 5, this.getY() + 40);
pdrShapeSelectPanel.addItems();
this.add(pdrShapeSelectPanel);
CMCShapeSelectGCPanel cmcShapeSelectPanel = new CMCShapeSelectGCPanel();
cmcShapeSelectPanel.setGCLocation(this.getX() + 5, this.getY() + 142 + 52);
cmcShapeSelectPanel.addItems();
this.add(cmcShapeSelectPanel);
this.addFunction(new FShadow());
}
@Override
public void paint(Graphics2D g2d) {
super.paint(g2d);
g2d.setColor(Color.BLACK);
g2d.setFont(new Font(null, Font.PLAIN, 16));
g2d.drawString("PDR Shape", this.getX()+10, this.getY()+25);
g2d.drawString("CMC Shape", this.getX()+10, this.getY()+127+52);
}
}
| [
"[email protected]"
] | |
90a913ce2e5a95bee8a3660508e568e822370133 | 8274b4976faa4e27fab2a880a605c90504b77127 | /yanbin/src/main/java/com/diabin/fastec/yanbin/generators/AppRegister.java | fb0851d54c321b1a85678f700f1b051ee9ac2b77 | [] | no_license | yb7553/android_ec | d885efc0ab510eb507fe7860b4c157ab2094b0f1 | 0addaeaa9d5510ac242e3d336237b266e6f77d17 | refs/heads/master | 2020-03-20T10:15:04.547070 | 2018-07-29T13:15:04 | 2018-07-29T13:15:04 | 137,364,013 | 1 | 1 | null | 2018-07-29T13:15:05 | 2018-06-14T13:46:53 | Java | UTF-8 | Java | false | false | 388 | java | package com.diabin.fastec.yanbin.generators;
import com.flj.latte.annotations.AppRegisterGenerator;
import com.flj.latte.wechat.templates.AppRegisterTemplate;
/**
* Created by yb on 2017/4/22
*/
@SuppressWarnings("unused")
@AppRegisterGenerator(
packageName = "com.diabin.fastec.yanbin",
registerTemplate = AppRegisterTemplate.class
)
public interface AppRegister {
}
| [
"[email protected]"
] | |
8606ac6fddf3811ab573ed198d17ab7f0f14f75d | 5b1e032a855513e8586ff69ed8b595bfc91db21c | /app/src/main/java/ml/parbel817/a1512501618/FirebaseMessagingService.java | 8d8cdffb69e26711a94dfbfc0949ceb0fdcf30fd | [] | no_license | adityaikhbalm/ParbelChat | da1959a01711baec503ebbd47ddaa570c27cd678 | d65439a32d655938cf08099db6dee6847c1dc69b | refs/heads/master | 2020-07-20T16:07:30.580493 | 2020-01-30T10:23:12 | 2020-01-30T10:23:12 | 206,674,833 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,567 | java | package ml.parbel817.a1512501618;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.messaging.RemoteMessage;
/**
* Created by ipin on 11/27/2017.
*/
public class FirebaseMessagingService extends com.google.firebase.messaging.FirebaseMessagingService {
private DatabaseReference mRootRef;
private String online="false";
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
mRootRef = FirebaseDatabase.getInstance().getReference();
String notification_title = remoteMessage.getNotification().getTitle();
String notification_message = remoteMessage.getNotification().getBody();
String click_action = remoteMessage.getNotification().getClickAction();
String from_user_id = remoteMessage.getData().get("user_id");
String from_user_name = remoteMessage.getData().get("user_name");
String user_online = remoteMessage.getData().get("user_online");
String user_login = remoteMessage.getData().get("user_login");
if(!user_online.equals("true") && user_login.equals("true")){
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle(notification_title)
.setContentText(notification_message)
.setAutoCancel(true);
Intent resultIntent = new Intent(click_action);
resultIntent.putExtra("user_id", from_user_id);
resultIntent.putExtra("user_name", from_user_name);
PendingIntent resultPendingIntent =
PendingIntent.getActivity(
this,
0,
resultIntent,
PendingIntent.FLAG_UPDATE_CURRENT
);
mBuilder.setContentIntent(resultPendingIntent);
int mNotificationId = (int) System.currentTimeMillis();
NotificationManager mNotifyMgr =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mNotifyMgr.notify(mNotificationId, mBuilder.build());
}
}
}
| [
"[email protected]"
] | |
06b314bef470d0d1d5d63641bee45dbac33f9930 | ea1ea88aeee53bf0b55ae6a0248aaa3144499d14 | /src/com/company/PeopleStats.java | e19912ef1f5984c843b1211e7309b46f23bdcb5d | [] | no_license | ostek97/Test_JAVA | c8aa5b38063647c274a78ba8e1a123cf78c2a467 | 58a96f12a63170a6a5d8b3d89f189fb0cc90e793 | refs/heads/main | 2022-12-30T12:24:43.620408 | 2020-10-20T13:06:16 | 2020-10-20T13:06:16 | 305,706,983 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 840 | java | package com.company;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.stream.Collectors;
class PeopleStats {
private final List<Person> people;
public PeopleStats(Path inputFilePath) {
try {
people = Files.lines(inputFilePath)
.map(line -> line.split("\t"))
.map(chunks -> new Person(chunks[0], chunks[1]))
.collect(Collectors.toList());
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
public long count() {
return people.size();
}
public long countUniqueLastNames() {
return people.stream()
.map(Person::getLastName)
.distinct()
.count();
}
} | [
"[email protected]"
] | |
a41669e304035504ace197ac8ae1c01b207db8e7 | 477954edc6de6a478163aebeac35e93a7f8a4f19 | /src/main/java/shop/shops/CommandLineShop.java | 3154250441a19f867603a426ccc0372af1b6d608 | [] | no_license | iryna707/flowers-shop | ea9c9a866aa48fd3a04758e8f7777875e5010d05 | b74a0bd1f14ec6205fd09c945db624bc246cc801 | refs/heads/master | 2023-04-12T01:37:35.458444 | 2021-04-30T13:57:07 | 2021-04-30T13:57:07 | 354,779,850 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 628 | java | package shop.shops;
import shop.filesIO.WriteFileJson;
import shop.models.bouquet.FlowersBouquet;
import shop.models.flowers.ChamomileFlower;
import shop.models.flowers.RoseFlower;
public class CommandLineShop {
public static void main(String[] args) throws Exception{
FlowersBouquet f = new FlowersBouquet();
f.addFlower(new RoseFlower(2, "red", "Rose", 2));
f.addFlower(new ChamomileFlower(2, "black", "Chamomile", 3));
String s = f.constructBouquet();
System.out.println(s);
WriteFileJson reads = new WriteFileJson();
reads.storeFlowers(f.getFlowers());
}
}
| [
"[email protected]"
] | |
c4b73a97ea3d1c7816d332d3e64da2fdab6fb5aa | f8b04daa0dabe6fc3a82dd64e392807f9e72503c | /src/main/java/com/eric/thinking/java/typeinfo/Person.java | f37b8bdd0b9879c2b4f0033e3f9bbfa3d189908d | [] | no_license | gangyou/garbage | 269a9dacc6fc564ad37d337374882f8602db9c63 | de60e1a2a538bdcbe943a6f35429db5542ba4469 | refs/heads/master | 2020-04-27T01:01:33.020034 | 2013-11-01T08:37:57 | 2013-11-01T08:37:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 643 | java | package com.eric.thinking.java.typeinfo;
public class Person {
public final String first;
public final String last;
public final String address;
public Person(String first, String last, String address) {
this.first = first;
this.last = last;
this.address = address;
}
public String toString() {
return "Person: " + first + " " + last + " " + address;
}
public static class NullPerson extends Person implements Null {
public NullPerson() {
super("", "", "");
}
@Override
public String toString() {
return "Null Person";
}
}
public static final NullPerson NULL = new NullPerson();
}
interface Null {
} | [
"[email protected]"
] | |
887fb317281d3e5e1ecd46bb62d99185a721b61d | 75ebcc622fe2bd4fb57fa784f191823c76116e72 | /Coupon_System_2.0/src/main/java/com/jb/Coupon_System_20/data/entity/Customer.java | 609f304902fd470b1f60bf418679826cd52aa0f2 | [] | no_license | dmitry-averbukh/Coupon_System | de32811032ed6ed2a0295998b03b7dee9560deb6 | 9674f84df8d2ffc10e46d5609a99196a9261c1e1 | refs/heads/master | 2021-05-17T15:30:25.942866 | 2020-09-05T18:50:02 | 2020-09-05T18:50:02 | 250,846,043 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,340 | java | package com.jb.Coupon_System_20.data.entity;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.persistence.*;
import java.util.List;
@Entity
public class Customer {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private String name;
private String email;
private String password;
@ManyToMany
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
@JoinTable(name = "customer_coupon",joinColumns = @JoinColumn(name = "customer_id"),
inverseJoinColumns = @JoinColumn(name = "coupon_id"))
private List<Coupon> coupons;
public Customer() {
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public List<Coupon> getCoupons() {
return coupons;
}
public void setCoupons(List<Coupon> coupons) {
this.coupons = coupons;
}
}
| [
"[email protected]"
] | |
98da07ac4c803d16d980fba505693892229d54e6 | bc21c5b31f1a49e4cd98e97b5ff0716def97765b | /src/com/server2/content/misc/ExpLocking.java | 0fe6c27d51129633cdca1b42b3cadf89f464fc9f | [] | no_license | NyteRS/Server | 49b3ea74c30ac4cc6c00d2b5b5cb05499c5e1277 | a90d727e97c735b6b0202c8fdffa3732a9bdeb44 | refs/heads/master | 2021-09-20T18:13:52.144899 | 2018-08-13T16:31:10 | 2018-08-13T16:31:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 810 | java | package com.server2.content.misc;
import com.server2.model.entity.player.Player;
/**
*
* @author Rene Roosen
*
*/
public class ExpLocking {
/**
* A stringArray that Contains the different lock states
*/
private static String[] lockStates = { "Unlocked", "Locked" };
/**
* Locks/Unlocks the users experience.
*/
public static void lockExperience(Player client) {
if (client.expLocked == 0)
client.expLocked = 1;
else
client.expLocked = 0;
if (client.expLocked == 0)
client.getActionSender()
.sendMessage(
"Your experience is now : @dre@" + lockStates[0]
+ "@bla@.");
else
client.getActionSender()
.sendMessage(
"Your experience is now : @dre@" + lockStates[1]
+ "@bla@.");
client.getActionSender().sendWindowsRemoval();
}
}
| [
"[email protected]"
] | |
d7f45e2b75c14360b807c3fd7549f212ffd1e780 | 0b055b4457d606a69c7337e636c809913d4f2fa0 | /website-base/src/main/java/com/goujia/website/base/dao/message/InnerMessageMapper.java | ae5c6bdfe195ca5a7a685534ee3cf66ca971d6c0 | [] | no_license | xiaobiao123/website | 46e3ce0b981803de60ca46f10ec3313b5b42d976 | 7767337f063bb7e4185d8b46a87a5f8a4e9b95fc | refs/heads/master | 2021-01-18T10:44:18.638436 | 2016-05-20T04:50:11 | 2016-05-20T04:50:11 | 59,265,573 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 489 | java | package com.goujia.website.base.dao.message;
import com.goujia.website.base.entity.message.InnerMessage;
public interface InnerMessageMapper {
int deleteByPrimaryKey(Integer id);
int insert(InnerMessage record);
int insertSelective(InnerMessage record);
InnerMessage selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(InnerMessage record);
int updateByPrimaryKeyWithBLOBs(InnerMessage record);
int updateByPrimaryKey(InnerMessage record);
} | [
"[email protected]"
] | |
7614a352057f6da53a3274882c2c3c73ab20ab83 | 21efae31fc094c9b6a999909070d8ba0c90390b9 | /src/test/java/troyan/dao/ChatDaoPostgresTest.java | c5bd6ca1b7d556f69d4aaf842cc7eeb16c37449e | [] | no_license | antonTroyan/ChatApp | b75153bbe75b465cc70a2d1191c9d028d4bb7c28 | 9ea658892cd6a39ef0dc2d72bed1776e7dc43e51 | refs/heads/master | 2020-03-30T23:45:59.408507 | 2018-10-05T11:45:25 | 2018-10-05T11:45:25 | 151,712,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,643 | java | package troyan.dao;
import by.troyan.config.test.TestJDBC;
import by.troyan.dao.ChatDao;
import by.troyan.entity.Message;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase;
import javax.sql.DataSource;
import java.time.LocalDateTime;
public class ChatDaoPostgresTest {
private ChatDao chatDao;
private EmbeddedDatabase db;
private Message message;
@Before
public void setUp() throws Exception {
AnnotationConfigApplicationContext applicationContext
= new AnnotationConfigApplicationContext(TestJDBC.class);
db = (EmbeddedDatabase) applicationContext.getBean(DataSource.class);
chatDao = applicationContext.getBean(ChatDao.class);
message = Message.builder()
.date(LocalDateTime.now())
.sender("Anton")
.content("Hello world")
.build();
chatDao.saveMessageInDB(message);
}
@After
public void tearDown() throws Exception {
db.shutdown();
}
@Test
public void saveMessageInDB() {
Assert.assertTrue(chatDao.saveMessageInDB(message));
}
@Test
public void getListOfLastMessagesEmptyCheck() {
Assert.assertFalse(chatDao.getListOfLastMessages(10).isEmpty());
}
@Test
public void getListOfLastMessagesMessageCheck() {
message.setId(1L);
Assert.assertEquals(message ,chatDao.getListOfLastMessages(10).get(0));
}
} | [
"[email protected]"
] | |
f57b892de47d04d7e8d9e13d35b30bd642fc405e | fda629d19bdafefe57506c93185c093250d204ad | /app/src/main/java/jp/co/shiratsuki/walkietalkie/broadcast/VolumeChangeObserver.java | 8432428461453935edb09637e25df5c27955c922 | [] | no_license | lwgboy/WalkieTalkie | 4e97e88a18869961d09a308e66daaaf939ee0287 | 05c71f524e0e4b09048151c2b19990b1a6704c1a | refs/heads/master | 2022-01-05T07:21:14.580705 | 2019-03-18T09:35:39 | 2019-03-18T09:35:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,864 | java | package jp.co.shiratsuki.walkietalkie.broadcast;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.media.AudioManager;
import java.lang.ref.WeakReference;
/**
* 系统媒体音量变化观察者
* Created at 2019/1/29 11:27
*
* @author Li Yuliang
* @version 1.0
*/
public class VolumeChangeObserver {
private static final String VOLUME_CHANGED_ACTION = "android.media.VOLUME_CHANGED_ACTION";
private static final String EXTRA_VOLUME_STREAM_TYPE = "android.media.EXTRA_VOLUME_STREAM_TYPE";
public interface VolumeChangeListener {
/**
* 系统媒体音量变化 * @param volume
*/
void onVolumeChanged(int volume);
}
private VolumeChangeListener mVolumeChangeListener;
private VolumeBroadcastReceiver mVolumeBroadcastReceiver;
private Context mContext;
private AudioManager mAudioManager;
private boolean mRegistered = false;
public VolumeChangeObserver(Context context) {
mContext = context;
mAudioManager = (AudioManager) context.getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
}
/**
* 获取当前媒体音量
*
* @return
*/
public int getCurrentMusicVolume() {
return mAudioManager != null ? mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC) : -1;
}
/**
* 获取系统最大媒体音量
*
* @return
*/
public int getMaxMusicVolume() {
return mAudioManager != null ? mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC) : 15;
}
public VolumeChangeListener getVolumeChangeListener() {
return mVolumeChangeListener;
}
public void setVolumeChangeListener(VolumeChangeListener volumeChangeListener) {
this.mVolumeChangeListener = volumeChangeListener;
}
/**
* 注册音量广播接收器
*
* @return
*/
public void registerReceiver() {
mVolumeBroadcastReceiver = new VolumeBroadcastReceiver(this);
IntentFilter filter = new IntentFilter();
filter.addAction(VOLUME_CHANGED_ACTION);
mContext.registerReceiver(mVolumeBroadcastReceiver, filter);
mRegistered = true;
}
/**
* 解注册音量广播监听器,需要与 registerReceiver 成对使用
*/
public void unregisterReceiver() {
if (mRegistered) {
try {
mContext.unregisterReceiver(mVolumeBroadcastReceiver);
mVolumeChangeListener = null;
mRegistered = false;
} catch (Exception e) {
e.printStackTrace();
}
}
}
private static class VolumeBroadcastReceiver extends BroadcastReceiver {
private WeakReference<VolumeChangeObserver> mObserverWeakReference;
public VolumeBroadcastReceiver(VolumeChangeObserver volumeChangeObserver) {
mObserverWeakReference = new WeakReference<>(volumeChangeObserver);
}
@Override
public void onReceive(Context context, Intent intent) {
//媒体音量改变才通知
if (VOLUME_CHANGED_ACTION.equals(intent.getAction()) && (intent.getIntExtra(EXTRA_VOLUME_STREAM_TYPE, -1) == AudioManager.STREAM_MUSIC)) {
VolumeChangeObserver observer = mObserverWeakReference.get();
if (observer != null) {
VolumeChangeListener listener = observer.getVolumeChangeListener();
if (listener != null) {
int volume = observer.getCurrentMusicVolume();
if (volume >= 0) {
listener.onVolumeChanged(volume);
}
}
}
}
}
}
}
| [
"[email protected]"
] | |
39ab0fce3cf1cb4b2a87c64dd6beae345611f2a9 | ba00a9202d33ff701f7c5dcf21f8aa155ce20c39 | /src/fresh/ui/FrmOrder_Goods_ADD.java | b34274a64b115540587deaa1de1bac14dc0a465e | [] | no_license | happily4399/SUPER_FRESH | f097f8cccbd7dbf75a9345057427785826897455 | ae65c1b5629062f47afee10ac41faf93562ba7ff | refs/heads/master | 2022-11-15T16:58:06.359514 | 2020-07-13T14:38:18 | 2020-07-13T14:38:18 | 276,839,713 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 3,058 | java | package fresh.ui;
import java.awt.BorderLayout;
import java.awt.Button;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import fresh.control.Goods_orderManager;
import fresh.control.Order_detailManager;
import fresh.model.BeanOrder_detail;
public class FrmOrder_Goods_ADD extends JDialog implements ActionListener {
private JPanel toolBar = new JPanel();
private JPanel workPane = new JPanel();
private Button btnOk = new Button("确定");
private Button btnCancel = new Button("取消");
private JLabel labelOrder = new JLabel("订单编号:");
private JLabel labelDis = new JLabel("满折编号:");
private JLabel labelcount = new JLabel("商品数量:");
private JTextField edtOrder = new JTextField(20);
private JTextField edtDis = new JTextField(20);
private JTextField edtcount = new JTextField(20);
private int Goods_num = 0;
FrmOrder_Goods_ADD(Frame f,String s,boolean b,int Goods_num){
super(f,s,b);
this.Goods_num=Goods_num;
toolBar.setLayout(new FlowLayout(FlowLayout.RIGHT));
toolBar.add(btnOk);
toolBar.add(btnCancel);
edtDis=new JTextField(String.valueOf(0),20);
edtcount=new JTextField(String.valueOf(0),20);
this.getContentPane().add(toolBar, BorderLayout.SOUTH);
workPane.add(labelOrder);
workPane.add(edtOrder);
workPane.add(labelDis);
workPane.add(edtDis);
workPane.add(labelcount);
workPane.add(edtcount);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
int width = 300;
int height = 230;
this.setBounds((d.width - width)/2, (d.height-height)/2, width, height);
this.getContentPane().add(workPane, BorderLayout.CENTER);
this.setSize(300, 230);
this.btnCancel.addActionListener(this);
this.btnOk.addActionListener(this);
this.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO 自动生成的方法存根
if(e.getSource()==this.btnCancel) {
this.setVisible(false);
}
else if(e.getSource()==this.btnOk) {
Order_detailManager odm = new Order_detailManager();
int Order = Integer.parseInt(this.edtOrder.getText());
int dis = Integer.parseInt(this.edtDis.getText());
int count = Integer.parseInt(this.edtcount.getText());
try {
Order_detailManager od = new Order_detailManager();
odm.Add(Order, dis, Goods_num, count);
BeanOrder_detail bod = od.loadonce(Order, Goods_num);
Goods_orderManager gom = new Goods_orderManager();
if(!"购物车中".equals(gom.LoadbyOrder_num(Order).getOrder_state())) throw new Exception("订单不在购物车中");
gom.reload_price(Order, gom.LoadbyOrder_num(Order).getCoupon_num());
}catch(Exception e1) {
JOptionPane.showMessageDialog(null,e1.getMessage(), "错误",JOptionPane.ERROR_MESSAGE);
return;
}
this.setVisible(false);
}
}
}
| [
"[email protected]"
] | |
c5008abd979d89054b105fbd061c34f55d3f99f3 | 783e8f957f1e9cdda59a041692bf9662c30f533f | /app/src/main/java/com/hearing/eventbusdemo/RemoteService.java | d1b6d40f38913a533de5c3d30c19507d2b3013e4 | [] | no_license | ljd1996/IpcEventBus | f7da65e40cf10a448e4d79ae9f920d4b3443978d | 5d91d1f0475deb6849dcf2098fe98562c0fc8150 | refs/heads/master | 2022-09-18T06:27:36.519594 | 2020-06-01T02:57:23 | 2020-06-01T02:57:23 | 267,823,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,370 | java | package com.hearing.eventbusdemo;
import android.app.Service;
import android.content.ComponentName;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import androidx.annotation.Nullable;
import com.hearing.eventbusdemo.eventbus.EventWrapper;
import com.hearing.eventbusdemo.eventbus.IEventCallback;
import com.hearing.eventbusdemo.eventbus.IEventInterface;
import com.hearing.eventbusdemo.eventbus.MyEventBus;
import com.hearing.eventbusdemo.util.Utils;
import org.greenrobot.eventbus.Subscribe;
import static com.hearing.eventbusdemo.util.Debug.TAG;
/**
* @author liujiadong
* @since 2020/5/29
*/
public class RemoteService extends Service {
private IEventInterface mEventInterface;
private IEventCallback mEventCallback = new IEventCallback.Stub() {
@Override
public void notifyEvent(Bundle event) throws RemoteException {
Log.d(TAG, "RemoteService notifyEvent: " + event);
// 收到主进程的转发后,将事件转发到本进程
MyEventBus.getInstance().postSingle(MyEventBus.getInstance().unPack(event));
}
};
@Override
public void onCreate() {
super.onCreate();
MyEventBus.getInstance().register(this);
bindService(new Intent(this, LocalService.class), new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
Log.d(TAG, "RemoteService onServiceConnected");
try {
mEventInterface = IEventInterface.Stub.asInterface(service);
mEventInterface.register(mEventCallback);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onServiceDisconnected(ComponentName name) {
Log.d(TAG, "RemoteService onServiceConnected");
try {
mEventInterface.unregister(mEventCallback);
} catch (Exception e) {
e.printStackTrace();
}
}
}, BIND_AUTO_CREATE);
new Thread(new Runnable() {
@Override
public void run() {
Utils.sleep(2000);
MyEventBus.getInstance().post(100);
}
}).start();
}
// 桥梁:监听本进程发送的事件,并转发给主进程
@Subscribe
public void handle(EventWrapper wrapper) {
Log.v(TAG, "RemoteService handle: " + wrapper);
try {
mEventInterface.notify(wrapper.mBundle);
} catch (RemoteException e) {
e.printStackTrace();
}
}
// 主进程的事件订阅者
@Subscribe
public void onEvent(String event) {
Log.d(TAG, "RemoteService onEvent: " + event);
}
// 主进程的事件订阅者
@Subscribe
public void onEvent1(Integer event) {
Log.d(TAG, "RemoteService onEvent: " + event);
}
@Override
public void onDestroy() {
MyEventBus.getInstance().unregister(this);
super.onDestroy();
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
}
| [
"[email protected]"
] | |
4fa461db1116895302e8f9f12c73734ed2904d20 | 697d4bce10894ad57391672719fde29b8108f767 | /StS-ShapeshifterMod-master/ShapeshifterMod/src/main/java/StSShapeShifter/stances/FoxFormStance.java | ad19d24cdc1fa2fece2d60dab6e76bc3c5f0ce7e | [
"MIT"
] | permissive | austingregory-git/StS-ShapeshifterMod | 2d6ed8b42f80e29307add7242ed7c6025fefa2d5 | 216baa85ba429593e34fe50d85e9ca8051650ce7 | refs/heads/master | 2023-03-07T19:55:45.157666 | 2021-02-24T10:18:02 | 2021-02-24T10:18:02 | 305,566,434 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,820 | java | package StSShapeShifter.stances;
import StSShapeShifter.ShapeshifterMod;
import StSShapeShifter.cards.Tortoise_Form;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.math.MathUtils;
import com.megacrit.cardcrawl.actions.common.ApplyPowerAction;
import com.megacrit.cardcrawl.actions.common.GainEnergyAction;
import com.megacrit.cardcrawl.actions.common.RemoveSpecificPowerAction;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.AbstractCreature;
import com.megacrit.cardcrawl.core.CardCrawlGame;
import com.megacrit.cardcrawl.core.Settings;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.localization.CardStrings;
import com.megacrit.cardcrawl.localization.StanceStrings;
import com.megacrit.cardcrawl.powers.DexterityPower;
import com.megacrit.cardcrawl.stances.AbstractStance;
import com.megacrit.cardcrawl.vfx.BorderFlashEffect;
import com.megacrit.cardcrawl.vfx.stance.CalmParticleEffect;
import com.megacrit.cardcrawl.vfx.stance.StanceAuraEffect;
public class FoxFormStance extends AbstractStance {
public static final String STANCE_ID = "FoxFormStance";
public static final String NAME = "Fox Form Stance";
private static final StanceStrings stanceString;
private static long sfxId;
private final AbstractPlayer owner;
public FoxFormStance() {
this.ID = STANCE_ID;
this.name = STANCE_ID;
//this.name = null;
this.updateDescription();
this.owner = AbstractDungeon.player;
}
public void updateDescription() {
//this.description = stanceString.DESCRIPTION[0];
this.description = "Bear Form Stance";
}
/*public void onEnterStance() {
AbstractDungeon.actionManager.addToBottom(new ApplyPowerAction(owner, owner,
new DexterityPower(owner, amount), amount));
}*/
public void updateAnimation() {
/*if (!Settings.DISABLE_EFFECTS) {
this.particleTimer -= Gdx.graphics.getDeltaTime();
if (this.particleTimer < 0.0F) {
this.particleTimer = 0.04F;
AbstractDungeon.effectsQueue.add(new CalmParticleEffect());
}
}
this.particleTimer2 -= Gdx.graphics.getDeltaTime();
if (this.particleTimer2 < 0.0F) {
this.particleTimer2 = MathUtils.random(0.45F, 0.55F);
AbstractDungeon.effectsQueue.add(new StanceAuraEffect("Calm"));
}*/
}
public void onExitStance() {
AbstractDungeon.actionManager.addToBottom(new RemoveSpecificPowerAction(owner, owner, ShapeshifterMod.makeID("FoxFormPower")));
}
static {
stanceString = CardCrawlGame.languagePack.getStanceString("FoxFormStance");
sfxId = -1L;
}
}
| [
"[email protected]"
] | |
3355230b0d6f46e39ee52b28e15f1fd7048b9bb9 | 7e445fa9c60830feeffe361d3bd3603c1e564ea4 | /SpringBootKafkaElasticSearch/src/main/java/com/demo/elastic/ElasticProducer.java | c31363d1fc99c74132c1df6c8086085c92215774 | [] | no_license | kgupta12345/KAFKA | 08657b1ffe3836b5a40a7bd25c433555035ac1b8 | c09ea07fe70979439640a09e3a8074ae1695686e | refs/heads/master | 2021-07-14T10:10:03.066572 | 2019-11-22T08:59:33 | 2019-11-22T08:59:33 | 211,359,509 | 0 | 1 | null | 2020-10-13T16:46:38 | 2019-09-27T16:24:22 | Java | UTF-8 | Java | false | false | 773 | java | package com.demo.elastic;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import org.springframework.stereotype.Service;
@Service
public class ElasticProducer {
public String sendMessage(String topic, String title, String category, String operationPath) {
Client client = Client.create();
String elasticserverURL="http://localhost:9200";
WebResource webResource = client.resource(elasticserverURL + operationPath);
String input = "{\"topic\":\"" + topic + "\",\"title\":\""+ title + "\",\"category\":\"" + category + "\"}";
ClientResponse response = webResource.type("application/json").post(ClientResponse.class, input);
return response.getEntity(String.class);
}
} | [
"[email protected]"
] | |
221e033269ac6fa3ae4871524dcc402a3573b91f | 73b43f5b0de7a0baa5fcfc2584988a46c2250e8f | /src/tui/Tui.java | cf7531ea66c02f3ea981998799356274324bae73 | [] | no_license | oestergaardnicolai/snake_server | 4c2a0b9248c9cd8a41b54cf91c4dff4d3d817212 | 302c2eb696f1b562c9356557e0da5d5700d0d2bb | refs/heads/master | 2021-01-10T05:48:47.095599 | 2015-12-11T05:16:52 | 2015-12-11T05:16:52 | 47,702,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,863 | java | package tui;
import controller.Logic;
import controller.Security;
import database.DatabaseWrapper;
import model.Game;
import model.User;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
public class Tui {
private static Scanner input = new Scanner(System.in);
private static boolean adminIsAuthenticated = false;
public static void serverMenu(){
boolean serverRunning = true;
while (serverRunning) {
Tui.miscOut("\n***Welcome to the Snake server***\n");
Tui.miscOut("What do you want to do?");
Tui.miscOut("1) Login as admin");
Tui.miscOut("2) Stop server");
switch (input.nextInt()) {
case 1:
login();
break;
case 2:
serverRunning = false;
break;
default:
Tui.miscOut("Unassigned key.");
}
}
}
public static void login() {
miscOut("Please log in.");
HashMap <String, Integer> hashMap = Logic.authenticateUser(enterUsername(), Security.hashing(enterPassword()));
if (hashMap.get("usertype") == 1) {
hashMap.put("code", 0);
}
int code = hashMap.get("code");
if (code == 0)
miscOut("User does not exist.");
else if (code == 1) {
miscOut("Wrong password.");
} else if (code == 2) {
miscOut("Success.");
adminIsAuthenticated = true;
userMenu();
}
}
public static void userMenu() {
while (adminIsAuthenticated) {
int menu = userMenuScreen();
switch (menu) {
case 1:
miscOut("Game List: ");
ArrayList<Game> gameList = Logic.getGames(DatabaseWrapper.ALL_GAMES, 0);
listGames(gameList);
break;
case 2:
miscOut("User List: ");
ArrayList<User> userList = Logic.getUsers();
listUsers(userList);
break;
case 3:
miscOut("Create User: ");
Logic.createUser(createUser());
break;
case 4:
miscOut("Delete User: ");
Logic.deleteUser(deleteUserScreen());
break;
case 5:
miscOut("You Logged Out.");
adminIsAuthenticated = false;
break;
default:
miscOut("Unassigned key.");
break;
}
}
}
public static int userMenuScreen() {
System.out.println("Please make a choice");
System.out.println("\n1: List all games");
System.out.println("2: List all users");
System.out.println("3: Create user");
System.out.println("4: Delete user");
System.out.println("5: Log out");
return input.nextInt();
}
public static void listUsers(ArrayList<User> userList) {
for (User user : userList) {
System.out.println("Id: " + user.getId() + "\tUser: " + user.getUsername() + "\tStatus: " + user.getStatus());
}
}
public static void listGames(ArrayList<Game> gameList) {
for (Game game : gameList) {
System.out.println("GameId: " + game.getGameId() + "\tHostId: " + game.getHost().getId() + "\tOpponentId: " + game.getOpponent().getId() + "\tWinner: " + game.getWinner().getId());
}
}
public static User createUser() {
//TODO: This should work! - DONE
User usr = new User();
usr.setFirstName(enterFirstName());
usr.setLastName(enterLastName());
usr.setEmail(enterEmail());
usr.setUsername(enterUsername());
usr.setPassword(enterPassword());
usr.setType(enterUserType());
return usr;
}
public static int deleteUserScreen() {
listUsers(Logic.getUsers());
System.out.print("Type id on the user you wish to delete: ");
return input.nextInt();
}
public static String enterUsername() {
System.out.print("Please enter username: "); // Brugeren bliver spurgt om username
String username = input.next();
return username;
}
public static String enterPassword() {
System.out.print("Please enter password: "); // Brugeren bliver spurgt om password
String password = input.next();
return password;
}
public static String enterFirstName() {
System.out.print("Please enter first name: "); // Brugeren bliver spurgt om fornavn
String firstName = input.next();
return firstName;
}
public static String enterLastName() {
System.out.print("Please enter last name: "); // Brugeren bliver spurgt om efternavn
String lastName = input.next();
return lastName;
}
public static String enterEmail() {
System.out.print("Please enter email: "); // Brugeren bliver spurgt om email
String email = input.next();
return email;
}
public static int enterUserType() {
boolean userTypeApproved = false;
System.out.print("Please enter user type (1 or 2) \n1) Admin\n2) User\n");
int userType = input.nextInt();
do {
if (userType != 1 && userType != 2)
System.out.println("Type must be either admin or user. P try again");
else{
userTypeApproved = true;
}
} while (!userTypeApproved);
return userType-1;
}
public static void miscOut(String s) {
System.out.println(s);
}
} | [
"[email protected]"
] | |
82875cb3ebaf04f62b50a9aaef9760f35c7c8502 | 95334df44b5391c085800ec7f52f469e77725990 | /algorithms/search/ConnectedCellInAGrid.java | cd6e8ac6212a90df50b59fee500de9dfdb956ebf | [] | no_license | baieric/hackerRank | e83edd3d824a80b66eb3104f24debbdddc492fff | f1de027d0f99a159141976ac9226710de0c59e22 | refs/heads/master | 2020-12-20T21:23:34.351130 | 2017-12-24T17:34:27 | 2017-12-24T17:34:27 | 42,031,469 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,873 | java | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
// Solution to https://www.hackerrank.com/challenges/connected-cell-in-a-grid
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int rows = in.nextInt();
int cols = in.nextInt();
int[][] grid = new int[rows][cols];
boolean[][] seen = new boolean[rows][cols];
for(int i = 0; i < rows; i++){
for(int j = 0; j < cols; j++){
grid[i][j] = in.nextInt();
seen[i][j] = false;
}
}
int max = 0;
for(int i = 0; i < rows; i++){
for(int j = 0; j < cols; j++){
int size = FloodFillDFS(i, j, rows, cols, grid, seen);
if(size > max){
max = size;
}
}
}
System.out.println(max);
}
public static int FloodFillDFS(int x, int y, int rows, int cols, int[][] grid, boolean[][] seen) {
if (x < 0 || x >= rows || y < 0 || y >= cols) {
return 0;
}
if (seen[x][y]) {
return 0;
}
seen[x][y] = true;
if (grid[x][y] == 0) {
return 0;
}
int sum = 1;
sum += FloodFillDFS(x + 1, y, rows, cols, grid, seen);
sum += FloodFillDFS(x - 1, y, rows, cols, grid, seen);
sum += FloodFillDFS(x, y + 1, rows, cols, grid, seen);
sum += FloodFillDFS(x, y - 1, rows, cols, grid, seen);
sum += FloodFillDFS(x- 1, y - 1, rows, cols, grid, seen);
sum += FloodFillDFS(x + 1, y + 1, rows, cols, grid, seen);
sum += FloodFillDFS(x - 1, y + 1, rows, cols, grid, seen);
sum += FloodFillDFS(x + 1, y - 1, rows, cols, grid, seen);
return sum;
}
}
| [
"[email protected]"
] | |
f4045e44709d9108c1c214dc2b4151b7fbb79aaf | d2a470d83206fa630a20e57693ab28913c0f3209 | /src/main/java/dto/PhonesDTO.java | 7f90b09b9f4089d1a742bad533881da36436f5f7 | [] | no_license | DitlevR/CA2 | db386a7c710f78bb0b908ffc6975c7cece27171d | 672cc6e669e0d76b3797387d3e17fccc1b133b75 | refs/heads/master | 2022-07-01T08:37:04.932809 | 2019-10-13T22:00:47 | 2019-10-13T22:00:47 | 212,580,648 | 0 | 0 | null | 2022-06-21T01:58:59 | 2019-10-03T12:58:18 | Java | UTF-8 | Java | false | false | 534 | 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 dto;
import entities.Phone;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author Rumle
*/
public class PhonesDTO {
private List<PhoneDTO> all = new ArrayList<>();
public PhonesDTO(List<Phone> phoneEntities) {
for(Phone p : phoneEntities) {
all.add(new PhoneDTO(p));
}
}
}
| [
"[email protected]"
] | |
5c84cc53ead048130b301ed2e85509b426ff44c6 | 51a675b5cda6a0c7d2cbea1fec3f75aeafd674c1 | /Ilham/senin 12 maret/Car.java | ffb2cd4f42fb0686a87fe66eeea6b91f2aeeaff9 | [] | no_license | ABOGABOGI/BootcampG6 | 2c2b732e0dcbbca13ba0c2c74e0de4886515205a | ab857e9e5661b9520280e0c6d23731a83823d694 | refs/heads/master | 2020-09-04T07:41:56.613904 | 2018-04-13T01:41:54 | 2018-04-13T01:41:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java |
public class Car {
double firstMiles;
double miles;
double gallons;
Car(double firstMiles) {
this.firstMiles = firstMiles;
}
void fillUp(int miles, double gallons) {
this.miles = miles;
this.gallons = gallons;
}
double calculateMPG() {
return (miles - firstMiles) / gallons;
}
boolean gasHog() {
if (calculateMPG() < 15.0) {
return true;
} else {
return false;
}
}
boolean economyCar() {
if (calculateMPG() > 30.0 ) {
return true;
} else {
return false;
}
}
void resetFirstMiles() {
firstMiles = miles;
}
}
| [
"[email protected]"
] | |
1ff9385c378cc942f811c03f0e4a97b9ab0e3831 | 261d334dc6b7e287ee66920954d333222fccdd3b | /app/src/main/java/com/nilprojects/androiduidesign/Activities/MikepenzeNav/customitems/customurl/CustomUrlPrimaryDrawerItem.java | 4d2d7a085d2f0c97f9510d1893242a7103a11442 | [] | no_license | ShahbazExpress/AndroidUiDesignApp | ded8acd86d17767456c7765ad412485694d22b7c | 2c7672acc4dbb2b170230fa19b84098a4ad33a4b | refs/heads/master | 2023-01-03T12:31:56.260501 | 2020-10-31T15:00:46 | 2020-10-31T15:00:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,358 | java | package com.nilprojects.androiduidesign.Activities.MikepenzeNav.customitems.customurl;
import android.content.Context;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.LayoutRes;
import androidx.annotation.StringRes;
import com.mikepenz.materialdrawer.holder.BadgeStyle;
import com.mikepenz.materialdrawer.holder.StringHolder;
import com.mikepenz.materialdrawer.model.interfaces.ColorfulBadgeable;
import com.nilprojects.androiduidesign.R;
import java.util.List;
public class CustomUrlPrimaryDrawerItem
extends CustomUrlBasePrimaryDrawerItem<CustomUrlPrimaryDrawerItem, CustomUrlPrimaryDrawerItem.ViewHolder>
implements ColorfulBadgeable<CustomUrlPrimaryDrawerItem> {
private StringHolder mBadge;
private BadgeStyle mBadgeStyle = new BadgeStyle();
@Override
public CustomUrlPrimaryDrawerItem withBadge(StringHolder badge) {
this.mBadge = badge;
return this;
}
@Override
public CustomUrlPrimaryDrawerItem withBadge(String badge) {
this.mBadge = new StringHolder(badge);
return this;
}
@Override
public CustomUrlPrimaryDrawerItem withBadge(@StringRes int badgeRes) {
this.mBadge = new StringHolder(badgeRes);
return this;
}
@Override
public CustomUrlPrimaryDrawerItem withBadgeStyle(BadgeStyle badgeStyle) {
this.mBadgeStyle = badgeStyle;
return this;
}
public StringHolder getBadge() {
return mBadge;
}
public BadgeStyle getBadgeStyle() {
return mBadgeStyle;
}
@Override
public int getType() {
return R.id.material_drawer_item_mini;
}
@Override
@LayoutRes
public int getLayoutRes() {
return R.layout.material_drawer_item_primary;
}
@Override
public void bindView(ViewHolder viewHolder, List payloads) {
super.bindView(viewHolder, payloads);
Context ctx = viewHolder.itemView.getContext();
//bind the basic view parts
bindViewHelper(viewHolder);
//set the text for the badge or hide
boolean badgeVisible = StringHolder.applyToOrHide(mBadge, viewHolder.badge);
//style the badge if it is visible
if (badgeVisible) {
mBadgeStyle.style(viewHolder.badge, getTextColorStateList(getColor(ctx), getSelectedTextColor(ctx)));
viewHolder.badgeContainer.setVisibility(View.VISIBLE);
}
else {
viewHolder.badgeContainer.setVisibility(View.GONE);
}
//define the typeface for our textViews
if (getTypeface() != null) {
viewHolder.badge.setTypeface(getTypeface());
}
//call the onPostBindView method to trigger post bind view actions (like the listener to modify the item if required)
onPostBindView(this, viewHolder.itemView);
}
@Override
public ViewHolder getViewHolder(View v) {
return new ViewHolder(v);
}
static class ViewHolder extends CustomBaseViewHolder {
private final View badgeContainer;
private final TextView badge;
ViewHolder(View view) {
super(view);
this.badgeContainer = view.findViewById(R.id.material_drawer_badge_container);
this.badge = (TextView) view.findViewById(R.id.material_drawer_badge);
}
}
}
| [
"[email protected]"
] | |
1672154b45db42701ee229e0bb7d1c468adf32f5 | 80fbe1071ca273256e5c61fd1dd4b5713ad3e81c | /src/Character.java | 5bc87f7fda2f67ece8c65cfce0328ad52e4ea9ab | [] | no_license | lo6169/TextGame | 0cbf8b648b6a29fa19455bce6905962a1f1d46e4 | befc77fdaf1e6779e192fff996af42d639110e3e | refs/heads/master | 2020-05-27T20:00:56.759681 | 2019-09-04T14:32:16 | 2019-09-04T14:32:16 | 188,771,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,881 | java | import java.util.Scanner;
/**
* Lindsey Olson
* WMC @ RIT
* 2019
* Version 1.0 7.2.19
*/
public class Character
{
/**
* Here are all of the parts to a character
* We have their name, which will end up being
* entered by the user.
* We have their fireSkill, woodSkill, fishingSkill,
* and buildingSkill, which will all determine how
* frequently they find goods and are able to use them.
* We have their charisma, a random number which they will
* never see but will come in handy come the day they meet
* the town. Then they have their wood, food, rawFood,
* and rock, all of which begin at 0 and are counters.
*/
String name;
int stamina;
int fireSkill;
int woodSkill;
int fishingSkill;
int miningSkill;
int buildingSkill;
int charisma;
int wood;
int food;
int rawFood;
int rock;
NPC person;
boolean wooedPerson;
public static final String ANSI_BLUE = "\u001B[34m";
/**
* The constructor for the Character,
* which will get the name and then
* randomly set the skills. It will also set
* all the counters to 0 except stamina,
* which will begin at 100.
*/
public void Character()
{
Scanner sc = new Scanner(System.in);
System.out.println(ANSI_BLUE + "Enter your name ");
this.name = sc.nextLine();
fireSkill = (int)(Math.random() * 101);
woodSkill = (int)(Math.random() * 101);
fishingSkill = (int)(Math.random() * 101);
buildingSkill = (int)(Math.random() * 101);
miningSkill = (int)(Math.random() * 101);
charisma = (int)(Math.random() * 101);
wood = 0;
food = 0;
rawFood = 0;
rock = 0;
stamina = 100;
}
/**
* This is a getter for the character's name
* @return the name
*/
public String getName()
{
return this.name;
}
/**
* This is a getter for the character's
* fire skill
* @return their fire skill
*/
public int getFireSkill()
{
return fireSkill;
}
/**
* This is a getter for the character's
* stamnia, which, if it hits low numbers,
* means bad things for the user.
* @return their stamina
*/
public int getStamina()
{
return stamina;
}
/**
* This is a setter for the character's stamina
* This will allow stamina points to be
* taken away if doing something strenuous
* or added if doing something beneficial
* @param x - the integer by which
* the stamina changes
*/
public void setStamina(int x)
{
stamina += x;
if (stamina > 100)
{
stamina = 100;
}
if (stamina <= 0)
{
System.out.println("You have died. Your game is over.");
System.exit(0);
}
}
/**
* This is a getter for the character's
* wood skill
* @return their wood skill
*/
public int getWoodSkill()
{
return woodSkill;
}
/**
* This is a getter for the character's
* fishing skill
* @return their fishing skill
*/
public int getFishingSkill()
{
return fishingSkill;
}
/**
* This is a getter for the character's
* building skill
* @return their building skill
*/
public int getBuildingSkill()
{
return buildingSkill;
}
/**
* This is a getter for the character's
* mining skill
* @return their mining skill
*/
public int getMiningSkill()
{
return miningSkill;
}
/**
* This is a getter for the character's
* charisma
* @return their charisma
*/
public int getCharisma()
{
return charisma;
}
/**
* This is the setter for
* the character's charisma
* @param i
*/
public void setCharisma(int i)
{
charisma = charisma + i;
}
/**
* This is a getter for the
* amount of wood the user has
* currently
* @return their wood count
*/
public int getWood()
{
return wood;
}
/**
* This is a setter for the
* amount of wood the user
* gains or loses
* @param i - the integer by
* which the wood count
* changes
*/
public void setWood(int i)
{
wood = wood + i;
}
/**
* This is a getter for the
* amount of food the user has
* @return their food
*/
public int getFood()
{
return food;
}
/**
* This is a getter for the
* amount of raw food the user has
* @return their raw food
*/
public int getRawFood()
{
return rawFood;
}
/**
* This is how the amount of
* food will change
* @param i the integer amount
* the food count changes by
*/
public void setFood(int i)
{
food += i;
if (food < 0)
{
System.out.println("You have no food - go cook some.");
food = 0;
}
}
/**
* This is a setter of how
* to change the raw food
* count
* @param i the integer amount
* the raw food count
* will change by
*/
public void setRawFood(int i)
{
rawFood += i;
if (rawFood < 0)
{
System.out.println("You have no fish - go gather some.");
rawFood = 0;
}
}
/**
* This is the getter for
* the amount of rock that
* the character has at
* the moment
* @return their rock count
*/
public int getRock()
{
return rock;
}
/**
* Set the user's rock
* count to increase or
* decrease by the variable i
* @param i - the integer
* amount that the
* rock count will
* change by
*/
public void setRock(int i)
{
rock = rock + i;
}
/**
* Set the boolean to see if the character
* has wooed a lover or not
* @param b - the truth value of
* whether or not a person was wooed
*/
public void setWooed(boolean b, NPC npc)
{
wooedPerson = b;
}
/**
* Check to see if a person has been wooed
* or not
* @return whether or not the character
* has wooed anyone.
*/
public boolean wooed()
{
return wooedPerson;
}
/**
* Get the character's person /
* love interest
* @return
*/
public NPC getPerson()
{
return person;
}
/**
* Set the character's person /
* love interest
* @param p
*/
public void setPerson(NPC p)
{
person = p;
}
}
| [
"[email protected]"
] | |
988098940c37690fd0a645637caa0281f084760b | 1793131f6b5b5f56f78818f064a3e1bb25dde975 | /src/test/java/com/centric/resources/Commonactions.java | 5ae222293952cb33fa804bf4e99895c990f50cb2 | [] | no_license | karthirajan/yuvraj-centric | b390f54856434346da15ce728d355dea771ff632 | 42ba228c2ee03f1a2a898a200dd8231da5e9090d | refs/heads/master | 2022-09-19T02:20:38.286483 | 2020-04-15T05:29:52 | 2020-04-15T05:29:52 | 253,981,905 | 0 | 0 | null | 2022-09-01T23:23:03 | 2020-04-08T04:06:50 | Java | UTF-8 | Java | false | false | 24,034 | java | package com.centric.resources;
import java.text.*;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.FluentWait;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.Wait;
import org.openqa.selenium.support.ui.WebDriverWait;
import com.centric.objectrepository.MaterialSpecificationPage;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class Commonactions{
public static WebDriver driver;
private static String homeWindow = null;
public WebDriver launch(String url) {
System.setProperty("webdriver.chrome.driver", ".\\driver\\chromedriver.exe");
driver=new ChromeDriver();
driver.get(url);
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
driver.manage().window().maximize();
return driver;
}
public void insertText(WebElement element, String value) {
try{
element.clear();
}catch (Exception e) {
}
element.sendKeys(value);
}
public void insertTextjs(WebElement element, String value) {
try{
element.clear();
}catch (Exception e) {
}
JavascriptExecutor js= (JavascriptExecutor)driver;
js.executeScript("arguments[0].setAttribute('value', '" + value +"')", element);
}
public void click(WebElement element) {
element.click();
}
public void eleToBeClickable() throws Throwable {
Thread.sleep(1000);
}
public void save() throws Throwable {
try{
click(driver.findElement(By.xpath("(//span[contains(@class,'Button') or text()='●']//following-sibling::span[text()='Save'])[1]")));
}catch(Exception e){
eleToBeClickable();
click(driver.findElement(By.xpath("(//span[contains(@class,'Button') or text()='●']//following-sibling::span[text()='Save'])[2]")));
eleToBeClickable();
}
}
public static void accept_Alert() {
try {
Alert alert = driver.switchTo().alert();
try{
String text = alert.getText();
System.out.println("alert tet :"+text);
}catch(Exception e){
}
alert.accept();
//Reporter.addStepLogPass("alert accepted successfully");
} catch (Exception e) {
//Reporter.addStepLogInfo("Alert is not accepted" + e.toString());
}
}
public static String screenCapture(String imgLocation) {
File scrFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
try {
FileUtils.copyFile(scrFile, new File(imgLocation));
//Reporter.addStepLogPass("Captured screen successfully");
} catch (IOException e) {
//Reporter.addStepLogInfo("Screen is not captured" + e.toString());
}
return imgLocation;
}
/**
* Method to switch to the newly opened window
*/
public static void switchToWindow() {
homeWindow = driver.getWindowHandle();
for (String window : driver.getWindowHandles()) {
driver.switchTo().window(window);
}
}
/**
* To navigate to the main window from child window
*/
public static void switchToMainWindow() {
for (String window : driver.getWindowHandles()) {
if (!window.equals(homeWindow)) {
driver.switchTo().window(window);
driver.close();
}
driver.switchTo().window(homeWindow);
}
}
/**
* This method returns the no.of windows present
*
* @return
*/
public static int getWindowCount() {
return driver.getWindowHandles().size();
}
/****************** frames *********************/
public static void frames(WebElement frameElement) {
try {
driver.switchTo().frame(frameElement);
//Reporter.addStepLogPass("successfully switched to frame");
} catch (Exception e) {
//Reporter.addStepLogInfo("failed while switching to frame");
}
}
public static void switchToDefaultcontent() {
try {
driver.switchTo().defaultContent();
} catch (NoSuchElementException e) {
}
}
public static void navigateToUrl(String url) {
try {
driver.navigate().to(url);
//Reporter.addStepLogPass("Application launched successfully to" + url);
} catch (Exception e) {
//Reporter.addStepLogInfo("Failed to load the url" + url + e.getMessage());
}
}
public static void closeBrowser() {
try {
driver.close();
//Reporter.addStepLogPass("Browser closed successfully");
} catch (Exception e) {
//Reporter.addStepLogInfo("Browser is not closed");
}
}
public static boolean isElementPresent(WebElement element) {
boolean elementPresent = false;
try {
waitForElementVisibility(element);
if (element.isDisplayed()) {
elementPresent = true;
}
//Reporter.addStepLogPass(element.toString() + "is Displayed successfully");
} catch (Exception e) {
//Reporter.addStepLogInfo("Verify Element Present failed" + e.toString());
}
return elementPresent;
}
/**
* Verifying the visibility of element only for assert conditions
*/
public static boolean isElementNotPresent(WebElement element) {
boolean elementNotPresent = true;
try {
if (element.isDisplayed()) {
elementNotPresent = false;
}
//Reporter.addStepLogPass("Element is Displayed successfully");
} catch (Exception e) {
//Reporter.addStepLogInfo("Verify Element Present failed" + e.getMessage());
}
return elementNotPresent;
}
public static String getText(WebElement element) {
String text = null;
try {
waitForElementVisibility(element);
if (element.getText() != null) {
text = element.getText();
}
//Reporter.addStepLogPass("text retrieved successfully from element" + element.toString());
} catch (Exception e) {
//Reporter.addStepLogInfo("text is not retrieved from element" + element.toString() + e.getMessage());
}
return text;
}
/**
* Method to get the value from textbox
*
* @param element
* @return
*/
public static String getValue(WebElement element) {
String value = null;
try {
waitForElementVisibility(element);
if (element.getAttribute("value") != null) {
value = element.getAttribute("value");
}
//Reporter.addStepLogPass("text retrieved successfully from element" + element.toString());
} catch (Exception e) {
//Reporter.addStepLogInfo("text is not retrieved from element" + element.toString() + e.getMessage());
}
return value;
}
/**
* Method to select the option from dropdown by value
*/
public static void selectByValue(WebElement element, String value) {
try {
Select obj_select = new Select(element);
obj_select.selectByValue(value);
//Reporter.addStepLogPass(value + "selected from dropdown " + element.toString());
} catch (Exception e) {
//Reporter.addStepLogInfo("failed to select" + value + "from " + element.toString());
}
}
/**
* Method to select the option from drop down by visible text
*/
public static void selectByText(WebElement element, String text) {
try {
Select obj_select = new Select(element);
obj_select.selectByVisibleText(text);
//Reporter.addStepLogPass(text + "selected from dropdown " + element.toString());
} catch (Exception e) {
//Reporter.addStepLogInfo("failed to select" + text + "from " + element.toString());
}
}
/**
* Method to select the option from dropdown by index
*/
public static void selectByIndex(WebElement element, int index) {
try {
Select obj_select = new Select(element);
obj_select.selectByIndex(index);
//Reporter.addStepLogPass(index + "index selected from dropdown " + element.toString());
} catch (Exception e) {
//Reporter.addStepLogInfo("failed to select" + index + "index" + "from " + element.toString());
}
}
/**
* To pause execution until get expected elements visibility
*
* @param element
*/
public static void waitForElementVisibility(WebElement element) {
WebDriverWait wait = new WebDriverWait(driver, 60);
wait.until(ExpectedConditions.visibilityOf(element));
}
public static void waitForElementClickable(WebElement element) {
WebDriverWait wait = new WebDriverWait(driver, 60);
wait.until(ExpectedConditions.elementToBeClickable(element));
}
/**
* To pause the execution @throws
*/
public static void pause(int milliSeconds) throws InterruptedException {
Thread.sleep(milliSeconds);
}
/**
* To create a connectivity to Database and update the scenario execution
* status
*/
/* public static void createDBConnection(String scName, String scStatus) {
try {
// convert current date from string to sql date data type
String currentDate = getCurrentDate();
DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
java.util.Date date = dateFormatter.parse(currentDate);
java.sql.Date sqlDate = new java.sql.Date(date.getTime());
String[] tcName = scName.split("-");
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
String url = "jdbc:ucanaccess://src\\main\\resources\\lib\\Sabre_Automation_Reports.accdb";
Connection conn = DriverManager.getConnection(url);
String qry = "INSERT INTO TestCaseStatus (TestCase_Name, TestScenario_Name, Exec_Date, Execution_Status)"
+ "VALUES (?, ?, ?, ?)";
PreparedStatement stment = conn.prepareStatement(qry);
stment.setString(1, tcName[0]);
stment.setString(2, tcName[1]);
stment.setDate(3, sqlDate);
stment.setString(4, scStatus);
stment.executeUpdate();
conn.commit();
conn.close();
} catch (Exception err) {
}
}*/
/**
* Method to get the available option from dropdown
*
* @return
*/
public static List<String> getOptionFromDropDown(WebElement element) {
List<String> AvailableOptions = new ArrayList<String>();
try {
Select obj_select = new Select(element);
List<WebElement> optionElements = obj_select.getOptions();
for (int i = 0; i < optionElements.size(); i++) {
AvailableOptions.add(optionElements.get(i).getText());
}
//Reporter.addStepLogPass("get available options from dropdown is success" + element.toString());
} catch (Exception e) {
//Reporter.addStepLogInfo(
// "get available options from dropdown is failed" + e.getMessage() + element.toString());
}
return AvailableOptions;
}
/**
* Method to perform mouseover action on required element
*
* @param element
*
*
*
*/
public void jsMouseOver() {
try {
Actions a = new Actions(driver);
Thread.sleep(100);
a.sendKeys(Keys.DOWN).build().perform();
a.sendKeys(Keys.TAB).build().perform();
} catch (Exception e) {
//Reporter.addStepLogPass("Mouseover to the element" + element.toString() + "is failed");
}
}
public void jsMouseOver(WebElement element) {
try {
String code = "var fireOnThis = arguments[0];" + "var evObj = document.createEvent('MouseEvents');"
+ "evObj.initEvent( 'mouseover', true, true );" + "fireOnThis.dispatchEvent(evObj);";
((JavascriptExecutor) driver).executeScript(code, element);
//Reporter.addStepLogPass("Mouseover to the element" + element.toString() + "is success");
} catch (Exception e) {
//Reporter.addStepLogPass("Mouseover to the element" + element.toString() + "is failed");
}
}
public static void mouseOver(WebElement element) {
try {
Actions action = new Actions(driver);
action.moveToElement(element).build().perform();
//Reporter.addStepLogPass("Mouseover to the element" + element.toString() + "is success");
} catch (Exception e) {
//Reporter.addStepLogPass("Mouseover to the element" + element.toString() + "is failed");
}
}
/**
* Method to wait for page load using javascript
* @throws Throwable
*/
public static void jsWaitForPageLoad() throws Throwable {
System.out.println("*********************in***************************");
for(int i=0; i < 500; i++){
JavascriptExecutor js = (JavascriptExecutor)driver;
if((boolean)js.executeScript("return document.readyState").toString().equals("complete")){
break;
}else{
Thread.sleep(1000);
}
}
System.out.println("*********************out***************************");
}
public static String getRandomString(int length) {
char[] chars = "abcdefghijklmnopqrstuvwxyz".toCharArray();
StringBuilder sb = new StringBuilder();
Random random = new Random();
for (int i = 0; i < length; i++) {
char c = chars[random.nextInt(chars.length)];
sb.append(c);
}
return sb.toString();
}
public static String getRandomNumber(int length) {
char[] chars = "1234567890".toCharArray();
StringBuilder sb = new StringBuilder();
Random random = new Random();
for (int i = 0; i < length; i++) {
char c = chars[random.nextInt(chars.length)];
sb.append(c);
}
return sb.toString();
}
public String dropDownSelectedValue(WebElement element) {
Select select = new Select(element);
String selectedOption = select.getFirstSelectedOption().getText();
return selectedOption;
}
public static BigDecimal truncateDecimal(double x, int numberofDecimals) {
if (x > 0) {
return new BigDecimal(String.valueOf(x)).setScale(numberofDecimals, BigDecimal.ROUND_FLOOR);
} else {
return new BigDecimal(String.valueOf(x)).setScale(numberofDecimals, BigDecimal.ROUND_CEILING);
}
}
/**
* To get default selected value from drop down
*
* @param element
* @return String
*/
public static String getDefaultDropDownValue(WebElement element) throws InterruptedException {
Select obj_select = new Select(element);
return obj_select.getFirstSelectedOption().getText();
}
/**
* To get checkbox is selected or not from list of checkboxes
*
* @param List
* <WebElement>
* @return
*/
public static boolean isCheckBoxSelectedInDropdown(List<WebElement> elements) {
boolean flag = true;
int noOfCheckBox = elements.size();
for (int i = 0; i < noOfCheckBox; i++) {
flag = elements.get(i).isSelected();
if (flag == true)
break;
}
return flag;
}
public static void clickjs(WebElement element) {
try {
JavascriptExecutor executor = (JavascriptExecutor) driver;
executor.executeScript("arguments[0].click();", element);
//Reporter.addStepLogPass(element.toString() + "element is clicked successfully");
} catch (Exception e) {
//Reporter.addStepLogInfo(element.toString() + "element is not clicked" + e.getMessage());
}
}
/**
* Method to scroll page up for element visibility using java script
*
* @author Ganesh Bharathy
* @param element
*/
public void jsScrollPageUp(WebElement element) {
try {
int yScrollPosition = element.getLocation().getY();
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("window.scrollBy(0, " + -yScrollPosition + ")", "");
//Reporter.addStepLogPass("scroll page up" + "page is scrolled up successfully");
} catch (Exception e) {
//Reporter.addStepLogInfo("page is not scrolled up ");
}
}
/**
* Method to get size of list
*
* @author Ganesh Bharathy
* @param List
* @return size of list
*/
public static int getListSize(List<WebElement> element) {
int size = 0;
try {
size = element.size();
//Reporter.addStepLogPass("size of list retrieved successfuly");
} catch (Exception e) {
//Reporter.addStepLogInfo("value is not retrieved from textbox" + e.toString());
}
return size;
}
/**
* quit Browser
*
* @author Ganesh Bharathy
*
*/
public static void quitBrowser() {
try {
driver.quit();
//Reporter.addStepLogPass("Browser quited successfully");
} catch (Exception e) {
//Reporter.addStepLogInfo("Browser is not quited");
}
}
public static void waitForAlert(WebDriver driver) throws Throwable
{
int i=0;
while(i++<200)
{
try
{
Alert alert = driver.switchTo().alert();
String text = alert.getText();
System.out.println("alert message is :"+text);
alert.accept();
break;
}
catch(NoAlertPresentException e)
{
Thread.sleep(1000);
continue;
}
}
try{
driver.navigate().refresh();
Thread.sleep(1000);
Alert alert = driver.switchTo().alert();
String text = alert.getText();
System.out.println("alert message is :"+text);
alert.accept();
}catch (Exception e) {
// TODO: handle exception
}
}
/**
* verify if list in Ascending Order
*
* @param list
* @author Ganesh Bharathy
* @return boolean
*/
public boolean checkAscendingOrder(List<String> list) {
String previous = "";// empty string
boolean flag = true;
for (String current : list) {
if (current.compareTo(previous) < 0) {
flag = false;
return flag;
}
previous = current;
}
return flag;
}
/**
* verify if list in descending Order
*
* @param list
* @author Ganesh Bharathy
* @return boolean
*/
public boolean checkDescendingOrder(List<String> list) {
String previous = list.get(0);
boolean flag = true;
for (String current : list) {
if (previous.compareTo(current) < 0) {
flag = false;
return flag;
}
previous = current;
}
return flag;
}
/**
* verify Option is available In DropDown
*
* @param Dropdown
* and option
* @author Ganesh Bharathy
* @return boolean
*/
public boolean verifyOptionIsAvailableInDropDown(WebElement dropDown, String option) {
boolean flag = false;
List<String> TaxSetupOption = getOptionFromDropDown(dropDown);
for (String string : TaxSetupOption) {
if (string.contains(option)) {
flag = true;
break;
}
}
return flag;
}
/**
* select Multiple Values From ListBox
*
* @param list
* @author Ganesh Bharathy
* @return List of selected values
*/
/**
* verify if list of integer in Descending Order
*
* @param list
* @author Ganesh Bharathy
* @return boolean
*/
public boolean checkDescendingOrderForInteger(List<Integer> list) {
int previous = list.get(0);// empty string
boolean flag = true;
for (Integer current : list) {
if (current > previous) {
flag = false;
return flag;
}
previous = current;
}
return flag;
}
/**
* verify if list of integer in Ascending Order
*
* @param list
* @author Ganesh Bharathy
* @return boolean
*/
public boolean checkAscendingOrderForInteger(List<Integer> list) {
int previous = list.get(0);// empty string
boolean flag = true;
for (Integer current : list) {
if (current < previous) {
flag = false;
return flag;
}
previous = current;
}
return flag;
}
/**
* get random special characters
*
* @param list
* @author Ganesh Bharathy
* @return boolean
*/
public static String getRandomSpecialCharacters(int length) {
char[] chars = "!#$%&'()*+|\\,-./:;<=>?@[]^_`{|}~".toCharArray();
StringBuilder sb = new StringBuilder();
Random random = new Random();
for (int i = 0; i < length; i++) {
char c = chars[random.nextInt(chars.length)];
sb.append(c);
}
return sb.toString();
}
/**
* Method to clear the text box
*
* @param WebElement
* @author Ganesh Bharathy
*/
public static void clearTextBox(WebElement element) {
waitForElementVisibility(element);
element.sendKeys(Keys.CONTROL, "a", Keys.DELETE);
}
public static void waitForElementTodisappear(By ByElement) {
WebDriverWait wait = new WebDriverWait(driver, 90);
wait.until(ExpectedConditions.invisibilityOfElementLocated(ByElement));
}
/* public static String getCurrentDateMMMDDYYYY() {
DateTimeFormatter fmt = DateTimeFormat.forPattern("MMM. dd, YYYY");
LocalDate now = LocalDate.now();
String exec_Date = now.toString(fmt);
return exec_Date;
}
*/
/**
* Modify drop down value if something is already selected
*
* @param Dropdown
* @author Ganesh Bharathy
* @return
*/
public void modifyDDValue(WebElement element) {
List<String> option = getOptionFromDropDown(element);
String DDSelectedValue = dropDownSelectedValue(element);
System.out.println("DDSelectedValue " + DDSelectedValue);
for (String text : option) {
System.out.println("option in list " + text);
if (text.isEmpty()) {
System.out.println("continue...");
continue;
} else if (!text.equals(DDSelectedValue)) {
selectByText(element, text);
break;
}
}
}
/**
* enter integer number using keypress
*
* @param String
* number
* @author Ganesh Bharathy
* @return
* @throws InterruptedException
* @throws AWTException
*/
public void enterNumberUsingkeypress(String number) throws InterruptedException, AWTException {
Robot robot = new Robot();
Map<Character, Integer> map = new HashMap<Character, Integer>();
map.put('0', KeyEvent.VK_0);
map.put('1', KeyEvent.VK_1);
map.put('2', KeyEvent.VK_2);
map.put('3', KeyEvent.VK_3);
map.put('4', KeyEvent.VK_4);
map.put('5', KeyEvent.VK_5);
map.put('6', KeyEvent.VK_6);
map.put('7', KeyEvent.VK_7);
map.put('8', KeyEvent.VK_8);
map.put('9', KeyEvent.VK_9);
int lenght = number.length();
// System.out.println("number lenght "+lenght);
char[] numberInChar = number.toCharArray();
int keyInput[] = new int[lenght];
for (int i = 0; i < numberInChar.length; i++) {
if (numberInChar != null && map != null) {
keyInput[i] = map.get(numberInChar[i]);
}
}
for (int i = 0; i < keyInput.length; i++) {
robot.keyPress(keyInput[i]);
pause(1000);
}
}
/**
* click on specific co-ordinates for a Webelement
*
* @param String
* number
* @author Ganesh Bharathy
* @return
* @throws InterruptedException
* @throws AWTException
*/
public void clickOnSpecificCoordinate(WebElement element, int x, int y) {
Actions clicker = new Actions(driver);
clicker.moveToElement(element).moveByOffset(x, y).click().perform();
}
/**
* Method to scroll page down for element visibility using java script
*
* @author Ganesh Bharathy
* @param element
* @throws Throwable
*/
public void jsScrollPageDown(WebElement element) throws Throwable {
//int yScrollPosition = element.getLocation().getY();
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].scrollIntoView(true);",element);
Thread.sleep(2000);
////Reporter.addStepLogPass("scroll page down" + "page is scrolled down successfully");
}
/**
* verify specific string is available in a list of String
*
* @author Ganesh Bharathy
* @param List
* @return flag
*/
public boolean verifyTextInList(List<String> list, String text) {
boolean flag = false;
for (String string : list) {
if (string.contains(text)) {
flag = true;
break;
}
}
return flag;
}
/**
* Method to verify a field is disabled
*
* @param WebElement
* @author Ganesh Bharathy user your xpath in this way
*/
public static boolean elementDisabled(WebElement element) {
boolean flag = false;
waitForElementVisibility(element);
String disabled = element.getAttribute("class");
if (disabled.contains("disabled")) {
flag = true;
}
return flag;
}
} | [
"[email protected]"
] | |
b40a8baa1426665160562e0986016d0c2eccbfee | f4cb6b7f33b369d4fac1cf9db2d308ebe643b266 | /translator/src/main/java/com/akruglov/translator/ui/bookmarks/view/FavoritesView.java | 3a4c14a42476336d81aa619cb756eb5443d36378 | [] | no_license | kaa-it/Translator | ae2dfac7cdec545e5ccde712893c1353dae01849 | 4ef885745616f1b4c8ca886e898a3d1b7e4acae9 | refs/heads/master | 2021-01-19T22:34:35.710706 | 2017-04-20T06:35:16 | 2017-04-20T06:35:16 | 88,829,874 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 951 | java | package com.akruglov.translator.ui.bookmarks.view;
import com.akruglov.translator.data.models.Translation;
import com.arellomobile.mvp.MvpView;
import com.arellomobile.mvp.viewstate.strategy.AddToEndSingleStrategy;
import com.arellomobile.mvp.viewstate.strategy.SingleStateStrategy;
import com.arellomobile.mvp.viewstate.strategy.SkipStrategy;
import com.arellomobile.mvp.viewstate.strategy.StateStrategyType;
import java.util.List;
/**
* Created by akruglov on 18.04.17.
*/
@StateStrategyType(AddToEndSingleStrategy.class)
public interface FavoritesView extends MvpView {
@StateStrategyType(SingleStateStrategy.class)
void showFavorites(List<Translation> favorites);
@StateStrategyType(SkipStrategy.class)
void showTranslationDetails(Translation translation);
@StateStrategyType(SkipStrategy.class)
void showClearFavoritesNotification();
@StateStrategyType(SingleStateStrategy.class)
void clearFavorites();
}
| [
"[email protected]"
] | |
2924e9fed5d9175d449f1fec21c376b4bb1032fb | 2602477b8cbd47df807d4e0ba329aa609668aaa6 | /t_rex/t-rex/src/main/java/co/merkhet/trex/constant/Gender.java | 8c2682507a9289e4c2b94dfed7947cbe4e80f922 | [] | no_license | jhonnycamargo/old-projects | 053f14780eed8efb8f7936d47e036c2baae6f812 | 2dee90ee61881c0ce7fc283a2e2a78f4e3e24abb | refs/heads/master | 2020-04-13T23:32:55.152053 | 2018-12-29T14:36:49 | 2018-12-29T14:36:49 | 163,509,511 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 173 | java | package co.merkhet.trex.constant;
import com.fasterxml.jackson.annotation.JsonFormat;
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum Gender {
MALE, FEMALE;
}
| [
"[email protected]"
] | |
66b55bca8533219e04e50ce1e17269ff1949fe9f | 0617a2dc8e4932e1970904afbe2f19fc41c87d84 | /ThemeBreaker/gen/com/sregnard/themebreaker/R.java | ad31b0be37fd227e54cadefbc4f84687b9cf3296 | [] | no_license | sregnard42/themebreaker | f44e5271d85be8a02edca2517df6c2229b718d9d | fb9a894e4a930feb124490284be464b12f5e344c | refs/heads/master | 2020-08-23T06:51:55.600216 | 2019-10-21T13:57:18 | 2019-10-21T13:57:18 | 216,564,324 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,645 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.sregnard.themebreaker;
public final class R {
public static final class anim {
public static final int push_down_in=0x7f040000;
public static final int push_down_out=0x7f040001;
public static final int push_up_in=0x7f040002;
public static final int push_up_out=0x7f040003;
public static final int slide_in_left=0x7f040004;
public static final int slide_in_right=0x7f040005;
public static final int slide_out_left=0x7f040006;
public static final int slide_out_right=0x7f040007;
}
public static final class attr {
}
public static final class drawable {
public static final int background=0x7f020000;
public static final int bank_background=0x7f020001;
public static final int bank_ball=0x7f020002;
public static final int bank_brick_cash=0x7f020003;
public static final int bank_brick_ingot=0x7f020004;
public static final int bank_paddle=0x7f020005;
public static final int cinema_background=0x7f020006;
public static final int cinema_ball=0x7f020007;
public static final int cinema_brick=0x7f020008;
public static final int cinema_brick_2=0x7f020009;
public static final int cinema_brick_3=0x7f02000a;
public static final int cinema_paddle=0x7f02000b;
public static final int ic_heart=0x7f02000c;
public static final int ic_launcher=0x7f02000d;
public static final int ic_podium=0x7f02000e;
public static final int mario_background=0x7f02000f;
public static final int mario_ball=0x7f020010;
public static final int mario_brick=0x7f020011;
public static final int mario_brick_2=0x7f020012;
public static final int mario_paddle=0x7f020013;
public static final int neon_background=0x7f020014;
public static final int neon_ball=0x7f020015;
public static final int neon_brick_blue_1=0x7f020016;
public static final int neon_brick_blue_2=0x7f020017;
public static final int neon_brick_blue_4=0x7f020018;
public static final int neon_brick_green_1=0x7f020019;
public static final int neon_brick_green_2=0x7f02001a;
public static final int neon_brick_green_4=0x7f02001b;
public static final int neon_brick_purple_1=0x7f02001c;
public static final int neon_brick_purple_2=0x7f02001d;
public static final int neon_brick_purple_4=0x7f02001e;
public static final int neon_brick_red_1=0x7f02001f;
public static final int neon_brick_red_2=0x7f020020;
public static final int neon_brick_red_4=0x7f020021;
public static final int neon_brick_yellow_1=0x7f020022;
public static final int neon_brick_yellow_2=0x7f020023;
public static final int neon_brick_yellow_4=0x7f020024;
public static final int neon_paddle=0x7f020025;
public static final int pokemon_background=0x7f020026;
public static final int pokemon_ball=0x7f020027;
public static final int pokemon_brick_excelangue=0x7f020028;
public static final int pokemon_brick_magicarpe=0x7f020029;
public static final int pokemon_brick_pikachu=0x7f02002a;
public static final int pokemon_brick_qulbutoke=0x7f02002b;
public static final int pokemon_brick_ramoloss=0x7f02002c;
public static final int pokemon_brick_ronflex=0x7f02002d;
public static final int pokemon_paddle=0x7f02002e;
public static final int shape_rounded=0x7f02002f;
public static final int sw_background=0x7f020030;
public static final int sw_ball=0x7f020031;
public static final int sw_brick_csi_combat=0x7f020032;
public static final int sw_brick_csi_droideka=0x7f020033;
public static final int sw_brick_csi_super=0x7f020034;
public static final int sw_brick_droid_c3po=0x7f020035;
public static final int sw_brick_droid_r2d2=0x7f020036;
public static final int sw_brick_imperial_scout=0x7f020037;
public static final int sw_brick_imperial_stormtrooper=0x7f020038;
public static final int sw_paddle=0x7f020039;
}
public static final class id {
public static final int CheckBox01=0x7f080015;
public static final int TextView01=0x7f080014;
public static final int btnMusique=0x7f080005;
public static final int btnOptions=0x7f080004;
public static final int btnPause=0x7f080009;
public static final int btnPlay=0x7f08000a;
public static final int btnQuitter=0x7f080007;
public static final int btnSFX=0x7f080006;
public static final int button1=0x7f080016;
public static final int button2=0x7f080017;
public static final int checkBox1=0x7f080013;
public static final int imgLife=0x7f08000c;
public static final int imgScore=0x7f08000f;
public static final int imgScore2=0x7f08000e;
public static final int layout_game=0x7f080011;
public static final int layout_game_engine=0x7f080000;
public static final int layout_game_info=0x7f08000b;
public static final int layout_game_state=0x7f080008;
public static final int layout_options=0x7f080003;
public static final int layout_settings=0x7f080002;
public static final int layout_top=0x7f080001;
public static final int textView1=0x7f080012;
public static final int txtLife=0x7f08000d;
public static final int txtScore=0x7f080010;
}
public static final class layout {
public static final int activity_brick_breaker=0x7f030000;
public static final int activity_game_engine=0x7f030001;
public static final int activity_menu_jouer=0x7f030002;
public static final int activity_menu_jouer_parametres=0x7f030003;
public static final int activity_menu_options=0x7f030004;
}
public static final class raw {
public static final int music_game=0x7f050000;
public static final int music_lose=0x7f050001;
public static final int music_menu=0x7f050002;
public static final int music_win=0x7f050003;
public static final int sfx_break=0x7f050004;
public static final int sfx_collision=0x7f050005;
public static final int sfx_fail=0x7f050006;
}
public static final class string {
public static final int app_name=0x7f060000;
public static final int btn_options=0x7f060007;
public static final int btn_pause=0x7f060005;
public static final int btn_play=0x7f060006;
public static final int btn_quitter=0x7f060008;
public static final int btn_sfx=0x7f06000a;
public static final int btn_sound=0x7f060009;
public static final int default_number=0x7f06000c;
public static final int default_string=0x7f06000e;
public static final int img_life=0x7f06000d;
public static final int img_score=0x7f06000f;
public static final int title_activity_brick_breaker=0x7f06000b;
public static final int title_activity_game_engine=0x7f060004;
public static final int title_activity_menu_jouer=0x7f060001;
public static final int title_activity_menu_jouer_parametres=0x7f060003;
public static final int title_activity_menu_options=0x7f060002;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
API 11 theme customizations can go here.
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f070000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f070001;
}
}
| [
"[email protected]"
] | |
cc49467f4cb33f9426a6904cd147c9036621bc41 | 68615a0bc74086460efd5bc8dacf228108248e5a | /it.tests/src/main/java/com/adobe/aem/guides/saan/it/tests/package-info.java | f142674d6cbf19d170fbe41ed58e02c63149abf4 | [] | no_license | ssogalapalli/aem-guides-saan | 2672032cdeadad532e1251149aa13dbbdcaaea42 | 15bbfc4868a4c4a89cb6a6aeaa34bde93c52f0c1 | refs/heads/develop | 2022-08-23T13:48:52.929442 | 2019-10-31T12:14:33 | 2019-10-31T12:14:33 | 218,758,595 | 0 | 0 | null | 2022-08-11T15:57:37 | 2019-10-31T12:15:59 | Java | UTF-8 | Java | false | false | 727 | java | /*
* Copyright 2015 Adobe Systems Incorporated
*
* 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.
*/
@Version("1.0")
package com.adobe.aem.guides.saan.it.tests;
import org.osgi.annotation.versioning.Version; | [
"[email protected]"
] | |
ddfec5e4967108c1afb7508f03a835ae3362cd5c | 2813ab84551f5ff5c89df2132791fc4048d2039c | /src/RESEARCHMVC/sample.java | ecfbe499b6a6a3f3d6a4019b0c5d908f0bb5246d | [] | no_license | PercyPanJX/EstuaryGame | bfcf5a8b60c00f887deb5ccf400b254d94a78008 | a2dd69d2dfa22b9b869150407ea11099bdd0fb6b | refs/heads/master | 2020-04-10T07:29:47.448345 | 2018-12-10T03:49:17 | 2018-12-10T03:49:17 | 160,881,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 598 | java | package RESEARCHMVC;
import java.io.Serializable;
/**
* a data type named sample including things needed for a sample
* @author hongbozhan
*
*/
public class sample implements Serializable{
int number;
int depth;
String name;
boolean isCollected;
/**
* constructor for sample
* @param n number of sample player got
* @param d the depth of sample
* @param name the name of the sample
* @param i whether the sample is collected
*/
public sample(int n, int d, String name, boolean i){
this.number = n;
this.depth = d;
this.name = name;
this.isCollected = i;
}
}
| [
"[email protected]"
] | |
8c5f1674a80fddc53279f3324863bb7757aa2e55 | d3ecb4f6d9c7d459bed367fc84d46f6084d8703c | /app/src/main/java/com/wgu/el/wgustudent/ui/course/list/CoursesListViewModel.java | 7a493c2ac9cfc365f14d124b6c05d14f6f460050 | [] | no_license | edi2lopez/WguStudent | 64792ac5a5e1af3d3d66a4cf9c7fd92f6a1ca8fe | 0db1dbe866a4a22f8dbeb0e6212d21ed1263e0fe | refs/heads/master | 2020-03-19T17:17:11.971920 | 2018-06-09T19:23:02 | 2018-06-09T19:23:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,265 | java | package com.wgu.el.wgustudent.ui.course.list;
import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.MutableLiveData;
import android.arch.lifecycle.ViewModel;
import android.util.Log;
import com.wgu.el.wgustudent.entity.Course;
import com.wgu.el.wgustudent.injection.WguComponent;
import com.wgu.el.wgustudent.repository.WguRepository;
import java.util.List;
import javax.inject.Inject;
import io.reactivex.CompletableObserver;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
public class CoursesListViewModel extends ViewModel implements WguComponent.Injectable {
private static final String TAG = "CoursesListViewModel";
// private Course course;
private int termId;
@Inject
WguRepository wguRepository;
@Override
public void inject(WguComponent wguComponent) {
wguComponent.inject(this);
courses = wguRepository.getCourses();
coursesFromTerm = wguRepository.getCoursesFromTerm(termId);
}
private LiveData<List<Course>> courses = new MutableLiveData<>();
public LiveData<List<Course>> getCourses() {
return courses;
}
public void deleteCourse(Course course) {
wguRepository.deleteCourse(course)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new CompletableObserver() {
@Override
public void onSubscribe(Disposable d) {
}
@Override
public void onComplete() {
Log.d(TAG, "onComplete - deleted course :");
}
@Override
public void onError(Throwable e) {
Log.d(TAG, "OnError - throwable :");
}
});
}
public int getTermId() { return termId; }
public void setTermId(int termId) { this.termId = termId; }
private LiveData<List<Course>> coursesFromTerm = new MutableLiveData<>();
public LiveData<List<Course>> getCoursesFromTerm(int id) {
return wguRepository.getCoursesFromTerm(id);
}
}
| [
"[email protected]"
] | |
19bde6dcd09a50dd61fba819aee782cc2c3b7769 | 74d451e2ef2b2b7a9ed9c02b596afec0d41d4f85 | /src/main/java/com/example/big_commercial/service/GeneralService.java | be48e5493bb8c1608c5e963d50e5f96aa3c162d2 | [] | no_license | phankhai/big_commercial | 039f007150ef7af8cc460d88bb9584a3149afdce | ee2717df8cdc46a7a3edc3b46d277fcdce4193af | refs/heads/main | 2023-05-31T03:54:12.281441 | 2021-06-13T05:52:11 | 2021-06-13T05:52:11 | 376,196,151 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 444 | java | package com.example.big_commercial.service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.io.Serializable;
import java.util.Optional;
public interface GeneralService<T, F, ID extends Serializable> {
Page<T> findPaging(Pageable pageable, F f);
Iterable<T> findAll();
Optional<T> findById(ID id);
T save(T t);
T update(ID id, T t);
void remove(ID id);
}
| [
"[email protected]"
] | |
b3e9272ec41f91febbd4e41928a2c01ba14f39fe | 87c7f2ce01e322c3e2f7ea8da6cedc9b8e359e6d | /app/src/main/java/com/example/jingbin/cloudreader/utils/TimeUtil.java | 03d884fba6223efd2083c7a6522438daa018528e | [
"Apache-2.0"
] | permissive | shamujier/CloudReader | 4e93c6ea2079a3710a7351cb5938286560bd6b66 | 03ab84f39c5f3eac3ca71b742c1ce2b81f560746 | refs/heads/master | 2020-08-10T14:42:48.487350 | 2019-10-11T06:43:28 | 2019-10-11T06:43:28 | 214,361,849 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,102 | java | package com.example.jingbin.cloudreader.utils;
import android.text.TextUtils;
import android.text.format.Time;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
public class TimeUtil {
/**
* 准备第一个模板,从字符串中提取出日期数字
*/
private static String pat1 = "yyyy-MM-dd HH:mm:ss";
/**
* 准备第二个模板,将提取后的日期数字变为指定的格式
*/
private static String pat2 = "yyyy年MM月dd日 HH:mm:ss";
/**
* 实例化模板对象
*/
private static SimpleDateFormat sdf1 = new SimpleDateFormat(pat1);
private static SimpleDateFormat sdf2 = new SimpleDateFormat(pat2);
private static long timeMilliseconds;
public static Long farmatTime(String string) {
Date date = null;
try {
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
date = Date(sf.parse(string));
} catch (ParseException e) {
e.printStackTrace();
}
return date.getTime();
}
public static Date Date(Date date) {
Date datetimeDate;
datetimeDate = new Date(date.getTime());
return datetimeDate;
}
public static Date Dates() {
Date datetimeDate;
Long dates = 1361515285070L;
datetimeDate = new Date(dates);
return datetimeDate;
}
public static Date Date() {
Date datetimeDate;
Long dates = 1361514787384L;
datetimeDate = new Date(dates);
return datetimeDate;
}
/**
* 如果在1分钟之内发布的显示"刚刚" 如果在1个小时之内发布的显示"XX分钟之前" 如果在1天之内发布的显示"XX小时之前"
* 如果在今年的1天之外的只显示“月-日”,例如“05-03” 如果不是今年的显示“年-月-日”,例如“2014-03-11”
*
* @param time
* @return
*/
public static String getTranslateTime(String time) {
if (TextUtils.isEmpty(time)) {
return "";
}
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
// 在主页面中设置当天时间
Date nowTime = new Date();
String currDate = sdf1.format(nowTime);
long currentMilliseconds = nowTime.getTime();// 当前日期的毫秒值
Date date = null;
try {
// 将给定的字符串中的日期提取出来
date = sdf1.parse(time);
} catch (Exception e) {
e.printStackTrace();
return time;
}
if (date != null) {
timeMilliseconds = date.getTime();
}
long timeDifferent = currentMilliseconds - timeMilliseconds;
if (timeDifferent < 60000) {// 一分钟之内
return "刚刚";
}
if (timeDifferent < 3600000) {// 一小时之内
long longMinute = timeDifferent / 60000;
int minute = (int) (longMinute % 100);
return minute + "分钟之前";
}
long l = 24 * 60 * 60 * 1000; // 每天的毫秒数
if (timeDifferent < l) {// 小于一天
long longHour = timeDifferent / 3600000;
int hour = (int) (longHour % 100);
return hour + "小时之前";
}
if (timeDifferent >= l) {
String currYear = currDate.substring(0, 4);
String year = time.substring(0, 4);
if (!year.equals(currYear)) {
return time.substring(0, 10);
}
return time.substring(5, 10);
}
return time;
}
/**
* 获取当前日期
*/
public static String getData() {
SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String date = sDateFormat.format(new Date());
return date;
}
/**
* 获取当前时间是否大于12:30
*/
public static boolean isRightTime() {
// or Time t=new Time("GMT+8"); 加上Time Zone资料。
Time t = new Time();
t.setToNow(); // 取得系统时间。
int hour = t.hour; // 0-23
int minute = t.minute;
return hour > 12 || (hour == 12 && minute >= 30);
}
/**
* 得到上一天的时间
*/
public static ArrayList<String> getLastTime(String year, String month, String day) {
Calendar ca = Calendar.getInstance();//得到一个Calendar的实例
ca.set(Integer.valueOf(year), Integer.valueOf(month) - 1, Integer.valueOf(day));//月份是从0开始的,所以11表示12月
//使用roll方法进行向前回滚
//cl.roll(Calendar.DATE, -1);
//使用set方法直接进行设置
int inDay = ca.get(Calendar.DATE);
ca.set(Calendar.DATE, inDay - 1);
ArrayList<String> list = new ArrayList<>();
list.add(String.valueOf(ca.get(Calendar.YEAR)));
list.add(String.valueOf(ca.get(Calendar.MONTH) + 1));
list.add(String.valueOf(ca.get(Calendar.DATE)));
return list;
}
public static String formatDataTime(long timeMilliseconds) {
try {
SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String date = sDateFormat.format(timeMilliseconds);
return date;
} catch (Exception e) {
return getData();
}
}
public static String getTime(long timeMilliseconds) {
try {
SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String date = sDateFormat.format(timeMilliseconds);
return date;
} catch (Exception e) {
return getData();
}
}
public static Date getDate() {
SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String date = sDateFormat.format(new Date());
try {
return sDateFormat.parse(date);
} catch (ParseException e) {
}
return null;
}
/**
* 比较日期与当前日期的大小
*/
public static boolean DateCompare(String s1) throws ParseException {
//设定时间的模板
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//得到指定模范的时间
Date d1 = sdf.parse(s1);
Date d2 = sdf.parse(getData());
//比较
if (((d1.getTime() - d2.getTime()) / (24 * 3600 * 1000)) >= 1) {
return true;
} else {
return false;
}
}
/**
* 获取当月的 天数
*/
public static int getCurrentMonthDay() {
Calendar a = Calendar.getInstance();
a.set(Calendar.DATE, 1);
a.roll(Calendar.DATE, -1);
return a.get(Calendar.DATE);
}
/**
* 获取当前月份的第几天
*/
public static String getDay() {
SimpleDateFormat sDateFormat = new SimpleDateFormat("dd");
String date = sDateFormat.format(new Date());
return date;
}
}
| [
"[email protected]"
] | |
561b913a89cc214ac9f33bd1b67b0a3dd208aa4c | a39f6d4d89f4f858d51e394933579b43e8e6f1fb | /src/main/java/pl/kazmierczak/domain/Category.java | c071d5b7b3c557c0589120ecb24b470dfaa779dc | [] | no_license | kamil203901/ebookcase | 1a7bd6f6c9b0c210616e81d1507309cf7c8e9b15 | 0fe8d426557dceeefa7af159b25fda5a0d423f50 | refs/heads/master | 2021-07-06T15:48:00.618115 | 2017-09-29T22:58:23 | 2017-09-29T22:58:23 | 104,767,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 808 | java | package pl.kazmierczak.domain;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
* Created by kamil on 22.09.17.
*/
@Entity
public class Category {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
private String name;
public Category() {}
public Category(Integer id, String name) {
this.id = id;
this.name = name;
}
public Category(String name) {
this.name = name;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"[email protected]"
] | |
bd00c94d0030bca6792f9508202f1f3529e52ea2 | 011144431398fb65287b3fc9fe024cfff0b43c78 | /RealDeal_Skeleton/src/main/java/softuni/exam/models/dtos/SellerOfferSeedDto.java | eb82cdc3ce22754250974328f65e92d793fe6c00 | [] | no_license | zulnerub/SpringData-Hybernate | 66bf31dde2d8b82177d12bb37dc3fd6523d94463 | 3fc7eeadabfb5dc7bee67bba2b461fdae565fb6d | refs/heads/master | 2022-07-02T05:19:51.289510 | 2020-04-06T17:14:57 | 2020-04-06T17:14:57 | 244,436,427 | 0 | 0 | null | 2022-06-21T02:58:42 | 2020-03-02T17:48:08 | Java | UTF-8 | Java | false | false | 659 | java | package softuni.exam.models.dtos;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "seller")
@XmlAccessorType(XmlAccessType.FIELD)
public class SellerOfferSeedDto {
@XmlElement(name = "id")
private long id;
public SellerOfferSeedDto() {
}
@NotNull
@Min(value = 1)
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
}
| [
"[email protected]"
] | |
f6f4a2dbf1e24328a60ede07607ac14ab3571fd1 | 8a7bf9b057642238e4b580a2f76a7ea0a1d86d65 | /app/src/main/java/com/mardomsara/social/ui/pages/tabs/pages/TagsPageFragment.java | 5185ce2324473cbe97f291d21132cf4992a4bdbb | [] | no_license | jozn/ms_native | a1034decfd7c6e4ce71260c3fbc05ed4b4fe7430 | 7e075ab7e50752d3140b45ff9c63866cc86ce040 | refs/heads/master | 2020-03-28T05:30:59.158949 | 2018-12-26T15:54:25 | 2018-12-26T15:54:25 | 147,781,150 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,924 | java | package com.mardomsara.social.ui.pages.tabs.pages;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import com.mardomsara.social.app.API;
import com.mardomsara.social.base.Http.Http;
import com.mardomsara.social.nav.FragmentPage;
import com.mardomsara.social.ui.X;
import com.mardomsara.social.ui.adaptors.PostGeneralListCell;
/**
* Created by Hamid on 8/24/2016.
*/
public class TagsPageFragment extends FragmentPage {
static final String TAG_NAME = "TAG_NAME";
String tagName = "";
public static TagsPageFragment newInstance(String tagName) {
Bundle bundle = new Bundle();
bundle.putString(TAG_NAME, tagName);
TagsPageFragment fragment = new TagsPageFragment();
fragment.setArguments(bundle);
return fragment;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
this.tagName = getArguments().getString(TAG_NAME);
}
}
@Override
public View getView(Bundle savedInstanceState) {
X.PageTag_Parent x = new X.PageTag_Parent();
PostGeneralListCell cell = new PostGeneralListCell(x.top_nav.getButtonPostMultiWayView(), (page, cell2) -> {
Http.getPath("v1/tags/list")
.setQueryParam("tag", "" + tagName.replace("#", ""))
.setQueryParam("page", "" + page)
.setQueryParam("last", "" + cell2.getLastPostId(page))
.doAsyncUi((result) -> {
cell2.loadedPostsFromNetNew(result, page);
cell2.loadedPostsFromNetNew(result, page);
});
});
x.container.addView(cell.getViewRoot());
cell.setLoadingEndPoint(API.TAGS_LIST);
x.top_nav.setTitle(getTagNameTitle(tagName));
// cell.loadNextPage(1);
return x.root;
}
String getTagNameTitle(String tagName) {
if (tagName != null && tagName.length() > 0) {
if (!tagName.startsWith("#")) {
return "#" + tagName;
} else {
return tagName;
}
}
return "";
}
}
| [
"[email protected]"
] | |
eb17688d16cb9c9d182272dc8160ba1c44e5503a | cad04bb71f3afd50c4df3b2f321cd378d3ad8cb9 | /Course practices/千峰教育:走向单体地狱/hello-idea/src/com/CZ/hello/idea/MyTest.java | 556ec516136b4c2dae00b2aad1725d354013c63f | [] | no_license | SourDumplings/CodeSolutions | 9033de38005b1d90488e64ccbb99f91c7e7b71ec | 5f9eca3fe5701a8fca234343fde31cfcba94cf27 | refs/heads/master | 2023-08-16T17:23:34.977471 | 2023-08-07T13:14:47 | 2023-08-07T13:14:47 | 110,331,879 | 10 | 8 | null | 2023-06-14T22:25:16 | 2017-11-11T08:59:11 | C | UTF-8 | Java | false | false | 295 | java | package com.CZ.hello.idea;
/**
* @author CHANG Zheng
* @title: MyTest
* @projectName 千峰教育:走向单体地狱
* @description: TODO
* @date 2019/10/1510:28
*/
public class MyTest
{
public static void main(String[] args)
{
System.out.println("Hello IDEA");
}
}
| [
"[email protected]"
] | |
bb53db3ba4f0cd3f7dd9c2572eabc0e48569b7fd | 3735a07d455d7b40613c3c4160aa8b1cb1b3472a | /platform/lang-impl/src/com/intellij/psi/codeStyle/CodeStyleSettingsServiceImpl.java | e1097d1119202ff5110d3d97996ef47c0f7461af | [
"Apache-2.0"
] | permissive | caofanCPU/intellij-community | ede9417fc4ccb4b5efefb099906e4abe6871f3b4 | 5ad3e2bdf3c83d86e7c4396f5671929768d76999 | refs/heads/master | 2023-02-27T21:38:33.416107 | 2021-02-05T06:37:40 | 2021-02-05T06:37:40 | 321,209,485 | 1 | 0 | Apache-2.0 | 2021-02-05T06:37:41 | 2020-12-14T02:22:32 | null | UTF-8 | Java | false | false | 3,289 | java | // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.psi.codeStyle;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.extensions.ExtensionPointListener;
import com.intellij.openapi.extensions.PluginDescriptor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.Set;
public class CodeStyleSettingsServiceImpl implements CodeStyleSettingsService {
@Override
public void addListener(@NotNull CodeStyleSettingsServiceListener listener, @Nullable Disposable disposable) {
FileTypeIndentOptionsProvider.EP_NAME.addExtensionPointListener(new ExtensionPointListener<>() {
@Override
public void extensionAdded(@NotNull FileTypeIndentOptionsProvider extension, @NotNull PluginDescriptor pluginDescriptor) {
listener.fileTypeIndentOptionsFactoryAdded(extension);
}
@Override
public void extensionRemoved(@NotNull FileTypeIndentOptionsProvider extension, @NotNull PluginDescriptor pluginDescriptor) {
listener.fileTypeIndentOptionsFactoryRemoved(extension);
}
}, disposable);
LanguageCodeStyleSettingsProvider.EP_NAME.addExtensionPointListener(new ExtensionPointListener<>() {
@Override
public void extensionAdded(@NotNull LanguageCodeStyleSettingsProvider extension, @NotNull PluginDescriptor pluginDescriptor) {
LanguageCodeStyleSettingsProvider.registerSettingsPageProvider(extension);
listener.languageCodeStyleProviderAdded(extension);
}
@Override
public void extensionRemoved(@NotNull LanguageCodeStyleSettingsProvider extension, @NotNull PluginDescriptor pluginDescriptor) {
LanguageCodeStyleSettingsProvider.unregisterSettingsPageProvider(extension);
listener.languageCodeStyleProviderRemoved(extension);
}
}, disposable);
CodeStyleSettingsProvider.EXTENSION_POINT_NAME.addExtensionPointListener(new ExtensionPointListener<>() {
@Override
public void extensionAdded(@NotNull CodeStyleSettingsProvider extension, @NotNull PluginDescriptor pluginDescriptor) {
listener.customCodeStyleSettingsFactoryAdded(extension);
}
@Override
public void extensionRemoved(@NotNull CodeStyleSettingsProvider extension, @NotNull PluginDescriptor pluginDescriptor) {
listener.customCodeStyleSettingsFactoryRemoved(extension);
}
}, disposable);
}
@Override
public @NotNull List<? extends FileTypeIndentOptionsFactory> getFileTypeIndentOptionsFactories() {
return FileTypeIndentOptionsProvider.EP_NAME.getExtensionList();
}
@Override
public @NotNull List<? extends CustomCodeStyleSettingsFactory> getCustomCodeStyleSettingsFactories() {
return CodeStyleSettingsProvider.EXTENSION_POINT_NAME.getExtensionList();
}
@Override
public @NotNull List<? extends LanguageCodeStyleProvider> getLanguageCodeStyleProviders() {
return LanguageCodeStyleSettingsProvider.EP_NAME.getExtensionList();
}
@Override
public @NotNull Set<? extends CustomCodeStyleSettingsFactory> getSettingsPagesProviders() {
return LanguageCodeStyleSettingsProvider.getSettingsPagesProviders();
}
} | [
"[email protected]"
] | |
3b2c5a6680cb1461fc59699139d1a259fc5313fc | 4312a71c36d8a233de2741f51a2a9d28443cd95b | /RawExperiments/Lang/Lang63/new/1/AstorMain-lang63/src/variant-216/org/apache/commons/lang/time/DurationFormatUtils.java | ec765a55a66e998571db72ab5076442db8b3b52e | [] | no_license | SajjadZaidi/AutoRepair | 5c7aa7a689747c143cafd267db64f1e365de4d98 | e21eb9384197bae4d9b23af93df73b6e46bb749a | refs/heads/master | 2021-05-07T00:07:06.345617 | 2017-12-02T18:48:14 | 2017-12-02T18:48:14 | 112,858,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,105 | java | package org.apache.commons.lang.time;
public class DurationFormatUtils {
public DurationFormatUtils() {
super();
}
public static final java.lang.String ISO_EXTENDED_FORMAT_PATTERN = "'P'yyyy'Y'M'M'd'DT'H'H'm'M's.S'S'";
public static java.lang.String formatDurationHMS(long durationMillis) {
return org.apache.commons.lang.time.DurationFormatUtils.formatDuration(durationMillis, "H:mm:ss.SSS");
}
public static java.lang.String formatDurationISO(long durationMillis) {
return org.apache.commons.lang.time.DurationFormatUtils.formatDuration(durationMillis, org.apache.commons.lang.time.DurationFormatUtils.ISO_EXTENDED_FORMAT_PATTERN, false);
}
public static java.lang.String formatDuration(long durationMillis, java.lang.String format) {
return org.apache.commons.lang.time.DurationFormatUtils.formatDuration(durationMillis, format, true);
}
public static java.lang.String formatDuration(long durationMillis, java.lang.String format, boolean padWithZeros) {
org.apache.commons.lang.time.DurationFormatUtils.Token[] tokens = org.apache.commons.lang.time.DurationFormatUtils.lexx(format);
int days = 0;
int hours = 0;
int minutes = 0;
int seconds = 0;
int milliseconds = 0;
if (org.apache.commons.lang.time.DurationFormatUtils.Token.containsTokenWithValue(tokens, org.apache.commons.lang.time.DurationFormatUtils.d)) {
days = ((int)(durationMillis / (org.apache.commons.lang.time.DateUtils.MILLIS_PER_DAY)));
durationMillis = durationMillis - (days * (org.apache.commons.lang.time.DateUtils.MILLIS_PER_DAY));
}
if (org.apache.commons.lang.time.DurationFormatUtils.Token.containsTokenWithValue(tokens, org.apache.commons.lang.time.DurationFormatUtils.H)) {
hours = ((int)(durationMillis / (org.apache.commons.lang.time.DateUtils.MILLIS_PER_HOUR)));
durationMillis = durationMillis - (hours * (org.apache.commons.lang.time.DateUtils.MILLIS_PER_HOUR));
}
if (org.apache.commons.lang.time.DurationFormatUtils.Token.containsTokenWithValue(tokens, org.apache.commons.lang.time.DurationFormatUtils.m)) {
minutes = ((int)(durationMillis / (org.apache.commons.lang.time.DateUtils.MILLIS_PER_MINUTE)));
durationMillis = durationMillis - (minutes * (org.apache.commons.lang.time.DateUtils.MILLIS_PER_MINUTE));
}
if (org.apache.commons.lang.time.DurationFormatUtils.Token.containsTokenWithValue(tokens, org.apache.commons.lang.time.DurationFormatUtils.s)) {
seconds = ((int)(durationMillis / (org.apache.commons.lang.time.DateUtils.MILLIS_PER_SECOND)));
durationMillis = durationMillis - (seconds * (org.apache.commons.lang.time.DateUtils.MILLIS_PER_SECOND));
}
if (org.apache.commons.lang.time.DurationFormatUtils.Token.containsTokenWithValue(tokens, org.apache.commons.lang.time.DurationFormatUtils.S)) {
milliseconds = ((int)(durationMillis));
}
return org.apache.commons.lang.time.DurationFormatUtils.format(tokens, 0, 0, days, hours, minutes, seconds, milliseconds, padWithZeros);
}
public static java.lang.String formatDurationWords(long durationMillis, boolean suppressLeadingZeroElements, boolean suppressTrailingZeroElements) {
java.lang.String duration = org.apache.commons.lang.time.DurationFormatUtils.formatDuration(durationMillis, "d' days 'H' hours 'm' minutes 's' seconds'");
if (suppressLeadingZeroElements) {
duration = " " + duration;
java.lang.String tmp = org.apache.commons.lang.StringUtils.replaceOnce(duration, " 0 days", "");
if ((tmp.length()) != (duration.length())) {
duration = tmp;
tmp = org.apache.commons.lang.StringUtils.replaceOnce(duration, " 0 hours", "");
if ((tmp.length()) != (duration.length())) {
duration = tmp;
tmp = org.apache.commons.lang.StringUtils.replaceOnce(duration, " 0 minutes", "");
duration = tmp;
if ((tmp.length()) != (duration.length())) {
duration = org.apache.commons.lang.StringUtils.replaceOnce(tmp, " 0 seconds", "");
}
}
}
if ((duration.length()) != 0) {
duration = duration.substring(1);
}
}
if (suppressTrailingZeroElements) {
java.lang.String tmp = org.apache.commons.lang.StringUtils.replaceOnce(duration, " 0 seconds", "");
if ((tmp.length()) != (duration.length())) {
duration = tmp;
tmp = org.apache.commons.lang.StringUtils.replaceOnce(duration, " 0 minutes", "");
if ((tmp.length()) != (duration.length())) {
duration = tmp;
tmp = org.apache.commons.lang.StringUtils.replaceOnce(duration, " 0 hours", "");
if ((tmp.length()) != (duration.length())) {
duration = org.apache.commons.lang.StringUtils.replaceOnce(tmp, " 0 days", "");
}
}
}
}
duration = " " + duration;
duration = org.apache.commons.lang.StringUtils.replaceOnce(duration, " 1 seconds", " 1 second");
duration = org.apache.commons.lang.StringUtils.replaceOnce(duration, " 1 minutes", " 1 minute");
duration = org.apache.commons.lang.StringUtils.replaceOnce(duration, " 1 hours", " 1 hour");
duration = org.apache.commons.lang.StringUtils.replaceOnce(duration, " 1 days", " 1 day");
return duration.trim();
}
public static java.lang.String formatPeriodISO(long startMillis, long endMillis) {
return org.apache.commons.lang.time.DurationFormatUtils.formatPeriod(startMillis, endMillis, org.apache.commons.lang.time.DurationFormatUtils.ISO_EXTENDED_FORMAT_PATTERN, false, java.util.TimeZone.getDefault());
}
public static java.lang.String formatPeriod(long startMillis, long endMillis, java.lang.String format) {
return org.apache.commons.lang.time.DurationFormatUtils.formatPeriod(startMillis, endMillis, format, true, java.util.TimeZone.getDefault());
}
public static java.lang.String formatPeriod(long startMillis, long endMillis, java.lang.String format, boolean padWithZeros, java.util.TimeZone timezone) {
int total = 0;
if (millis < (28 * (org.apache.commons.lang.time.DateUtils.MILLIS_PER_DAY))) {
return org.apache.commons.lang.time.DurationFormatUtils.formatDuration(millis, format, padWithZeros);
}
org.apache.commons.lang.time.DurationFormatUtils.Token[] tokens = org.apache.commons.lang.time.DurationFormatUtils.lexx(format);
java.util.Calendar start = java.util.Calendar.getInstance(timezone);
start.setTime(new java.util.Date(startMillis));
java.util.Calendar end = java.util.Calendar.getInstance(timezone);
end.setTime(new java.util.Date(endMillis));
int milliseconds = (end.get(java.util.Calendar.MILLISECOND)) - (start.get(java.util.Calendar.MILLISECOND));
int seconds = (end.get(java.util.Calendar.SECOND)) - (start.get(java.util.Calendar.SECOND));
int minutes = (end.get(java.util.Calendar.MINUTE)) - (start.get(java.util.Calendar.MINUTE));
int hours = (end.get(java.util.Calendar.HOUR_OF_DAY)) - (start.get(java.util.Calendar.HOUR_OF_DAY));
int days = (end.get(java.util.Calendar.DAY_OF_MONTH)) - (start.get(java.util.Calendar.DAY_OF_MONTH));
int months = (end.get(java.util.Calendar.MONTH)) - (start.get(java.util.Calendar.MONTH));
int years = (end.get(java.util.Calendar.YEAR)) - (start.get(java.util.Calendar.YEAR));
while (milliseconds < 0) {
milliseconds += 1000;
seconds -= 1;
}
while (seconds < 0) {
seconds += 60;
minutes -= 1;
}
while (minutes < 0) {
minutes += 60;
hours -= 1;
}
while (hours < 0) {
hours += 24;
days -= 1;
}
while (days < 0) {
days += 31;
months -= 1;
}
while (months < 0) {
months += 12;
years -= 1;
}
milliseconds -= org.apache.commons.lang.time.DurationFormatUtils.reduceAndCorrect(start, end, java.util.Calendar.MILLISECOND, milliseconds);
seconds -= org.apache.commons.lang.time.DurationFormatUtils.reduceAndCorrect(start, end, java.util.Calendar.SECOND, seconds);
minutes -= org.apache.commons.lang.time.DurationFormatUtils.reduceAndCorrect(start, end, java.util.Calendar.MINUTE, minutes);
hours -= org.apache.commons.lang.time.DurationFormatUtils.reduceAndCorrect(start, end, java.util.Calendar.HOUR_OF_DAY, hours);
days -= org.apache.commons.lang.time.DurationFormatUtils.reduceAndCorrect(start, end, java.util.Calendar.DAY_OF_MONTH, days);
months -= org.apache.commons.lang.time.DurationFormatUtils.reduceAndCorrect(start, end, java.util.Calendar.MONTH, months);
years -= org.apache.commons.lang.time.DurationFormatUtils.reduceAndCorrect(start, end, java.util.Calendar.YEAR, years);
if (!(org.apache.commons.lang.time.DurationFormatUtils.Token.containsTokenWithValue(tokens, org.apache.commons.lang.time.DurationFormatUtils.y))) {
if (org.apache.commons.lang.time.DurationFormatUtils.Token.containsTokenWithValue(tokens, org.apache.commons.lang.time.DurationFormatUtils.M)) {
months += 12 * years;
years = 0;
} else {
days += 365 * years;
years = 0;
}
}
if (!(org.apache.commons.lang.time.DurationFormatUtils.Token.containsTokenWithValue(tokens, org.apache.commons.lang.time.DurationFormatUtils.M))) {
days += (end.get(java.util.Calendar.DAY_OF_YEAR)) - (start.get(java.util.Calendar.DAY_OF_YEAR));
months = 0;
}
if (!(org.apache.commons.lang.time.DurationFormatUtils.Token.containsTokenWithValue(tokens, org.apache.commons.lang.time.DurationFormatUtils.d))) {
hours += 24 * days;
days = 0;
}
if (!(org.apache.commons.lang.time.DurationFormatUtils.Token.containsTokenWithValue(tokens, org.apache.commons.lang.time.DurationFormatUtils.H))) {
minutes += 60 * hours;
hours = 0;
}
if (!(org.apache.commons.lang.time.DurationFormatUtils.Token.containsTokenWithValue(tokens, org.apache.commons.lang.time.DurationFormatUtils.m))) {
seconds += 60 * minutes;
minutes = 0;
}
if (!(org.apache.commons.lang.time.DurationFormatUtils.Token.containsTokenWithValue(tokens, org.apache.commons.lang.time.DurationFormatUtils.s))) {
milliseconds += 1000 * seconds;
seconds = 0;
}
return org.apache.commons.lang.time.DurationFormatUtils.format(tokens, years, months, days, hours, minutes, seconds, milliseconds, padWithZeros);
}
static java.lang.String format(org.apache.commons.lang.time.DurationFormatUtils.Token[] tokens, int years, int months, int days, int hours, int minutes, int seconds, int milliseconds, boolean padWithZeros) {
java.lang.StringBuffer buffer = new java.lang.StringBuffer();
boolean lastOutputSeconds = false;
int sz = tokens.length;
for (int i = 0 ; i < sz ; i++) {
org.apache.commons.lang.time.DurationFormatUtils.Token token = tokens[i];
java.lang.Object value = token.getValue();
int count = token.getCount();
if (value instanceof java.lang.StringBuffer) {
buffer.append(value.toString());
} else {
if (value == (org.apache.commons.lang.time.DurationFormatUtils.y)) {
buffer.append((padWithZeros ? org.apache.commons.lang.StringUtils.leftPad(java.lang.Integer.toString(years), count, '0') : java.lang.Integer.toString(years)));
lastOutputSeconds = false;
} else {
if (value == (org.apache.commons.lang.time.DurationFormatUtils.M)) {
buffer.append((padWithZeros ? org.apache.commons.lang.StringUtils.leftPad(java.lang.Integer.toString(months), count, '0') : java.lang.Integer.toString(months)));
lastOutputSeconds = false;
} else {
if (value == (org.apache.commons.lang.time.DurationFormatUtils.d)) {
buffer.append((padWithZeros ? org.apache.commons.lang.StringUtils.leftPad(java.lang.Integer.toString(days), count, '0') : java.lang.Integer.toString(days)));
lastOutputSeconds = false;
} else {
if (value == (org.apache.commons.lang.time.DurationFormatUtils.H)) {
buffer.append((padWithZeros ? org.apache.commons.lang.StringUtils.leftPad(java.lang.Integer.toString(hours), count, '0') : java.lang.Integer.toString(hours)));
lastOutputSeconds = false;
} else {
if (value == (org.apache.commons.lang.time.DurationFormatUtils.m)) {
buffer.append((padWithZeros ? org.apache.commons.lang.StringUtils.leftPad(java.lang.Integer.toString(minutes), count, '0') : java.lang.Integer.toString(minutes)));
lastOutputSeconds = false;
} else {
if (value == (org.apache.commons.lang.time.DurationFormatUtils.s)) {
buffer.append((padWithZeros ? org.apache.commons.lang.StringUtils.leftPad(java.lang.Integer.toString(seconds), count, '0') : java.lang.Integer.toString(seconds)));
lastOutputSeconds = true;
} else {
if (value == (org.apache.commons.lang.time.DurationFormatUtils.S)) {
if (lastOutputSeconds) {
milliseconds += 1000;
java.lang.String str = padWithZeros ? org.apache.commons.lang.StringUtils.leftPad(java.lang.Integer.toString(milliseconds), count, '0') : java.lang.Integer.toString(milliseconds);
buffer.append(str.substring(1));
} else {
buffer.append((padWithZeros ? org.apache.commons.lang.StringUtils.leftPad(java.lang.Integer.toString(milliseconds), count, '0') : java.lang.Integer.toString(milliseconds)));
}
lastOutputSeconds = false;
}
}
}
}
}
}
}
}
}
return buffer.toString();
}
static int reduceAndCorrect(java.util.Calendar start, java.util.Calendar end, int field, int difference) {
end.add(field, ((-1) * difference));
int endValue = end.get(field);
int startValue = start.get(field);
if (endValue < startValue) {
int newdiff = startValue - endValue;
end.add(field, newdiff);
return newdiff;
} else {
return 0;
}
}
static final java.lang.Object y = "y";
static final java.lang.Object M = "M";
static final java.lang.Object d = "d";
static final java.lang.Object H = "H";
static final java.lang.Object m = "m";
static final java.lang.Object s = "s";
static final java.lang.Object S = "S";
static org.apache.commons.lang.time.DurationFormatUtils.Token[] lexx(java.lang.String format) {
char[] array = format.toCharArray();
java.util.ArrayList list = new java.util.ArrayList(array.length);
boolean inLiteral = false;
java.lang.StringBuffer buffer = null;
org.apache.commons.lang.time.DurationFormatUtils.Token previous = null;
int sz = array.length;
for (int i = 0 ; i < sz ; i++) {
char ch = array[i];
if (inLiteral && (ch != '\'')) {
buffer.append(ch);
continue;
}
java.lang.Object value = null;
switch (ch) {
case '\'' :
if (inLiteral) {
buffer = null;
inLiteral = false;
} else {
buffer = new java.lang.StringBuffer();
list.add(new org.apache.commons.lang.time.DurationFormatUtils.Token(buffer));
inLiteral = true;
}
break;
case 'y' :
value = org.apache.commons.lang.time.DurationFormatUtils.y;
break;
case 'M' :
value = org.apache.commons.lang.time.DurationFormatUtils.M;
break;
case 'd' :
value = org.apache.commons.lang.time.DurationFormatUtils.d;
break;
case 'H' :
value = org.apache.commons.lang.time.DurationFormatUtils.H;
break;
case 'm' :
value = org.apache.commons.lang.time.DurationFormatUtils.m;
break;
case 's' :
value = org.apache.commons.lang.time.DurationFormatUtils.s;
break;
case 'S' :
value = org.apache.commons.lang.time.DurationFormatUtils.S;
break;
default :
if (buffer == null) {
buffer = new java.lang.StringBuffer();
list.add(new org.apache.commons.lang.time.DurationFormatUtils.Token(buffer));
}
buffer.append(ch);
}
if (value != null) {
if ((previous != null) && ((previous.getValue()) == value)) {
previous.increment();
} else {
org.apache.commons.lang.time.DurationFormatUtils.Token token = new org.apache.commons.lang.time.DurationFormatUtils.Token(value);
list.add(token);
previous = token;
}
buffer = null;
}
}
return ((org.apache.commons.lang.time.DurationFormatUtils.Token[])(list.toArray(new org.apache.commons.lang.time.DurationFormatUtils.Token[0])));
}
static class Token {
static boolean containsTokenWithValue(org.apache.commons.lang.time.DurationFormatUtils.Token[] tokens, java.lang.Object value) {
int sz = tokens.length;
for (int i = 0 ; i < sz ; i++) {
if ((tokens[i].getValue()) == value) {
return true;
}
}
return false;
}
private java.lang.Object value;
private int count;
Token(java.lang.Object value) {
org.apache.commons.lang.time.DurationFormatUtils.Token.this.value = value;
org.apache.commons.lang.time.DurationFormatUtils.Token.this.count = 1;
}
Token(java.lang.Object value ,int count) {
org.apache.commons.lang.time.DurationFormatUtils.Token.this.value = value;
org.apache.commons.lang.time.DurationFormatUtils.Token.this.count = count;
}
void increment() {
(count)++;
}
int getCount() {
return count;
}
java.lang.Object getValue() {
return value;
}
public boolean equals(java.lang.Object obj2) {
if (obj2 instanceof org.apache.commons.lang.time.DurationFormatUtils.Token) {
org.apache.commons.lang.time.DurationFormatUtils.Token tok2 = ((org.apache.commons.lang.time.DurationFormatUtils.Token)(obj2));
if ((org.apache.commons.lang.time.DurationFormatUtils.Token.this.value.getClass()) != (tok2.value.getClass())) {
return false;
}
if ((org.apache.commons.lang.time.DurationFormatUtils.Token.this.count) != (tok2.count)) {
return false;
}
if ((org.apache.commons.lang.time.DurationFormatUtils.Token.this.value) instanceof java.lang.StringBuffer) {
return org.apache.commons.lang.time.DurationFormatUtils.Token.this.value.toString().equals(tok2.value.toString());
} else {
if ((org.apache.commons.lang.time.DurationFormatUtils.Token.this.value) instanceof java.lang.Number) {
return org.apache.commons.lang.time.DurationFormatUtils.Token.this.value.equals(tok2.value);
} else {
return (org.apache.commons.lang.time.DurationFormatUtils.Token.this.value) == (tok2.value);
}
}
} else {
return false;
}
}
public int hashCode() {
return org.apache.commons.lang.time.DurationFormatUtils.Token.this.value.hashCode();
}
public java.lang.String toString() {
return org.apache.commons.lang.StringUtils.repeat(org.apache.commons.lang.time.DurationFormatUtils.Token.this.value.toString(), org.apache.commons.lang.time.DurationFormatUtils.Token.this.count);
}
}
}
| [
"[email protected]"
] | |
5b671334ed2831a6e2be0495924a147ae542d096 | 2ca7ea739e95f4b867de2d6e7c26f0ea7e4afd03 | /src/collectionType/TestType/Test1.java | eee6d238cf89880985066238c9105feeffda8122 | [] | no_license | Archforce-Internship/zhengrong-repo | 1b21c9b4b66da0420d303c977dd38bc503625a7d | 813eeb3110124cb8a2b397908168aa068c1edbeb | refs/heads/master | 2023-03-21T04:50:33.975994 | 2021-03-10T08:51:03 | 2021-03-10T08:51:03 | 343,345,474 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,140 | java | package collectionType.TestType;
import collectionType.Book;
import collectionType.FactoryBean.MyBean;
import collectionType.Stu;
import collectionType.courses;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* @author 517
* @date 2021-03-02 - 14:08
*/
public class Test1 {
@Test
public void TestCollection() {
ApplicationContext context = new ClassPathXmlApplicationContext("bean3.xml");
Stu stu = context.getBean("stu", Stu.class);
stu.test();
}
@Test
public void TestBook() {
ApplicationContext context = new ClassPathXmlApplicationContext("beanForPublic.xml");
Book book = context.getBean("Book", Book.class);
Book book2 = context.getBean("Book", Book.class);
book.ou();
book2.ou();
}
@Test
public void TestFBean() {
ApplicationContext context = new ClassPathXmlApplicationContext("beanForFactory.xml");
courses courses = context.getBean("myBean", courses.class);
System.out.println(courses);
}
}
| [
"[email protected]"
] | |
985cc2cdce6982985c1a05081e18ee01b2b4c35c | b404826a9a3f0fee80d1c35ca6295f9248acad1d | /com/google/android/gms/common/download/zza.java | 26cedccf57071a89d5906550946114f82eba219d | [] | no_license | cyberhorse208/SafetyNet | 9690da910fb80a72f0858b0ffef378e9e1b1609b | f251566d00f9e79ff0205eaaa889d74102b4ebc4 | refs/heads/master | 2021-12-11T02:30:34.120200 | 2016-10-18T08:21:52 | 2016-10-18T08:21:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,284 | java | package com.google.android.gms.common.download;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.google.android.gms.common.internal.safeparcel.zzb;
public class zza implements Creator<DownloadDetails> {
static void zza(DownloadDetails downloadDetails, Parcel parcel, int i) {
int zzbe = zzb.zzbe(parcel);
zzb.zzc(parcel, 1, downloadDetails.versionCode);
zzb.zza(parcel, 2, downloadDetails.filename, false);
zzb.zza(parcel, 3, downloadDetails.url, false);
zzb.zza(parcel, 4, downloadDetails.zzaud);
zzb.zza(parcel, 5, downloadDetails.zzaue, false);
zzb.zza(parcel, 6, downloadDetails.zzauf, false);
zzb.zzc(parcel, 7, downloadDetails.zzaug);
zzb.zzc(parcel, 8, downloadDetails.zzauh);
zzb.zzJ(parcel, zzbe);
}
public /* synthetic */ Object createFromParcel(Parcel parcel) {
return zzaT(parcel);
}
public /* synthetic */ Object[] newArray(int i) {
return zzdc(i);
}
public DownloadDetails zzaT(Parcel parcel) {
int i = 0;
String str = null;
int zzbd = com.google.android.gms.common.internal.safeparcel.zza.zzbd(parcel);
long j = 0;
int i2 = 0;
String str2 = null;
String str3 = null;
String str4 = null;
int i3 = 0;
while (parcel.dataPosition() < zzbd) {
int zzbc = com.google.android.gms.common.internal.safeparcel.zza.zzbc(parcel);
switch (com.google.android.gms.common.internal.safeparcel.zza.zzdr(zzbc)) {
case 1:
i3 = com.google.android.gms.common.internal.safeparcel.zza.zzg(parcel, zzbc);
break;
case 2:
str4 = com.google.android.gms.common.internal.safeparcel.zza.zzq(parcel, zzbc);
break;
case 3:
str3 = com.google.android.gms.common.internal.safeparcel.zza.zzq(parcel, zzbc);
break;
case 4:
j = com.google.android.gms.common.internal.safeparcel.zza.zzi(parcel, zzbc);
break;
case 5:
str2 = com.google.android.gms.common.internal.safeparcel.zza.zzq(parcel, zzbc);
break;
case 6:
str = com.google.android.gms.common.internal.safeparcel.zza.zzq(parcel, zzbc);
break;
case 7:
i2 = com.google.android.gms.common.internal.safeparcel.zza.zzg(parcel, zzbc);
break;
case 8:
i = com.google.android.gms.common.internal.safeparcel.zza.zzg(parcel, zzbc);
break;
default:
com.google.android.gms.common.internal.safeparcel.zza.zzb(parcel, zzbc);
break;
}
}
if (parcel.dataPosition() == zzbd) {
return new DownloadDetails(i3, str4, str3, j, str2, str, i2, i);
}
throw new com.google.android.gms.common.internal.safeparcel.zza.zza("Overread allowed size end=" + zzbd, parcel);
}
public DownloadDetails[] zzdc(int i) {
return new DownloadDetails[i];
}
}
| [
"[email protected]"
] | |
cbadb2d3794faace8640b36d8323165b418719ab | 918499f4cac65e3f13fd62ca8d428a2ebec2415b | /Board.java | 321f934b9861309a1820a410ca355094319793a0 | [] | no_license | TBoneSteak91/NoughtsAndCrosses | 11d4881571af3c35eec1ea40497fa512159ddd46 | d9da278c3719ae1a19116ddbdba50097ff951870 | refs/heads/main | 2023-02-05T10:19:12.552535 | 2020-12-20T15:15:50 | 2020-12-20T15:15:50 | 323,100,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,442 | java | /* Anthony Lydon - 2497467
*
* A class to represent the game board.
*/
public class Board {
/*
* Attributes representing the number of rows and columns and the array of
* columns
*/
private int rows;
private int columns;
private Column[] columnArray;
public Board(int rows, int columns) { // A constructor
this.rows = rows;
this.columns = columns;
columnArray = new Column[columns]; // Making a columnArray, which length is the number of columns.
for (int i = 0; i < columns; i++) {
columnArray[i] = new Column(rows);
// Setting the length of each column to the number of rows using a for loop
}
}
/*
* A boolean add method which takes a counter and a column number as its
* arguments and returns true if the board successfully adds a counter to the
* column and otherwise only returns false.
*/
public boolean add(Counter counter, int columnNumber) {
if (columnArray[columnNumber].isFull()) // Checking if the column is full
return false;
else
columnArray[columnNumber].add(counter); // Using the column's add method to add a counter.
return true;
}
/*
* A toString method which returns a String representation of the board.
*/
public String toString() {
String board = new String(); // Making a String
for (int i = 0; i < columns; i++)
board += "|" + i; // Adding the column numbers along the top of the board
board += "|\n";
for (int i = 0; i < columns; i++)
board += "--"; // Adding the line separating the column numbers from the board
board += "\n";
for (int k = 0; k < rows; k++) { // A for loop to loop over all rows
for (int i = 0; i < columns; i++)
/*
* A second for loop nested in the row loop, to loop over each column space in a
* row
*/
board += "|" + columnArray[i].displayRow(k);
/*
* Using the Column object's displayRow method to add all the counter symbols
* and empty space characters to the board String.
*/
board += "|\n";
}
return board;
}
/*
* A boolean method which uses a for loop to check if the board is full by
* returning true if all columns are full and false if otherwise.
*/
public boolean isFull() {
for (int i = 0; i < columns; i++)
if (columnArray[i].isFull()) // Checking if a column is full using the Column object's isFull method
continue;
else
return false;
return true; // Returning true if all columns are full
}
// A getter for the Columns
public int getColumns() {
return columns;
}
/*
* A boolean method that takes a player as an argument and checks if that player
* has won
*/
public boolean hasWon(Player player) {
/*
* Four for loops each checking if a set of four adjacent counters exist from the
* same player. There is a for loop for each type of potential winning position:
* vertical, horizontal, diagonal left and diagonal right. Each for loop contains
* a method to check either a row or column, and then this is looped over the whole
* board
*/
for (int i = 0; i < columns; i++) {
// looping over the all the columns with a method to check for a vertical win.
if (checkVerticals(player, i))
return true;
}
for (int k = 0; k < rows; k++) {
// looping over the all the rows with a method to check for a horizontal win.
if (checkHorizontals(player, k))
return true;
}
for (int j = 0; j < rows - 3; j++) {
/*
* looping over the rows with a method to check for a diagonal win from the one
* direction, starting from the left side.
*/
if (checkDiagonalsLeft(player, j))
return true;
}
for (int a = 0; a < rows - 3; a++) {
/*
* looping over the rows with a method to check for a diagonal win from the
* opposite direction, starting from the right side
*/
if (checkDiagonalsRight(player, a))
return true;
}
return false;
// returns false if the entire board is checked via the four loops and no win is found
}
/*
* A method which, when passed a player and a column, checks if a vertical win
* exists for the player in the column. It uses another method to check if four
* counters match from a particular position, then loops this over the whole column
*/
public boolean checkVerticals(Player player, int columnNum) {
for (int i = 0; i < rows - 3; i++) { // Looping through the column by row position
if (checkVerticalPosition(player, columnNum,i))
// Using a method to check if a vertical position of four wins.
return true; // returns true if a win exists.
}
return false; // false if no win exists in the column
}
/*
* A method that when passed a player, column and a row index which acts as a
* start position, checks four adjacent counters vertically to see if they match
*/
public boolean checkVerticalPosition(Player player, int column, int rowNum) {
for (int i = 0; i < 4; i++) { // Looping over four positions
if (columnArray[column].getCounterArray()[rowNum + i] == null)
// Checking if there is an empty space and returning false if so.
return false;
else if (columnArray[column].getCounterArray()[rowNum + i]
.equals(new Counter(player))) // Checking if a counter matches the player's counter
continue; // If the counter matches, the next counter is checked.
else
return false; // If a different counter is found, false is returned.
}
return true; // If the loop is completed and all four counters match, true is returned.
}
/*
* A method which, when passed a player and a row number, checks if a horizontal
* win exists for the player in the row. It uses another method to check if four
* counters match from a particular position, then loops this over the whole row
*/
public boolean checkHorizontals(Player player, int rowNum) {
for (int i = 0; i < columns - 3; i++) { // Looping through the row by column position
if (checkHorizontalPosition(player, rowNum,i))
// Using a method to check if a horizontal position of four wins.
return true; // returns true if a win exists.
}
return false; // false if no win exists in the row
}
/*
* A method that when passed a player, row number and a row index which acts as
* a start position, checks four adjacent counters horizontally to see if they
* match.
*/
public boolean checkHorizontalPosition(Player player, int row, int columnNum) {
for (int i = 0; i < 4; i++) { // Looping over four positions
if (columnArray[columnNum + i].getCounterArray()[row] == null)
// Checking if there is an empty space and returning no win if so.
return false;
else if (columnArray[columnNum + i].getCounterArray()[row].equals(new Counter(player)))
//Checking if a counter matches the player's counter
continue; // If the counter matches, the next counter is checked.
else
return false; // If a different counter is found, false is returned.
}
return true; // If the loop is completed and all four counters match, true is returned.
}
/*
* A method which, when passed a player and a row number, checks if a diagonal
* win exists for the player in the row, from the left direction. It uses another
* method to check if four counters match from a particular position, then loops
* this over the whole row
*/
public boolean checkDiagonalsLeft(Player player, int rowNum) {
for (int i = 0; i < columns - 3; i++) { // Looping through the row by column position, starting from the left.
if (checkDiagonalPositionLeft(player, rowNum,i))
// Using a method to check if a diagonal position of four wins.
return true; // returns true if a win exists
}
return false; // false if no win exists
}
/*
* A method that when passed a player, row number and a row index which acts as
* a start position, checks four adjacent counters diagonally to see if they
* match, from one direction.
*/
public boolean checkDiagonalPositionLeft(Player player, int row, int checkCount) {
for (int i = 0; i < 4; i++) { // Looping over four positions, starting from the left.
if (columnArray[checkCount + i].getCounterArray()[row+ i] == null)
// Checking if there is an empty space and returning no win if so.
return false;
else if (columnArray[checkCount + i].getCounterArray()[row + i].equals(new Counter(player)))
// Checking if a counter matches the player's counter
continue; // If the counter matches, the next counter is checked.
else
return false; // If a different counter is found, false is returned.
}
return true; // If the loop is completed and all four counters match, true is returned.
}
/*
* A method which, when passed a player and a row number, checks if a diagonal
* win exists for the player in the row, from the right direction. It uses another
* method to check if four counters match from a particular position, then loops
* this over the whole row
*/
public boolean checkDiagonalsRight(Player player, int rowNum) {
for (int i = columns - 1; i > 2; i--) { // Looping over four positions, this time from the right.
if (checkDiagonalPositionRight(player, rowNum, i))
return true; // returns true if a win exists
}
return false; // false if no win exists
}
/*
* A method that when passed a player, row number and a row index which acts as
* a start position, checks four adjacent counters diagonally to see if they
* match, from a different direction than checkDiagonalPositionLeft
*/
public boolean checkDiagonalPositionRight(Player player, int row, int checkCount) {
for (int i = 0; i < 4; i++) { // Looping over four positions, starting from the right.
if (columnArray[checkCount - i].getCounterArray()[row+ i] == null)
// Checking if there is an empty space and returning no win if so.
return false;
else if (columnArray[checkCount - i].getCounterArray()[row + i].equals(new Counter(player)))
continue; // If the counter matches, the next counter is checked.
else
return false; // If a different counter is found, false is returned.
}
return true; // If the loop is completed and all four counters match, true is returned.
}
}
| [
"[email protected]"
] | |
e45cd9dd7b7c40936489879f1010656dfc1b6c21 | 5906ccaedfe8c0a6d07862607ebfbe43201ad85d | /Arquitetura/Anexos/arquitetutadesistemas/vish/Exercicios/Exercicio06/src/exercicio06/Entrada.java | 2c75ff4f857b0589d20a5a50d54942c54528e055 | [] | no_license | sergiobh/4periodo_desativado | b9061b989df8d29c75d322993ef0e969cae20a88 | b04028c48fc95ae07fb97486223a56fbe225ab37 | refs/heads/master | 2020-12-24T15:49:46.185698 | 2013-11-24T20:24:47 | 2013-11-24T20:24:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 723 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package exercicio06;
import java.util.Date;
/**
*
* @author 311115755
*/
public class Entrada {
private String numeroConta, historico;
private double valor;
private Date data;
FileUtil futil;
public void Salvar(){
futil.writeToFile("Entrada.txt", "1", true, true);
}
public boolean eValido() {
Date datas = new Date();
//SimpleDateFormat formatador = new SimpleDateFormat("dd/MM/yyyy");
if (numeroConta.length() < 8 || historico.equals("") || valor <= 0 || datas.after(data)) {
return false;
}
return true;
}
}
| [
"[email protected]"
] | |
9494a52e8dd820a3f983bebaafae784dab0eeebc | a13ab684732add3bf5c8b1040b558d1340e065af | /java7-src/com/sun/imageio/plugins/bmp/BMPConstants.java | c2783e186fe238095279f0b4e4854c9a67ec0e50 | [] | no_license | Alivop/java-source-code | 554e199a79876343a9922e13ccccae234e9ac722 | f91d660c0d1a1b486d003bb446dc7c792aafd830 | refs/heads/master | 2020-03-30T07:21:13.937364 | 2018-10-25T01:49:39 | 2018-10-25T01:51:38 | 150,934,150 | 5 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,161 | java | /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.sun.imageio.plugins.bmp;
public interface BMPConstants {
// bmp versions
static final String VERSION_2 = "BMP v. 2.x";
static final String VERSION_3 = "BMP v. 3.x";
static final String VERSION_3_NT = "BMP v. 3.x NT";
static final String VERSION_4 = "BMP v. 4.x";
static final String VERSION_5 = "BMP v. 5.x";
// Color space types
static final int LCS_CALIBRATED_RGB = 0;
static final int LCS_sRGB = 1;
static final int LCS_WINDOWS_COLOR_SPACE = 2;
static final int PROFILE_LINKED = 3;
static final int PROFILE_EMBEDDED = 4;
// Compression Types
static final int BI_RGB = 0;
static final int BI_RLE8 = 1;
static final int BI_RLE4 = 2;
static final int BI_BITFIELDS = 3;
static final int BI_JPEG = 4;
static final int BI_PNG = 5;
static final String[] compressionTypeNames =
{"BI_RGB", "BI_RLE8", "BI_RLE4", "BI_BITFIELDS", "BI_JPEG", "BI_PNG"};
}
| [
"[email protected]"
] | |
f7d539f6f8c0c684f1a3dff99069b33e4967a531 | f54de0d00ceaccbde50f6d47cc615fc94af0af8d | /src/com/sap/document/sap/soap/functions/mc_style/ZdefmHrJfperResponse.java | e44edd146dc3912758c489738ab2d5ed4dc3662a | [] | no_license | Char-CN/EmployeeExtract | 3dc0f062e09ac9427c5e8a9d8ccf31649b2e9e12 | fcec02a3997357be65b0caa121902865746d7981 | refs/heads/master | 2021-01-19T23:11:47.557827 | 2017-11-28T07:57:56 | 2017-11-28T07:57:56 | 88,932,963 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,294 | java |
package com.sap.document.sap.soap.functions.mc_style;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>anonymous complex type的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="EtResult" type="{urn:sap-com:document:sap:soap:functions:mc-style}TableOfZshrJfpernr" minOccurs="0"/>
* <element name="ItPernr" type="{urn:sap-com:document:sap:soap:functions:mc-style}TableOfZhrsHtPernr" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"etResult",
"itPernr"
})
@XmlRootElement(name = "ZdefmHrJfperResponse")
public class ZdefmHrJfperResponse {
@XmlElement(name = "EtResult")
protected TableOfZshrJfpernr etResult;
@XmlElement(name = "ItPernr")
protected TableOfZhrsHtPernr itPernr;
/**
* 获取etResult属性的值。
*
* @return
* possible object is
* {@link TableOfZshrJfpernr }
*
*/
public TableOfZshrJfpernr getEtResult() {
return etResult;
}
/**
* 设置etResult属性的值。
*
* @param value
* allowed object is
* {@link TableOfZshrJfpernr }
*
*/
public void setEtResult(TableOfZshrJfpernr value) {
this.etResult = value;
}
/**
* 获取itPernr属性的值。
*
* @return
* possible object is
* {@link TableOfZhrsHtPernr }
*
*/
public TableOfZhrsHtPernr getItPernr() {
return itPernr;
}
/**
* 设置itPernr属性的值。
*
* @param value
* allowed object is
* {@link TableOfZhrsHtPernr }
*
*/
public void setItPernr(TableOfZhrsHtPernr value) {
this.itPernr = value;
}
}
| [
"[email protected]"
] | |
9df06d915ad1b90b4c5cc4aee0855ca91e0edd3e | 03eff65822ba0f44686c767463f3b05b12517b69 | /sentiment-hdfs/src/main/java/zx/soft/sent/hdfs/io/impl/HdfsWriter.java | 9116c638a7ac2bcc9ac63de6b53162097d56ed73 | [] | no_license | billhongs/sentiment-search | a43fb3ff661ddfe54db48db6d50e90f71d90586e | 5fa469fdba8495d12f1d75c0b9ebadd2c3a9b451 | refs/heads/master | 2021-01-18T10:01:02.942637 | 2014-06-19T08:29:41 | 2014-06-19T08:29:41 | 21,086,771 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 212 | java | package zx.soft.sent.hdfs.io.impl;
import java.io.Closeable;
/**
* HDFS写数据接口
*
* @author wanggang
*
*/
public interface HdfsWriter extends Closeable {
void write(String key, String value);
}
| [
"[email protected]"
] | |
0d7c4b17600deff0fdce01d1a89423d84a023b60 | c2882688b3d1bb00785e745cce06063e5663afc7 | /schema/schema-api/src/main/java/org/bndly/schema/api/query/Where.java | f6b4c5f6daaf3a78fb2136ec08f1f7913d4bdf7f | [
"Apache-2.0"
] | permissive | bndly/bndly-commons | e04be01aabcb9e5ff6d15287a3cfa354054a26fe | 6734e6a98f7e253ed225a4f2cce47572c5a969cb | refs/heads/master | 2023-04-03T04:20:47.954354 | 2023-03-17T13:49:57 | 2023-03-17T13:49:57 | 275,222,708 | 1 | 2 | Apache-2.0 | 2023-01-02T21:59:50 | 2020-06-26T18:31:34 | Java | UTF-8 | Java | false | false | 773 | java | package org.bndly.schema.api.query;
/*-
* #%L
* Schema API
* %%
* Copyright (C) 2013 - 2020 Cybercon GmbH
* %%
* 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.
* #L%
*/
public interface Where extends QueryFragmentRenderer {
Expression expression();
}
| [
"[email protected]"
] | |
c50dc700858ac637df9a87294949ff580051ec7a | afa5ce9feea1b42366e5fc77724ba7696fd072eb | /app/src/main/java/com/koteswara/wiseplaces/places/ShareCurrentLocation.java | 701f1b1203e5bfe9b95d9b86492369bf9ef772b7 | [] | no_license | koteswaradk/WisePlaces | 42510388a9d82a699c2bd475f09d40ee4fc15de8 | 79abf73de8a49c0e8379e22be2b949a22f7ab990 | refs/heads/master | 2023-02-03T16:43:08.593252 | 2020-12-17T13:30:18 | 2020-12-17T13:30:18 | 322,303,618 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,697 | java | package com.koteswara.wiseplaces.places;
import android.Manifest;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.location.Address;
import android.location.Criteria;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.telephony.SmsManager;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.TranslateAnimation;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Toast;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.InterstitialAd;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.SnapshotReadyCallback;
import com.google.android.gms.maps.LocationSource.OnLocationChangedListener;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.koteswara.wiseplaces.R;
import com.koteswara.wiseplaces.util.CheckInternetConnection;
import com.koteswara.wiseplaces.util.InternetCheckDialog;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.Fragment;
/**
* Created by Edwin on 15/02/2015.
*/
public class ShareCurrentLocation extends Fragment implements OnLocationChangedListener, LocationListener, OnClickListener, OnMapReadyCallback {
AdView mAdView;
AdRequest adRequest;
private InterstitialAd interstitial;
GoogleMap googleMap;
Location location;
private LocationManager locationManager;
String CityName = "", StateName = "", CountryName = "", s_address, result = null, ContactNumber, name;
double latitude, longitude;
Bitmap _snapshot;
ImageView snapshotHolder;
byte[] temp_photo;
ImageButton _watsapp_button, _facebook_button, _message_button, _share_button;
boolean flag = false;
TelephonyManager tm;
SupportMapFragment fm;
@Override
public void onPause() {
// TODO Auto-generated method stub
super.onPause();
result = null;
}
@Override
public void onDestroy() {
// TODO Auto-generated method stub
super.onDestroy();
result = null;
}
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootview = inflater.inflate(R.layout.sharecurrentlocation, container, false);
// Getting reference to the SupportMapFragment of activity_main.xml
fm = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map);
mAdView = (AdView) rootview.findViewById(R.id.adView);
interstitial = new InterstitialAd(getContext());
_watsapp_button = (ImageButton) rootview.findViewById(R.id.watsapp_button);
//_facebook_button=(ImageButton) rootview.findViewById(R.id.facebook_button);
_message_button = (ImageButton) rootview.findViewById(R.id.message_button);
_share_button = (ImageButton) rootview.findViewById(R.id.share_button);
/*snapshotHolder=(ImageView)rootview.findViewById(R.id.screenimage);*/
_watsapp_button.setOnClickListener(this);
_message_button.setOnClickListener(this);
//_facebook_button.setOnClickListener(this);
tm = (TelephonyManager) getContext()
.getSystemService(Context.TELEPHONY_SERVICE);
interstitial.setAdUnitId(getResources().getString(
R.string.admobi_adUid_interstitial_add));
tm = (TelephonyManager) getContext()
.getSystemService(Context.TELEPHONY_SERVICE);
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
if (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED)
tm.getDeviceId();
adRequest = new AdRequest.Builder()
//.addTestDevice(deviceid)
.build();
mAdView.loadAd(adRequest);
callLocationUpdate();
//interstitial.loadAd(adRequest);
/*interstitial.setAdListener(new AdListener() {
public void onAdLoaded() {
// Call displayInterstitial() function
// interstitial.show();
displayInterstitial();
}
private void displayInterstitial() {
// TODO Auto-generated method stub
if (interstitial.isLoaded()) {
interstitial.show();
}
}
});*/
//snapshotHolder=new ImageView(getActivity());
/*RotateAnimation animation = (RotateAnimation)AnimationUtils.loadAnimation(getActivity(), R.anim.rotate);
_watsapp_button.startAnimation(animation);
_facebook_button.startAnimation(animation);
_message_button.startAnimation(animation);
_watsapp_button.startAnimation(animation);*/
// Getting GoogleMap object from the fragment
return rootview;
}
void callLocationUpdate() {
fm.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
googleMap = googleMap;
}
});
// Enabling MyLocation Layer of Google Map
googleMap.getMyLocation();
CheckInternetConnection intenercheck = new CheckInternetConnection(getActivity());
if (!intenercheck.CheckInternet()) {
InternetCheckDialog dialog = new InternetCheckDialog(getActivity());
dialog.showDialog();
} else {
// Getting LocationManager object from System Service LOCATION_SERVICE
locationManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
LocationListener locListener = new ShareCurrentLocation();
//locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locListener);
// Creating a criteria object to retrieve provider
Criteria criteria = new Criteria();
// Getting the name of the best provider
String provider = locationManager.getBestProvider(criteria, true);
//locationManager.requestLocationUpdates(GPS_PROVIDER, 0, 0, 0, locListener);
// Getting Current Location
if (ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
}
location = locationManager.getLastKnownLocation(provider);
if(location!=null){
onLocationChanged(location);
}
locationManager.requestLocationUpdates(provider, 100, 0, this);
}
_share_button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
//Toast.makeText(getActivity(), "share_button", Toast.LENGTH_SHORT).show();
if (!flag) {
TranslateAnimation slide = new TranslateAnimation(0, 0, 100,0 );
slide.setDuration(1000);
slide.setFillAfter(true);
Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.bottomtotop);
_message_button.startAnimation(anim);
_watsapp_button.startAnimation(anim);
//_facebook_button.startAnimation(anim);
_message_button.setVisibility(View.VISIBLE);
//_facebook_button.setVisibility(View.VISIBLE );
_watsapp_button.setVisibility(View.VISIBLE);
flag=true;
}else {
Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.toptobottom);
_message_button.startAnimation(anim);
_watsapp_button.startAnimation(anim);
//_facebook_button.startAnimation(anim);
_message_button.setVisibility(View.INVISIBLE);
//_facebook_button.setVisibility(View.INVISIBLE );
_watsapp_button.setVisibility(View.INVISIBLE);
flag=false;
}
}
});
}
@Override
public void onResume() {
// TODO Auto-generated method stub
super.onResume();
// Insert the Ad Unit ID
callLocationUpdate();
}
@Override
public void onLocationChanged(Location location) {
//TextView tvLocation = new TextView(getActivity());
//(TextView) findViewById(R.id.tv_location);
//location.getAccuracy();
// Getting latitude of the current location
latitude = location.getLatitude();
// Getting longitude of the current location
longitude = location.getLongitude();
// Creating a LatLng object for the current location
LatLng latLng = new LatLng(latitude, longitude);
// Showing the current location in Google Map
try{
googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
// Zoom in the Google Map
googleMap.animateCamera(CameraUpdateFactory.zoomTo(16));
getLocationAddress(latitude,longitude);
}catch(NullPointerException e){
}
}
private void getLocationAddress( double latitude, double longitude){
try {
Geocoder geocoder = new Geocoder(getContext(), Locale.getDefault());
List<Address> addressList = geocoder.getFromLocation(
latitude, longitude, 1);
if (addressList != null && addressList.size() > 0) {
Address address = addressList.get(0);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < address.getMaxAddressLineIndex(); i++) {
sb.append(address.getAddressLine(i)).append("\n");
}
/* sb.append(address.getLocality()).append("\n");
sb.append(address.getPostalCode()).append("\n");*/
sb.append(address.getCountryName());
result = sb.toString();
// s_address=result;
Log.i("address", ""+result);
Log.i("getting latlang", ""+latitude+""+longitude);
}
} catch (IOException e) {
// Log.e("GetLocation Address", "Unable connect to Geocoder", e);
}catch (NullPointerException e) {
// TODO: handle exception
Toast.makeText(getActivity(), "some problem with google server", Toast.LENGTH_SHORT).show();
}
}
/*public String getMyCurrentLocation(double Lat,double Lang,Location location) {
try
{
// Getting address from found locations.
Geocoder geocoder;
List<Address> addresses;
geocoder = new Geocoder(getActivity(), Locale.getDefault());
addresses = geocoder.getFromLocation(Lat, Lang, 1);
System.out.println("latitide"+Lat);
System.out.println("langitude"+Lang);
StateName= addresses.get(0).getAdminArea();
CityName = addresses.get(0).getLocality();
CountryName = addresses.get(0).getCountryName();
addresses.get(0).getPostalCode();
addresses.get(0).getPremises();
addresses.get(0).getSubAdminArea();
addresses.get(0).getAddressLine(0);
addresses.get(0).getFeatureName();
addresses.get(0).getSubLocality();
Log.i(""+StateName+""+CityName+""+CountryName+CountryName+addresses.get(0).getPostalCode()+"\n"+ addresses.get(0).getPremises()+
addresses.get(0).getSubAdminArea()+addresses.get(0).getAddressLine(0)+ addresses.get(0).getFeatureName()+ addresses.get(0).getSubLocality()
+"\n", "detail adreesss");
// you can get more details other than this . like country code, state code, etc.
System.out.println(" StateName " + StateName);
System.out.println("\n"+" CityName " + CityName);
System.out.println("\n"+" CountryName " + CountryName);
System.out.println(" StateName " + addresses.get(0).getPostalCode());
System.out.println("\n"+" CityName " + addresses.get(0).getPremises());
System.out.println("\n"+" CountryName " + addresses.get(0).getSubAdminArea());
System.out.println(" Street Name " + addresses.get(0).getAddressLine(0));
System.out.println(" CityName " + addresses.get(0).getFeatureName());
System.out.println(" Area Name " + addresses.get(0).getSubLocality());
System.out.println(" premisis " + addresses.get(0).getPremises());
System.out.println(" phone " + addresses.get(0).getPhone());
System.out.println(" postal code " + addresses.get(0).getPostalCode());
System.out.println(" Sub Area " + addresses.get(0).getSubAdminArea());
}
catch (Exception e)
{
e.printStackTrace();
}
Toast.makeText(getActivity(), " StateName " + StateName +" CityName " + CityName +" CountryName " + CountryName, Toast.LENGTH_SHORT).show();
String returnaddress=StateName+"\n"+CityName+"\n"+CountryName;
return returnaddress;
}*/
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub
}
@Override
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
}
@Override
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
}
@Override
public void onClick(View view) {
// TODO Auto-generated method stub
switch (view.getId()) {
case R.id.watsapp_button:
//takeSnapshot();
//Uri imgUri=Uri.parse("android.resource://"+getActivity().getPackageName()+"/"+temp_photo);
// File tmpBitmap = getActivity().getFileStreamPath("tempfile_wip");
//address = _gettext.getText().toString();
//String uri = Uri.Builder().scheme("geo").appendPath(latitude +","+ longitude).appendQueryParameter("q", result).build();
//String uri = "http://maps.google.com/maps?saddr=" +latitude+","+longitude;
/*String uri = "geo:" + latitude + ","
+longitude + "?q=" + latitude
+ "," + longitude;*/
//Uri imgUri=Uri.parse("android.resource://my.package.name/"+tmpBitmap);
// Uri imgUri=Uri.parse("android.resource://"+getActivity().getPackageName()+"/"+tmpBitmap);
/*String uri =
"http://maps.google.com/maps?q=" + latitude + "," + latitude + "&iwloc=A";
Uri myUri = Uri.parse(uri);*/
CheckInternetConnection intenercheck=new CheckInternetConnection(getActivity());
if (!intenercheck.CheckInternet()) {
InternetCheckDialog dialog=new InternetCheckDialog(getActivity());
dialog.showDialog();
}
else{
if(result!=null){
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
//Target whatsapp:
shareIntent.setPackage("com.whatsapp");
//Add text and then Image URI
shareIntent.putExtra(Intent.EXTRA_TEXT, result);
// System.out.println(result);
// System.out.println(uri);
//for sending image as location
/* shareIntent.putExtra(Intent.EXTRA_STREAM, imgUri);
shareIntent.setType("image/*");*/
shareIntent.setType("text/plain");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
try {
startActivity(shareIntent);
} catch (android.content.ActivityNotFoundException ex) {
//ToastHelper.MakeShortText("Whatsapp have not been installed.");
}
}else{
callLocationUpdate();
Toast.makeText(getActivity(), "please wait loaction nedd to be get updated", Toast.LENGTH_SHORT).show();
}
}
break;
/*case R.id.facebook_button:
break;*/
case R.id.message_button:
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, 1);
break;
}
}
private void sendSMS(String phoneNumber, String message) {
ArrayList<PendingIntent> sentPendingIntents = new ArrayList<PendingIntent>();
ArrayList<PendingIntent> deliveredPendingIntents = new ArrayList<PendingIntent>();
PendingIntent sentPI = PendingIntent.getBroadcast(getActivity(), 0,
new Intent(getActivity(), SmsSentReceiver.class), 0);
PendingIntent deliveredPI = PendingIntent.getBroadcast(getActivity(), 0,
new Intent(getActivity(), SmsDeliveredReceiver.class), 0);
try {
SmsManager sms = SmsManager.getDefault();
ArrayList<String> mSMSMessage = sms.divideMessage(message);
for (int i = 0; i < mSMSMessage.size(); i++) {
sentPendingIntents.add(i, sentPI);
deliveredPendingIntents.add(i, deliveredPI);
}
sms.sendMultipartTextMessage(phoneNumber, null, mSMSMessage,
sentPendingIntents, deliveredPendingIntents);
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(getContext(), "SMS sending failed...",Toast.LENGTH_SHORT).show();
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case (1) :
/* if (resultCode == Activity.RESULT_OK) {
Uri contactData = data.getData();
Cursor c = getActivity().managedQuery(contactData, null, null, null, null);
if (c.moveToFirst()) {
String name = c.getString(c.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
String number=c.getString(c.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));
Log.d("", ""+name);
Log.d("number", ""+number);
// TODO Fetch other Contact details as you want to use
}
}*/
if (resultCode == Activity.RESULT_OK) {
Uri contactData = data.getData();
Cursor c = getActivity().managedQuery(contactData, null, null, null, null);
if (c.moveToFirst()) {
String id =c.getString(c.getColumnIndexOrThrow(ContactsContract.Contacts._ID));
String hasPhone =c.getString(c.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));
if (hasPhone.equalsIgnoreCase("1")) {
Cursor phones = getActivity().getContentResolver().query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ id,
null, null);
phones.moveToFirst();
ContactNumber = phones.getString(phones.getColumnIndex("data1"));
System.out.println("number is:"+ContactNumber);
}
name = c.getString(c.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
System.out.println("name is:"+name);
if(result!=null){
if ((ContactNumber!=null)&&(name!=null)) {
sendSMS(ContactNumber, result);
}else {
Toast.makeText(getActivity(), "need to select contact", Toast.LENGTH_SHORT).show();
}
}else{
Toast.makeText(getActivity(), "Please wait loaction need to be get updated", Toast.LENGTH_SHORT).show();
}
}
}
break;
}
}
public void onScreenshot(View view) {
takeSnapshot();
}
/* private void initShareIntent(String type,String _text){
File filePath = getFileStreamPath("shareimage.jpg"); //optional //internal storage
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_TEXT, _text);
shareIntent.putExtra(Intent.EXTRA_STREAM,Uri.fromFile(new File(filePath))); //optional//use this when you want to send an image
shareIntent.setType("image/jpeg");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent, "send"));
}*/
private void takeSnapshot() {
if (googleMap == null) {
return;
}
final SnapshotReadyCallback callback = new SnapshotReadyCallback() {
@Override
public void onSnapshotReady(Bitmap snapshot) {
// Callback is called from the main thread, so we can modify the ImageView safely.
_snapshot=snapshot;
snapshotHolder.setImageBitmap(snapshot);
ByteArrayOutputStream stream=new ByteArrayOutputStream();
snapshot.compress(Bitmap.CompressFormat.JPEG, 90, stream);
temp_photo=stream.toByteArray();
System.out.println(snapshotHolder+"snap shot ");
String fileName = "tempfile_wip";
try {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
snapshot.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
FileOutputStream fo = getActivity().openFileOutput(fileName, Context.MODE_PRIVATE);
fo.write(bytes.toByteArray());
fo.close();
/* Intent i = new Intent(getApplicationContext(), apply_effects.class);
startActivity(i);*/
} catch (Exception e) {
Toast.makeText(getActivity(), "Error 010", Toast.LENGTH_SHORT).show();
}
}
};
/*if (mWaitForMapLoadCheckBox.isChecked()) {
googleMap.setOnMapLoadedCallback(new OnMapLoadedCallback() {
@Override
public void onMapLoaded() {
mMap.snapshot(callback);
}
});
} else {*/
googleMap.snapshot(callback);
//}
}
@Override
public void onMapReady(GoogleMap map) {
// TODO Auto-generated method stub
googleMap=map;
}
} | [
"[email protected]"
] | |
0bceb19058374048374fdbf6be7ecce88c187fbd | d17a6c0d0eee7b61374d4dbfd0b3a7d13952aade | /app/src/main/java/com/example/mr/yihuanhuishou/adapter/Driver_quhuo_adapter.java | ec1097337f84e6f0a00bd0f6954c73c2e19d9f71 | [] | no_license | Mrzhaoplus/YiHuanHuiShou | 6649c130105e44d1239ddccdf6323291a2777db0 | 0829d43b1ffe92c8d0f718ecdcad840ad26c65a5 | refs/heads/master | 2020-03-14T21:27:08.829743 | 2018-09-20T01:18:01 | 2018-09-20T01:18:01 | 131,796,353 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,788 | java | package com.example.mr.yihuanhuishou.adapter;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.example.mr.yihuanhuishou.R;
import com.example.mr.yihuanhuishou.activity.Clame_Goods_DetailsActivity;
import com.example.mr.yihuanhuishou.activity.Driver_dingdan_DetailsActivity;
import com.example.mr.yihuanhuishou.utils.ToastUtils;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Mr赵 on 2018/5/7.
*/
public class Driver_quhuo_adapter extends RecyclerView.Adapter<Driver_quhuo_adapter.Holder> {
Context context;
List<String>list=new ArrayList<>();
public Driver_quhuo_adapter(Context context) {
this.context = context;
data();
}
private void data() {
for(int i=0;i<8;i++){
list.add("");
}
}
@Override
public Holder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.driver_quhuo_adapter, parent, false);
Holder holder = new Holder(view);
return holder;
}
@Override
public void onBindViewHolder(Holder holder, final int position) {
//取消
holder.quxiao.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ToastUtils.getToast(context,"取消订单");
}
});
//点击事件
holder.view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(context, Clame_Goods_DetailsActivity.class);
context.startActivity(intent);
}
});
}
@Override
public int getItemCount() {
return list.size();
}
public class Holder extends RecyclerView.ViewHolder{
public View view;
public TextView bian;
public TextView state;
public TextView sort;
public TextView zhong;
public LinearLayout quxiao;
public RelativeLayout clo_bill;
public Holder(View itemView) {
super(itemView);
view = itemView;
bian = itemView.findViewById(R.id.jie_bh);
state = itemView.findViewById(R.id.jie_state);
sort = itemView.findViewById(R.id.jie_lx);
zhong = itemView.findViewById(R.id.jie_zl);
quxiao = itemView.findViewById(R.id.jie_qx);
clo_bill = itemView.findViewById(R.id.clo_bill);
}
}
}
| [
"[[email protected]]"
] | |
28cfc0af72ca77d542d5f9487d7ee9cd25f0034d | 7d3debfedd2feffa7e8c21b287e5e414de9e7f6e | /src/main/java/net/madz/lifecycle/solutionThree/ServiceableLifecycleMeta.java | 8d3db89532e1c769007a4446b97f0ab258be94a1 | [] | no_license | zhongdj/javassist.bcel.samples | 7282d3ee8f3eb0770f364fb5cd8f091bdca18feb | b616b0f7667d9ae17939ef7287f071484f6a484e | refs/heads/master | 2020-12-24T14:57:30.521827 | 2013-10-24T05:34:36 | 2013-10-24T05:34:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,878 | java | package net.madz.lifecycle.solutionThree;
import net.madz.lifecycle.annotations.Function;
import net.madz.lifecycle.annotations.Functions;
import net.madz.lifecycle.annotations.StateMachine;
import net.madz.lifecycle.annotations.StateSet;
import net.madz.lifecycle.annotations.TransitionSet;
import net.madz.lifecycle.annotations.state.End;
import net.madz.lifecycle.annotations.state.Initial;
import net.madz.lifecycle.demo.standalone.ServiceableLifecycleMeta.Transitions.Cancel;
import net.madz.lifecycle.demo.standalone.ServiceableLifecycleMeta.Transitions.Finish;
import net.madz.lifecycle.demo.standalone.ServiceableLifecycleMeta.Transitions.Schedule;
import net.madz.lifecycle.demo.standalone.ServiceableLifecycleMeta.Transitions.Start;
/**
* There won't be any implementation of this interface, since this interface is
* ONLY meta data of serviceable life cycle.
*
* @author Barry
*
*/
@StateMachine
public interface ServiceableLifecycleMeta {
@StateSet
public static class States {
@Initial
@Function(transition = Schedule.class, value = Queued.class)
public static class Created {}
@Functions({ @Function(transition = Start.class, value = Ongoing.class),
@Function(transition = Cancel.class, value = Cancelled.class) })
public static class Queued {}
@Functions({ @Function(transition = Finish.class, value = Finished.class),
@Function(transition = Cancel.class, value = Cancelled.class) })
public static class Ongoing {}
@End
public static class Finished {}
@End
public static class Cancelled {}
}
@TransitionSet
public static class Transitions {
public static class Schedule {}
public static class Start {}
public static class Finish {}
public static class Cancel {}
}
} | [
"[email protected]"
] | |
1809a9cf3f6271c2e099ce3aa62ec371d9485983 | 085239b995406cbcce9e86651567fb80af1d56b1 | /src/main/java/com/example/algorithm/bitManipulation/PrintBitsOfInteger.java | 8ad0c793e1760abd9b4b780500dda3eb581023d3 | [] | no_license | chankibiswas/algorithm | 83b980168cef41aba0b58a369a8c26f8689d4cd7 | 32e6b5ef2d618aba260eb7ce1adbf30fe51ec0f4 | refs/heads/master | 2023-08-29T04:56:30.984903 | 2021-11-08T07:57:42 | 2021-11-08T07:57:59 | 294,657,374 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 534 | java | package com.example.algorithm.bitManipulation;
/*
Input would be normal integer.
The api will print bits in it.
*/
public class PrintBitsOfInteger {
public static void main(final String[] s) {
printBitsInInteger(4);
}
public static void printBitsInInteger(final int n) {
for (int i = 31; i >= 0; i--) {
final int mask = 1 << i;
if ((n & mask) != 0) {
System.out.print(1);
} else {
System.out.print(0);
}
}
}
}
| [
"[email protected]"
] | |
45e7ba94cfcd9ec69f5e3ba90ed87e17ff078e99 | b962db7ffe12e27949557727558dded36b553501 | /app/src/main/java/test/bwie/com/zhaoxixiang1508bjd/view/fragment/FragFaxian.java | f3a2103a5af752a5c50c0ac9545cae4f6cea9668 | [] | no_license | zxx1997/Zhaoxixiang1508bJD | 6e89ed03cccdcc50be969bc99330f6efde0e3912 | a7a640e3c5d524c8d164849a2a4c0e8e2bbea91d | refs/heads/master | 2021-08-26T07:05:11.373462 | 2017-11-22T01:07:21 | 2017-11-22T01:07:21 | 111,619,071 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 680 | java | package test.bwie.com.zhaoxixiang1508bjd.view.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import test.bwie.com.zhaoxixiang1508bjd.R;
/**
* Created by admin on 2017/11/01/001.
*/
public class FragFaxian extends Fragment{
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view=LayoutInflater.from(getActivity()).inflate(R.layout.frag_faxian,container,false);
return view;
}
}
| [
"[email protected]"
] | |
2616b840c12626e35e4a2a132c44ac2950d74acf | c749796ae10487401e92c6a63deef52ba3ae8b8f | /utility-core/src/main/java/com/lector/util/tabular/io/OutputStreamTabularDocumentProducer.java | 4fc0c8d4b792cefd9d4e3ba524feb4c10e6a6091 | [] | no_license | reza-mousavi/csv-java-mapper | 22df2db20debd986c36a11a21d92196d213f908a | 57a5801c213f30b8d62f77bed3f096eee0173dae | refs/heads/master | 2021-06-06T03:37:43.576520 | 2016-07-27T08:14:04 | 2016-07-27T08:14:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 196 | java | package com.lector.util.tabular.io;
/**
* Created by Reza Mousavi [email protected] on 7/18/2016
*/
public class OutputStreamTabularDocumentProducer implements TabularDocumentProducer {
}
| [
"[email protected]"
] | |
92fa71327454d9853013614a6301af801ecf5e99 | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project239/src/test/java/org/gradle/test/performance/largejavamultiproject/project239/p1199/Test23997.java | 3df93ed744d6242a9bfff3327f1b3ff3a14609d8 | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,113 | java | package org.gradle.test.performance.largejavamultiproject.project239.p1199;
import org.junit.Test;
import static org.junit.Assert.*;
public class Test23997 {
Production23997 objectUnderTest = new Production23997();
@Test
public void testProperty0() {
String value = "value";
objectUnderTest.setProperty0(value);
assertEquals(value, objectUnderTest.getProperty0());
}
@Test
public void testProperty1() {
String value = "value";
objectUnderTest.setProperty1(value);
assertEquals(value, objectUnderTest.getProperty1());
}
@Test
public void testProperty2() {
String value = "value";
objectUnderTest.setProperty2(value);
assertEquals(value, objectUnderTest.getProperty2());
}
@Test
public void testProperty3() {
String value = "value";
objectUnderTest.setProperty3(value);
assertEquals(value, objectUnderTest.getProperty3());
}
@Test
public void testProperty4() {
String value = "value";
objectUnderTest.setProperty4(value);
assertEquals(value, objectUnderTest.getProperty4());
}
@Test
public void testProperty5() {
String value = "value";
objectUnderTest.setProperty5(value);
assertEquals(value, objectUnderTest.getProperty5());
}
@Test
public void testProperty6() {
String value = "value";
objectUnderTest.setProperty6(value);
assertEquals(value, objectUnderTest.getProperty6());
}
@Test
public void testProperty7() {
String value = "value";
objectUnderTest.setProperty7(value);
assertEquals(value, objectUnderTest.getProperty7());
}
@Test
public void testProperty8() {
String value = "value";
objectUnderTest.setProperty8(value);
assertEquals(value, objectUnderTest.getProperty8());
}
@Test
public void testProperty9() {
String value = "value";
objectUnderTest.setProperty9(value);
assertEquals(value, objectUnderTest.getProperty9());
}
} | [
"[email protected]"
] | |
23118a93a449eb934767af906bdf199063159d69 | bb86cc3ec7c64af6e70e1cd89d97f5b4185b3550 | /src/main/java/com/example/dto/userinfo/LoginMessageDTO.java | 35a4531878593c5974a449c115ed860e3622ea33 | [] | no_license | fenghuolibie/editor4 | a4a856de1b97a315e9f548097c1bad56e5778e66 | 0621e4fce2b493beb21aa5115f6803a568425f00 | refs/heads/master | 2020-03-23T12:13:52.548601 | 2018-09-07T01:10:25 | 2018-09-07T01:10:25 | 141,545,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 507 | java | package com.example.dto.userinfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 用于封装登录信息的传输对象
*/
@Data
public class LoginMessageDTO {
@ApiModelProperty(value = "用户名",example = "李德龙")
private String userName;
@ApiModelProperty(value = "用户密码",example = "123")
private String passWord;
@ApiModelProperty(value = "用户所属部门",example = "信息所",hidden = true)
private String departmentName;
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.