blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
ba9afb6d301af913e596bef2effd346d1ec43c9a
aeb7379493ba0127bd7f0abcdac604ec807bf5f5
/GestionareLocuriDeVeci/src/dto/CerereInhumareDTO.java
03a27e5fdd47f6bc35a1fec7cfa6bfac38aeef0c
[]
no_license
lrdTnc/proiectcolectiv
8a6290f8250d8a0ac351a1052dbd125cb56fed67
1f7865b1536ef578481ba6d6238569028573f909
refs/heads/master
2021-05-28T04:07:18.789473
2015-01-17T17:52:57
2015-01-17T17:52:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
795
java
package dto; import domain.CerereInhumare; public class CerereInhumareDTO { private ConcesionarDTO concesionarDTO; private CerereInhumare cerereInhumare; public CerereInhumareDTO() { super(); } public CerereInhumareDTO(ConcesionarDTO concesionarDTO, CerereInhumare cerereInhumare) { super(); this.concesionarDTO = concesionarDTO; this.cerereInhumare = cerereInhumare; } public ConcesionarDTO getConcesionarDTO() { return concesionarDTO; } public void setConcesionarDTO(ConcesionarDTO concesionarDTO) { this.concesionarDTO = concesionarDTO; } public CerereInhumare getCerereInhumare() { return cerereInhumare; } public void setCerereInhumare(CerereInhumare cerereInhumare) { this.cerereInhumare = cerereInhumare; } }
[ "Bia@Bia-PC" ]
Bia@Bia-PC
3ef90571481f301656aaae245ac1935ecd8bb6f8
7432089b21d3ff1f772c9968d8f86e4f18be9fd9
/src/main/java/mk/learning/HRApps/Services/EmployeeInterceptorAppConfig.java
645ea53f43b39060d7051eaea7fa15328604e797
[ "MIT" ]
permissive
keerthana-mk/HRApps_SF_Integration
c26783f25676c84499f1a8a5dd8a5952949618f8
67a5e94750eb4409dc5ed8ce58a3391077969752
refs/heads/master
2022-04-04T00:47:37.083452
2020-02-24T05:10:39
2020-02-24T05:10:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
604
java
package mk.learning.HRApps.Services; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; @Component public class EmployeeInterceptorAppConfig extends WebMvcConfigurationSupport { @Autowired EmployeeInterceptor employeeInterceptor; @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(employeeInterceptor); } }
[ "noreply@github.com" ]
noreply@github.com
69f5ad7bf1da4d243ad7c2e272fbb9e5f1a791e3
a697cc95da205533ce04e347d6e85c9717a2ca07
/examples/android-simple/src/main/java/com/example/dagger/simple/dummy/DummyClass497.java
eefdfb82d314b9e3b2899fe21cb94c36a70c9249
[ "Apache-2.0" ]
permissive
jasta/dagger
ee248b5b98782fb2fb8d5b7248cb91241783966f
4c6f7e6c676bec65b27ce41a52710728f89716fa
refs/heads/master
2021-01-16T01:06:51.734316
2013-09-16T02:13:55
2013-09-16T02:18:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
105
java
package com.example.dagger.simple.dummy; public interface DummyClass497 { public void printHello(); }
[ "jasta@devtcg.org" ]
jasta@devtcg.org
93256a0038b668de1d5b5396c3e1ae748e5f3482
b5f21292847abe2dcd6d457605695983b2427fbe
/app/src/main/java/pl/code_zone/praca_licencjacka/utils/SessionManager.java
e5a1d5f153df2163285b51eeb3baa92016accf9f
[]
no_license
Hippo14/Praca_Licencjacka
8312fc2ca5610b126041ba4a9a5ee605ddafa74a
173a825f123c546cd29d9d6eaa44ff5665449ea6
refs/heads/master
2021-01-11T02:31:59.892255
2017-06-27T22:05:39
2017-06-27T22:05:39
70,925,077
0
0
null
2017-05-04T15:39:28
2016-10-14T15:52:18
Java
UTF-8
Java
false
false
2,662
java
package pl.code_zone.praca_licencjacka.utils; import android.content.Context; import android.content.SharedPreferences; import android.location.Location; import com.google.android.gms.maps.model.LatLng; import com.google.gson.Gson; /** * Created by MSI on 2016-11-13. */ public class SessionManager { // Instance private static SessionManager ourInstance; // Shared Preferences private static SharedPreferences sharedPreferences; private static SharedPreferences.Editor editor; // Context private static Context context; // Shared pref mode private static final int PRIVATE_MODE = 0; // Shared preferences file name private static final String PREF_NAME = "PracaLicencjacka"; //Shared preferences keys private static final String KEY_IS_TOKEN = "token"; private static final String KEY_IS_MESSAGE = "message"; private static final String KEY_IS_LOCATION = "location"; private static Location location; private SessionManager() { } private static void init(Context context) { SessionManager.context = context; SessionManager.sharedPreferences = context.getSharedPreferences(PREF_NAME, PRIVATE_MODE); SessionManager.editor = sharedPreferences.edit(); } public static SessionManager getInstance(Context context) { if (ourInstance == null) { ourInstance = new SessionManager(); ourInstance.init(context); } return SessionManager.ourInstance; } public static void setToken(String token) { editor.putString(KEY_IS_TOKEN, token); editor.commit(); } public static String getToken() { return sharedPreferences.getString(KEY_IS_TOKEN, "empty"); } public static void setMessage(String message) { editor.putString(KEY_IS_MESSAGE, message); editor.commit(); } public static String getMessaage() { String msg = sharedPreferences.getString(KEY_IS_MESSAGE, null); setMessage(null); return msg; } public static void setLocation(LatLng location) { Gson gson = new Gson(); String json = gson.toJson(location); editor.putString(KEY_IS_LOCATION, json); editor.commit(); } public static LatLng getLocation() { Gson gson = new Gson(); String json = sharedPreferences.getString(KEY_IS_LOCATION, null); LatLng object = null; if (json != null) { object = gson.fromJson(json, LatLng.class); } return object; } public static void clearSession() { editor.clear(); editor.commit(); } }
[ "hippo14@gmail.com" ]
hippo14@gmail.com
c157f213d44baf1c688585030a24987eafa7f905
290b3aee32ab2a9c790464dc36fa237ca7519266
/src/main/java/com/entity/DetailsExample.java
759897c3644b22d497b76d0d893edd9b9ba37a55
[]
no_license
1720261670/pawn
cb5e95ed904b83a0b34a65b503fa7b0388ac004b
8005453352f861b7814164cb38ecd89395d5d09f
refs/heads/master
2020-05-06T13:55:53.644669
2019-04-11T01:18:24
2019-04-11T01:18:24
180,163,869
0
0
null
null
null
null
UTF-8
Java
false
false
27,709
java
package com.entity; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; public class DetailsExample { /** * This field was generated by MyBatis Generator. * This field corresponds to the database table details * * @mbggenerated Mon Apr 08 22:05:46 CST 2019 */ protected String orderByClause; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table details * * @mbggenerated Mon Apr 08 22:05:46 CST 2019 */ protected boolean distinct; /** * This field was generated by MyBatis Generator. * This field corresponds to the database table details * * @mbggenerated Mon Apr 08 22:05:46 CST 2019 */ protected List<Criteria> oredCriteria; /** * This method was generated by MyBatis Generator. * This method corresponds to the database table details * * @mbggenerated Mon Apr 08 22:05:46 CST 2019 */ public DetailsExample() { oredCriteria = new ArrayList<Criteria>(); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table details * * @mbggenerated Mon Apr 08 22:05:46 CST 2019 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table details * * @mbggenerated Mon Apr 08 22:05:46 CST 2019 */ public String getOrderByClause() { return orderByClause; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table details * * @mbggenerated Mon Apr 08 22:05:46 CST 2019 */ public void setDistinct(boolean distinct) { this.distinct = distinct; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table details * * @mbggenerated Mon Apr 08 22:05:46 CST 2019 */ public boolean isDistinct() { return distinct; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table details * * @mbggenerated Mon Apr 08 22:05:46 CST 2019 */ public List<Criteria> getOredCriteria() { return oredCriteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table details * * @mbggenerated Mon Apr 08 22:05:46 CST 2019 */ public void or(Criteria criteria) { oredCriteria.add(criteria); } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table details * * @mbggenerated Mon Apr 08 22:05:46 CST 2019 */ 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 details * * @mbggenerated Mon Apr 08 22:05:46 CST 2019 */ 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 details * * @mbggenerated Mon Apr 08 22:05:46 CST 2019 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } /** * This method was generated by MyBatis Generator. * This method corresponds to the database table details * * @mbggenerated Mon Apr 08 22:05:46 CST 2019 */ public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table details * * @mbggenerated Mon Apr 08 22:05:46 CST 2019 */ 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)); } protected void addCriterionForJDBCDate(String condition, Date value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } addCriterion(condition, new java.sql.Date(value.getTime()), property); } protected void addCriterionForJDBCDate(String condition, List<Date> values, String property) { if (values == null || values.size() == 0) { throw new RuntimeException("Value list for " + property + " cannot be null or empty"); } List<java.sql.Date> dateList = new ArrayList<java.sql.Date>(); Iterator<Date> iter = values.iterator(); while (iter.hasNext()) { dateList.add(new java.sql.Date(iter.next().getTime())); } addCriterion(condition, dateList, property); } protected void addCriterionForJDBCDate(String condition, Date value1, Date value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } addCriterion(condition, new java.sql.Date(value1.getTime()), new java.sql.Date(value2.getTime()), property); } public Criteria andDetailsIdIsNull() { addCriterion("details_id is null"); return (Criteria) this; } public Criteria andDetailsIdIsNotNull() { addCriterion("details_id is not null"); return (Criteria) this; } public Criteria andDetailsIdEqualTo(Integer value) { addCriterion("details_id =", value, "detailsId"); return (Criteria) this; } public Criteria andDetailsIdNotEqualTo(Integer value) { addCriterion("details_id <>", value, "detailsId"); return (Criteria) this; } public Criteria andDetailsIdGreaterThan(Integer value) { addCriterion("details_id >", value, "detailsId"); return (Criteria) this; } public Criteria andDetailsIdGreaterThanOrEqualTo(Integer value) { addCriterion("details_id >=", value, "detailsId"); return (Criteria) this; } public Criteria andDetailsIdLessThan(Integer value) { addCriterion("details_id <", value, "detailsId"); return (Criteria) this; } public Criteria andDetailsIdLessThanOrEqualTo(Integer value) { addCriterion("details_id <=", value, "detailsId"); return (Criteria) this; } public Criteria andDetailsIdIn(List<Integer> values) { addCriterion("details_id in", values, "detailsId"); return (Criteria) this; } public Criteria andDetailsIdNotIn(List<Integer> values) { addCriterion("details_id not in", values, "detailsId"); return (Criteria) this; } public Criteria andDetailsIdBetween(Integer value1, Integer value2) { addCriterion("details_id between", value1, value2, "detailsId"); return (Criteria) this; } public Criteria andDetailsIdNotBetween(Integer value1, Integer value2) { addCriterion("details_id not between", value1, value2, "detailsId"); return (Criteria) this; } public Criteria andUserIdIsNull() { addCriterion("user_id is null"); return (Criteria) this; } public Criteria andUserIdIsNotNull() { addCriterion("user_id is not null"); return (Criteria) this; } public Criteria andUserIdEqualTo(Integer value) { addCriterion("user_id =", value, "userId"); return (Criteria) this; } public Criteria andUserIdNotEqualTo(Integer value) { addCriterion("user_id <>", value, "userId"); return (Criteria) this; } public Criteria andUserIdGreaterThan(Integer value) { addCriterion("user_id >", value, "userId"); return (Criteria) this; } public Criteria andUserIdGreaterThanOrEqualTo(Integer value) { addCriterion("user_id >=", value, "userId"); return (Criteria) this; } public Criteria andUserIdLessThan(Integer value) { addCriterion("user_id <", value, "userId"); return (Criteria) this; } public Criteria andUserIdLessThanOrEqualTo(Integer value) { addCriterion("user_id <=", value, "userId"); return (Criteria) this; } public Criteria andUserIdIn(List<Integer> values) { addCriterion("user_id in", values, "userId"); return (Criteria) this; } public Criteria andUserIdNotIn(List<Integer> values) { addCriterion("user_id not in", values, "userId"); return (Criteria) this; } public Criteria andUserIdBetween(Integer value1, Integer value2) { addCriterion("user_id between", value1, value2, "userId"); return (Criteria) this; } public Criteria andUserIdNotBetween(Integer value1, Integer value2) { addCriterion("user_id not between", value1, value2, "userId"); return (Criteria) this; } public Criteria andFamilyNameIsNull() { addCriterion("family_name is null"); return (Criteria) this; } public Criteria andFamilyNameIsNotNull() { addCriterion("family_name is not null"); return (Criteria) this; } public Criteria andFamilyNameEqualTo(String value) { addCriterion("family_name =", value, "familyName"); return (Criteria) this; } public Criteria andFamilyNameNotEqualTo(String value) { addCriterion("family_name <>", value, "familyName"); return (Criteria) this; } public Criteria andFamilyNameGreaterThan(String value) { addCriterion("family_name >", value, "familyName"); return (Criteria) this; } public Criteria andFamilyNameGreaterThanOrEqualTo(String value) { addCriterion("family_name >=", value, "familyName"); return (Criteria) this; } public Criteria andFamilyNameLessThan(String value) { addCriterion("family_name <", value, "familyName"); return (Criteria) this; } public Criteria andFamilyNameLessThanOrEqualTo(String value) { addCriterion("family_name <=", value, "familyName"); return (Criteria) this; } public Criteria andFamilyNameLike(String value) { addCriterion("family_name like", value, "familyName"); return (Criteria) this; } public Criteria andFamilyNameNotLike(String value) { addCriterion("family_name not like", value, "familyName"); return (Criteria) this; } public Criteria andFamilyNameIn(List<String> values) { addCriterion("family_name in", values, "familyName"); return (Criteria) this; } public Criteria andFamilyNameNotIn(List<String> values) { addCriterion("family_name not in", values, "familyName"); return (Criteria) this; } public Criteria andFamilyNameBetween(String value1, String value2) { addCriterion("family_name between", value1, value2, "familyName"); return (Criteria) this; } public Criteria andFamilyNameNotBetween(String value1, String value2) { addCriterion("family_name not between", value1, value2, "familyName"); return (Criteria) this; } public Criteria andNameIsNull() { addCriterion("name is null"); return (Criteria) this; } public Criteria andNameIsNotNull() { addCriterion("name is not null"); return (Criteria) this; } public Criteria andNameEqualTo(String value) { addCriterion("name =", value, "name"); return (Criteria) this; } public Criteria andNameNotEqualTo(String value) { addCriterion("name <>", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThan(String value) { addCriterion("name >", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThanOrEqualTo(String value) { addCriterion("name >=", value, "name"); return (Criteria) this; } public Criteria andNameLessThan(String value) { addCriterion("name <", value, "name"); return (Criteria) this; } public Criteria andNameLessThanOrEqualTo(String value) { addCriterion("name <=", value, "name"); return (Criteria) this; } public Criteria andNameLike(String value) { addCriterion("name like", value, "name"); return (Criteria) this; } public Criteria andNameNotLike(String value) { addCriterion("name not like", value, "name"); return (Criteria) this; } public Criteria andNameIn(List<String> values) { addCriterion("name in", values, "name"); return (Criteria) this; } public Criteria andNameNotIn(List<String> values) { addCriterion("name not in", values, "name"); return (Criteria) this; } public Criteria andNameBetween(String value1, String value2) { addCriterion("name between", value1, value2, "name"); return (Criteria) this; } public Criteria andNameNotBetween(String value1, String value2) { addCriterion("name not between", value1, value2, "name"); return (Criteria) this; } public Criteria andNationalityIsNull() { addCriterion("nationality is null"); return (Criteria) this; } public Criteria andNationalityIsNotNull() { addCriterion("nationality is not null"); return (Criteria) this; } public Criteria andNationalityEqualTo(String value) { addCriterion("nationality =", value, "nationality"); return (Criteria) this; } public Criteria andNationalityNotEqualTo(String value) { addCriterion("nationality <>", value, "nationality"); return (Criteria) this; } public Criteria andNationalityGreaterThan(String value) { addCriterion("nationality >", value, "nationality"); return (Criteria) this; } public Criteria andNationalityGreaterThanOrEqualTo(String value) { addCriterion("nationality >=", value, "nationality"); return (Criteria) this; } public Criteria andNationalityLessThan(String value) { addCriterion("nationality <", value, "nationality"); return (Criteria) this; } public Criteria andNationalityLessThanOrEqualTo(String value) { addCriterion("nationality <=", value, "nationality"); return (Criteria) this; } public Criteria andNationalityLike(String value) { addCriterion("nationality like", value, "nationality"); return (Criteria) this; } public Criteria andNationalityNotLike(String value) { addCriterion("nationality not like", value, "nationality"); return (Criteria) this; } public Criteria andNationalityIn(List<String> values) { addCriterion("nationality in", values, "nationality"); return (Criteria) this; } public Criteria andNationalityNotIn(List<String> values) { addCriterion("nationality not in", values, "nationality"); return (Criteria) this; } public Criteria andNationalityBetween(String value1, String value2) { addCriterion("nationality between", value1, value2, "nationality"); return (Criteria) this; } public Criteria andNationalityNotBetween(String value1, String value2) { addCriterion("nationality not between", value1, value2, "nationality"); return (Criteria) this; } public Criteria andBirthdayIsNull() { addCriterion("birthday is null"); return (Criteria) this; } public Criteria andBirthdayIsNotNull() { addCriterion("birthday is not null"); return (Criteria) this; } public Criteria andBirthdayEqualTo(Date value) { addCriterionForJDBCDate("birthday =", value, "birthday"); return (Criteria) this; } public Criteria andBirthdayNotEqualTo(Date value) { addCriterionForJDBCDate("birthday <>", value, "birthday"); return (Criteria) this; } public Criteria andBirthdayGreaterThan(Date value) { addCriterionForJDBCDate("birthday >", value, "birthday"); return (Criteria) this; } public Criteria andBirthdayGreaterThanOrEqualTo(Date value) { addCriterionForJDBCDate("birthday >=", value, "birthday"); return (Criteria) this; } public Criteria andBirthdayLessThan(Date value) { addCriterionForJDBCDate("birthday <", value, "birthday"); return (Criteria) this; } public Criteria andBirthdayLessThanOrEqualTo(Date value) { addCriterionForJDBCDate("birthday <=", value, "birthday"); return (Criteria) this; } public Criteria andBirthdayIn(List<Date> values) { addCriterionForJDBCDate("birthday in", values, "birthday"); return (Criteria) this; } public Criteria andBirthdayNotIn(List<Date> values) { addCriterionForJDBCDate("birthday not in", values, "birthday"); return (Criteria) this; } public Criteria andBirthdayBetween(Date value1, Date value2) { addCriterionForJDBCDate("birthday between", value1, value2, "birthday"); return (Criteria) this; } public Criteria andBirthdayNotBetween(Date value1, Date value2) { addCriterionForJDBCDate("birthday not between", value1, value2, "birthday"); return (Criteria) this; } public Criteria andPhoneIsNull() { addCriterion("phone is null"); return (Criteria) this; } public Criteria andPhoneIsNotNull() { addCriterion("phone is not null"); return (Criteria) this; } public Criteria andPhoneEqualTo(String value) { addCriterion("phone =", value, "phone"); return (Criteria) this; } public Criteria andPhoneNotEqualTo(String value) { addCriterion("phone <>", value, "phone"); return (Criteria) this; } public Criteria andPhoneGreaterThan(String value) { addCriterion("phone >", value, "phone"); return (Criteria) this; } public Criteria andPhoneGreaterThanOrEqualTo(String value) { addCriterion("phone >=", value, "phone"); return (Criteria) this; } public Criteria andPhoneLessThan(String value) { addCriterion("phone <", value, "phone"); return (Criteria) this; } public Criteria andPhoneLessThanOrEqualTo(String value) { addCriterion("phone <=", value, "phone"); return (Criteria) this; } public Criteria andPhoneLike(String value) { addCriterion("phone like", value, "phone"); return (Criteria) this; } public Criteria andPhoneNotLike(String value) { addCriterion("phone not like", value, "phone"); return (Criteria) this; } public Criteria andPhoneIn(List<String> values) { addCriterion("phone in", values, "phone"); return (Criteria) this; } public Criteria andPhoneNotIn(List<String> values) { addCriterion("phone not in", values, "phone"); return (Criteria) this; } public Criteria andPhoneBetween(String value1, String value2) { addCriterion("phone between", value1, value2, "phone"); return (Criteria) this; } public Criteria andPhoneNotBetween(String value1, String value2) { addCriterion("phone not between", value1, value2, "phone"); return (Criteria) this; } public Criteria andEmailIsNull() { addCriterion("email is null"); return (Criteria) this; } public Criteria andEmailIsNotNull() { addCriterion("email is not null"); return (Criteria) this; } public Criteria andEmailEqualTo(String value) { addCriterion("email =", value, "email"); return (Criteria) this; } public Criteria andEmailNotEqualTo(String value) { addCriterion("email <>", value, "email"); return (Criteria) this; } public Criteria andEmailGreaterThan(String value) { addCriterion("email >", value, "email"); return (Criteria) this; } public Criteria andEmailGreaterThanOrEqualTo(String value) { addCriterion("email >=", value, "email"); return (Criteria) this; } public Criteria andEmailLessThan(String value) { addCriterion("email <", value, "email"); return (Criteria) this; } public Criteria andEmailLessThanOrEqualTo(String value) { addCriterion("email <=", value, "email"); return (Criteria) this; } public Criteria andEmailLike(String value) { addCriterion("email like", value, "email"); return (Criteria) this; } public Criteria andEmailNotLike(String value) { addCriterion("email not like", value, "email"); return (Criteria) this; } public Criteria andEmailIn(List<String> values) { addCriterion("email in", values, "email"); return (Criteria) this; } public Criteria andEmailNotIn(List<String> values) { addCriterion("email not in", values, "email"); return (Criteria) this; } public Criteria andEmailBetween(String value1, String value2) { addCriterion("email between", value1, value2, "email"); return (Criteria) this; } public Criteria andEmailNotBetween(String value1, String value2) { addCriterion("email not between", value1, value2, "email"); return (Criteria) this; } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table details * * @mbggenerated do_not_delete_during_merge Mon Apr 08 22:05:46 CST 2019 */ public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } /** * This class was generated by MyBatis Generator. * This class corresponds to the database table details * * @mbggenerated Mon Apr 08 22:05:46 CST 2019 */ 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); } } }
[ "544077885@qq.com" ]
544077885@qq.com
e6c523fb1d25b75da83007f162aa83030540e863
0480f00464d50b2e2a80567db2e00897507f8d5b
/client-android/src/com/zhat/ui/util/TabListener.java
ce98fc1a234b2effb9a1dbb1db87240529e3161d
[]
no_license
lizhieffe/zhat
92bc9f9e2a9dad4aabb08ade114b231f444ebbf3
77274abd19774b3f1a28263a49858e86f1e25559
refs/heads/master
2016-09-03T07:03:23.101964
2015-04-16T01:48:35
2015-04-16T01:48:35
32,075,695
0
0
null
null
null
null
UTF-8
Java
false
false
1,290
java
package com.zhat.ui.util; import android.app.ActionBar; import android.app.ActionBar.Tab; import android.app.Activity; import android.app.Fragment; import android.app.FragmentTransaction; public class TabListener <T extends Fragment> implements ActionBar.TabListener { private Fragment mFragment; private final Activity mActivity; private final String mTag; private final Class<T> mClass; /** Constructor used each time a new tab is created. * @param activity The host Activity, used to instantiate the fragment * @param tag The identifier tag for the fragment * @param clz The fragment's Class, used to instantiate the fragment */ public TabListener(Activity activity, String tag, Class<T> clz) { mActivity = activity; mTag = tag; mClass = clz; } @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { if (mFragment == null) { mFragment = Fragment.instantiate(mActivity, mClass.getName()); ft.add(android.R.id.content, mFragment, mTag); } else { ft.attach(mFragment); } } @Override public void onTabUnselected(Tab tab, FragmentTransaction ft) { if (mFragment != null) ft.detach(mFragment); } @Override public void onTabReselected(Tab arg0, FragmentTransaction arg1) { } }
[ "lizhieffe@gmail.com" ]
lizhieffe@gmail.com
20480b8d9306d47a60721dd3bf86ffdd6321dc79
f42687bd2e79c4a9e69e5cd6822d55825b6be7c0
/String/src/Adjacent_remove.java
b335b2f7b4f8a13804367b0db1423e10f3a88549
[]
no_license
vivek244/String
0adb162d1894b79fa8a8e2b83285c384edc8eac7
880ee19fa2f75691d6890327cf504d661b216683
refs/heads/master
2023-05-30T07:26:33.112975
2021-05-30T10:28:02
2021-05-30T10:28:02
369,720,167
0
0
null
null
null
null
UTF-8
Java
false
false
119
java
public class Adjacent_remove { public static void main(String[] args) { // TODO Auto-generated method stub } }
[ "vivekumar175@gmail.com" ]
vivekumar175@gmail.com
c3e028f4071d5d4d1df8284558b7d2b34febf757
ee19da9556d7e1b97adc09c9a0638d164b0f5fef
/java 2 컬랙션 프레임웍/src/propreties3.java
5436ca61c72e305c8d7714254e499123d46bafcc
[]
no_license
lovemin1003/lovemin34
bc6384e6abb071b2b5689411d1898982b9abf141
3af29667645fff631dc79137cd9beeca2f0981f8
refs/heads/master
2020-07-17T04:38:57.202293
2020-02-09T09:33:12
2020-02-09T09:33:12
205,943,964
1
0
null
null
null
null
UTF-8
Java
false
false
795
java
import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties; public class propreties3 { public static void main(String[] args) { // TODO Auto-generated method stub Properties 담원 = new Properties(); 담원.setProperty("너구리", "탑"); 담원.setProperty("펀치", "정글"); 담원.setProperty("쇼메이커", "미드"); 담원.setProperty("뉴클리어", "원딜"); 담원.setProperty("beryl", "support"); try { 담원.store(new FileOutputStream("담원.txt"), "담원 게이밍,damwon gaming");//한글은 깨져보임. 담원.storeToXML(new FileOutputStream("담원.xml"), "담원 게이밍"); } catch(IOException e) { e.printStackTrace(); } }//main의 끝 }
[ "noreply@github.com" ]
noreply@github.com
29c08c6123829986c2761381a0d2b2b5a5acd73e
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/drjava_cluster/4978/tar_0.java
5e82ed67b3d46cfd6713a7094d4718f2792a01fb
[]
no_license
martinezmatias/GenPat-data-C3
63cfe27efee2946831139747e6c20cf952f1d6f6
b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4
refs/heads/master
2022-04-25T17:59:03.905613
2020-04-15T14:41:34
2020-04-15T14:41:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,750
java
/*BEGIN_COPYRIGHT_BLOCK * * This file is a part of DrJava. Current versions of this project are available * at http://sourceforge.net/projects/drjava * * Copyright (C) 2001-2002 JavaPLT group at Rice University (javaplt@rice.edu) * * DrJava is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * DrJava is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * or see http://www.gnu.org/licenses/gpl.html * * In addition, as a special exception, the JavaPLT group at Rice University * (javaplt@rice.edu) gives permission to link the code of DrJava with * the classes in the gj.util package, even if they are provided in binary-only * form, and distribute linked combinations including the DrJava and the * gj.util package. You must obey the GNU General Public License in all * respects for all of the code used other than these classes in the gj.util * package: Dictionary, HashtableEntry, ValueEnumerator, Enumeration, * KeyEnumerator, Vector, Hashtable, Stack, VectorEnumerator. * * If you modify this file, you may extend this exception to your version of the * file, but you are not obligated to do so. If you do not wish to * do so, delete this exception statement from your version. (However, the * present version of DrJava depends on these classes, so you'd want to * remove the dependency first!) * END_COPYRIGHT_BLOCK*/ package edu.rice.cs.drjava.model; import junit.framework.*; import java.io.*; import java.util.LinkedList; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.DefaultStyledDocument; import edu.rice.cs.drjava.model.compiler.*; import edu.rice.cs.util.UnexpectedException; /** * A test on the GlobalModel for JUnit testing. * * @version $Id$ */ public class GlobalModelJUnitTest extends GlobalModelTestCase { private static final String MONKEYTEST_PASS_TEXT = "import junit.framework.*; " + "public class MonkeyTestPass extends TestCase { " + " public MonkeyTestPass(String name) { super(name); } " + " public void testShouldPass() { " + " assertEquals(\"monkey\", \"monkey\"); " + " } " + "}"; private static final String MONKEYTEST_FAIL_TEXT = "import junit.framework.*; " + "public class MonkeyTestFail extends TestCase { " + " public MonkeyTestFail(String name) { super(name); } " + " public void testShouldFail() { " + " assertEquals(\"monkey\", \"baboon\"); " + " } " + "}"; private static final String MONKEYTEST_COMPILEERROR_TEXT = "import junit.framework.*; " + "public class MonkeyTestCompileError extends TestCase { " + " Object MonkeyTestFail(String name) { super(name); } " + " public void testShouldFail() { " + " assertEquals(\"monkey\", \"baboon\"); " + " } " + "}"; private static final String NON_TESTCASE_TEXT = "public class NonTestCase {}"; /** * Constructor. * @param String name */ public GlobalModelJUnitTest(String name) { super(name); } /** * Creates a test suite for JUnit to run. * @return a test suite based on the methods in this class */ public static Test suite() { return new TestSuite(GlobalModelJUnitTest.class); } /** * Tests that startJUnit() does not execute if there are compile * errors in the file */ public void testDoNotRunJUnitWhenCompileErrorsOccur() throws Exception { final OpenDefinitionsDocument doc = setupDocument(MONKEYTEST_COMPILEERROR_TEXT); final File file = new File(_tempDir, "MonkeyTestCompileError.java"); doc.saveFile(new FileSelector(file)); CompileShouldFailListener listener = new CompileShouldFailListener(); _model.addListener(listener); doc.startJUnit(); listener.checkCompileOccurred(); assertCompileErrorsPresent("JUnit", true); listener.assertJUnitStartCount(0); listener.assertJUnitEndCount(0); } /** * Tests that startJUnit() does not execute if the user runs it * with an unsaved file and then chooses not to save the file. */ public void testDoNotRunJUnitUnsavedAndDoNotSaveWhenAsked() throws Exception { final OpenDefinitionsDocument doc = setupDocument(MONKEYTEST_PASS_TEXT); final File file = new File(_tempDir, "MonkeyTestPass.java"); CompileShouldSucceedListener listener = new CompileShouldSucceedListener() { public void junitStarted() { junitStartCount++; } public void junitEnded() { junitEndCount++; } public void saveAllBeforeProceeding(GlobalModelListener.SaveReason reason) { assertEquals("should be JUNIT reason to save", JUNIT_REASON, reason); assertModified(true, doc); assertSaveCount(0); assertCompileStartCount(0); assertCompileEndCount(0); try { doc.saveFile(new CancelingSelector()); } catch (IOException ioe) { fail("Save produced exception: " + ioe); } saveAllBeforeProceedingCount++; } public void fileSaved(OpenDefinitionsDocument doc) { assertModified(false, doc); assertSaveAllBeforeProceedingCount(0); assertCompileStartCount(0); assertCompileEndCount(0); File f = null; try { f = doc.getFile(); } catch (IllegalStateException ise) { // We know file should exist throw new UnexpectedException(ise); } assertEquals("JUNIT file saved", file, f); saveCount++; } }; _model.addListener(listener); doc.startJUnit(); // Check events fired listener.assertSaveAllBeforeProceedingCount(1); listener.assertSaveCount(0); listener.assertJUnitStartCount(0); listener.assertJUnitEndCount(0); } /** * Tests that a JUnit file with no errors is reported to have no errors. */ public void testNoJUnitErrors() throws Exception { OpenDefinitionsDocument doc = setupDocument(MONKEYTEST_PASS_TEXT); final File file = new File(_tempDir, "MonkeyTestPass.java"); doc.saveFile(new FileSelector(file)); doc.startCompile(); // Clear document so we can make sure it's written to after startJUnit _model.getJUnitDocument().remove(0, _model.getJUnitDocument().getLength() - 1); final TestResult testResults = doc.startJUnit(); assertEquals("test case should have no errors reported", 0, testResults.failureCount()); } /** * Tests that a JUnit file with an error is reported to have an error. */ public void testOneJUnitError() throws Exception { OpenDefinitionsDocument doc = setupDocument(MONKEYTEST_FAIL_TEXT); final File file = new File(_tempDir, "MonkeyTestFail.java"); doc.saveFile(new FileSelector(file)); doc.startCompile(); // Clear document so we can make sure it's written to after startJUnit _model.getJUnitDocument().remove(0, _model.getJUnitDocument().getLength() - 1); final TestResult testResults = doc.startJUnit(); assertEquals("test case has one error reported", 1, testResults.failureCount()); } /** * Tests that startJUnit() executes happily if the user runs * it with an unsaved file and then chooses to save the file. */ public void testRunJUnitUnsavedButSaveWhenAsked() throws Exception { final OpenDefinitionsDocument doc = setupDocument(MONKEYTEST_PASS_TEXT); final File file = new File(_tempDir, "MonkeyTestPass.java"); CompileShouldSucceedListener listener = new CompileShouldSucceedListener() { public void junitStarted() { junitStartCount++; } public void junitEnded() { junitEndCount++; } public void saveAllBeforeProceeding(GlobalModelListener.SaveReason reason) { assertEquals("should be JUNIT reason to save", JUNIT_REASON, reason); assertModified(true, doc); assertSaveCount(0); assertCompileStartCount(0); assertCompileEndCount(0); try { doc.saveFile(new FileSelector(file)); } catch (IOException ioe) { fail("Save produced exception: " + ioe); } saveAllBeforeProceedingCount++; } public void fileSaved(OpenDefinitionsDocument doc) { assertModified(false, doc); assertSaveAllBeforeProceedingCount(0); assertCompileStartCount(0); assertCompileEndCount(0); File f = null; try { f = doc.getFile(); } catch (IllegalStateException ise) { // We know file should exist throw new UnexpectedException(ise); } assertEquals("JUNIT file saved", file, f); saveCount++; } }; _model.addListener(listener); doc.startJUnit(); // Check events fired listener.assertSaveAllBeforeProceedingCount(1); listener.assertSaveCount(1); assertCompileErrorsPresent("JUNIT", false); listener.checkCompileOccurred(); listener.assertJUnitStartCount(1); listener.assertJUnitEndCount(1); // Make sure .class exists File compiled = classForJava(file, "MonkeyTestPass"); assertTrue("JUNIT: Class file doesn't exist after compile", compiled.exists()); } /** * Tests that the ui is notified to put up an error dialog if JUnit * is run on a non-TestCase. */ public void testNonTestCaseError() throws Exception { final OpenDefinitionsDocument doc = setupDocument(NON_TESTCASE_TEXT); final File file = new File(_tempDir, "NonTestCase.java"); doc.saveFile(new FileSelector(file)); CompileShouldSucceedListener listener = new CompileShouldSucceedListener() { public void junitStarted() { junitStartCount++; } public void junitEnded() { junitEndCount++; } public void nonTestCase() { nonTestCaseCount++; } }; _model.addListener(listener); doc.startJUnit(); // Check events fired listener.assertJUnitStartCount(1); listener.assertJUnitEndCount(1); listener.assertNonTestCaseCount(1); } }
[ "375833274@qq.com" ]
375833274@qq.com
e94da8fd79cc3fbcc104060fdb5ec773744cc944
772b7c2549d653fedb76932b758b4b85352df421
/src/test/java/test/api/TestWithValidSystemProperties.java
c9850ff6bfe0da92e80e40a02395de72d5478386
[]
no_license
groonyn/SelenideSample
4d6940d6295ca40c9dd04b10811b558883da6601
7570052a9f3d0b3d8b5ec206a1c4ec9fd7f5bccd
refs/heads/master
2021-07-10T19:42:29.493996
2019-09-11T10:06:58
2019-09-11T10:06:58
207,780,566
0
1
null
2020-10-13T15:58:09
2019-09-11T10:01:17
Java
UTF-8
Java
false
false
1,457
java
package test.api; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; import toolkit.DataProvider; import static toolkit.DataProvider.getNewSingletonProviderProperty; /** * Test with valid second and valid default property. * Paths to properties must be defined via * -D parameter as a part of Maven goal: -Dsecond.file=/second.cfg -Ddefault.file=/default.cfg * @author Nikolai Grunin */ public class TestWithValidSystemProperties { /** * Checks getting values of property by keys with two cases. It must take * the unique value by unique key which is only exists in one of two * properties. */ @Ignore @Test public void testGetPropertyWithBothExistingSystemProperties() { DataProvider.getNewSingleDataProvider(); String currentSecondProperty = getNewSingletonProviderProperty(ENVIRONMENT_ID); Assert.assertEquals(VALID_VALUE, currentSecondProperty); String currentDefaultProperty = getNewSingletonProviderProperty(KEY_IS_ONLY_IN_DEFAULT_FILE); Assert.assertEquals(ONLY_IN_DEFAULT_VALUE, currentDefaultProperty); } /* Test message and data templates. */ static private final String KEY_IS_ONLY_IN_DEFAULT_FILE = "only.default.key"; static private final String ONLY_IN_DEFAULT_VALUE = "default_value"; static private final String VALID_VALUE = "SECOND"; static private final String ENVIRONMENT_ID = "environment.id"; }
[ "nikolai.grunin@t-systems.ru" ]
nikolai.grunin@t-systems.ru
e765de71b5f7543d83173d37e18dc42d155cd806
dea05a90c245a53a383134c247c1831e7958a906
/src/java/co/mpc/frontend/ordenes/utilities/converters/MantenimientoConverter.java
f86ae5d0ee44325c15ba272a44d18f2339ac1bb3
[]
no_license
thrasher7000/NewMpc
54087d599bdb7f9db58f865241b6cf4e469b87ff
b6974e65d64c838b0ae3f980bbe8e2eb970ffd0b
refs/heads/master
2020-06-11T07:23:57.833618
2016-12-06T22:57:53
2016-12-06T22:57:53
75,734,953
0
0
null
null
null
null
UTF-8
Java
false
false
681
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 co.mpc.frontend.ordenes.utilities.converters; import co.mpc.backend.persistence.model.entities.Mantenimiento; import co.mpc.frontend.utilities.converters.AbstractConverter; import javax.faces.convert.FacesConverter; /** * * @author Juank */ @FacesConverter(forClass = Mantenimiento.class) public class MantenimientoConverter extends AbstractConverter { public MantenimientoConverter() { this.nameManagedBean = "mantenimientoManagedBean"; } }
[ "Juank@Lenovo-PC" ]
Juank@Lenovo-PC
f5a75c1e77816a5847c93a52ea26a10b9a381d12
81579f1ed98889472301dc92a4f057d53d8ae644
/src/features/EstablishConnection.java
df9d59a8002c1021262eb03dd208e8310ea4882b
[]
no_license
amritpal2851/Assignment_3
911529c46d40d680a11960dd35255da7be4a0336
a0b0add04cc24af99a3addf43559e5417e0845b5
refs/heads/main
2023-08-18T05:05:15.611289
2021-09-16T16:58:51
2021-09-16T16:58:51
407,246,919
0
0
null
null
null
null
UTF-8
Java
false
false
585
java
package features; import org.apache.log4j.Logger; import java.sql.Connection; import java.sql.DriverManager; public class EstablishConnection { static Logger logger=Logger.getLogger(EstablishConnection.class); public static Connection setConnection(){ Connection connection=null; try{ Class.forName("org.postgresql.Driver"); connection = DriverManager.getConnection("jdbc:postgresql://localhost:5432/library", "postgres", "admin"); }catch (Exception e){ logger.info(e); } return connection; } }
[ "amritpal2851@gmail.com" ]
amritpal2851@gmail.com
e069b03da1753e85e8635500bf0cf9b9530d44be
74039d99750e233fb7636af6133ac26e3afa0f45
/LordUClient/src/main/java/e/wrod/net/common/Common2.java
1f345db6e426ee8fb0f3d4d3e5defc4a99cf1034
[]
no_license
AIOSCloud/enjoy_word
b89f7ae8774aa65fdbe5c3d461b6758e3ace412a
12d9766deab0a98487ec607881db0b807602f2e6
refs/heads/master
2022-11-27T04:46:54.123316
2020-03-20T09:47:21
2020-03-20T09:47:21
246,191,077
0
0
null
2022-11-16T11:34:59
2020-03-10T02:37:41
Java
UTF-8
Java
false
false
3,855
java
package e.wrod.net.common; import e.wrod.net.component.JCard; import e.wrod.net.view.RoomPage; import javax.swing.*; import java.awt.*; import java.util.Comparator; import java.util.List; public class Common2 { //排序 public static void order(List<JCard> list) { list.sort(new Comparator<JCard>() { @Override public int compare(JCard c1, JCard c2) { return weight(c2) - weight(c1); } }); } public static int weight(JCard card) { int color = card.getCard().getColor(); int number = card.getCard().getNumber(); //��������Ļ� if (color == 5 && number == 2) { return 100; } if (color == 5 && number == 1) { return 90; } if (color < 5 && number == 2) { return 80; } if (color < 5 && number == 1) { return 70; } return number; } public static int mine(int position) { return position; } public static int befor(int position) { if (position == 0) { return 2; } else if (position == 2) { return 1; } else { return 0; } } public static int next(int position) { if (position == 0) { return 1; } else if (position == 2) { return 0; } else { return 2; } } //重新定位 flag代表是电脑0,2,或者是我 public static void rePosition(JFrame main, List<JCard> list, int flag, int position) { Point p = new Point(); if (flag == befor(position)) {//电脑0 p.x = 50; p.y = (450 / 2) - (list.size() + 1) * 15 / 2; } if (flag == mine(position)) {//我 p.x = (800 / 2) - (list.size() + 1) * 21 / 2; p.y = 450; } if (flag == next(position)) { p.x = 700; p.y = (450 / 2) - (list.size() + 1) * 15 / 2; } int len = list.size(); for (int i = 0; i < len; i++) { JCard card = list.get(i); Common.move(card, card.getLocation(), p); main.getContentPane().setComponentZOrder(card, 0); if (flag == mine(position)) p.x += 21; else p.y += 15; } }//移动效果的函数,用于发牌 public static void move(JCard card, Point from, Point to) { if (to.x != from.x) { double k = (1.0) * (to.y - from.y) / (to.x - from.x); double b = to.y - to.x * k; int flag = 0;//判断是向左还是向又移动的步幅 if (from.x < to.x) { flag = 20; } else { flag = -20; } for (int i = from.x; Math.abs(i - to.x) > 20; i += flag) { double y = k * i + b;//这里主要用的数学中的线性函数 card.setLocation(i, (int) y); try { Thread.sleep(5); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } //位置校准 card.setLocation(to); } // 设定地主 public static void setLord(RoomPage page, int i, int postion) { Point point = new Point(); if (i == mine(postion))// 我是地主 { point.x = 120; point.y = 480; } if (i == 0) { point.x = 80; point.y = 20; } if (i == 2) { point.x = 700; point.y = 20; } page.getLord().setLocation(point); page.getLord().setVisible(true); } }
[ "xuchang@icsoc.net" ]
xuchang@icsoc.net
d5d69598476d97974b72865c1a35caed046a38f2
c3db0a8fbb8a54cd0b5e5f0f05ac70ad2082cee7
/src/test/java/io/github/bonigarcia/seljup/test/template/TemplateRegisterOptionsTest.java
9d7dc406cfc4cadd8680f7a35381c34ab0ad60b1
[ "Apache-2.0" ]
permissive
bonigarcia/selenium-jupiter
52187e90a69b9f8b8f0c57b74ea30f115e8f3fd5
f950029c6bd7ce062d28e024e5401bec3feadd6a
refs/heads/master
2023-09-04T00:54:20.482310
2023-09-01T14:41:51
2023-09-01T14:41:51
94,019,756
239
61
Apache-2.0
2023-09-07T06:38:15
2017-06-11T17:12:59
Java
UTF-8
Java
false
false
2,337
java
/* * (C) Copyright 2021 Boni Garcia (https://bonigarcia.github.io/) * * 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 io.github.bonigarcia.seljup.test.template; import static org.assertj.core.api.Assertions.assertThat; import java.time.Duration; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.TestTemplate; import org.junit.jupiter.api.extension.RegisterExtension; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeOptions; import io.github.bonigarcia.seljup.BrowserBuilder; import io.github.bonigarcia.seljup.Options; import io.github.bonigarcia.seljup.BrowsersTemplate.Browser; import io.github.bonigarcia.seljup.SeleniumJupiter; class TemplateRegisterOptionsTest { @RegisterExtension static SeleniumJupiter seleniumJupiter = new SeleniumJupiter(); @Options static ChromeOptions chromeOptions = new ChromeOptions(); @BeforeAll static void setup() { chromeOptions.addArguments("--use-fake-device-for-media-stream", "--use-fake-ui-for-media-stream"); Browser chrome = BrowserBuilder.chrome().build(); Browser chromeInDocker = BrowserBuilder.chromeInDocker().build(); seleniumJupiter.addBrowsers(chrome); seleniumJupiter.addBrowsers(chromeInDocker); seleniumJupiter.getConfig().enableScreenshot(); } @TestTemplate void templateTest(WebDriver driver) throws InterruptedException { driver.get( "https://webrtc.github.io/samples/src/content/devices/input-output/"); assertThat(driver.findElement(By.id("video")).getTagName()) .isEqualTo("video"); Thread.sleep(Duration.ofSeconds(5).toMillis()); } }
[ "boni.garcia@uc3m.es" ]
boni.garcia@uc3m.es
93e8066638a61f05eba93ae18e67d206e947c930
46b4f94259c9c02ae3dc618b8b61a325a95c6e61
/Web3_1_NoSciptlets/src/ui/controller/CountryDBDesktopApp.java
2736976f98a9d1950f2ad6386a6edea110538435
[]
no_license
ArnoPiersoul/web3
c9b2a56817d4e95109e6cef2f72685674f2410aa
d9e18e983a74889131e39835c582c4492136eff3
refs/heads/master
2021-04-15T10:46:12.034327
2018-03-23T03:12:38
2018-03-23T03:12:38
126,376,811
0
0
null
null
null
null
UTF-8
Java
false
false
1,407
java
package ui.controller; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; import domain.model.Country; public class CountryDBDesktopApp { public static void main(String[] args) throws SQLException { // connectie met databank Properties properties = new Properties(); String url = "jdbc:postgresql://gegevensbanken.khleuven.be:51314/webontwerp"; properties.setProperty("user", "daily.build"); properties.setProperty("password", "irooZiNgae0daiba"); properties.setProperty("ssl", "true"); properties.setProperty("sslfactory", "org.postgresql.ssl.NonValidatingFactory"); Connection connection = DriverManager.getConnection(url, properties); // query schrijven Statement statement = connection.createStatement(); ResultSet result = statement.executeQuery("SELECT * FROM test_u0082726.country"); // resultaten van de query tonen op console while (result.next()) { String name = result.getString("name"); String capital = result.getString("capital"); int votes = Integer.parseInt(result.getString("votes")); int inwoners = Integer.parseInt(result.getString("inhabitants")); Country country = new Country(name, inwoners, capital, votes); System.out.println(country); } statement.close(); connection.close(); } }
[ "arno.piersoul@student.ucll.be" ]
arno.piersoul@student.ucll.be
1236ad1a86e601e890cd2cd74105697375c5f348
cb33fb918716e5497dedeea20b11e859c8472bdc
/JAVA/Assignments/Assignment02/ASSIGNMENT02/Star.java
3a590d785745ff5add85d9dcdadf1aa23b57a5a0
[]
no_license
Arun-A-Patil/Edac-may2021
2fa02666d9e09ad243a99ab68371111bbd5fff25
b801d8f47484bb906e84dc35067844d5eab78e60
refs/heads/main
2023-06-16T06:56:18.660773
2021-07-12T05:00:20
2021-07-12T05:00:20
365,245,406
1
0
null
null
null
null
UTF-8
Java
false
false
256
java
public class Star { public static void main(String[] args) { for(int i=1; i<=6;i++) { for(int j=6; j>=1;j--) { if(j>i) { System.out.print(" "); } else System.out.print(" *"); } System.out.println(); } } }
[ "noreply@github.com" ]
noreply@github.com
26d0b894a1221888c73a3aaa649c595b166fb5e1
fe49bebdae362679d8ea913d97e7a031e5849a97
/bqerpejb/src/power/ejb/productiontec/dependabilityAnalysis/business/PtJDesulfurizationParameterFacade.java
d3023e0e96e15c4dfe074a7d5437aa9499373f89
[]
no_license
loveyeah/BQMIS
1f87fad2c032e2ace7e452f13e6fe03d8d09ce0d
a3f44db24be0fcaa3cf560f9d985a6ed2df0b46b
refs/heads/master
2020-04-11T05:21:26.632644
2018-03-08T02:13:18
2018-03-08T02:13:18
124,322,652
0
2
null
null
null
null
UTF-8
Java
false
false
4,497
java
package power.ejb.productiontec.dependabilityAnalysis.business; import java.util.List; import java.util.logging.Level; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import power.ejb.comm.NativeSqlHelperRemote; import power.ejb.hr.LogUtil; /** * */ @Stateless public class PtJDesulfurizationParameterFacade implements PtJDesulfurizationParameterFacadeRemote { @PersistenceContext private EntityManager entityManager; @EJB(beanName = "NativeSqlHelper") private NativeSqlHelperRemote bll; public void save(PtJDesulfurizationParameter entity) { LogUtil.log("saving PtJDesulfurizationParameter instance", Level.INFO, null); try { entity.setDesulfurizationId(bll.getMaxId("PT_J_DESULFURIZATION_PARAMETER", "DESULFURIZATION_ID")); entityManager.persist(entity); LogUtil.log("save successful", Level.INFO, null); } catch (RuntimeException re) { LogUtil.log("save failed", Level.SEVERE, re); throw re; } } public void delete(PtJDesulfurizationParameter entity) { LogUtil.log("deleting PtJDesulfurizationParameter instance", Level.INFO, null); try { entity = entityManager.getReference( PtJDesulfurizationParameter.class, entity .getDesulfurizationId()); entityManager.remove(entity); LogUtil.log("delete successful", Level.INFO, null); } catch (RuntimeException re) { LogUtil.log("delete failed", Level.SEVERE, re); throw re; } } public PtJDesulfurizationParameter update(PtJDesulfurizationParameter entity) { LogUtil.log("updating PtJDesulfurizationParameter instance", Level.INFO, null); try { PtJDesulfurizationParameter result = entityManager.merge(entity); LogUtil.log("update successful", Level.INFO, null); return result; } catch (RuntimeException re) { LogUtil.log("update failed", Level.SEVERE, re); throw re; } } public PtJDesulfurizationParameter findById(Long id) { LogUtil.log("finding PtJDesulfurizationParameter instance with id: " + id, Level.INFO, null); try { PtJDesulfurizationParameter instance = entityManager.find( PtJDesulfurizationParameter.class, id); return instance; } catch (RuntimeException re) { LogUtil.log("find failed", Level.SEVERE, re); throw re; } } @SuppressWarnings("unchecked") public List<PtJDesulfurizationParameter> findByProperty( String propertyName, final Object value, final int... rowStartIdxAndCount) { LogUtil.log( "finding PtJDesulfurizationParameter instance with property: " + propertyName + ", value: " + value, Level.INFO, null); try { final String queryString = "select model from PtJDesulfurizationParameter model where model." + propertyName + "= :propertyValue"; Query query = entityManager.createQuery(queryString); query.setParameter("propertyValue", value); if (rowStartIdxAndCount != null && rowStartIdxAndCount.length > 0) { int rowStartIdx = Math.max(0, rowStartIdxAndCount[0]); if (rowStartIdx > 0) { query.setFirstResult(rowStartIdx); } if (rowStartIdxAndCount.length > 1) { int rowCount = Math.max(0, rowStartIdxAndCount[1]); if (rowCount > 0) { query.setMaxResults(rowCount); } } } return query.getResultList(); } catch (RuntimeException re) { LogUtil.log("find by property name failed", Level.SEVERE, re); throw re; } } @SuppressWarnings("unchecked") public List<PtJDesulfurizationParameter> findAll( final int... rowStartIdxAndCount) { LogUtil.log("finding all PtJDesulfurizationParameter instances", Level.INFO, null); try { final String queryString = "select model from PtJDesulfurizationParameter model"; Query query = entityManager.createQuery(queryString); if (rowStartIdxAndCount != null && rowStartIdxAndCount.length > 0) { int rowStartIdx = Math.max(0, rowStartIdxAndCount[0]); if (rowStartIdx > 0) { query.setFirstResult(rowStartIdx); } if (rowStartIdxAndCount.length > 1) { int rowCount = Math.max(0, rowStartIdxAndCount[1]); if (rowCount > 0) { query.setMaxResults(rowCount); } } } return query.getResultList(); } catch (RuntimeException re) { LogUtil.log("find all failed", Level.SEVERE, re); throw re; } } }
[ "yexinhua@rtdata.cn" ]
yexinhua@rtdata.cn
d77af5a65094149a2803f47ad813e5b187a03fa2
5fe2d38530885c3350db898feb1fef0ae748da37
/src/test/java/com/sam/reactivemongorecipeapplication/controllers/ImageControllerTest.java
8e7d96b92e5ba3d14e33a684fa26ae823e5de3e5
[]
no_license
baskicisamet/reactive-mongo-recipe-application
fe6b248a9bd41f0e2256ac25f5029804fa627789
f6c68c750c5c7198df87a56b2ca8618d850e4ec3
refs/heads/master
2020-04-27T14:19:01.538666
2018-02-03T06:10:44
2018-02-03T06:10:44
174,405,624
0
0
null
null
null
null
UTF-8
Java
false
false
3,694
java
package com.sam.reactivemongorecipeapplication.controllers; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.multipart; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockMultipartFile; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import com.sam.reactivemongorecipeapplication.commands.RecipeCommand; import com.sam.reactivemongorecipeapplication.services.ImageService; import com.sam.reactivemongorecipeapplication.services.RecipeService; public class ImageControllerTest { @Mock ImageService imageService; @Mock RecipeService recipeService; ImageController controller; MockMvc mockMvc; @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); controller = new ImageController(imageService, recipeService); mockMvc = MockMvcBuilders.standaloneSetup(controller) .setControllerAdvice(new ControllerExceptionHandler()) .build(); } @Test public void getImageForm() throws Exception { //given RecipeCommand command = new RecipeCommand(); command.setId("1"); when(recipeService.findCommandById(anyString())).thenReturn(command); //when mockMvc.perform(get("/recipe/1/image")) .andExpect(status().isOk()) .andExpect(model().attributeExists("recipe")); verify(recipeService, times(1)).findCommandById(anyString()); } @Test public void handleImagePost() throws Exception { MockMultipartFile multipartFile = new MockMultipartFile("imagefile", "testing.txt", "text/plain", "Spring Framework Guru".getBytes()); mockMvc.perform(multipart("/recipe/1/image").file(multipartFile)) .andExpect(status().is3xxRedirection()) .andExpect(header().string("Location", "/recipe/1/show")); verify(imageService, times(1)).saveImageFile(anyString(), any()); } @Test public void renderImageFromDB() throws Exception { //given RecipeCommand command = new RecipeCommand(); command.setId("1"); String s = "fake image text"; Byte[] bytesBoxed = new Byte[s.getBytes().length]; int i = 0; for (byte primByte : s.getBytes()){ bytesBoxed[i++] = primByte; } command.setImage(bytesBoxed); when(recipeService.findCommandById(anyString())).thenReturn(command); //when MockHttpServletResponse response = mockMvc.perform(get("/recipe/1/recipeimage")) .andExpect(status().isOk()) .andReturn().getResponse(); byte[] reponseBytes = response.getContentAsByteArray(); assertEquals(s.getBytes().length, reponseBytes.length); } }
[ "baskicisamet@gmail.com" ]
baskicisamet@gmail.com
0510eede9aaeb96798ba0420f405e2007ed3bdf3
b080909e42349f608cc770268574616373145908
/app/src/main/java/com/jinglan/lilo/coolweather/gson/Basic.java
4c942079c3840759542e9d6e8a7c463c64096056
[]
no_license
ligfo/CoolWeather
b2d647ab70990d047832c08adcb20a4efb852923
58ecb7721a7b2b20f6c287aacbefccaa383afa50
refs/heads/master
2021-05-06T05:16:46.610561
2017-12-23T08:27:06
2017-12-23T08:27:06
115,064,324
1
0
null
null
null
null
UTF-8
Java
false
false
403
java
package com.jinglan.lilo.coolweather.gson; import com.google.gson.annotations.SerializedName; /** * Created by lilo on 2017/12/23. */ public class Basic { @SerializedName("city") public String cityName; @SerializedName("id") public String weatherId; public Update update; public class Update { @SerializedName("loc") public String updatetime; } }
[ "lilo@gmail" ]
lilo@gmail
0c64b708a7b0695f88272b8d9835983d9fc88933
3f8e1febd263e334af4983e2163495f7d3118085
/app/src/main/java/com/cquant/lizone/bean/GiftItem.java
f5858d58bc5717fa6cb02b27b97d8663fc301fa6
[]
no_license
tienjunhsu/lizone
69cd5d64b9d3dcc2af1b7da97a6751bd46401854
7b5e7f9a05669a3653817427e7700aadccfc29bb
refs/heads/master
2021-01-01T05:51:59.482462
2016-01-29T07:51:22
2016-01-29T07:51:22
41,292,375
1
0
null
null
null
null
UTF-8
Java
false
false
2,232
java
package com.cquant.lizone.bean; import com.cquant.lizone.tool.JsnTool; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; /** * Created by asus on 2015/10/25. */ public class GiftItem { //K线页财经热点、市场要闻 public String id; public String name; public String price; public String img; public String big_img; public String rmb; public String number; public GiftItem(String id, String name, String price, String img,String big_img,String rmb,String number) { this.id = id; this.name = name; this.price = price; this.img = img; this.big_img = big_img; this.rmb = rmb; this.number = number; } public static GiftItem getItem(JSONObject obj) { String mId = JsnTool.getString(obj, "id"); String mName = JsnTool.getString(obj, "name"); String mPrice = JsnTool.getString(obj, "price"); String mImg = JsnTool.getString(obj, "min_img"); String big_img = JsnTool.getString(obj, "img"); String rmb = JsnTool.getString(obj, "rmb"); String number = JsnTool.getString(obj, "number"); return new GiftItem(mId, mName, mPrice, mImg,big_img,rmb,number); } public static ArrayList<GiftItem> getItemList(String json) { return getItemList(JsnTool.getObject(json)); } public static ArrayList<GiftItem> getItemList(JSONObject obj) { return getItemList(JsnTool.getArray(obj, "data")); } public static ArrayList<GiftItem> getItemList(JSONArray ary) { ArrayList<GiftItem> list = null; if (ary != null) { int n = ary.length(); list = new ArrayList<GiftItem>(n); JSONObject obj = null; for (int i = 0; i < n; i++) { try { obj = ary.getJSONObject(i); } catch (JSONException e) { e.printStackTrace(); } if (obj != null) { list.add(getItem(obj)); } } } else { list = new ArrayList<GiftItem>(0); } return list; } }
[ "tienqhsu@163.com" ]
tienqhsu@163.com
1065941ebc43a9950efd5531f1fec172f30bea35
9a1dbc6fc48c9f8e7ccf4caf14d3a6f8b7aed1c3
/InternshipTutor/src/main/java/it/univaq/ingweb/internshiptutor/data/dao/AziendaDAO.java
d5de739d74b75b809de67230ca52b06fb09eec2c
[]
no_license
StephanXV/internship_tutor
44351d14fd6ec1a7797cb11a78c1812045f44c13
c3f1a607c0205864f183197f4be9cc5eef7836f7
refs/heads/master
2022-10-09T16:33:24.496143
2020-01-21T11:56:43
2020-01-21T11:56:43
215,810,200
0
0
null
null
null
null
UTF-8
Java
false
false
1,090
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 it.univaq.ingweb.internshiptutor.data.dao; import it.univaq.ingweb.framework.data.DataException; import it.univaq.ingweb.internshiptutor.data.model.Azienda; import java.sql.ResultSet; import java.util.List; /** * * @author Stefano Florio */ public interface AziendaDAO { Azienda createAzienda(); Azienda createAzienda(ResultSet rs) throws DataException; Azienda getAzienda(int id) throws DataException; Azienda getAzienda(String ut_username) throws DataException; List<Azienda> getAziendeByStato(int stato) throws DataException; int insertAzienda(Azienda az) throws DataException; int deleteAzienda(int id_az) throws DataException; int getTirocinantiAttivi(Azienda az) throws DataException; List<Azienda> getBestFiveAziende() throws DataException; int updateAzienda(Azienda az) throws DataException; }
[ "31825478+StephanXV@users.noreply.github.com" ]
31825478+StephanXV@users.noreply.github.com
161cc3f344436b0a4c46d58aa58b46acd387782d
d1a6d1e511df6db8d8dd0912526e3875c7e1797d
/genny_JavaWithoutLambdasApi21/applicationModule/src/test/java/applicationModulepackageJava12/Foo652Test.java
a5ffb3d296c6b7c330acc72fd39c6cabbf73b7ec
[]
no_license
NikitaKozlov/generated-project-for-desugaring
0bc1443ab3ddc84cd289331c726761585766aea7
81506b3711004185070ca4bb9a93482b70011d36
refs/heads/master
2020-03-20T00:35:06.996525
2018-06-12T09:30:37
2018-06-12T09:30:37
137,049,317
0
0
null
null
null
null
UTF-8
Java
false
false
482
java
package applicationModulepackageJava12; import org.junit.Test; public class Foo652Test { @Test public void testFoo0() { new Foo652().foo0(); } @Test public void testFoo1() { new Foo652().foo1(); } @Test public void testFoo2() { new Foo652().foo2(); } @Test public void testFoo3() { new Foo652().foo3(); } @Test public void testFoo4() { new Foo652().foo4(); } @Test public void testFoo5() { new Foo652().foo5(); } }
[ "nikita.e.kozlov@gmail.com" ]
nikita.e.kozlov@gmail.com
e6c872fc7278e4d662c488da492b67e71b62869b
f54230c5e5f85a210c924b0fb1ce7fc3e07f9701
/IMAGINE/src/hearth/capillary/KthSequence.java
a7581b0a676e01425cdaf28cd2267b3138f45142
[]
no_license
pdhub/IMAGINE
6823f545200ca6d107e8d02da2a8c6595627ca3a
210a81e6e79c37d1a1b89543d9b6a3f37d8819d2
refs/heads/master
2021-01-10T05:30:23.594472
2017-10-16T19:18:25
2017-10-16T19:18:25
47,502,326
0
0
null
null
null
null
UTF-8
Java
false
false
849
java
package hearth.capillary; import java.util.HashSet; import java.util.Scanner; public class KthSequence { public static void main(String[] args) { Scanner in = new Scanner(System.in); int testCases = in.nextInt(); while (testCases-- > 0) { int n = in.nextInt(); int k = in.nextInt(); System.out.println(findKthsubSequence(n,k)); } } private static String findKthsubSequence(int n, int k) { String retVal = ""; String orig= ""; for (int i = 0; i < n; i++) { orig+="O"; } HashSet<String> set = new HashSet<String>(); generateSequence(n,k,set,orig); return retVal; } private static void generateSequence(int n, int k, HashSet<String> s, String orig) { s.add(orig); for (int i = 0; i < orig.length()-1; i++) { if(orig.charAt(i)!=orig.charAt(i+1)){ } } } }
[ "pdeb@manh.com" ]
pdeb@manh.com
80dd79e9d41deae5c5cbc93ae4cb30db1c275922
28a14071289ba3065ee8bf203b745a36a3b83629
/taolele/src/main/java/com/cjw/taolele/web/SellerController.java
01510d0b39b9c8616ba0ca9487228bb6aa8fdafb
[]
no_license
sengeiou/taolele
47eae0ca264c1251ad01ccfa1b3b9594c3fcc07e
3f5e3d154be3b9f8ae728da917884f7887e44e51
refs/heads/master
2020-04-23T00:38:31.894836
2019-02-14T03:30:06
2019-02-14T03:30:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,476
java
package com.cjw.taolele.web; import com.cjw.taolele.core.Result; import com.cjw.taolele.core.ResultGenerator; import com.cjw.taolele.entity.PageResult; import com.cjw.taolele.model.Seller; import com.cjw.taolele.service.SellerService; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; /** * Created by Jing wen on 2019/02/14. */ @RestController @RequestMapping("/seller") public class SellerController { @Resource private SellerService sellerService; @RequestMapping("/save") public Result save(@RequestBody Seller seller) { sellerService.save(seller); return ResultGenerator.genSuccessResult(); } @RequestMapping("/saveList") public Result saveList(@RequestBody Seller seller) { sellerService.save(seller); return ResultGenerator.genSuccessResult(); } @RequestMapping("/deleteByIds") public Result deleteByIds(String ids) { sellerService.deleteByIds(ids); return ResultGenerator.genSuccessResult(); } @RequestMapping("/deleteById") public Result deleteById(Long id) { sellerService.deleteById(id); return ResultGenerator.genSuccessResult(); } @RequestMapping("/update") public Result update(@RequestBody Seller seller) { sellerService.update(seller); return ResultGenerator.genSuccessResult(); } @RequestMapping("/findById") public Result findById(Long id) { Seller seller = sellerService.findById(id); return ResultGenerator.genSuccessResult(seller); } @RequestMapping("/findByIds") public Result findByIds(String ids) { List<Seller> sellers = sellerService.findByIds(ids); return ResultGenerator.genSuccessResult(sellers); } @RequestMapping("/findAll") public Result findAll() { List<Seller> sellers = sellerService.findAll(); return ResultGenerator.genSuccessResult(sellers); } @RequestMapping("/findPage") public Result findPage(@RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "8")int pageSize) { PageResult pageResult = sellerService.findPage(pageNum, pageSize); return ResultGenerator.genSuccessResult(pageResult); } }
[ "245846413@qq.com" ]
245846413@qq.com
71422e7dbab1e07f51333120b1699787823f3acf
6eadd0be75c6abb4f26c997fc8e23df0264d2eff
/util/plugins/eu.esdihumboldt.util.blueprints.entities/src/eu/esdihumboldt/util/blueprints/entities/VertexEntityTransformation.java
f3571518257aed61c53f7d7cdc32b592f56945c8
[]
no_license
thorsten-reitz/hale
ca98c0b28ea9e6a6c9835b1efe9b72cea8e7c68f
6cf266c4e004221bebdc8e6da093cc0bdfb5567b
refs/heads/master
2021-01-17T12:09:28.190262
2013-09-26T17:29:34
2013-09-26T17:29:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
22,084
java
/* * Copyright (c) 2013 Simon Templer * * All rights reserved. This program and the accompanying materials are made * available under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of the License, * or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public License * along with this distribution. If not, see <http://www.gnu.org/licenses/>. * * Contributors: * Simon Templer - initial version */ package eu.esdihumboldt.util.blueprints.entities; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.List; import org.codehaus.groovy.ast.ASTNode; import org.codehaus.groovy.ast.AnnotationNode; import org.codehaus.groovy.ast.ClassHelper; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.ConstructorNode; import org.codehaus.groovy.ast.FieldNode; import org.codehaus.groovy.ast.GenericsType; import org.codehaus.groovy.ast.MethodNode; import org.codehaus.groovy.ast.Parameter; import org.codehaus.groovy.ast.PropertyNode; import org.codehaus.groovy.ast.expr.ArgumentListExpression; import org.codehaus.groovy.ast.expr.BinaryExpression; import org.codehaus.groovy.ast.expr.ClassExpression; import org.codehaus.groovy.ast.expr.ConstantExpression; import org.codehaus.groovy.ast.expr.ConstructorCallExpression; import org.codehaus.groovy.ast.expr.Expression; import org.codehaus.groovy.ast.expr.FieldExpression; import org.codehaus.groovy.ast.expr.MethodCallExpression; import org.codehaus.groovy.ast.expr.NotExpression; import org.codehaus.groovy.ast.expr.StaticMethodCallExpression; import org.codehaus.groovy.ast.expr.VariableExpression; import org.codehaus.groovy.ast.stmt.BlockStatement; import org.codehaus.groovy.ast.stmt.EmptyStatement; import org.codehaus.groovy.ast.stmt.ExpressionStatement; import org.codehaus.groovy.ast.stmt.IfStatement; import org.codehaus.groovy.ast.stmt.ReturnStatement; import org.codehaus.groovy.ast.stmt.Statement; import org.codehaus.groovy.control.CompilePhase; import org.codehaus.groovy.control.SourceUnit; import org.codehaus.groovy.syntax.Token; import org.codehaus.groovy.syntax.Types; import org.codehaus.groovy.transform.ASTTransformation; import org.codehaus.groovy.transform.AbstractASTTransformUtil; import org.codehaus.groovy.transform.GroovyASTTransformation; import com.tinkerpop.blueprints.Graph; import com.tinkerpop.blueprints.Vertex; import com.tinkerpop.blueprints.impls.orient.OrientGraph; /** * Groovy AST transformation that converts POGOs to vertex entities. * * @author Simon Templer */ @GroovyASTTransformation(phase = CompilePhase.SEMANTIC_ANALYSIS) public class VertexEntityTransformation implements ASTTransformation { private static final ClassNode VERTEX_CLASS = ClassHelper.make(Vertex.class); private static final ClassNode GRAPH_CLASS = ClassHelper.make(Graph.class); private static final ClassNode ORIENT_GRAPH_CLASS = ClassHelper.make(OrientGraph.class); private static final ClassNode VERTEX_ENTITY_CLASS = ClassHelper.make(VertexEntity.class); private static final ClassNode ITERABLE_CLASS = ClassHelper.make(Iterable.class); private static final ClassNode VE_DELEGATES_CLASS = ClassHelper .make(VertexEntityDelegates.class); private static final ClassNode VE_ITERABLE_DELEGATE_CLASS = ClassHelper .make(IterableDelegate.class); private static final ClassNode VE_NON_UNIQUE_EXCEPTION = ClassHelper .make(NonUniqueResultException.class); private static final Token TOKEN_PLUS = Token.newSymbol(Types.PLUS, -1, -1); @Override public void visit(ASTNode[] nodes, SourceUnit sourceUnit) { if (sourceUnit.getAST() == null) return; List<ClassNode> classes = sourceUnit.getAST().getClasses(); for (ClassNode clazz : classes) { // find all classes annotated with @ODocumentEntity List<AnnotationNode> entityAnnotations = clazz.getAnnotations(VERTEX_ENTITY_CLASS); if (entityAnnotations != null && !entityAnnotations.isEmpty()) { Expression entityName = entityAnnotations.get(0).getMember("value"); Expression typeProperty = entityAnnotations.get(0).getMember("typeProperty"); if (typeProperty == null) { // default value if none given typeProperty = new ConstantExpression("_type"); } // add the vertex field FieldNode vertexField = clazz.addField("v", Modifier.PRIVATE, VERTEX_CLASS, null); // add the vertex field FieldNode graphField = clazz.addField("g", Modifier.PRIVATE, GRAPH_CLASS, null); // add constructor clazz.addConstructor(buildVertexGraphConstructor(vertexField, graphField, typeProperty, entityName)); // get all non-static properties List<PropertyNode> properties = AbstractASTTransformUtil .getInstanceProperties(clazz); List<PropertyNode> newProperties = new ArrayList<>(); for (PropertyNode property : properties) { // TODO check for "transient" properties? // TODO check not allowed property names, e.g. id, v, g // TODO decide on kind of property // add static findByX method clazz.addMethod(buildFindByMethod(clazz, entityName, typeProperty, property.getName(), property.getType())); // add static findUniqueByX method clazz.addMethod(buildGetByMethod(clazz, entityName, typeProperty, property.getName(), property.getType())); // update property property.setGetterBlock(createGetter(property.getName(), vertexField)); property.setSetterBlock(createSetter(property.getName(), vertexField)); newProperties.add(property); } // readd updated properties for (PropertyNode property : newProperties) { readdProperty(clazz, property); } // add the vertex getter clazz.addMethod("getV", Modifier.PUBLIC, VERTEX_CLASS, // new Parameter[0], new ClassNode[0], new ReturnStatement( new FieldExpression(vertexField))); // add the graph getter clazz.addMethod("getG", Modifier.PUBLIC, GRAPH_CLASS, // new Parameter[0], new ClassNode[0], new ReturnStatement( new FieldExpression(graphField))); // add the id getter clazz.addMethod("getId", Modifier.PUBLIC, ClassHelper.OBJECT_TYPE, new Parameter[0], new ClassNode[0], new ReturnStatement( new MethodCallExpression(new FieldExpression(vertexField), "getId", new ArgumentListExpression()))); // add delete method clazz.addMethod(buildDeleteMethod(vertexField, graphField)); // add static create method clazz.addMethod(buildCreateMethod(clazz, entityName)); // add static findAll method clazz.addMethod(buildFindAllMethod(clazz, entityName, typeProperty)); // add static getById method clazz.addMethod(buildGetByIdMethod(clazz)); // add static initGraph method clazz.addMethod(buildInitGraphMethod(entityName)); } } } /** * Create a static method that initializes a graph. For an * {@link OrientGraph} it registers the entity class as a schema type. * * @param entityName the entity name * @return the method */ private MethodNode buildInitGraphMethod(Expression entityName) { // graph (parameter) VariableExpression graph = new VariableExpression("graph"); BlockStatement code = new BlockStatement(); // register class code.addStatement(new ExpressionStatement(new StaticMethodCallExpression( VE_DELEGATES_CLASS, VertexEntityDelegates.METHOD_REGISTER_CLASS, new ArgumentListExpression(graph, entityName)))); return new MethodNode("initGraph", Modifier.PUBLIC | Modifier.STATIC, ClassHelper.VOID_TYPE, new Parameter[] { new Parameter(GRAPH_CLASS, "graph") }, new ClassNode[0], code); } /** * Create a call to initGraph(Graph). * * @param clazz the entity class * @param graph the graph to initialize * @return the method call statement */ private Statement callInitGraph(ClassNode clazz, Expression graph) { return new ExpressionStatement(new StaticMethodCallExpression(clazz, "initGraph", new ArgumentListExpression(graph))); } /** * Create a method the removes the entity from the graph. * * @param vertexField the vertex field * @param graphField the graph field * @return the delete method */ private MethodNode buildDeleteMethod(FieldNode vertexField, FieldNode graphField) { BlockStatement code = new BlockStatement(); // > g.removeVertex(v) code.addStatement(new ExpressionStatement(new MethodCallExpression(new FieldExpression( graphField), "removeVertex", new ArgumentListExpression(new FieldExpression( vertexField))))); // reset graph field // > g = null code.addStatement(AbstractASTTransformUtil.assignStatement(new FieldExpression(graphField), new ConstantExpression(null))); return new MethodNode("delete", Modifier.PUBLIC, ClassHelper.VOID_TYPE, new Parameter[0], new ClassNode[0], code); } /** * Create a static method that allows creating a new vertex and adding it to * a graph. * * @param clazz the entity class * @param entityName the entity name * @return the static create method taking a graph as an argument */ private MethodNode buildCreateMethod(ClassNode clazz, Expression entityName) { clazz = ClassHelper.make(clazz.getName()); BlockStatement code = new BlockStatement(); // graph (parameter) VariableExpression graph = new VariableExpression("graph"); // initialize graph code.addStatement(callInitGraph(clazz, graph)); // vertex (local variable) VariableExpression vertex = new VariableExpression("vertex"); // id (local variable) VariableExpression id = new VariableExpression("id"); code.addStatement(AbstractASTTransformUtil.declStatement(id, new ConstantExpression(null))); // id = OrientGraph.CLASS_PREFIX + entityName Statement orientBlock = AbstractASTTransformUtil.assignStatement(id, new BinaryExpression( new ConstantExpression(OrientGraph.CLASS_PREFIX), TOKEN_PLUS, entityName)); // > if (graph instanceof OrientGraph) { // > id = OrientGraph.CLASS_PREFIX + entityName // > } code.addStatement(new IfStatement(AbstractASTTransformUtil.isInstanceOf(graph, ORIENT_GRAPH_CLASS), orientBlock, new EmptyStatement())); // > vertex = graph.addVertex(id) Statement assignVertex = AbstractASTTransformUtil.declStatement(vertex, new MethodCallExpression(graph, new ConstantExpression("addVertex"), new ArgumentListExpression(id))); code.addStatement(assignVertex); // > return new Entity(vertex, graph) code.addStatement(new ReturnStatement(new ConstructorCallExpression(clazz, new ArgumentListExpression(vertex, graph)))); return new MethodNode("create", Modifier.STATIC | Modifier.PUBLIC, clazz, new Parameter[] { new Parameter(GRAPH_CLASS, "graph") }, new ClassNode[0], code); } /** * Create a static method to retrieve all objects in a graph. * * @param clazz the entity class node * @param entityName the entity name * @param typeProperty the name of the property holding the entity name in a * vertex * @return the method */ private MethodNode buildFindAllMethod(ClassNode clazz, Expression entityName, Expression typeProperty) { clazz = ClassHelper.make(clazz.getName()); ClassNode returnType = ITERABLE_CLASS.getPlainNodeReference(); // add generic type argument returnType.setGenericsTypes(new GenericsType[] { new GenericsType(clazz) }); BlockStatement code = new BlockStatement(); // initialize graph code.addStatement(callInitGraph(clazz, new VariableExpression("graph"))); /* * def vertices = VertexEntityDelegates.findAllDelegate(graph, * entityName, typeProperty) */ VariableExpression vertices = new VariableExpression("vertices"); ArgumentListExpression args = new ArgumentListExpression(); args.addExpression(new VariableExpression("graph")); args.addExpression(entityName); args.addExpression(typeProperty); code.addStatement(AbstractASTTransformUtil.declStatement(vertices, new StaticMethodCallExpression(VE_DELEGATES_CLASS, VertexEntityDelegates.METHOD_FIND_ALL, args))); /* * return new IterableDelegate(vertices, EntityClass, graph) */ ArgumentListExpression createDelegateArgs = new ArgumentListExpression(); createDelegateArgs.addExpression(vertices); createDelegateArgs.addExpression(new ClassExpression(clazz)); createDelegateArgs.addExpression(new VariableExpression("graph")); code.addStatement(new ReturnStatement(new ConstructorCallExpression( VE_ITERABLE_DELEGATE_CLASS, createDelegateArgs))); return new MethodNode("findAll", Modifier.STATIC | Modifier.PUBLIC, returnType, new Parameter[] { new Parameter(GRAPH_CLASS, "graph") }, new ClassNode[0], code); } /** * Create a static method to retrieve objects by property value. * * @param clazz the entity class node * @param entityName the entity name * @param typeProperty the name of the property holding the entity name in a * vertex * @param propertyName the property name * @param propertyType the property type * @return the method */ private MethodNode buildFindByMethod(ClassNode clazz, Expression entityName, Expression typeProperty, String propertyName, ClassNode propertyType) { clazz = ClassHelper.make(clazz.getName()); propertyType = ClassHelper.make(propertyType.getName()); ClassNode returnType = ITERABLE_CLASS.getPlainNodeReference(); // add generic type argument returnType.setGenericsTypes(new GenericsType[] { new GenericsType(clazz) }); String methodName = "findBy" + Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1); BlockStatement code = new BlockStatement(); // initialize graph code.addStatement(callInitGraph(clazz, new VariableExpression("graph"))); /* * def vertices = VertexEntityDelegates.findByDelegate(graph, * entityName, typeProperty, propertyName, value) */ VariableExpression vertices = new VariableExpression("vertices"); ArgumentListExpression args = new ArgumentListExpression(); args.addExpression(new VariableExpression("graph")); args.addExpression(entityName); args.addExpression(typeProperty); args.addExpression(new ConstantExpression(propertyName)); args.addExpression(new VariableExpression("value")); code.addStatement(AbstractASTTransformUtil.declStatement(vertices, new StaticMethodCallExpression(VE_DELEGATES_CLASS, VertexEntityDelegates.METHOD_FIND_BY, args))); /* * return new IterableDelegate(vertices, EntityClass, graph) */ ArgumentListExpression createDelegateArgs = new ArgumentListExpression(); createDelegateArgs.addExpression(vertices); createDelegateArgs.addExpression(new ClassExpression(clazz)); createDelegateArgs.addExpression(new VariableExpression("graph")); code.addStatement(new ReturnStatement(new ConstructorCallExpression( VE_ITERABLE_DELEGATE_CLASS, createDelegateArgs))); return new MethodNode(methodName, Modifier.STATIC | Modifier.PUBLIC, returnType, new Parameter[] { new Parameter(GRAPH_CLASS, "graph"), new Parameter(propertyType, "value") }, new ClassNode[0], code); } /** * Create a static method to get an entity by its ID. * * @param clazz the entity class node * @return the method */ private MethodNode buildGetByIdMethod(ClassNode clazz) { clazz = ClassHelper.make(clazz.getName()); BlockStatement code = new BlockStatement(); // initialize graph code.addStatement(callInitGraph(clazz, new VariableExpression("graph"))); // def vertex = graph.getVertex(id) VariableExpression vertex = new VariableExpression("vertex"); code.addStatement(AbstractASTTransformUtil.declStatement(vertex, new MethodCallExpression( new VariableExpression("graph"), "getVertex", new ArgumentListExpression( new VariableExpression("id"))))); /* * return new EntityClass(vertex, graph) */ Statement returnEntity = new ReturnStatement(new ConstructorCallExpression(clazz, new ArgumentListExpression(vertex, new VariableExpression("graph")))); // return null Statement returnNull = new ReturnStatement(new ConstantExpression(null)); // if (vertex == null) ... else ... code.addStatement(new IfStatement(AbstractASTTransformUtil.equalsNullExpr(vertex), returnNull, returnEntity)); return new MethodNode("getById", Modifier.STATIC | Modifier.PUBLIC, clazz, new Parameter[] { new Parameter(GRAPH_CLASS, "graph"), new Parameter(ClassHelper.OBJECT_TYPE, "id") }, new ClassNode[] { VE_NON_UNIQUE_EXCEPTION }, code); } /** * Create a static method to retrieve an object by property value. * * @param clazz the entity class node * @param entityName the entity name * @param typeProperty the name of the property holding the entity name in a * vertex * @param propertyName the property name * @param propertyType the property type * @return the method */ private MethodNode buildGetByMethod(ClassNode clazz, Expression entityName, Expression typeProperty, String propertyName, ClassNode propertyType) { clazz = ClassHelper.make(clazz.getName()); propertyType = ClassHelper.make(propertyType.getName()); String methodName = "getBy" + Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1); BlockStatement code = new BlockStatement(); // initialize graph code.addStatement(callInitGraph(clazz, new VariableExpression("graph"))); /* * def vertex = VertexEntityDelegates.findUniqueByDelegate(graph, * entityName, typeProperty, propertyName, value) */ VariableExpression vertex = new VariableExpression("vertex"); ArgumentListExpression args = new ArgumentListExpression(); args.addExpression(new VariableExpression("graph")); args.addExpression(entityName); args.addExpression(typeProperty); args.addExpression(new ConstantExpression(propertyName)); args.addExpression(new VariableExpression("value")); code.addStatement(AbstractASTTransformUtil.declStatement(vertex, new StaticMethodCallExpression(VE_DELEGATES_CLASS, VertexEntityDelegates.METHOD_GET_BY, args))); /* * return new EntityClass(vertex, graph) */ Statement returnEntity = new ReturnStatement(new ConstructorCallExpression(clazz, new ArgumentListExpression(vertex, new VariableExpression("graph")))); // return null Statement returnNull = new ReturnStatement(new ConstantExpression(null)); // if (vertex == null) ... else ... code.addStatement(new IfStatement(AbstractASTTransformUtil.equalsNullExpr(vertex), returnNull, returnEntity)); return new MethodNode(methodName, Modifier.STATIC | Modifier.PUBLIC, clazz, new Parameter[] { new Parameter(GRAPH_CLASS, "graph"), new Parameter(propertyType, "value") }, new ClassNode[] { VE_NON_UNIQUE_EXCEPTION }, code); } /** * Create a constructor taking a Vertex and a Graph as an argument, * assigning them to the vertex and graph fields. * * @param vertexField the vertex field * @param graphField the graph field * @param typeProperty the expression specifying the name of the type * property * @param entityName the expression specifying the entity name * @return a constructor taking a Vertex as an argument */ private ConstructorNode buildVertexGraphConstructor(FieldNode vertexField, FieldNode graphField, Expression typeProperty, Expression entityName) { BlockStatement block = new BlockStatement(); // > this.v = v block.addStatement(AbstractASTTransformUtil.assignStatement( new FieldExpression(vertexField), new VariableExpression("v"))); // > this.g = g block.addStatement(AbstractASTTransformUtil.assignStatement( new FieldExpression(graphField), new VariableExpression("g"))); // this.v.setProperty(typeProperty, entityName) Statement notOrientStatement = new ExpressionStatement(new MethodCallExpression( new FieldExpression(vertexField), "setProperty", new ArgumentListExpression( new Expression[] { typeProperty, entityName }))); // > if (!(this.g instanceof OrientGraph)) // > this.v.setProperty(typeProperty, entityName) block.addStatement(new IfStatement(new NotExpression(AbstractASTTransformUtil.isInstanceOf( new FieldExpression(graphField), ORIENT_GRAPH_CLASS)), notOrientStatement, new EmptyStatement())); return new ConstructorNode(Modifier.PUBLIC, new Parameter[] { new Parameter(VERTEX_CLASS, "v"), new Parameter(GRAPH_CLASS, "g") }, new ClassNode[0], block); } /** * Add the given property and clean up the old with the same name. * * @param clazz the class node to add the property to * @param property the property node */ private void readdProperty(ClassNode clazz, PropertyNode property) { clazz.getProperties().remove(property); final FieldNode fn = property.getField(); clazz.getFields().remove(fn); clazz.addProperty(property.getName(), property.getModifiers(), property.getType(), property.getInitialExpression(), property.getGetterBlock(), property.getSetterBlock()); final FieldNode newfn = clazz.getField(fn.getName()); clazz.getFields().remove(newfn); // the original field is not needed // cNode.addField(fn); } private Statement createSetter(String name, FieldNode vertexField) { BlockStatement block = new BlockStatement(); /* * > v.setProperty(name, value) */ ArgumentListExpression args = new ArgumentListExpression(); args.addExpression(new ConstantExpression(name)); args.addExpression(new VariableExpression("value")); block.addStatement(new ExpressionStatement(new MethodCallExpression(new FieldExpression( vertexField), "setProperty", args))); return block; } private Statement createGetter(String name, FieldNode vertexField) { BlockStatement block = new BlockStatement(); /* * > v.getProperty(name) */ ArgumentListExpression args = new ArgumentListExpression(); args.addExpression(new ConstantExpression(name)); block.addStatement(new ExpressionStatement(new MethodCallExpression(new FieldExpression( vertexField), "getProperty", args))); return block; } }
[ "simon.templer@igd.fraunhofer.de" ]
simon.templer@igd.fraunhofer.de
e7e32b5563b0b3a9567d16d7ea4315ad3e355389
6889f8f30f36928a2cd8ba880032c855ac1cc66c
/SemplestServiceMSNv8r3/src/com/microsoft/adcenter/v8/GetBusinessesByIdsRequest.java
3b102f41087563344050b1b27479a71e14d71896
[]
no_license
enterstudio/semplest2
77ceb4fe6d076f8c161d24b510048802cd029b67
44eeade468a78ef647c62deb4cec2bea4318b455
refs/heads/master
2022-12-28T18:35:54.723459
2012-11-20T15:39:09
2012-11-20T15:39:09
86,645,696
0
0
null
2020-10-14T08:14:22
2017-03-30T01:32:35
Roff
UTF-8
Java
false
false
4,319
java
/** * GetBusinessesByIdsRequest.java * * This file was auto-generated from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */ package com.microsoft.adcenter.v8; public class GetBusinessesByIdsRequest implements java.io.Serializable { private long[] businessIds; public GetBusinessesByIdsRequest() { } public GetBusinessesByIdsRequest( long[] businessIds) { this.businessIds = businessIds; } /** * Gets the businessIds value for this GetBusinessesByIdsRequest. * * @return businessIds */ public long[] getBusinessIds() { return businessIds; } /** * Sets the businessIds value for this GetBusinessesByIdsRequest. * * @param businessIds */ public void setBusinessIds(long[] businessIds) { this.businessIds = businessIds; } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof GetBusinessesByIdsRequest)) return false; GetBusinessesByIdsRequest other = (GetBusinessesByIdsRequest) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((this.businessIds==null && other.getBusinessIds()==null) || (this.businessIds!=null && java.util.Arrays.equals(this.businessIds, other.getBusinessIds()))); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = 1; if (getBusinessIds() != null) { for (int i=0; i<java.lang.reflect.Array.getLength(getBusinessIds()); i++) { java.lang.Object obj = java.lang.reflect.Array.get(getBusinessIds(), i); if (obj != null && !obj.getClass().isArray()) { _hashCode += obj.hashCode(); } } } __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(GetBusinessesByIdsRequest.class, true); static { typeDesc.setXmlType(new javax.xml.namespace.QName("https://adcenter.microsoft.com/v8", ">GetBusinessesByIdsRequest")); org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("businessIds"); elemField.setXmlName(new javax.xml.namespace.QName("https://adcenter.microsoft.com/v8", "BusinessIds")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "long")); elemField.setMinOccurs(0); elemField.setNillable(true); elemField.setItemQName(new javax.xml.namespace.QName("http://schemas.microsoft.com/2003/10/Serialization/Arrays", "long")); typeDesc.addFieldDesc(elemField); } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } /** * Get Custom Serializer */ public static org.apache.axis.encoding.Serializer getSerializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanSerializer( _javaType, _xmlType, typeDesc); } /** * Get Custom Deserializer */ public static org.apache.axis.encoding.Deserializer getDeserializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanDeserializer( _javaType, _xmlType, typeDesc); } }
[ "mitch@02200ff9-b5b2-46f0-9171-221b09c08c7b" ]
mitch@02200ff9-b5b2-46f0-9171-221b09c08c7b
1f57c52b20131ab2b702527be1dcaf39cc2c98e9
67f429b14c7ba28cd8a25affd90f4727bc5c7d8e
/Pixelocalypse/src/com/thale/engine/ResourceLoader.java
9608b6ba3d47ecbbca356113fd4caae984bc8a05
[]
no_license
rh3547/Pixelocalypse
9241300423e7e118a05bd5a7a2fe30bf915b0788
e9b9ebe72b49fce76b7845793f0f65b5a20624a8
refs/heads/master
2021-01-21T14:43:22.330052
2017-06-24T22:36:21
2017-06-24T22:36:21
95,326,317
0
0
null
null
null
null
UTF-8
Java
false
false
763
java
package com.thale.engine; import java.awt.Image; import javax.swing.ImageIcon; import com.thale.locations.LocationManager; public class ResourceLoader extends GameAsset { private static Game game; public static Image bgImage; public ResourceLoader(Game game) { super(game); this.game = game; } public static void loadFonts() { GameFonts.addFont(new GameFonts(game.getRespath() + "font/Minecraftia.ttf")); } public static void loadBgImage() { ImageIcon bgII = new ImageIcon(game.getRespath() + "/gui/backgrounds/mainBg.png"); bgImage = bgII.getImage(); } public static void loadResources() { } public static Image getBgImage() { return bgImage; } public static void setGame(Game gameset) { game = gameset; } }
[ "rh3547@rit.edu" ]
rh3547@rit.edu
9bf990f54e6649c9766867f1be0c22cb8d8baaeb
71288bee1619cf0b12fb15ac1d6e680bd644c6ad
/gen/com/codepath/apps/simpletwitterclient/R.java
a64a4e076879e30821fa604d9a909998b73e02d6
[]
no_license
mttlee0/android-simple-twitter-client
e22c75dd63c6761ad635d217761b0b65260a08ca
360407cb241489e3dff9c37304adf50085104554
refs/heads/master
2016-09-06T10:37:02.000530
2013-09-07T10:59:02
2013-09-07T10:59:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,249
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.codepath.apps.simpletwitterclient; public final class R { public static final class attr { } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Customize dimensions originally defined in res/values/dimens.xml (such as screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. */ public static final int activity_horizontal_margin=0x7f040000; public static final int activity_vertical_margin=0x7f040001; } public static final class drawable { public static final int ic_action_tweet_btn=0x7f020000; public static final int ic_action_twitter_logo=0x7f020001; public static final int ic_launcher=0x7f020002; public static final int ic_launcher_twitter_icon=0x7f020003; } public static final class id { public static final int action_settings=0x7f08000d; public static final int btnTweet=0x7f080004; public static final int etTweetBody=0x7f080003; public static final int itComposeActionBar=0x7f08000b; public static final int itLoginActionBar=0x7f08000c; public static final int itTimelineActionBar=0x7f08000e; public static final int ivProfile=0x7f080007; public static final int ivUserProfilePic=0x7f080000; public static final int lvTweets=0x7f080006; public static final int separator=0x7f080002; public static final int tvBody=0x7f080009; public static final int tvCharacterCount=0x7f080005; public static final int tvName=0x7f080008; public static final int tvTimestamp=0x7f08000a; public static final int tvUserScreenName=0x7f080001; } public static final class layout { public static final int activity_compose_tweet=0x7f030000; public static final int activity_login=0x7f030001; public static final int activity_timeline=0x7f030002; public static final int tweet_item=0x7f030003; } public static final class menu { public static final int compose_tweet=0x7f070000; public static final int login=0x7f070001; public static final int photos=0x7f070002; public static final int timeline=0x7f070003; } public static final class string { public static final int action_settings=0x7f050003; public static final int app_name=0x7f050000; public static final int hello_world=0x7f050004; public static final int login_label=0x7f050006; public static final int title_activity_compose_tweet=0x7f050008; public static final int title_activity_photos=0x7f050005; public static final int title_activity_timeline=0x7f050007; public static final int title_compose_action_bar=0x7f050002; public static final int title_login_action_bar=0x7f050001; public static final int tweet_btn_text=0x7f050009; } 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=0x7f060000; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f060001; } }
[ "Matt@unknownb8f6b11c341f.gateway.2wire.net" ]
Matt@unknownb8f6b11c341f.gateway.2wire.net
6f0613acc149853c12ea226a76bebdef9c94581a
40e2df4f5e65db821c2ad1a8af9173b50b8fa2f8
/src/main/java/com/mycompany/xmlmodelparser/UserHandler.java
b67b8a126eddef938d1cd5e4c62014de60b3cc76
[]
no_license
Lundii/xml-parser
58e7d206e4aefd47c613b550345bf3210477ce5c
2a8db82e3758111703ea033b2a9fd4105773d15f
refs/heads/master
2022-11-27T11:53:02.831730
2020-07-27T13:06:16
2020-07-27T13:06:16
282,899,266
0
0
null
null
null
null
UTF-8
Java
false
false
2,447
java
package com.mycompany.xmlmodelparser; import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler; public class UserHandler extends DefaultHandler { private static final String USER = "user"; private static final String FIRSTNAME = "firstname"; private static final String LASTNAME = "lastname"; private static final String EMAIL = "email"; private static final String PASSWORD = "password"; public List<User> users; public String currentValue; public User currentUser; @Override public void characters(char[] ch, int start, int length) throws SAXException { currentValue = new String(ch, start, length); } @Override public void endElement(String uri, String localName, String qName) throws SAXException { switch (qName) { case USER: { users.add(currentUser); break; } case FIRSTNAME: { currentUser.setFirstname(currentValue); break; } case LASTNAME: { currentUser.setLastname(currentValue); break; } case EMAIL: { currentUser.setEmail(currentValue); break; } case PASSWORD: { currentUser.setPassword(currentValue); break; } } } @Override public void startDocument() throws SAXException { users = new ArrayList<>(); } @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { switch (qName) { case USER: { currentUser = new User(); String id = attributes.getValue("id"); currentUser.setId(id); } } } public List<User> getAllUsers() { return users; } public User findUserByEmail(String email) throws Exception { User user = users.stream() .filter(curUser -> curUser.getEmail().equals(email)) .findAny() .orElse(null); if(!(user instanceof User)){ throw new Exception("No User with that email found"); } return user; } public User findUserById(String id) throws Exception { User user = users.stream() .filter(curUser -> curUser.getId().equals(id)) .findFirst() .orElse(null); if(!(user instanceof User)){ throw new Exception("No User with that id found"); } return user; } }
[ "mondayemmanuel67@gmail.com" ]
mondayemmanuel67@gmail.com
1339f7184e0c0c8e50c6f7a7a27152eee63f4a3f
d9d8bf3702848435edeaf92e9f5b55a8a5ea8254
/solvers/java/src/main/java/com/analog/lyric/dimple/factorfunctions/MultinomialUnnormalizedParameters.java
63d7fbbbed61dd1a4a98ee0ec96adace045646b7
[ "BSD-3-Clause", "Minpack", "Apache-2.0" ]
permissive
yujianyuanhaha/Co-Channel-Sig-Detection
8fb79cfbbd560dcb3205c53fa57c2e19081a8ad7
5c6b4d203957fb043966ff17a2241555cf03e5fe
refs/heads/master
2022-01-22T23:20:18.052915
2019-06-17T04:38:11
2019-06-17T04:38:11
166,728,619
3
1
null
null
null
null
UTF-8
Java
false
false
5,736
java
/******************************************************************************* * Copyright 2013 Analog Devices, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ********************************************************************************/ package com.analog.lyric.dimple.factorfunctions; import com.analog.lyric.dimple.exceptions.DimpleException; import com.analog.lyric.dimple.factorfunctions.core.FactorFunction; import com.analog.lyric.dimple.factorfunctions.core.FactorFunctionUtilities; import com.analog.lyric.dimple.model.values.Value; /** * Parameterized multinomial distribution, which corresponds to p(x | N, alpha), * where x is a vector of discrete count variables, N is the total count across all categories, and * where alpha is a vector of real probability parameters (not necessarily normalized). * <p> * The domain of each x variable must be a zero-based integer with maximum value N (domain 0 through N). * If N is a variable rather than a constant, then the domain of each x must be range from 0 through * the maximum value in the domain of N. * <p> * Representing alpha as described, the conjugate prior for alpha is such that * each entry of alpha is independently distributed according to * a Gamma distribution, all with a common Beta parameter. * Depending on the solver, it may or may not be necessary to use a * conjugate prior (for the Gibbs solver, for example, it is not). * <p> * The variables in the argument list are ordered as follows: * <ol> * <li> N: Parameter indicating the total count * <li>...dimension+1) Alpha: A number of Real variables containing unnormalized probabilities, where * the number of variables must equal the specified dimension * <li>dimension+2...2*dimension+1) x: A number of discrete count variable, where the number of variables * must equal the specified dimension * </ol> * N parameter may optionally be specified as a constant in the constructor. * In this case, N is not included in the list of arguments. * * @since 0.06 */ public class MultinomialUnnormalizedParameters extends FactorFunction { private int _dimension; protected int _N; protected double _negativeLogFactorialN; protected boolean _NParameterConstant; private double[] _alpha; private int _firstDirectedToIndex; public MultinomialUnnormalizedParameters(int dimension) // Variable N { super(); _dimension = dimension; _NParameterConstant = false; _firstDirectedToIndex = dimension + 1; _alpha = new double[dimension]; } public MultinomialUnnormalizedParameters(int dimension, int N) // Fixed N { super(); _dimension = dimension; _N = N; if (_N < 0) throw new DimpleException("N must be a non-negative value."); _negativeLogFactorialN = -org.apache.commons.math3.special.Gamma.logGamma(_N + 1); _NParameterConstant = true; _firstDirectedToIndex = dimension; _alpha = new double[dimension]; } @Override public final double evalEnergy(Value[] arguments) { int index = 0; if (!_NParameterConstant) { _N = arguments[index++].getInt(); // First argument is N parameter if (_N < 0) return Double.POSITIVE_INFINITY; _negativeLogFactorialN = -org.apache.commons.math3.special.Gamma.logGamma(_N + 1); } for (int i = 0; i < _dimension; i++) { final double a = arguments[index++].getDouble(); // Next _dimension arguments are vector of Alpha parameters if (a < 0) return Double.POSITIVE_INFINITY; _alpha[i] = a; } if (arguments.length - index != _dimension) throw new DimpleException("Number of count variables must equal the dimension of the parameter vector."); int countSum = 0; double parameterSum = 0; double sum = _negativeLogFactorialN; for (int i = 0; i < _dimension; i++) { final double alphai = _alpha[i]; if (alphai < 0) return Double.POSITIVE_INFINITY; parameterSum += alphai; final int x = arguments[index++].getInt(); // Remaining arguments are discrete count variables if (x < 0) return Double.POSITIVE_INFINITY; countSum += x; double negativeXLogAlphai; if (alphai == 0 && x == 0) negativeXLogAlphai = 0; else negativeXLogAlphai = -x * Math.log(alphai); sum += negativeXLogAlphai + org.apache.commons.math3.special.Gamma.logGamma(x + 1); } if (countSum != _N) return Double.POSITIVE_INFINITY; final double energy = sum + _N * Math.log(parameterSum); if (energy != energy) // Faster isNaN return Double.POSITIVE_INFINITY; return energy; } @Override public final boolean isDirected() {return true;} @Override public final int[] getDirectedToIndices(int numEdges) { // All edges except the parameter edges (if present) are directed-to edges return FactorFunctionUtilities.getListOfIndices(_firstDirectedToIndex, numEdges-1); } // Factor-specific methods public final int getDimension() { return _dimension; } public final boolean hasConstantNParameter() { return _NParameterConstant; } public final int getN() { return _N; } }
[ "jianyuan@vt.edu" ]
jianyuan@vt.edu
0f257fb3f3e4798e0b677c37bf369d004ee70459
38b426f5acc8f75599953c1642b65276457aa82e
/mrpc-core/src/main/java/com/kongzhong/mrpc/spring/RpcNameSpaceHandler.java
8deac38e95ea9b9eac8d2c7e70f3c7d7aafe0054
[]
no_license
Lunsqby/mrpc
ee2f5290d42adaed9f7c750f7842300bcdf644e2
0afa79e107fb2ae9fd284e2586ea9618b640ff6e
refs/heads/master
2021-01-11T13:57:35.982224
2017-06-20T09:15:37
2017-06-20T09:15:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
911
java
package com.kongzhong.mrpc.spring; import com.kongzhong.mrpc.spring.parser.ClientBeanDefinitionParser; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.xml.NamespaceHandlerSupport; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; public class RpcNameSpaceHandler extends NamespaceHandlerSupport { public RpcNameSpaceHandler() { } @Override public void init() { this.registerBeanDefinitionParser("referer", new ClientBeanDefinitionParser()); } public BeanDefinition parse(Element element, ParserContext parserContext) { // parserContext.getRegistry().registerBeanDefinition(ClientRpcContext.class.getName(), // BeanDefinitionBuilder.rootBeanDefinition(ClientRpcContext.class).getBeanDefinition()); return super.parse(element, parserContext); } }
[ "biezhi.me@gmail.com" ]
biezhi.me@gmail.com
e97c4176b5250c4d430b0ab0278e8dec3fed6e1a
a5b68d162ed7d977679451337fba3bc3c762c714
/sandbox/src/main/java/ru/stqa/pft/sandbox/Square.java
e955225afc6c0f0c96a533c8f722908f013fe12f
[ "Apache-2.0" ]
permissive
andreyskubakov/java_pft_Skubakov
a7cdfeec3f398080cca604ec9daf388bd3388fae
6c97433302b8203b18de07b7dfb859517521d39f
refs/heads/master
2022-12-05T10:21:01.346380
2020-08-15T14:53:37
2020-08-15T14:53:37
275,852,643
0
0
null
null
null
null
UTF-8
Java
false
false
184
java
package ru.stqa.pft.sandbox; public class Square { public double l; public Square(double l) { this.l = l; } public double area () { return this.l * this.l; } }
[ "skubakov_a@mail.ru" ]
skubakov_a@mail.ru
60d402adb41d0c95234125bfea9ee70f91e2709f
99c0237d954a8182df65c7cf683dd99da8bd78eb
/src/TurtlePanel.java
3668f869656b1ae744f6041f3a061ab59d4ffc97
[ "MIT" ]
permissive
seanedwards/evolutionary-turtles
49cd41e325dfda185c1984b9ac313a053dbbf5fd
f51c52c84ec6865498543f38d568e5b26791e560
refs/heads/master
2021-01-20T04:32:15.662401
2011-06-20T14:42:33
2011-06-20T14:42:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,434
java
import java.awt.*; import javax.swing.*; import java.awt.event.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Edwards */ public class TurtlePanel extends JPanel { private TurtleWorld world; private LineGraph graph; private long lasttick; public TurtlePanel(TurtleWorld world, LineGraph graph) { super(); this.graph = graph; lasttick = System.nanoTime(); this.world = world; } public void paintComponent(Graphics g) { super.paintComponent(g); long thistick = System.nanoTime(); double timediff = (thistick - lasttick) / 1000000000.0; world.tick(timediff); lasttick = thistick; Dimension size = new Dimension(400, 400); for (int x = 0; x < world.getGrid().getWidth(); ++x) { for (int y = 0; y < world.getGrid().getHeight(); ++y) { GridPatch p = world.getGrid().getPatch(new Point(x, y)); g.setColor(p.getColor()); g.fillRect(x * (size.width / world.getGrid().getWidth()), y * (size.height / world.getGrid().getHeight()), (size.width / world.getGrid().getWidth()), (size.height / world.getGrid().getHeight())); } } for (AbstractTurtle t : world) { t.draw(g); } graph.update(timediff); } }
[ "devnull@localhost" ]
devnull@localhost
8591a6925404ff3c1fdb3c9e0107b54966d76593
ad45b48e36c85e16984eecc2b7c83211b8671c7c
/spring-cnamespace-demo/src/main/java/com/chuix/springdemo/CNamespaceApp.java
1a477e20d9b676bd659cf53a0df3e4399f92c6b8
[]
no_license
chuix/java
740907bc02aea25194f7413d01affb4544cc6b36
2583209d4e5bfff4635b31994758195ec581b666
refs/heads/master
2020-03-19T19:48:50.084372
2018-06-22T16:13:08
2018-06-22T16:13:08
136,874,899
1
0
null
null
null
null
UTF-8
Java
false
false
650
java
package com.chuix.springdemo; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.chuix.springdemo.domain.Organization; public class CNamespaceApp { public static void main(String[] args) { // Create the application context ApplicationContext ctx = new ClassPathXmlApplicationContext("Beans-cp.xml"); // Create the bean Organization org = (Organization) ctx.getBean("myorg"); // pring organizations details System.out.println(org); // close the application conext (container) ((ClassPathXmlApplicationContext) ctx).close(); } }
[ "carleshuix@hotmail.com" ]
carleshuix@hotmail.com
7a098b46aee63718379895ca4c4b9cec4fc297d8
2be4d6e9cde99181ce9389e00ab7f14b87d7cce7
/puppy/src/EmployeeTest.java
1a7adbc6ea870bd2a67dc2b5f018c1ce94fa9705
[]
no_license
tongzhipeng/winnie
699d532313faece23223af4f6976f16039bc9f6d
955bdd57caab9b54f662887fde13b08758c72a5b
refs/heads/master
2020-05-17T19:36:03.501262
2019-06-12T15:23:39
2019-06-12T15:23:39
183,918,849
0
0
null
null
null
null
UTF-8
Java
false
false
641
java
import java.io.*; public class EmployeeTest { public static void main(String[] args) { /* 使用构造器创建两个对象 */ Employee empOne = new Employee("RUNOOB1"); Employee empTwo = new Employee("RUNOOB2"); // 调用这两个对象的成员方法 empOne.empAge(26); empOne.empDesignation("高级程序员"); empOne.empSalary(1000); empOne.printEmployee(); empTwo.empAge(21); empTwo.empDesignation("菜鸟程序员"); empTwo.empSalary(500); empTwo.printEmployee(); Puppy p = new Puppy("winnie"); p.setAge(1); } }
[ "tongzhipeng5688@gmail.com" ]
tongzhipeng5688@gmail.com
1eb43067e91847b581b30cd8664004c0e1eac04c
505ea197f1ea9e49d8c0e73f4ecb8415ff043bea
/OnLineSpringDIStudy5/src/main/java/com/sist/di/MainClass.java
7a708ff59d78b01bc765e16640bc639cb422f032
[]
no_license
achoon91/SpringStudy
e3cba03a9eb4abc3e058b69cab1098e3a5928294
70f2ecfdcb596ae1ce32d003f4eb2a95cdb76b3f
refs/heads/master
2023-01-24T06:49:10.189864
2020-12-10T00:28:49
2020-12-10T00:28:49
313,833,344
0
0
null
null
null
null
UTF-8
Java
false
false
566
java
package com.sist.di; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import java.util.*; public class MainClass { public static void main(String[] args) { // TODO Auto-generated method stub ApplicationContext app=new ClassPathXmlApplicationContext("app.xml"); MusicDAO dao=(MusicDAO)app.getBean("dao"); List<MusicVO> list=dao.musicAllData(); for(MusicVO vo:list) { System.out.println(vo.getTitle()+" "+vo.getSinger()+" "+vo.getAlbum()); } } }
[ "achoon91@gmail.com" ]
achoon91@gmail.com
718c2110ff3b27c5603c19f0a23d5ea1939dd0b6
1a39fd264545accabb2fb50f4c39d9eb6f13406a
/app/src/main/java/com/example/viewpagetest/fragment/AddressFragment.java
0a91944d959aac3637c30228ee1ec35dcfc8e2f9
[]
no_license
xiaoerfu/ViewPageTest
1eac174408922667b79a632f764687456781356b
a05ea14cc21bd0fdf19ec8d8be5bc52c4ed68961
refs/heads/master
2021-01-19T22:34:41.719046
2017-04-20T06:22:37
2017-04-20T06:22:37
88,827,199
0
0
null
null
null
null
UTF-8
Java
false
false
556
java
package com.example.viewpagetest.fragment; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.example.viewpagetest.R; /** * A simple {@link Fragment} subclass. */ public class AddressFragment extends BaseFragment{ @Override public View initView() { View view= View.inflate(context,R.layout.fragment_address,null); return view; } @Override public View initData() { return null; } }
[ "3067418132@qq.com" ]
3067418132@qq.com
5cdd281bfa157c808ff42d6842334930ca837378
318bbe8b002205a0be45d3505f046c035a01128b
/app/src/main/java/de/blinkt/openvpn/View/SelfGridView.java
6945de88d48338e833a94a9ac9d57776e2823d4b
[]
no_license
guyuegeblog/NewUiVpnMovies_NoLive_ConfigServer
593e102508ebf58bc7cc7732dae0a1a5c2bf702a
5f5a341066503e5e3e8748919b48a3df09dc9604
refs/heads/master
2021-01-19T09:48:28.383754
2017-04-10T08:28:54
2017-04-10T08:28:54
87,786,005
0
0
null
null
null
null
UTF-8
Java
false
false
793
java
package de.blinkt.openvpn.View; import android.content.Context; import android.util.AttributeSet; import android.widget.GridView; /** * Created by Administrator on 2016/5/9. */ public class SelfGridView extends GridView { public SelfGridView(Context context, AttributeSet attrs) { super(context, attrs); } public SelfGridView(Context context) { super(context); } public SelfGridView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int expandSpec = MeasureSpec.makeMeasureSpec( Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, expandSpec); } }
[ "2219736084@qq.com" ]
2219736084@qq.com
d7b892ecf351fba59ca6e32a0f3843bb42914e10
5644a542c4470402aab1ac44b1dd9ae427364f13
/src/ap1/task11/Solution.java
4275c1c7b33db3c7c0c2922df5ecfb5165042485
[]
no_license
Torevill/CodingBat
392fda1ac0df9e3f0583a9fd7643df39382b0d55
df4d2839cfc99996da148dfb014eb89ae047a77c
refs/heads/master
2021-09-02T00:32:04.979026
2017-12-29T11:15:51
2017-12-29T11:15:51
111,561,086
0
0
null
null
null
null
UTF-8
Java
false
false
821
java
package ap1.task11; /* We'll say that a positive int n is "endy" if it is in the range 0..10 or 90..100 (inclusive). Given an array of positive ints, return a new array of length "count" containing the first endy numbers from the original array. Decompose out a separate isEndy(int n) method to test if a number is endy. The original array will contain at least "count" endy numbers. */ public class Solution { public int[] copyEndy(int[] nums, int count) { int[] a = new int[count]; for (int i = 0, j = 0; count > 0; i++) { if (isEndy(nums[i])) { a[j] = nums[i]; j++; count--; } } return a; } public boolean isEndy(int n) { return (n >= 0 && n <= 10) || (n >= 90 && n <= 100); } }
[ "Torevill@gmail.com" ]
Torevill@gmail.com
92e02afcf3b8ee49770efe4798710dbff446e8cf
138956bad98cb7bbd2e1108967712ac32a0c5451
/src/main/java/com/linhao007/www/pattern/DecoratorPattern/impl/Skills.java
0ed02c2409076ec2756dcce0bd7b753b2dc215fc
[]
no_license
linhao007/learning
fcbc85f558bb8c00d11d38eebc4e10ff5d593ae8
782a59f0a35303e9568734813ae4e991e7130a4b
refs/heads/master
2021-07-11T12:39:34.410857
2020-04-14T03:32:45
2020-04-14T03:32:45
66,897,595
0
0
null
2020-10-12T20:51:28
2016-08-30T02:09:04
Java
UTF-8
Java
false
false
501
java
package com.linhao007.www.pattern.DecoratorPattern.impl; import com.linhao007.www.pattern.DecoratorPattern.Learn; /** * @author: linhu@kanzhun.com * @date: 2020/4/9 12:03 * @description: 创建装饰角色(Skills): */ public class Skills implements Learn { private Learn learner; public Skills(Learn learner) { this.learner = learner; } @Override public void learnSkills() { if (learner != null) { learner.learnSkills(); } } }
[ "15101538245@163.com" ]
15101538245@163.com
72ede33aba8609d9bef5ddce2b5f7f18edb8e85e
f8a14fec331ec56dd7e070fc032604117f155085
/gameserver/src/main/java/ru/l2/gameserver/model/Request.java
3594e0b20004f350c4e2fe23ff3646d93602d8be
[]
no_license
OFRF/BladeRush
c2f06d050a1f2d79a9b50567b9f1152d6d755149
87329d131c0fcc8417ed15479298fdb90bc8f1d2
refs/heads/master
2023-03-25T13:51:04.404738
2020-05-04T14:37:23
2020-05-04T14:37:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,196
java
package ru.l2.gameserver.model; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ru.l2.commons.collections.MultiValueSet; import ru.l2.commons.lang.reference.HardReference; import ru.l2.commons.threading.RunnableImpl; import ru.l2.gameserver.ThreadPoolManager; import ru.l2.gameserver.data.cache.Msg; import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicInteger; public class Request extends MultiValueSet<String> { private static final long serialVersionUID = 1L; private static final Logger LOGGER = LoggerFactory.getLogger(Request.class); private static final AtomicInteger _nextId = new AtomicInteger(); private final int _id; private L2RequestType _type; private HardReference<Player> _requestor; private HardReference<Player> _reciever; private boolean _isRequestorConfirmed; private boolean _isRecieverConfirmed; private boolean _isCancelled; private boolean _isDone; private long _timeout; private Future<?> _timeoutTask; public Request(final L2RequestType type, final Player requestor, final Player reciever) { _id = _nextId.incrementAndGet(); _requestor = requestor.getRef(); _reciever = reciever.getRef(); _type = type; requestor.setRequest(this); reciever.setRequest(this); } public Request setTimeout(final long timeout) { _timeout = ((timeout > 0L) ? (System.currentTimeMillis() + timeout) : 0L); _timeoutTask = ThreadPoolManager.getInstance().schedule(new RunnableImpl() { @Override public void runImpl() { timeout(); } }, timeout); return this; } public int getId() { return _id; } public void cancel() { _isCancelled = true; if (_timeoutTask != null) { _timeoutTask.cancel(false); } _timeoutTask = null; Player player = getRequestor(); if (player != null && player.getRequest() == this) { player.setRequest(null); } player = getReciever(); if (player != null && player.getRequest() == this) { player.setRequest(null); } } public void done() { _isDone = true; if (_timeoutTask != null) { _timeoutTask.cancel(false); } _timeoutTask = null; Player player = getRequestor(); if (player != null && player.getRequest() == this) { player.setRequest(null); } player = getReciever(); if (player != null && player.getRequest() == this) { player.setRequest(null); } } public void timeout() { final Player player = getReciever(); if (player != null && player.getRequest() == this) { player.sendPacket(Msg.TIME_EXPIRED); } cancel(); } public Player getOtherPlayer(final Player player) { if (player == getRequestor()) { return getReciever(); } if (player == getReciever()) { return getRequestor(); } return null; } public Player getRequestor() { return _requestor.get(); } public Player getReciever() { return _reciever.get(); } public boolean isInProgress() { return !_isCancelled && !_isDone && (_timeout == 0L || _timeout > System.currentTimeMillis()); } public boolean isTypeOf(final L2RequestType type) { return _type == type; } public void confirm(final Player player) { if (player == getRequestor()) { _isRequestorConfirmed = true; } else if (player == getReciever()) { _isRecieverConfirmed = true; } } public boolean isConfirmed(final Player player) { if (player == getRequestor()) { return _isRequestorConfirmed; } return player == getReciever() && _isRecieverConfirmed; } public enum L2RequestType { CUSTOM, PARTY, PARTY_ROOM, CLAN, ALLY, TRADE, TRADE_REQUEST, FRIEND, CHANNEL, DUEL } }
[ "yadrov995@gmail.com" ]
yadrov995@gmail.com
fbe13da8534857a3447b837434006ae678028d28
1857ff73b4feb888d4a971642a8ff907c0ce93c4
/app/src/main/java/tk/suhel/myblog/model/CategoryListForSpinner.java
3885d865e5e90a6d20cbe7b69fc2321c7e1fc0f4
[]
no_license
stpsuhel/simple_blog_app
e37890371d8e53ac8ac7cf462970cfd5cf89b0c0
1bf55b9f6e7e72d504d7ad0f4110982622686434
refs/heads/master
2023-04-12T16:51:43.852510
2021-04-24T12:48:48
2021-04-24T12:48:48
360,497,361
0
0
null
null
null
null
UTF-8
Java
false
false
3,484
java
package tk.suhel.myblog.model; import android.util.Log; import androidx.databinding.BindingAdapter; import com.androidbuts.multispinnerfilter.KeyPairBoolData; import com.androidbuts.multispinnerfilter.MultiSpinnerSearch; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; import lombok.Data; public class CategoryListForSpinner{ private static final String TAG = "CategoryListForSpinner"; private final List<KeyPairBoolData> categoryList; private static List<KeyPairBoolData> alreadySelectedList; private static List<String> selectedCategoryList; @Inject public CategoryListForSpinner(List<KeyPairBoolData> categoryList, List<KeyPairBoolData> alreadySelectedList, List<String> selectedCategoryList) { this.categoryList = categoryList; CategoryListForSpinner.alreadySelectedList = alreadySelectedList; CategoryListForSpinner.selectedCategoryList = selectedCategoryList; setCategoryList(); } public void setCategoryList(){ categoryList.add(new KeyPairBoolData("Business", false)); categoryList.add(new KeyPairBoolData("Lifestyle", false)); categoryList.add(new KeyPairBoolData("Entertainment", false)); categoryList.add(new KeyPairBoolData("Productivity", false)); } public List<KeyPairBoolData> getCategoryList(){ return categoryList; } public void setAlreadySelectedList(List<String> list){ if (list != null && list.size() > 0) { for (String s : list) { Log.d(TAG, "setAlreadySelectedList: " + s); alreadySelectedList.add(new KeyPairBoolData(s, true)); } } } public List<String> getSelectedCategoryList(){ return selectedCategoryList; } public static Boolean ifExist(List<KeyPairBoolData> alreadySelectedList, String data){ for (KeyPairBoolData item : alreadySelectedList) { if (item.getName().equals(data)){ return true; } } return false; } @BindingAdapter("android:setCategoryToSpinner") public static void setCategoryToSpinner(MultiSpinnerSearch spinner, List<KeyPairBoolData> list) { if(alreadySelectedList.size() > 0){ for (KeyPairBoolData item: list) { if (ifExist(alreadySelectedList, item.getName())){ Log.d(TAG, "setCategoryToSpinner: " + item.getName()); item.setSelected(true); } } } spinner.setItems(list, items -> { selectedCategoryList.clear(); for (int i = 0; i < items.size(); i++) { if (items.get(i).isSelected()) { Log.i(TAG, i + " : " + items.get(i).getName() + " : " + items.get(i).isSelected()); selectedCategoryList.add(items.get(i).getName()); } } }); if (selectedCategoryList.isEmpty()){ for (KeyPairBoolData item : alreadySelectedList) { Log.d(TAG, "setCategoryToSpinner: " + item.getName()); selectedCategoryList.add(item.getName()); } } } public String listToString(List<String> list) { StringBuilder sb = new StringBuilder(); for (String s: list) { sb.append(s); sb.append(", "); } sb.setLength(sb.length()-2); return sb.toString(); } }
[ "suhelrana53@gmail.com" ]
suhelrana53@gmail.com
00b3b2b9d21bbc64a28ba1b3e2195cebb78b38f0
aa2e804a68561f56706b8aaa83252758dbfe933a
/src/main/java/com/cmcc/paymentclean/entity/dto/pcac/resq/gen/pcac027/PcacList.java
6b888318163fc80725eb0af8c3f6294d22ea86f6
[ "Apache-2.0" ]
permissive
gitldy1013/payment-clean
9613f330cfc9ac7fc7c10deb8c2147ba7f916349
1cfccd77836706cbbad516a4591442de36be9295
refs/heads/master
2023-04-14T00:56:05.662209
2021-04-29T01:45:53
2021-04-29T01:45:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,785
java
// // 此文件是由 JavaTM Architecture for XML Binding (JAXB) 引用实现 v2.2.8-b130911.1802 生成的 // 请访问 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // 在重新编译源模式时, 对此文件的所有修改都将丢失。 // 生成时间: 2020.09.18 时间 11:15:58 AM CST // package com.cmcc.paymentclean.entity.dto.pcac.resq.gen.pcac027; 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; import java.util.ArrayList; import java.util.List; /** * anonymous complex type的 Java 类。 * * <p>以下模式片段指定包含在此类中的预期内容。 * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element ref="{}Count"/> * &lt;element ref="{}UpDate"/> * &lt;element ref="{}RiskInfo" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType( name = "", propOrder = {"count", "upDate", "riskInfo"}) @XmlRootElement(name = "PcacList") public class PcacList { @XmlElement(name = "Count") protected int count; @XmlElement(name = "UpDate", required = true) protected String upDate; @XmlElement(name = "RiskInfo") protected List<RiskInfo> riskInfo; /** 获取count属性的值。 */ public int getCount() { return count; } /** 设置count属性的值。 */ public void setCount(int value) { this.count = value; } /** * 获取upDate属性的值。 * * @return possible object is {@link String } */ public String getUpDate() { return upDate; } /** * 设置upDate属性的值。 * * @param value allowed object is {@link String } */ public void setUpDate(String value) { this.upDate = value; } /** * Gets the value of the riskInfo property. * * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any * modification you make to the returned list will be present inside the JAXB object. This is why * there is not a <CODE>set</CODE> method for the riskInfo property. * * <p>For example, to add a new item, do as follows: * * <pre> * getRiskInfo().add(newItem); * </pre> * * <p>Objects of the following type(s) are allowed in the list {@link RiskInfo } */ public List<RiskInfo> getRiskInfo() { if (riskInfo == null) { riskInfo = new ArrayList<RiskInfo>(); } return this.riskInfo; } }
[ "liudongyangds@chinamobile.com" ]
liudongyangds@chinamobile.com
66f0fd676e878feee8aa3ea16fef93b8641ce340
fbaecb506535ef91c3e81cc9f247a81a73a7e9ca
/Colocvium/src/com/example/colocvium/Life.java
aff531733062f1e52be200e2e67c301b4c9b3a7e
[]
no_license
grtkachenko/Android
638637bb2aa4f3f7c59fde842f0d2a19b1949acf
188e0939cd48af5093ec8b583ee0a7b770351389
refs/heads/master
2021-01-23T13:17:15.589756
2013-06-27T21:48:59
2013-06-27T21:48:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,831
java
package com.example.colocvium; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Point; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; import java.util.Arrays; /** * User: svasilinets Date: 31.10.12 Time: 15:21 */ public class Life extends SurfaceView implements Runnable { volatile boolean running = false; Thread thread; SurfaceHolder holder; // 0 - black, 1 - white int[][] z, znew; int[] colorBitmap; static boolean wasInit = false, initBitmap = false; volatile static int n = 0; Bitmap bitmap; int width, height; static final int FRAMES_PER_COLOR = 16; public Life(Context context, AttributeSet attrs) { super(context, attrs); holder = getHolder(); initConstructor(); } public Life(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); holder = getHolder(); initConstructor(); } public Life(Context context) { super(context); holder = getHolder(); initConstructor(); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { // TODO Auto-generated method stub super.onSizeChanged(w, h, oldw, oldh); if (initBitmap) { return; } else { initBitmap = true; } this.width = w - w % 30; this.height = h - h % 30; bitmap = Bitmap.createBitmap(this.width, this.height, Bitmap.Config.RGB_565); bitmap.eraseColor(Color.BLACK); colorBitmap = new int[this.width * this.height]; Arrays.fill(colorBitmap, Color.BLACK); z = new int[this.height / 30][this.width / 30]; znew = new int[this.height / 30][this.width / 30]; z[10][10] = 1; z[10][11] = 1; z[10][12] = 1; z[11][12] = 1; z[12][11] = 1; thread.start(); } private void initConstructor() { } Integer curx = null, cury = null; @Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { int x = (int) event.getX(); int y = (int) event.getY(); x /= 30; y /= 30; fillByCoordinate(y, x, color(1 - z[y][x])); z[y][x] = 1 - z[y][x]; bitmap.setPixels(colorBitmap, 0, this.width, 0, 0, this.width, this.height); Canvas canvas = holder.lockCanvas(); onDraw(canvas); holder.unlockCanvasAndPost(canvas); return true; } return false; } public void run() { initField(); while (running) { if (holder.getSurface().isValid()) { updateField(); Canvas canvas = holder.lockCanvas(); onDraw(canvas); holder.unlockCanvasAndPost(canvas); } // System.out.println("runnibg " + ); try { Thread.sleep(16); } catch (InterruptedException e) { e.printStackTrace(); } } } public void resume() { running = true; thread = new Thread(this); if (initBitmap) { thread.start(); } } public void pause() { running = false; try { thread.join(); } catch (InterruptedException ignore) { } } void initField() { if (!wasInit) { wasInit = true; } else { return; } n = 0; running = true; bitmap.eraseColor(Color.BLACK); for (int i = 0; i < this.height / 30; i++) { for (int j = 0; j < this.width / 30; j++) { fillByCoordinate(i, j, color(z[i][j])); } } bitmap.setPixels(colorBitmap, 0, this.width, 0, 0, this.width, this.height); } private void fillByCoordinate(int x, int y, int color) { for (int i = x * 30; i < x * 30 + 30; i++) { for (int j = y * 30; j < y * 30 + 30; j++) { colorBitmap[i * this.width + j] = color; } } } void updateField() { for (int i = 0; i < this.height / 30; i++) { for (int j = 0; j < this.width / 30; j++) { int countAlive = 0; for (int ii = -1; ii <= 1; ii++) { for (int jj = -1; jj <= 1; jj++) { if (ii != 0 || jj != 0) { if (z[(i + ii + (this.height / 30)) % (this.height / 30)][(j + jj + (this.width / 30)) % (this.width / 30)] == 1) { countAlive++; } } } } if (countAlive < 2 || countAlive > 3) { znew[i][j] = 0; } else if (countAlive == 3) { znew[i][j] = 1; } else if (countAlive == 2) { znew[i][j] = z[i][j]; } } } for (int i = 0; i < this.height / 30; i++) { for (int j = 0; j < this.width / 30; j++) { z[i][j] = znew[i][j]; } } for (int i = 0; i < this.height / 30; i++) { for (int j = 0; j < this.width / 30; j++) { fillByCoordinate(i, j, color(z[i][j])); } } bitmap.setPixels(colorBitmap, 0, this.width, 0, 0, this.width, this.height); } private static int color(int n) { if (n == 0) { return Color.BLACK; } else { return Color.WHITE; } } @Override protected void onDraw(Canvas canvas) { canvas.drawBitmap(bitmap, 0, 0, null); } }
[ "grtkachenko@gmail.com" ]
grtkachenko@gmail.com
5dce857e07bc13dee9e04495bc8b6847371cae9d
c6d2f60533f57b8fbb514b28c64abb13b43a8b99
/src/main/java/rocks/gebsattel/hochzeit/web/rest/LogsResource.java
fd997b9ae7d544f8288f91c1b45465bd50af4964
[]
no_license
Mesqualito/weddingplaner
498686f3286b9cbdfef487244d879143dd4ff1ca
78c9fa4d040497c56752fbc66f5d260c3a1711aa
refs/heads/master
2020-03-20T18:20:29.078040
2019-02-15T21:47:56
2019-02-15T21:47:56
137,583,597
0
0
null
2018-08-02T09:09:34
2018-06-16T13:43:44
Java
UTF-8
Java
false
false
1,186
java
package rocks.gebsattel.hochzeit.web.rest; import rocks.gebsattel.hochzeit.web.rest.vm.LoggerVM; import ch.qos.logback.classic.Level; import ch.qos.logback.classic.LoggerContext; import com.codahale.metrics.annotation.Timed; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.stream.Collectors; /** * Controller for view and managing Log Level at runtime. */ @RestController @RequestMapping("/management") public class LogsResource { @GetMapping("/logs") @Timed public List<LoggerVM> getList() { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); return context.getLoggerList() .stream() .map(LoggerVM::new) .collect(Collectors.toList()); } @PutMapping("/logs") @ResponseStatus(HttpStatus.NO_CONTENT) @Timed public void changeLevel(@RequestBody LoggerVM jsonLogger) { LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); context.getLogger(jsonLogger.getName()).setLevel(Level.valueOf(jsonLogger.getLevel())); } }
[ "jhipster-bot@users.noreply.github.com" ]
jhipster-bot@users.noreply.github.com
533108a7aeb396ff8d1d2cb983d452b28fe263ba
8bb36803f183ab024cd2d6f1b779172b315cc163
/src/main/java/com/imooc/project/entity/Customer.java
daefd271c2a5fc73b26f6c2d4a35952bfc5e20a2
[]
no_license
RockChuLee/project
f168899e1a1fe5c5bd4a186f5d74cd6b20ad3f4a
03c79d88b1533e943e2b37aad450dff49d78baf5
refs/heads/master
2023-06-05T01:09:41.109373
2021-06-25T09:59:41
2021-06-25T09:59:41
340,627,051
0
0
null
null
null
null
UTF-8
Java
false
false
927
java
package com.imooc.project.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.imooc.project.entity.BaseEntity; import com.baomidou.mybatisplus.annotation.TableId; import lombok.Data; import lombok.EqualsAndHashCode; /** * <p> * 客户表 * </p> * * @author XXX * @since 2021-02-20 */ @Data @EqualsAndHashCode(callSuper = true) public class Customer extends BaseEntity { private static final long serialVersionUID = 1L; /** * 主键 */ @TableId(value = "customer_id", type = IdType.AUTO) private Long customerId; /** * 真实姓名 */ private String realName; /** * 性别 */ private String sex; /** * 年龄 */ private Integer age; /** * 邮箱 */ private String email; /** * 手机号码 */ private String phone; /** * 地址 */ private String address; }
[ "donghao@fang.com" ]
donghao@fang.com
a3e885bf2f80fe0eb24ec99e795aa23eadd5431d
c311740befd3c1040a5e5279d3c6c07066eebe57
/binary search/src/folder/Search.java
24178ba96030e10f296f4e20e7ae3443783502bd
[]
no_license
srijit10/software-lab
24ccee13c636180b2f22bc7352f046a03482a5ba
27d791e7a92bec2636c0022ea3139b1a73e068f6
refs/heads/master
2021-03-24T10:29:24.003037
2016-01-27T16:26:56
2016-01-27T16:26:56
50,521,550
0
0
null
null
null
null
UTF-8
Java
false
false
441
java
package folder; public class Search{ public void binarysearch(int arr[],int low,int high,int t) { int mid; while(low<=high) { mid=(low+high)/2; if(arr[mid]==t) { System.out.println("Element is found at position "+(mid+1)); break; } else if(arr[mid]<t) { low=mid+1; } else { high=mid-1; } } if(low>high) System.out.println("Element is not found"); } }
[ "thisissrijit@gmail.com" ]
thisissrijit@gmail.com
8cb8e2a5ea17c99211970746bc253fc70115733c
69ca8f89a8f3bba48d0da40d06b43ab67280b589
/data/src/main/java/com/oliva/data/model/entities/local/NewsLocalStore.java
b6cfa74c7c73af999a6281438ffb8d245f9568a2
[]
no_license
alexandruoliva/News-Reader-Android-Advanced
58b0d1b9cca424dcbb9b0055eeef4af07184da04
37ef5f1df1cc2cecc554ab56cca2165661e50721
refs/heads/master
2023-06-13T02:29:18.415268
2021-07-07T14:40:21
2021-07-07T14:40:21
365,615,201
1
0
null
2021-07-07T14:40:22
2021-05-08T21:33:49
Java
UTF-8
Java
false
false
1,356
java
package com.oliva.data.model.entities.local; import com.oliva.data.model.Article; import java.util.List; import io.reactivex.Completable; import io.reactivex.Single; import io.reactivex.schedulers.Schedulers; import mapper.ArticleToNewsEntityMapper; import mapper.EntitiesToArticlesMapper; public class NewsLocalStore { private ArticlesDao dao; public NewsLocalStore(ArticlesDao dao) { this.dao = dao; } public Single<List<Article>> getArticlesList() { return dao.queryArticles().map(new EntitiesToArticlesMapper()); } public Single<ArticleEntity> getArticleById(int id) { return dao.queryArticleItem(id); } public Completable deleteArticle(int id) { return dao.deleteArticleItem(id); } public Completable saveArticle(ArticleEntity article) { if (article.id == null) { return dao.insertArticle(article); } else { return dao.updateArticle(article.title, article.imageUrl, article.content, article.description, article.id); } } public void saveArticles(List<Article> articles) { Single.just(articles).map(new ArticleToNewsEntityMapper()) .flatMapCompletable(entityList -> dao .insertArticles(entityList)) .subscribeOn(Schedulers.io()).subscribe(); } }
[ "olivaalexandru@yahoo.com" ]
olivaalexandru@yahoo.com
31dd028daf4a1bdc42edba72313465b9a91cbf96
2fd2abd417d1b39782215c3150f0cd7cba662e52
/Interface/src/Interface/Principal.java
a948d71e6abb549d3e83d08e4df8b9e33e507cb0
[]
no_license
isadoraora/Curso-Java
8630b93fa1fac62bec8d603f6da449ac38a0bb9c
3e501348ae5bebe4178ce4d3ce3713f8bf5e5d27
refs/heads/master
2020-08-27T17:06:16.172264
2019-10-25T03:11:31
2019-10-25T03:11:31
217,440,834
0
0
null
null
null
null
UTF-8
Java
false
false
3,282
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 Interface; /** * * @author isa.mdeo */ public class Principal extends javax.swing.JFrame { /** * Creates new form Principal */ public Principal() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Cadastro de Clientes"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 400, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 300, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Principal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Principal().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables }
[ "isa.mdeo@gmail.com" ]
isa.mdeo@gmail.com
4165e38de05d080c67a09da3bcdb0b2e088a1ad1
c016a43db69d29e7a33ad5f8fb1abdcb32558379
/src/Server/shape/RoundRect.java
04698ab4e85b6396ee63c247bb1f34baa38b8f45
[]
no_license
Fan-FL/ServerCanvas
ef236363a4ec8b82b1fbf38a8a6af6cfc210ecc9
e68d2da8827f7e529f02e221ff49575c54c87666
refs/heads/master
2021-07-13T01:28:28.709412
2017-10-17T07:15:14
2017-10-17T07:15:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
372
java
package Server.shape; import java.awt.*; public class RoundRect extends Shape { // This function will draw a round corner rectangle @Override public void draw(Graphics2D g2d) { g2d.setPaint(new Color(R, G, B)); g2d.setStroke(new BasicStroke(stroke)); g2d.drawRoundRect(Math.min(x1, x2), Math.min(y2, y2), Math.abs(x1 - x2), Math.abs(y1 - y2), 50, 35); } }
[ "fanl3@student.unimelb.edu.au" ]
fanl3@student.unimelb.edu.au
b219a5692f0c5273c4e47ee7d31c0a8c4f1b91b7
6d2e855e3db017f50c0c6f05bf874484c4d165b8
/Searching/Indx_FirstOcc.java
e7029c7d43f37f3a9b195faa750285924422e694
[]
no_license
kumaratul60/Data-Structures-and-Algorithms
7c74bf91d10254221afae51d1daaf65242763f05
b98c43e45700bda6670a7037b06e48126e4705b6
refs/heads/main
2023-04-13T07:39:18.568455
2021-04-20T08:51:17
2021-04-20T08:51:17
357,965,592
2
0
null
null
null
null
UTF-8
Java
false
false
1,301
java
package Searching; import java.util.Scanner; public class Indx_FirstOcc { public static void main(String[] ss) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); int x = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) a[i] = sc.nextInt(); // System.out.println(new Indx_FirstOcc().firstOcc(a, x)); System.out.println(new Indx_FirstOcc().firstOcc(a, 0, n, x)); } } // static int firstOcc(int a[], int x) { // int low = 0; // int high = a.length - 1; // while (low <= high) { // int mid = low + (high - low) / 2; // // int mid = (high - low) / 2; // if (a[mid] == x) // return mid; // else if (a[mid] > x) // high = mid - 1; // else // low = mid + 1; // } // return -1; // // } static int firstOcc(int a[], int low, int high, int x) { low = 0; high = a.length - 1; if (low > high) return -1; while (low <= high) { int mid = low + (high - low) / 2; // int mid = (high - low) / 2; if (a[mid] > x) return firstOcc(a, low, mid - 1, x); else if (a[mid] < x) return firstOcc(a, mid + 1, high, x); else { if (mid == 0 || a[mid - 1] != a[mid]) return mid; else return firstOcc(a, low, mid - 1, x); } } return -1; } }
[ "atulreso1@gmail.com" ]
atulreso1@gmail.com
e2065a35836f7d947b206ea89611e7acb141b729
1c40b7839027cf2ef11826a31d65e6fea18c0b38
/testframewok/src/main/java/jet/opengl/demos/nvidia/waves/crest/Mesh.java
2806fa553b1c60f6e20f1ec6290cb70c4914b75f
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
mzhg/PostProcessingWork
5370d37597015a178aef8cb631cc2925e4dde71e
fbc0f2a4693995102f623bf5b7643c15d7309f9a
refs/heads/master
2022-10-21T04:32:24.792131
2022-10-06T06:37:31
2022-10-06T06:37:31
86,224,204
17
8
null
null
null
null
UTF-8
Java
false
false
605
java
package jet.opengl.demos.nvidia.waves.crest; import org.lwjgl.util.vector.Vector2f; import org.lwjgl.util.vector.Vector3f; import jet.opengl.postprocessing.util.BoundingBox; public final class Mesh { public Vector3f[] vertices; public Vector3f[] normals; public Vector2f[] uv; public int[] indices; public int mode; public BoundingBox bounds; public String name; public void SetIndices(int[] arrI, int mode){ this.indices = arrI; this.mode = mode; } public void RecalculateBounds(){ throw new UnsupportedOperationException(); } }
[ "635709609@qq.com" ]
635709609@qq.com
c9d5d3e25a89c467b3cbca6be84aeaf1eea0750c
2b52bc23ad45f964c43bf4f7ad94a6c7477c077f
/src/main/java/com/greenfoxacademy/gudetamagochi/services/TamaServiceImpl.java
70f72fb9497e80901df1073851e85b52e0932184
[]
no_license
juditcsokay/Gudetamagochi
42f50836118c9dbd2ce8fb6b496797dc1b537549
5e2f5bda82c3bf56b34de05fb4f1f8d65672a801
refs/heads/master
2020-04-17T09:25:54.025385
2019-01-20T21:46:55
2019-01-20T21:46:55
166,457,429
0
0
null
null
null
null
UTF-8
Java
false
false
1,422
java
package com.greenfoxacademy.gudetamagochi.services; import com.greenfoxacademy.gudetamagochi.models.Drink; import com.greenfoxacademy.gudetamagochi.models.Food; import com.greenfoxacademy.gudetamagochi.models.Gudetama; import com.greenfoxacademy.gudetamagochi.models.Trick; import com.greenfoxacademy.gudetamagochi.repositories.TamaRepository; import com.greenfoxacademy.gudetamagochi.repositories.TamaRepositoryImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class TamaServiceImpl implements TamaService{ private TamaRepository tamaRepository; @Autowired public TamaServiceImpl(TamaRepositoryImpl tamaRepository) { this.tamaRepository = tamaRepository; } @Override public void login(String name) { if (tamaRepository.findOneById(name) == null) { tamaRepository.save(new Gudetama(name)); } } @Override public Gudetama getTama(String name) { return tamaRepository.findOneById(name); } @Override public void addTrickToTama(Trick trick, String tamaName) { tamaRepository.findOneById(tamaName).addTrick(trick); } @Override public void addFoodToTama(Food food, String tamaName) { tamaRepository.findOneById(tamaName).setFood(food); } @Override public void addDrinkToTama(Drink drink, String tamaName) { tamaRepository.findOneById(tamaName).setDrink(drink); } }
[ "juditcsokay@gmail.com" ]
juditcsokay@gmail.com
834f7cece887ade0d4ba5415f9e5ba4d43a99f26
033b8379cb86c4d1b363428bd9ab9a894911a39b
/12_外观模式/src/com/hyt/facade/SubSystem1.java
fc48a8c8e24cca1088490582d9f23ecd5f880148
[]
no_license
TopCombine/Design-pattern
c1a375b77239bfe5a26dbed061f3c02c5abf9e24
e505dbf886fd70d4896f7a346db322f2d045625d
refs/heads/master
2021-01-23T14:13:08.881625
2017-06-03T12:23:07
2017-06-03T12:23:07
93,247,002
0
0
null
null
null
null
GB18030
Java
false
false
178
java
package com.hyt.facade; /** * 子系统一 * @author wangwen * */ public class SubSystem1 { public void method1(){ System.out.println("方法一"); } }
[ "1239225791@qq.com" ]
1239225791@qq.com
d22906392b518aa8d715a572d217be0b8ac4ce49
ee0c8423cf5bfbd4839c1014f7379f9f4b08ca55
/src/main/java/com/hamish/factory/pizza/ChicagoStyleCheesePizza.java
7238eeacb7b16fac73866dc4b45a4f9b2cf64136
[]
no_license
ArindomGhosh/DesignPatterns
6b470ae213aae1ab79270804fe539a230421303d
d2fe77a41500f7f8128c3583bada056646906512
refs/heads/master
2021-04-26T23:13:15.564922
2015-01-05T14:07:35
2015-01-05T14:07:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
486
java
package com.hamish.factory.pizza; /** * Created by hamishdickson on 06/12/14. */ public class ChicagoStyleCheesePizza extends Pizza { public ChicagoStyleCheesePizza() { name = "Chicaho Style Deep Dish Cheese Pizza"; dough = "Extra Thick Crust Dough"; sauce = "Plum Tomato Sauce"; // yuk! toppings.add("Shredded Mozzarella Cheese"); } @Override void cut() { System.out.println("Cutting the pizza into square slices"); } }
[ "hamish.dickson@gmail.com" ]
hamish.dickson@gmail.com
ac7ec0d8a9c83dbfa30ca09f1d37017872c360ea
766daa3e461bbad3bd80fcf47564c9ca9d6171e3
/src/com/c2point/tms/web/ui/taxreports/SelectReportType.java
189f3933378871339a2bb58a911d1a6740e378e6
[]
no_license
Yanychar/TaxReport_1
f506d6e62cc104656125cee6ed4cd1b1d27aac15
f414f5b757cc3e3f685670e72ed903de441fcdbf
refs/heads/master
2020-05-20T15:49:06.277801
2014-10-20T10:35:03
2014-10-20T10:35:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,205
java
package com.c2point.tms.web.ui.taxreports; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.joda.time.LocalDate; import com.c2point.tms.datalayer.tax.TaxReportInfoIF; import com.c2point.tms.entity_tax.ReportType; import com.vaadin.data.Property.ValueChangeEvent; import com.vaadin.data.Property.ValueChangeListener; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Button.ClickListener; import com.vaadin.ui.ComboBox; import com.vaadin.ui.Component; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Label; import com.vaadin.ui.OptionGroup; import com.vaadin.ui.UI; import com.vaadin.ui.VerticalLayout; import com.vaadin.ui.Window; public class SelectReportType extends Window { private static final long serialVersionUID = 1L; private static Logger logger = LogManager.getLogger( SelectReportType.class.getName()); private SelectReportType.Listener listener; private TaxReportInfoIF trInfo; private ReportType type; private LocalDate date; private ComboBox comboYear; private ComboBox comboMonth; private boolean confirmed; public SelectReportType( TaxReportInfoIF trInfo, SelectReportType.Listener listener ) { this( trInfo, ReportType.Employees, listener ); } public SelectReportType( TaxReportInfoIF trInfo, ReportType type, SelectReportType.Listener listener ) { super(); this.trInfo = trInfo; this.listener = listener; this.type = type; initDateField(); confirmed = false; initUI(); } public ReportType select() { center(); // Open it in the UI UI.getCurrent().addWindow( this ); return type; } public boolean getConfirmed() { return this.confirmed; } public ReportType getReportType() { return this.type; } // public int getMonth() { return this.date.getDayOfMonth(); } // public int getYear() { return this.date.getYear(); } public LocalDate getDate() { return this.date; } private void initUI() { this.setWidth( "20em" ); this.setHeight( "20em" ); this.setModal( true ); this.setCaption( "New Tax report" ); // Close listener implementation this.addCloseListener( new CloseListener() { private static final long serialVersionUID = 1L; public void windowClose(CloseEvent ce) { // Only process if still enabled if ( SelectReportType.this.isEnabled()) { SelectReportType.this.setEnabled( false ); // avoid double processing if ( SelectReportType.this.listener != null ) { if ( logger.isDebugEnabled()) logger.debug( "OnClose listener will be call" ); SelectReportType.this.listener.onClose( SelectReportType.this ); } } } }); VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); vl.setMargin( true ); vl.setSpacing( true ); // Calendar Fields HorizontalLayout calendarFields = new HorizontalLayout(); calendarFields.setSpacing( true ); calendarFields.setSizeFull(); calendarFields.addComponent( getMonthCombo()); calendarFields.addComponent( getYearCombo()); Label glue = new Label( "" ); calendarFields.addComponent( glue ); calendarFields.setExpandRatio( glue, 1.0f ); // Report Type fields OptionGroup optionGroup = new OptionGroup( "Select Report Type:"); optionGroup.setMultiSelect( false ); optionGroup.setNullSelectionAllowed( false ); optionGroup.setImmediate( true ); optionGroup.addItem( ReportType.Employees ); optionGroup.addItem( ReportType.Contracts ); optionGroup.setItemCaption( ReportType.Employees, ReportType.Employees.toString()); optionGroup.setItemCaption( ReportType.Contracts, ReportType.Contracts.toString()); optionGroup.select( this.type ); optionGroup.addValueChangeListener( new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange( ValueChangeEvent event ) { SelectReportType.this.type = ( ReportType )event.getProperty().getValue(); } }); // Just button Button okButton = new Button( "OK" ); Button cancelButton = new Button( "Cancel" ); okButton.addClickListener( new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick( ClickEvent event) { SelectReportType.this.confirmed = true; if ( SelectReportType.this.isEnabled()) { SelectReportType.this.setEnabled( false ); if ( SelectReportType.this.listener != null ) { if ( logger.isDebugEnabled()) logger.debug( "OnClose listener will be call" ); SelectReportType.this.listener.onClose( SelectReportType.this ); } SelectReportType.this.close(); } } }); cancelButton.addClickListener( new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick( ClickEvent event) { SelectReportType.this.confirmed = false; if ( SelectReportType.this.isEnabled()) { SelectReportType.this.setEnabled( false ); if ( SelectReportType.this.listener != null ) { if ( logger.isDebugEnabled()) logger.debug( "OnClose listener will be call" ); SelectReportType.this.listener.onClose( SelectReportType.this ); } SelectReportType.this.close(); } } }); HorizontalLayout hl = new HorizontalLayout(); hl.setSizeFull(); hl.addComponent( okButton ); hl.addComponent( cancelButton ); vl.addComponent( calendarFields ); vl.addComponent( optionGroup ); vl.addComponent( new Label( " " )); vl.addComponent( hl ); this.setContent( vl ); } public interface Listener { public void onClose( SelectReportType dlg ); } private void initDateField() { if ( trInfo != null ) { this.date = trInfo.getNewReportTime( this.type ); if ( this.date == null ) { this.date = LocalDate.now(); } } else { this.date = LocalDate.now(); } } private Component getMonthCombo() { comboMonth = new ComboBox( "Month:" ); comboMonth.setWidth( "20ex" ); comboMonth.setImmediate( true ); comboMonth.addValueChangeListener( new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { SelectReportType.this.date = SelectReportType.this.date.withMonthOfYear( ( Integer ) comboMonth.getValue()); logger.debug( "Clas of value is: " + comboMonth.getValue().getClass().getSimpleName()); } }); LocalDate tmpDate = new LocalDate( 2000, 1, 1 ); for ( int i = 1; i <= 12; i++ ) { comboMonth.addItem ( i ); comboMonth.setItemCaption( i, tmpDate.monthOfYear().getAsText( getLocale())); tmpDate = tmpDate.plusMonths( 1 ); } comboMonth.select( this.date.getMonthOfYear()); return comboMonth; } private Component getYearCombo() { comboYear = new ComboBox( "Year:" ); comboYear.setWidth( "10ex" ); comboYear.setImmediate( true ); comboYear.addValueChangeListener( new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(ValueChangeEvent event) { SelectReportType.this.date = SelectReportType.this.date.withYear( ( Integer ) comboYear.getValue()); logger.debug( "Class of value is: " + comboMonth.getValue().getClass().getSimpleName()); logger.debug( "Value is: " + comboMonth.getValue()); } }); LocalDate tmpDate = LocalDate.now().minusYears( 1 ); for ( int i = 1; i <= 3; i++ ) { comboYear.addItem ( tmpDate.getYear()); comboYear.setItemCaption( i, tmpDate.year().getAsString()); tmpDate = tmpDate.plusYears( 1 ); } comboYear.select( this.date.getYear()); return comboYear; } }
[ "serguei.sevastianov@gmail.com" ]
serguei.sevastianov@gmail.com
27aaee4e15bdd68d2d11a030c32178a9f8c3f8dc
936aa88990d1e478491aa66627b0263b5590aaa0
/Platform/mo-6-content/src/content-resource/org/mo/content/resource/common/FResResourceFile.java
765e3a1884a41aa1c1738d176f9d2638eb99790e
[]
no_license
favedit/MoCloud3d
f6d417412c5686a0f043a2cc53cd34214ee35618
ef6116df5b66fbc16468bd5e915ba19bb982d867
refs/heads/master
2021-01-10T12:12:22.837243
2016-02-21T09:05:53
2016-02-21T09:05:53
48,077,310
2
2
null
null
null
null
UTF-8
Java
false
false
76
java
package org.mo.content.resource.common; public class FResResourceFile { }
[ "favedit@hotmail.com" ]
favedit@hotmail.com
b6c5afcedd9b726739d4b8d803cbd698709aef07
e32e1dcaa49d67eb322f4e435276b5aa9fca8093
/resource/src/main/java/demo/oauth2/resource/Application.java
aa37c45725684fd11738976dd556d47afc134295
[ "Apache-2.0" ]
permissive
abc55555521/Oauth2
6321f066bd32479a4c8748a615959bf3510da49d
695e436e15a4e4c12ecbab60afba9e5d71d7f58b
refs/heads/master
2020-03-18T01:40:12.122581
2018-05-20T14:59:12
2018-05-20T14:59:12
134,153,554
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
/* * Copyright (c) 2017 <l_iupeiyu@qq.com> All rights reserved. */ package demo.oauth2.resource; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; @EnableWebMvc//启动MVC @EnableTransactionManagement // 启注解事务管理 @SpringBootApplication//SpringBoot启动核心 public class Application extends WebMvcConfigurerAdapter { public static void main(String[] args){ SpringApplication.run(Application.class, args); } }
[ "437713305@qq.com" ]
437713305@qq.com
6e71b54f284e768fb539c5f4145399d3b2aca1dc
08a2e765c0b1002c16a3d930fb912f9f377a80b8
/part-02/Summation.java
83f5d7c0092a8c78dc0a137979c510a27d273137
[]
no_license
Podesta/mooc-java
618e76c67d3d4c4751cbb8caf305ba95af87fb1e
391da4d3b5995e10a20533f9c85a3cb48ce9add0
refs/heads/master
2023-07-09T10:41:22.191907
2021-08-15T00:05:55
2021-08-15T00:05:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
281
java
public class Summation { public static int sum(int num1, int num2, int num3, int num4) { return num1 + num2 + num3 + num4; } public static void main(String[] args) { int result = sum(4, 3, 6, 1); System.out.println("Sum: " + result); } }
[ "11512008+Podesta@users.noreply.github.com" ]
11512008+Podesta@users.noreply.github.com
e87dd21e4e7f178715d9c3b65872fb64fae771f1
05268f3f0d63507c22842dfb9b16e3d7642d047f
/src/pojo/custom/UserCustom.java
88a1953dccd7aa70443ae7f1aadc03089830f096
[]
no_license
m18508130880/LNGS
0b09278b0b7a7c5fbfbd804d47e632c2bdc520e5
d2cb639bf662e84b7870a81f4c5b45cda9a66a67
refs/heads/master
2021-05-09T21:55:59.040180
2018-01-24T13:03:38
2018-01-24T13:03:38
118,739,947
0
0
null
null
null
null
UTF-8
Java
false
false
83
java
package pojo.custom; import pojo.User; public class UserCustom extends User { }
[ "903063674@qq.com" ]
903063674@qq.com
a7333532086811cc1380286be0b8c516ef30428a
bd7d02d63b58aaf5c1487ab381ccd987ad3ca1a8
/yyp_tools/src/main/java/com/yyp/tools/utils/IOUtils.java
1e0e5d18b09674d9c88a22478764b0beaa8dde25
[]
no_license
General757/YYP_Tools
e6c84a5c20652691fd3b9b49e8a7c05eea3861cc
aac9536fbe323ebb476345e60f4f001080d41fd7
refs/heads/master
2020-08-17T20:25:41.194358
2019-12-07T06:03:21
2019-12-07T06:03:21
215,708,110
0
0
null
null
null
null
UTF-8
Java
false
false
29,938
java
// // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) // package com.yyp.tools.utils; import android.os.Build.VERSION; import com.yyp.tools.Charsets; import com.yyp.tools.stream.ByteArrayOutputStream; import com.yyp.tools.stream.StringBuilderWriter; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.CharArrayWriter; import java.io.Closeable; import java.io.EOFException; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.RandomAccessFile; import java.io.Reader; import java.io.Writer; import java.net.HttpURLConnection; import java.net.ServerSocket; import java.net.Socket; import java.net.URI; import java.net.URL; import java.net.URLConnection; import java.nio.channels.Selector; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; /** * Created by Yan on 2019/10/11. */ public class IOUtils { private static final int EOF = -1; public static final char DIR_SEPARATOR_UNIX = '/'; public static final char DIR_SEPARATOR_WINDOWS = '\\'; public static final char DIR_SEPARATOR; public static final String LINE_SEPARATOR_UNIX = "\n"; public static final String LINE_SEPARATOR_WINDOWS = "\r\n"; public static final String LINE_SEPARATOR; private static final int SKIP_BUFFER_SIZE = 2048; private static char[] SKIP_CHAR_BUFFER; private static byte[] SKIP_BYTE_BUFFER; public static final int DEFAULT_BUFFER_SIZE = 32768; public static final int CONTINUE_LOADING_PERCENTAGE = 75; public IOUtils() { } public static void close(URLConnection conn) { if (conn instanceof HttpURLConnection) { ((HttpURLConnection) conn).disconnect(); } } public static void closeQuietly(Reader input) { closeQuietly((Closeable) input); } public static void closeQuietly(Writer output) { closeQuietly((Closeable) output); } public static void closeQuietly(InputStream input) { closeQuietly((Closeable) input); } public static void closeQuietly(OutputStream output) { closeQuietly((Closeable) output); } public static void closeQuietly(Closeable closeable) { try { if (closeable != null) { closeable.close(); } } catch (IOException var2) { ; } } public static void closeQuietly(Socket sock) { if (sock != null) { try { sock.close(); } catch (IOException var2) { ; } } } public static void closeQuietly(Selector selector) { if (selector != null) { try { selector.close(); } catch (IOException var2) { ; } } } public static void closeQuietly(ServerSocket sock) { if (sock != null) { try { sock.close(); } catch (IOException var2) { ; } } } public static InputStream toBufferedInputStream(InputStream input) throws IOException { return ByteArrayOutputStream.toBufferedInputStream(input); } public static BufferedReader toBufferedReader(Reader reader) { return reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader); } public static byte[] toByteArray(InputStream input) throws IOException { ByteArrayOutputStream var1 = new ByteArrayOutputStream(); copy((InputStream) input, (OutputStream) var1); return var1.toByteArray(); } public static byte[] toByteArray(InputStream input, long size) throws IOException { if (size > 2147483647L) { throw new IllegalArgumentException("Size cannot be greater than Integer max value: " + size); } else { return toByteArray(input, (int) size); } } public static byte[] toByteArray(InputStream input, int size) throws IOException { if (size < 0) { throw new IllegalArgumentException("Size must be equal or greater than zero: " + size); } else if (size == 0) { return new byte[0]; } else { byte[] var2 = new byte[size]; int var3; int var4; for (var3 = 0; var3 < size && (var4 = input.read(var2, var3, size - var3)) != -1; var3 += var4) { ; } if (var3 != size) { throw new IOException("Unexpected readed size. current: " + var3 + ", excepted: " + size); } else { return var2; } } } public static byte[] toByteArray(Reader input) throws IOException { return toByteArray(input, Charset.defaultCharset()); } public static byte[] toByteArray(Reader input, Charset encoding) throws IOException { ByteArrayOutputStream var2 = new ByteArrayOutputStream(); copy((Reader) input, (OutputStream) var2, (Charset) encoding); return var2.toByteArray(); } public static byte[] toByteArray(Reader input, String encoding) throws IOException { return toByteArray(input, Charsets.toCharset(encoding)); } @Deprecated public static byte[] toByteArray(String input) throws IOException { return input.getBytes(); } public static byte[] toByteArray(URI uri) throws IOException { return toByteArray(uri.toURL()); } public static byte[] toByteArray(URL url) throws IOException { URLConnection var1 = url.openConnection(); byte[] var2; try { var2 = toByteArray(var1); } finally { close(var1); } return var2; } public static byte[] toByteArray(URLConnection urlConn) throws IOException { InputStream var1 = urlConn.getInputStream(); byte[] var2; try { var2 = toByteArray(var1); } finally { var1.close(); } return var2; } public static char[] toCharArray(InputStream is) throws IOException { return toCharArray(is, Charset.defaultCharset()); } public static char[] toCharArray(InputStream is, Charset encoding) throws IOException { CharArrayWriter var2 = new CharArrayWriter(); copy((InputStream) is, (Writer) var2, (Charset) encoding); return var2.toCharArray(); } public static char[] toCharArray(InputStream is, String encoding) throws IOException { return toCharArray(is, Charsets.toCharset(encoding)); } public static char[] toCharArray(Reader input) throws IOException { CharArrayWriter var1 = new CharArrayWriter(); copy((Reader) input, (Writer) var1); return var1.toCharArray(); } public static String toString(InputStream input) throws IOException { return toString(input, Charset.defaultCharset()); } public static String toString(InputStream input, Charset encoding) throws IOException { StringBuilderWriter var2 = new StringBuilderWriter(); copy((InputStream) input, (Writer) var2, (Charset) encoding); return var2.toString(); } public static String toString(InputStream input, String encoding) throws IOException { return toString(input, Charsets.toCharset(encoding)); } public static String toString(Reader input) throws IOException { StringBuilderWriter var1 = new StringBuilderWriter(); copy((Reader) input, (Writer) var1); return var1.toString(); } public static String toString(URI uri) throws IOException { return toString(uri, Charset.defaultCharset()); } public static String toString(URI uri, Charset encoding) throws IOException { return toString(uri.toURL(), Charsets.toCharset(encoding)); } public static String toString(URI uri, String encoding) throws IOException { return toString(uri, Charsets.toCharset(encoding)); } public static String toString(URL url) throws IOException { return toString(url, Charset.defaultCharset()); } public static String toString(URL url, Charset encoding) throws IOException { InputStream var2 = url.openStream(); String var3; try { var3 = toString(var2, encoding); } finally { var2.close(); } return var3; } public static String toString(URL url, String encoding) throws IOException { return toString(url, Charsets.toCharset(encoding)); } @Deprecated public static String toString(byte[] input) throws IOException { return new String(input); } public static String toString(byte[] input, String encoding) throws IOException { return new String(input, encoding); } public static List<String> readLines(InputStream input) throws IOException { return readLines(input, Charset.defaultCharset()); } public static List<String> readLines(InputStream input, Charset encoding) throws IOException { InputStreamReader var2 = new InputStreamReader(input, Charsets.toCharset(encoding)); return readLines((Reader) var2); } public static List<String> readLines(InputStream input, String encoding) throws IOException { return readLines(input, Charsets.toCharset(encoding)); } public static List<String> readLines(Reader input) throws IOException { BufferedReader var1 = toBufferedReader(input); ArrayList var2 = new ArrayList(); for (String var3 = var1.readLine(); var3 != null; var3 = var1.readLine()) { var2.add(var3); } return var2; } public static InputStream toInputStream(CharSequence input) { return toInputStream(input, Charset.defaultCharset()); } public static InputStream toInputStream(CharSequence input, Charset encoding) { return toInputStream(input.toString(), encoding); } public static InputStream toInputStream(CharSequence input, String encoding) throws IOException { return toInputStream(input, Charsets.toCharset(encoding)); } public static InputStream toInputStream(String input) { return toInputStream(input, Charset.defaultCharset()); } public static InputStream toInputStream(String input, Charset encoding) { return new ByteArrayInputStream(StringCodingUtils.getBytes(input, Charsets.toCharset(encoding))); } public static InputStream toInputStream(String input, String encoding) throws IOException { byte[] var2 = StringCodingUtils.getBytes(input, Charsets.toCharset(encoding)); return new ByteArrayInputStream(var2); } public static void write(byte[] data, OutputStream output) throws IOException { if (data != null) { output.write(data); } } public static void write(byte[] data, Writer output) throws IOException { write(data, output, Charset.defaultCharset()); } public static void write(byte[] data, Writer output, Charset encoding) throws IOException { if (data != null) { if (VERSION.SDK_INT < 9) { output.write(new String(data, Charsets.toCharset(encoding).name())); } else { output.write(new String(data, Charsets.toCharset(encoding))); } } } public static void write(byte[] data, Writer output, String encoding) throws IOException { write(data, output, Charsets.toCharset(encoding)); } public static void write(char[] data, Writer output) throws IOException { if (data != null) { output.write(data); } } public static void write(char[] data, OutputStream output) throws IOException { write(data, output, Charset.defaultCharset()); } public static void write(char[] data, OutputStream output, Charset encoding) throws IOException { if (data != null) { output.write(StringCodingUtils.getBytes(new String(data), Charsets.toCharset(encoding))); } } public static void write(char[] data, OutputStream output, String encoding) throws IOException { write(data, output, Charsets.toCharset(encoding)); } public static void write(CharSequence data, Writer output) throws IOException { if (data != null) { write(data.toString(), output); } } public static void write(CharSequence data, OutputStream output) throws IOException { write(data, output, Charset.defaultCharset()); } public static void write(CharSequence data, OutputStream output, Charset encoding) throws IOException { if (data != null) { write(data.toString(), output, encoding); } } public static void write(CharSequence data, OutputStream output, String encoding) throws IOException { write(data, output, Charsets.toCharset(encoding)); } public static void write(String data, Writer output) throws IOException { if (data != null) { output.write(data); } } public static void write(String data, OutputStream output) throws IOException { write(data, output, Charset.defaultCharset()); } public static void write(String data, OutputStream output, Charset encoding) throws IOException { if (data != null) { output.write(StringCodingUtils.getBytes(data, Charsets.toCharset(encoding))); } } public static void write(String data, OutputStream output, String encoding) throws IOException { write(data, output, Charsets.toCharset(encoding)); } @Deprecated public static void write(StringBuffer data, Writer output) throws IOException { if (data != null) { output.write(data.toString()); } } @Deprecated public static void write(StringBuffer data, OutputStream output) throws IOException { write(data, output, (String) null); } @Deprecated public static void write(StringBuffer data, OutputStream output, String encoding) throws IOException { if (data != null) { output.write(StringCodingUtils.getBytes(data.toString(), Charsets.toCharset(encoding))); } } public static void writeLines(Collection<?> lines, String lineEnding, OutputStream output) throws IOException { writeLines(lines, lineEnding, output, Charset.defaultCharset()); } public static void writeLines(Collection<?> lines, String lineEnding, OutputStream output, Charset encoding) throws IOException { if (lines != null) { if (lineEnding == null) { lineEnding = LINE_SEPARATOR; } Charset var4 = Charsets.toCharset(encoding); for (Iterator var5 = lines.iterator(); var5.hasNext(); output.write(StringCodingUtils.getBytes(lineEnding, var4))) { Object var6 = var5.next(); if (var6 != null) { output.write(StringCodingUtils.getBytes(var6.toString(), var4)); } } } } public static void writeLines(Collection<?> lines, String lineEnding, OutputStream output, String encoding) throws IOException { writeLines(lines, lineEnding, output, Charsets.toCharset(encoding)); } public static void writeLines(Collection<?> lines, String lineEnding, Writer writer) throws IOException { if (lines != null) { if (lineEnding == null) { lineEnding = LINE_SEPARATOR; } for (Iterator var3 = lines.iterator(); var3.hasNext(); writer.write(lineEnding)) { Object var4 = var3.next(); if (var4 != null) { writer.write(var4.toString()); } } } } public static int copy(InputStream input, OutputStream output) throws IOException { long var2 = copyLarge(input, output); return var2 > 2147483647L ? -1 : (int) var2; } public static long copyLarge(InputStream input, OutputStream output) throws IOException { return copyLarge(input, output, new byte['耀']); } public static long copyLarge(InputStream input, OutputStream output, byte[] buffer) throws IOException { long var3 = 0L; int var6; for (boolean var5 = false; -1 != (var6 = input.read(buffer)); var3 += (long) var6) { output.write(buffer, 0, var6); } return var3; } public static long copyLarge(InputStream input, OutputStream output, long inputOffset, long length) throws IOException { return copyLarge(input, output, inputOffset, length, new byte['耀']); } public static long copyLarge(InputStream input, OutputStream output, long inputOffset, long length, byte[] buffer) throws IOException { if (inputOffset > 0L) { skipFully(input, inputOffset); } if (length == 0L) { return 0L; } else { int var7 = buffer.length; int var8 = var7; if (length > 0L && length < (long) var7) { var8 = (int) length; } long var10 = 0L; int var9; while (var8 > 0 && -1 != (var9 = input.read(buffer, 0, var8))) { output.write(buffer, 0, var9); var10 += (long) var9; if (length > 0L) { var8 = (int) Math.min(length - var10, (long) var7); } } return var10; } } public static void copy(InputStream input, Writer output) throws IOException { copy(input, output, Charset.defaultCharset()); } public static void copy(InputStream input, Writer output, Charset encoding) throws IOException { InputStreamReader var3 = new InputStreamReader(input, Charsets.toCharset(encoding)); copy((Reader) var3, (Writer) output); } public static void copy(InputStream input, Writer output, String encoding) throws IOException { copy(input, output, Charsets.toCharset(encoding)); } public static int copy(Reader input, Writer output) throws IOException { long var2 = copyLarge(input, output); return var2 > 2147483647L ? -1 : (int) var2; } public static long copyLarge(Reader input, Writer output) throws IOException { return copyLarge(input, output, new char['耀']); } public static long copyLarge(Reader input, Writer output, char[] buffer) throws IOException { long var3 = 0L; int var6; for (boolean var5 = false; -1 != (var6 = input.read(buffer)); var3 += (long) var6) { output.write(buffer, 0, var6); } return var3; } public static long copyLarge(Reader input, Writer output, long inputOffset, long length) throws IOException { return copyLarge(input, output, inputOffset, length, new char['耀']); } public static long copyLarge(Reader input, Writer output, long inputOffset, long length, char[] buffer) throws IOException { if (inputOffset > 0L) { skipFully(input, inputOffset); } if (length == 0L) { return 0L; } else { int var7 = buffer.length; if (length > 0L && length < (long) buffer.length) { var7 = (int) length; } long var9 = 0L; int var8; while (var7 > 0 && -1 != (var8 = input.read(buffer, 0, var7))) { output.write(buffer, 0, var8); var9 += (long) var8; if (length > 0L) { var7 = (int) Math.min(length - var9, (long) buffer.length); } } return var9; } } public static void copy(Reader input, OutputStream output) throws IOException { copy(input, output, Charset.defaultCharset()); } public static void copy(Reader input, OutputStream output, Charset encoding) throws IOException { OutputStreamWriter var3 = new OutputStreamWriter(output, Charsets.toCharset(encoding)); copy((Reader) input, (Writer) var3); var3.flush(); } public static void copy(Reader input, OutputStream output, String encoding) throws IOException { copy(input, output, Charsets.toCharset(encoding)); } public static boolean contentEquals(InputStream input1, InputStream input2) throws IOException { if (!(input1 instanceof BufferedInputStream)) { input1 = new BufferedInputStream((InputStream) input1); } if (!(input2 instanceof BufferedInputStream)) { input2 = new BufferedInputStream((InputStream) input2); } int var3; for (int var2 = ((InputStream) input1).read(); -1 != var2; var2 = ((InputStream) input1).read()) { var3 = ((InputStream) input2).read(); if (var2 != var3) { return false; } } var3 = ((InputStream) input2).read(); return var3 == -1; } public static boolean contentEquals(Reader input1, Reader input2) throws IOException { BufferedReader input3 = toBufferedReader(input1); BufferedReader input4 = toBufferedReader(input2); int var3; for (int var2 = input3.read(); -1 != var2; var2 = input3.read()) { var3 = input4.read(); if (var2 != var3) { return false; } } var3 = input4.read(); return var3 == -1; } public static boolean contentEqualsIgnoreEOL(Reader input1, Reader input2) throws IOException { BufferedReader var2 = toBufferedReader(input1); BufferedReader var3 = toBufferedReader(input2); String var4 = var2.readLine(); String var5; for (var5 = var3.readLine(); var4 != null && var5 != null && var4.equals(var5); var5 = var3.readLine()) { var4 = var2.readLine(); } return var4 == null ? var5 == null : var4.equals(var5); } public static long skip(InputStream input, long toSkip) throws IOException { if (toSkip < 0L) { throw new IllegalArgumentException("Skip count must be non-negative, actual: " + toSkip); } else { if (SKIP_BYTE_BUFFER == null) { SKIP_BYTE_BUFFER = new byte[2048]; } long var3; long var5; for (var3 = toSkip; var3 > 0L; var3 -= var5) { var5 = (long) input.read(SKIP_BYTE_BUFFER, 0, (int) Math.min(var3, 2048L)); if (var5 < 0L) { break; } } return toSkip - var3; } } public static long skip(Reader input, long toSkip) throws IOException { if (toSkip < 0L) { throw new IllegalArgumentException("Skip count must be non-negative, actual: " + toSkip); } else { if (SKIP_CHAR_BUFFER == null) { SKIP_CHAR_BUFFER = new char[2048]; } long var3; long var5; for (var3 = toSkip; var3 > 0L; var3 -= var5) { var5 = (long) input.read(SKIP_CHAR_BUFFER, 0, (int) Math.min(var3, 2048L)); if (var5 < 0L) { break; } } return toSkip - var3; } } public static void skipFully(InputStream input, long toSkip) throws IOException { if (toSkip < 0L) { throw new IllegalArgumentException("Bytes to skip must not be negative: " + toSkip); } else { long var3 = skip(input, toSkip); if (var3 != toSkip) { throw new EOFException("Bytes to skip: " + toSkip + " actual: " + var3); } } } public static void skipFully(Reader input, long toSkip) throws IOException { long var3 = skip(input, toSkip); if (var3 != toSkip) { throw new EOFException("Chars to skip: " + toSkip + " actual: " + var3); } } public static int read(Reader input, char[] buffer, int offset, int length) throws IOException { if (length < 0) { throw new IllegalArgumentException("Length must not be negative: " + length); } else { int var4; int var6; for (var4 = length; var4 > 0; var4 -= var6) { int var5 = length - var4; var6 = input.read(buffer, offset + var5, var4); if (-1 == var6) { break; } } return length - var4; } } public static int read(Reader input, char[] buffer) throws IOException { return read((Reader) input, (char[]) buffer, 0, buffer.length); } public static int read(InputStream input, byte[] buffer, int offset, int length) throws IOException { if (length < 0) { throw new IllegalArgumentException("Length must not be negative: " + length); } else { int var4; int var6; for (var4 = length; var4 > 0; var4 -= var6) { int var5 = length - var4; var6 = input.read(buffer, offset + var5, var4); if (-1 == var6) { break; } } return length - var4; } } public static int read(InputStream input, byte[] buffer) throws IOException { return read((InputStream) input, (byte[]) buffer, 0, buffer.length); } public static void readFully(Reader input, char[] buffer, int offset, int length) throws IOException { int var4 = read(input, buffer, offset, length); if (var4 != length) { throw new EOFException("Length to read: " + length + " actual: " + var4); } } public static void readFully(Reader input, char[] buffer) throws IOException { readFully((Reader) input, (char[]) buffer, 0, buffer.length); } public static void readFully(InputStream input, byte[] buffer, int offset, int length) throws IOException { int var4 = read(input, buffer, offset, length); if (var4 != length) { throw new EOFException("Length to read: " + length + " actual: " + var4); } } public static void readFully(InputStream input, byte[] buffer) throws IOException { readFully((InputStream) input, (byte[]) buffer, 0, buffer.length); } public static boolean copyStream(InputStream is, RandomAccessFile os, CopyListener listener, int alreadyRead) throws IOException { return copyStream(is, os, listener, alreadyRead, 32768); } public static boolean copyStream(InputStream is, RandomAccessFile os, CopyListener listener, int alreadyRead, int bufferSize) throws IOException { int var5 = alreadyRead; int var6 = is.available(); byte[] var7 = new byte[bufferSize]; if (shouldStopLoading(listener, alreadyRead, var6)) { return false; } else { do { int var8; if ((var8 = is.read(var7, 0, bufferSize)) == -1) { return true; } os.write(var7, 0, var8); var5 += var8; } while (!shouldStopLoading(listener, var5, var6)); return false; } } private static boolean shouldStopLoading(CopyListener listener, int current, int total) { if (listener != null) { boolean var3 = listener.onBytesCopied(current, total); if (!var3 && 100 * current / total < 75) { return true; } } return false; } public static void closeSilently(Closeable closeable) { try { closeable.close(); } catch (Exception var2) { ; } } static { DIR_SEPARATOR = File.separatorChar; StringBuilderWriter var0 = new StringBuilderWriter(4); PrintWriter var1 = new PrintWriter(var0); var1.println(); LINE_SEPARATOR = var0.toString(); var1.close(); } public interface CopyListener { boolean onBytesCopied(int var1, int var2); } public static String convertStreamToString(InputStream is) { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line = null; try { while ((line = reader.readLine()) != null) { sb.append(line); } } catch (IOException var13) { ; } finally { try { is.close(); } catch (IOException var12) { ; } } return sb.toString(); } public static void closeStream(Closeable stream) { try { if (stream != null) { stream.close(); } } catch (IOException var2) { ; } } public static byte[] InputStreamToByte(InputStream is) throws IOException { java.io.ByteArrayOutputStream bytestream = new java.io.ByteArrayOutputStream(); int ch; while ((ch = is.read()) != -1) { bytestream.write(ch); } byte[] byteData = bytestream.toByteArray(); bytestream.close(); return byteData; } }
[ "1183561804@qq.com" ]
1183561804@qq.com
635da96b772f1b8fc8e50d12b69f7949ffd54fcc
df09eafb287eeb78a9c0f5aa2e525d8f7d1f3e2e
/Send/app/src/test/java/sdk21/FriendsListFragmentTest.java
a8b712b2b3d60c3b2548ae9c4ef581e71889fec7
[]
no_license
baek0429/android_proto
92fd1fe2a04adfb1086b248bce82c5e4ed8d1083
b767ef58ea591f82b6e90e84a5cb9a612fa31f01
refs/heads/master
2016-08-12T00:41:51.151131
2015-11-12T12:35:11
2015-11-12T12:35:11
46,031,442
0
0
null
null
null
null
UTF-8
Java
false
false
2,844
java
/* * Copyright (c) 2015. <Chungseok Baek> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package sdk21; import com.image.send.BuildConfig; import com.image.send.MainActivity; import com.image.send.friend.model.FriendContent; import com.image.send.friend.FriendsListFragment; import org.json.JSONException; import org.json.JSONObject; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricGradleTestRunner; import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLog; import org.robolectric.util.FragmentTestUtil; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @RunWith(RobolectricGradleTestRunner.class) @Config(constants = BuildConfig.class, sdk = 21) public class FriendsListFragmentTest { @Before public void setup() { ShadowLog.stream = System.out; } @Test public void shouldNotBeNull() throws Exception { FriendsListFragment fragment = new FriendsListFragment(); FragmentTestUtil.startFragment(fragment, MainActivity.class); assertNotNull(fragment); } @Test public void jsonTest() throws JSONException { JSONObject obj = null; try { obj = new JSONObject("{success: true, friend1: { name: hello }, friend2: {name: hello2}}"); } catch (JSONException e) { e.printStackTrace(); } int i = 1; if (obj != null) { while (obj.has("friend"+i)) { JSONObject fObj = obj.getJSONObject("friend"+i); String f_name = fObj.getString("name"); FriendContent.addFriendInstance(f_name); i++; } } assertEquals(i-1,FriendContent.ITEMS.size()); } }
[ "baek0429@hotmail.com" ]
baek0429@hotmail.com
abdbdd81b33b3de0ef9553b54f89721f971f739d
84e9aec439a016729bafa9ed3566d901bf812b56
/hello-world-distributed/service/src/main/java/io/github/jeqo/demo/HelloWorldServiceApp.java
4e79b01940575a92e23b6b75a7da230c4ad230e3
[ "MIT" ]
permissive
eduardoalvarado/talk-observing-distributed-systems
3c9b01f25d41a22e48533adaca64e429f6aa0a8f
873a6608b7e365baeb5350952e0027670edd56ef
refs/heads/master
2021-08-30T06:32:52.499602
2017-12-14T12:41:37
2017-12-14T12:41:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,548
java
package io.github.jeqo.demo; import io.dropwizard.Application; import io.dropwizard.Configuration; import io.dropwizard.setup.Environment; import io.github.jeqo.demo.infra.HelloTranslationClient; import io.github.jeqo.demo.rest.HelloWorldResource; import io.opentracing.NoopTracerFactory; import io.opentracing.Tracer; import io.opentracing.contrib.apache.http.client.TracingHttpClientBuilder; import io.opentracing.contrib.jaxrs2.server.ServerTracingDynamicFeature; import io.opentracing.util.GlobalTracer; import org.apache.http.client.HttpClient; import javax.ws.rs.container.DynamicFeature; /** * Hello World Distributed version with Translation Service contained as a Service. In this version * the Client will have to call Hello World Service and call Translation Service at the end. */ public class HelloWorldServiceApp extends Application<Configuration> { public static void main(String[] args) throws Exception { final HelloWorldServiceApp app = new HelloWorldServiceApp(); app.run(args); } public void run(Configuration configuration, Environment environment) throws Exception { // Preparing Tracer final Tracer tracer = getTracer(); GlobalTracer.register(tracer); //Register on Global Scope final DynamicFeature tracing = new ServerTracingDynamicFeature.Builder(tracer).build(); environment.jersey().register(tracing); // Preparing Http Client final String baseUrl = "http://hello-translation-service:8080/translation"; final HttpClient httpClient = new TracingHttpClientBuilder().withTracer(tracer).build(); // Preparing Translation Service Client final HelloTranslationClient translationClient = new HelloTranslationClient(httpClient, baseUrl); // Preparing Hello World Resource and inject Translation Client final HelloWorldResource resource = new HelloWorldResource(translationClient); // Register Hello World Resource environment.jersey().register(resource); } private Tracer getTracer() { try { return new com.uber.jaeger.Configuration( "hello-world-service", new com.uber.jaeger.Configuration.SamplerConfiguration("const", 1), //100% new com.uber.jaeger.Configuration.ReporterConfiguration( true, "tracing-jaeger-agent", 6831, 1000, // flush interval in milliseconds 10000) /*max buffered Spans*/) .getTracer(); } catch (Exception e) { e.printStackTrace(); return NoopTracerFactory.create(); } } }
[ "quilcate.jorge@gmail.com" ]
quilcate.jorge@gmail.com
a055f1648909f3d1f3deb338f8aae9aa765dabd2
7c0b843785145412548b7dd97d3812bc0ac859ad
/src/main/java/spring/abc/bean/q3/AppConfig.java
5e3fbcbb0ba290d054462011c8c8089d0f944f7b
[]
no_license
psean21c/webapp
7b47ea9a48f2959a42a8c1b19c634425f364b41a
c1e24bb336495fff65facc42081782a97c06e3ae
refs/heads/master
2018-10-18T21:41:56.964730
2018-10-16T09:58:01
2018-10-16T09:58:01
109,051,389
1
0
null
null
null
null
UTF-8
Java
false
false
263
java
package spring.abc.bean.q3; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class AppConfig { @Bean public MyServiceImpl myService(){ return new MyServiceImpl(); } }
[ "psean21c@gmail.com" ]
psean21c@gmail.com
280aec303869c975ff8cf199347452ca64f306a9
f1f38e5767645a85f0292e58e05cebd063c4be36
/Cacao/src/cacao/cmd/login/CmdLoginPwdAcc.java
1da65e72d3e65b0941adf0808e298007c303fec4
[]
no_license
seungyang/Cacao
81748815094ebeb2c1585a0d158a0d2087e40554
bda42b5ca884897df3b9b8ffc8c0b17b73da0cd8
refs/heads/master
2021-05-16T12:15:34.836917
2017-10-20T08:21:56
2017-10-20T08:21:56
105,235,419
0
1
null
null
null
null
UTF-8
Java
false
false
1,396
java
package cacao.cmd.login; import java.util.List; import java.util.Properties; import java.util.Random; import javax.mail.Address; import javax.mail.Authenticator; import javax.mail.Message; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import cacao.cmd.Cmd; import cacao.cmd.CmdException; import cacao.model.vo.Member; import cacao.service.CacaoLoginService; import cacao.service.CacaoRegisterService; public class CmdLoginPwdAcc implements Cmd { private String next; public CmdLoginPwdAcc( String _next ){ next = _next; } @Override public String execute(HttpServletRequest request, HttpServletResponse response ) throws CmdException { // TODO Auto-generated method stub String pwd1 = request.getParameter("pwd1"); System.out.println("requestpwd1 :"+pwd1); HttpSession session = request.getSession(); Member m = (Member) session.getAttribute("findM"); m.setmPwd(pwd1); System.out.println("session 후 :"+pwd1); int result = CacaoLoginService.getInstance().updatePwd(m); System.out.println("update : "+result); return next; } }
[ "kosta@192.168.0.138" ]
kosta@192.168.0.138
a68c32f50a3a4c7424eca321f8f924e732cbb631
4f3c4c14a3cc277785ce8de00a4f7cf360d5798c
/src/main/java/pl/kenbit/maps/icao/Main.java
becc176b046add49baba0f95a69096b02b878b99
[]
no_license
mziolkowski/ICAO_code_gen
7fa6e9df6024a82f3335601d5454dd09ef118ca3
a18f5197e517757a2caa31f8d37d684cc0bcfa96
refs/heads/master
2021-01-02T09:33:43.388907
2017-08-07T11:04:47
2017-08-07T11:04:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,038
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 pl.kenbit.maps.icao; import java.awt.Dimension; public class Main { /** * @wbp.parser.entryPoint */ public static void main(String[] args) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Icao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Icao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Icao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Icao.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { Icao icao = new Icao(); icao.setSize(645, 230); icao.setVisible(true); } }); } }
[ "ziolek0321@gmail.com" ]
ziolek0321@gmail.com
c8246b69b19fc17497b26844df9730046b52491b
329894d6aae49c288345591b760784a279a6df49
/JAVATOS_GARAGE/src/main/java/com/poe/javatos/rs/ClientController.java
c602f9b69ab3822fd342eb6b8a482ff73f8cfeaa
[]
no_license
Pedrog38/javatos
680ca32cc7d1a1aca0ff97823fcfa338422a73a8
bcbd53890fca91afd7c42e44a0ffea5017f5a74f
refs/heads/master
2020-07-28T04:23:54.646113
2019-10-03T13:40:42
2019-10-03T13:40:42
209,307,841
0
0
null
2019-09-30T14:52:46
2019-09-18T12:52:40
Java
UTF-8
Java
false
false
1,150
java
package com.poe.javatos.rs; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import com.poe.javatos.bean.Client; import com.poe.javatos.service.crud.IServiceClientCrud; @RestController public class ClientController { @Autowired IServiceClientCrud serviceClient; @PostMapping(path="/createclient", produces= MediaType.APPLICATION_JSON_VALUE , consumes= MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Client> createAClient(@RequestBody Client clientToSave){ try{ Client newClient = serviceClient.createClient(clientToSave) ; if (newClient !=null && newClient .getId() > 0 ) return ResponseEntity.ok().body(newClient) ; } catch (Exception e) { return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } return new ResponseEntity<>(HttpStatus.NOT_ACCEPTABLE); } }
[ "lumix.photo@yahoo.fr" ]
lumix.photo@yahoo.fr
c29b9e86cd5a95e7a396cce039657ceffd54c783
f3c85f3b8c5266cfbe2be900f8ea540415da992d
/gildedrose/src/test/java/be/jeremy/gildedrose/updater/quality/MiscellaneousItemQualityUpdaterTest.java
f467b8e2b7b9a613ed3b7680e3fb60cefef5e39c
[]
no_license
Masterjim/kata
222f6b20549092fb2a6b3f5370102f6d9a6024d1
bc9adb41da7367411e03dc8309e7bf17578893d8
refs/heads/master
2021-05-06T21:00:11.546704
2017-11-29T08:29:08
2017-11-29T08:29:08
112,447,377
0
0
null
null
null
null
UTF-8
Java
false
false
2,443
java
package be.jeremy.gildedrose.updater.quality; import be.jeremy.gildedrose.Item; import org.junit.Test; import static be.jeremy.gildedrose.ItemBuilder.anItem; import static org.assertj.core.api.Assertions.assertThat; public class MiscellaneousItemQualityUpdaterTest { private static final String FOO = "foo"; private static final int QUALITY = 12; private static final int SELL_IN = 10; private static final int NEAR_MIN_QUALITY = 1; private MiscellaneousItemQualityUpdater itemQualityUpdater = new MiscellaneousItemQualityUpdater(); @Test public void shouldDecrementQuality_whenUpdateQualityOfAnItem() { Item anItem = anItem() .withName(FOO) .withQuality(QUALITY) .withSellIn(SELL_IN) .build(); itemQualityUpdater.updateQuality(anItem); assertThat(anItem.name).isEqualTo(FOO); assertThat(anItem.sellIn).isEqualTo(SELL_IN); assertThat(anItem.quality).isEqualTo(QUALITY - 1); } @Test public void shouldNotDecrementQuality_whenUpdateQualityOfAnItemWithQualitySetToZero() { Item anItem = anItem() .withName(FOO) .withQuality(0) .withSellIn(SELL_IN) .build(); itemQualityUpdater.updateQuality(anItem); assertThat(anItem.name).isEqualTo(FOO); assertThat(anItem.sellIn).isEqualTo(SELL_IN); assertThat(anItem.quality).isEqualTo(0); } @Test public void shouldDecreaseQualityByTwo_whenUpdateQualityOfAnItemWithPassedSellIn() { Item anItem = anItem() .withName(FOO) .withQuality(QUALITY) .withSellIn(0) .build(); itemQualityUpdater.updateQuality(anItem); assertThat(anItem.name).isEqualTo(FOO); assertThat(anItem.sellIn).isEqualTo(0); assertThat(anItem.quality).isEqualTo(QUALITY - 2); } @Test public void shouldDecreaseQualityButNotLowerThanZero_whenUpdateQualityOfAnItemWithPassedSellIn() { Item anItem = anItem() .withName(FOO) .withQuality(NEAR_MIN_QUALITY) .withSellIn(0) .build(); itemQualityUpdater.updateQuality(anItem); assertThat(anItem.name).isEqualTo(FOO); assertThat(anItem.sellIn).isEqualTo(0); assertThat(anItem.quality).isEqualTo(0); } }
[ "jeremy.vanpe@ehealth.fgov.be" ]
jeremy.vanpe@ehealth.fgov.be
2098c129bf108befcbda7d49b0978858f21b6c1b
b85d19ccb08280496a06f3c0201907c2a87192e3
/src/main/java/com/github/skySpiral7/java/infinite/numbers/InfiniteInteger.java
ed47b874b6623c2873f3284abdd005e7e7e08c2a
[]
no_license
SkySpiral7/Infinite
ff1379946281c8ceec23ef38c8ff31c3b77c37c7
e379fca8d1a5118cd16a13ad04fa49d0c1d14bab
refs/heads/master
2023-08-30T21:09:57.034903
2023-08-28T04:10:00
2023-08-28T04:10:00
108,744,792
0
0
null
null
null
null
UTF-8
Java
false
false
45,595
java
package com.github.skySpiral7.java.infinite.numbers; import java.io.IOException; import java.io.NotSerializableException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.ObjectStreamException; import java.math.BigInteger; import java.util.Iterator; import java.util.ListIterator; import java.util.Spliterator; import java.util.Spliterators; import java.util.stream.Stream; import java.util.stream.StreamSupport; import com.github.skySpiral7.java.infinite.util.BitWiseUtil; import com.github.skySpiral7.java.infinite.util.RadixUtil; import com.github.skySpiral7.java.iterators.DequeNodeIterator; import com.github.skySpiral7.java.iterators.ReadOnlyListIterator; import com.github.skySpiral7.java.numbers.NumberFormatException; import com.github.skySpiral7.java.staticSerialization.ObjectStreamReader; import com.github.skySpiral7.java.staticSerialization.ObjectStreamWriter; import com.github.skySpiral7.java.staticSerialization.StaticSerializable; /** * <p>I don't have anything against BigInteger, it's fast and big, but it bugs me that there isn't another class that has no max size. * After searching the internet I found a few arbitrary-precision integers but all had a max size. * More recently I found <a href="http://mrob.com/pub/perl/hypercalc.html">HyperCalc</a> but that's still not infinite. * I understand that an array is faster than a linked list and that generating a security key is the only practical * way for a primitive long to max out but I wanted the option for infinite precision. And I had fun making it.</p> * * <p>BigInteger's maximum value (in JRE 1.8) is 2^(2^31-1) which is about 10^(10^8). Using long[] with each element being unsigned * would max out at 2^(64 * (2^31-1))-1 which is about 10^(10^10). The largest base 10 number a string can hold is * 10^(2^31-1) which is about 10^(10^9) (base 255 has the same estimate). InfiniteInteger on the other hand * uses {@code DequeNode<Integer>} internally (which has no limit) each node is unsigned and * the nodes are in little endian order. Only integers are supported however there are also ±∞ and NaN defined.</p> * * <p>Someone suggested I should name the class InfinInt but as much as I love puns I would like this class to be * taken seriously. There is very little effort put to being efficient therefore expect it to be slow. * This class is more of a proof of concept to show that truly infinite precision can be done. * This class can logically support more than the hardware can provide. For example: * if this object takes 10 TB or memory and you call factorial the logic functions as normal * but can't finish the calculation within the next thousand years but of course memory * will run out long before then. Since hardware can't be infinite, memory will run out eventually if the number gets too large.</p> * * <p>This class is immutable and thread-safe. There are constants singletons for Zero, ±∞, and NaN. * Zero is a singleton (that object is the only way to reference the number 0) and is defined for convenience such * as if(var == ZERO). Positive and negative infinity represent exactly that and may be returned from math operations. * NaN is also as expected except that as an object it will have pointer equality NaN == NaN. Operations return NaN * instead of throwing whenever possible.</p> * * <p>But the most useful design is that every operation is overloaded to take either long, BigInteger, or InfiniteInteger * which makes var = var.add(1) possible. The methods that exist are based on the ones defined by BigInteger.</p> * * <p>The constants finite singletons are: Zero, One, Two.</p> * * @see BigInteger * @see MutableInfiniteInteger */ public final class InfiniteInteger extends AbstractInfiniteInteger<InfiniteInteger> implements StaticSerializable { private static final long serialVersionUID = 1L; /** * Common abbreviation for "not a number". This constant is the result of invalid math such as 0/0. * Note that this is a normal object such that <code>(InfiniteInteger.NaN == InfiniteInteger.NaN)</code> is * always true. Therefore it is logically correct unlike the floating point unit's NaN. */ public static final InfiniteInteger NaN = new InfiniteInteger(MutableInfiniteInteger.NaN); /** * +∞ is a concept rather than a number and can't be the result of math involving finite numbers. * It is defined for completeness and behaves as expected with math resulting in ±∞ or NaN. */ public static final InfiniteInteger POSITIVE_INFINITY = new InfiniteInteger(MutableInfiniteInteger.POSITIVE_INFINITY); /** * -∞ is a concept rather than a number and can't be the result of math involving finite numbers. * It is defined for completeness and behaves as expected with math resulting in ±∞ or NaN. */ public static final InfiniteInteger NEGATIVE_INFINITY = new InfiniteInteger(MutableInfiniteInteger.NEGATIVE_INFINITY); /** * This constant represents 0 and it is the only InfiniteInteger that can be 0 (ie this is a singleton). * Therefore it is safe to use pointer equality for comparison: <code>if(var == InfiniteInteger.ZERO)</code> */ public static final InfiniteInteger ZERO = new InfiniteInteger(new MutableInfiniteInteger(0)); /** * This constant represents 1 and it is the only InfiniteInteger that can be 1 (ie this is a singleton). * Therefore it is safe to use pointer equality for comparison: <code>if(var == InfiniteInteger.ONE)</code> */ public static final InfiniteInteger ONE = new InfiniteInteger(new MutableInfiniteInteger(1)); /** * This constant represents 2 and it is the only InfiniteInteger that can be 2 (ie this is a singleton). * Therefore it is safe to use pointer equality for comparison: <code>if(var == InfiniteInteger.TWO)</code> */ public static final InfiniteInteger TWO = new InfiniteInteger(new MutableInfiniteInteger(2)); private final transient MutableInfiniteInteger baseNumber; private InfiniteInteger(final MutableInfiniteInteger baseNumber){this.baseNumber = baseNumber;} /** * Converts a long value to an InfiniteInteger. * * @param value the desired numeric value * * @return a new InfiniteInteger or a defined singleton */ public static InfiniteInteger valueOf(final long value) { return InfiniteInteger.valueOf(MutableInfiniteInteger.valueOf(value)); } /** * Converts a BigInteger value to an InfiniteInteger. * Conversion is O(n) and may be slow for large values of the parameter. * * @param value the desired numeric value * * @return a new InfiniteInteger or a defined singleton */ public static InfiniteInteger valueOf(final BigInteger value) { return InfiniteInteger.valueOf(MutableInfiniteInteger.valueOf(value)); } //There is no valueOf(InfiniteInteger) because that would be a no-op (no reason to make a copy) /** * Converts a MutableInfiniteInteger to an InfiniteInteger. * The value passed in is copied so that this InfiniteInteger won't be affected * by mutating the value. * * @param value the desired numeric value * * @return a new InfiniteInteger or a defined singleton */ public static InfiniteInteger valueOf(final MutableInfiniteInteger value) { if (value.isNaN()) return InfiniteInteger.NaN; if (value.equals(MutableInfiniteInteger.POSITIVE_INFINITY)) return InfiniteInteger.POSITIVE_INFINITY; if (value.equals(MutableInfiniteInteger.NEGATIVE_INFINITY)) return InfiniteInteger.NEGATIVE_INFINITY; if (value.equalValue(0)) return InfiniteInteger.ZERO; if (value.equalValue(1)) return InfiniteInteger.ONE; if (value.equalValue(2)) return InfiniteInteger.TWO; return new InfiniteInteger(value.copy()); } /** * Simply calls parseString (radix 10). This exists for orthogonality. * * @see #parseString(String, int) */ public static InfiniteInteger valueOf(final String value) { return InfiniteInteger.parseString(value, 10); } /** * Simply calls parseString. This exists for orthogonality. * * @see #parseString(String, int) */ public static InfiniteInteger valueOf(final String value, final int radix) { return InfiniteInteger.parseString(value, radix); } /** * Simply calls parseString with radix 10. This exists for orthogonality and ease of use. * * @see #parseString(String, int) */ public static InfiniteInteger parseString(final String value) { return InfiniteInteger.parseString(value, 10); } /** * <p>Parses the inputString as an InfiniteInteger in the radix specified. * See {@link RadixUtil#toString(long, int)} for a description of legal characters per radix. * See {@link RadixUtil#parseLong(String, int)} for more details.</p> * * <p>Note the special values of ∞, -∞, and ∉ℤ (for NaN) can be parsed given any valid * radix.</p> * * @param inputString the String to be parsed * @param radix the number base * * @return the InfiniteInteger that inputString represents * * @throws NullPointerException if inputString is null * @throws NumberFormatException excluding a leading + or - if inputString is empty (and not base 1) * or contains illegal characters for that radix * @throws IllegalArgumentException {@code if(radix > 62 || radix < 1)} * @see Long#parseLong(String, int) * @see RadixUtil#toString(long, int) * @see RadixUtil#parseLong(String, int) */ public static InfiniteInteger parseString(final String inputString, final int radix) { final MutableInfiniteInteger mutableInfiniteInteger = MutableInfiniteInteger.parseString(inputString, radix); return InfiniteInteger.valueOf(mutableInfiniteInteger); } /** * Converts an InfiniteInteger to a MutableInfiniteInteger. * The value returned is a new object so that this InfiniteInteger won't be affected * by mutating the returned object. * * @return a new MutableInfiniteInteger or a defined singleton */ public MutableInfiniteInteger toMutableInfiniteInteger() { return baseNumber.copy(); } /** * Converts an array of UNSIGNED longs into a new InfiniteInteger. * The elements must be in little endian order. This method delegates to littleEndian(Iterator, boolean). * An empty array is considered 0. * * @param valueArray the unsigned elements in little endian order * @param isNegative whether the resulting InfiniteInteger should be negative or not * * @return a new InfiniteInteger representing the indicated number * * @see #littleEndian(Iterator, boolean) * @see #bigEndian(long[], boolean) */ public static InfiniteInteger littleEndian(final long[] valueArray, final boolean isNegative) { return InfiniteInteger.valueOf(MutableInfiniteInteger.littleEndian(valueArray, isNegative)); } /** * Converts an array of UNSIGNED longs into a new InfiniteInteger. * The elements must be in big endian order. This method ultimately delegates to littleEndian(Iterator, boolean). * An empty array is considered 0. * * @param valueArray the unsigned elements in big endian order * @param isNegative whether the resulting InfiniteInteger should be negative or not * * @return a new InfiniteInteger representing the indicated number * * @see #bigEndian(ListIterator, boolean) * @see #littleEndian(long[], boolean) * @see #littleEndian(Iterator, boolean) */ public static InfiniteInteger bigEndian(final long[] valueArray, final boolean isNegative) { return InfiniteInteger.valueOf(MutableInfiniteInteger.bigEndian(valueArray, isNegative)); } /** * <p>Converts an iterator of UNSIGNED longs into a new InfiniteInteger. * The elements must be in little endian order.</p> * * <p>The iterator must not return a null element, the meaning of which would be ambiguous. * The iterator can't be infinite since this method aggregates the values (it would also be meaningless). * An empty iterator is considered 0.</p> * * @param valueIterator the unsigned elements in little endian order * @param isNegative whether the resulting InfiniteInteger should be negative or not * * @return a new InfiniteInteger representing the indicated number * * @see #littleEndian(long[], boolean) * @see #bigEndian(ListIterator, boolean) */ public static InfiniteInteger littleEndian(final Iterator<Long> valueIterator, final boolean isNegative) { return InfiniteInteger.valueOf(MutableInfiniteInteger.littleEndian(valueIterator, isNegative)); } /** * <p>Converts an iterator of UNSIGNED longs into a new InfiniteInteger. * The elements must be in big endian order. Note that the iterator * must be a list iterator because it must be read backwards. * This method delegates to littleEndian(Iterator, boolean).</p> * * <p>The iterator must not return a null element, the meaning of which would be ambiguous. * The iterator can't be infinite since this method aggregates the values (it would also be meaningless). * An empty iterator is considered 0.</p> * * @param valueIterator the unsigned elements in big endian order * @param isNegative whether the resulting InfiniteInteger should be negative or not * * @return a new InfiniteInteger representing the indicated number * * @see #bigEndian(long[], boolean) * @see #littleEndian(Iterator, boolean) */ public static InfiniteInteger bigEndian(final ListIterator<Long> valueIterator, final boolean isNegative) { return InfiniteInteger.valueOf(MutableInfiniteInteger.bigEndian(valueIterator, isNegative)); } /** * This method returns an infinite stream of all integers. * NaN is not included in the stream and ±∞ is unreachable. * The stream is logically truely infinite (will never loop around or overflow) * but hardware will eventually run out of memory. * The stream's order is: 0, 1, -1, 2, -2, 3, -3, 4, -4... * * @return an infinite stream of all integers */ public static Stream<InfiniteInteger> streamAllIntegers() { return Stream.iterate(InfiniteInteger.ZERO, (InfiniteInteger previous) -> { if (previous.equals(InfiniteInteger.ZERO)) return InfiniteInteger.valueOf(1); if (previous.baseNumber.signum() == -1) return InfiniteInteger.valueOf(previous.baseNumber.copy().abs().add(1)); return previous.negate(); }); } /** * <p>This method returns an infinite iterator of all integers. * NaN is not included in the stream and ±∞ is unreachable. * The stream is logically truely infinite (will never loop around or overflow) * but hardware will eventually run out of memory.</p> * * <p>The iterator starts after 0 such that calling next() will return 1 and previous() will return 0. * Calling next or previous index will return the intValue(). Set, add, and remove can't be called because * it is read only.</p> * * @return an infinite iterator of all integers * * @see #intValue() * @see ReadOnlyListIterator */ public static ReadOnlyListIterator<InfiniteInteger> iterateAllIntegers() { return new ReadOnlyListIterator<>(new ListIterator<InfiniteInteger>() { private InfiniteInteger nextElement = InfiniteInteger.valueOf(1); @Override public boolean hasNext(){return true;} @Override public boolean hasPrevious(){return true;} @Override public InfiniteInteger next() { final InfiniteInteger current = nextElement; nextElement = nextElement.add(1); return current; } @Override public InfiniteInteger previous() { nextElement = nextElement.subtract(1); return nextElement; } @Override public int nextIndex() { return nextElement.intValue(); } @Override public int previousIndex() { return nextElement.intValue() - 1; } //will be replaced by ReadOnlyListIterator to throw: @Override public void remove(){} @Override public void set(final InfiniteInteger e){} @Override public void add(final InfiniteInteger e){} }); } /** * <p>This method returns an infinite stream all numbers in the Fibonacci Sequence. * The stream starts with 0 which is known as the zeroth element in the sequence. * The stream is logically truely infinite (will never loop around or overflow) * but hardware will eventually run out of memory.</p> * * <p>The Fibonacci Sequence aka golden sequence aka Lame's Sequence is defined by starting with * f(0)=0 and f(1)=1 and f(n)=f(n-2)+f(n-1). * Therefore the sequence starts out with: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34...</p> * * @return an infinite stream of the Fibonacci Sequence */ public static Stream<InfiniteInteger> streamFibonacciSequence() { final Iterator<InfiniteInteger> iterator = new Iterator<InfiniteInteger>() { private InfiniteInteger previous = null; private InfiniteInteger back2 = null; @Override public boolean hasNext(){return true;} @Override public InfiniteInteger next() { final InfiniteInteger next; if (previous == null) next = InfiniteInteger.ZERO; else if (back2 == null) next = InfiniteInteger.valueOf(1); else next = previous.add(back2); back2 = previous; previous = next; return next; } }; return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, Spliterator.ORDERED | Spliterator.IMMUTABLE), false); } /** * Entire code: <blockquote>{@code return (float) longValue();}</blockquote> * * @see #longValue() */ @Override public float floatValue(){return baseNumber.floatValue();} /** * Entire code: <blockquote>{@code return (double) longValue();}</blockquote> * * @see #longValue() */ @Override public double doubleValue(){return baseNumber.doubleValue();} /** * This method returns the least significant 31 bits of the number represented by this InfiniteInteger. * The int is then given the same sign as this class. This is different than a narrowing cast because * normally the bits would be unchanged signed or otherwise but this method performs a two's complement. * * @throws ArithmeticException if this is ±∞ or NaN * @see #longValue() */ @Override public int intValue() { return baseNumber.intValue(); } /** * This method returns the least significant 63 bits of the number represented by this InfiniteInteger. * The long is then given the same sign as this class. This is different than a narrowing cast because * normally the bits would be unchanged signed or otherwise but this method performs a two's complement. * * @throws ArithmeticException if this is ±∞ or NaN * @see #longValueExact() * @see #bigIntegerValue() */ @Override public long longValue() { return baseNumber.longValue(); } /** * This method returns the longValue only if this InfiniteInteger can fit within a signed long without losing information. * * @throws ArithmeticException if this is ±∞ or NaN * @throws ArithmeticException if this is greater than max long: 2^63-1 * @see #longValue() * @see #bigIntegerValue() */ @Override public long longValueExact() { return baseNumber.longValueExact(); } @Override public BigInteger bigIntegerValue() { return baseNumber.bigIntegerValue(); } /** * This method returns the a BigInteger representing the same number as this InfiniteInteger. * Or will throw if this InfiniteInteger is greater than BigInteger will allow. * * @throws ArithmeticException if this is ±∞ or NaN * @throws ArithmeticException if this is greater than the max of BigInteger: 2^(2^31-1)-1 * @see #bigIntegerValue() * @see #longValue() */ @Override public BigInteger bigIntegerValueExact() { return baseNumber.bigIntegerValueExact(); } /** * This method returns a read only list iterator of unknown size that iterates over the data of each of the nodes * of this InfiniteInteger. Each node is unsigned and they are in little endian order. * Calling nextIndex or previousIndex will return -1 and calling add, set, or remove will throw. * Note that there might be more than Long.Max elements (or even max BigInteger!). * * @throws UnsupportedOperationException if this is ±∞ or NaN * @see #magnitudeStream() * @see ReadOnlyListIterator * @see DequeNodeIterator.IndexAgnosticValueIterator */ @Override public ReadOnlyListIterator<Integer> magnitudeIterator() { return baseNumber.magnitudeIterator(); } /** * This method returns a stream for the data of each of the nodes of this InfiniteInteger. * Each node is unsigned and they are in little endian order. * Note that there might be more than Long.Max elements (or even max BigInteger!). * This method represents that there can be any number of elements better than magnitudeIterator. * Streams are also naturally read only with unknown size. * * @throws UnsupportedOperationException if this is ±∞ or NaN * @see #magnitudeIterator() */ @Override public Stream<Integer> magnitudeStream() { return baseNumber.magnitudeStream(); } /** * Returns an InfiniteInteger whose value is {@code (this + value)}. * Note that the formula used is designed for a long and is slightly more efficient * than calling add(InfiniteInteger.valueOf(value)) would be. * * @param value the operand to be added to this InfiniteInteger. * * @return the result including ±∞ and NaN * * @see #add(InfiniteInteger) */ @Override public InfiniteInteger add(final long value) { return InfiniteInteger.valueOf(baseNumber.copy().add(value)); } /** * Entire code: <blockquote>{@code return this.add(InfiniteInteger.valueOf(value));}</blockquote> * * @see #add(InfiniteInteger) * @see #valueOf(BigInteger) */ @Override public InfiniteInteger add(final BigInteger value) { return InfiniteInteger.valueOf(baseNumber.copy().add(value)); } /** * Returns an InfiniteInteger whose value is {@code (this + value)}. * * @param value the operand to be added to this InfiniteInteger. * * @return the result including ±∞ and NaN * * @see #add(long) */ @Override public InfiniteInteger add(final InfiniteInteger value) { return InfiniteInteger.valueOf(baseNumber.copy().add(value.baseNumber)); } /** * Returns an InfiniteInteger whose value is {@code (this - value)}. * Note that the formula used is designed for a long and is slightly more efficient * than calling subtract(InfiniteInteger.valueOf(value)) would be. * * @param value the operand to be subtracted from this InfiniteInteger. * * @return the result including ±∞ and NaN * * @see #subtract(InfiniteInteger) */ @Override public InfiniteInteger subtract(final long value) { return InfiniteInteger.valueOf(baseNumber.copy().subtract(value)); } /** * Entire code: <blockquote>{@code return this.subtract(InfiniteInteger.valueOf(value));}</blockquote> * * @see #subtract(InfiniteInteger) * @see #valueOf(BigInteger) */ @Override public InfiniteInteger subtract(final BigInteger value) { return InfiniteInteger.valueOf(baseNumber.copy().subtract(value)); } /** * Returns an InfiniteInteger whose value is {@code (this - value)}. * Note ∞ - ∞ results in NaN. * * @param value the operand to be subtracted from this InfiniteInteger. * * @return the result including ±∞ and NaN * * @see #subtract(long) */ @Override public InfiniteInteger subtract(final InfiniteInteger value) { return InfiniteInteger.valueOf(baseNumber.copy().subtract(value.baseNumber)); } /** * Returns an InfiniteInteger whose value is {@code (this * value)}. * Note that the formula used is designed for a long and is slightly more efficient * than calling multiply(InfiniteInteger.valueOf(value)) would be. * Note ±∞ * 0 results in NaN. * * @param value the operand to be multiplied to this InfiniteInteger. * * @return the result including ±∞ and NaN * * @see #multiply(InfiniteInteger) */ @Override public InfiniteInteger multiply(final long value) { return InfiniteInteger.valueOf(baseNumber.copy().multiply(value)); } /** * Entire code: <blockquote>{@code return this.multiply(InfiniteInteger.valueOf(value));}</blockquote> * * @see #multiply(InfiniteInteger) * @see #valueOf(BigInteger) */ @Override public InfiniteInteger multiply(final BigInteger value) { return InfiniteInteger.valueOf(baseNumber.copy().multiply(value)); } /** * Returns an InfiniteInteger whose value is {@code (this * value)}. * Note ±∞ * 0 results in NaN. * * @param value the operand to be multiplied to this InfiniteInteger. * * @return the result including ±∞ and NaN * * @see #multiply(long) */ @Override public InfiniteInteger multiply(final InfiniteInteger value) { return InfiniteInteger.valueOf(baseNumber.copy().multiply(value.baseNumber)); } /** * This method delegates because the formula used is exactly the same. * Entire code: <blockquote>{@code return this.multiplyByPowerOf2(InfiniteInteger.valueOf(exponent));}</blockquote> * * @see #multiplyByPowerOf2(InfiniteInteger) * @see #valueOf(long) */ @Override public InfiniteInteger multiplyByPowerOf2(final long exponent) { return InfiniteInteger.valueOf(baseNumber.copy().multiplyByPowerOf2(exponent)); } /** * Entire code: <blockquote>{@code return this.multiplyByPowerOf2(InfiniteInteger.valueOf(exponent));}</blockquote> * * @see #multiplyByPowerOf2(InfiniteInteger) * @see #valueOf(BigInteger) */ @Override public InfiniteInteger multiplyByPowerOf2(final BigInteger exponent) { return InfiniteInteger.valueOf(baseNumber.copy().multiplyByPowerOf2(exponent)); } /** * <p>Returns an InfiniteInteger whose value is {@code (this << exponent)}. * If the exponent is negative then a right shift is performed instead. * Computes <tt>this * 2<sup>exponent</sup></tt>. * Note that the nodes are unsigned and this operation ignores sign. * Therefore this operation won't change the sign.</p> * * <p>Examples:<br /><code> * InfiniteInteger.valueOf(-10).multiplyByPowerOf2(1) is -20<br /> * InfiniteInteger.valueOf(100).multiplyByPowerOf2(2) is 400</code></p> * * <p>This method is not named shiftLeft because the direction left only makes sense for big endian numbers.</p> * * @param exponent is also the shift distance in bits * * @return the result including ±∞ and NaN * * @see #divideByPowerOf2DropRemainder(InfiniteInteger) */ @Override public InfiniteInteger multiplyByPowerOf2(final InfiniteInteger exponent) { return InfiniteInteger.valueOf(baseNumber.copy().multiplyByPowerOf2(exponent.baseNumber)); } @Override public IntegerQuotient<InfiniteInteger> divide(final long value) { return divide(InfiniteInteger.valueOf(value)); } /** * Entire code: <blockquote>{@code return this.divide(InfiniteInteger.valueOf(value));}</blockquote> * * @see #divide(InfiniteInteger) * @see #valueOf(BigInteger) */ @Override public IntegerQuotient<InfiniteInteger> divide(final BigInteger value){return this.divide(InfiniteInteger.valueOf(value));} @Override public IntegerQuotient<InfiniteInteger> divide(final InfiniteInteger value) { final IntegerQuotient<MutableInfiniteInteger> mutableAnswer = baseNumber.copy().divide(value.baseNumber); return new IntegerQuotient<>(InfiniteInteger.valueOf(mutableAnswer.getWholeResult()), InfiniteInteger.valueOf(mutableAnswer.getRemainder())); } //aka divideReturnWhole @Override public InfiniteInteger divideDropRemainder(final long value) { return InfiniteInteger.valueOf(baseNumber.copy().divideDropRemainder(value)); } /** * Entire code: <blockquote>{@code return this.divideDropRemainder(InfiniteInteger.valueOf(value));}</blockquote> * * @see #divideDropRemainder(InfiniteInteger) * @see #valueOf(BigInteger) */ @Override public InfiniteInteger divideDropRemainder(final BigInteger value) { return InfiniteInteger.valueOf(baseNumber.copy().divideDropRemainder(value)); } @Override public InfiniteInteger divideDropRemainder(final InfiniteInteger value) { return InfiniteInteger.valueOf(baseNumber.copy().divideDropRemainder(value.baseNumber)); } /** * This method delegates because the formula used is exactly the same. * Entire code: <blockquote>{@code return this.divideByPowerOf2DropRemainder(InfiniteInteger.valueOf(exponent));}</blockquote> * * @see #divideByPowerOf2DropRemainder(InfiniteInteger) * @see #valueOf(long) */ @Override public InfiniteInteger divideByPowerOf2DropRemainder(final long exponent) { return InfiniteInteger.valueOf(baseNumber.copy().divideByPowerOf2DropRemainder(exponent)); } /** * Entire code: <blockquote>{@code return this.divideByPowerOf2DropRemainder(InfiniteInteger.valueOf(exponent));}</blockquote> * * @see #divideByPowerOf2DropRemainder(InfiniteInteger) * @see #valueOf(BigInteger) */ @Override public InfiniteInteger divideByPowerOf2DropRemainder(final BigInteger exponent) { return InfiniteInteger.valueOf(baseNumber.copy().divideByPowerOf2DropRemainder(exponent)); } /** * <p>Returns an InfiniteInteger whose value is {@code (this >>> exponent)}. * If the exponent is negative then a left shift is performed instead. * Computes <tt>truncate(this / 2<sup>exponent</sup>)</tt>. * Note that the nodes are unsigned and this operation ignores sign. * Also note that truncation occurs which means the low numbers are thrown away not rounded. * Therefore this operation always 0 fills and won't change the sign (unless the result is ZERO).</p> * <p>Examples:<br /><code> * InfiniteInteger.valueOf(-10).divideByPowerOf2DropRemainder(1) is -5<br /> * InfiniteInteger.valueOf(100).divideByPowerOf2DropRemainder(2) is 25<br /> * InfiniteInteger.valueOf(3).divideByPowerOf2DropRemainder(1) is 1</code></p> * * <p>This method is not named shiftRight because the direction right only makes sense for big endian numbers.</p> * * @param exponent is also the shift distance in bits * * @return the result including ±∞ and NaN * * @see #multiplyByPowerOf2(InfiniteInteger) */ @Override public InfiniteInteger divideByPowerOf2DropRemainder(final InfiniteInteger exponent) { return InfiniteInteger.valueOf(baseNumber.copy().divideByPowerOf2DropRemainder(exponent.baseNumber)); } //aka remainder, divideDropWhole, divideReturnRemainder @Override public InfiniteInteger divideReturnRemainder(final long value) { return InfiniteInteger.valueOf(baseNumber.copy().divideReturnRemainder(value)); } /** * Entire code: <blockquote>{@code return this.mod(InfiniteInteger.valueOf(value));}</blockquote> * * @see #divideReturnRemainder(InfiniteInteger) * @see #valueOf(BigInteger) */ @Override public InfiniteInteger divideReturnRemainder(final BigInteger value) { return InfiniteInteger.valueOf(baseNumber.copy().divideReturnRemainder(value)); } @Override public InfiniteInteger divideReturnRemainder(final InfiniteInteger value) { return InfiniteInteger.valueOf(baseNumber.copy().divideReturnRemainder(value.baseNumber)); } @Override public InfiniteInteger power(final long exponent) { return InfiniteInteger.valueOf(baseNumber.copy().power(exponent)); } /** * Entire code: <blockquote>{@code return this.pow(InfiniteInteger.valueOf(exponent));}</blockquote> * * @see #power(InfiniteInteger) * @see #valueOf(BigInteger) */ @Override public InfiniteInteger power(final BigInteger exponent) { return InfiniteInteger.valueOf(baseNumber.copy().power(exponent)); } //BigInt is wrong: 0^0 is NaN but it returns 1. And 1^(-2) is 1 but it throws //TODO: make this table into a class that can't be modified /** * Used by powerSpecialLookUp. Private to prevent modification. * * @see #powerSpecialLookUp(InfiniteInteger, InfiniteInteger) */ private final static InfiniteInteger[][] powerSpecialCaseTable = { //[baseIndex][exponentIndex] //the elements are in order: 0, 1, Infinity, -Infinity, -X (other), X (other) {NaN, ZERO, ZERO, NaN, NaN, ZERO}, //0 {ONE, ONE, NaN, NaN, ONE, ONE}, //1 {NaN, POSITIVE_INFINITY, POSITIVE_INFINITY, ZERO, ZERO, POSITIVE_INFINITY}, //Infinity {NaN, NEGATIVE_INFINITY, NaN, NaN, ZERO, null}, //-Infinity {ONE, null, NaN, ZERO, null, null}, //-X (other) {ONE, null, POSITIVE_INFINITY, ZERO, null, null} //X (other) }; /** * <table border="1"> * <caption><b>Special cases for Base<sup>Exponent</sup></b></caption> * <tr><th></th><th colspan="6">Exponent</th></tr> * <tr valign="top"> * <th>Base</th> <th width="30px">0</th> * <th width="30px">1</th> * <th width="30px">∞</th> * <th width="30px">-∞</th> * <th width="30px">-X</th> * <th width="30px">X</th></tr> * * <tr align="center"><td>0</td> <td>NaN</td> <td>0</td> <td>0</td> <td>NaN</td> <td>NaN</td> <td>0</td></tr> * <tr align="center"><td>1</td> <td>1</td> <td>1</td> <td>NaN</td> <td>NaN</td> <td>1</td> <td>1</td></tr> * <tr align="center"><td>∞</td> <td>NaN</td> <td>∞</td> <td>∞</td> <td>0</td> <td>0</td> <td>∞</td></tr> * <tr align="center"><td>-∞</td> <td>NaN</td> <td>-∞</td> <td>NaN</td> <td>NaN</td> <td>0</td> <td>±∞</td></tr> * <tr align="center"><td>-X</td> <td>1</td> <td>-X</td> <td>NaN</td> <td>0</td> <td>1/?</td> <td>?</td></tr> * <tr align="center"><td>X</td> <td>1</td> <td>X</td> <td>∞</td> <td>0</td> <td>1/?</td> <td>?</td></tr> * </table> * * <p>In the table above X is an integer greater than one. 1/? means the result is a * fraction instead of an integer. And ? means that the answer is an integer but this method doesn't know the exact value. * In the cases of 1/? and ? null is returned. In all other cases the answer is returned.</p> * * @return the answer or null */ static InfiniteInteger powerSpecialLookUp(final InfiniteInteger base, final InfiniteInteger exponent) { if (base.isNaN() || exponent.isNaN()) return InfiniteInteger.NaN; if (exponent.equalValue(1)) return base; //always true //TODO: test all these special cases of pow final byte baseIndex = InfiniteInteger.powerSpecialIndex(base); final byte exponentIndex = InfiniteInteger.powerSpecialIndex(exponent); //is never 1 due to above if check final InfiniteInteger tableValue = InfiniteInteger.powerSpecialCaseTable[baseIndex][exponentIndex]; if (tableValue != null) return tableValue; if (base.equals(InfiniteInteger.NEGATIVE_INFINITY)) { //exponent.isFinite by this point (exponentIndex == 5 for X) if (BitWiseUtil.isEven(exponent.intValue())) return InfiniteInteger.POSITIVE_INFINITY; return InfiniteInteger.NEGATIVE_INFINITY; } //baseIndex == 4 or 5 and exponentIndex == 4 or 5 for -X or X. in all 4 cases return null return null; } /** * Used by powerSpecialLookUp to find the table index to use for a given value. * * @return the table index which matches the powerSpecialCaseTable * * @see #powerSpecialLookUp(InfiniteInteger, InfiniteInteger) * @see #powerSpecialCaseTable */ private static byte powerSpecialIndex(final InfiniteInteger value) { if (value.equals(InfiniteInteger.ZERO)) return 0; if (value.equals(InfiniteInteger.ONE)) return 1; if (value.equals(InfiniteInteger.POSITIVE_INFINITY)) return 2; if (value.equals(InfiniteInteger.NEGATIVE_INFINITY)) return 3; if (value.baseNumber.signum() == -1) return 4; return 5; } /** * Returns an InfiniteInteger whose value is this<sup>exponent</sup>. * There are many special cases, for a full table see {@link InfiniteInteger#powerSpecialLookUp(InfiniteInteger, InfiniteInteger) this * table} * except the pow method will return the result instead of null. * * @param exponent to which this InfiniteInteger is to be raised. * * @return the result including ±∞ and NaN * * @throws ArithmeticException if the result would be a fraction (only possible if exponent is negative) */ @Override public InfiniteInteger power(final InfiniteInteger exponent) { return InfiniteInteger.valueOf(baseNumber.copy().power(exponent.baseNumber)); } /** * Returns an InfiniteInteger whose value is this<sup>this</sup>. * This method exists mostly as a testimony that this class really can hold any integer. * The result will be much larger than a factorial so it will be a slow execution. * For example if this InfiniteInteger is 3 then 3<sup>3</sup> is 27. * * @return the result including ∞ and NaN * * @see #power(InfiniteInteger) */ @Override public InfiniteInteger selfPower() { return InfiniteInteger.valueOf(baseNumber.copy().selfPower()); } /** * Returns an InfiniteInteger whose value is this!. * This method exists mostly as a testimony that this class really can hold any integer. * Factorial is defined as a number multiplied by all positive integers less than it. * So 4! = 4*3*2*1. The special cases of 1! and 0! are 1 but factorial is not defined for * negative numbers. If this InfiniteInteger is negative then NaN is returned. * * @return the result including ∞ and NaN * * @see #power(InfiniteInteger) */ @Override public InfiniteInteger factorial() { return InfiniteInteger.valueOf(baseNumber.copy().factorial()); } /** * Returns the absolute value of this InfiniteInteger. * * @return itself or the positive version of this * * @see Math#abs(double) */ @Override public InfiniteInteger abs() { return InfiniteInteger.valueOf(baseNumber.copy().abs()); } /** * Returns an InfiniteInteger whose value is {@code (0-this)}. * * @return {@code -this} */ @Override public InfiniteInteger negate() { return InfiniteInteger.valueOf(baseNumber.copy().negate()); } /** * @return -1, 0 or 1 as the value of this number is negative, zero or * positive respectively. NaN returns 0. */ @Override public byte signum() { return baseNumber.signum(); } /** * Compares this == NaN. * * @return true if this InfiniteInteger is the constant for NaN. * * @see #NaN */ @Override public boolean isNaN(){return this == InfiniteInteger.NaN;} /** * Compares this InfiniteInteger to both positive and negative infinity. * * @return true if this InfiniteInteger is either of the infinity constants. * * @see #POSITIVE_INFINITY * @see #NEGATIVE_INFINITY */ @Override public boolean isInfinite(){return (this == InfiniteInteger.POSITIVE_INFINITY || this == InfiniteInteger.NEGATIVE_INFINITY);} /** * Compares this InfiniteInteger to ±∞ and NaN (returns false of this is any of them). * * @return true if this InfiniteInteger is not a special value (ie if this is a finite number). * * @see #NaN * @see #POSITIVE_INFINITY * @see #NEGATIVE_INFINITY */ @Override public boolean isFinite(){return (!this.isNaN() && !this.isInfinite());} /** * @throws ArithmeticException if this == NaN */ @Override public void signalNaN(){if (isNaN()) throw new ArithmeticException("Not a number.");} /** * Compares this InfiniteInteger with the specified object for numeric equality. * * @param other the value to be compared to this * * @return true if this InfiniteInteger has the same numeric value as other. false if other is not a number */ @Override public boolean equalValue(final Object other) { return baseNumber.equalValue(other); } /** * Compares this InfiniteInteger with the specified value for numeric equality. * * @param value the value to be compared to this * * @return true if this InfiniteInteger has the same numeric value as the value parameter * * @see #longValueExact() * @see #compareTo(long) */ @Override public boolean equalValue(final long value) { return baseNumber.equalValue(value); } @Override public boolean equals(final Object other) { if (other == null) return false; if (this == other) return true; if (!(other instanceof InfiniteInteger)) return false; final InfiniteInteger that = (InfiniteInteger) other; if (!this.isFinite() || !that.isFinite()) return false; return baseNumber.equals(that.baseNumber); } /** * Compares this InfiniteInteger with the specified other for numeric equality. * The natural order is as expected with ±∞ being at either end. * However for the sake of sorting 0 < NaN < 1. * * @param other the value to be compared to this * * @return -1, 0 or 1 if this InfiniteInteger is numerically less than, equal * to, or greater than other. */ @Override public int compareTo(final InfiniteInteger other) { return baseNumber.compareTo(other.baseNumber); } /** * Compares this InfiniteInteger with the specified other for numeric equality. * Even though sorting is not possible this method returns as expected. * Entire code: <blockquote>{@code return this.compareTo(InfiniteInteger.valueOf(other));}</blockquote> * * @param other the value to be compared to this * * @see #compareTo(InfiniteInteger) * @see Comparable#compareTo(Object) */ @Override public int compareTo(final BigInteger other){return this.compareTo(InfiniteInteger.valueOf(other));} /** * Compares this InfiniteInteger with the specified other for numeric equality. * Even though sorting is not possible this method returns as expected. * Entire code: <blockquote>{@code return this.compareTo(InfiniteInteger.valueOf(other));}</blockquote> * * @param other the value to be compared to this * * @see #compareTo(InfiniteInteger) * @see Comparable#compareTo(Object) */ @Override public int compareTo(final long other){return this.compareTo(InfiniteInteger.valueOf(other));} /** * Returns the hash code for this InfiniteInteger. * Collisions are, in theory, likely when comparing all possible integers * with all possible values that can fit into int. * * @return hash code for this InfiniteInteger. */ @Override public int hashCode() { return baseNumber.hashCode(); } @Override public String toString() { return baseNumber.toString(); } public String toString(final int radix) { return baseNumber.toString(radix); } String toDebuggingString() { //Mutable will handle special numbers return baseNumber.toDebuggingString(); } public static InfiniteInteger readFromStream(final ObjectStreamReader reader) { //valueOf will handle constant conversions return InfiniteInteger.valueOf(reader.readObject(MutableInfiniteInteger.class)); } @Override public void writeToStream(final ObjectStreamWriter writer) { writer.writeObject(baseNumber); } private Object writeReplace() throws ObjectStreamException {throw new NotSerializableException();} private Object readResolve() throws ObjectStreamException {throw new NotSerializableException();} private void writeObject(final ObjectOutputStream out) throws IOException {throw new NotSerializableException();} private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {throw new NotSerializableException();} private void readObjectNoData() throws ObjectStreamException {throw new NotSerializableException();} }
[ "rworcest@g.emporia.edu" ]
rworcest@g.emporia.edu
273edb6f48e5864d77f94e0fcf7ea3dede82545c
54a23c1efc4e3582f9734f38f1017795bdb5e664
/model/src/com/efimchick/battleships/model/unit/Fortress.java
3e229081faa9c72d36897d036016e34c94b285b9
[]
no_license
thejerome/BattleShips
8517f6a9965dd641f16d46805774e9ff9e1f8bd2
da1ba11bafd847f870ce6c489d6d639ad68d49a6
refs/heads/master
2020-04-01T23:55:56.830696
2015-07-17T15:40:57
2015-07-17T15:40:57
6,386,816
0
0
null
null
null
null
UTF-8
Java
false
false
560
java
package com.efimchick.battleships.model.unit; /** * Created by efimchick on 14.07.15. */ public class Fortress extends Unit implements Shooting, Building { private final FortressType type; public Fortress(String name, FortressType type) { super(name); this.type = type; } public FortressType getType() { return type; } @Override public WallStrength getWallStrength() { return type.getWallStrength(); } @Override public Weapon getWeapon() { return type.getWeapon(); } }
[ "thejerome@mail.ru" ]
thejerome@mail.ru
f8b3dabd2d3f9afaa38505cec06801863f39fe3c
382762e05a5a9e81375198a97eb1028997e1f78c
/src/jfi/iu/ImagePanel.java
15f6247e48045bd71f37d558932a6e6dbce2535c
[]
no_license
jesuschamorro/JFI
3d1ac9af40f4ab0f5e05cddc07a1d1934ee9128e
c0693fb13bccc0f1182bcc4367adfdddc8cc141f
refs/heads/master
2021-06-20T07:56:11.488944
2021-02-13T21:55:10
2021-02-13T21:55:10
54,067,269
4
2
null
null
null
null
UTF-8
Java
false
false
4,618
java
package jfi.iu; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.image.BufferedImage; /** * Panel que contiene y muestra una imagen * * @author Jesús Chamorro Martínez (jesus@decsai.ugr.es) */ public class ImagePanel extends javax.swing.JPanel { /** * Imagen asociada al panel */ protected BufferedImage img; /** * Localización de la imagen dentro del panel (esquina superior izquierda) */ protected int x_image, y_image; /** * Patrón de discontinuidad del grid */ private final float grid_dash[] = {1.0f,1.0f}; /** * Trazo del grid */ private final BasicStroke grid = new BasicStroke(1.0f,0,0,1.0f,grid_dash,0.0f); /** * Tamaño de la retícula del grid */ private final int grid_size = 30; /** * Determina si se usa o no grid */ protected boolean use_grid = true; /** * Zoom (escalado) a aplicar */ protected int zoom = 1; /** * Construye un panel sin imagen */ public ImagePanel() { this(null); } /** * Cosntruye un panel con la imagen pasada por parámetro * * @param img imagen */ public ImagePanel(BufferedImage img){ initComponents(); this.setImage(img); } /** * Asigna una imagen al panel * * @param img la imagen a asignar */ public final void setImage(BufferedImage img) { this.img = img; if (img != null) { this.setPreferredSize(new Dimension(img.getWidth(), img.getHeight())); } } /** * Devuelve la imagen del panel * * @return la imagen del panel */ public BufferedImage getImage(){ return(img); } /** * Devuelve la localización de la imagen dentro del panel * * @return la localización de la imagen dentro del panel */ public Point getImageLocation(){ return new Point(x_image,y_image); } /** * Establece si hay o no grid * * @param grid */ public void setGrid(boolean grid){ this.use_grid = grid; } /** * Devuelve <tt>true</tt> si se usa grid * * @return <tt>true</tt> si se usa grid */ public boolean isGridded(){ return use_grid; } /** * Establece un nuevo valor de zoom * * @param zoom nuevo valor de zoom */ public void setZoom(int zoom){ this.zoom = zoom; if (img != null) { this.setPreferredSize(new Dimension(img.getWidth()*zoom, img.getHeight()*zoom)); } } /** * Devuelve el valor actual de zoom * * @return el valor actual de zoom */ public int getZoom(){ return this.zoom; } /** * Pinta el panel * * @param g gráfico asociado al panel */ @Override public void paint(Graphics g) { super.paint(g); ((Graphics2D)g).scale(zoom, zoom); if (img != null) { Rectangle r = this.getParent().getBounds(); x_image = (int)Math.max(0,r.getCenterX() - (img.getWidth()*zoom/2)) / zoom; y_image = (int)Math.max(0,r.getCenterY() - (img.getHeight()*zoom/2)) / zoom; if(use_grid) paintGrid(g); g.drawImage(img, x_image, y_image, this); } } /** * Pinta un grid * * @param g gráfico asociado al panel */ protected void paintGrid(Graphics g){ Rectangle bounds = this.getParent().getBounds(); ((Graphics2D)g).setStroke(grid); g.setColor(Color.LIGHT_GRAY); for(int x=x_image%grid_size;x<bounds.width;x+=grid_size){ g.drawLine(x,0,x,bounds.height); } for(int y=y_image%grid_size;y<bounds.height;y+=grid_size){ g.drawLine(0,y,bounds.width,y); } } /* * Código generado por Netbeans para el diseño del interfaz */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { setAlignmentX(0.0F); setAlignmentY(0.0F); setCursor(new java.awt.Cursor(java.awt.Cursor.CROSSHAIR_CURSOR)); }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables // End of variables declaration//GEN-END:variables }
[ "jesus@decsai.ugr.es" ]
jesus@decsai.ugr.es
2d11ed02959327d8b1396ad7c1867d80794ede5e
48e835e6f176a8ac9ae3ca718e8922891f1e5a18
/benchmark/training/org/sonar/scanner/bootstrap/MetricProviderTest.java
8bb5360f53915e5345b818b5083989841fbb4230
[]
no_license
STAMP-project/dspot-experiments
f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5
121487e65cdce6988081b67f21bbc6731354a47f
refs/heads/master
2023-02-07T14:40:12.919811
2019-11-06T07:17:09
2019-11-06T07:17:09
75,710,758
14
19
null
2023-01-26T23:57:41
2016-12-06T08:27:42
null
UTF-8
Java
false
false
1,949
java
/** * SonarQube * Copyright (C) 2009-2019 SonarSource SA * mailto:info AT sonarsource DOT com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.scanner.bootstrap; import java.util.Arrays; import java.util.List; import org.junit.Test; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Metric; import org.sonar.api.measures.Metrics; public class MetricProviderTest { @Test public void should_provide_at_least_core_metrics() { MetricProvider provider = new MetricProvider(); List<Metric> metrics = provider.provide(); assertThat(metrics).hasSize(CoreMetrics.getMetrics().size()); assertThat(metrics).extracting("key").contains("ncloc"); } @Test public void should_provide_plugin_metrics() { Metrics factory = new Metrics() { public List<Metric> getMetrics() { return Arrays.<Metric>asList(create()); } }; MetricProvider provider = new MetricProvider(new Metrics[]{ factory }); List<Metric> metrics = provider.provide(); assertThat(metrics.size()).isEqualTo((1 + (CoreMetrics.getMetrics().size()))); assertThat(metrics).extracting("key").contains("custom"); } }
[ "benjamin.danglot@inria.fr" ]
benjamin.danglot@inria.fr
66fe0457d70f7e0493cd8a330dba5b78701985cc
bf441cf2e674c74b255e877f81d97299a5879678
/Merchant's Guide to the Galaxy/tests/com/tw/math/ConverterProcessDecimalValuesTests.java
2bd8b2f7a9cfcae067a78b039a25cd2080dd4961
[]
no_license
PedroPK/tw
c3123c0999d444d4cbb7fe849fbe87ca30a66bc8
7123b024d58cb6a3682c5f6b8be5811d94bec4bf
refs/heads/master
2020-03-21T01:46:10.749185
2018-07-03T22:17:10
2018-07-03T22:17:10
137,961,355
0
0
null
null
null
null
UTF-8
Java
false
false
5,086
java
package com.tw.math; import static com.tw.utils.Utils.isEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.math.BigDecimal; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; import org.junit.runners.Parameterized; /** * Roman numerals are based on seven symbols: * * Symbol Value * I 1 * V 5 * X 10 * L 50 * C 100 * D 500 * M 1,000 * * Numbers are formed by combining symbols together and adding the values. For example, MMVI is 1000 + 1000 + 5 + 1 = 2006. * Generally, symbols are placed in order of value, starting with the largest values. * When smaller values precede larger values, the smaller values are subtracted from the larger values, and the result is added to the total. * * For example MCMXLIV = 1000 + (1000 - 100) + (50 - 10) + (5 - 1) = 1944. * * The symbols "I", "X", "C", and "M" can be repeated three times in succession, but no more. * (They may appear four times if the third and fourth are separated by a smaller value, such as XXXIX.) "D", "L", and "V" can never be repeated. * * "I" can be subtracted from "V" and "X" only. * "X" can be subtracted from "L" and "C" only. * "C" can be subtracted from "D" and "M" only. * "V", "L", and "D" can never be subtracted. * * Only one small-value symbol may be subtracted from any large-value symbol. * * A number written in [16]Arabic numerals can be broken into digits. * * For example, 1903 is composed of 1, 9, 0, and 3. * * To write the Roman numeral, each of the non-zero digits should be treated separately. * In the above example, 1,000 = M, 900 = CM, and 3 = III. * * Therefore, 1903 = MCMIII. * (Source: Wikipedia http://en.wikipedia.org/wiki/Roman_numerals) * * Input to your program consists of lines of text detailing your notes on the conversion between intergalactic units and roman numerals. * You are expected to handle invalid queries appropriately. * * Test input: * glob is I * prok is V * pish is X * tegj is L * * glob glob Silver is 34 Credits * glob prok Gold is 57800 Credits * pish pish Iron is 3910 Credits * * how much is pish tegj glob glob ? * how many Credits is glob prok Silver ? * how many Credits is glob prok Gold ? * how many Credits is glob prok Iron ? * how much wood could a woodchuck chuck if a woodchuck could chuck wood ? * * Test Output: * pish tegj glob glob is 42 * glob prok Silver is 68 Credits * glob prok Gold is 57800 Credits * glob prok Iron is 782 Credits * I have no idea what you are talking about * * @author pedroc.f.santos */ @FixMethodOrder(MethodSorters.JVM) @RunWith(Parameterized.class) public class ConverterProcessDecimalValuesTests { //private @Test public void testProcessDecimalValuesFromNull() { BigDecimal integerBigDecimal = Converter.processDecimalValues(null); assertNull(integerBigDecimal); } @Test public void testProcessDecimalValuesFrom10String() { BigDecimal integerBigDecimal = Converter.processDecimalValues(new BigDecimal("10.0")); assertNotNull(integerBigDecimal); BigDecimal ten = new BigDecimal(10); assertTrue( isEquals(integerBigDecimal, ten) ); } @Test public void testProcessDecimalValuesFrom10Point1String() { BigDecimal integerBigDecimal = Converter.processDecimalValues(new BigDecimal("10.1")); assertNotNull(integerBigDecimal); assertFalse( isEquals(integerBigDecimal, new BigDecimal(10)) ); } @Test public void testProcessDecimalValuesFrom10Point01String() { BigDecimal integerBigDecimal = Converter.processDecimalValues(new BigDecimal("10.01")); assertNotNull(integerBigDecimal); assertFalse( isEquals(integerBigDecimal, new BigDecimal(10)) ); } @Test public void testProcessDecimalValuesFrom10Point001String() { BigDecimal integerBigDecimal = Converter.processDecimalValues(new BigDecimal("10.001")); assertNotNull(integerBigDecimal); assertFalse( isEquals(integerBigDecimal, new BigDecimal(10)) ); } @Test public void testProcessDecimalValuesFrom10Point0001String() { BigDecimal integerBigDecimal = Converter.processDecimalValues(new BigDecimal("10.0001")); assertNotNull(integerBigDecimal); assertFalse( isEquals(integerBigDecimal, new BigDecimal(10)) ); } @Test public void testProcessDecimalValuesFrom10Point00001String() { BigDecimal integerBigDecimal = Converter.processDecimalValues(new BigDecimal("10.00001")); assertNotNull(integerBigDecimal); assertFalse( isEquals(integerBigDecimal, new BigDecimal(10)) ); } @Test public void testProcessDecimalValuesFrom10Point000001String() { BigDecimal integerBigDecimal = Converter.processDecimalValues(new BigDecimal("10.000001")); assertNotNull(integerBigDecimal); assertTrue( isEquals(integerBigDecimal, new BigDecimal(10)) ); } }
[ "pedroc.f.santos@192.168.15.9" ]
pedroc.f.santos@192.168.15.9
f47c9ef11ba7860afd78d8e8b8b7441f68d63d17
ac7f50723ca7795dbc6eedb6be302b779b4689da
/src/main/java/jp/co/aisinfo/edu/batch/a10pg20b/A10PG20B.java
f832e09cee83fee3366c19387e2db3129978eeca
[]
no_license
ais-kimjinman/education
a5ebc6f88b20f26d33e7e8be0ad4c0ad0024fdca
a8b80bd2623f7b1b9d297605e1111fa8256085ea
refs/heads/master
2021-01-21T07:08:30.683721
2017-03-13T14:31:57
2017-03-13T14:31:57
83,325,359
0
0
null
null
null
null
UTF-8
Java
false
false
3,656
java
package jp.co.aisinfo.edu.batch.a10pg20b; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.io.Writer; import org.apache.ibatis.cursor.Cursor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.opencsv.CSVWriter; import jp.co.aisinfo.edu.batch.BatchProcess; import jp.co.aisinfo.edu.common.ConfigLoader; import jp.co.aisinfo.edu.common.Constant; import jp.co.aisinfo.edu.common.Tbl; import jp.co.aisinfo.edu.dao.model.TblZip; import jp.co.aisinfo.edu.util.StringUtils; /** * 郵便番号ファイル作成処理 * * @author ais-info */ public class A10PG20B extends BatchProcess { /** * ログの定義 */ private static Logger logger = LoggerFactory.getLogger("A10PG20B"); /** * バッチ名 */ private static final String BATCH_NAME = "郵便番号ファイル作成処理"; /** *ファイル名定数 */ private static final String OUTPUT_FILE_NAME = "zip.out.file.name"; /** * 郵便番号情報取込処理実行 * * @param args * WINDOWSスクリプトから入力パラメータ */ public static void main(final String[] args) { A10PG20B obj = new A10PG20B(); // 当クラスを設定 obj.setGymClass(A10PG20B.class); // 実行 int ret = obj.execMain(args); // WINDOWSスクリプトへの返却値を設定 System.exit(ret); } /** * 業務主処理 * * @param args * 入力パラメータ * @return 処理結果コード * @throws Exception * 例外 */ protected final int mainProcess(String[] args) throws Exception { // 初期化 Writer iowriter = null; CSVWriter writer = null; // 処理件数 int wirteCnt = 0; try { // 主処理 // ① ファイルパス作成 String filePath = ConfigLoader.getParameter(Constant.OUTPUNT_FILE_PATH); logger.debug("ファイルパス:" + filePath); // ファイルパスをチェック if (StringUtils.isEmpty(filePath)) { logger.error("ファイルパスが存在しません。"); return Constant.RET_CODE_NG; } // ファイル名をチェック String fileName = ConfigLoader.getParameter(OUTPUT_FILE_NAME); String path = filePath + fileName; logger.debug("対象ファイル:" + path); File csvPath = new File(path); iowriter = new OutputStreamWriter(new FileOutputStream(csvPath), Constant.FILE_ENCODE_SJIS); writer = new CSVWriter(iowriter, ',', CSVWriter.NO_QUOTE_CHARACTER); // 郵便番号マスタテーブル取得 @SuppressWarnings("unchecked") Cursor<TblZip> TblZipList = (Cursor<TblZip>) Tbl.TblZip.getDAO() .selectCursor(Tbl.TblZip.gen("selectCursor")); for (TblZip item : TblZipList) { // レコード別の処理 String[] entries = new String[]{ item.getZipSeq().toString(), item.getPrefcode(), item.getCitycode().toString(), item.getZip7(), item.getPrefkana(), item.getCitykana(), item.getAreakana(), item.getPref(), item.getCity(), item.getArea() }; writer.writeNext(entries); wirteCnt++; } // 処理終了 logger.info(wirteCnt+"件を作成しました。"); logger.info(BATCH_NAME + "処理が正常終了しました。"); // 結果返却 return Constant.RET_CODE_OK; } catch (Exception e) { writer.close(); logger.debug(BATCH_NAME + "処理中エラーが発生しました。"); throw e; } finally { writer.close(); } } }
[ "JINMAN@HOME-PC" ]
JINMAN@HOME-PC
ad12a35c6b84b9873f83caa5a8d1e812077997a4
b842d7a58429e3fd65f1bf7e781d8031ce4d5a63
/src/main/java/com/devlog/delog/service/CustomUserDetailService.java
4444e088b0e745263a7d14985b74b3a36a233b1c
[]
no_license
HyunSung-Na/delog
afa1aee4fff2a653450ad22463b38ef33f01ecf8
22cb67c3ba2cfe6ea76ee29b08652b4e12902fe2
refs/heads/master
2023-01-04T02:42:56.987962
2020-10-27T07:55:27
2020-10-27T07:55:27
303,080,976
0
0
null
null
null
null
UTF-8
Java
false
false
1,038
java
package com.devlog.delog.service; import com.devlog.delog.domain.Account; import com.devlog.delog.repository.AccountRepository; import lombok.RequiredArgsConstructor; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; @Service @RequiredArgsConstructor public class CustomUserDetailService implements UserDetailsService { private final AccountRepository accountRepository; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { Account account = accountRepository.findByEmail(username); Account user = Account.builder() .id(account.getId()) .email(account.getEmail()) .password(account.getPassword()) .roles(account.getRoles()) .build(); return user; } }
[ "59365947+HyunSung-Na@users.noreply.github.com" ]
59365947+HyunSung-Na@users.noreply.github.com
6bd362b33f25d1facd6c961bcb968896ebe4be1c
73d81f6c3b6ced2c7e4e55b392a808e3b0a250fc
/src/main/java/com/Driver.java
0b31072b8bd9029dc3d9843079f5f92be472d45a
[]
no_license
visionskyGH/codingtest
cd041d60440db1641af1788645f17810b06b8a17
51f06e31f20aa977076cb4eb56a798f9efa8d631
refs/heads/master
2021-07-06T03:23:05.129346
2019-06-03T14:17:31
2019-06-03T14:17:31
188,855,252
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
package com; public interface Driver { void move(DriverOperation operation,Car c)throws Exception; }
[ "scutlxj@163.com" ]
scutlxj@163.com
d5a5ff461045fa6b591e29ecded557a30400e64a
549bbad8f6dfbc979250f78290c77c10d5005873
/app/src/main/java/com/lastsoft/plog/util/IgnorePauseAnimator.java
ebe3c89b368fd14c9dad8fab3bae3b4a03ce2f70
[]
no_license
aelaster/Plog
af657fc00cf2dd5343d7dfa909de8a8f3293fb20
29a57d9e8816e668244c77250b7a27f4f1172202
refs/heads/master
2021-01-10T14:47:18.863917
2017-11-03T15:40:19
2017-11-03T15:40:19
36,373,580
1
1
null
null
null
null
UTF-8
Java
false
false
4,775
java
package com.lastsoft.plog.util; import android.animation.Animator; import android.animation.TimeInterpolator; import java.util.ArrayList; import java.util.List; public class IgnorePauseAnimator extends Animator implements Animator.AnimatorListener { private Animator mAnimator; private ArrayList<AnimatorListener> mListeners; public IgnorePauseAnimator(Animator animator) { mAnimator = animator; mAnimator.addListener(this); } @Override public long getDuration() { return mAnimator.getDuration(); } @Override public Animator setDuration(long millis) { mAnimator.setDuration(millis); return this; } @Override public TimeInterpolator getInterpolator() { return mAnimator.getInterpolator(); } @Override public void setInterpolator(TimeInterpolator interpolator) { mAnimator.setInterpolator(interpolator); } @Override public long getStartDelay() { return mAnimator.getStartDelay(); } @Override public void setStartDelay(long millis) { mAnimator.setStartDelay(millis); } @Override public boolean isRunning() { return mAnimator.isRunning(); } @Override public ArrayList<AnimatorListener> getListeners() { return mListeners; } @Override public void addListener(Animator.AnimatorListener listener) { if (mListeners == null) { mListeners = new ArrayList<>(); } mListeners.add(listener); } @Override public void removeListener(Animator.AnimatorListener listener) { if (mListeners != null) { mListeners.remove(listener); if (mListeners.isEmpty()) { mListeners = null; } } } @Override public void removeAllListeners() { if (mListeners != null) { mListeners.clear(); mListeners = null; } } @Override public void addPauseListener(Animator.AnimatorPauseListener listener) { // Do nothing. } @Override public void removePauseListener(Animator.AnimatorPauseListener listener) { // Do nothing. } @Override public void pause() { // Do nothing. } @Override public void resume() { // Do nothing. } @Override public void start() { mAnimator.start(); } @Override public void end() { mAnimator.end(); } @Override public void cancel() { mAnimator.cancel(); } @Override public boolean isPaused() { return mAnimator.isPaused(); } @Override public boolean isStarted() { return mAnimator.isStarted(); } @Override public void setTarget(Object target) { mAnimator.setTarget(target); } @Override public void setupStartValues() { mAnimator.setupStartValues(); } @Override public void setupEndValues() { mAnimator.setupEndValues(); } @Override public IgnorePauseAnimator clone() { IgnorePauseAnimator anim = (IgnorePauseAnimator) super.clone(); if (mListeners != null) { List<AnimatorListener> oldListeners = mListeners; anim.mListeners = new ArrayList<>(); for (AnimatorListener oldListener : oldListeners) { anim.mListeners.add(oldListener); } } return anim; } @Override public void onAnimationCancel(Animator animator) { @SuppressWarnings("unchecked") List<AnimatorListener> listeners = (ArrayList<AnimatorListener>) mListeners.clone(); for (AnimatorListener tmpListener : listeners) { tmpListener.onAnimationCancel(this); } } @Override public void onAnimationEnd(Animator animator) { @SuppressWarnings("unchecked") List<AnimatorListener> listeners = (ArrayList<AnimatorListener>) mListeners.clone(); for (AnimatorListener tmpListener : listeners) { tmpListener.onAnimationEnd(this); } } @Override public void onAnimationRepeat(Animator animator) { @SuppressWarnings("unchecked") List<AnimatorListener> listeners = (ArrayList<AnimatorListener>) mListeners.clone(); for (AnimatorListener tmpListener : listeners) { tmpListener.onAnimationRepeat(this); } } @Override public void onAnimationStart(Animator animator) { @SuppressWarnings("unchecked") List<AnimatorListener> listeners = (ArrayList<AnimatorListener>) mListeners.clone(); for (AnimatorListener tmpListener : listeners) { tmpListener.onAnimationStart(this); } } }
[ "aelaster@gmail.com" ]
aelaster@gmail.com
023ac1453ae6ca0293f81b5e4b3cf4cd95e1826e
a8bd151ed83e9b5501268a1ae3250dcd011d7a92
/src/plasma/collections/ObservableCollections.java
ab743349ee18f1c914a7cd48cfb649a05331c467
[]
no_license
dtrehas/plasmafx
ee7940d5325a97820e9b8264e5a48f2b11ba0d17
cea2eb0235bee24ed8f9839dce821c7c33574c0f
refs/heads/master
2021-01-24T06:07:31.926030
2013-08-12T14:41:07
2013-08-12T14:41:07
32,844,934
0
0
null
null
null
null
UTF-8
Java
false
false
9,350
java
package plasma.collections; import java.util.AbstractList; import java.util.AbstractMap; import java.util.AbstractSet; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; import plasma.beans.InvalidationListener; import plasma.beans.Observable; /** * {@code ObservableCollections} provides factory methods for creating * observable lists and maps. */ public class ObservableCollections { /** * Creates and returns an {@code ObservableList} wrapping the supplied * {@code List}. * * @param list * the {@code List} to wrap * @return an {@code ObservableList} * @throws IllegalArgumentException * if {@code list} is {@code null} */ public static <E> ObservableList<E> observableList(List<E> list) { if (list == null) { throw new IllegalArgumentException("List must be non-null"); } return new ObservableListImpl<E>(list); } /** * Creates and returns an {@code ObservableMap} wrapping the supplied * {@code Map}. * * @param map * the {@code Map} to wrap * @return an {@code ObservableMap} * @throws IllegalArgumentException * if {@code map} is {@code null} */ public static <K, V> ObservableMap<K, V> observableMap(Map<K, V> map) { if (map == null) { throw new IllegalArgumentException("Map must be non-null"); } return new ObservableMapImpl<K, V>(map); } // --------------------------------------------------------------------- // ObservableList implementation. // --------------------------------------------------------------------- private static final class ObservableListImpl<E> extends AbstractList<E> implements ObservableList<E> { private final List<E> list; private final List<ObservableListListener<E>> listeners; private final ObservableSupport observableSupport; ObservableListImpl(List<E> list) { this.list = list; this.listeners = new CopyOnWriteArrayList<ObservableListListener<E>>(); this.observableSupport = new ObservableSupport() { @SuppressWarnings("unchecked") @Override public Observable getObservable() { return ObservableListImpl.this; } }; } @Override public E get(int index) { return list.get(index); } @Override public int size() { return list.size(); } @Override public E set(int index, E element) { // TODO check equals? E oldValue = list.set(index, element); observableSupport.notifyListeners(); for (ObservableListListener<E> listener : listeners) { listener.listElementReplaced(this, index, oldValue); } return oldValue; } @Override public void add(int index, E element) { list.add(index, element); modCount++; observableSupport.notifyListeners(); for (ObservableListListener<E> listener : listeners) { listener.listElementsInserted(this, index, 1); } } @Override public E remove(int index) { E oldValue = list.remove(index); modCount++; observableSupport.notifyListeners(); for (ObservableListListener<E> listener : listeners) { listener.listElementsRemoved(this, index, Collections.singletonList(oldValue)); } return oldValue; } @Override public boolean addAll(Collection<? extends E> c) { return addAll(size(), c); } @Override public boolean addAll(int index, Collection<? extends E> c) { if (list.addAll(index, c)) { modCount++; observableSupport.notifyListeners(); for (ObservableListListener<E> listener : listeners) { listener.listElementsInserted(this, index, c.size()); } } return false; } @Override public void clear() { List<E> dup = new ArrayList<E>(list); list.clear(); modCount++; observableSupport.notifyListeners(); if (dup.size() != 0) { for (ObservableListListener<E> listener : listeners) { listener.listElementsRemoved(this, 0, dup); } } } @Override public boolean containsAll(Collection<?> c) { return list.containsAll(c); } @Override public <T> T[] toArray(T[] a) { return list.toArray(a); } @Override public Object[] toArray() { return list.toArray(); } @Override public void addObservableListListener(ObservableListListener<E> listener) { listeners.add(listener); } @Override public void removeObservableListListener( ObservableListListener<E> listener) { listeners.remove(listener); } @Override public void addListener(InvalidationListener listener) { observableSupport.addListener(listener); } @Override public void removeListener(InvalidationListener listener) { observableSupport.removeListener(listener); } } // --------------------------------------------------------------------- // ObservableMap implementation. // --------------------------------------------------------------------- private static final class ObservableMapImpl<K, V> extends AbstractMap<K, V> implements ObservableMap<K, V> { private final Map<K, V> map; private Set<Map.Entry<K, V>> entrySet; private final List<ObservableMapListener<K, V>> listeners; private final ObservableSupport observableSupport; ObservableMapImpl(Map<K, V> map) { this.map = map; this.listeners = new CopyOnWriteArrayList<ObservableMapListener<K, V>>(); this.observableSupport = new ObservableSupport() { @SuppressWarnings("unchecked") @Override public Observable getObservable() { return ObservableMapImpl.this; } }; } @Override public void clear() { // Remove all elements via iterator to trigger notification Iterator<K> iterator = keySet().iterator(); while (iterator.hasNext()) { iterator.next(); iterator.remove(); } } @Override public boolean containsKey(Object key) { return map.containsKey(key); } @Override public boolean containsValue(Object value) { return map.containsValue(value); } @Override public Set<Map.Entry<K, V>> entrySet() { Set<Map.Entry<K, V>> es = entrySet; return es != null ? es : (entrySet = new EntrySet()); } @Override public V get(Object key) { return map.get(key); } @Override public boolean isEmpty() { return map.isEmpty(); } @Override public V put(K key, V value) { V lastValue; if (containsKey(key)) { lastValue = map.put(key, value); observableSupport.notifyListeners(); for (ObservableMapListener<K, V> listener : listeners) { listener.mapKeyValueChanged(this, key, lastValue); } } else { lastValue = map.put(key, value); observableSupport.notifyListeners(); for (ObservableMapListener<K, V> listener : listeners) { listener.mapKeyAdded(this, key); } } return lastValue; } @Override public void putAll(Map<? extends K, ? extends V> m) { for (K key : m.keySet()) { put(key, m.get(key)); } } @Override @SuppressWarnings("unchecked") public V remove(Object key) { if (containsKey(key)) { V value = map.remove(key); observableSupport.notifyListeners(); for (ObservableMapListener<K, V> listener : listeners) { listener.mapKeyRemoved(this, (K) key, value); } return value; } return null; } @Override public int size() { return map.size(); } @Override public void addObservableMapListener( ObservableMapListener<K, V> listener) { listeners.add(listener); } @Override public void removeObservableMapListener( ObservableMapListener<K, V> listener) { listeners.remove(listener); } @Override public void addListener(InvalidationListener listener) { observableSupport.addListener(listener); } @Override public void removeListener(InvalidationListener listener) { observableSupport.removeListener(listener); } private class EntryIterator implements Iterator<Map.Entry<K, V>> { private Iterator<Map.Entry<K, V>> realIterator; private Map.Entry<K, V> last; EntryIterator() { realIterator = map.entrySet().iterator(); } @Override public boolean hasNext() { return realIterator.hasNext(); } @Override public Map.Entry<K, V> next() { last = realIterator.next(); return last; } @Override public void remove() { if (last == null) { throw new IllegalStateException(); } Object toRemove = last.getKey(); last = null; ObservableMapImpl.this.remove(toRemove); } } private class EntrySet extends AbstractSet<Map.Entry<K, V>> { @Override public Iterator<Map.Entry<K, V>> iterator() { return new EntryIterator(); } @Override @SuppressWarnings("unchecked") public boolean contains(Object o) { if (!(o instanceof Map.Entry)) { return false; } Map.Entry<K, V> e = (Map.Entry<K, V>) o; return containsKey(e.getKey()); } @Override @SuppressWarnings("unchecked") public boolean remove(Object o) { if (o instanceof Map.Entry) { K key = ((Map.Entry<K, V>) o).getKey(); if (containsKey(key)) { remove(key); return true; } } return false; } @Override public int size() { return ObservableMapImpl.this.size(); } @Override public void clear() { ObservableMapImpl.this.clear(); } } } }
[ "georgopoulos.georgios@gmail.com@6f97281e-d518-c372-eee3-0b5b61c45b3a" ]
georgopoulos.georgios@gmail.com@6f97281e-d518-c372-eee3-0b5b61c45b3a
53645f52cd418bd75c85df689d1948220de0ac4f
881d05f26e712844d897c12ac5abf5341993bae2
/src/main/java/com/orange/thread/OutputDemo.java
ba76a39d0ef48beeeeb00086b3d89d58a1e7b1dd
[]
no_license
GLGGAG/orange
8a7d8d18a084ec6becf4db301c37d6a7a9d22e9a
e4688f6f06d2269551450c8264e9b0467f5b4211
refs/heads/master
2021-09-07T19:56:24.378997
2018-02-28T06:49:07
2018-02-28T06:49:07
112,339,926
0
0
null
null
null
null
UTF-8
Java
false
false
695
java
package com.orange.thread; /** * @author:GLGGAG * @Date:2017/10/31 * @Description: */ public class OutputDemo extends Thread { private SourceDemo s; public OutputDemo(SourceDemo demo){ this.s=demo; } @Override public void run() { while (true){ synchronized (s){ if (!s.flag){ try { s.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } System.out.println(s.sex+"===="+s.name); s.flag=false; s.notify(); } } } }
[ "1835854167@qq.com" ]
1835854167@qq.com
65494b34874b86131bea145c14c50ef9734cc48d
0204755d9f904b2e645256740c0449c4eb331138
/src/L8_Dominator/Solution.java
ca0a4b62495c7174180e0aa3f2c44727333a487a
[]
no_license
lanskyfan/codility
aa6b7d39bddb809cbbf26b8d024f8fbaf0d190cb
3c7f1deb39292410f5a5a2daf6962b3d0310ff6d
refs/heads/master
2022-12-16T15:36:50.312451
2020-09-08T09:32:35
2020-09-08T09:32:35
286,676,157
0
0
null
null
null
null
UTF-8
Java
false
false
2,081
java
package L8_Dominator; /** * An array A consisting of N integers is given. The dominator of array A is the value that occurs in more * than half of the elements of A. * * For example, consider array A such that * * A[0] = 3 A[1] = 4 A[2] = 3 * A[3] = 2 A[4] = 3 A[5] = -1 * A[6] = 3 A[7] = 3 * The dominator of A is 3 because it occurs in 5 out of 8 elements of A (namely in those with indices 0, 2, 4, 6 and 7) * and 5 is more than a half of 8. * * Write a function * * class Solution { public int solution(int[] A); } * * that, given an array A consisting of N integers, returns index of any element of array A in which the dominator of A * occurs. The function should return −1 if array A does not have a dominator. * * For example, given array A such that * * A[0] = 3 A[1] = 4 A[2] = 3 * A[3] = 2 A[4] = 3 A[5] = -1 * A[6] = 3 A[7] = 3 * the function may return 0, 2, 4, 6 or 7, as explained above. * * Write an efficient algorithm for the following assumptions: * * N is an integer within the range [0..100,000]; * each element of array A is an integer within the range [−2,147,483,648..2,147,483,647]. */ import java.util.Stack; public class Solution { public int solution(int[] A) { // write your code in Java SE 8 Stack<Integer> leader_stack = new Stack<>(); for (int x: A){ if (leader_stack.isEmpty()){ leader_stack.push(x); } else if (leader_stack.peek() != x){ leader_stack.pop(); } else { leader_stack.push(x); } } if (leader_stack.isEmpty()){ return -1; } int candidate = leader_stack.peek(); int count = 0; int position = 0; for (int i = 0; i < A.length; i++){ if (A[i] == candidate){ count++; position = i; } } if (count <= A.length / 2){ return -1; } return position; } }
[ "1522254605@qq.com" ]
1522254605@qq.com
3073f8998aa5ebeafa0290fd40fa68e3c68ccf1b
e670b10af68c3d0c595e50897afc04c35baa65cf
/app/src/main/java/com/example/SmartWorker/Customer/Help.java
3a62fe0455622daf6a356910b8ec2b570b133d59
[]
no_license
AmilaNipun/Smart-Worker
852fcbf34688b8769c344d68f21c15c0bc612ab5
a7eebd4e6d84fc765e8f122a866b0315d281e4a5
refs/heads/master
2021-07-23T22:54:04.678847
2020-05-20T14:56:03
2020-05-20T14:56:03
260,912,976
0
0
null
null
null
null
UTF-8
Java
false
false
373
java
package com.example.SmartWorker.Customer; import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import com.example.SmartWorker.R; public class Help extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_help); } }
[ "amilanipun97@gmail.com" ]
amilanipun97@gmail.com
3fbaab2986762104ef83da4e6d750fd71cf7581f
dd9f18a6911571035f3f461386c043fa0439be2f
/src/main/java/com/lmig/uscm/cl/predictivemodel/util/JSONUtil.java
a57a4e8e7a97995da1827c0ab3973bc039beb559
[]
no_license
schen2011/autotesting
ca1ca722daa8cacc22de2dd81cdeb93a8856aa6e
f237be4fdf05e51a878637d7fc6bf2cb4fdec60e
refs/heads/master
2020-06-18T13:49:06.687273
2016-11-30T02:29:45
2016-11-30T02:29:45
75,133,888
0
0
null
null
null
null
UTF-8
Java
false
false
559
java
/* * Copyright (c) 2016, Liberty Mutual * Proprietary and Confidential * All Rights Reserved */ package com.lmig.uscm.cl.predictivemodel.util; import com.google.gson.Gson; import com.google.gson.GsonBuilder; /** * @author BoChen * */ public final class JSONUtil { /*** * */ private JSONUtil() { super(); } /*** * * @param obj * @return */ public static String objectToJson(Object obj) { Gson gson = new GsonBuilder().create(); return gson.toJson(obj); } }
[ "schenjobs@gmail.com" ]
schenjobs@gmail.com
e881fce4418281d9f5931410a68263082940be9f
798d2cb7eb8b1a28c25680543e824d909581c955
/src/main/java/com/wanghao/listener/SystemServiceLog.java
cb9d44f654d1e5581d5ea8b8d3b48fbab2ce25e0
[]
no_license
huahangwanghao/work4cc
fcd0097768f490f51db4d29c4b2313cb173de713
6ef514a6062dde4ce6c5da558268ae59b2648a1f
refs/heads/master
2021-05-11T16:29:48.325394
2018-01-31T09:03:33
2018-01-31T09:03:33
117,766,523
0
0
null
null
null
null
UTF-8
Java
false
false
444
java
package com.wanghao.listener; /** * @author WH 作者 E-mail: * @version 创建时间:2017年3月2日 上午11:20:58 * 类说明 */ import java.lang.annotation.*; /** *自定义注解 拦截service */ @Target({ElementType.PARAMETER, ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface SystemServiceLog { String description() default ""; }
[ "wanghao2@gomeholdings.com" ]
wanghao2@gomeholdings.com
4c5b9a6a7b0a9869cf466f8865d6d34bbfee4d1e
49b3d7c0e383cdac8035e5f81078c863fac6a547
/src/main/java/agh/ea/EnergyEvaluator.java
53da3b0aa9d5be49f7594a086f38fd456e4e38b0
[]
no_license
joaoperfig/EA_Group4
73ed5753015d786291ced538b5bffb0ff3c77deb
c764b330b3e64a789801c2345424d4ebee4bbdaa
refs/heads/master
2020-04-07T02:49:11.487841
2019-02-01T08:20:23
2019-02-01T08:20:23
157,991,233
0
0
null
null
null
null
UTF-8
Java
false
false
462
java
package agh.ea; public class EnergyEvaluator implements IEvaluator { @Override public float evaluate(ISequence sequence) { int total = 0; for (int k = 1; k < sequence.getLength(); k++) { total += Math.pow(cks(k, sequence), 2); } return (float) total; } private int cks(int k, ISequence sequence) { int total = 0; for (int i = 0; i < sequence.getLength() - k; i++) { total += sequence.at(i) * sequence.at(i + k); } return total; } }
[ "joaoperfig@gmail.com" ]
joaoperfig@gmail.com
5c1b2110bc745fad30362d7caf04a65da483b873
7e1511cdceeec0c0aad2b9b916431fc39bc71d9b
/flakiness-predicter/input_data/original_tests/joel-costigliola-assertj-core/nonFlakyMethods/org.assertj.core.api.Condition_as_Description_Test-should_throw_error_of_description_is_null.java
3eb6cca446738c1e4c804b724b605c9b094b5481
[ "BSD-3-Clause" ]
permissive
Taher-Ghaleb/FlakeFlagger
6fd7c95d2710632fd093346ce787fd70923a1435
45f3d4bc5b790a80daeb4d28ec84f5e46433e060
refs/heads/main
2023-07-14T16:57:24.507743
2021-08-26T14:50:16
2021-08-26T14:50:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
182
java
@Test public void should_throw_error_of_description_is_null(){ thrown.expectNullPointerException("The description to set should not be null"); condition.as((Description)null); }
[ "aalsha2@masonlive.gmu.edu" ]
aalsha2@masonlive.gmu.edu
71c854fd97cf9a74347e221dd995ddb46ae1dcb1
ce0ac05cc2c6c9ceedb4a268476d70dd727a448b
/frontend/lib/src/stripes-1.5.6/src/net/sourceforge/stripes/localization/LocalizationUtility.java
ef97b995b1748991f204212274d76bf7ca3a509c
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
masteinhauser/connectedkitchen
80804e280489ea52c452f2590acedba73bb8e925
680befd9d3276d43f7f842c967477b6214dab80e
refs/heads/master
2016-09-06T13:25:17.998587
2011-12-15T05:19:57
2011-12-15T05:19:57
2,617,267
1
0
null
null
null
null
UTF-8
Java
false
false
6,705
java
/* Copyright 2005-2006 Tim Fennell * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.sourceforge.stripes.localization; import net.sourceforge.stripes.controller.ParameterName; import net.sourceforge.stripes.controller.StripesFilter; import net.sourceforge.stripes.util.Log; import net.sourceforge.stripes.validation.ValidationMetadata; import net.sourceforge.stripes.config.Configuration; import net.sourceforge.stripes.action.ActionBean; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; /** * Provides simple localization utility methods that are used in multiple places in the Stripes * code base. * * @author Tim Fennell * @since Stripes 1.1 */ public class LocalizationUtility { private static final Log log = Log.getInstance(LocalizationUtility.class); /** * <p>Fetches the localized name for a form field if one exists in the form field resource bundle. * If for any reason a localized value cannot be found (e.g. the bundle cannot be found, or * does not contain the required properties) then null will be returned.</p> * * <p>Looks first for a property called {@code beanClassFQN.fieldName} in the resource bundle. * If that is undefined, it next looks for {@code actionPath.fieldName} and * if not defined, looks for a property called {@code fieldName}. Will strip any indexing * from the field name prior to using it to construct property names (e.g. foo[12] will become * simply foo).</p> * * @param fieldName The name of the field whose localized name to look up * @param actionPath The action path of the form in which the field is nested. If for some * reason this is not available, null may be passed without causing errors. * @param locale The desired locale of the looked up name. * @return a localized field name if one can be found, or null otherwise. */ public static String getLocalizedFieldName(String fieldName, String actionPath, Class<? extends ActionBean> beanclass, Locale locale) { ParameterName parameterName = new ParameterName(fieldName); String strippedName = parameterName.getStrippedName(); String localizedValue = null; ResourceBundle bundle = null; try { bundle = StripesFilter.getConfiguration().getLocalizationBundleFactory() .getFormFieldBundle(locale); } catch (MissingResourceException mre) { log.error(mre); return null; } // First with the bean class if (beanclass != null) { try { localizedValue = bundle.getString(beanclass.getName() + "." + strippedName); } catch (MissingResourceException mre) { /* do nothing */ } } // Then the action path (THIS IS DEPRECATED) if (localizedValue == null) { try { localizedValue = bundle.getString(actionPath + "." + strippedName); } catch (MissingResourceException mre) { /* do nothing */ } } // Then all by itself if (localizedValue == null) { try { localizedValue = bundle.getString(strippedName); } catch (MissingResourceException mre2) { /* do nothing */ } } // Lastly, check @Validate on the ActionBean property if (localizedValue == null && beanclass != null) { ValidationMetadata validate = StripesFilter.getConfiguration() .getValidationMetadataProvider() .getValidationMetadata(beanclass, parameterName); if (validate != null && validate.label() != null && !"".equals(validate.label())) { localizedValue = validate.label(); } } return localizedValue; } /** * Makes a half hearted attempt to convert the property name of a field into a human * friendly name by breaking it on periods and upper case letters and capitalizing each word. * This is only used when developers do not provide names for their fields. * * @param fieldNameKey the programmatic name of a form field * @return String a more user friendly name for the field in the absence of anything better */ public static String makePseudoFriendlyName(String fieldNameKey) { StringBuilder builder = new StringBuilder(fieldNameKey.length() + 10); char[] characters = fieldNameKey.toCharArray(); builder.append( Character.toUpperCase(characters[0]) ); boolean upcaseNextChar = false; for (int i=1; i<characters.length; ++i) { if (characters[i] == '.') { builder.append(' '); upcaseNextChar = true; } else if (Character.isUpperCase(characters[i])) { builder.append(' ').append(characters[i]); upcaseNextChar = false; } else if (upcaseNextChar) { builder.append( Character.toUpperCase(characters[i]) ); upcaseNextChar = false; } else { builder.append(characters[i]); upcaseNextChar = false; } } return builder.toString(); } /** * Looks up the specified key in the error message resource bundle. If the * bundle is missing or if the resource cannot be found, will return null * instead of throwing an exception. * * @param locale the locale in which to lookup the resource * @param key the exact resource key to lookup * @return the resource String or null */ public static String getErrorMessage(Locale locale, String key) { try { Configuration config = StripesFilter.getConfiguration(); ResourceBundle bundle = config.getLocalizationBundleFactory().getErrorMessageBundle(locale); return bundle.getString(key); } catch (MissingResourceException mre) { return null; } } }
[ "myles.steinhauser@gmail.com" ]
myles.steinhauser@gmail.com
0e427d1cb69864390b56cca6a558e0fff3c7fdc5
ac8dc602259604274f957ce596265021a1cc01d3
/app/src/java/entity/Admin.java
c7e5899b83524ba934483c39769577c772d4ca9d
[]
no_license
miaoqiong/Software-Engineering
a869eea9853eba7a1641b6da0be5c2b2827b40bc
f0b7022af0d940658f16b65e76e3f3dee3a54deb
refs/heads/master
2021-01-10T06:33:21.561053
2016-03-05T12:24:56
2016-03-05T12:24:56
53,200,097
0
0
null
null
null
null
UTF-8
Java
false
false
912
java
package entity; /** * Creates an Admin object. The Admin has access to system features such as Bootstrapping * and Uploading of additional data. * */ public class Admin { private String name; private String password; /**This method creates and instantiates a valid Admin object. * * @param name The username of the system administrator. Default is set as "Admin" * @param password The password of the system administrator. */ public Admin(String name, String password){ this.name = name; this.password = password; } /** * Retuns the username of Admin. * @return username of the Admin */ public String getAdminName(){ return name; } /** * Returns the password of Admin * @return password of the Admin */ public String getAdminPassword(){ return password; } }
[ "mq.wang.2014@sis.smu.edu.sg" ]
mq.wang.2014@sis.smu.edu.sg
74913fe6b66e71b955c74efbc9d4825a3ee6449e
11070baa8b7d454fae5e301ca3c2ff3e464079a5
/src/main/java/cn/lezu/consumer/service/ICollectService.java
f55d4e3cdbaa6e1a027d93734600e1a05e09e48f
[]
no_license
immajm/Lezu_consumer_server
028ea10188705b41165766bf2cd1481265f00dba
d6a98ef52c175cd0c7ea04c9ea30b86f04fd1f97
refs/heads/main
2023-04-02T11:41:57.407129
2021-04-07T11:36:40
2021-04-07T11:36:40
355,514,600
0
0
null
null
null
null
UTF-8
Java
false
false
282
java
package cn.lezu.consumer.service; import cn.lezu.consumer.entity.Collect; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; public interface ICollectService extends IService<Collect> { public List<Collect> collectList(Integer consumerId); }
[ "1150095545@qq.com" ]
1150095545@qq.com
5ee6f8d920bab70487af997aff9cfeef05698bf0
17e8438486cb3e3073966ca2c14956d3ba9209ea
/dso/tags/3.5.1/code/base/dso-l2/src/com/tc/l2/msg/ObjectListSyncMessageFactory.java
9bc69452d4e965bbdc51c22cd0be2b26d745d24e
[]
no_license
sirinath/Terracotta
fedfc2c4f0f06c990f94b8b6c3b9c93293334345
00a7662b9cf530dfdb43f2dd821fa559e998c892
refs/heads/master
2021-01-23T05:41:52.414211
2015-07-02T15:21:54
2015-07-02T15:21:54
38,613,711
1
0
null
null
null
null
UTF-8
Java
false
false
1,076
java
/* * All content copyright (c) 2003-2008 Terracotta, Inc., except as may otherwise be noted in a separate copyright * notice. All rights reserved. */ package com.tc.l2.msg; import com.tc.net.groups.GroupMessage; import com.tc.util.State; import java.util.Set; public class ObjectListSyncMessageFactory { public static GroupMessage createObjectListSyncRequestMessage() { return new ObjectListSyncMessage(ObjectListSyncMessage.REQUEST); } public static GroupMessage createObjectListSyncResponseMessage(ObjectListSyncMessage initiatingMsg, State currentState, Set knownIDs, boolean isCleanDB) { return new ObjectListSyncMessage(initiatingMsg.getMessageID(), ObjectListSyncMessage.RESPONSE, currentState, knownIDs, isCleanDB); } public static GroupMessage createObjectListSyncFailedResponseMessage(ObjectListSyncMessage initiatingMsg) { return new ObjectListSyncMessage(initiatingMsg.getMessageID(), ObjectListSyncMessage.FAILED_RESPONSE); } }
[ "hhuynh@7fc7bbf3-cf45-46d4-be06-341739edd864" ]
hhuynh@7fc7bbf3-cf45-46d4-be06-341739edd864
1b23d4450889e82fc15e842f2ce4b98bb1a517b4
bf0b9a876fb5726ebf9736713c35dcac3f90db1c
/src/com/ch/sort/CountSort.java
a28f55b55b98d9e6942494083ca069f2c84486e8
[]
no_license
changechenhao/leetcode
1f315faa83d938527d44a7d7aef0f87f90b594fd
d43c7d97564dd891b7ee5aa4afa924b1340aed3a
refs/heads/master
2020-04-28T10:33:57.360625
2020-01-19T01:52:10
2020-01-19T01:52:10
132,567,788
0
0
null
null
null
null
UTF-8
Java
false
false
1,197
java
package com.ch.sort; /** * @author : chenhao */ public class CountSort{ public void sort(int[] a){ if(a == null){ return; } int arrLength = a.length; int min = a[0]; int max = a[0]; for (int i = 1; i < arrLength; i++){ if(min > a[i]){ min = a[i]; } if(max < a[i]){ max = a[i]; } } int newArrLength = max - min +1; int[] newArr = new int[newArrLength]; for (int i = 0; i < arrLength; i++) { newArr[a[i] - min]++; } for (int i = 1; i < arrLength; i++) { newArr[i] = newArr[i - 1] + newArr[i]; } int[] auxiliary = new int[arrLength]; for (int i = arrLength - 1; i >= 0 ; i--) { int index = newArr[a[i] - min] - 1; auxiliary[index] = a[i]; newArr[a[i] - min]--; } for (int i = 0; i < arrLength; ++i){ a[i] = auxiliary[i]; } } public static void main(String[] args) { int[] a = {1}; System.out.println(a[0]++); System.out.println(a[0]); } }
[ "chenhao@cncloudsec.com" ]
chenhao@cncloudsec.com
edb0b49e6cfa2d931732e41c690c8d81009b830c
66aecd809e488e8fddb90f1760aaf588cb2cd5ba
/OpenGl3DPro1/src/test/java/com/cfox/opengl3dpro1/ExampleUnitTest.java
ddc8fd8375b2f9be3d6bf27ad0a66d7c519befdb
[]
no_license
mm-sgf/OpenGLTmpSimple
0e0c4e70dc05e0308c7e09f1cea1362acb959220
6414d440752e012edd84c6cd0f1e0a0dcbb8264a
refs/heads/master
2023-06-23T15:44:53.767869
2021-07-19T12:42:07
2021-07-19T12:42:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
382
java
package com.cfox.opengl3dpro1; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "cfox.ma@gmail.com" ]
cfox.ma@gmail.com
97af14e73f6f0bfd653693830fa06ecf3d8e23f2
8c3cf6f551f8f0d0cfd401ae57c3e0feb2bdfaf6
/LeetCode/src/Easy/Array/ContainsDuplicate2.java
bedc4f9ed802770f73db64a6352cc778911df30e
[]
no_license
sarishbiswas/Java8-Practice-example-
f4f8e21b4f3f7f1e1a3544ea2c922689d763b384
b7c04fe1e19ff3609b688f69c79a5ac2829f76b7
refs/heads/master
2023-02-06T17:21:28.536228
2020-12-22T07:18:22
2020-12-22T07:18:22
317,182,145
0
0
null
null
null
null
UTF-8
Java
false
false
662
java
package Easy.Array; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; public class ContainsDuplicate2 { public static boolean containsNearbyDuplicate(int[] nums, int k) { Map<Integer,Integer> map = new HashMap<>(); for(int i=0;i<nums.length;i++){ if(map.containsKey(nums[i]) && i-map.get(nums[i])<=k) return true; else{ map.put(nums[i],i); } } return false; } public static void main(String[] args) { int [] arr = {1,2,3,1}; System.out.println(containsNearbyDuplicate(arr,2)); } }
[ "sarishbiswas@gmail.com" ]
sarishbiswas@gmail.com
ee51194270d79ede1cc1d02e664d9d3300be71dc
5cc8a36d4d4b7e35839c522b4e45bbcb343060b5
/List.java
45ab073a97adabeef45505e8af23c99f11ce8874
[]
no_license
sejli/square-matrix-calculator
8bc6232046ee7050953da894ea043971077923fe
8b864600b7dedcc609f8fb223348077f6f73ff95
refs/heads/master
2022-12-23T05:09:08.633363
2020-09-30T04:46:13
2020-09-30T04:46:13
299,807,812
0
0
null
null
null
null
UTF-8
Java
false
false
7,377
java
// Sean Li, sejli, pa3 public class List{ // Fields private Node back; private Node front; private Node cursor; private int length; private int index; // List(): Creates an empty List public List(){ back = null; front = null; cursor = null; index = -1; length = 0; } // Node: private node class private class Node{ Object data; Node prev; Node next; Node(Object x){ data = x; prev = null; next = null; } public String toString(){ return String.valueOf(data); } public boolean equals(Object x){ boolean eq = false; Node that; if(x instanceof Node){ that = (Node) x; eq = (this.data.equals(that.data)); } return eq; } } // length(): Returns the number of elements in this List. public int length(){ return length; } // index(): If cursor is defined, returns the index of the cursor element, // otherwise returns -1 public int index(){ if(cursor != null && length > 0){ int i = 0; Node N = front; while(N != cursor){ i++; N = N.next; } index = i; return i; } index = -1; return -1; } // front(): Returns front element. Pre: length()>0 public Object front(){ if(length == 0){ throw new RuntimeException("List Error: Cannot call front() on empty List"); } return front.data; } // back(): Returns back element. Pre: length()>0 public Object back(){ if(length == 0){ throw new RuntimeException("List Error: Cannot call back() on empty List"); } return back.data; } // get(): Returns cursor element. Pre: length()>0, index()>=0 public Object get(){ if(length == 0){ throw new RuntimeException("List Error: Cannot call get() on empty List"); } if(index < 0){ throw new RuntimeException("List Error: Cannot call get() on an undefined cursor"); } return cursor.data; } // equals(): Returns true if and only if this List and L are the same integer sequence public boolean equals(List x){ boolean eq = false; Node N = this.front; Node M = x.front; eq = (this.length == x.length); while(eq && N != null){ eq = N.equals(M); N = N.next; M = M.next; } return eq; } // clear(): Resets this List to its original empty state. public void clear(){ front = null; back = null; length = 0; } // moveFront(): If List is non-empty, places the cursor under the front element, // otherwise do nothing. public void moveFront(){ if(length > 0){ cursor = front; index = 0; } } // moveBack(): If List is non-empty, places the cursor under the back element, // otherwise does nothing. public void moveBack(){ if(length > 0){ cursor = back; index = length - 1; } } // If cursor is defined and not at front, moves cursor one step toward // front of this List, if cursor is defined and at front, cursor becomes // undefined, if cursor is undefined does nothing. public void movePrev(){ if(index >= 0 && cursor != front){ cursor = cursor.prev; index--; } else if(index >= 0 && cursor == front){ cursor = null; index = -1; } else{ } } // moveNext(): If cursor is defined and not at back, moves cursor one step toward // back of this List, if cursor is defined and at back, cursor becomes // undefined, if cursor is undefined does nothing. public void moveNext(){ if(index >= 0 && index != length - 1){ cursor = cursor.next; index++; } else if(index >= 0 && index == length - 1){ cursor = null; index = -1; } else{ } } // prepend(): // Insert new element into this List. If List is non-empty, // insertion takes place before front element. public void prepend(Object data){ Node N = new Node(data); if(length == 0){ front = back = N; } else{ Node M = front; M.prev = N; N.next = M; front = N; if(index >= 0){ index++; } } length++; } // append(): Insert new element into this List. If List is non-empty, // insertion takes place before front element. public void append(Object data){ Node N = new Node(data); if(length == 0){ front = back = N; } else{ back.next = N; N.prev = back; back = N; } length++; } // insertBefore(): Insert new element before cursor. // Pre: length()>0, index()>=0 public void insertBefore(Object data){ if(length == 0){ throw new RuntimeException("List Error: Cannot call insertBefore() on empty List"); } if(index < 0){ throw new RuntimeException("List Error: Cannot call insertBefore() on undefined cursor"); } if(cursor == front){ this.prepend(data); index++; } else{ Node N = new Node(data); Node M = cursor.prev; M.next = N; N.prev = M; N.next = cursor; cursor.prev = N; index++; length++; } } // insertAfter(): Inserts new element after cursor. // Pre: length()>0, index()>=0 public void insertAfter(Object data){ if(length == 0){ throw new RuntimeException("List Error: Cannot call insertAfter() on empty List"); } if(index < 0){ throw new RuntimeException("List Error: Cannot call insertAfter() on undefined cursor"); } if(cursor == back){ this.append(data); } else{ Node N = new Node(data); Node M = cursor.next; N.next = M; cursor.next = N; N.prev = cursor; M.prev = N; length++; } } // deleteFront(): Deletes the front element. Pre: length()>0 public void deleteFront(){ if(length == 0){ throw new RuntimeException("List Error: Cannot call deleteFront() on empty List"); } if(cursor == front){ front = front.next; front.prev = null; cursor = null; index = -1; } else if(length == 1){ cursor = null; index = -1; front = back = null; } else if(cursor != front && length > 1){ front = front.next; front.prev = null; index--; } length--; } // deleteBack(): Deletes the back element. Pre: length()>0 public void deleteBack(){ if(length == 0){ throw new RuntimeException("List Error: Cannot call deleteBack() on empty List"); } if(cursor == back){ cursor = null; back = back.prev; back.next = null; index = -1; } else if(length == 1){ cursor = null; index = -1; front = back = null; } else if(cursor != back){ back = back.prev; back.next = null; } length--; } // delete(): Deletes cursor element, making cursor undefined. // Pre: length()>0, index()>=0 public void delete(){ if(length == 0){ throw new RuntimeException("List Error: Cannot call delete() on empty List"); } if(index < 0){ throw new RuntimeException("List Error: Cannot call delete() on undefined cursor"); } if(cursor == front && length > 1){ front = cursor.next; cursor = null; index = -1; } else if(cursor == back && length > 1){ back = cursor.prev; cursor = null; index = -1; } else if(cursor != front && cursor != back && length > 1){ cursor.prev.next = cursor.next; cursor = null; index = -1; } else{ front = back = null; cursor = null; index = -1; } length--; } // Overrides Object's toString method. Returns a String // representation of this List consisting of a space // separated sequence of integers, with front on left. public String toString(){ StringBuffer sb = new StringBuffer(); Node N = front; while(N != null){ sb.append(N.toString()); sb.append(" "); N = N.next; } String s = sb.toString(); return s; } }
[ "sejli@ucsc.edu" ]
sejli@ucsc.edu
7f0df71f649ed22c1c18b20f03914addf36b10d2
166f267e6c7d06a7f9343d79f94ac475ce2862c2
/src/com/wang/ExceptionTest.java
d62e20241f0649bcb3e54c9673376a63bc8407ad
[]
no_license
theSnowBoy/FlowDroidCG
cc995ae0005de9105d1a0b5cadb678eacf10e112
8aea98f36e3db4a1f3cdf08668923b0cf5548db9
refs/heads/master
2021-01-13T16:58:32.450296
2016-12-26T11:38:46
2016-12-26T11:38:46
77,379,771
0
0
null
2016-12-26T11:31:44
2016-12-26T11:31:44
null
UTF-8
Java
false
false
262
java
public class ExceptionTest { public static void main(String[] args) { // TODO Auto-generated method stub } public static void C(int data){ try { if (data > 0 ){ }else{ throw new Exception(); } }catch(Exception e){ } } }
[ "415249614@qq.com" ]
415249614@qq.com
ac4c3825ebb442635ae9e8d7c61a18aee37849dc
3c0ddbf2d6eeb6cfc829f10e946ef051dbfe5dc2
/microservicecloud/microservicecloud-config-eureka-client-7001/src/main/java/com/rym/springcloud/Config_Git_EurekaServerApplication.java
8dc5353322dc8f51bbd99d00ba1de67e9232bfcf
[]
no_license
MingGe666/microservicecloud-config
e8b7a482e8bba619254512752a4e1666b9fbc9fb
f7ac3fb3d6fbb44d4f3059f21b38eb18e0ae4784
refs/heads/master
2022-06-21T18:56:00.226645
2019-11-04T09:04:11
2019-11-04T09:04:11
219,252,912
0
0
null
2022-06-21T04:06:35
2019-11-03T04:48:26
Java
UTF-8
Java
false
false
444
java
package com.rym.springcloud; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @SpringBootApplication @EnableEurekaServer public class Config_Git_EurekaServerApplication { public static void main(String[] args) { SpringApplication.run(Config_Git_EurekaServerApplication.class,args); } }
[ "359441404@qq.com" ]
359441404@qq.com
6f3ea5cc6e60974d3693ab7bc40c3a6dd8c2b2cd
ce0f733bf2924a060a8a669c33cb54bfe9717f95
/nbt-exp/src/main/java/com/purplefrog/minecraftExplorer/WindowShape.java
72c9f0331a594f2519f7d2b5c00c62061b10d0e7
[]
no_license
mutantbob/minecraft-block-hack
2648d8352f56fc057ec0218f008114c9957c9b3e
a4579761cef6138bbefecec345b6caf6db63c113
refs/heads/master
2021-01-23T16:35:15.313574
2014-12-05T17:13:53
2014-12-05T17:13:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,423
java
package com.purplefrog.minecraftExplorer; /** * Created with IntelliJ IDEA. * User: thoth * Date: 10/15/13 * Time: 11:17 AM * To change this template use File | Settings | File Templates. */ public class WindowShape { public final int cellWidth; public final BlockPlusData[] blocks; public WindowShape(int cellWidth, Object[] blocks) { this.blocks = new BlockPlusData[blocks.length]; for (int i = 0; i < blocks.length; i++) { Object block_ = blocks[i]; if (block_ instanceof BlockPlusData) { this.blocks[i] = (BlockPlusData) block_; } else { this.blocks[i] = new BlockPlusData((Integer)block_, 0); } } this.cellWidth = cellWidth; if (blocks.length != (cellWidth -1)* height()) throw new IllegalArgumentException("blocks.length=" +blocks.length+ " is not an even multiple of "+(cellWidth-1)); } public WindowShape(int cellWidth, int... blocks) { this.cellWidth = cellWidth; this.blocks = new BlockPlusData[blocks.length]; for (int i = 0; i < blocks.length; i++) { this.blocks[i] = new BlockPlusData(blocks[i], 0); } } public int height() { return blocks.length / (cellWidth-1); } public BlockPlusData getBlock(int u, int v) { return blocks[u + v*(cellWidth-1)]; } }
[ "git@thoth.purplefrog.com" ]
git@thoth.purplefrog.com
d5dc121e5a1a1c5f1957d424a8a3c28c35bb1733
32d884b46cf81c2677648e7b3af3ba4621ea6901
/app/src/main/java/challenge/community/farmmart/RecyclerAdapter.java
1fd1dfe08316264c9c8efcffd65431d42c997493
[]
no_license
maghassan/Farmmart
f15ff5690da0fa9b7d497f1699fc25946eebb268
51f6e9b2a9d72a3bd7cf86a98b16600f83b6efed
refs/heads/master
2020-03-21T10:14:54.152337
2018-10-18T13:06:17
2018-10-18T13:06:17
138,440,552
1
0
null
2018-10-18T13:10:22
2018-06-23T23:39:27
Java
UTF-8
Java
false
false
12,924
java
package challenge.community.farmmart; import android.content.Context; import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; import com.google.android.gms.tasks.OnSuccessListener; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.firestore.DocumentSnapshot; import com.google.firebase.firestore.EventListener; import com.google.firebase.firestore.FieldValue; import com.google.firebase.firestore.FirebaseFirestore; import com.google.firebase.firestore.FirebaseFirestoreException; import com.google.firebase.firestore.QuerySnapshot; import java.util.HashMap; import java.util.List; import java.util.Map; import de.hdodenhof.circleimageview.CircleImageView; public class RecyclerAdapter extends RecyclerView.Adapter<RecyclerAdapter.ViewHolder> { public List<DataModel> blog_list; public List<User> user_list; public Context context; private FirebaseFirestore firebaseFirestore; private FirebaseAuth firebaseAuth; public RecyclerAdapter(List<DataModel> blog_list, List<User> user_list) { this.blog_list = blog_list; this.user_list = user_list; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.blog_list_item, parent, false); context = parent.getContext(); firebaseFirestore = FirebaseFirestore.getInstance(); firebaseAuth = FirebaseAuth.getInstance(); return new ViewHolder(view); } @Override public void onBindViewHolder(@NonNull final ViewHolder holder, final int position) { holder.setIsRecyclable(false); final String blogPostId = blog_list.get(position).BlogPostId; final String currentUserId = firebaseAuth.getCurrentUser().getUid(); String post_Title = blog_list.get(position).getPost_title(); holder.setITitle(post_Title); String postPrice = blog_list.get(position).getPost_price(); holder.setPrice(postPrice); String post_Content = blog_list.get(position).getPost_content(); holder.setContent(post_Content); final String image_url = blog_list.get(position).getImage_thumb(); holder.setBlogImage(image_url); final String blog_user_id = blog_list.get(position).getUser_id(); /*if (blog_user_id.equals(currentUserId)) { holder.deletePost.setEnabled(true); holder.deletePost.setVisibility(View.VISIBLE); }*/ String userName = user_list.get(position).getName(); final String userImage = user_list.get(position).getImage(); String userContact = user_list.get(position).getContact(); String userAddress = user_list.get(position).getAddress(); holder.setUserData(userName, userImage); /*try { long millisecond = blog_list.get(position).getTime_stamp().getTime(); String dateString = android.text.format.DateFormat.format("MM/dd/yyyy", new Date(millisecond)).toString(); holder.setTime(dateString); } catch (Exception e) { //Toast.makeText(context, "Exception : " + e.getMessage(), Toast.LENGTH_SHORT).show(); }*/ try { GetTimeAgo getTimeAgo = new GetTimeAgo(); long postTime = blog_list.get(position).getTime_stamp().getTime(); String timeAgo = getTimeAgo.getTimeAgo(postTime, context); holder.setTime(timeAgo); } catch (Exception e) { //Toast.makeText(context, "Exception : " + e.getMessage(), Toast.LENGTH_SHORT).show(); } firebaseFirestore.collection("Posts/" + blogPostId + "/Comments").addSnapshotListener(new EventListener<QuerySnapshot>() { @Override public void onEvent(QuerySnapshot documentSnapshots, FirebaseFirestoreException e) { if (!documentSnapshots.isEmpty()) { int count = documentSnapshots.size(); holder.updateCommentCount(count); } else { holder.updateCommentCount(0); } } }); firebaseFirestore.collection("Posts/" + blogPostId + "/likes").addSnapshotListener(new EventListener<QuerySnapshot>() { @Override public void onEvent(QuerySnapshot documentSnapshots, FirebaseFirestoreException e) { if (!documentSnapshots.isEmpty()) { int count = documentSnapshots.size(); holder.updateLikesCount(count); } else { holder.updateLikesCount(0); } } }); firebaseFirestore.collection("Posts/" + blogPostId + "/likes").document(currentUserId) .addSnapshotListener(new EventListener<DocumentSnapshot>() { @Override public void onEvent(DocumentSnapshot documentSnapshot, FirebaseFirestoreException e) { if (documentSnapshot.exists()) { holder.blogLikeBtn.setImageDrawable(context.getDrawable(R.mipmap.action_like_red)); } else { holder.blogLikeBtn.setImageDrawable(context.getDrawable(R.mipmap.action_like_grey)); } } }); holder.blogLikeBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { firebaseFirestore.collection("Posts/" + blogPostId + "/likes").document(currentUserId) .get() .addOnSuccessListener(new OnSuccessListener<DocumentSnapshot>() { @Override public void onSuccess(DocumentSnapshot documentSnapshot) { if (!documentSnapshot.exists()) { Map<String, Object> likesMap = new HashMap<>(); likesMap.put("likes_time", FieldValue.serverTimestamp()); firebaseFirestore.collection("Posts/" + blogPostId + "/likes").document(currentUserId).set(likesMap); } else { firebaseFirestore.collection("Posts/" + blogPostId + "/likes").document(currentUserId).delete(); } } }); } }); holder.blogCommentBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent commentIntent = new Intent(context, CommentsActivity.class); commentIntent.putExtra("blog_post_id", blogPostId); context.startActivity(commentIntent); } }); holder.buyProducts.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String title = holder.titleView.getText().toString(); String price = holder.priceView.getText().toString(); String postId = blog_user_id.toString(); String contact = user_list.get(position).contact; Intent buyProducts = new Intent(context, BuyProducts.class); buyProducts.putExtra("blog_post_id", blogPostId); buyProducts.putExtra("title", title); buyProducts.putExtra("price", price); buyProducts.putExtra("postId", postId); buyProducts.putExtra("contact", contact); context.startActivity(buyProducts); } }); /*holder.deletePost.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { firebaseFirestore.collection("Posts").document(blogPostId).delete().addOnSuccessListener(new OnSuccessListener<Void>() { @Override public void onSuccess(Void aVoid) { blog_list.remove(position); user_list.remove(position); Toast.makeText(context, "Post Deleted", Toast.LENGTH_SHORT).show(); } }); } });*/ holder.mainBlogCard.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String title = holder.titleView.getText().toString(); String content = holder.contentView.getText().toString(); //String time = holder.blogDate.getText().toString(); String username = holder.blogUserName.getText().toString(); String postId = blog_user_id.toString(); String image = image_url.toString(); String user_image = userImage.toString(); Intent viewPost = new Intent(v.getContext(), ViewPost.class); viewPost.putExtra("title", title); viewPost.putExtra("content", content); //viewPost.putExtra("time", time); viewPost.putExtra("username", username); viewPost.putExtra("postId", postId); viewPost.putExtra("image", image); viewPost.putExtra("user_image", user_image); v.getContext().startActivity(viewPost); } }); } @Override public int getItemCount() { return blog_list.size(); } public class ViewHolder extends RecyclerView.ViewHolder { private View mView; private TextView titleView; private TextView contentView; private TextView priceView; private ImageView blogPostImage; private TextView blogDate; private TextView blogUserName; private CircleImageView blogUserImage; private ImageView blogLikeBtn; private TextView blogLikeCount; private ImageView blogCommentBtn; private TextView blogCommentCount; private ImageView buyProducts; private ImageView deletePost; private CardView mainBlogCard; public ViewHolder(View itemView) { super(itemView); mView = itemView; blogPostImage = mView.findViewById(R.id.blogPostImage); blogLikeBtn = mView.findViewById(R.id.likeBtn); blogCommentBtn = mView.findViewById(R.id.blog_comment_icon); //deletePost = mView.findViewById(R.id.deletePost); buyProducts = mView.findViewById(R.id.buyProduct); mainBlogCard = mView.findViewById(R.id.mainBlogPost); } public void setITitle(String postTitle) { titleView = mView.findViewById(R.id.postTitle); titleView.setText(postTitle); } public void setContent(String postContent) { contentView = mView.findViewById(R.id.postContent); contentView.setText(postContent); } public void setPrice(String postPrice) { priceView = mView.findViewById(R.id.postPrice); priceView.setText(postPrice); } public void setBlogImage(String downloadUri){ blogPostImage = mView.findViewById(R.id.blogPostImage); Glide.with(context).load(downloadUri).into(blogPostImage); } public void setTime(String date) { blogDate = mView.findViewById(R.id.postDate); blogDate.setText(date); } public void setUserData(String name, String image) { blogUserName = mView.findViewById(R.id.username); blogUserImage = mView.findViewById(R.id.profileImage); blogUserName.setText(name); RequestOptions requestOptions = new RequestOptions(); //requestOptions.placeholder(R.drawable.profile_placeholder); Glide.with(context).applyDefaultRequestOptions(requestOptions).load(image).into(blogUserImage); } public void updateLikesCount (int count){ blogLikeCount = mView.findViewById(R.id.likeCount); blogLikeCount.setText(count + " Likes"); } public void updateCommentCount (int countComment) { blogCommentCount = mView.findViewById(R.id.blog_comment_count); blogCommentCount.setText(countComment + " Comments"); } } }
[ "elminu80@gmail.com" ]
elminu80@gmail.com
c40df36d9939ad41fe373895afa4ae2b1ebf6c0a
a15cfcd607ff3aa396640588f38cb1fc38327c95
/app/src/main/java/me/imli/newme/okhttp/callback/FileCallBack.java
e2fabdf5a9f5af03daedb2c99435354997dc521f
[ "Apache-2.0" ]
permissive
bryant1410/NewsMe
8c4b7e8e33986f05745a5c3a55d1ebb560fe805b
aa373f3005549215533a7aab4589f74bad1ffb2d
refs/heads/master
2021-01-19T19:48:17.016354
2017-04-16T23:22:49
2017-04-16T23:22:49
88,448,628
0
0
null
2017-04-16T23:22:50
2017-04-16T23:22:50
null
UTF-8
Java
false
false
2,372
java
package me.imli.newme.okhttp.callback; import com.squareup.okhttp.Response; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import me.imli.newme.okhttp.OkHttpUtils; import me.imli.newme.okhttp.utils.L; /** * Created by zhy on 15/12/15. */ public abstract class FileCallBack extends Callback<File> { /** * 目标文件存储的文件夹路径 */ private String destFileDir; /** * 目标文件存储的文件名 */ private String destFileName; public abstract void inProgress(float progress); public FileCallBack(String destFileDir, String destFileName) { this.destFileDir = destFileDir; this.destFileName = destFileName; } @Override public File parseNetworkResponse(Response response) throws IOException { return saveFile(response); } public File saveFile(Response response) throws IOException { InputStream is = null; byte[] buf = new byte[2048]; int len = 0; FileOutputStream fos = null; try { is = response.body().byteStream(); final long total = response.body().contentLength(); long sum = 0; L.e(total + ""); File dir = new File(destFileDir); if (!dir.exists()) { dir.mkdirs(); } File file = new File(dir, destFileName); fos = new FileOutputStream(file); while ((len = is.read(buf)) != -1) { sum += len; fos.write(buf, 0, len); final long finalSum = sum; OkHttpUtils.getInstance().getDelivery().post(new Runnable() { @Override public void run() { inProgress(finalSum * 1.0f / total); } }); } fos.flush(); return file; } finally { try { if (is != null) is.close(); } catch (IOException e) { } try { if (fos != null) fos.close(); } catch (IOException e) { } } } }
[ "liz3002@126.com" ]
liz3002@126.com
a95ab6b85acb3aa20e66ae965313b2d30ce5fe8a
7a833ea2de21724467625b350acbc053f98e0686
/src/main/java/com/duongvietanh/dao/ProductRelatedDAO.java
717831b11a9fdf24e6b7bc8f467deb98cb3b4c4a
[]
no_license
VieEng121419/AshionJavaHibernate
62b1c2ef175a9e7e7d7f667378e867eaad54f54a
32521f7f6c89a6b35b06b0e94d33bbbcb1ef6316
refs/heads/main
2023-03-30T08:30:31.357929
2021-04-05T11:21:19
2021-04-05T11:21:19
354,808,065
0
0
null
null
null
null
UTF-8
Java
false
false
231
java
package com.duongvietanh.dao; import java.util.List; import com.duongvietanh.model.Product; import com.duongvietanh.model.ProductRelated; public interface ProductRelatedDAO { public List<Product> listProductRelated(int id); }
[ "vietanh1419@gmail.com" ]
vietanh1419@gmail.com
4757eb1b0504639a09da0a025912a84d739c3651
c92dac7961f3cd57c6a3993d5fc09547f246b2e7
/src/main/java/com/cfl/comment/LayUIPageBean.java
3e3ede04545f507d756d523382fc6d58ccb014e6
[]
no_license
NDCFL/LayUIModule
eee21ffc1055521cca696e5a6fdde40afca5d91d
7aa95471991c506a4850dfb4aeecba99f364af77
refs/heads/master
2021-09-01T22:58:35.917626
2017-12-29T02:48:20
2017-12-29T02:48:20
115,504,232
0
1
null
null
null
null
UTF-8
Java
false
false
1,085
java
package com.cfl.comment; import java.util.List; public class LayUIPageBean<T> { private int code ; private String msg; private long count; private Integer page; private Integer limit; private List<T> data; public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public long getCount() { return count; } public void setCount(long count) { this.count = count; } public List<T> getData() { return data; } public void setData(List<T> data) { this.data = data; } public Integer getPage() { return page; } public void setPage(Integer page) { this.page = page; } public Integer getLimit() { return limit; } public void setLimit(Integer limit) { this.limit = limit; } public int getStartIndex(){ return (page-1)*limit; } }
[ "275300091@qq.com" ]
275300091@qq.com