blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
46de87d765a17689be59bf2ee56fae65b29550fc
359bad61781b8eadcba0abd4f5aa48847ed03dd0
/src/main/java/com/springtrader/Config.java
d5946dc07c81e1d856fc27a02f7e66026f021700
[]
no_license
DustinVK/SpringTrader
bd15a0e73e94a523bf901a89cbba022cb84533db
41baa42936810e830c8ffea0317b7b03027c4186
refs/heads/master
2023-04-11T19:34:17.166055
2021-05-09T02:10:45
2021-05-09T02:10:45
360,707,314
0
0
null
null
null
null
UTF-8
Java
false
false
1,733
java
package com.springtrader; import javax.sql.DataSource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.web.client.RestTemplate; import com.springtrader.model.external.search.AlphaVantageSearch; import com.springtrader.model.external.search.ISearch; import com.springtrader.service.StockService; import com.springtrader.service.SearchService; @Configuration @ComponentScan public class Config { @Bean public static DataSource dataSource() { return new EmbeddedDatabaseBuilder() .setType(EmbeddedDatabaseType.H2) .addScript("classpath:jdbc/schema.sql") .addScript("classpath:jdbc/test-data.sql").build(); } @Bean public RestTemplate getRestTemplate() { return new RestTemplate(); } @Bean public SearchService getSearchService() { return new SearchService(); } @Bean public StockService getStockService() { return new StockService(); } @Bean public PasswordEncoder getPasswordEncoder() { return new BCryptPasswordEncoder(); //return NoOpPasswordEncoder.getInstance(); // plain text 'encoder' for testing } @Bean public ISearch getAlphaSearchDAO() { return new AlphaVantageSearch(); } // For tests // @Bean // public AlphaVantageStockDAO getAlphaStockDAO() { // return new AlphaVantageStockDAO(); // } }
85bdefb7cd9ea54957caa668c002aa2683860918
ce74a1ae96be89fa47f2888ad21844f98b4525a2
/Troco/src/Troco.java
bfae43eddb1a88191589d6e12b64e490dd93f68c
[]
no_license
julio16j/JavaProjetos
b625480316fb91b161c4a36d4c5e324344bdc5b2
030c4ed55dd8f5d3ec8099e7f04c6c2bcdb8882e
refs/heads/master
2021-07-17T08:54:16.406083
2019-10-29T04:06:43
2019-10-29T04:06:43
217,209,365
0
0
null
null
null
null
UTF-8
Java
false
false
2,238
java
public class Troco { int valor; public Troco(int valor) { this.valor = valor; } public static void main(String args[]) { Troco troca; troca = new Troco(777); //cria um objeto da classe System.out.println("\nCedulas de 100: " + troca.getCedulas100()); System.out.println("\nCedulas de 50: " + troca.getCedulas50()); System.out.println("\nCedulas de 20: " + troca.getCedulas20()); System.out.println("\nCedulas de 10: " + troca.getCedulas10()); System.out.println("\nCedulas de 5: " + troca.getCedulas5()); System.out.println("\nCedulas de 2: " + troca.getCedulas2()); } public int getCedulas100(){ int numcedulas; for(numcedulas = 0 ; valor > numcedulas *100 ; numcedulas++){ } if(valor != numcedulas * 2 ) numcedulas--; valor = (valor - (100*numcedulas)); return numcedulas; } public int getCedulas50(){ int numcedulas; for(numcedulas = 0 ; valor > numcedulas *50 ; numcedulas++){ } if(valor != numcedulas * 2 ) numcedulas--; valor = (valor - (50*numcedulas)); return numcedulas; } public int getCedulas20(){ int numcedulas; for(numcedulas = 0 ; valor > numcedulas *20 ; numcedulas++){ } if(valor != numcedulas * 2 ) numcedulas--; valor = (valor - (20*numcedulas)); return numcedulas; } public int getCedulas10(){ int numcedulas; for(numcedulas = 0 ; valor > numcedulas *10 ; numcedulas++){ } if(valor != numcedulas * 2 ) numcedulas--; valor = (valor - (10*numcedulas)); return numcedulas; } public int getCedulas5(){ int numcedulas; for(numcedulas = 0 ; valor > numcedulas *5 ; numcedulas++){ } if(valor != numcedulas * 2 ) numcedulas--; valor = (valor - (5*numcedulas)); return numcedulas; }public int getCedulas2(){ int numcedulas; for(numcedulas = 0 ; valor > numcedulas *2 ; numcedulas++){ } if(valor != numcedulas * 2 ) numcedulas--; valor = (valor - (2*numcedulas)); return numcedulas; } }
0cff46e64cd5021c5c54aa809959a731a3196430
470974bc45a8ab5ff6d69e13c97c0c73f07a1a36
/src/main/java/com/chk/pd/fpd/domain/FpdSeriesExample.java
ec7d2c81f031be5ae967f11dd20ac21889b75128
[]
no_license
winner66/pd
855f9ed29b37131614420eae9adf3229ee4180ec
88f50c8c4394cb2adfbd89b7bf67c4f87902c587
refs/heads/main
2023-02-25T11:00:25.374152
2021-02-03T03:10:41
2021-02-03T03:10:41
318,452,262
0
0
null
null
null
null
UTF-8
Java
false
false
32,687
java
package com.chk.pd.fpd.domain; import java.util.ArrayList; import java.util.List; public class FpdSeriesExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public FpdSeriesExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andIdIsNull() { addCriterion("Id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("Id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Integer value) { addCriterion("Id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Integer value) { addCriterion("Id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Integer value) { addCriterion("Id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Integer value) { addCriterion("Id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Integer value) { addCriterion("Id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Integer value) { addCriterion("Id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Integer> values) { addCriterion("Id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Integer> values) { addCriterion("Id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Integer value1, Integer value2) { addCriterion("Id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Integer value1, Integer value2) { addCriterion("Id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andFFactorysIsNull() { addCriterion("F_factorys is null"); return (Criteria) this; } public Criteria andFFactorysIsNotNull() { addCriterion("F_factorys is not null"); return (Criteria) this; } public Criteria andFFactorysEqualTo(String value) { addCriterion("F_factorys =", value, "fFactorys"); return (Criteria) this; } public Criteria andFFactorysNotEqualTo(String value) { addCriterion("F_factorys <>", value, "fFactorys"); return (Criteria) this; } public Criteria andFFactorysGreaterThan(String value) { addCriterion("F_factorys >", value, "fFactorys"); return (Criteria) this; } public Criteria andFFactorysGreaterThanOrEqualTo(String value) { addCriterion("F_factorys >=", value, "fFactorys"); return (Criteria) this; } public Criteria andFFactorysLessThan(String value) { addCriterion("F_factorys <", value, "fFactorys"); return (Criteria) this; } public Criteria andFFactorysLessThanOrEqualTo(String value) { addCriterion("F_factorys <=", value, "fFactorys"); return (Criteria) this; } public Criteria andFFactorysLike(String value) { addCriterion("F_factorys like", value, "fFactorys"); return (Criteria) this; } public Criteria andFFactorysNotLike(String value) { addCriterion("F_factorys not like", value, "fFactorys"); return (Criteria) this; } public Criteria andFFactorysIn(List<String> values) { addCriterion("F_factorys in", values, "fFactorys"); return (Criteria) this; } public Criteria andFFactorysNotIn(List<String> values) { addCriterion("F_factorys not in", values, "fFactorys"); return (Criteria) this; } public Criteria andFFactorysBetween(String value1, String value2) { addCriterion("F_factorys between", value1, value2, "fFactorys"); return (Criteria) this; } public Criteria andFFactorysNotBetween(String value1, String value2) { addCriterion("F_factorys not between", value1, value2, "fFactorys"); return (Criteria) this; } public Criteria andFSeriesIsNull() { addCriterion("F_series is null"); return (Criteria) this; } public Criteria andFSeriesIsNotNull() { addCriterion("F_series is not null"); return (Criteria) this; } public Criteria andFSeriesEqualTo(String value) { addCriterion("F_series =", value, "fSeries"); return (Criteria) this; } public Criteria andFSeriesNotEqualTo(String value) { addCriterion("F_series <>", value, "fSeries"); return (Criteria) this; } public Criteria andFSeriesGreaterThan(String value) { addCriterion("F_series >", value, "fSeries"); return (Criteria) this; } public Criteria andFSeriesGreaterThanOrEqualTo(String value) { addCriterion("F_series >=", value, "fSeries"); return (Criteria) this; } public Criteria andFSeriesLessThan(String value) { addCriterion("F_series <", value, "fSeries"); return (Criteria) this; } public Criteria andFSeriesLessThanOrEqualTo(String value) { addCriterion("F_series <=", value, "fSeries"); return (Criteria) this; } public Criteria andFSeriesLike(String value) { addCriterion("F_series like", value, "fSeries"); return (Criteria) this; } public Criteria andFSeriesNotLike(String value) { addCriterion("F_series not like", value, "fSeries"); return (Criteria) this; } public Criteria andFSeriesIn(List<String> values) { addCriterion("F_series in", values, "fSeries"); return (Criteria) this; } public Criteria andFSeriesNotIn(List<String> values) { addCriterion("F_series not in", values, "fSeries"); return (Criteria) this; } public Criteria andFSeriesBetween(String value1, String value2) { addCriterion("F_series between", value1, value2, "fSeries"); return (Criteria) this; } public Criteria andFSeriesNotBetween(String value1, String value2) { addCriterion("F_series not between", value1, value2, "fSeries"); return (Criteria) this; } public Criteria andHkSeriesIsNull() { addCriterion("HK_series is null"); return (Criteria) this; } public Criteria andHkSeriesIsNotNull() { addCriterion("HK_series is not null"); return (Criteria) this; } public Criteria andHkSeriesEqualTo(String value) { addCriterion("HK_series =", value, "hkSeries"); return (Criteria) this; } public Criteria andHkSeriesNotEqualTo(String value) { addCriterion("HK_series <>", value, "hkSeries"); return (Criteria) this; } public Criteria andHkSeriesGreaterThan(String value) { addCriterion("HK_series >", value, "hkSeries"); return (Criteria) this; } public Criteria andHkSeriesGreaterThanOrEqualTo(String value) { addCriterion("HK_series >=", value, "hkSeries"); return (Criteria) this; } public Criteria andHkSeriesLessThan(String value) { addCriterion("HK_series <", value, "hkSeries"); return (Criteria) this; } public Criteria andHkSeriesLessThanOrEqualTo(String value) { addCriterion("HK_series <=", value, "hkSeries"); return (Criteria) this; } public Criteria andHkSeriesLike(String value) { addCriterion("HK_series like", value, "hkSeries"); return (Criteria) this; } public Criteria andHkSeriesNotLike(String value) { addCriterion("HK_series not like", value, "hkSeries"); return (Criteria) this; } public Criteria andHkSeriesIn(List<String> values) { addCriterion("HK_series in", values, "hkSeries"); return (Criteria) this; } public Criteria andHkSeriesNotIn(List<String> values) { addCriterion("HK_series not in", values, "hkSeries"); return (Criteria) this; } public Criteria andHkSeriesBetween(String value1, String value2) { addCriterion("HK_series between", value1, value2, "hkSeries"); return (Criteria) this; } public Criteria andHkSeriesNotBetween(String value1, String value2) { addCriterion("HK_series not between", value1, value2, "hkSeries"); return (Criteria) this; } public Criteria andSizeIsNull() { addCriterion("size is null"); return (Criteria) this; } public Criteria andSizeIsNotNull() { addCriterion("size is not null"); return (Criteria) this; } public Criteria andSizeEqualTo(String value) { addCriterion("size =", value, "size"); return (Criteria) this; } public Criteria andSizeNotEqualTo(String value) { addCriterion("size <>", value, "size"); return (Criteria) this; } public Criteria andSizeGreaterThan(String value) { addCriterion("size >", value, "size"); return (Criteria) this; } public Criteria andSizeGreaterThanOrEqualTo(String value) { addCriterion("size >=", value, "size"); return (Criteria) this; } public Criteria andSizeLessThan(String value) { addCriterion("size <", value, "size"); return (Criteria) this; } public Criteria andSizeLessThanOrEqualTo(String value) { addCriterion("size <=", value, "size"); return (Criteria) this; } public Criteria andSizeLike(String value) { addCriterion("size like", value, "size"); return (Criteria) this; } public Criteria andSizeNotLike(String value) { addCriterion("size not like", value, "size"); return (Criteria) this; } public Criteria andSizeIn(List<String> values) { addCriterion("size in", values, "size"); return (Criteria) this; } public Criteria andSizeNotIn(List<String> values) { addCriterion("size not in", values, "size"); return (Criteria) this; } public Criteria andSizeBetween(String value1, String value2) { addCriterion("size between", value1, value2, "size"); return (Criteria) this; } public Criteria andSizeNotBetween(String value1, String value2) { addCriterion("size not between", value1, value2, "size"); return (Criteria) this; } public Criteria andTemperatureIsNull() { addCriterion("temperature is null"); return (Criteria) this; } public Criteria andTemperatureIsNotNull() { addCriterion("temperature is not null"); return (Criteria) this; } public Criteria andTemperatureEqualTo(String value) { addCriterion("temperature =", value, "temperature"); return (Criteria) this; } public Criteria andTemperatureNotEqualTo(String value) { addCriterion("temperature <>", value, "temperature"); return (Criteria) this; } public Criteria andTemperatureGreaterThan(String value) { addCriterion("temperature >", value, "temperature"); return (Criteria) this; } public Criteria andTemperatureGreaterThanOrEqualTo(String value) { addCriterion("temperature >=", value, "temperature"); return (Criteria) this; } public Criteria andTemperatureLessThan(String value) { addCriterion("temperature <", value, "temperature"); return (Criteria) this; } public Criteria andTemperatureLessThanOrEqualTo(String value) { addCriterion("temperature <=", value, "temperature"); return (Criteria) this; } public Criteria andTemperatureLike(String value) { addCriterion("temperature like", value, "temperature"); return (Criteria) this; } public Criteria andTemperatureNotLike(String value) { addCriterion("temperature not like", value, "temperature"); return (Criteria) this; } public Criteria andTemperatureIn(List<String> values) { addCriterion("temperature in", values, "temperature"); return (Criteria) this; } public Criteria andTemperatureNotIn(List<String> values) { addCriterion("temperature not in", values, "temperature"); return (Criteria) this; } public Criteria andTemperatureBetween(String value1, String value2) { addCriterion("temperature between", value1, value2, "temperature"); return (Criteria) this; } public Criteria andTemperatureNotBetween(String value1, String value2) { addCriterion("temperature not between", value1, value2, "temperature"); return (Criteria) this; } public Criteria andVoltageIsNull() { addCriterion("voltage is null"); return (Criteria) this; } public Criteria andVoltageIsNotNull() { addCriterion("voltage is not null"); return (Criteria) this; } public Criteria andVoltageEqualTo(String value) { addCriterion("voltage =", value, "voltage"); return (Criteria) this; } public Criteria andVoltageNotEqualTo(String value) { addCriterion("voltage <>", value, "voltage"); return (Criteria) this; } public Criteria andVoltageGreaterThan(String value) { addCriterion("voltage >", value, "voltage"); return (Criteria) this; } public Criteria andVoltageGreaterThanOrEqualTo(String value) { addCriterion("voltage >=", value, "voltage"); return (Criteria) this; } public Criteria andVoltageLessThan(String value) { addCriterion("voltage <", value, "voltage"); return (Criteria) this; } public Criteria andVoltageLessThanOrEqualTo(String value) { addCriterion("voltage <=", value, "voltage"); return (Criteria) this; } public Criteria andVoltageLike(String value) { addCriterion("voltage like", value, "voltage"); return (Criteria) this; } public Criteria andVoltageNotLike(String value) { addCriterion("voltage not like", value, "voltage"); return (Criteria) this; } public Criteria andVoltageIn(List<String> values) { addCriterion("voltage in", values, "voltage"); return (Criteria) this; } public Criteria andVoltageNotIn(List<String> values) { addCriterion("voltage not in", values, "voltage"); return (Criteria) this; } public Criteria andVoltageBetween(String value1, String value2) { addCriterion("voltage between", value1, value2, "voltage"); return (Criteria) this; } public Criteria andVoltageNotBetween(String value1, String value2) { addCriterion("voltage not between", value1, value2, "voltage"); return (Criteria) this; } public Criteria andOutletIsNull() { addCriterion("outlet is null"); return (Criteria) this; } public Criteria andOutletIsNotNull() { addCriterion("outlet is not null"); return (Criteria) this; } public Criteria andOutletEqualTo(String value) { addCriterion("outlet =", value, "outlet"); return (Criteria) this; } public Criteria andOutletNotEqualTo(String value) { addCriterion("outlet <>", value, "outlet"); return (Criteria) this; } public Criteria andOutletGreaterThan(String value) { addCriterion("outlet >", value, "outlet"); return (Criteria) this; } public Criteria andOutletGreaterThanOrEqualTo(String value) { addCriterion("outlet >=", value, "outlet"); return (Criteria) this; } public Criteria andOutletLessThan(String value) { addCriterion("outlet <", value, "outlet"); return (Criteria) this; } public Criteria andOutletLessThanOrEqualTo(String value) { addCriterion("outlet <=", value, "outlet"); return (Criteria) this; } public Criteria andOutletLike(String value) { addCriterion("outlet like", value, "outlet"); return (Criteria) this; } public Criteria andOutletNotLike(String value) { addCriterion("outlet not like", value, "outlet"); return (Criteria) this; } public Criteria andOutletIn(List<String> values) { addCriterion("outlet in", values, "outlet"); return (Criteria) this; } public Criteria andOutletNotIn(List<String> values) { addCriterion("outlet not in", values, "outlet"); return (Criteria) this; } public Criteria andOutletBetween(String value1, String value2) { addCriterion("outlet between", value1, value2, "outlet"); return (Criteria) this; } public Criteria andOutletNotBetween(String value1, String value2) { addCriterion("outlet not between", value1, value2, "outlet"); return (Criteria) this; } public Criteria andToleranceIsNull() { addCriterion("tolerance is null"); return (Criteria) this; } public Criteria andToleranceIsNotNull() { addCriterion("tolerance is not null"); return (Criteria) this; } public Criteria andToleranceEqualTo(String value) { addCriterion("tolerance =", value, "tolerance"); return (Criteria) this; } public Criteria andToleranceNotEqualTo(String value) { addCriterion("tolerance <>", value, "tolerance"); return (Criteria) this; } public Criteria andToleranceGreaterThan(String value) { addCriterion("tolerance >", value, "tolerance"); return (Criteria) this; } public Criteria andToleranceGreaterThanOrEqualTo(String value) { addCriterion("tolerance >=", value, "tolerance"); return (Criteria) this; } public Criteria andToleranceLessThan(String value) { addCriterion("tolerance <", value, "tolerance"); return (Criteria) this; } public Criteria andToleranceLessThanOrEqualTo(String value) { addCriterion("tolerance <=", value, "tolerance"); return (Criteria) this; } public Criteria andToleranceLike(String value) { addCriterion("tolerance like", value, "tolerance"); return (Criteria) this; } public Criteria andToleranceNotLike(String value) { addCriterion("tolerance not like", value, "tolerance"); return (Criteria) this; } public Criteria andToleranceIn(List<String> values) { addCriterion("tolerance in", values, "tolerance"); return (Criteria) this; } public Criteria andToleranceNotIn(List<String> values) { addCriterion("tolerance not in", values, "tolerance"); return (Criteria) this; } public Criteria andToleranceBetween(String value1, String value2) { addCriterion("tolerance between", value1, value2, "tolerance"); return (Criteria) this; } public Criteria andToleranceNotBetween(String value1, String value2) { addCriterion("tolerance not between", value1, value2, "tolerance"); return (Criteria) this; } public Criteria andSocStrIsNull() { addCriterion("soc_str is null"); return (Criteria) this; } public Criteria andSocStrIsNotNull() { addCriterion("soc_str is not null"); return (Criteria) this; } public Criteria andSocStrEqualTo(String value) { addCriterion("soc_str =", value, "socStr"); return (Criteria) this; } public Criteria andSocStrNotEqualTo(String value) { addCriterion("soc_str <>", value, "socStr"); return (Criteria) this; } public Criteria andSocStrGreaterThan(String value) { addCriterion("soc_str >", value, "socStr"); return (Criteria) this; } public Criteria andSocStrGreaterThanOrEqualTo(String value) { addCriterion("soc_str >=", value, "socStr"); return (Criteria) this; } public Criteria andSocStrLessThan(String value) { addCriterion("soc_str <", value, "socStr"); return (Criteria) this; } public Criteria andSocStrLessThanOrEqualTo(String value) { addCriterion("soc_str <=", value, "socStr"); return (Criteria) this; } public Criteria andSocStrLike(String value) { addCriterion("soc_str like", value, "socStr"); return (Criteria) this; } public Criteria andSocStrNotLike(String value) { addCriterion("soc_str not like", value, "socStr"); return (Criteria) this; } public Criteria andSocStrIn(List<String> values) { addCriterion("soc_str in", values, "socStr"); return (Criteria) this; } public Criteria andSocStrNotIn(List<String> values) { addCriterion("soc_str not in", values, "socStr"); return (Criteria) this; } public Criteria andSocStrBetween(String value1, String value2) { addCriterion("soc_str between", value1, value2, "socStr"); return (Criteria) this; } public Criteria andSocStrNotBetween(String value1, String value2) { addCriterion("soc_str not between", value1, value2, "socStr"); return (Criteria) this; } public Criteria andElecCodeIsNull() { addCriterion("elec_code is null"); return (Criteria) this; } public Criteria andElecCodeIsNotNull() { addCriterion("elec_code is not null"); return (Criteria) this; } public Criteria andElecCodeEqualTo(String value) { addCriterion("elec_code =", value, "elecCode"); return (Criteria) this; } public Criteria andElecCodeNotEqualTo(String value) { addCriterion("elec_code <>", value, "elecCode"); return (Criteria) this; } public Criteria andElecCodeGreaterThan(String value) { addCriterion("elec_code >", value, "elecCode"); return (Criteria) this; } public Criteria andElecCodeGreaterThanOrEqualTo(String value) { addCriterion("elec_code >=", value, "elecCode"); return (Criteria) this; } public Criteria andElecCodeLessThan(String value) { addCriterion("elec_code <", value, "elecCode"); return (Criteria) this; } public Criteria andElecCodeLessThanOrEqualTo(String value) { addCriterion("elec_code <=", value, "elecCode"); return (Criteria) this; } public Criteria andElecCodeLike(String value) { addCriterion("elec_code like", value, "elecCode"); return (Criteria) this; } public Criteria andElecCodeNotLike(String value) { addCriterion("elec_code not like", value, "elecCode"); return (Criteria) this; } public Criteria andElecCodeIn(List<String> values) { addCriterion("elec_code in", values, "elecCode"); return (Criteria) this; } public Criteria andElecCodeNotIn(List<String> values) { addCriterion("elec_code not in", values, "elecCode"); return (Criteria) this; } public Criteria andElecCodeBetween(String value1, String value2) { addCriterion("elec_code between", value1, value2, "elecCode"); return (Criteria) this; } public Criteria andElecCodeNotBetween(String value1, String value2) { addCriterion("elec_code not between", value1, value2, "elecCode"); return (Criteria) this; } public Criteria andFFactorysLikeInsensitive(String value) { addCriterion("upper(F_factorys) like", value.toUpperCase(), "fFactorys"); return (Criteria) this; } public Criteria andFSeriesLikeInsensitive(String value) { addCriterion("upper(F_series) like", value.toUpperCase(), "fSeries"); return (Criteria) this; } public Criteria andHkSeriesLikeInsensitive(String value) { addCriterion("upper(HK_series) like", value.toUpperCase(), "hkSeries"); return (Criteria) this; } public Criteria andSizeLikeInsensitive(String value) { addCriterion("upper(size) like", value.toUpperCase(), "size"); return (Criteria) this; } public Criteria andTemperatureLikeInsensitive(String value) { addCriterion("upper(temperature) like", value.toUpperCase(), "temperature"); return (Criteria) this; } public Criteria andVoltageLikeInsensitive(String value) { addCriterion("upper(voltage) like", value.toUpperCase(), "voltage"); return (Criteria) this; } public Criteria andOutletLikeInsensitive(String value) { addCriterion("upper(outlet) like", value.toUpperCase(), "outlet"); return (Criteria) this; } public Criteria andToleranceLikeInsensitive(String value) { addCriterion("upper(tolerance) like", value.toUpperCase(), "tolerance"); return (Criteria) this; } public Criteria andSocStrLikeInsensitive(String value) { addCriterion("upper(soc_str) like", value.toUpperCase(), "socStr"); return (Criteria) this; } public Criteria andElecCodeLikeInsensitive(String value) { addCriterion("upper(elec_code) like", value.toUpperCase(), "elecCode"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } 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); } } }
a9b8d9c4f9e08b4cd028cb40564a0ec34ef2ccc1
70dec32ba4e0cdbbf866274b74fd0b6701080566
/src/test/java/io/zipcoder/services/AccountServicesTest.java
bec197ff98bd16a21d19b1d7c4767043badf1251
[]
no_license
bth1994/ZipperBank
f8d782ef84282715792b7e103c1e509f354fcab3
2ff87797686ffad4136028d42c074a493400f70e
refs/heads/master
2020-03-09T12:00:58.657787
2018-04-21T22:04:29
2018-04-21T22:04:29
128,775,250
0
1
null
2018-04-21T22:04:30
2018-04-09T13:21:55
Java
UTF-8
Java
false
false
4,122
java
package io.zipcoder.services; import io.zipcoder.controllers.AccountController; import io.zipcoder.entities.Account; import io.zipcoder.entities.Customer; import io.zipcoder.repositories.AccountRepo; import io.zipcoder.repositories.CustomerRepo; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.web.servlet.MockMvc; import java.util.ArrayList; import java.util.List; import java.util.Optional; import static java.util.Collections.singletonList; import static org.mockito.BDDMockito.given; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyLong; import static org.mockito.Matchers.isA; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.springframework.http.HttpStatus.OK; public class AccountServicesTest { @Mock private AccountRepo accountRepo; @Mock private CustomerRepo customerRepo; @InjectMocks private AccountService accountService; private Account testAccount; @Before public void init() { MockitoAnnotations.initMocks(this); Customer testCustomer = new Customer(); testCustomer.setId(1L); testAccount = new Account(); testAccount.setId(1L); testAccount.setCustomer(testCustomer); } @Test public void getAllAccountsTest() { Iterable<Account> accountsList = new ArrayList<>(); given(accountRepo.findAll()).willReturn(accountsList); ResponseEntity<Iterable<Account>> expected = new ResponseEntity<>(accountsList, OK); ResponseEntity<Iterable<Account>> actual = accountService.getAllAccounts(); Assert.assertEquals(expected, actual); } @Test public void getAccountsByIdTest() { accountRepo.save(testAccount); when(accountRepo.findOne(1L)).thenReturn(testAccount); ResponseEntity<Account> expected = new ResponseEntity<>(testAccount, OK); ResponseEntity<Account> actual = accountService.getAccountById(testAccount.getId()); Assert.assertEquals(expected, actual); } @Test public void getAllAccountsByCustomerIdTest() { Iterable<Account> accountsList = new ArrayList<>(); accountRepo.save(testAccount); when(accountRepo.findAllAccountsByCustomerId(testAccount.getCustomer().getId())).thenReturn(accountsList); ResponseEntity<Iterable<Account>> expected = new ResponseEntity<>(accountsList, OK); ResponseEntity<Iterable<Account>> actual = accountService.getAllAccountsByCustomer(testAccount.getCustomer().getId()); Assert.assertEquals(expected, actual); } @Test public void createAccountTest() { Customer testCust = new Customer(); testCust.setId(1L); when(customerRepo.findOne(anyLong())).thenReturn(testCust); when(accountRepo.save(any(Account.class))).thenReturn(testAccount); ResponseEntity<Account> expected = new ResponseEntity<>(testAccount, HttpStatus.CREATED); ResponseEntity<Account> actual = accountService.createAccount(testAccount, testAccount.getCustomer().getId()); Assert.assertEquals(expected, actual); } @Test public void updateAccountTest() { when(accountRepo.save(any(Account.class))).thenReturn(testAccount); ResponseEntity<Account> expected = new ResponseEntity<>(testAccount, HttpStatus.OK); ResponseEntity<Account> actual = accountService.updateAccount(testAccount.getId(), testAccount); Assert.assertEquals(expected, actual); } @Test public void deleteAccountTest() { accountRepo.save(testAccount); accountRepo.delete(1L); when(accountRepo.findOne(1L)).thenReturn(testAccount).thenReturn(null); verify(accountRepo, times(1)).delete(1L); } }
3996a9d40fcfbfa1213a3c18cfb8fc4aa54b09ce
e4392f06cc562f747bedf6aba6fa33890f8c7b8b
/Rabbit/src/collectibles/ExtraLifeRole.java
f2dc215695f1f81b7d6623b227458f50394705bb
[]
no_license
BDianaIulia/RabbitGame
7b2e934b5c8ee3d0b8f5667e1aec30ae0524e384
51b257e60c81886b36fa6da1877dda4a133fd76e
refs/heads/main
2023-08-21T01:47:56.182442
2021-10-19T15:43:34
2021-10-19T15:43:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
237
java
package collectibles; import java.io.Serializable; import buttons.ButtonRole; import players.PlayerRole; public interface ExtraLifeRole extends Serializable{ void giveLife(PlayerRole rabbit); void loadImage(ButtonRole button); }
77e18fcc90c499bdf2f3718a291c7314e25bf913
6515dab1934f879937dff8f725ca20bdb7c2b587
/dangernoodles/src/main/java/uq/deco2800/dangernoodles/windowhandlers/HandlerUtil.java
e61469ab031ba88f2937fcec634b4128a992c7d1
[]
no_license
UQdeco2800/dangernoodles
ca914f6ac232d5baae7dd7a58e1da6e0c30bd76d
97ae1ed5ac5313de980c73e3a16a56619b0f7f69
refs/heads/master
2020-06-14T01:02:34.552134
2016-12-10T05:01:53
2016-12-10T05:01:53
75,535,178
6
3
null
null
null
null
UTF-8
Java
false
false
1,164
java
package uq.deco2800.dangernoodles.windowhandlers; import javafx.scene.control.Alert; import uq.deco2800.dangernoodles.AudioManager; public class HandlerUtil { /** * This method exits the game, called by the exit button */ public static void exitGame() { clickedSound(); System.exit(0); } /** * Plays the clicked sound. */ public static void clickedSound() { AudioManager.playSound("resources/sounds/click2.wav", false); } /** * Plays the sound for when a button is hovered over. */ public static void typingSound() { AudioManager.playSound("resources/sounds/click1.wav", false); } /** * this method is used to display an error alert on log in failure. * * @param error * is the error message you wish to provide. */ public static void showErrorDialog(String error) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Failed Login"); alert.setContentText(error); alert.showAndWait(); // Plays click sound for when the box is closed. clickedSound(); } }
dedc3e3b4e76852c5e54388c0d241c3c504f159c
b8526977c11d0d443286765bc8ad0f1773dedb00
/Server/src/main/java/com/example/nyurates/entity/results/StudentListResult.java
3f7603da8094b55f23f52f2f15e7355065a9aeb0
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Barrywww/NYU-Rates
b217e2908f275eb2d195f035ae52253da0816d5b
1d5eb19c6a3b89a3bd2186b8ce81a659fc5f4ea7
refs/heads/main
2023-05-04T17:33:06.417337
2021-05-24T15:22:43
2021-05-24T15:22:43
336,223,101
1
0
null
null
null
null
UTF-8
Java
false
false
489
java
package com.example.nyurates.entity.results; import java.util.ArrayList; import com.example.nyurates.entity.Student; public class StudentListResult extends Result{ private ArrayList<Student> student_list; public StudentListResult(){ super(); } public ArrayList<Student> getStudent_list(){ return this.student_list; } public void setStudent_list(ArrayList<Student> student_list){ this.student_list = student_list; } }
1119737f6ec36acdc4330d89f18f41c90384b6db
86db6de0e8d4aa61db9838bcbd2dbdb16d1964e6
/src/main/java/com/tingyu/xblog/app/service/impl/TraceServiceImpl.java
f3acf3218918abeaf932891026fd8b52ae8f6cf2
[]
no_license
Essionshy/xblog
844bba4d3dbbe20d80c170248715c3d6f107372c
fb78a10180a9581339f882b5ef3645f222c35b44
refs/heads/master
2022-12-24T22:57:47.262724
2020-03-09T15:13:57
2020-03-09T15:13:57
246,068,053
0
0
null
2022-12-14T20:45:07
2020-03-09T15:10:17
Java
UTF-8
Java
false
false
864
java
package com.tingyu.xblog.app.service.impl;//package com.tingyu.xblog.app.service.impl; // //import org.springframework.boot.actuate.trace.http.HttpTrace; //import org.springframework.boot.actuate.trace.http.HttpTraceRepository; //import org.springframework.stereotype.Service; //import com.tingyu.xblog.app.service.TraceService; // //import java.util.List; // ///** // * TraceService implementation class. // * // * @author johnniang // * @date 2019-06-18 // */ //@Service //public class TraceServiceImpl implements TraceService { // // private final HttpTraceRepository httpTraceRepository; // // public TraceServiceImpl(HttpTraceRepository httpTraceRepository) { // this.httpTraceRepository = httpTraceRepository; // } // // @Override // public List<HttpTrace> listHttpTraces() { // return httpTraceRepository.findAll(); // } //}
51c8f203913b60482e0686ad7a637d01ef2157a0
f9ddc240b5544ab6d0be872eb89f052d91ddecdf
/app/src/main/java/com/example/abedeid/the_movie_app/data_pass.java
305d2127a81ca3f28060c7373b4612c7e41309a1
[]
no_license
abedeidgithub/Solyf
9593419469c42d82beab063b88139033765c41b9
a03ec530f25c5c44b2df7b67303c404c4e5942ab
refs/heads/master
2020-09-20T22:41:24.094372
2016-08-24T13:24:52
2016-08-24T13:24:52
66,042,714
0
0
null
null
null
null
UTF-8
Java
false
false
1,139
java
package com.example.abedeid.the_movie_app; /** * Created by Abed Eid on 20/08/2016. */ public class data_pass { private static int id; private static String title; private static String img; private static String time; private static String date; private static String vote; private static String overview; public data_pass(int id) { this.id=id; } public data_pass(String title, String imageView, String time, String date, String vote, String overview) { this.title = title; this.img = imageView; this.time = time; this.date = date; this.vote = vote; this.overview = overview; } public static int getId() { return id; } public static String getOverview() { return overview; } public static String getTitle() { return title; } public static String getImg() { return img; } public static String getTime() { return time; } public static String getDate() { return date; } public static String getVote() { return vote; } }
88c5ecae2e4d3264bb6d02e189d83a6d309392d1
06a70742fde237e6d43044dccd505c379ceeca40
/src/main/java/com/globpay/cashpickupmicroservice/controllers/CashPickupBeneficiaryController.java
309cf52ac20def0adff525ca2f37e61b6a44a605
[]
no_license
Masud034/cashpickup-microservice
709d83a25c5a94da5961f8238adc6be81628eb31
66eb4def512f45fa07a690ff22a81a0f3f177118
refs/heads/main
2023-06-30T12:26:58.181058
2021-08-09T21:11:46
2021-08-09T21:11:46
394,064,170
0
0
null
null
null
null
UTF-8
Java
false
false
3,164
java
package com.globpay.cashpickupmicroservice.controllers; import com.globpay.cashpickupmicroservice.entities.CashPickupBeneficiary; import com.globpay.cashpickupmicroservice.model.ApiResponse; import com.globpay.cashpickupmicroservice.services.CashPickupBeneficiaryService; import com.globpay.cashpickupmicroservice.validators.BeneficiaryIdMustExist; import com.globpay.cashpickupmicroservice.validators.UserIdMustExist; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; @Validated @RestController public class CashPickupBeneficiaryController { @Autowired private CashPickupBeneficiaryService cashPickupBeneficiaryService; @GetMapping(value = "/beneficiary/{userId}/cashpickup",produces = "application/json") public ResponseEntity<ApiResponse> getAllBeneficiaries(@PathVariable @UserIdMustExist String userId){ return new ResponseEntity(new ApiResponse("Success",cashPickupBeneficiaryService.getAllBeneficiaries(userId)), HttpStatus.OK); } @GetMapping(value = "beneficiary/{userId}/cashpickup/{cashpickupId}", produces = "application/json") public ResponseEntity<ApiResponse> getBeneficiary(@PathVariable @UserIdMustExist String userId, @PathVariable @BeneficiaryIdMustExist String cashpickupId){ return new ResponseEntity<>(new ApiResponse("Success",cashPickupBeneficiaryService.getBeneficiary(cashpickupId)), HttpStatus.OK); } @PostMapping(value = "/beneficiary/{userId}/cashpickup", consumes = "application/json", produces = "application/json") public ResponseEntity<ApiResponse> addBeneficiary(@PathVariable @UserIdMustExist String userId, @Valid @RequestBody CashPickupBeneficiary cashPickupBeneficiary){ return new ResponseEntity<>(new ApiResponse("Success",cashPickupBeneficiaryService.addBeneficiary(userId, cashPickupBeneficiary)), HttpStatus.CREATED); } @PutMapping(value = "beneficiary/{userId}/beneficiary/{cashpickupId}", consumes = "application/json", produces = "application/json") public ResponseEntity<ApiResponse> updateBeneficiary(@PathVariable @BeneficiaryIdMustExist String cashpickupId, @PathVariable @UserIdMustExist String userId, @Valid @RequestBody CashPickupBeneficiary newCashPickupBeneficiary){ return new ResponseEntity<>(new ApiResponse("Success",cashPickupBeneficiaryService.updateBeneficiary(userId,cashpickupId, newCashPickupBeneficiary)), HttpStatus.OK); } @DeleteMapping(value = "beneficiary/{userId}/cashpickup/{cashpickupId}") public ResponseEntity<ApiResponse> deleteBeneficiary(@PathVariable @UserIdMustExist String userId, @PathVariable @BeneficiaryIdMustExist String cashpickupId){ return new ResponseEntity(new ApiResponse("Deleted"),HttpStatus.NO_CONTENT); } }
a26a19b773c931f03bef7c379f3d717f6c062b84
644ae4b8ba00405e21410db7b93ecbca5e806cb4
/src/programacion/excepciones/domain/OperationException.java
dcd222adf31300ed838429c271ea071f25fb3f05
[]
no_license
alfredo00sd/java-practices
126963dfad80f723e217168bcc4b4b46cf27adfc
4f812db0c14a6eb4cd2ba2a5fe18ed2e8722a628
refs/heads/master
2020-07-24T08:29:33.990842
2019-11-14T12:01:27
2019-11-14T12:01:27
207,865,974
0
0
null
null
null
null
UTF-8
Java
false
false
209
java
package programacion.excepciones.domain; public class OperationException extends Exception { public OperationException(String msg){ super(msg);//call the constructor of the parent class } }
d6da8e4d44f999b613829d0c2f4bb9586b8bb797
6cda4ba980b4084941cdeb8029bb427d172300fc
/src/NumberOfIslands||/Solution1.java
e01fa3a17c081820c788934b56768d90803713a2
[]
no_license
zhenyiluo/lintcode
b0c9f2500300e425b07456a6e5309bb930d89948
6002d1f0d4357734f509c41f1bd4155d45ca0c23
refs/heads/master
2020-04-06T03:42:21.345545
2015-12-28T18:48:38
2015-12-28T18:48:38
42,069,812
0
0
null
null
null
null
UTF-8
Java
false
false
1,655
java
/** * Definition for a point. * struct Point { * int x; * int y; * Point() : x(0), y(0) {} * Point(int a, int b) : x(a), y(b) {} * }; */ public class Solution { private int findFather(HashMap<Integer, Integer> father, int x) { if (father.contains(x)) { father.put(x, x); return x; } int res = x, tmp; while (res != father.get(res)) { res = father.get(res); } while (x != father.get(x)) { tmp = father.get(x); father.put(x, res); x = tmp; } return x; } public static final int dx[] = {0, 1, 0, -1}; public static final int dy[] = {1, 0, -1, 0}; public List<Integer> numIslands2(int n, int m, Point[] operators) { // Write your code here HashMap<Integer, Integer> father; List<Integer> res = new ArrayList<Integer>(); int cnt = 0; for (Point op : operators) { int p = op.x * m + op.y; int fp = findFather(father, p); if (fp == p) ++cnt; for (int i = 0; i < 4; ++i) { int xx = op.x + dx[i], yy = op.y + dy[i]; if (xx < 0 || xx >= n || yy < 0 || yy >= m) continue; int q = (op.x + dx[i]) * m + op.y + dy[i]; if (father.find(q) != father.end()) { int fq = findFather(father, q); if (fp != fq) { --cnt; father.put(fq, fp); } } } res.add(cnt); } return res; } }
f8fe72d1c24891255fe10e64676af1458689ac66
78af166cdc63aaa476152c4b9aecb3791736f7b4
/src/ged/CppElementCheckerVisitor.java
087d802a62537c5c67d413f8121dc17b3dc1315c
[]
no_license
prk223/GED
f4931ae626a5a89da89e498e43791e10e2aeb3cc
0da826b0657f2f885badc614ce75bb64e5ffca87
refs/heads/master
2021-01-10T19:43:54.177568
2014-04-30T01:40:31
2014-04-30T01:40:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,721
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 ged; import java.util.ArrayList; import java.util.Iterator; /** * * @author Comp */ public class CppElementCheckerVisitor implements ElementCheckerVisitor { private final ArrayList<ClassElement> classes; private final ArrayList<AggregationRelationship> aggregations; public CppElementCheckerVisitor() { classes = new ArrayList<>(); aggregations = new ArrayList<>(); } @Override public String visit(ClassDiagram diagram) { String error = ""; if(diagram.getElements().isEmpty()) error = "Diagram does not contain any elements:" + diagram.getName(); return error; } @Override public String visit(ClassElement c) { String error = ""; if(c.getName().isEmpty()) error = "Class has no name!"; else { Iterator<ClassElement> classIt = classes.iterator(); while(classIt.hasNext()) { ClassElement classInList = classIt.next(); if(classInList.getName().equals(c.getName())) { error = "Duplicate class name:" + c.getName(); break; } } } classes.add(c); return error; } @Override public String visit(Relationship r) { String error = ""; if(r.getSourceClass() == null) error += "Relationship does not have a source class! "; if(r.getDestinationClass() == null) error += "Relationship does not have a destination class! "; return error; } @Override public String visit(InheritanceRelationship r) { return visit((Relationship)r); } @Override public String visit(AggregationRelationship r) { String error = visit((Relationship)r); if(error.isEmpty()) { Iterator<AggregationRelationship> aggIt = aggregations.iterator(); while(aggIt.hasNext()) { AggregationRelationship agg = aggIt.next(); if((agg.getSourceClass() == r.getSourceClass()) && (agg.getDestinationClass() == r.getDestinationClass())) { error += "Multiple aggregation relationships between same two classes:"; error += r.getSourceClass().getName() + " and "; error += r.getDestinationClass().getName() + "! "; break; } } aggregations.add(r); } return error; } @Override public String visit(AssociationRelationship r) { return visit((Relationship)r); } }
abaecf5436541d9a43fe949ea74480c06ab14239
07174aa43b1644b795e9d7dd6fc6a376669265c1
/library/src/main/java/com/tom_roush/pdfbox/contentstream/operator/graphics/CurveToReplicateInitialPoint.java
336dfb3cfab8caf660c1329bae39427e3ff2d578
[ "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "APAFML", "LicenseRef-scancode-unknown-license-reference" ]
permissive
sbassomp/PdfBox-Android
a505a0afc930305544358d2b3d4b17eca70d2e4b
c9b99fa03e6f2cfca3574bceb763fbd54530c4c3
refs/heads/master
2020-03-13T22:47:16.923659
2018-04-27T16:53:02
2018-04-27T16:53:02
131,322,744
0
0
Apache-2.0
2018-04-27T16:53:04
2018-04-27T16:50:39
Java
UTF-8
Java
false
false
1,512
java
package com.tom_roush.pdfbox.contentstream.operator.graphics; import android.graphics.PointF; import android.util.Log; import com.tom_roush.pdfbox.contentstream.operator.Operator; import com.tom_roush.pdfbox.cos.COSBase; import com.tom_roush.pdfbox.cos.COSNumber; import java.io.IOException; import java.util.List; /** * v Append curved segment to path with the initial point replicated. * * @author Ben Litchfield */ public class CurveToReplicateInitialPoint extends GraphicsOperatorProcessor { @Override public void process(Operator operator, List<COSBase> operands) throws IOException { COSNumber x2 = (COSNumber) operands.get(0); COSNumber y2 = (COSNumber) operands.get(1); COSNumber x3 = (COSNumber) operands.get(2); COSNumber y3 = (COSNumber) operands.get(3); PointF currentPoint = context.getCurrentPoint(); PointF point2 = context.transformedPoint(x2.floatValue(), y2.floatValue()); PointF point3 = context.transformedPoint(x3.floatValue(), y3.floatValue()); if (currentPoint == null) { Log.w("PdfBox-Android", "curveTo (" + point3.x + "," + point3.y + ") without initial MoveTo"); context.moveTo(point3.x, point3.y); } else { context.curveTo(currentPoint.x, currentPoint.y, point2.x, point2.y, point3.x, point3.y); } } @Override public String getName() { return "v"; } }
927aeae142902a8d9cd2a032da84519991d1ae48
e1af7696101f8f9eb12c0791c211e27b4310ecbc
/MCP/temp/src/minecraft/net/minecraft/world/WorldProviderSurface.java
d03bb474756b9b32327fb3024ec7b6f40c4e47e8
[]
no_license
VinmaniaTV/Mania-Client
e36810590edf09b1d78b8eeaf5cbc46bb3e2d8ce
7a12b8bad1a8199151b3f913581775f50cc4c39c
refs/heads/main
2023-02-12T10:31:29.076263
2021-01-13T02:29:35
2021-01-13T02:29:35
329,156,099
0
0
null
null
null
null
UTF-8
Java
false
false
333
java
package net.minecraft.world; public class WorldProviderSurface extends WorldProvider { public DimensionType func_186058_p() { return DimensionType.OVERWORLD; } public boolean func_186056_c(int p_186056_1_, int p_186056_2_) { return !this.field_76579_a.func_72916_c(p_186056_1_, p_186056_2_); } }
933075cec891595c895b63a7250a9cbfde0dfaa4
fdc66063e6225953296e10b713b1fe15a3185777
/src/main/java/com/huigod/spring/com/huigod/thinkjava/example8/CovariantReturn.java
b5d29a5ade4a610400172623094f07e092015db3
[]
no_license
huiGod/spring-lecture
450f1b6272be8bca972912d4a261117ccd1e2e06
833c954cabad79a9058cc0a6e31d0f2ae9a98ad7
refs/heads/master
2020-03-21T04:12:28.694718
2018-08-16T06:30:10
2018-08-16T06:30:10
138,096,899
0
0
null
null
null
null
UTF-8
Java
false
false
622
java
package com.huigod.spring.com.huigod.thinkjava.example8; public class CovariantReturn { public static void main(String[] args) { Mill m = new Mill(); Grain g = m.process(); System.out.println(g); m = new WheatMill(); g = m.process(); System.out.println(g); } } class Grain { @Override public String toString() { return "Grain"; } } class Wheat extends Grain { @Override public String toString() { return "Wheat"; } } class Mill { Grain process() { return new Grain(); } } class WheatMill extends Mill { Wheat process() { return new Wheat(); } }
2b204dc3877c47d5d55f956bb73a26f4c3361605
93740012e907b568a0a8c842aeb27769ad2024ed
/core/src/main/java/de/mirkosertic/bytecoder/core/ir/RuntimeClassOf.java
fd0df83be65ca2d3699e1df614132b636300efd1
[ "Apache-2.0" ]
permissive
mirkosertic/Bytecoder
2beb0dc07d3d00777c9ad6eeb177a978f9a6464b
7af3b3c8f26d2f9f922d6ba7dd5ba21ab2acc6db
refs/heads/master
2023-09-01T12:38:20.003639
2023-08-17T04:59:00
2023-08-25T09:06:25
88,152,958
831
75
Apache-2.0
2023-09-11T13:47:20
2017-04-13T10:21:59
Java
UTF-8
Java
false
false
798
java
/* * Copyright 2023 Mirko Sertic * * 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 de.mirkosertic.bytecoder.core.ir; import org.objectweb.asm.Type; public class RuntimeClassOf extends Value { public RuntimeClassOf() { super(Type.getType(Class.class)); } }
d57d17e34c6fa8264b34d0a8a6f78afe3539ac34
af611ea132d315e58d9f881a8ea5faa394760d5a
/app/build/generated/source/buildConfig/debug/practicaltest01var04/eim/systems/cs/pub/ro/practicaltest01var04/BuildConfig.java
7fc41fd85236a1ff54578c967dcbdaa74e4d7531
[ "Apache-2.0" ]
permissive
catalinaD19/PracticalTest01Var04
029c890a91ab1eea5b3de4cf92ed6c3becd9bc02
0dafba65089e5c737fa89306ba983227c50d60e5
refs/heads/master
2020-03-07T08:59:30.390116
2018-03-30T08:28:42
2018-03-30T08:28:42
127,394,898
0
0
null
null
null
null
UTF-8
Java
false
false
533
java
/** * Automatically generated file. DO NOT MODIFY */ package practicaltest01var04.eim.systems.cs.pub.ro.practicaltest01var04; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "practicaltest01var04.eim.systems.cs.pub.ro.practicaltest01var04"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 1; public static final String VERSION_NAME = "1.0"; }
5f7d5983a4574599fe1817fe9a0441051bc42ee8
e8ed920165f799ceefa770aa4c64b496b7a11277
/src/CompositeEngine.java
15adc378d51b508c6754bc6f61b269b62fa3f99c
[]
no_license
athornburg/CompositePatterProject4
93d7eb50bd88f4f85a7185ebc25d7687031c420e
0bed0c691ec5abb8ca1ebd5c7c87af5c238259b9
refs/heads/master
2021-01-13T02:04:02.619533
2014-04-02T01:58:33
2014-04-02T01:58:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,736
java
import java.util.ArrayList; import java.util.List; import java.util.Random; /** * User: alexthornburg * Date: 4/1/14 * Time: 7:10 PM */ public class CompositeEngine implements Part { public List<Part> components = new ArrayList<Part>(); String name; boolean needsMaintenance = false; public List<Part> getComponents() { return components; } @Override public String getName() { return name; } @Override public void addName(String name) { this.name = name; } @Override public boolean needsMaintenance() { return needsMaintenance; } @Override public void breakPart() { needsMaintenance = true; } @Override public void fixPart() { needsMaintenance = false; } @Override public String getStatus() { for(Part part:components){ //This is where the fun happens Random r = new Random(); double gremlin = r.nextInt(800); if(gremlin > 10 && gremlin < 15){ part.breakPart(); } // if(part.needsMaintenance()){ needsMaintenance = true; return "there is a problem with "+part.getName(); }else{ return "vrooooooom"; } } return "Engine status checked"; } @Override public int performFunction() { int power = 0; for(Part part:components){ power+= part.performFunction(); } return power; } public void addPart(Part part){ components.add(part); } public void removePart(Part part){ components.remove(part); } }
6376fed49ad8f2e7c86aab9d6fe6baee3f4453ba
24ae82eaca3dbf261979b54f0a82debce81eb89d
/SmartMeter~/SmartMeter_v1/src/SmartMeter_v1.java
dc126eba0a2f8866ca427cf8b7285a1e3bc942a0
[]
no_license
xchmwang/java-projects
702ef635b40b95ce422c5dcd2c46a3d1f91649d8
71e95aa19a85059527e7a1762c69853fd93762a1
refs/heads/master
2021-06-02T12:45:16.145362
2015-12-24T10:52:44
2015-12-24T10:52:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,276
java
import java.io.*; import java.text.*; import java.util.*; import java.util.Map.Entry; public class SmartMeter_v1 { private static final String powerPath = "E:\\zju\\pr\\smart meter\\BLUED_data\\export_data\\exprt_data_p"; private static final String[] phase = {"a", "b"}; private static final double[] consumptionDead = new double [Conf.applianceNumbers]; public static double Abs(double x) { return x > 0 ? x : -x; } private int FindApplianceLabelId(double triggerPower, double stablePower, HashMap<Integer, Double> powerTable) { double deltaPower = Abs(triggerPower - stablePower); double diff = 0x7fffffff * 1.0; int labelId = 0; Iterator<Entry<Integer, Double>> iter = powerTable.entrySet().iterator(); while (iter.hasNext()) { Map.Entry<Integer, Double> entry = iter.next(); int key = entry.getKey(); double val = entry.getValue(); if (Abs(deltaPower - val) < diff) { diff = Abs(deltaPower - val); labelId = key; } } return labelId; } /*private LinkedList<Integer> FindApplianceLabelId(double triggerPower, double stablePower, HashMap<Integer, Double> powerTable) { double deltaPower = Abs(triggerPower - stablePower); double fluctuationRate = 0.1; double diff = deltaPower*fluctuationRate; LinkedList<Integer> labelIdList = new LinkedList<Integer>(); Iterator<Entry<Integer, Double>> iter = powerTable.entrySet().iterator(); while (iter.hasNext()) { Map.Entry<Integer, Double> entry = iter.next(); int key = entry.getKey(); double val = entry.getValue(); if (Abs(deltaPower - val) < diff) { labelIdList.add(key); } } return labelIdList; }*/ private int FindApplianceLabelId(double triggerPower, double stablePower, Stack<Appliance_v1> st) { double deltaPower = Abs(triggerPower - stablePower); double diff = 0x7fffffff * 1.0; int labelId = 0; for (Appliance_v1 app : st) { if (Abs(deltaPower - app.GetPower()) < diff) { diff = Abs(deltaPower - app.GetPower()); labelId = app.GetLabelId(); } } return labelId; } private boolean EnStable(LinkedList<Double> llist, double power) { if (llist.size() < 2) return true; double deltaSum = 0.0; for (int i = 0; i < llist.size()-1; i++) { deltaSum += (llist.get(i+1) - llist.get(i)); if (Abs(deltaSum)/power >= Conf.deltaRate) return false; } return true; } private void Process(String path, int fileId, int ph) { try { File readFile = new File(path + phase[ph] + fileId); InputStreamReader reader = new InputStreamReader(new FileInputStream(readFile)); BufferedReader bufr = new BufferedReader(reader); File writeFile = new File("e:\\foo1.txt"); writeFile.createNewFile(); BufferedWriter bufw = new BufferedWriter(new FileWriter(writeFile)); BuildPowerDatabase_v1 appliancePowerDatabase = new BuildPowerDatabase_v1(); HashMap<Integer, Double> powerTable = appliancePowerDatabase.GetPowerDatabase(); int index = 0, startIndex = 0, endIndex = 0; double beforeLast = -1.0, lastPower = -1.0, curPower = -1.0, triggerPower = -1.0; Stack<Appliance_v1> st = new Stack<Appliance_v1>(); boolean enTrigger = false, deTrigger = false; LinkedList<Double> llist = new LinkedList<Double>(); Stack<ApplianceTriggerFeature> applianceTriggerFeature = new Stack<ApplianceTriggerFeature>(); for (String line = bufr.readLine(); line != null; line = bufr.readLine(), ++index) { if (index == 0) { beforeLast = Double.parseDouble(line); continue; } else if (index == 1) { lastPower = Double.parseDouble(line); continue; } double[] consumptionAlive = new double [Conf.applianceNumbers]; if (index % 60 == 0) { if (!st.empty()) { for (Appliance_v1 app : st) { app.SetCurIndex(index); consumptionAlive[app.GetLabelId()] += app.CurPowerConsumption(); } } // System.out.println(consumptionAlive[11]+consumptionDead[11]); /*DecimalFormat df = new DecimalFormat("#.000000"); bufw.write(df.format(consumptionAlive[11]+consumptionDead[11])); bufw.newLine();*/ } curPower = Double.parseDouble(line); double deltaPower = curPower - lastPower; if (enTrigger) { /*ApplianceTriggerFeature triggerFeature = applianceTriggerFeature.pop(); triggerFeature.SetTriggerPowerList(curPower);*/ if (llist.size() >= Conf.stablePowerListLength) { Appliance_v1 lastApp = st.peek(); //LinkedList<Integer> labelIdList = FindApplianceLabelId(triggerPower, llist.getLast(), powerTable); int labelId = FindApplianceLabelId(triggerPower, llist.getLast(), powerTable); llist.clear(); lastApp.SetLabelId(labelId); lastApp.SetPower(powerTable.get(labelId)); DecimalFormat df = new DecimalFormat("#.000000"); bufw.write(lastApp.GetStartIndex() + " " + lastApp.GetLabelId() + " " + df.format(lastApp.GetPower())); bufw.newLine(); enTrigger = false; // applianceTriggerFeature.push(triggerFeature); } else if (llist.size()<Conf.stablePowerListLength && Abs(deltaPower)/triggerPower<Conf.deltaRate && EnStable(llist, triggerPower)) llist.add(curPower); else llist.clear(); } else if (deTrigger && !st.empty()) { if (llist.size() >= Conf.stablePowerListLength) { int labelId = FindApplianceLabelId(triggerPower, llist.getLast(), st); llist.clear(); for (Appliance_v1 app : st) { if (labelId == app.GetLabelId()) { app.SetEndIndex(endIndex); consumptionDead[app.GetLabelId()] += app.TotalPowerConsumption(); DecimalFormat df = new DecimalFormat("#.000000"); bufw.write(app.GetEndIndex() + " " + app.GetLabelId() + " " + df.format(app.GetPower())); bufw.newLine(); st.remove(app); deTrigger = false; break; } } } else if (llist.size()<Conf.stablePowerListLength && Abs(deltaPower)/curPower<Conf.deltaRate && EnStable(llist, curPower)) llist.add(curPower); else llist.clear(); } else if (!enTrigger && Abs(deltaPower)/lastPower>Conf.deltaRate && deltaPower>=0) { Appliance_v1 app = new Appliance_v1(startIndex=index-1); st.push(app); triggerPower = beforeLast; enTrigger = true; /*ApplianceTriggerFeature triggerFeature = new ApplianceTriggerFeature(); triggerFeature.SetTriggerPowerList(beforeLast); triggerFeature.SetTriggerPowerList(lastPower); triggerFeature.SetTriggerPowerList(curPower); applianceTriggerFeature.push(triggerFeature);*/ } else if (!deTrigger && Abs(deltaPower)/curPower>Conf.deltaRate && deltaPower<0 && !st.empty()){ endIndex = index - 1; triggerPower = beforeLast; deTrigger = true; } beforeLast = lastPower; lastPower = curPower; } bufr.close(); bufw.flush(); bufw.close(); } catch (Exception e) { e.printStackTrace(); } return; } public static void main(String[] args) { for (int i = 1; i <= 4; i++) { for (int j = 0; j < 1; j++) { SmartMeter_v1 obj = new SmartMeter_v1(); obj.Process(powerPath, i, j); } } return; } }
d07e4198e0816e3e57b43da8ba29c89c5bdfd61e
e5149b1001e23daaa21fe9c33f12f391b98ee852
/src/main/java/com/zikozee/springbootfirebase/model/Patient.java
86606a86acd9e6373a1821deb69f425f79b3bcfb
[]
no_license
zikozee/springboot-firebase
369636efc18cb67e4b89d6b1094aa90b17331575
b5b832ec4d6c2735c452321bd3277854c9204f3b
refs/heads/master
2022-12-16T03:37:06.566370
2020-09-08T05:24:59
2020-09-08T05:24:59
290,915,157
0
0
null
null
null
null
UTF-8
Java
false
false
171
java
package com.zikozee.springbootfirebase.model; import lombok.Data; @Data public class Patient { private String name; private int age; private String city; }
f8757cd9c9deed32cb1e906ad0ce0df0265b407f
dbc258080422b91a8ff08f64146261877e69d047
/java-opensaml2-2.3.1/src/test/java/org/opensaml/saml2/core/impl/StatusResponseTestBase.java
8dd411bb46cc3539638ca956532976e4b781e986
[]
no_license
mayfourth/greference
bd99bc5f870ecb2e0b0ad25bbe776ee25586f9f9
f33ac10dbb4388301ddec3ff1b130b1b90b45922
refs/heads/master
2020-12-05T02:03:59.750888
2016-11-02T23:45:58
2016-11-02T23:45:58
65,941,369
0
0
null
null
null
null
UTF-8
Java
false
false
6,331
java
/* * Copyright [2005] [University Corporation for Advanced Internet Development, 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 org.opensaml.saml2.core.impl; import javax.xml.namespace.QName; import org.joda.time.DateTime; import org.joda.time.chrono.ISOChronology; import org.opensaml.common.SAMLObject; import org.opensaml.common.BaseSAMLObjectProviderTestCase; import org.opensaml.common.SAMLVersion; import org.opensaml.common.xml.SAMLConstants; import org.opensaml.saml2.core.Issuer; import org.opensaml.saml2.core.Status; import org.opensaml.saml2.core.StatusResponseType; /** * */ public abstract class StatusResponseTestBase extends BaseSAMLObjectProviderTestCase { /** Expected ID attribute */ protected String expectedID; /** Expected InResponseTo attribute */ protected String expectedInResponseTo; /** Expected Version attribute */ protected SAMLVersion expectedSAMLVersion; /** Expected IssueInstant attribute */ protected DateTime expectedIssueInstant; /** Expected Destination attribute */ protected String expectedDestination; /** Expected Consent attribute */ protected String expectedConsent; /** Expected Issuer child element */ protected Issuer expectedIssuer; /** Expected Status child element */ protected Status expectedStatus; /** * Constructor * */ public StatusResponseTestBase() { } /** {@inheritDoc} */ protected void setUp() throws Exception { super.setUp(); expectedID = "def456"; expectedInResponseTo = "abc123"; expectedSAMLVersion = SAMLVersion.VERSION_20; expectedIssueInstant = new DateTime(2006, 2, 21, 16, 40, 0, 0, ISOChronology.getInstanceUTC()); expectedDestination = "http://sp.example.org/endpoint"; expectedConsent = "urn:string:consent"; QName issuerQName = new QName(SAMLConstants.SAML20_NS, Issuer.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20_PREFIX); expectedIssuer = (Issuer) buildXMLObject(issuerQName); QName statusQName = new QName(SAMLConstants.SAML20P_NS, Status.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20P_PREFIX); expectedStatus = (Status) buildXMLObject(statusQName); } /** {@inheritDoc} */ public abstract void testSingleElementUnmarshall(); /** {@inheritDoc} */ public abstract void testSingleElementMarshall(); /** * Used by subclasses to populate the required attribute values * that this test expects. * * @param samlObject */ protected void populateRequiredAttributes(SAMLObject samlObject) { StatusResponseType sr = (StatusResponseType) samlObject; sr.setID(expectedID); sr.setIssueInstant(expectedIssueInstant); // NOTE: the SAML Version attribute is set automatically by the impl superclas } /** * Used by subclasses to populate the optional attribute values * that this test expects. * * @param samlObject */ protected void populateOptionalAttributes(SAMLObject samlObject) { StatusResponseType sr = (StatusResponseType) samlObject; sr.setInResponseTo(expectedInResponseTo); sr.setConsent(expectedConsent); sr.setDestination(expectedDestination); } /** * Used by subclasses to populate the child elements that this test expects. * * * @param samlObject */ protected void populateChildElements(SAMLObject samlObject) { StatusResponseType sr = (StatusResponseType) samlObject; sr.setIssuer(expectedIssuer); sr.setStatus(expectedStatus); } protected void helperTestSingleElementUnmarshall(SAMLObject samlObject) { StatusResponseType sr = (StatusResponseType) samlObject; assertEquals("Unmarshalled ID attribute was not the expected value", expectedID, sr.getID()); assertEquals("Unmarshalled Version attribute was not the expected value", expectedSAMLVersion.toString(), sr.getVersion().toString()); assertEquals("Unmarshalled IssueInstant attribute was not the expected value", 0, expectedIssueInstant.compareTo(sr.getIssueInstant())); assertNull("InResponseTo was not null", sr.getInResponseTo()); assertNull("Consent was not null", sr.getConsent()); assertNull("Destination was not null", sr.getDestination()); } protected void helperTestSingleElementOptionalAttributesUnmarshall(SAMLObject samlObject) { StatusResponseType sr = (StatusResponseType) samlObject; assertEquals("Unmarshalled ID attribute was not the expected value", expectedID, sr.getID()); assertEquals("Unmarshalled Version attribute was not the expected value", expectedSAMLVersion.toString(), sr.getVersion().toString()); assertEquals("Unmarshalled IssueInstant attribute was not the expected value", 0, expectedIssueInstant.compareTo(sr.getIssueInstant())); assertEquals("Unmarshalled InResponseTo attribute was not the expected value", expectedInResponseTo, sr.getInResponseTo()); assertEquals("Unmarshalled Consent attribute was not the expected value", expectedConsent, sr.getConsent()); assertEquals("Unmarshalled Destination attribute was not the expected value", expectedDestination, sr.getDestination()); } protected void helperTestChildElementsUnmarshall(SAMLObject samlObject) { StatusResponseType sr = (StatusResponseType) samlObject; assertNotNull("Issuer was null", sr.getIssuer()); assertNotNull("Status was null", sr.getIssuer()); } }
774ea8e410888c2acf5d90ab3d1fff1282e60968
ad2181edf66d26267a3c50ecddc9cbdf41666c3c
/laboratorios/lab02/ejercicioEnLinea/Array2.java
05a8fe96904367ad88942aef6c6cc6f59c24111c
[]
no_license
JJCanon/ST0245-034
f9090920f85c4b94f46ee84eb2f93ee64e7bd073
82ea0555c20edffd496a9c207dc80bbc283ea8a4
refs/heads/master
2022-09-18T13:16:32.356375
2020-06-04T13:25:42
2020-06-04T13:25:42
260,345,174
1
0
null
2020-05-01T00:08:37
2020-05-01T00:08:37
null
WINDOWS-1252
Java
false
false
443
java
public class Array2{ public static void main(String[] args) { } public int countEvens(int[] nums) { int cont=0;//O(1) for (int i =0 ; i < nums.length;i++){//C1*O(1) ó O(n) if(nums[i]%2==0){//O(1) cont++;//O(1) } } return cont;//O(1) } public int[] fizzArray(int n) { int [] arr = new int [n];//O(1) for(int i=0; i<n;i++){//O(n) arr[i]=i;//O(1) } return arr;//O(1) } }
e8549b61a560ff9591f52fcccfc8ed72ccf9304e
ddc8d0f3696bd7f0b51d9c04ffe2fcb22b24da2a
/ad-gateway/src/main/java/com/wjc/ad/filter/PreRequestFilter.java
de275883902d88f86a27070143806a069fd19672
[]
no_license
wjc1243/myadvertisement
41d97517a21843456e830639f8f7a50064e42371
7eb46d82b0bb657ae6fcd24364ef9a8611269dcc
refs/heads/master
2020-04-28T21:30:46.236934
2019-03-14T08:59:26
2019-03-14T08:59:26
175,584,678
0
0
null
null
null
null
UTF-8
Java
false
false
861
java
package com.wjc.ad.filter; import com.netflix.zuul.ZuulFilter; import com.netflix.zuul.context.RequestContext; import com.netflix.zuul.exception.ZuulException; import lombok.extern.slf4j.Slf4j; import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants; import org.springframework.stereotype.Component; import java.time.Instant; @Slf4j @Component public class PreRequestFilter extends ZuulFilter { @Override public String filterType() { return FilterConstants.PRE_TYPE; } @Override public int filterOrder() { return 0; } @Override public boolean shouldFilter() { return true; } @Override public Object run() throws ZuulException { RequestContext rc = RequestContext.getCurrentContext(); rc.set("startTime", Instant.now()); return null; } }
2ffc89947273d63fbda0614b7ccc85e033559c0d
463cb738f82438cc7efca20de50a8ab8b3f23c1e
/api126/src/main/java/com/github/khazrak/jdocker/api126/model/IOServiceBytes126.java
ea623bddb6ff3bc678357271447246d2897957d8
[ "Apache-2.0" ]
permissive
Khazrak/JDocker
e7ac6b144f3cb1d3b4a30d69882be8ba0344b5fb
940b4036368851211c4ee2b783528cd2a4fe23b9
refs/heads/master
2021-01-17T16:15:20.062811
2017-06-15T14:37:23
2017-06-15T14:37:23
69,988,552
11
2
null
null
null
null
UTF-8
Java
false
false
1,033
java
package com.github.khazrak.jdocker.api126.model; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import com.github.khazrak.jdocker.abstraction.IOServiceBytes; import lombok.Builder; import lombok.Getter; @Getter @Builder @JsonDeserialize(builder = IOServiceBytes126.IOServiceBytes126Builder.class) public class IOServiceBytes126 implements IOServiceBytes { @JsonProperty("major") private int major; @JsonProperty("minor") private int minor; @JsonProperty("op") private String op; @JsonProperty("value") private long value; @JsonPOJOBuilder(withPrefix = "") public static class IOServiceBytes126Builder { @JsonProperty("major") private int major; @JsonProperty("minor") private int minor; @JsonProperty("op") private String op; @JsonProperty("value") private long value; } }
52708af7532f674777b4f5b397b957324da4485b
047e9f4a3e08395418071c91dba4995478a372aa
/org/DataCom/Client/UFTClientResponder.java
476ae761967ade2dc187c19e1f08f0e4db4d83d4
[]
no_license
jordonbiondo/UDPFileTransfer
306e16e44e83a61db2e13cf842b83f64f95f8aac
3adcaf5466908f8bcbc39f6b3a9c9ab589f83119
refs/heads/master
2020-05-09T13:39:39.161086
2013-04-22T04:41:11
2013-04-22T04:41:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,800
java
package org.DataCom.Client; import java.util.*; import java.util.concurrent.*; import java.io.*; import java.net.*; import org.DataCom.Utility.*; public class UFTClientResponder extends UFTPacketResponder { /** * Create a new Responder */ public UFTClientResponder(UDPFileTransferNode master) { super(master); } /** * Respond to a packet */ @Override public void respondTo(UFTPacket packet) { switch(packet.getHeader().type) { case ERR: respondToERR(packet); break; case DAT: respondToDAT(packet); break; case ACK: respondToACK(packet); break; case END: break; } } /** * Respon to ACK */ public void respondToACK(UFTPacket packet) { Debug.pln("got an ack"); master.acknowledged.put(packet.getDataAsString(),new Boolean(true)); } /** * Resond to dat */ public void respondToDAT(UFTPacket packet) { UDPFileTransferClient client = (UDPFileTransferClient)master; if (client.fileDataPackets.length < packet.getHeader().totalPackets) { client.fileDataPackets = new UFTPacket[packet.getHeader().totalPackets]; } client.gettingData = true; client.fileDataPackets[packet.getHeader().packetNumber-1] = packet; Debug.pln("putting packet: "+packet.getHeader().packetNumber+"/"+packet.getHeader().totalPackets); UFTPacket ackPack = UFTPacket.createACKPacket(packet); this.master.enqueueForSend(ackPack); this.master.notifySpeaker(); boolean done = true; for (UFTPacket pack : client.fileDataPackets) { if (pack == null) { done = false; } } if (done) { System.out.println("DONE"); client.writeFileAndEnd(); } } /** * Respond to ERR */ public void respondToERR(UFTPacket packet) { System.out.println(packet.getDataAsString()); } }
3251575a9baa0504d057d2751216bd9f3bf434e3
ef86a08d68b1a17956af296d31f1ce8b1835597f
/bt40/bai7.java
685776a4cb61f89200febbe02ec90accf945c290
[]
no_license
duy2271995/hutech-oop
32014b04ee993987504cebc7b811742531b5956f
a945a5f566965d65b435d73cc7a76e474700fe2e
refs/heads/master
2020-07-05T06:58:12.318161
2019-08-16T08:21:42
2019-08-16T08:21:42
202,563,040
0
0
null
null
null
null
UTF-8
Java
false
false
1,157
java
import java.util.Scanner; public class bai7 { public static int nhap() { Scanner input = new Scanner(System.in); boolean check = false; int n = 0; while (!check) { System.out.print(" "); try { n = input.nextInt(); check = true; } catch (Exception e) { System.out.println("Ban phai nhap so! hay nhap lai..."); input.nextLine(); } } return (n); } public static void main(String[] args) { System.out.print("Nhap n"); int n = nhap(); int[] f = new int[n + 1]; f[0] = 1; f[1] = 1; for (int i = 2; i <= n; i++) { f[i] = f[i - 1] + f[i - 2]; } System.out.println("So Fibonanci thu " + n + " la: f[" + n + "]= " + f[n]); } }
1db8deaf048b6184cbd8d929b00d82aae846057b
952d8ff3b1ca310e8e0df02d3063d0d81fa929a6
/home work7/Push button/BorderedApp.java
8da4a768c95e2b2aad1077dc9dd918e98c0a1fa1
[]
no_license
5610110352/f2
ca6a0b56c2ca5f8bc6a00837369d223254480759
e6d8d160b385065ac858f744a64edc0aa58dcefd
refs/heads/master
2020-04-17T02:45:51.260715
2019-05-13T04:54:56
2019-05-13T04:54:56
166,151,844
0
0
null
null
null
null
UTF-8
Java
false
false
778
java
import javax.swing.JFrame; import javax.swing.JButton; import java.awt.BorderLayout; import java.awt.Dimension; public class BorderedApp { public static void main(String[] args){ JFrame frame = new JFrame("My App"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(400, 200); frame.getContentPane().setLayout(new BorderLayout()); frame.add(new JButton("North"), BorderLayout.PAGE_START); frame.add(new JButton("West"), BorderLayout.LINE_START); frame.add(new JButton("East"), BorderLayout.LINE_END); frame.add(new JButton("Center"), BorderLayout.CENTER); JButton southBotton = new JButton("South"); southBotton.setPreferredSize(new Dimension(100, 60)); frame.add(southBotton, BorderLayout.PAGE_END); frame.setVisible(true); } }
c88670e38eaa95500aa266980f5eb7f2f8f30ef4
0644590e7e787c1962ab571e5f62341000a5b8c1
/Xmal_1/Xmal_1/Xmal_1.Android/obj/Debug/90/android/src/crc647152c3a05c5ca8c4/MainActivity.java
b15cb4e9634d98d0997a0fd7b0a189289aacfc8a
[]
no_license
TiberiusRexJr/FridgePractice
28d1f4e76dc17023ad89805fb033d15522a4f6cf
e0bb491da731e8eeb2abec4038dd661800f9f69b
refs/heads/master
2022-11-14T02:02:54.372643
2020-07-10T02:10:04
2020-07-10T02:10:04
277,411,830
0
0
null
null
null
null
UTF-8
Java
false
false
1,422
java
package crc647152c3a05c5ca8c4; public class MainActivity extends crc643f46942d9dd1fff9.FormsAppCompatActivity implements mono.android.IGCUserPeer { /** @hide */ public static final String __md_methods; static { __md_methods = "n_onCreate:(Landroid/os/Bundle;)V:GetOnCreate_Landroid_os_Bundle_Handler\n" + "n_onRequestPermissionsResult:(I[Ljava/lang/String;[I)V:GetOnRequestPermissionsResult_IarrayLjava_lang_String_arrayIHandler\n" + ""; mono.android.Runtime.register ("Xmal_1.Droid.MainActivity, Xmal_1.Android", MainActivity.class, __md_methods); } public MainActivity () { super (); if (getClass () == MainActivity.class) mono.android.TypeManager.Activate ("Xmal_1.Droid.MainActivity, Xmal_1.Android", "", this, new java.lang.Object[] { }); } public void onCreate (android.os.Bundle p0) { n_onCreate (p0); } private native void n_onCreate (android.os.Bundle p0); public void onRequestPermissionsResult (int p0, java.lang.String[] p1, int[] p2) { n_onRequestPermissionsResult (p0, p1, p2); } private native void n_onRequestPermissionsResult (int p0, java.lang.String[] p1, int[] p2); private java.util.ArrayList refList; public void monodroidAddReference (java.lang.Object obj) { if (refList == null) refList = new java.util.ArrayList (); refList.add (obj); } public void monodroidClearReferences () { if (refList != null) refList.clear (); } }
888a5bd6e512675662b5b891acced7a914944dad
eeda8628333c0500d02434e9273dc0936f5a70d7
/Java/Spring/Assignments Day 2/Day2SpringProjects/Vivek10_01-SpecialBean-CustomPropertyEditor/test/TestPhoneEditor.java
7c692278ead94f2919fd2f81075ec5b4c098fa8f
[]
no_license
manasjoshi1/PerennialTraining
8edefaa3a7cf4a19660f77677a133b8ac96edde2
aeba9a7ed6d2d5584694df2c7434cb70a47a6bdc
refs/heads/main
2023-04-03T00:17:39.407450
2021-04-08T09:51:06
2021-04-08T09:51:06
345,991,291
0
0
null
null
null
null
UTF-8
Java
false
false
448
java
import java.util.Collection; import java.util.List; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class TestPhoneEditor { /** * @param args */ public static void main(String[] args) { ApplicationContext ctx =new ClassPathXmlApplicationContext("application-list.config.xml"); System.out.println(ctx.getBean("contact")); } }
[ "Manas Joshi" ]
Manas Joshi
8bc0bff47623b7847cc0afc968e65bb913df54fc
a7c716bad711b569fd575b17f5feccec8e5966bb
/education_kinder/src/main/java/com/muji/zh/config/WebConfig.java
5bd738f60c32b0f6e71d287abe75e766c327385d
[]
no_license
liuwenqi9/kinderEducation
1d4da26e412a365d95e0decbc5b37951bf358630
fc2933321feb21a95a5d3a1b75f1c188ddedf180
refs/heads/master
2020-04-30T08:57:23.328662
2019-01-15T13:29:18
2019-01-15T13:29:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,335
java
package com.muji.zh.config; import com.muji.zh.interceptor.LoginInterceptor; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; /** * Created by Administrator on 2018/9/7/007. */ @Configuration public class WebConfig extends WebMvcConfigurerAdapter { public WebConfig(){ super(); } // @Override // public void addResourceHandlers(ResourceHandlerRegistry registry) { // registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/"); // registry.addResourceHandler("/templates/**").addResourceLocations("classpath:/templates/"); // // super.addResourceHandlers(registry); // } // // // // @Override // public void addInterceptors(InterceptorRegistry registry) { // //拦截规则:除了/index,/system/user/validate其他都拦截判断 // registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**").excludePathPatterns("/tologin","/login","/getImage","/css/**","/js/**","/images/**","/fonts/**","/lib/**","/templates/**"); // super.addInterceptors(registry); // } }
117d25f3a6108fe77788ff185b48cb34ea731632
156f5a6314dfe13f83662d3d081fc8f8839db71c
/app/src/main/java/com/saegil/comivo/Landing/ConfirmActivity.java
26602a55715c66ddbe76412c0e9b91194cd44dd5
[]
no_license
RyanHan2017/Comivo
7de0aa050247462d1a061fbb253b7e7959eb2de1
54ce59e44d8a846568a5503012c7ca15e76487bb
refs/heads/master
2021-01-19T11:58:17.333501
2017-04-12T03:55:22
2017-04-12T03:55:22
88,007,913
0
0
null
null
null
null
UTF-8
Java
false
false
1,509
java
package com.saegil.comivo.Landing; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.view.View; import android.widget.Button; import com.saegil.comivo.R; public class ConfirmActivity extends AppCompatActivity { Toolbar mToolbar; Button resetPasswordButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_confirm); mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); resetPasswordButton=(Button)findViewById(R.id.reset_password_button); resetPasswordButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent=new Intent(ConfirmActivity.this,ChangePasswordActivity.class); startActivity(intent); } }); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: { finish(); return true; } default: { return super.onOptionsItemSelected(item); } } } }
d93c8efe16150b0cb8033d146b89d47d850d92d2
660d459282c761a7d21c900b0ccbb888297e0052
/src/main/java/com/epam/project/webappcourses/dao/implemented_dao/JDBCUserDao.java
f5e67f3d83e7bd0d05ae6d0df3f96549c7dd2b07
[]
no_license
Cunning0fDesires/Courses-App
a195556a1e8dcaccfcf2a909e40d245b7e176046
b3a3f36e4a88f0326ddddb63fc210df92ea11411
refs/heads/master
2023-08-30T02:14:37.981245
2021-11-02T17:02:37
2021-11-02T17:02:37
422,897,596
0
0
null
null
null
null
UTF-8
Java
false
false
8,546
java
package com.epam.project.webappcourses.dao.implemented_dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.SQLIntegrityConstraintViolationException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import org.apache.log4j.Logger; import com.epam.project.webappcourses.dao.ConnectionPool; import com.epam.project.webappcourses.dao.SQLConstants; import com.epam.project.webappcourses.dao.abstract_dao.UserDao; import com.epam.project.webappcourses.dao.mapper.UserMapper; import com.epam.project.webappcourses.entities.User; import com.epam.project.webappcourses.exceptions.DBException; public class JDBCUserDao implements UserDao { final static Logger logger = Logger.getLogger(JDBCUserDao.class); static UserMapper mapper = new UserMapper(); public static int getStatusIdByName(String name) throws DBException { int number = 0; try (Connection connection = ConnectionPool.getConnection(); PreparedStatement pstmt = connection.prepareStatement(SQLConstants.GET_STATUS_ID_BY_NAME)) { pstmt.setString(1, name); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { number = rs.getInt("status_id"); } return number; } catch (SQLException e) { logger.error("There was an error", e); throw new DBException("Failed to find entity", e); } } public static boolean addNewTeacher(User user) throws DBException { boolean result = false; try (Connection connection = ConnectionPool.getConnection(); PreparedStatement pstmt = connection.prepareStatement(SQLConstants.ADD_NEW_TEACHER);) { pstmt.setString(1, user.getLogin()); pstmt.setString(2, user.getName()); pstmt.setString(3, user.getSurname()); pstmt.setString(4, user.getEmail()); pstmt.setString(5, user.getPassword()); result = pstmt.executeUpdate() > 0; } catch (SQLIntegrityConstraintViolationException e) { logger.error("There was an error", e); throw new DBException("Entity already exists", e); } catch (SQLException e) { logger.error("There was an error", e); throw new DBException("Unexpected database error", e); } return result; } public static List<User> getAllTeachers() throws DBException { List<User> users = new ArrayList<>(); try(Connection connection = ConnectionPool.getConnection(); Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(SQLConstants.GET_ALL_TEACHERS);) { while (rs.next()) { users.add(mapper.mapEntity(rs)); } } catch (SQLException e) { logger.error("There was an error", e); System.out.println(e.getMessage()); throw new DBException("Failed to get users", e); } return users; } public static User getUserByLogin(String login) throws DBException { List<User> users = new ArrayList<>(); try (Connection connection = ConnectionPool.getConnection(); PreparedStatement pstmt = connection.prepareStatement(SQLConstants.GET_USER_BY_LOGIN)) { pstmt.setString(1, login); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { users.add(mapper.mapEntity(rs)); } return users.get(0); } catch (SQLException e) { logger.error("There was an error", e); throw new DBException("Failed to find user", e); } } private void close(AutoCloseable object) { if (object != null) { try { object.close(); } catch (Exception e) { } } } @Override public List<User> getUsersByRole(int role) throws DBException { List<User> users = new ArrayList<>(); try (Connection connection = ConnectionPool.getConnection(); PreparedStatement pstmt = connection.prepareStatement(SQLConstants.GET_USER_BY_ROLE)) { pstmt.setInt(1, role); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { users.add(mapper.mapEntity(rs)); } return users; } catch (SQLException e) { logger.error("There was an error", e); throw new DBException("Failed to find entities", e); } } @Override public boolean updateBlockedStatus(User user, int status) { String statusField = "status"; boolean result = false; result = update(user.getId(), statusField, status); return result; } @Override public User getById(long id) throws DBException { List<User> users = new ArrayList<>(); try (Connection connection = ConnectionPool.getConnection(); PreparedStatement pstmt = connection.prepareStatement(SQLConstants.GET_USER_BY_ID)) { pstmt.setLong(1, id); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { users.add(mapper.mapEntity(rs)); } return users.get(0); } catch (SQLException e) { logger.error("There was an error", e); throw new DBException("Failed to find entity", e); } } @Override public List<User> getAll() throws DBException { List<User> users = new ArrayList<>(); try(Connection connection = ConnectionPool.getConnection(); Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(SQLConstants.GET_ALL_USERS);) { while (rs.next()) { users.add(mapper.mapEntity(rs)); } } catch (SQLException e) { logger.error("There was an error", e); System.out.println(e.getMessage()); throw new DBException("Failed to get users", e); } return users; } @Override public boolean add(User user) throws DBException { boolean result = false; try (Connection connection = ConnectionPool.getConnection(); PreparedStatement pstmt = connection.prepareStatement(SQLConstants.ADD_NEW_USER);) { pstmt.setString(3, user.getName()); pstmt.setString(4, user.getSurname()); pstmt.setString(5, user.getEmail()); pstmt.setString(2, user.getLogin()); pstmt.setString(6, user.getPassword()); pstmt.setInt(1, user.getRole()); result = pstmt.executeUpdate() > 0; } catch (SQLIntegrityConstraintViolationException e) { logger.error("There was an error", e); throw new DBException("Entity already exists", e); } catch (SQLException e) { logger.error("There was an error", e); throw new DBException("Unexpected database error", e); } return result; } @Override public boolean update(long id, String field, Object value) { boolean result = false; String sqlQuery = "UPDATE " + SQLConstants.TABLE_USER + " SET " + field + " = ? WHERE user_id = ?;"; try (Connection connection = ConnectionPool.getConnection(); PreparedStatement ps = connection.prepareStatement(sqlQuery);) { ResultSet rs = null; ps.setObject(1, value); ps.setLong(2, id); result = ps.executeUpdate() > 0; } catch (SQLException e) { e.printStackTrace(); } return result; } @Override public boolean deleteById(long id) throws DBException { boolean result = false; Connection connection = null; PreparedStatement pstmt = null; try { connection = ConnectionPool.getConnection(); pstmt = connection.prepareStatement(SQLConstants.DELETE_USER_BY_ID); int index = 1; pstmt.setLong(index, id); result = pstmt.executeUpdate() > 0; } catch (SQLException e) { logger.error("There was an error", e); e.printStackTrace(); throw new DBException("Failed to delete a user with id = " + id, e); } finally { close(connection); } return result; } }
35d8ed303b6ea1aa86f3add33651460097ca6d45
2d2554dea7239aa3403646db1cca5eac2f782202
/src/main/java/com/revolut/repository/TransactionRepositoryImpl.java
bfc69920b66c50adf58c65044a90d62fd598ed04
[]
no_license
antkuznetsov/wallet
1d2fc60afaa0b62f82bc335e12c759ff30712ad4
181b1beb7f0a7f12d6a702853275558b2ab2784b
refs/heads/master
2020-05-28T03:25:27.097315
2019-06-01T07:32:08
2019-06-01T07:32:08
188,866,564
0
0
null
null
null
null
UTF-8
Java
false
false
889
java
package com.revolut.repository; import com.revolut.model.Transaction; import java.time.LocalDateTime; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; public class TransactionRepositoryImpl implements TransactionRepository { private int nextId = 1; private static Map<Long, Transaction> data = new HashMap<>(); public long createTransaction(double amount, long sender, long recipient) { long id = this.nextId++; Transaction transaction = new Transaction(amount, sender, recipient); transaction.setId(id); transaction.setTime(LocalDateTime.now()); data.put(id, transaction); return id; } public List<Transaction> getAllTransactions() { return data.keySet().stream().sorted().map((id) -> data.get(id)).collect(Collectors.toList()); } public Transaction getTransaction(long id) { return data.get(id); } }
ac29a7d2a51225edacd7ee631bf292124b962a4b
e18867994416e81881ecb5680021ac1fc4b228a9
/taotao-rest/src/main/java/com/taotao/rest/pojo/CatNode.java
03e8c88ef30588b44267d52ef210901922c9f122
[]
no_license
lsjhfutseu/com.perfect
8b122c75b45259c9c4a94f0b28ffef98dfc18427
3d3ca00ae11163eef51e75f216411c4f00330605
refs/heads/master
2020-03-12T23:50:05.524629
2018-04-25T13:55:51
2018-04-25T13:55:51
130,874,717
0
0
null
null
null
null
UTF-8
Java
false
false
648
java
package com.taotao.rest.pojo; /** * @author shijun_li * @date 2018年4月3日 下午9:34:04 * */ import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; public class CatNode { @JsonProperty("n") private String name; @JsonProperty("u") private String url; @JsonProperty("i") private List<?> item; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public List<?> getItem() { return item; } public void setItem(List<?> item) { this.item = item; } }
3a9e737fed5e7ce84e95d30d6bdcc115f0f7f49c
25b2571b2dd2a6dc7d274bdd65d3ac06efd0ae30
/app/src/main/java/com/einao/ordersapp/domain/providers/TimeProvider.java
e94631b91101011364a8464293a869b2b07c9504
[]
no_license
anaaguilaralonso/OrdersApp
b4f28795211009d9016779aa61ac48bfbe010f4b
ffd8bfa6dcc6f7bf951f88b9bdb1804f29551c91
refs/heads/master
2021-01-11T23:49:39.673845
2017-01-11T10:55:38
2017-01-11T10:55:38
78,630,546
0
0
null
null
null
null
UTF-8
Java
false
false
121
java
package com.einao.ordersapp.domain.providers; public interface TimeProvider { Long getCurrentTimeInMiliseconds(); }
23bd0e46c04ce52786082eb53a2f6ed22cb6bdec
99608a41c19f1854f8866d8c4d4cf142a6f3df96
/Exercicio2/src/main/java/com/ti2cc/DAO.java
6afb17349315f992f2656529c49d8ec9471278d4
[]
no_license
ReynaldoGaravini/TI2
154eeb28b97397c15d1cfc28c4cfbd33728c971f
94fe561453129ddb7c55de1ed2b41725a35dea44
refs/heads/master
2023-04-04T02:15:25.199737
2021-04-18T23:37:26
2021-04-18T23:37:26
352,379,651
1
0
null
null
null
null
ISO-8859-1
Java
false
false
4,272
java
package com.ti2cc; import java.sql.*; public class DAO { private Connection conexao; public DAO() { conexao = null; } public boolean conectar() { String driverName = "org.postgresql.Driver"; String serverName = "localhost"; String mydatabase = "funcionario"; int porta = 5432; String url = "jdbc:postgresql://" + serverName + ":" + porta +"/" + mydatabase; String username = "ti2cc"; String password = "ti@cc"; boolean status = false; try { Class.forName(driverName); conexao = DriverManager.getConnection(url, username, password); status = (conexao == null); System.out.println("Conexão efetuada com o postgres!"); } catch (ClassNotFoundException e) { System.err.println("Conexão NÃO efetuada com o postgres -- Driver não encontrado -- " + e.getMessage()); } catch (SQLException e) { System.err.println("Conexão NÃO efetuada com o postgres -- " + e.getMessage()); } return status; } public boolean close() { boolean status = false; try { conexao.close(); status = true; } catch (SQLException e) { System.err.println(e.getMessage()); } return status; } public boolean inserirFuncionario(Funcionario funcionario) { boolean status = false; try { Statement st = conexao.createStatement(); st.executeUpdate("INSERT INTO funcionarios (codigo, nome, cpf, sexo) " + "VALUES ("+funcionario.getCodigo()+ ", '" + funcionario.getNome() + "', '" + funcionario.getCPF() + "', '" + funcionario.getSexo() + "');"); st.close(); status = true; } catch (SQLException u) { throw new RuntimeException(u); } return status; } public boolean atualizarFuncionario(Funcionario funcionario) { boolean status = false; try { Statement st = conexao.createStatement(); String sql = "UPDATE funcionarios SET nome = '" + funcionario.getNome() + "', cpf = '" + funcionario.getCPF() + "', sexo = '" + funcionario.getSexo() + "'" + " WHERE codigo = " + funcionario.getCodigo(); st.executeUpdate(sql); st.close(); status = true; } catch (SQLException u) { throw new RuntimeException(u); } return status; } public boolean excluirFuncionario(int codigo) { boolean status = false; try { Statement st = conexao.createStatement(); st.executeUpdate("DELETE FROM funcionarios WHERE codigo = " + codigo); st.close(); status = true; } catch (SQLException u) { throw new RuntimeException(u); } return status; } public Funcionario[] getFuncionarios() { Funcionario[] funcionarios = null; try { Statement st = conexao.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); ResultSet rs = st.executeQuery("SELECT * FROM funcionarios"); if(rs.next()){ rs.last(); funcionarios = new Funcionario[rs.getRow()]; rs.beforeFirst(); for(int i = 0; rs.next(); i++) { funcionarios[i] = new Funcionario(rs.getInt("codigo"), rs.getString("nome"), rs.getString("cpf"), rs.getString("sexo").charAt(0)); } } st.close(); } catch (Exception e) { System.err.println(e.getMessage()); } return funcionarios; } public Funcionario[] getFuncionariosMasculinos() { Funcionario[] funcionarios = null; try { Statement st = conexao.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); ResultSet rs = st.executeQuery("SELECT * FROM funcionario WHERE funcionario.sexo LIKE 'M'"); if(rs.next()){ rs.last(); funcionarios = new Funcionario[rs.getRow()]; rs.beforeFirst(); for(int i = 0; rs.next(); i++) { funcionarios[i] = new Funcionario(rs.getInt("codigo"), rs.getString("nome"), rs.getString("cpf"), rs.getString("sexo").charAt(0)); } } st.close(); } catch (Exception e) { System.err.println(e.getMessage()); } return funcionarios; } }
694eb56bb9ede1e924311ff055465153c4599787
4e97a27e2f21e912b2d5bbf2f51c7af333318089
/src/leetcode13.java
71baf8407528e16c1a71b589737e6431d5ec1483
[]
no_license
sunflower303338469/leetcode
1befbe85e865a9f526b17bf38c37bed199ddb8ea
27b278ef88d7706fd5cd52946c8b2ec33847639f
refs/heads/master
2021-06-17T21:21:35.077755
2021-05-06T06:10:14
2021-05-06T06:10:14
181,305,429
0
0
null
null
null
null
UTF-8
Java
false
false
767
java
import java.util.HashMap; import java.util.Map; /** * Created by xuanmao on 2019/6/6. */ public class leetcode13 { public int romanToInt(String s) { int ans = 0; int pos = 0; int before = 0; Map<Character,Integer> value = new HashMap<>(); value.put('I',1); value.put('V',5); value.put('X',10); value.put('L',50); value.put('C',100); value.put('D',500); value.put('M',1000); while (pos<s.length()){ int v = value.get(s.charAt(pos)); if (v>before){ ans = ans - 2 * before + v; } else { ans = ans + v; } before = v; pos+=1; } return ans; } }
cd46d9a1899d50c43bf9ea3c1ac35ab495b7f3be
050d9e2c4f979ff3c2b70b7365f202fee35e0a9e
/app/src/main/java/com/example/dell/book/adapter/TheLoaiAdapter.java
a5fe2e253d55543a23a80721a59879778a1b1c41
[]
no_license
domanhtuan06869/QuanLySach_DuanMau
e4d488aba07f51ec809b95c42b0b9cfebe748de9
ffc2c3295b9ba396dfd3dff2b30916221eec0e2b
refs/heads/master
2020-04-23T18:43:54.630690
2019-02-19T00:42:59
2019-02-19T00:42:59
171,378,228
0
0
null
null
null
null
UTF-8
Java
false
false
2,874
java
package com.example.dell.book.adapter; import android.app.Activity; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import com.example.dell.book.R; import com.example.dell.book.dao.TheLoaiDao; import com.example.dell.book.model.Theloai; import java.util.List; public class TheLoaiAdapter extends BaseAdapter { List<Theloai> theloaiList; public Activity context; public LayoutInflater inflater; TheLoaiDao theLoaiDao; public TheLoaiAdapter(List<Theloai> theloaiList, Activity context) { super(); this.theloaiList = theloaiList; this.context = context; this.inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); theLoaiDao = new TheLoaiDao(context); } @Override public int getCount() { return theloaiList.size(); } @Override public Object getItem(int position) { return theloaiList.get(position); } @Override public long getItemId(int position) { return 0; } public static class ViewHolder{ ImageView img, imgdelete; TextView txtMaTheLoai,txtTenTheLoai; } @Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView==null){ holder= new ViewHolder(); convertView=inflater.inflate(R.layout.customtheloai,null); holder.img = (ImageView) convertView.findViewById(R.id.imgavatartheloai); holder.txtMaTheLoai = (TextView) convertView.findViewById(R.id.tvmatheloai); holder.txtTenTheLoai = (TextView) convertView.findViewById(R.id.tvtentheloai); holder.imgdelete = (ImageView) convertView.findViewById(R.id.imgdeletetheloai); holder.imgdelete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { theLoaiDao.deleteTheLoaiByID(theloaiList.get(position).getMaTheLoai()); theloaiList.remove(position); notifyDataSetChanged(); } }); convertView.setTag(holder); }else holder=(ViewHolder)convertView.getTag(); Theloai entry =(Theloai)theloaiList.get(position); holder.img.setImageResource(R.drawable.cateicon); holder.txtMaTheLoai.setText(entry.getMaTheLoai()); holder.txtTenTheLoai.setText(entry.getTenTheLoai()); return convertView; } @Override public void notifyDataSetChanged() { super.notifyDataSetChanged(); } public void changeDataset(List<Theloai> items){ this.theloaiList=items; notifyDataSetChanged(); } }
202007e98b8798b6e683da93be3169e6d76d7067
6b019618eace91e0ffd5afb58a67f668527b5bd2
/app/models/PointsList.java
f13b57e1b42882c9bce3303a5719b4b89bca7342
[]
no_license
JuliaMochalova/GeoWebb
7c260e4620051366f8cd121c466d29547212675a
8e06b76d828ff489112ccba9bea3eff3b45b37c7
refs/heads/master
2020-03-18T19:44:46.414027
2018-05-28T14:56:16
2018-05-28T14:56:16
135,175,102
0
0
null
null
null
null
UTF-8
Java
false
false
356
java
package models; import play.db.ebean.Model; import java.util.ArrayList; import java.util.List; public class PointsList extends Model { public List<String[]> pointsList = new ArrayList<>(); //public void add(String[] list){ //PointsList.add(list); //} public String[] get(int i){ return pointsList.get(i); } }
02af09cd594a5f1c2dc941fd7fcbaa0649e19f16
ba9496b2c612abc4590b7fa386542e41042692b8
/lab09/Methods.java
3b49c3a1b1855fc226ebba236037547a67da46dd
[]
no_license
sehguh/CSE2
2f98960265cfd65effe319ec49c9b79f96d36566
87d89060be94fd47e2b286a223ebbee9d81c014e
refs/heads/master
2021-01-16T18:06:36.837764
2015-05-02T22:19:51
2015-05-02T22:19:51
29,748,585
0
0
null
null
null
null
UTF-8
Java
false
false
6,038
java
//Ryan Hughes //03/27/15 //CSE002 //Program that prints out a random gramatically correct sentence import java.util.Scanner;//import the scanner import java.util.Random;//import the random function public class Methods {//declare class public static void main(String [] args){//main method Scanner scan = new Scanner(System.in);//declare and initialize the scanner int x = 1;//declare integer to use while(true){//loop to keep printing sentences if so requested System.out.println("The " + adjective() + " " + noun() + " " + verb() + " the " + adjective() + " " + noun2() + ".");//calls the other methods to form a sentence System.out.println("Press 1 to get another sentence, press 2 to quit: ");//asks the user for another sentence if they want it x = scan.nextInt(); if(x == 1){//ends the program of they press not 2 continue; }else{ return; } } } public static String adjective(){//method for adjective Random rand = new Random();//declares random generator int x = rand.nextInt(10);//creates random number String y = "a"; switch (x){//switch statement determines the adjective that is selected case 0: y = "quick"; break; case 1: y = "slow"; break; case 2: y = "giant"; break; case 3: y = "cunning"; break; case 4: y = "majestic"; break; case 5: y = "miniscule"; break; case 6: y = "rapid"; break; case 7: y = "mysterious"; break; case 8: y = "depressed"; break; case 9: y = "happy"; break; } return y;//returns the word } public static String noun(){//method for noun Random rand = new Random(); int x = rand.nextInt(10);//generates random number String y = "a"; switch (x){//switch to statement to determine the noun case 0: y = "fox"; break; case 1: y = "cheetah"; break; case 2: y = "tiger"; break; case 3: y = "kangaroo"; break; case 4: y = "wolf"; break; case 5: y = "gazelle"; break; case 6: y = "person"; break; case 7: y = "alien"; break; case 8: y = "robot"; break; case 9: y = "velociraptor"; break; } return y;//returns the noun } public static String verb(){//verb method Random rand = new Random(); int x = rand.nextInt(10);//generates random number String y = "a"; switch (x){//switch statement to determine the verb case 0: y = "jumped over"; break; case 1: y = "ate"; break; case 2: y = "fought"; break; case 3: y = "kicked"; break; case 4: y = "stared at"; break; case 5: y = "befriended"; break; case 6: y = "inspired"; break; case 7: y = "confused"; break; case 8: y = "distracted"; break; case 9: y = "scared"; break; } return y;//returns the verb } public static String noun2(){//method for the second noun Random rand = new Random(); int x = rand.nextInt(10);//generates random number String y = "a"; switch (x){//switch statement to determine the second noun case 0: y = "tree"; break; case 1: y = "cat"; break; case 2: y = "donkey"; break; case 3: y = "mouse"; break; case 4: y = "statue"; break; case 5: y = "martian"; break; case 6: y = "platypus"; break; case 7: y = "fish"; break; case 8: y = "witch"; break; case 9: y = "samurai"; break; } return y;//returns the noun } }
2d05d1e6033cf2e2dbd80b9f97123582fc9e8575
4f4a5093e290054be47083bb2d745c664d3b1e10
/src/main/java/com/bishe/exam/dto/RelationDTO.java
1bb357982459ebaa2fffbefe82a2a7dcf815ac29
[]
no_license
HuadongYang/examArrange
5617c419c5632613945494179e0f191e8d641006
4a23d32764c233f4e24e4086a7afc91398c5543a
refs/heads/main
2023-05-04T05:45:51.761911
2021-05-16T07:30:53
2021-05-16T07:30:53
365,462,168
1
0
null
null
null
null
UTF-8
Java
false
false
369
java
package com.bishe.exam.dto; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.bishe.exam.domain.Exam; import com.bishe.exam.domain.Student; import java.util.List; public class RelationDTO { private Exam exam; List<Student> students; }
96b1e01dfdfa6b508119667efd5a661f7e21616f
b57d9d57e66dcf5821927292584902e6aae50080
/src/creational/abstractfactory/interfaces/IDrawable.java
6ea133e22166ac83a1ef07d73f7c922e2ac6649d
[]
no_license
ljmocic/design-patterns
c6dcc2304ef63efbfb1c4ae8ab34d1e9f40a1c9f
cf9e78fd0c56b06f78aed5b8f900cb7e7f0a3f32
refs/heads/master
2021-05-05T21:53:51.401480
2018-01-17T19:14:58
2018-01-17T19:14:58
115,958,245
1
0
null
null
null
null
UTF-8
Java
false
false
98
java
package creational.abstractfactory.interfaces; public interface IDrawable { void draw(); }
45c64dd45fd0fd38538675d5d55c7b4ce68ecca6
cacdf40b1139e160771fe382c1977b1133bc8083
/src/main/java/com/consultoraestrategia/ss_crmeducativo/TabCursoAlumno/adapters/PagerCursoAlumnoAdapter.java
4679ab1024bc5a82d6dc115f3384feaeca3c14bc
[]
no_license
irwindiho/SS_crmeducativo_v2_i
3c90dbfbbb9bdb38052f7256e43992a3bef3b7bd
77ba1258765f2ff8d9a0f95e802f74013f850d7f
refs/heads/master
2020-12-02T16:27:08.198340
2017-07-07T15:59:59
2017-07-07T15:59:59
96,554,501
0
0
null
null
null
null
UTF-8
Java
false
false
2,051
java
package com.consultoraestrategia.ss_crmeducativo.TabCursoAlumno.adapters; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import com.consultoraestrategia.ss_crmeducativo.sesiones.view.fragments.FragmentSesiones; import com.consultoraestrategia.ss_crmeducativo.tareas.view.fragments.FragmentHorario; import com.consultoraestrategia.ss_crmeducativo.tareas.view.fragments.FragmentTareas; /** * Created by irvinmarin on 24/02/2017. */ public class PagerCursoAlumnoAdapter extends FragmentPagerAdapter { private static final String TAG = "PagerCursoAlumnoAdapter"; private int backgroudColor; private int idCargaCurso; //integer to count number of tabs private int tabCount; //Constructor to the class public PagerCursoAlumnoAdapter(FragmentManager fm, int tabCount, int backgroudColor, int idCargaCurso) { super(fm); this.tabCount = tabCount; this.backgroudColor = backgroudColor; this.idCargaCurso = idCargaCurso; } //Overriding method getItem @Override public Fragment getItem(int position) { // Returning the current tabs Bundle bundle1 = new Bundle(); bundle1.putInt("idCargaCurso", idCargaCurso); bundle1.putInt("backgroudColor", backgroudColor); Fragment fragment = null; switch (position) { case 0: fragment = FragmentSesiones.newInstance(); fragment.setArguments(bundle1); break; case 1: fragment = new FragmentTareas(); fragment.setArguments(bundle1); break; case 2: fragment = new FragmentHorario(); fragment.setArguments(bundle1); break; } return fragment; } //Overriden method getCount to get the number of tabs @Override public int getCount() { return tabCount; } }
3cebbd1c055e6b44460edac5f7a89719d6d85dea
ada6db72a5a0725d13526570c69ac84561ae6ba0
/src/main/java/fr/eai/application/rnd/management/web/rest/vm/LoggerVM.java
0496d868124438598e767a4201f3ca8c8157def3
[]
no_license
BulkSecurityGeneratorProject/rnd-management-application
21f5bcfa764cbec6b20a789b3f9aa8f0e29dc12a
71e34e3fabfdffe7b6d5d0f46dd2ce94f5ca0878
refs/heads/master
2022-12-10T01:22:52.412732
2018-10-12T22:43:44
2018-10-12T22:43:44
296,657,927
0
0
null
2020-09-18T15:19:57
2020-09-18T15:19:57
null
UTF-8
Java
false
false
901
java
package fr.eai.application.rnd.management.web.rest.vm; import ch.qos.logback.classic.Logger; /** * View Model object for storing a Logback logger. */ public class LoggerVM { private String name; private String level; public LoggerVM(Logger logger) { this.name = logger.getName(); this.level = logger.getEffectiveLevel().toString(); } public LoggerVM() { // Empty public constructor used by Jackson. } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getLevel() { return level; } public void setLevel(String level) { this.level = level; } @Override public String toString() { return "LoggerVM{" + "name='" + name + '\'' + ", level='" + level + '\'' + '}'; } }
55dc64e7a6928387c1c4911c4afbf0a66cc4c670
4f4d64b39f56e19bbf83c6720ffde9dbb94d9982
/app/src/main/java/com/cjq/yicaijiaoyu/entities/SMSRequestEntity.java
5e3feb27a04402b02ac8875933b1dca959b2b339
[]
no_license
chengjinwu008/YiCaiJiaoYu
15c6679f44125cc859cce511974147eeb61083cf
19077f6c519a93b7829199f49be2db996cb3fdb8
refs/heads/master
2021-01-23T07:02:43.637547
2015-07-20T08:02:24
2015-07-20T08:02:24
37,979,180
0
0
null
null
null
null
UTF-8
Java
false
false
953
java
package com.cjq.yicaijiaoyu.entities; /** * Created by CJQ on 2015/6/29. */ public class SMSRequestEntity { String code; public Data data; public SMSRequestEntity(String code, Data data) { this.code = code; this.data = data; } public SMSRequestEntity() { } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public Data getData() { return data; } public void setData(Data data) { this.data = data; } public static class Data{ String phoneNumber; public Data(String phoneNumber) { this.phoneNumber = phoneNumber; } public Data() { } public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } } }
cc65717dd0b98a3a2305d98031cf989297a5af9e
e7ee311e20b40c87bf6d23a53a1d7b11fd29d2c3
/src/chosun/ciis/ad/pub/ds/AD_PUB_1120_ADataSet.java
4c4ab24f01583a9931eebc237ffbb1d42b4322d7
[]
no_license
nosmoon/misdevteam
4e3695ef7bbdcd231bb84d7d8d7df54a23ff0a60
1829d5bd489eb6dd307ca244f0e183a31a1de773
refs/heads/master
2020-04-15T15:57:05.480056
2019-01-10T01:12:01
2019-01-10T01:12:01
164,812,547
1
0
null
null
null
null
UHC
Java
false
false
2,630
java
/*************************************************************************************************** * 파일명 : * 기능 : * 작성일자 : * 작성자 : ***************************************************************************************************/ /*************************************************************************************************** * 수정내역 : * 수정자 : * 수정일자 : * 백업 : ***************************************************************************************************/ package chosun.ciis.ad.pub.ds; import java.sql.*; import java.util.*; import somo.framework.db.*; import somo.framework.util.*; import chosun.ciis.ad.pub.dm.*; import chosun.ciis.ad.pub.rec.*; /** * */ public class AD_PUB_1120_ADataSet extends somo.framework.db.BaseDataSet implements java.io.Serializable{ public String errcode; public String errmsg; public AD_PUB_1120_ADataSet(){} public AD_PUB_1120_ADataSet(String errcode, String errmsg){ this.errcode = errcode; this.errmsg = errmsg; } public void setErrcode(String errcode){ this.errcode = errcode; } public void setErrmsg(String errmsg){ this.errmsg = errmsg; } public String getErrcode(){ return this.errcode; } public String getErrmsg(){ return this.errmsg; } public void getValues(CallableStatement cstmt) throws SQLException{ this.errcode = Util.checkString(cstmt.getString(1)); this.errmsg = Util.checkString(cstmt.getString(2)); } }/*---------------------------------------------------------------------------------------------------- Web Tier에서 DataSet 객체 관련 코드 작성시 사용하십시오. <% AD_PUB_1120_ADataSet ds = (AD_PUB_1120_ADataSet)request.getAttribute("ds"); %> Web Tier에서 Record 객체 관련 코드 작성시 사용하십시오. ----------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------- Web Tier에서 DataSet 객체의 <%= %> 작성시 사용하십시오. <%= ds.getErrcode()%> <%= ds.getErrmsg()%> ----------------------------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------------------------- Web Tier에서 Record 객체의 <%= %> 작성시 사용하십시오. ----------------------------------------------------------------------------------------------------*/ /* 작성시간 : Wed Oct 07 18:42:09 KST 2009 */
2ba5db3218f0b25b4fbdc3cb12b70738e7ef06f1
10915d6cb5a7d2e9f01faae9aad8315297afd97a
/utils/src/main/java/com/xiaofeng/utils/designpatterns/bridge/IImageImp.java
7894f2e175d7877ccc0cb63ac8ad2cb18d0a8618
[ "MIT" ]
permissive
nellochen/springboot-start
d6184afd7f4759240a48bc0cc689e954f27ef91b
21dbc516326ac5f4c6981659395093335a5f775a
refs/heads/master
2021-01-19T02:08:43.235541
2017-07-28T03:36:52
2017-07-28T03:36:52
87,262,945
1
0
null
null
null
null
UTF-8
Java
false
false
242
java
package com.xiaofeng.utils.designpatterns.bridge; /** * @author Chen Xiaofeng * @version 1.0.0 * @date 2017/07/19 * @email [email protected] */ public interface IImageImp { public void doPaint(Matrix m); //显示像素矩阵m }
b0b024f51647bcdfcd66f7d4c171ce5df621b352
d46502880935eb01eb160d200b977962625e0a27
/android/app/src/main/java/com/blixtwallet/LndMobileToolsPackage.java
17041b54d95a409bc81d20cd642d34875fc1897a
[ "MIT" ]
permissive
hsjoberg/blixt-wallet
2818550f4a6d596a21cd23cd1f3aafbe6948776e
b15e2b415f4b17da946b400f0c9e2a7b03676955
refs/heads/master
2023-08-31T19:21:16.382631
2023-08-28T15:04:07
2023-08-28T15:04:07
197,743,202
332
67
MIT
2023-09-05T19:42:48
2019-07-19T09:20:57
TypeScript
UTF-8
Java
false
false
666
java
package com.blixtwallet; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; import java.util.Arrays; import java.util.Collections; import java.util.List; public class LndMobileToolsPackage implements ReactPackage { @Override public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { return Collections.emptyList(); } @Override public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { return Arrays.asList(new LndMobileTools(reactContext)); } }
7b1bc47248a53bd7550d57ef6048c80563d38a65
12c564b17a4dd74fcf84ea36914f97a885c50801
/src/org/sustudio/concise/core/statistics/ConciseMultivariate.java
2c3f88e21a9cba0f139716c0efd77cfaba1987e8
[]
no_license
jardar/concise-core
27a8beae8613a9bd1478ad0013d00cd388abf10d
1524ff92bb0774ec5d2e8219de39c243c9f1076e
refs/heads/master
2021-01-24T23:41:56.067058
2014-10-18T09:38:46
2014-10-18T09:38:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,145
java
package org.sustudio.concise.core.statistics; import java.util.List; import org.sustudio.concise.core.Workspace; public abstract class ConciseMultivariate { public static final double SMALL = -1.0e10; public static final double MAXVAL = 1.0e12; protected final Workspace workspace; protected final boolean showPartOfSpeech; public ConciseMultivariate(Workspace workspace, boolean showPartOfSpeech) { this.workspace = workspace; this.showPartOfSpeech = showPartOfSpeech; } public abstract void setWords(List<String> words) throws Exception; /** * 傳回文字的投影坐標(僅看 Factor1(x) 和 Factor2(y) 的投影) * @return */ public abstract List<WordPlotData> getRowProjectionData(); /** * 傳回文件的投影坐標(僅看 Factor1(x) 和 Factor2(y) 的投影) * @return */ public abstract List<DocumentPlotData> getColProjectionData(); /** * returns the Eigenvalues * @return */ public abstract double[] getEigenvalues(); /** * returns rates of inertia (or explained) * @return */ public abstract double[] getRates(); public abstract Object getResult(); }
9775f6b32dd6e8f168e97dfd5ca66bd1d29633bd
eec968da61a6a91a790321911c8b19bc85fc2a12
/DesignPattern/src/com/bridgelabz/designpattern/adapter/SocketObjectAdapterImpl.java
dfa1ea17d9c14ca1fe180efba8db7a35d3d614da
[]
no_license
Priya1508/Object_Oriented_Programs
75c3ce7aaadefb1fcb6aefb6b85efc2d7638ab82
0b991a75ffa63ecd771da9ae993927379f05a085
refs/heads/master
2020-11-25T10:37:46.945814
2020-01-18T12:17:46
2020-01-18T12:17:46
228,622,825
0
0
null
null
null
null
UTF-8
Java
false
false
542
java
package com.bridgelabz.designpattern.adapter; public class SocketObjectAdapterImpl implements SocketAdapter { //Using Composition for adapter pattern private Socket sock = new Socket(); @Override public Volt get120Volt() { return sock.getVolt(); } @Override public Volt get12Volt() { Volt v= sock.getVolt(); return convertVolt(v,10); } @Override public Volt get3Volt() { Volt v= sock.getVolt(); return convertVolt(v,40); } private Volt convertVolt(Volt v, int i) { return new Volt(v.getVolts()/i); } }
e2a56184fb5066903e358db8952f70abd75f0ff4
f661135eb559a6571b19af978f9e0ce9c20cc972
/TableAllocationProj/src/com/tap/ui/OrderDialog.java
48215ec39ee24585189a90d5d6d00b8fe45ec560
[]
no_license
ccxuy/TableAllocationProj
9959a2341b7dd9aa765e9d40e94bdcf6d34a7a17
0d331fa45d2559833736a277c6820b9b24dad104
refs/heads/master
2020-03-27T18:43:49.631563
2013-07-25T01:14:52
2013-07-25T01:14:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,175
java
package com.tap.ui; import org.eclipse.swt.widgets.Dialog; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Button; import org.eclipse.ui.internal.dnd.SwtUtil; import com.tap.tableordersys.BookOrder; import com.tap.tableordersys.Order; public class OrderDialog extends Dialog { protected Object result; protected Shell shell; private Text text; private Text text_1; private Text text_2; private Text text_3; private Text text_4; private Text text_5; private Order order; /** * Create the dialog. * @param parent * @param style */ public OrderDialog(Shell parent, Order o) { super(parent, SWT.INHERIT_DEFAULT); setText("SWT Dialog"); this.order = o; } /** * Open the dialog. * @return the result */ public Object open() { createContents(); shell.open(); shell.layout(); Display display = getParent().getDisplay(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return result; } /** * Create contents of the dialog. */ private void createContents() { shell = new Shell(getParent(), getStyle()); shell.setSize(266, 268); shell.setText("Order"); Label lblNewLabel = new Label(shell, SWT.NONE); lblNewLabel.setBounds(33, 39, 61, 17); lblNewLabel.setText("ID:"); text = new Text(shell, SWT.BORDER); text.setBounds(141, 36, 73, 23); text.setText(order.getOrderID()); Label lblNewLabel_1 = new Label(shell, SWT.NONE); lblNewLabel_1.setBounds(33, 72, 61, 17); lblNewLabel_1.setText("Operator:"); text_1 = new Text(shell, SWT.BORDER); text_1.setBounds(141, 72, 73, 23); text_1.setText(order.getOperatorID()); Label lblNewLabel_2 = new Label(shell, SWT.NONE); lblNewLabel_2.setBounds(33, 107, 61, 17); lblNewLabel_2.setText("Table ID:"); text_2 = new Text(shell, SWT.BORDER); text_2.setBounds(141, 101, 73, 23); text_2.setText(order.getTable().getId()); Label lblNewLabel_3 = new Label(shell, SWT.NONE); lblNewLabel_3.setBounds(33, 139, 61, 17); lblNewLabel_3.setText("Guest ID:"); text_3 = new Text(shell, SWT.BORDER); text_3.setBounds(141, 133, 73, 23); text_3.setText(order.getGusets().getId()); Label lblNewLabel_4 = new Label(shell, SWT.NONE); lblNewLabel_4.setBounds(33, 178, 73, 17); lblNewLabel_4.setText("Guest amout:"); text_4 = new Text(shell, SWT.BORDER); text_4.setBounds(141, 172, 73, 23); text_4.setText(order.getGusets().getId()); if(order instanceof BookOrder){ Label lblBookTime = new Label(shell, SWT.NONE); lblBookTime.setBounds(33, 215, 73, 17); lblBookTime.setText("Book time:"); text_5 = new Text(shell, SWT.BORDER); text_5.setBounds(141, 213, 73, 23); text_5.setText( ((BookOrder)order).getBookTime().toString() ); } Button btnConfirm = new Button(shell, SWT.NONE); btnConfirm.setBounds(83, 250, 80, 27); btnConfirm.setText("Confirm"); } }
a9abca02210df7962957e0d30aefdf5aab3c927e
5b12c002ed670d01d365336608ac836bb4bfa75f
/src/main/java/week05d03/ListCounter.java
ea1c7889106f74422ec7ea7c6a74f1a5dd3313d9
[]
no_license
suvegtamas/training-solutions
d39b56939456a47b40d1ec1f68e0b4b5bbe89c40
5cbaae8bc804fb918904056e2858f3f89bd73727
refs/heads/master
2023-03-26T14:12:45.498101
2021-03-16T13:51:40
2021-03-16T13:51:40
308,285,673
0
0
null
null
null
null
UTF-8
Java
false
false
470
java
package week05d03; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class ListCounter { private static final String FIRST_LETTER = "A"; public int countElements(List<String> elements) { int count = 0; for (String item : elements) { if (item.startsWith(FIRST_LETTER) || item.startsWith(FIRST_LETTER.toLowerCase())) { count++; } } return count; } }
2e3cb18cc676d5eae79cdd7754d10c947144d442
4bee0c98ee96a51b69d0fb83928ba4f86e5b2580
/HelthCare/src/com/userService.java
491ff94aac7139dad3bd4956aca8b398b5b6fd63
[]
no_license
EdithZhu/HelthCare-online-hospital-management-system-
898f86ae7137e57ae20d352ebe3371fbc3681cc8
de953a3f596b3bc9bea8437d63b7851642441bc2
refs/heads/master
2022-06-15T07:44:03.509627
2020-05-06T08:04:40
2020-05-06T08:04:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,308
java
package com; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import model.Users; import com.google.gson.*; import org.jsoup.*; import org.jsoup.parser.*; import org.jsoup.nodes.Document; @Path("/Users") public class userService { //Creating an object of User class Users users = new Users(); //Read all Users @GET @Path("/") @Produces({MediaType.APPLICATION_XML, MediaType.TEXT_HTML}) public String readItems() { return users.readUser(); } //creating a new record @POST @Path("/") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.TEXT_PLAIN) public String insertUser(@FormParam("userID") String userID, @FormParam("fName") String fName, @FormParam("lName") String lName, @FormParam("email") String email, @FormParam("nic") String nic, @FormParam("phone") String phone, @FormParam("password") String password, @FormParam("confirmPass") String confirmPass){ String output = users.insertUser(userID, fName, lName, nic, phone, password, confirmPass); return output; } //Updating an available record using ID @PUT @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.TEXT_PLAIN) public String updateItem(String userData) { JsonObject userObject = new JsonParser().parse(userData).getAsJsonObject(); String userID = userObject.get("userID").getAsString(); String fName = userObject.get("fName").getAsString(); String lName = userObject.get("lName").getAsString(); String email = userObject.get("email").getAsString(); String nic = userObject.get("nic").getAsString(); String phone = userObject.get("phone").getAsString(); String password = userObject.get("password").getAsString(); String confirmPass = userObject.get("confirmPass").getAsString(); String output = users.UpdateUser(userID, fName, lName, email, nic, phone, password, confirmPass); return output; } @DELETE @Path("/") @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.TEXT_PLAIN) public String deleteItem(String userData) { Document document = Jsoup.parse(userData, "", Parser.xmlParser()); //Read the value from the element <itemID> String userID = document.select("userID").text(); String output = users.deleteUser(userID); return output; } }
9d348c81cbf6dbabb8c40f52648b63f61304993a
5f0a38a19de575fe21f341cbfae4acafb4fd3f6c
/app/src/androidTest/java/com/example/cryptx/mymusic/ExampleInstrumentedTest.java
8e204cdd1a105baa85d65c5116f3769f40fff926
[]
no_license
TushCN/MyMusic
02fd637c2222687741fc6910320c5e023d9f4173
cc1561f23e874c665872579c7e78447f278ef156
refs/heads/master
2021-07-08T05:50:35.873415
2017-10-06T17:12:08
2017-10-06T17:12:08
106,030,585
0
0
null
null
null
null
UTF-8
Java
false
false
756
java
package com.example.cryptx.mymusic; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.cryptx.mymusic", appContext.getPackageName()); } }
[ "tusharyadav14111997gmail.com" ]
tusharyadav14111997gmail.com
3f4194a382b292ad2646ca46edc566b834d437aa
8acfc429105b89e455222c5070c7aa7cbf5290c5
/projectBooking/src/main/java/src/main/Model/Response/UserResponse.java
c2608f5ebe51f3d0a60169a31ac3a408a63037b7
[]
no_license
duc96/booking
833df6dbffe65ece41ab03ab992009475c218b26
596d4bb77f91d350e0227118a708475d81f3983e
refs/heads/master
2022-12-23T02:15:10.618164
2019-10-10T12:14:10
2019-10-10T12:14:10
208,821,834
0
1
null
2022-12-16T05:05:40
2019-09-16T14:33:54
JavaScript
UTF-8
Java
false
false
1,130
java
package src.main.Model.Response; import java.text.SimpleDateFormat; import java.util.Date; import src.main.java.booking.AdminUsers; public class UserResponse { private Integer id; private Integer index; private String email; private String fullname; private String address1; private String address2; private String city; private String country; private String zipcode; private String cretatedate; private String status; public void serialize(AdminUsers user) { this.email = user.getEmail(); this.fullname = user.getFullname(); this.address1 = user.getAddress1(); this.address2 = user.getAddress2(); this.city = user.getCity(); this.country = user.getCountry(); this.zipcode = user.getZipcode(); this.id = user.getUserId(); this.status = "Hoạt động"; SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyy"); this.cretatedate = format.format(user.getCretatedate()); if(user.getIsdeleted() == 1) { this.status = "Khoá"; } } public Integer getIndex() { return this.index; } public void setIndex(Integer index) { this.index = index; } }
7907a8c067847b84b5095db9ea5beeb0f0b83aa8
8b13280c95748e773170a22fbd85edd94947ae39
/common/src/main/java/com/prime/common/response/TokenResponse.java
86164fef1e684cc444dee8fe2b3de910b832eb07
[]
no_license
yogeshjadhav95/java-microservice-setup
a2020525a59fb811320899934317fd235bce4b45
7c9aad747126efd42af2bc418632718953bf5e2e
refs/heads/main
2023-06-20T10:12:41.623021
2021-07-22T05:16:56
2021-07-22T05:16:56
388,333,479
1
0
null
null
null
null
UTF-8
Java
false
false
304
java
package com.prime.common.response; import lombok.Getter; import lombok.Setter; @Getter @Setter public class TokenResponse { public TokenResponse(String token, String refreshToken) { this.token = token; this.refreshToken = refreshToken; } private String token; private String refreshToken; }
c60526a4c5064c21f703db3e4d00692c5b275e9c
781091b7d8a9549de1d62b55a970c17cdc38ddc9
/src/main/java/com/smn/apivendas/serializers/VendaItemDeserialize.java
2400f8477e8f8dec77cd5eab98b2bddd5271f170
[]
no_license
ThallesMendes/spring-rest-api-vendas-example
991760d7ad3e8f28c95a6a07c88e010602128a31
84f5c0b5e8c2001d445ff3ce72ddac1f665f3ab0
refs/heads/master
2021-05-13T11:21:23.123651
2018-01-11T19:56:40
2018-01-11T19:56:40
117,120,518
0
0
null
null
null
null
UTF-8
Java
false
false
1,861
java
package com.smn.apivendas.serializers; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.*; import com.smn.apivendas.models.Produto; import com.smn.apivendas.models.VendaItem; import com.smn.apivendas.services.ProdutoServiceImpl; import org.springframework.beans.factory.annotation.Autowired; import java.io.IOException; public class VendaItemDeserialize extends JsonDeserializer<VendaItem> { @Autowired private ProdutoServiceImpl produtoService; @Override public VendaItem deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException { JsonNode node = p.readValueAsTree(); VendaItem vendaItem = new VendaItem(); Produto produto = null; if(node.hasNonNull("produto_id")) { Long produtoId = node.get("produto_id").asLong(); produto = (produtoId > 0) ? produtoService.find(produtoId) : null; } if(node.hasNonNull("valor_unitario")) vendaItem.setValor_unitario(node.get("valor_unitario").asDouble()); if(node.hasNonNull("quantidade")) vendaItem.setQuantidade(node.get("quantidade").asDouble()); if(node.hasNonNull("quantidade_devolvido")) vendaItem.setQuantidade_devolvido(node.get("quantidade_devolvido").asDouble()); if(node.hasNonNull("valor_desconto")) vendaItem.setValor_desconto(node.get("valor_desconto").asDouble()); if(node.hasNonNull("valor_total")) vendaItem.setValor_total(node.get("valor_total").asDouble()); if(node.hasNonNull("devolvido")) vendaItem.setDevolvido(node.get("devolvido").asBoolean()); if (produto != null) vendaItem.setProdutoId(produto); return vendaItem; } }
89f5513bfc7ce99e39b4dfcdd75c88a58750f62d
6d17c72acbb53f1d3e38222fa9935d2a4a4da937
/src/com/sj/service/IPeriodicalsService.java
6b4fa45e490f46651168ca2a2a70b64a7123a497
[]
no_license
MsTiny/sj
cb536914b6f08973a514a9aed66a271c41011fa0
d7a573f689426d79059df914626cb26f6ceddc7c
refs/heads/master
2021-01-15T13:29:03.286113
2017-06-27T03:30:29
2017-06-27T03:30:29
99,674,629
1
0
null
2017-08-08T09:21:06
2017-08-08T09:21:06
null
UTF-8
Java
false
false
508
java
package com.sj.service; import java.util.List; import com.sj.entity.Periodicals; public interface IPeriodicalsService extends IBaseService<Periodicals>{ /** * 获取最期刊 * @return */ public List<Periodicals> getnewPeriodicals(); public List<Periodicals> getnewPeriodicals(Integer page,Integer row); public List<Periodicals> getnewPeriodicals(Integer cp, Integer row, Integer type, String keycontect); public List<Periodicals> getLikeperiodicals(List<Periodicals> periodicals); }
0848f6bab24e2b4f395344442dc8a81bb196b255
e7c0d76de7dd99fecf667e6591c8deed7bd5292e
/tutorial-4/src/main/java/com/apap/tutorial4/service/DealerServiceImpl.java
e34365fefb0b48db645289de1c0f1bb3f51b9945
[]
no_license
deanalmira/Apap-2018-tutorial4_1606918181
28c89f38f8f2e2b1faebad0995f74d385132e759
d20577ea009847bf048b0252173a5e9a5902492e
refs/heads/master
2020-03-30T20:50:17.552339
2018-10-04T16:56:56
2018-10-04T16:56:56
151,604,587
0
0
null
null
null
null
UTF-8
Java
false
false
1,144
java
package com.apap.tutorial4.service; import java.util.Optional; import javax.transaction.Transactional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.apap.tutorial4.model.DealerModel; import com.apap.tutorial4.repository.DealerDb; @Service @Transactional public class DealerServiceImpl implements DealerService{ @Autowired private DealerDb dealerDb; @Override public Optional<DealerModel> getDealerDetailById(Long id){ return dealerDb.findById(id); } @Override public void addDealer(DealerModel dealer) { dealerDb.save(dealer); } @Override public void deleteDealer(DealerModel dealer) { // TODO Auto-generated method stub dealerDb.delete(dealer); } @Override public void updateDealer(long id, Optional<DealerModel> newDealer) { // TODO Auto-generated method stub DealerModel dealer = dealerDb.getOne(id); dealer.setAlamat(newDealer.get().getAlamat()); dealer.setNoTelp(newDealer.get().getNoTelp()); dealerDb.save(dealer); } @Override public DealerDb viewAll() { // TODO Auto-generated method stub return dealerDb; } }
9e1b19e2ea0fe7ac14d9987ef31c26f4dd283893
c6010ea43d7533eb1a4ee78faa6dab0da0dc9606
/app/src/main/java/com/cctv/xiqu/android/widget/WeiboItemView.java
22af50e8739d6904d4ce234536d9f049cef3f1e0
[]
no_license
30962088/c11_as
4a101940adce30a7bdc802db1497dfce59bc872f
c4c152aace91aaf980e85c07291740c46bd66d0c
refs/heads/master
2021-01-13T00:37:31.549784
2016-01-10T08:16:20
2016-01-10T08:16:20
49,358,888
0
0
null
null
null
null
UTF-8
Java
false
false
10,114
java
package com.cctv.xiqu.android.widget; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import com.cctv.xiqu.android.APP; import com.cctv.xiqu.android.PhotoViewActivity; import com.cctv.xiqu.android.WebViewActivity; import com.cctv.xiqu.android.APP.DisplayOptions; import com.cctv.xiqu.android.adapter.WeiboImgAdapter; import com.cctv.xiqu.android.utils.WeiboUtils; import com.cctv.xiqu.android.utils.WeiboUtils.OnSymbolClickLisenter; import com.cctv.xiqu.android.utils.WeiboUtils.Synbol; import com.cctv.xiqu.android.utils.WeiboUtils.WeiboSymboResult; import com.cctv.xiqu.android.utils.WeiboUtils.WeiboSymbol; import com.mengle.lib.utils.Utils; import com.nostra13.universalimageloader.core.ImageLoader; import com.cctv.xiqu.android.R; import android.content.Context; import android.graphics.Color; import android.text.Spannable; import android.text.SpannableString; import android.text.Spanned; import android.text.TextPaint; import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.widget.AdapterView; import android.widget.FrameLayout; import android.widget.GridView; import android.widget.ImageView; import android.widget.TextView; import android.widget.AdapterView.OnItemClickListener; public class WeiboItemView extends FrameLayout{ public static interface OnWeiboItemClickListener{ public void onCommentClick(Model model); public void onItemClick(Model model); } public WeiboItemView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } public WeiboItemView(Context context, AttributeSet attrs) { super(context, attrs); init(); } public WeiboItemView(Context context) { super(context); init(); } private OnWeiboItemClickListener onWeiboItemClickListener; public void setOnWeiboItemClickListener( OnWeiboItemClickListener onWeiboItemClickListener) { this.onWeiboItemClickListener = onWeiboItemClickListener; } public static class Count implements Serializable{ private int share; private int comment; public Count(int share, int comment) { super(); this.share = share; this.comment = comment; } public int getShare() { return share; } public int getComment() { return comment; } } public static class Model implements Serializable { private String id; private String avatar; private String name; private String time; private Content content; private Content retweetedContent; public Model(String id,String avatar, String name, String time, Content content, Content retweetedContent) { super(); this.id = id; this.avatar = avatar; this.name = name; this.time = time; this.content = content; this.retweetedContent = retweetedContent; } public Content getContent() { return content; } public String getId() { return id; } } private ViewHolder holder; private void init() { LayoutInflater.from(getContext()).inflate(R.layout.weibo_item, this); holder = new ViewHolder(); } private static class MyClickSpan extends ClickableSpan{ private OnClickListener onClickListener; public MyClickSpan(OnClickListener onClickListener) { super(); this.onClickListener = onClickListener; } @Override public void onClick(View widget) { onClickListener.onClick(widget); } @Override public void updateDrawState(TextPaint ds) { /*// TODO Auto-generated method stub super.updateDrawState(ds); ds.setColor(Color.BLACK); ds.setUnderlineText(false);*/ } } public void setModel(final Model model) { holder.commentBtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(APP.getSession().getWeiboAccessToken() == null){ Utils.tip(getContext(), "请绑定新浪微博"); return; } if(onWeiboItemClickListener != null){ onWeiboItemClickListener.onCommentClick(model); } } }); holder.container.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(onWeiboItemClickListener != null){ onWeiboItemClickListener.onItemClick(model); } } }); holder.name.setText(model.name); holder.time.setText(model.time); ImageLoader.getInstance().displayImage(model.avatar, holder.avatar, DisplayOptions.IMG.getOptions()); model.content.setContext(getContext()); SpannableString spannableString = model.content.getSpannableString(); spannableString.setSpan(new MyClickSpan(new OnClickListener() { @Override public void onClick(View v) { if(onWeiboItemClickListener != null){ onWeiboItemClickListener.onItemClick(model); } } }), 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); holder.text.setText(spannableString); holder.retweetedPhotogrid.setVisibility(View.GONE); holder.photogrid.setVisibility(View.GONE); if (model.retweetedContent != null) { holder.photogrid.setVisibility(View.GONE); holder.retweeted.setVisibility(View.VISIBLE); model.retweetedContent.setContext(getContext()); SpannableString spannableString1 = model.retweetedContent.getSpannableString(); spannableString1.setSpan(new MyClickSpan(new OnClickListener() { @Override public void onClick(View v) { if(onWeiboItemClickListener != null){ onWeiboItemClickListener.onItemClick(model); } } }), 0, spannableString1.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); holder.retweetedText.setText(spannableString1); // holder.retweetedText.setText(model.retweetedContent.text); holder.retweetedCount.setText("转发("+model.retweetedContent.count.share+")| 评论("+model.retweetedContent.count.comment+")"); if (model.retweetedContent.photos != null) { holder.retweetedPhotogrid.setVisibility(View.VISIBLE); holder.retweetedPhotogrid.setAdapter(new WeiboImgAdapter( getContext(), model.retweetedContent.toModel())); holder.retweetedPhotogrid .setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { onImageClick(model.retweetedContent.getPhotos()); } }); } } else { holder.photogrid.setVisibility(View.VISIBLE); holder.retweeted.setVisibility(View.GONE); if (model.content.photos != null) { holder.photogrid .setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { onImageClick(model.content.getPhotos()); } }); holder.photogrid.setAdapter(new WeiboImgAdapter(getContext(), model.content.toModel())); } } } public class ViewHolder { private View commentBtn; private TextView time; private TextView name; private ImageView avatar; private TextView text; private GridView photogrid; private View retweeted; private TextView retweetedText; private GridView retweetedPhotogrid; private TextView retweetedCount; private View container; public ViewHolder() { container = findViewById(R.id.container); commentBtn = findViewById(R.id.comment_btn); time = (TextView) findViewById(R.id.time); name = (TextView) findViewById(R.id.name); avatar = (ImageView) findViewById(R.id.avatar); text = (TextView) findViewById(R.id.text); text.setMovementMethod(LinkMovementMethod.getInstance()); photogrid = (GridView) findViewById(R.id.photogrid); retweeted = findViewById(R.id.retweeted); retweetedText = (TextView) findViewById(R.id.retweetedText); retweetedText.setMovementMethod(LinkMovementMethod.getInstance()); retweetedPhotogrid = (GridView) findViewById(R.id.retweetedPhotogrid); retweetedCount = (TextView) findViewById(R.id.retweetedCount); } } public static class Photo implements Serializable { private String url; private String real; public Photo(String url, String real) { super(); this.url = url; this.real = real; } public WeiboImgAdapter.Model toModel() { return new WeiboImgAdapter.Model(url); } } public static class Content implements Serializable { private String text; private ArrayList<Photo> photos; private Count count; private transient SpannableString spannableString; public Count getCount() { return count; } public List<Photo> getPhotos() { return photos; } public Content(String text, ArrayList<Photo> photos,Count count) { super(); this.text = text; this.photos = photos; this.count = count; } private transient Context context; public void setContext(Context context) { this.context = context; } public SpannableString getSpannableString() { if (spannableString == null) { ArrayList<WeiboSymboResult> list = WeiboUtils.build(text, new OnSymbolClickLisenter() { @Override public void OnSymbolClick(WeiboSymbol symbol) { if(symbol.getSymbol() == Synbol.URL){ WebViewActivity.open(context, symbol.getText()); } } }); this.spannableString = new SpannableString(text); for (WeiboSymboResult result : list) { this.spannableString.setSpan(result.getClickableString(), result.getStart(), result.getEnd(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } } return spannableString; } public List<WeiboImgAdapter.Model> toModel() { List<WeiboImgAdapter.Model> list = new ArrayList<WeiboImgAdapter.Model>(); for (Photo photo : photos) { list.add(photo.toModel()); } return list; } } private void onImageClick(List<Photo> imgs) { ArrayList<PhotoViewActivity.Photo> list = new ArrayList<PhotoViewActivity.Photo>(); for (Photo photo : imgs) { list.add(new PhotoViewActivity.Photo(photo.url, photo.real)); } PhotoViewActivity.open(getContext(), list); } }
e831372ab85364a5b695b27b66dcde7fe2a08d19
98bcb36b307ce97f2e3a61c720bd0898c00d71f8
/modules/dfp_appengine/src/main/java/com/google/api/ads/dfp/jaxws/v201505/LineItemCreativeAssociationServiceInterfacegetPreviewUrl.java
58bf938a28d807c39bcf4f3f90cac10301d325d3
[ "Apache-2.0" ]
permissive
goliva/googleads-java-lib
7050c16adbdfe1bf966414c1c412124b4f1352cc
ed88ac7508c382453682d18f46e53e9673286039
refs/heads/master
2021-01-22T00:52:23.999379
2015-07-17T22:20:42
2015-07-17T22:20:42
36,671,823
0
1
null
2015-07-17T22:20:42
2015-06-01T15:58:41
Java
UTF-8
Java
false
false
3,445
java
package com.google.api.ads.dfp.jaxws.v201505; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * * Returns an insite preview URL that references the specified site URL with * the specified creative from the association served to it. For Creative Set * previewing you may specify the master creative Id. * * @param lineItemId the ID of the line item, which must already exist * @param creativeId the ID of the creative, which must already exist * @param siteUrl the URL of the site that the creative should be previewed in * @return a URL that references the specified site URL with the specified * creative served to it * * * <p>Java class for getPreviewUrl element declaration. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;element name="getPreviewUrl"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="lineItemId" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="creativeId" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/> * &lt;element name="siteUrl" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "lineItemId", "creativeId", "siteUrl" }) @XmlRootElement(name = "getPreviewUrl") public class LineItemCreativeAssociationServiceInterfacegetPreviewUrl { protected Long lineItemId; protected Long creativeId; protected String siteUrl; /** * Gets the value of the lineItemId property. * * @return * possible object is * {@link Long } * */ public Long getLineItemId() { return lineItemId; } /** * Sets the value of the lineItemId property. * * @param value * allowed object is * {@link Long } * */ public void setLineItemId(Long value) { this.lineItemId = value; } /** * Gets the value of the creativeId property. * * @return * possible object is * {@link Long } * */ public Long getCreativeId() { return creativeId; } /** * Sets the value of the creativeId property. * * @param value * allowed object is * {@link Long } * */ public void setCreativeId(Long value) { this.creativeId = value; } /** * Gets the value of the siteUrl property. * * @return * possible object is * {@link String } * */ public String getSiteUrl() { return siteUrl; } /** * Sets the value of the siteUrl property. * * @param value * allowed object is * {@link String } * */ public void setSiteUrl(String value) { this.siteUrl = value; } }
20f62dc6923cbb182fa9ed86ebc81698d8d924f3
2446637f24c29d84a8c7025c921ca365c71dc108
/server_jsrunner/src/main/java/com/jsrunner/server/models/ScriptExecutionItem.java
e80323b168fcd622872b3406dcbe6e933856842b
[]
no_license
maksympc/jsrunner
4155d44d15e9a01ca5bdc636c68bf9000e220412
dfaa231b348a450eec7fc1bfbc84101410744f88
refs/heads/master
2022-06-05T12:39:01.054166
2021-07-25T19:31:03
2021-07-25T19:31:03
123,016,639
0
0
null
2022-05-20T20:46:29
2018-02-26T19:02:58
Java
UTF-8
Java
false
false
977
java
package com.jsrunner.server.models; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.NonNull; import lombok.Builder; import java.io.StringWriter; import java.util.UUID; @Data @NoArgsConstructor @AllArgsConstructor @Builder public class ScriptExecutionItem { private String sourceCode; private UUID id; private ScriptExecutionStatus status; private StringWriter writer; private StringWriter errorWriter; public ScriptExecutionItem(@NonNull String sourceCode, @NonNull UUID id, @NonNull ScriptExecutionStatus status) { this.sourceCode = sourceCode; this.id = id; this.status = status; writer = new StringWriter(); errorWriter = new StringWriter(); } @Override public String toString() { return "ScriptExecutionItem{" + "sourceCode='" + sourceCode + '\'' + ", id=" + id + '}'; } }
adc2214de45e21536fe177d939f701395b75087d
68102394ed601826c92384977465d4f7d911d95a
/hr-hexagon/src/com/example/hr/repository/EmployeeRepository.java
299587d7e3941434e00a6684ce075c7aeb7aae93
[ "MIT" ]
permissive
deepcloudlabs/dcl350-2021-jun-07
b34724f20fec751e9a31fde95297b89390aa9cf0
05332025909e49b8067657d02eed1bef08c03a92
refs/heads/main
2023-05-21T01:14:28.843633
2021-06-11T13:35:40
2021-06-11T13:35:40
374,163,769
1
0
null
null
null
null
UTF-8
Java
false
false
311
java
package com.example.hr.repository; import com.example.hr.domain.Employee; import com.example.hr.domain.TcKimlikNo; public interface EmployeeRepository { boolean exists(TcKimlikNo tcKimlikNo); void save(Employee employee); Employee findByIdentity(TcKimlikNo kimlik); void remove(Employee employee); }
1356775708adc514c9471d39ffb6569ac3372850
7a2e94f32eac49052d4bc2f85995c07f3d184aa3
/Webproj5/src/com/internousdev/webproj5/util/DBConnector.java
43a15cd6f1fd3567bbb4cb018e29beae3165e818
[]
no_license
sneak9show/test
8a651f02b3994e8f9ef7d5831bccf4c5ce2aadc6
222f527e2ee6ac295f2545a76ab620dd0863da34
refs/heads/master
2020-04-01T13:22:03.925927
2018-12-27T02:43:37
2018-12-27T02:43:37
153,249,714
0
0
null
null
null
null
UTF-8
Java
false
false
822
java
package com.internousdev.webproj5.util; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class DBConnector { /** * JDBCドライバー名 */ private static String driverName="com.mysql.jdbc.Driver"; /** * データベース接続URL */ private static String url="jdbc:mysql://localhost/testdb_webproj5"; /** * データベース接続ユーザ名 */ private static String user="root"; /** * データベース接続パスワード */ private static String password="mysql"; public Connection getConnection(){ Connection con=null; try{ Class.forName(driverName); con=DriverManager.getConnection(url,user,password); }catch(ClassNotFoundException e){ e.printStackTrace(); }catch(SQLException e){ e.printStackTrace(); } return con; } }
745e2f52a4248c136d0554581ee42c01ca49ef34
34201c17e3e99271199158c5b7a16fff7ee78ca8
/java-fundamental/src/ua/lisovoy/multithread/Timer.java
fd7946e339fe4fbbdab98c980b58b6b2bfa005d9
[]
no_license
VladimirLisovoy/java-projects
d31a2009455825d61332dfb97ee9434d249ac581
82090ded01ea935e1787b78053367acd0f915a8b
refs/heads/master
2020-06-13T09:25:22.163963
2016-12-12T09:00:26
2016-12-12T09:00:26
75,427,593
0
0
null
2016-12-12T09:00:26
2016-12-02T20:15:17
Java
UTF-8
Java
false
false
737
java
package ua.lisovoy.multithread; /** * Created by dp-ptcstd-1 on 12/7/2016. */ public class Timer implements Runnable { private final String name; private int secondTillFinish; public Timer(String name, int secondTillFinish) { this.name = name; this.secondTillFinish = secondTillFinish; } @Override public void run() { for (int i = 0; i < secondTillFinish; i++) { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("Name: " + name + ", seconds till finish: " + (secondTillFinish - i)); } System.out.println(name + " finished"); } }
3dc7ece3469fc12a8d56144a8b016f06579284d8
69c3accee241a3dc82c0fe840196e49f906270df
/FRC2018/src/templates/Action.java
5151c83b022304e60d8f55fc8cbbb37048e94209
[]
no_license
SummitRobotics/FRC2018
0d7acef797d5cd78187b60c65a0403a2ba7057a6
cf72d345a89b0143fc74766ee36fbfd5e15a66be
refs/heads/master
2021-04-28T02:27:05.116400
2018-03-18T20:47:23
2018-03-18T20:47:23
122,113,718
1
1
null
2018-07-12T16:18:54
2018-02-19T20:00:59
Java
UTF-8
Java
false
false
950
java
package templates; import org.usfirst.frc.team5468.robot.Hardware; public abstract class Action{ protected Hardware robot; //has this specific action been concluded? protected boolean finished = false; //has this specific action been called before? private boolean started = false; //constructor public Action(Hardware r) { robot = r; } //called by Sequence.java to run the action public final void run() { if(!started) { actionInit(); started = true; } actionPeriodic(); finished = actionFinished(); } //runs when first called public abstract void actionInit(); //runs in an interative fashion public abstract void actionPeriodic(); //conclude iteration or continue public abstract boolean actionFinished(); public final boolean finished() { return finished; } public final boolean started() { return started; } public abstract String getAction(); }
4bac7ce26fc91be89dfa6a9a03fe4b863f2308d0
8b978fdd162e701b58e4269b9e26286a85418a06
/src/main/java/com/minegusta/mgessentials/command/RekCommand.java
177018a1d41c28f2afd76c611a69fde51b5043ee
[]
no_license
saitohirga/LFG-Essentials
08c635b72c61bcceb4e2d133cd3a20048496ef1c
fe1ec1e30145b035859ef4ace1181a83d2ea90c9
refs/heads/master
2021-06-10T15:38:54.892337
2017-01-13T23:59:06
2017-01-13T23:59:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,634
java
package com.minegusta.mgessentials.command; import com.minegusta.mgessentials.util.Title; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class RekCommand implements CommandExecutor { @Override public boolean onCommand(CommandSender s, Command cmd, String label, String[] args) { if ((!s.isOp() && !s.hasPermission("minegusta.rek")) || args.length < 1) { s.sendMessage(ChatColor.RED + "Usage: " + ChatColor.DARK_RED + "/Rek <Name>"); } else { if (args[0].equals("*")) { for (Player p : Bukkit.getOnlinePlayers()) { rekPlayer(p, s.getName()); } s.sendMessage(ChatColor.YELLOW + "You rekt everyone."); return true; } try { Player victim = Bukkit.getPlayer(args[0]); rekPlayer(victim, s.getName()); s.sendMessage(ChatColor.YELLOW + "You rekt " + victim.getName() + "."); } catch (Exception ignored) { s.sendMessage(ChatColor.RED + "That is not an online player!"); } } return true; } private void rekPlayer(Player p, String sender) { Title title = new Title("You got rekt"); title.setSubtitle("By " + sender); title.setTitleColor(ChatColor.RED); title.setFadeInTime(2); title.setStayTime(5); title.setFadeOutTime(2); title.send(p); } }
bd6d11dc00856ad22c01e4388809155f87d7bcce
755d0f42b306b840d0e54fc64920b10b5c4af3ac
/src/main/java/gobbler/domain/Gobble.java
35ed7e524c32e9f70ab392f0341af5491c304a25
[]
no_license
Henrikhi/Gobbler
64dc0c128c68ac33f417b5f713c2e583e3762452
52c2a000f7dde5b50276cf46967d03cf0e31ab43
refs/heads/master
2020-09-30T01:45:37.147128
2019-12-15T10:26:05
2019-12-15T10:26:05
227,169,749
0
0
null
null
null
null
UTF-8
Java
false
false
1,488
java
package gobbler.domain; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; import org.springframework.data.jpa.domain.AbstractPersistable; @Entity @Data @NoArgsConstructor @AllArgsConstructor public class Gobble extends AbstractPersistable<Long> { @ManyToOne private Gobbler gobbler; private String content; private LocalDateTime dateTime; @OneToMany(targetEntity = Comment.class, fetch = FetchType.EAGER) @Fetch(value = FetchMode.SUBSELECT) private List<Comment> comments = new ArrayList<>(); @ManyToMany(targetEntity = Gobbler.class, fetch = FetchType.EAGER) private List<Gobbler> peckers = new ArrayList<>(); public void addComment(Comment comment) { if (!this.comments.contains(comment)) { this.comments.add(comment); } } public void peck(Gobbler gobbler) { if (!this.getPeckers().contains(gobbler)) { this.peckers.add(gobbler); } } public void unpeck(Gobbler gobbler) { if (this.getPeckers().contains(gobbler)) { this.peckers.remove(gobbler); } } }
b7b688797966e85c32c9805f793487bd9814dab4
bad46ece3b6faf4dd522032c6dedebdd463dda66
/src/main/java/com/mycompany/mywebapp/controller/MainController.java
ecf2b5f60ecd4077947c0443bbdde545f53e42e3
[]
no_license
AyeshaMustfa/SpringBoot_Api
58ac43c1ca1723ee839d5bd4968106521dcf4b51
97ca5377c878149ff55936ef8ba5ae5e7297fddf
refs/heads/main
2023-07-14T11:38:02.142272
2021-08-21T15:54:35
2021-08-21T15:54:35
398,361,495
0
0
null
null
null
null
UTF-8
Java
false
false
1,697
java
package com.mycompany.mywebapp.controller; import com.mycompany.mywebapp.domain.Student; import com.mycompany.mywebapp.model.StudentModel; import com.mycompany.mywebapp.service.StudentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("/student") public class MainController { @Autowired private StudentService studentService; private Object Student; private StudentModel student; private Long id; @PostMapping("/add-new-student") public HttpStatus addStudentPost(@RequestBody StudentModel student) { studentService.saveStudent(student); return HttpStatus.ACCEPTED; } @GetMapping("/get-all-student") public List<Student> getAllStudentGet() { return studentService.getAllStudents(); } @GetMapping("/get-student/{id}") public Student getStudentGet(@PathVariable Long id) { return studentService.getStudent(id); } /*@GetMapping("/get-student") public Student showHomePage(@RequestParam Long id) { return studentService.getStudent(id); }*/ @PutMapping("/update-student/{id}") public Student upDateStudentPut(@RequestBody StudentModel student, @PathVariable Long id){ return studentService.updateStudent(student,id); } @DeleteMapping("/delete-student/{id}") public ResponseEntity deleteStudentD( @PathVariable Long id) { studentService.deleteStudent(id); return ResponseEntity.ok().build(); } }
4c7ef08e17abacd19a577414b6e1c2d8ef6f812c
3010e077d66adc8edee1fdc19889be9e5aaa5be8
/client/android/Jokes/platform/gen/com/kb/platform/BuildConfig.java
eb7900a00ddaeebf9f79bcf7ec538a769dc831cb
[]
no_license
weibinke/Jokes
35f460d29edb2bdefa9cad6b473c3842422e8af9
861cfdb92fb05b6b013dcfc273e9ff321d068698
refs/heads/master
2021-03-12T19:17:12.932631
2015-09-01T16:19:08
2015-09-01T16:19:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
157
java
/** Automatically generated file. DO NOT MODIFY */ package com.kb.platform; public final class BuildConfig { public final static boolean DEBUG = true; }
9468bb67264483372eef23757c320d5c2439f34d
6d9b4a7e4c83e26db7372635b9410d568a911cb7
/hw4/SearchCondition.java
09dbaa019effa13cb9ec7b780ce74920cd2c08d8
[ "MIT" ]
permissive
mattmckillip/Coms227
037de4c5a97fa0886f6c68c7b8ff2d398f5e1e77
ae77c93d6f11caff76ca569aa16e850bb3422da6
refs/heads/master
2021-01-01T19:15:53.622654
2015-06-24T03:41:57
2015-06-24T03:41:57
37,960,344
1
0
null
null
null
null
UTF-8
Java
false
false
489
java
package hw4; /** * Abstraction of a search predicate for items. Subtypes * can customize the nature of the search (e.g., exact title, * title keywords, genre, etc.). */ public interface SearchCondition { /** * Determine whether the given item matches this * search condition's criteria for inclusion. * @param item the item to be checked * @return true if the item matches this condition's * criteria, false otherwise */ public boolean matches(Item item); }
0ebd9cd03e67806e9d505d0d39b1b71264848c7c
a464211147d0fd47d2be533a5f0ced0da88f75f9
/EvoSuiteTests/evosuite_2/evosuite-tests/org/mozilla/classfile/TypeInfo_ESTest.java
0a8533315e276442117d9af456f3e9cc9e29db14
[ "MIT" ]
permissive
LASER-UMASS/Swami
63016a6eccf89e4e74ca0ab775e2ef2817b83330
5bdba2b06ccfad9d469f8122c2d39c45ef5b125f
refs/heads/master
2022-05-19T12:22:10.166574
2022-05-12T13:59:18
2022-05-12T13:59:18
170,765,693
11
5
NOASSERTION
2022-05-12T13:59:19
2019-02-14T22:16:01
HTML
UTF-8
Java
false
false
7,572
java
/* * This file was automatically generated by EvoSuite * Wed Aug 01 08:50:14 GMT 2018 */ package org.mozilla.classfile; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; import org.mozilla.classfile.ClassFileWriter; import org.mozilla.classfile.ConstantPool; import org.mozilla.classfile.TypeInfo; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true) public class TypeInfo_ESTest extends TypeInfo_ESTest_scaffolding { @Test(timeout = 4000) public void test00() throws Throwable { ConstantPool constantPool0 = new ConstantPool((ClassFileWriter) null); String string0 = TypeInfo.toString(6, constantPool0); assertEquals("uninitialized_this", string0); assertNotNull(string0); } @Test(timeout = 4000) public void test01() throws Throwable { int[] intArray0 = new int[10]; intArray0[0] = 5; ClassFileWriter classFileWriter0 = new ClassFileWriter("dnJ<R", "wd:MV]", "Psd/nC%C*phw^ZB+.-"); ConstantPool constantPool0 = new ConstantPool(classFileWriter0); TypeInfo.print(intArray0, intArray0, constantPool0); assertArrayEquals(new int[] {5, 0, 0, 0, 0, 0, 0, 0, 0, 0}, intArray0); } @Test(timeout = 4000) public void test02() throws Throwable { ClassFileWriter classFileWriter0 = new ClassFileWriter(";Z-", ";Z-", ";Z-"); ConstantPool constantPool0 = new ConstantPool(classFileWriter0); // Undeclared exception! try { TypeInfo.merge(7, 3, constantPool0); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // bad merge attempt between null and double // verifyException("org.mozilla.classfile.TypeInfo", e); } } @Test(timeout = 4000) public void test03() throws Throwable { ClassFileWriter classFileWriter0 = new ClassFileWriter("No method to add to", "No method to add to", "No method to add to"); ConstantPool constantPool0 = new ConstantPool(classFileWriter0); // Undeclared exception! try { TypeInfo.merge((short)2, (short)8, constantPool0); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // bad merge attempt between float and uninitialized // verifyException("org.mozilla.classfile.TypeInfo", e); } } @Test(timeout = 4000) public void test04() throws Throwable { ConstantPool constantPool0 = new ConstantPool((ClassFileWriter) null); String string0 = TypeInfo.toString(1, constantPool0); assertEquals("int", string0); assertNotNull(string0); } @Test(timeout = 4000) public void test05() throws Throwable { // Undeclared exception! try { TypeInfo.merge(4, 4856, (ConstantPool) null); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // bad type // verifyException("org.mozilla.classfile.TypeInfo", e); } } @Test(timeout = 4000) public void test06() throws Throwable { int int0 = TypeInfo.merge(5, 1287, (ConstantPool) null); assertEquals(1287, int0); } @Test(timeout = 4000) public void test07() throws Throwable { ClassFileWriter classFileWriter0 = new ClassFileWriter(";Z-", ";Z-", ";Z-"); ConstantPool constantPool0 = new ConstantPool(classFileWriter0); int int0 = TypeInfo.merge((short)32, (short)1024, constantPool0); assertEquals(0, int0); } @Test(timeout = 4000) public void test08() throws Throwable { int int0 = TypeInfo.merge(1287, 5, (ConstantPool) null); assertEquals(1287, int0); } @Test(timeout = 4000) public void test09() throws Throwable { boolean boolean0 = TypeInfo.isTwoWords(3); assertTrue(boolean0); } @Test(timeout = 4000) public void test10() throws Throwable { ConstantPool constantPool0 = new ConstantPool((ClassFileWriter) null); // Undeclared exception! try { TypeInfo.getPayloadAsType(6, constantPool0); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // expecting object type // verifyException("org.mozilla.classfile.TypeInfo", e); } } @Test(timeout = 4000) public void test11() throws Throwable { ClassFileWriter classFileWriter0 = new ClassFileWriter("D#3^CCZc%CMe4 $\":", "D#3^CCZc%CMe4 $\":", "D#3^CCZc%CMe4 $\":"); ConstantPool constantPool0 = new ConstantPool(classFileWriter0); // Undeclared exception! try { TypeInfo.merge(519, 7, constantPool0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { } } @Test(timeout = 4000) public void test12() throws Throwable { ClassFileWriter classFileWriter0 = new ClassFileWriter("Z]jJ", "Z]jJ", "Z]jJ"); ConstantPool constantPool0 = new ConstantPool(classFileWriter0); // Undeclared exception! try { TypeInfo.fromType("M", constantPool0); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // bad type // verifyException("org.mozilla.classfile.TypeInfo", e); } } @Test(timeout = 4000) public void test13() throws Throwable { int int0 = TypeInfo.fromType("J", (ConstantPool) null); assertEquals(4, int0); } @Test(timeout = 4000) public void test14() throws Throwable { ClassFileWriter classFileWriter0 = new ClassFileWriter("Sg&", "Sg&", "Sg&"); ConstantPool constantPool0 = new ConstantPool(classFileWriter0); int int0 = TypeInfo.fromType("F", constantPool0); assertEquals(2, int0); } @Test(timeout = 4000) public void test15() throws Throwable { ClassFileWriter classFileWriter0 = new ClassFileWriter("bad operand [8:ze", "bad operand [8:ze", "bad operand [8:ze"); ConstantPool constantPool0 = new ConstantPool(classFileWriter0); int int0 = TypeInfo.fromType("B", constantPool0); assertEquals(1, int0); } @Test(timeout = 4000) public void test16() throws Throwable { ClassFileWriter classFileWriter0 = new ClassFileWriter("bU eArg/ sBGe", "bU eArg/ sBGe", "bU eArg/ sBGe"); ConstantPool constantPool0 = new ConstantPool(classFileWriter0); int int0 = TypeInfo.fromType("D", constantPool0); assertEquals(3, int0); } @Test(timeout = 4000) public void test17() throws Throwable { int int0 = TypeInfo.UNINITIALIZED_VARIABLE(5); assertEquals(1288, int0); } @Test(timeout = 4000) public void test18() throws Throwable { ClassFileWriter classFileWriter0 = new ClassFileWriter("D#3^CCZc%CMe4 $\":", "D#3^CCZc%CMe4 $\":", "D#3^CCZc%CMe4 $\":"); ConstantPool constantPool0 = new ConstantPool(classFileWriter0); TypeInfo.fromType("D#3^CCZc%CMe4 $\":", constantPool0); // Undeclared exception! try { TypeInfo.merge(519, 7, constantPool0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { } } }
479644df1de4cba2ed5661fe67165e93a5924774
919bb3004248518e6463e2d45597c56ab77700d8
/src/AddEmply.java
a72bc8e88827376f2de764842ac955a0fa304ff4
[]
no_license
mohdarif8299/VehicleManagementSystm
6b77a8319a3c2beda6a0d85e9056044a266a3f8a
86f97e8c4c9fc5f877b2e89bf3d6ae540f170f34
refs/heads/master
2022-12-11T07:35:29.209399
2020-06-23T06:00:07
2020-06-23T06:00:07
274,321,678
0
0
null
2020-09-02T11:53:25
2020-06-23T05:58:55
Java
UTF-8
Java
false
false
4,327
java
import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import javax.imageio.ImageIO; import javax.swing.*; public class AddEmply implements ActionListener { JFrame f3; JButton add,cancel; JLabel empnamel,empidl,empphonel,empaddresl; JTextField empnamet,empidt,empphonet,empaddrest; AddEmply() { f3=new JFrame("Add Employee"); try { f3.setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("\\Vehicle-Management-System-master\\src\\images\\adminback-1.png"))))); } catch (IOException e) { e.printStackTrace(); } f3.setSize(400,400); f3.setResizable(false); f3.pack(); f3.setVisible(true); Font font1 = new Font("Arial", Font.BOLD,25);/* Font font2 = new Font("Arial", Font.ITALIC+Font.BOLD,14);*/ empnamel=new JLabel("Name"); empnamel.setBounds(250,100,100,40); empnamel.setForeground(Color.WHITE); empnamel.setFont(font1); empnamet=new JTextField(); empnamet.setBounds(370,100,210,30); empidl=new JLabel("ID"); empidl.setBounds(250,150,100,40); empidl.setForeground(Color.WHITE); empidl.setFont(font1); empidt=new JTextField(); empidt.setBounds(370,150,210,30); empphonel=new JLabel("Phone"); empphonel.setBounds(250,200,100,30); empphonel.setForeground(Color.WHITE); empphonel.setFont(font1); empphonet=new JTextField(); empphonet.setBounds(370,200,210,30); empaddresl=new JLabel("Address"); empaddresl.setBounds(250,250,100,40); empaddresl.setForeground(Color.WHITE); empaddresl.setFont(font1); empaddrest=new JTextField(); empaddrest.setBounds(370,250,210,30); try { add=new JButton("Add",new ImageIcon(ImageIO.read(new File("\\Vehicle-Management-System-master\\src\\images\\addnew.png")))); } catch (IOException e) { e.printStackTrace(); } add.setBounds(250,330,155,50); add.setForeground(Color.decode("#0F5DA6")); try { cancel=new JButton("Cancel",new ImageIcon(ImageIO.read(new File("\\Vehicle-Management-System-master\\src\\images\\cancelico.png")))); } catch (IOException e) { e.printStackTrace(); } cancel.setBounds(425,330,155,50); cancel.setForeground(Color.decode("#0F5DA6")); f3.add(empnamel); f3.add(empnamet); f3.add(empidl); f3.add(empidt); f3.add(empphonel); f3.add(empphonet); f3.add(empaddresl); f3.add(empaddrest); f3.add(add); f3.add(cancel); add.addActionListener(this); cancel.addActionListener(this); } @Override public void actionPerformed(ActionEvent e) { if (e.getSource()==add) { String name=empnamet.getText().toString(); String id=empidt.getText().toString(); String phone=empphonet.getText().toString(); String address=empaddrest.getText().toString(); if(validate()) { try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection cn=DriverManager.getConnection("jdbc:oracle:thin:@Localhost:1521:xe","system","root"); Statement st=cn.createStatement(); st.executeUpdate("Insert into ADDEMPLY values('"+name+"','"+id+"','"+phone+"','"+address+"')"); JOptionPane.showMessageDialog(f3,"Added"); f3.dispose(); new AdminHome(); }catch(Exception excep) { excep.printStackTrace(); } } } if(e.getSource()==cancel) { f3.dispose(); new AdminHome(); } } public Boolean validate() { Boolean check=false; String name=empnamet.getText().toString(); String id=empidt.getText().toString(); String phone=empphonet.getText().toString(); String address=empaddrest.getText().toString(); if(name.length()<3) { check=false; JOptionPane.showMessageDialog(f3,"Fill all the fields"); return check; }else { check=true; } if(id.length()<5) { check=false; JOptionPane.showMessageDialog(f3,"Fill all the fields"); return check; }else { check=true; } if(address.length()<1) { check=false; JOptionPane.showMessageDialog(f3,"Fill all the fields"); return check; }else { check=true; } if(phone.length()<10||name.length()>10) { check=false; JOptionPane.showMessageDialog(f3,"Enter valid phone no"); return check; }else { check=true; } return check; } }
123ca96875d677811dedaabd2275934b3a0f7e27
bb6d5a9f148a6701062c97f4891b98aae65985e6
/ServletBeginner/src/com/duochuan/helloworld/HelloWorld.java
84fd6df176819a090cc5707b4d93cc39367e1a9b
[]
no_license
aprilzhang/servlets
4fe180f17d48a8c0fbccaba1d12d994cdfbf46d3
afb58af3f66c615309e34253a358bbc0a7f26eca
refs/heads/master
2020-05-26T13:45:48.709647
2017-02-19T18:50:28
2017-02-19T18:50:28
82,481,447
0
0
null
null
null
null
UTF-8
Java
false
false
1,218
java
package com.duochuan.helloworld; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class HelloWorld */ @WebServlet("/HelloWorld") public class HelloWorld extends HttpServlet { private static final long serialVersionUID = 1L; /** * Default constructor. */ public HelloWorld() { super(); } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("HelloWorld I am Servlet"); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
f6819dc9814be7abae1f9560a25620344e5c52c4
2c227162bc996003685eff75d0fd498202a02f70
/src/main/java/org/hpccsystems/dashboard/controller/SelectDataController.java
fa01a0de6a00f905bc4d57bdf6777d1c26b178fb
[ "Apache-2.0" ]
permissive
senthilkumar2githup/Dashboard
5fcf1ff064d3433fe8a58a9c29cd8233780a91f6
92514a18c4246576715239ec6284adaa1a1c4c1e
refs/heads/master
2021-01-22T17:14:05.448289
2014-12-19T12:50:13
2014-12-19T12:50:13
27,585,649
0
0
null
2015-11-21T05:42:44
2014-12-05T10:05:53
JavaScript
UTF-8
Java
false
false
22,783
java
package org.hpccsystems.dashboard.controller; import java.io.InputStream; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import javax.xml.bind.JAXBContext; import javax.xml.bind.Unmarshaller; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hpccsystems.dashboard.chart.entity.ChartData; import org.hpccsystems.dashboard.chart.entity.Field; import org.hpccsystems.dashboard.chart.entity.Filter; import org.hpccsystems.dashboard.chart.entity.HpccConnection; import org.hpccsystems.dashboard.chart.entity.HpccConnections; import org.hpccsystems.dashboard.common.Constants; import org.hpccsystems.dashboard.entity.FileMeta; import org.hpccsystems.dashboard.entity.Portlet; import org.hpccsystems.dashboard.entity.QuerySchema; import org.hpccsystems.dashboard.exception.HpccConnectionException; import org.hpccsystems.dashboard.services.ChartService; import org.hpccsystems.dashboard.services.HPCCQueryService; import org.hpccsystems.dashboard.services.HPCCService; import org.hpccsystems.dashboard.util.FileListTreeModel; import org.zkoss.util.resource.Labels; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Sessions; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.SelectEvent; import org.zkoss.zk.ui.select.SelectorComposer; import org.zkoss.zk.ui.select.annotation.Listen; import org.zkoss.zk.ui.select.annotation.VariableResolver; import org.zkoss.zk.ui.select.annotation.Wire; import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.util.Clients; import org.zkoss.zul.Button; import org.zkoss.zul.Checkbox; import org.zkoss.zul.Combobox; import org.zkoss.zul.Comboitem; import org.zkoss.zul.Div; import org.zkoss.zul.Hbox; import org.zkoss.zul.Intbox; import org.zkoss.zul.Label; import org.zkoss.zul.Listbox; import org.zkoss.zul.Listitem; import org.zkoss.zul.Panel; import org.zkoss.zul.Textbox; import org.zkoss.zul.Tree; import org.zkoss.zul.Treecell; import org.zkoss.zul.Treecol; import org.zkoss.zul.Treeitem; import org.zkoss.zul.Treerow; import org.zkoss.zul.Vbox; import org.zkoss.zul.Window; @VariableResolver(org.zkoss.zkplus.spring.DelegatingVariableResolver.class) public class SelectDataController extends SelectorComposer<Component>{ private static final long serialVersionUID = 1L; private static final Log LOG = LogFactory.getLog(SelectDataController.class); @WireVariable private HPCCService hpccService; @WireVariable private ChartService chartService; @WireVariable private HPCCQueryService hpccQueryService; @Wire private Textbox username; @Wire private Textbox password; @Wire private Checkbox sslCheckbox; @Wire private Intbox wssqlport; @Wire private Intbox espport; @Wire private Intbox wsEclPort; @Wire private Combobox fileType; @Wire private Panel formPanel; @Wire private Tree tree; @Wire private Listbox selectedFilesListbox; @Wire private Button visualizeBtn; @Wire private Vbox viewHpccVbox; @Wire private Vbox editHpccVbox; @Wire private Label hpccUrl; @Wire private Combobox clusters; @Wire private Button submitBtn; @Wire private Treecol treeColumn; @Wire private Textbox clusterIp; @Wire private Hbox clusterNameHbox; @Wire private Button getClustersBtn; @Wire private Div roxieportLabel; @Wire private Vbox defaultsContainer; @Wire private Combobox defaultConnections; private ChartData chartData; private Window parentWindow; private HpccConnection hpccConnection; private Portlet portlet; @Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); chartData = (ChartData) Executions.getCurrent().getAttribute(Constants.CHART_DATA); parentWindow = (Window) Executions.getCurrent().getAttribute(Constants.PARENT); hpccConnection = (HpccConnection) Sessions.getCurrent().getAttribute(Constants.HPCC_CONNECTION); portlet = (Portlet)Executions.getCurrent().getAttribute(Constants.PORTLET); //Hides Hpcc data select page,Because common filters enabled if (hpccConnection != null) { editHpccVbox.setVisible(false); viewHpccVbox.setVisible(true); defaultsContainer.setVisible(false); StringBuilder builder = new StringBuilder(); builder.append(hpccConnection.getHostIp()); hpccUrl.setValue(builder.toString()); } else { InputStream is = SelectDataController.class.getClassLoader().getResourceAsStream("hpcc_config.xml"); JAXBContext jaxbContext = JAXBContext.newInstance(HpccConnections.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); HpccConnections connections = (HpccConnections) jaxbUnmarshaller.unmarshal(is); List<HpccConnection> defaulHpccConnections = connections.getHpccConnections(); if(LOG.isDebugEnabled()) { LOG.debug("Default HPCC Connections - " + defaulHpccConnections); } if(!defaulHpccConnections.isEmpty()) { defaultsContainer.setVisible(true); editHpccVbox.setVisible(false); Comboitem comboitem; for (HpccConnection defaultHpccConnection : defaulHpccConnections) { comboitem = new Comboitem(defaultHpccConnection.getName()); if(defaultHpccConnection.getName() == null) { comboitem.setLabel(defaultHpccConnection.getHostIp()); } //if datasource not defined default to logical file if(defaultHpccConnection.getDatasource() == null) { defaultHpccConnection.setDatasource(Constants.LOGICAL_FILE); } comboitem.setValue(defaultHpccConnection); defaultConnections.appendChild(comboitem); } } else { defaultsContainer.setVisible(false); editHpccVbox.setVisible(true); } } //selecting 'logical file' as default fileType.setSelectedIndex(0); //If chartData is null, chart category is not added in EditWidgetController chartData.setIsQuery(false); if(LOG.isDebugEnabled()) { LOG.debug("Checkbox" + sslCheckbox); } } @Listen("onClick = #proceedBtn") public void onProcced(Event event) { chartData.setHpccConnection(hpccConnection); if(constructFileBrowser(hpccConnection)) { Button btn = (Button) event.getTarget(); btn.setDisabled(true); } } @Listen("onClick = #submitBtn") public void onFormSubmit(Event event) { boolean isValidData = validateHpccData(true); if(isValidData){ updateHpccConnectionObject(); if(chartData.getIsQuery()) { treeColumn.setLabel("Choose a query to Visualize"); if(constructQueryBrowser(hpccConnection)) { Button btn = (Button) event.getTarget(); btn.setDisabled(true); } } else { if(LOG.isDebugEnabled()) { LOG.debug("Hpcc Connection - " + hpccConnection); } if(constructFileBrowser(hpccConnection)) { Button btn = (Button) event.getTarget(); btn.setDisabled(true); } } chartData.setHpccConnection(hpccConnection); } } @Listen("onSelect = #defaultConnections") public void onHpccConnectionSelect(SelectEvent<Component, Object> event) { Comboitem comboitem = (Comboitem) event.getSelectedItems().iterator().next(); HpccConnection selectedConnection = comboitem.getValue(); clusterIp.setValue(selectedConnection.getHostIp()); espport.setValue(selectedConnection.getEspPort()); wssqlport.setValue(selectedConnection.getWssqlPort()); wsEclPort.setValue(selectedConnection.getWsEclPort()); username.setValue(selectedConnection.getUsername()); password.setValue(selectedConnection.getPassword()); sslCheckbox.setChecked(selectedConnection.getIsSSL()); for(Component comp: fileType.getChildren()) { comboitem=(Comboitem)comp; if(comboitem.getValue().equals(selectedConnection.getDatasource())) { fileType.setSelectedIndex(comboitem.getIndex()); showHideQueryUIElements(selectedConnection.getDatasource()); break; } } editHpccVbox.setVisible(true); getClusterList(); } @Listen("onClick = #defineConnection") public void onCreateNewConnection() { clusterIp.setValue(null); espport.setValue(null); wssqlport.setValue(null); wsEclPort.setValue(null); username.setValue(null); password.setValue(null); sslCheckbox.setChecked(false); editHpccVbox.setVisible(true); if(Constants.QUERY.equals(fileType.getSelectedItem().getValue())){ showHideQueryUIElements(Constants.QUERY); } defaultConnections.setSelectedItem(null); } private void updateHpccConnectionObject() { if(hpccConnection == null){ hpccConnection = new HpccConnection(); } hpccConnection.setUsername(username.getValue()); hpccConnection.setPassword(password.getValue()); hpccConnection.setHostIp(clusterIp.getValue()); hpccConnection.setIsSSL(sslCheckbox.isChecked()); hpccConnection.setWssqlPort(wssqlport.getValue()); hpccConnection.setEspPort(espport.getValue()); hpccConnection.setWsEclPort(wsEclPort.getValue()); if(clusters.getSelectedItem() != null) { hpccConnection.setClusterType(String.valueOf(clusters.getSelectedItem().getValue())); } chartData.setHpccConnection(hpccConnection); } /**Constructs the Roxie query tree to select files * @param hpccConnection * @return boolean */ private boolean constructQueryBrowser(HpccConnection hpccConnection) { FileMeta fileMeta = new FileMeta(); fileMeta.setScope(""); fileMeta.setFileName("ROOT"); fileMeta.setIsDirectory(true); try { fileMeta.setChildlist(hpccService.getQueries(chartData.getHpccConnection(), chartService.getCharts().get(portlet.getChartType()).getCategory())); } catch (Exception e) { Clients.showNotification(Labels.getLabel("plzCheckProvidedHPCCCrendentials"), "error", username.getParent().getParent(), "after_center", 3000, true); LOG.error(Constants.EXCEPTION, e); return false; } FileListTreeModel fileListTreeModel = new FileListTreeModel(fileMeta, chartData); tree.setModel(fileListTreeModel); tree.setVisible(true); tree.addEventListener(Events.ON_SELECT, new EventListener<SelectEvent<Component, Object>>() { @Override public void onEvent(SelectEvent<Component, Object> event)throws Exception { Tree targetTree = (Tree) event.getTarget(); if(targetTree.getSelectedItems().size() > 1){ //Enabling multiple selection of query only for tree/any Hierarchy chart if(Constants.CATEGORY_HIERARCHY != chartService.getCharts().get(portlet.getChartType()).getCategory()) { Clients.showNotification(Labels.getLabel("chooseOneQuery"),"error", tree, "middle_center", 3000, true); Treeitem item = (Treeitem)event.getSelectedItems().iterator().next(); item.setSelected(false); return; } } selectedFilesListbox.getChildren().clear(); addSelectedItem(targetTree); } }); formPanel.setOpen(false); return true; } @Listen("onSelect = #fileType") public void onSelectFileType(SelectEvent<Component, Object> event){ Comboitem selecteditem = (Comboitem)event.getSelectedItems().iterator().next(); String fileTypeSelected = String.valueOf(selecteditem.getValue()); showHideQueryUIElements(fileTypeSelected); } private void showHideQueryUIElements(String dataSource) { if(Constants.LOGICAL_FILE.equals(dataSource)) { chartData.setIsQuery(false); submitBtn.setLabel(Labels.getLabel("fetchFields")); clusterNameHbox.setVisible(false); // inputParamHbox.setVisible(false); if(hpccConnection != null) { hpccConnection.setClusterType(null); } roxieportLabel.setVisible(false); wsEclPort.setVisible(false); submitBtn.setDisabled(false); }else if(Constants.QUERY.equals(dataSource)){ chartData.setIsQuery(true); submitBtn.setLabel(Labels.getLabel("fetchQueries")); roxieportLabel.setVisible(true); wsEclPort.setVisible(true); if(hpccConnection != null) { hpccConnection.setWsEclPort(null); } clusterNameHbox.setVisible(true); //inputParamHbox.setVisible(true); getClustersBtn.setVisible(true); clusters.setVisible(false); submitBtn.setDisabled(true); } } @Listen("onClick = #getClustersBtn") public void onGetClusters(Event event) { if(validateHpccData(false)) { getClusterList(); } } public void getClusterList() { try { updateHpccConnectionObject(); List<String> clusterNames = hpccService.getClusters(hpccConnection); //Clearing existing clusters clusters.getChildren().clear(); Comboitem comboitem; for (String clusterName : clusterNames) { comboitem = new Comboitem(clusterName); comboitem.setValue(clusterName); clusters.appendChild(comboitem); } getClustersBtn.setVisible(false); clusters.setVisible(true); submitBtn.setDisabled(false); } catch (HpccConnectionException e) { Clients.showNotification(Labels.getLabel("plzCheckProvidedHPCCCrendentials"), "error", username.getParent().getParent(), "after_center", 3000, true); LOG.error(Constants.EXCEPTION, e); } } /** * Validates Hpcc connection data * @return boolean */ private boolean validateHpccData(boolean isSubmit) { if(clusterIp.getValue() == null || clusterIp.getValue().trim().length() == 0){ Clients.showNotification(Labels.getLabel("emptyIP"),"error", clusterIp, "end_center", 3000, true); return false; } else if(espport.getValue() == null || espport.getValue() < 1){ Clients.showNotification(Labels.getLabel("emptyESPPort"),"error", espport, "end_center", 3000, true); return false; } else if(wssqlport.getValue() == null || wssqlport.getValue() < 1){ Clients.showNotification(Labels.getLabel("emptyWSSQLPort"),"error", wssqlport, "end_center", 3000, true); return false; } else if(chartData.getIsQuery() && (wsEclPort.getValue() == null || wsEclPort.getValue() < 1)){ Clients.showNotification(Labels.getLabel("emptyRoxiePort"),"error", wsEclPort, "end_center", 3000, true); return false; } if(isSubmit && chartData.getIsQuery() && (clusters.getSelectedItem() == null)) { Clients.showNotification(Labels.getLabel("emptyClusterName"),"error", clusters, "end_center", 3000, true); return false; } return true; } /**Adds the selected file or query to selectedFileslistbox * @param targetTree */ private void addSelectedItem(Tree targetTree){ Listitem listitem; for (Treeitem treeitem : targetTree.getSelectedItems()) { if(treeitem.getLastChild() instanceof Treerow) { Treerow treerow = (Treerow) treeitem.getLastChild(); Treecell treecell = (Treecell) treerow.getLastChild(); Label label = (Label) treecell.getLastChild(); listitem = new Listitem(label.getValue()); selectedFilesListbox.appendChild(listitem); } else { if(treeitem.isOpen()) { treeitem.setOpen(false); } else { treeitem.setOpen(true); } treeitem.setSelected(false); } } } /** * Constructs the file browser tree to select files * @param hpccConnection * @return * Success or Failure as boolean */ private boolean constructFileBrowser(HpccConnection hpccConnection) { FileMeta fileMeta = new FileMeta(); fileMeta.setScope(""); fileMeta.setFileName("ROOT"); fileMeta.setIsDirectory(true); try { fileMeta.setChildlist(hpccService.getFileList(fileMeta.getScope(), chartData.getHpccConnection())); } catch (Exception e) { Clients.showNotification(Labels.getLabel("plzCheckProvidedHPCCCrendentials"), "error", username.getParent().getParent(), "after_center", 3000, true); LOG.error(Constants.EXCEPTION, e); return false; } FileListTreeModel fileListTreeModel = new FileListTreeModel(fileMeta, chartData); tree.setModel(fileListTreeModel); tree.setVisible(true); tree.addEventListener(Events.ON_SELECT, new EventListener<Event>() { public void onEvent(Event event) { Tree targetTree = (Tree) event.getTarget(); selectedFilesListbox.getChildren().clear(); addSelectedItem(targetTree); if(selectedFilesListbox.getChildren().size() > 1) { visualizeBtn.setLabel(Labels.getLabel("defineRelations")); } else { visualizeBtn.setLabel(Labels.getLabel("visualize")); } } }); formPanel.setOpen(false); return true; } @Listen("onClick = #visualizeBtn") public void onVisualizeButtonClick(Event event) { if(!selectedFilesListbox.getChildren().isEmpty()) { List<String> files = new ArrayList<String>(); Listitem listitem; for (Component component : selectedFilesListbox.getChildren()) { listitem = (Listitem) component; files.add(listitem.getLabel()); } chartData.setFiles(files); //fetching file columns List<Field> fields; QuerySchema querySchema = null; Map<String, List<Field>> fieldMap = new LinkedHashMap<String, List<Field>>(); for (String fileName : chartData.getFiles()) { fields = new ArrayList<Field>(); try { if(!chartData.getIsQuery()){ fields.addAll(hpccService.getColumns(fileName, chartData.getHpccConnection())); } else { querySchema = hpccQueryService.getQuerySchema(fileName, chartData.getHpccConnection(), chartData.isGenericQuery(), chartData.getInputParamQuery()); fields.addAll(querySchema.getFields()); } } catch (Exception e) { LOG.error(Constants.EXCEPTION, e); Clients.showNotification(Labels.getLabel("unableToFetchColumns"), Clients.NOTIFICATION_TYPE_ERROR, tree, "middle_center", 2000, false); return; } fieldMap.put(fileName, fields); } //Setting fields to ChartData chartData.setFields(fieldMap); if (Sessions.getCurrent().getAttribute(Constants.COMMON_FILTERS) != null) { // Setting common filters for Newly created chart @SuppressWarnings("unchecked") Set<Filter> filterSet = (Set<Filter>) Sessions.getCurrent().getAttribute(Constants.COMMON_FILTERS); for (Filter filter : filterSet) { if( (Constants.DATA_TYPE_STRING.equals(filter.getType()) && (filter.getValues() != null)) || (Constants.DATA_TYPE_NUMERIC.equals(filter.getType()) && filter.getStartValue() != null && filter.getEndValue() != null) ) { for (Map.Entry<String, List<Field>> entry : chartData.getFields().entrySet()) { if(filter.getFileName().equals(entry.getKey())) { for (Field field : entry.getValue()) { if(filter.getColumn().equals(field.getColumnName())) { chartData.setIsFiltered(true); chartData.getFilters().add(filter); } } } } } } } Events.sendEvent("onIncludeDetach", parentWindow, Constants.EDIT_WINDOW_TYPE_DATA_SELECTION); } else { Clients.showNotification(Labels.getLabel("plzChooseaFile"), "warning", tree, "middle_center", 2000, false); } } }
dc79e258dd316fe6f5cae2a92c3cd7f25cf5d442
206d15befecdfb67a93c61c935c2d5ae7f6a79e9
/justdoit/SoJQGrid/src/main/java/ningbo/media/util/JqgridFilter.java
da6e6407324138718fd20d93b28ced17a25fa8f1
[]
no_license
MarkChege/micandroid
2e4d2884929548a814aa0a7715727c84dc4dcdab
0b0a6dee39cf7e258b6f54e1103dcac8dbe1c419
refs/heads/master
2021-01-10T19:15:34.994670
2013-05-16T05:56:21
2013-05-16T05:56:21
34,704,029
0
1
null
null
null
null
UTF-8
Java
false
false
1,825
java
package ningbo.media.util; import java.util.ArrayList; /** * A POJO that represents a jQgrid JSON requests {@link String}<br/> * A sample filter follows the following format: * <pre> * {"groupOp":"AND","rules":[{"field":"firstName","op":"eq","data":"John"}]} * </pre> */ public class JqgridFilter { private String source; private String groupOp; private ArrayList<Rule> rules; public JqgridFilter() { super(); } public JqgridFilter(String source) { super(); this.source = source; } public String getSource() { return source; } public void setSource(String source) { this.source = source; } public String getGroupOp() { return groupOp; } public void setGroupOp(String groupOp) { this.groupOp = groupOp; } public ArrayList<Rule> getRules() { return rules; } public void setRules(ArrayList<Rule> rules) { this.rules = rules; } /** * Inner class containing field rules */ public static class Rule { private String junction; private String field; private String op; private String data; public Rule() {} public Rule(String junction, String field, String op, String data) { super(); this.junction = junction; this.field = field; this.op = op; this.data = data; } public String getJunction() { return junction; } public void setJunction(String junction) { this.junction = junction; } public String getField() { return field; } public void setField(String field) { this.field = field; } public String getOp() { return op; } public void setOp(String op) { this.op = op; } public String getData() { return data; } public void setData(String data) { this.data = data; } } }
[ "[email protected]@29cfa68c-37ae-8048-bc30-ccda835e92b1" ]
[email protected]@29cfa68c-37ae-8048-bc30-ccda835e92b1
c8af1dec862b747c21c85e7ecd8fbac5451e1300
0ac5fd918bcc20ba492d8caa5f43ab9b7a2570b8
/CodingQuestions/src/org/bentonc/codingquestions/crackingthecodinginterview/RemoveDuplicates.java
ad2e8681f99517f31533f616859a39f2da49c94c
[]
no_license
bentonc/coding-questions
72ed8666e6084afb45d36754cebbead26104517f
fea13bc1607565720d43629a308e3ed74bcd9c9d
refs/heads/master
2021-07-02T03:21:40.841531
2020-09-09T07:02:13
2020-09-09T07:02:13
149,233,790
3
0
null
null
null
null
UTF-8
Java
false
false
679
java
package org.bentonc.codingquestions.crackingthecodinginterview; public class RemoveDuplicates { public String removeDuplicates(String str) { char[] cstr = str.toCharArray(); if (cstr == null) return new String(); int len = cstr.length; if (len < 2) return str; int tail = 1; for (int i = 1; i < len; ++i) { int j; for (j = 0; j < tail; ++j) { if (cstr[i] == cstr[j]) break; } if (j == tail) { cstr[tail] = cstr[i]; ++tail; } } cstr[tail] = 0; return new String(cstr, 0, tail); } }
34fb1773eab2fb6e18f75468188c8bfcae6a47fb
4a5afa09ceb7df5dfbd9720279afe9ff3e9df61c
/serverside/java/src/main/java/com/justonetech/system/daoservice/SysPrivilegeService.java
4ba03957ca76fa1e89eb0daced67d60daf1fc56e
[]
no_license
chrgu000/juyee
00ad3af9446a1df68d5a7c286f6243700e371c5c
0de221b728e1eed7fe8eb06c267d62a0edc99793
refs/heads/master
2020-05-25T01:21:01.504384
2016-11-28T09:26:10
2016-11-28T09:26:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
611
java
package com.justonetech.system.daoservice; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.justonetech.core.orm.hibernate.EntityService; import com.justonetech.system.domain.SysPrivilege; /** * author:system *注:此文件内容不需要修改 */ @Service public class SysPrivilegeService extends EntityService<SysPrivilege,Long> { @Autowired public void setSessionFactory(SessionFactory sessionFactory) { initDao(sessionFactory, SysPrivilege.class); } }
[ "chenjunping@18d54d2b-35bc-4a19-92ed-a673819ede82" ]
chenjunping@18d54d2b-35bc-4a19-92ed-a673819ede82
e0b32fbcab6086cb226285b60ba66c9ab7622c08
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/drjava_cluster/21548/tar_0.java
b580f69a27d39b46e4a065408a423b451f780b31
[]
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
4,974
java
/*BEGIN_COPYRIGHT_BLOCK * * This file is part of DrJava. Download the current version of this project from http://www.drjava.org/ * or http://sourceforge.net/projects/drjava/ * * DrJava Open Source License * * Copyright (C) 2001-2006 JavaPLT group at Rice University ([email protected]). All rights reserved. * * Developed by: Java Programming Languages Team, Rice University, http://www.cs.rice.edu/~javaplt/ * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal with 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: * * - Redistributions of source code must retain the above copyright notice, this list of conditions and the * following disclaimers. * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the * following disclaimers in the documentation and/or other materials provided with the distribution. * - Neither the names of DrJava, the JavaPLT, Rice University, nor the names of its contributors may be used to * endorse or promote products derived from this Software without specific prior written permission. * - Products derived from this software may not be called "DrJava" nor use the term "DrJava" as part of their * names without prior written permission from the JavaPLT group. For permission, write to [email protected]. * * 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 * CONTRIBUTORS 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 * WITH THE SOFTWARE. * *END_COPYRIGHT_BLOCK*/ package edu.rice.cs.drjava.model.definitions.indent; import javax.swing.text.*; import edu.rice.cs.util.UnexpectedException; import edu.rice.cs.drjava.model.AbstractDJDocument; /** * Indents the current line in the document to the indent level of the * start of the previous line, plus the given suffix, then backs up to a * specific cursor position. * @version $Id$ */ class ActionStartPrevLinePlusBackup extends IndentRuleAction { private String _suffix; private int _position = 0; /** * Rule that repeats the indentation from the previous line, plus a string, * then moves the cursor to a specified location. * @param suffix The string to be added * @param position the character within the suffix string before which to * place the cursor * @throws IllegalArgumentException if the position is negative or * outside the bounds of the suffix string */ public ActionStartPrevLinePlusBackup(String suffix, int position) { _suffix = suffix; if ((position >= 0) && (position <= suffix.length())) { _position = position; } else { throw new IllegalArgumentException ("The specified position was not within the bounds of the suffix."); } } /** * Indents the line according to the previous line, with the suffix string added, * then backs up the cursor position a number of characters. * If on the first line, indent is set to 0. * @param doc AbstractDJDocument containing the line to be indented. * @param The reason that the indentation is taking place * @return this is always false, since we are updating the cursor location */ public boolean indentLine(AbstractDJDocument doc, Indenter.IndentReason reason) { super.indentLine(doc, reason); try { // Find start of line int here = doc.getCurrentLocation(); int startLine = doc.getLineStartPos(here); if (startLine > AbstractDJDocument.DOCSTART) { // Find prefix of previous line int startPrevLine = doc.getLineStartPos(startLine - 1); int firstChar = doc.getLineFirstCharPos(startPrevLine); String prefix = doc.getText(startPrevLine, firstChar - startPrevLine); // indent and add the suffix doc.setTab(prefix + _suffix, here); // move the cursor to the new position doc.setCurrentLocation(startLine + prefix.length() + _position); } else { // On first line doc.setTab(_suffix, here); // move the cursor to the new position doc.setCurrentLocation(here + _position); } return false; } catch (BadLocationException e) { // Shouldn't happen throw new UnexpectedException(e); } } }
63fa4df53b398efd617448236e1d7847e0e701eb
a59ed8f7495e0f4a55341f4e18ce9a64de35e35f
/app/src/main/java/com/projectclean/magicpainterforkids/utils/OnDialogClickListener.java
6a5350bf5d1146b3ec6bd1112bfcc4e1b9463786
[]
no_license
karlozalb/MagicPainter
b20a720336428950896829257b9b4d8692d47b60
cf87acd4050843bf17309c247dbade391382b2dc
refs/heads/master
2021-01-21T07:45:51.903761
2016-04-12T15:51:00
2016-04-12T15:51:00
55,479,678
0
0
null
null
null
null
UTF-8
Java
false
false
228
java
package com.projectclean.magicpainterforkids.utils; /** * Created by Carlos Albaladejo Pérez on 21/03/2016. */ public interface OnDialogClickListener { void onPositiveButtonClick(); void onNegativeButtonClick(); }
a737a269ce8bd137a42afc9db14c066a9b09fdc6
d1030722951b796a90d816344143bf7db71e159c
/src/main/java/com/tanbobo/dmps/service/impl/SysUserRoleServiceImpl.java
e7b9e1331d82cba30508703e5c80675247426f5d
[]
no_license
sunsunsun000/dmps
f2f170b8f9ef77ce1b3bca4316674486cec65ca9
e04959dd93b1738df9cb16b1452464054dfa03be
refs/heads/master
2020-03-28T05:14:47.461485
2017-02-10T18:32:51
2017-02-10T18:32:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
673
java
package com.tanbobo.dmps.service.impl; import com.tanbobo.dmps.mapper.SysUserRoleMapper; import com.tanbobo.dmps.service.SysUserRoleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; /** * ClassName: SysUserRoleServiceImpl * Author: tandingbo * CreateTime: 2017-02-08 15:53 */ @Service("sysUserRoleService") public class SysUserRoleServiceImpl implements SysUserRoleService { @Autowired private SysUserRoleMapper sysUserRoleMapper; @Override public List<Integer> findRoleIdByUid(Integer uid) { return sysUserRoleMapper.findRoleIdByUid(uid); } }
[ "TAN19881218bo" ]
TAN19881218bo
d51d5c21b0da181d3914cf285d17a6b7957fa28e
3e2c972a15009811e6a6a0d83e3d52f4c465d413
/TenIntsLab.java
243168d33667b38152f6ae04ccc4640d01e4b1ee
[]
no_license
NancyMeri/APCS-A
5ed3df7ec211734b8fe1703a17d6604f823d8b71
7e1b7576fff0f9e9b7a6108bfd43cc1f566cdcd5
refs/heads/master
2022-11-08T18:51:19.882545
2020-06-30T03:11:09
2020-06-30T03:11:09
272,248,013
0
0
null
null
null
null
UTF-8
Java
false
false
609
java
//Nancy import java.util.*; public class TenIntsLab { public static void main (String [] args){ Scanner scan = new Scanner (System.in); int [] arr = new int [10]; for (int i = 0; i < 10; i++){ arr [i] = (int) (Math.random() * 10 + 1); System.out.print(arr[i] + " "); } System.out.println("Type an integer"); int x = scan.nextInt(); int count = 0; for (int i = 0; i < 10; i++){ if (arr [i] == x) {count ++;;} } System.out.println(x + " appears " + count + " times in this array"); } }
0833600b0fb080b67477697c9ec5a6863e741c1f
971bbac893927b485ac16b4f4a88ec7278d154ed
/others/src/test/java/olddog/digest/HexUtilsTest.java
3f7520250559acff8fc1ca631636603cc4d9bcfd
[]
no_license
ihanyong/olddog
27e1a0736db4517b8f391dddb9b9529db580e4ed
8e6d9e31ab437cee28fed7a0ac0d3f092ebbf6a2
refs/heads/master
2022-07-02T11:41:12.685640
2019-07-17T09:45:15
2019-07-17T09:45:15
96,169,947
0
0
null
2022-07-01T21:24:40
2017-07-04T03:04:36
Java
UTF-8
Java
false
false
1,845
java
package olddog.digest; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import static org.junit.Assert.assertArrayEquals; /** * HexUtilsTest * * @author yong.han * 2019/3/14 */ public class HexUtilsTest { public static class Tuple2 { char[] f0; byte[] f1; public static Tuple2 of(char[] f0, byte[] f1) { Tuple2 tuple2 = new Tuple2(); tuple2.f0 = f0; tuple2.f1 = f1; return tuple2; } } private static Tuple2[] simples = new Tuple2[]{ Tuple2.of(new char[]{'0', '1'}, new byte[]{1}) ,Tuple2.of(new char[]{'0', '1', '2', '3', '4', '5'}, new byte[]{1, 35, 69}) , Tuple2.of(new char[]{'F', 'D', 'E', 'C', 'B', 'A'}, new byte[]{-3, -20, -70}) , Tuple2.of(new char[]{'0', 'F', 'E', '8', '9', 'C'}, new byte[]{15, -24, -100}) , Tuple2.of(new char[]{'9', 'C'}, new byte[]{-100}) , Tuple2.of(new char[]{'0', '1', '2', '3', '4', '5','F', 'D', 'E', 'C', 'B', 'A','0', 'F', 'E', '8', '9', 'C'}, new byte[]{1, 35, 69,-3, -20, -70,15, -24, -100}) }; @Test public void testHexEncode() { for (Tuple2 simple : simples) { assertArrayEquals(simple.f0, HexUtils.hexEncode(simple.f1)); } } @Test public void testHexDecode() { for (Tuple2 simple : simples) { assertArrayEquals(simple.f1, HexUtils.hexDecode(simple.f0)); } } @Rule public ExpectedException expectedException = ExpectedException.none(); @Test public void testHexDecode_exception() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("char 数组长度应该为偶数"); HexUtils.hexDecode(new char[]{'a','a','a'}); } }
2096fab419d54d8ec9b721f9a0043e829ad38db3
79d1883756f4591469c0f43dcab2ef8018249dbc
/src/test/java/com/politrix/PolitrixCoreApplicationTests.java
65eb0994ad628365188407272686e55e24304fc8
[]
no_license
LinShuangShuang/politrix-core
343a34ae280c8e34360fdd9b6dddbbef14b43337
42a84d62a4e38577bc2a1589ad534f9344ac248e
refs/heads/master
2023-03-18T09:18:32.996951
2017-02-19T21:57:41
2017-02-19T21:57:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
335
java
package com.politrix; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class PolitrixCoreApplicationTests { @Test public void contextLoads() { } }
9779a00c75b7cbdc6bfa0a58b062a360ae30b240
c15c403c891c5604c1409d9112fd7934af3c022e
/src/test/java/Utilities/CommonUtilities.java
c8be02a6a20bc500352c8cb0545f5f44b12bbf9b
[]
no_license
krishnaagupta/Testmaven-git
f9225ed20dc6f34a5f5956dfd911d03e2bda6950
5aecc58caa18b6067c4c17d5a43e79f0732df9f2
refs/heads/master
2023-04-21T02:51:03.505318
2021-05-11T16:20:15
2021-05-11T16:20:15
366,442,989
0
0
null
null
null
null
UTF-8
Java
false
false
4,670
java
package Utilities; import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import org.apache.commons.io.FileUtils; import org.openqa.selenium.By; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; import com.aventstack.extentreports.Status; import Base.BaseTest; public class CommonUtilities { public void enterText(WebElement element, String textToEnter, String elementName) { if (element.isDisplayed()) { element.sendKeys(textToEnter); BaseTest.test.log(Status.INFO, elementName + " is entered"); } else BaseTest.test.log(Status.FAIL, elementName + " is not displayed"); } public void clickonElement(WebElement element, String elementName) { element.click(); BaseTest.test.log(Status.INFO, elementName + " is clicked"); } public void verifyText(String ActualText, String ExpectedText, String msg) throws IOException { if (ActualText.equals(ExpectedText)) { BaseTest.test.pass(msg + "is verified successfully"); } else { BaseTest.test.fail(msg + " verification is failed"); // BaseTest.test.addScreenCaptureFromPath(takeScreenshot()); } } public void verifyUsermenu(String ElementXapth) throws IOException { List<WebElement> userMenuItems = BaseTest.driver.findElements(By.xpath(ElementXapth)); String[] ExpectedmenuItems = { "My Profile", "My Settings", "Developer Console", "Switch to Lightning Experience", "Logout" }; for (int i = 0; i < userMenuItems.size(); i++) { Assert.assertEquals(userMenuItems.get(i).getText(), ExpectedmenuItems[i]); BaseTest.test.log(Status.INFO, ExpectedmenuItems[i] + " is Verified"); } } public boolean waitForElementVisible(WebElement element) { try { WebDriverWait wait = new WebDriverWait(BaseTest.driver, 30); wait.until(ExpectedConditions.visibilityOf(element)); return true; } catch (Exception e) { return false; } } // TakesScreenshot srcShot = ((TakesScreenshot) driver); // File srcFile = srcShot.getScreenshotAs(OutputType.FILE); // String imagePath = reportFolder + new SimpleDateFormat("'Image_'YYYYMMddHHmm'.png'").format(new Date()); // File destFile = new File(imagePath); // FileUtils.copyFile(srcFile,destFile); // return imagePath; public String takeScreenshot() throws IOException { TakesScreenshot screenshot = (TakesScreenshot) BaseTest.driver; String addDate = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); //String destinationPath = System.getProperty("user.dir") + "/Reports/Screenshots/" + addDate + ".PNG"; // my String destinationPath = System.getProperty("/Users/krishnaagupta/eclipse-workspace/javaprog/Testmaven/target/HtmlReports" )+ addDate + ".PNG"; String destinationPath = AppConstants.EXTENT_HTML_REPORT_PATH+ addDate + ".PNG"; File srcfile = screenshot.getScreenshotAs(OutputType.FILE); File dstfile = new File(destinationPath); FileUtils.copyFile(srcfile, dstfile); // test.addScreenCaptureFromPath(destinationPath); // test.fail("Login to homepage failed"); return destinationPath; } public void logintoSFDC(String username, String pass) throws InterruptedException, IOException { // test = extent.createTest("logintoSFDC_TC02"); WebElement username1 = BaseTest.driver.findElement(By.name("username")); enterText(username1, username, "Username"); BaseTest.test.log(Status.INFO, "usernmae is enterd"); WebElement password = BaseTest.driver.findElement(By.name("pw")); enterText(password, pass, "Password"); BaseTest.test.log(Status.INFO, "Password field"); WebElement loginButton = BaseTest.driver.findElement(By.id("Login")); clickonElement(loginButton, "LoginButton"); Thread.sleep(5000); // verifyText(BaseTest.driver.getTitle(), readPropertiesfile("Messages", "homepage.title"), "HomePage title"); // To logout } public void logOut(WebDriver driver) { // TODO Auto-generated method stub WebElement usernavgi=driver.findElement(By.xpath("//*[@id=\"userNav\"]")); clickonElement(usernavgi, "usernavgation click"); BaseTest.test.log(Status.INFO, "usernmae is enterd"); WebElement logout=driver.findElement(By.xpath("//*[@id=\"userNav-menuItems\"]/a[5]")); clickonElement(logout,"LogOut"); BaseTest.test.log(Status.INFO, "logoutClicked"); } }
0c26cfd65c430b160736566028fd984958d2907c
8ad43ffdcf57e51b0da8961639d9ecb6c25f8cfe
/app/src/main/java/com/example/dam/legoparts/Part.java
beb07c844abd66c0d9836cd8b260a4ebbc520f69
[]
no_license
alvarosanchezdam/LegoParts
6e982c1641b463b393022ef1411c43f9c18af5e9
b4ed981c712b5aeb02c6b4c2469c23577e1b8af8
refs/heads/master
2020-12-30T22:43:32.190779
2017-02-13T19:17:51
2017-02-13T19:17:51
80,649,049
0
0
null
null
null
null
UTF-8
Java
false
false
940
java
package com.example.dam.legoparts; /** * Created by DAM on 26/1/17. */ public class Part { private String id; private int cantidad; private String nombre; private String imgUrl; public Part() { } public Part(int cantidad, String nombre, String imgUrl) { this.cantidad = cantidad; this.nombre = nombre; this.imgUrl = imgUrl; } public String getId() { return id; } public void setId(String id) { this.id = id; } public int getCantidad() { return cantidad; } public void setCantidad(int cantidad) { this.cantidad = cantidad; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public String getImgUrl() { return imgUrl; } public void setImgUrl(String imgUrl) { this.imgUrl = imgUrl; } }
a2b23a818e531703c7ca357326d7b841e769c6d6
2c327cc1c607a5c77eebe754884799d443d39c66
/src/main/java/com/mattanger/api/Retail/model/Account.java
b8afa1abdb90ccfed3bff705f10378dcb1a91e6f
[ "MIT" ]
permissive
mattanger/LightspeedJava
1713230216a1f51a76c3d30d2a31f1b17c4b6d14
fd7195c394e098b3b59c764dfa422f7258ba7eb3
refs/heads/master
2021-04-08T10:07:40.775970
2020-03-20T13:41:59
2020-03-20T13:41:59
248,765,588
1
0
null
null
null
null
UTF-8
Java
false
false
398
java
package com.mattanger.api.Retail.model; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.api.client.util.Key; import com.mattanger.api.model.Attributes; import com.mattanger.api.model.Link; public class Account { @JsonProperty("accountID") public int accountID; @JsonProperty("name") public String name; @JsonProperty("link") public Link link; }
674d3f52fa6c3c58d1bc5722e7d89fce385c5bfc
f4480622f3b008dd5d14688a83cebe93d3350106
/service/service_edu/src/main/java/com/shun/eduservice/service/EduTeacherService.java
3c7debdaad92f3ec9bfc033fbf2074c047a99231
[]
no_license
D18130495/project
617f46d7b0960a1de935c876d33f2293ae0dc8d9
03fa297c78cc6e1d68b5797a7f48fb5aa26f9ef7
refs/heads/main
2023-06-16T06:19:15.753221
2021-07-08T20:02:58
2021-07-08T20:02:58
382,617,076
0
0
null
null
null
null
UTF-8
Java
false
false
305
java
package com.shun.eduservice.service; import com.shun.eduservice.entity.EduTeacher; import com.baomidou.mybatisplus.extension.service.IService; /** * <p> * 讲师 服务类 * </p> * * @author 画若雨幕 * @since 2021-07-03 */ public interface EduTeacherService extends IService<EduTeacher> { }
193513e957fc2f38aee9cd4c9bf83a72a0ecea4e
a8cb1b33c33fb25edfb189380da033107c3390c6
/src/main/java/ca/yorku/eecs/caps/Game.java
bac3381505737c2253b44121049ab7c34a96e086
[]
no_license
snksbs/capsapp
7bec5564c214e3885c863f0d249bd361c4740d47
07d302fa9be64af3490b0d8907833454e8cced5e
refs/heads/main
2023-04-30T14:45:10.532468
2021-05-20T00:46:26
2021-05-20T00:46:26
369,037,980
0
0
null
null
null
null
UTF-8
Java
false
false
807
java
package ca.yorku.eecs.caps; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.TreeMap; import ca.roumani.i2c.Country; import ca.roumani.i2c.CountryDB; public class Game { private CountryDB db; public Game() { this.db = new CountryDB(); } public String qa() { List<String> capitals = new ArrayList<>(); capitals = db.getCapitals(); int k = capitals.size(); int index = (int) (Math.random() * k); String a = capitals.get(index); Map <String, Country> map = new TreeMap<>(); map = db.getData(); Country cho = map.get(a); if (Math.random() < 0.5) return "What is the capital of " + cho.getName() + "\n" + cho.getCapital(); else return cho.getCapital() + " is the capital of " + "\n" + cho.getName(); } }
d0e42e132917c42b0804893df3ae07a4d367563b
7cc780c8a59b17f7b34f90d4fd438aa715db92e9
/src/test/java/com/jarosinski/jhipster/web/rest/AccountResourceIT.java
d4d46fd7f0055fa9f94dc1f054941c1c0cd01351
[]
no_license
galthran/jhipster-camunda-bpmn-learning
fcf51791737c3a73b400c7624f1092728ddcbf36
6981255d67d0bf378e51f85578f341d6cf41d7f7
refs/heads/master
2020-05-31T19:30:09.844116
2019-06-05T19:35:09
2019-06-05T19:35:09
190,456,815
0
0
null
2019-10-31T17:11:59
2019-06-05T19:34:58
Java
UTF-8
Java
false
false
34,355
java
package com.jarosinski.jhipster.web.rest; import com.jarosinski.jhipster.JhipsterCamundaBpmnApplicationApp; import com.jarosinski.jhipster.config.Constants; import com.jarosinski.jhipster.domain.Authority; import com.jarosinski.jhipster.domain.User; import com.jarosinski.jhipster.repository.AuthorityRepository; import com.jarosinski.jhipster.repository.UserRepository; import com.jarosinski.jhipster.security.AuthoritiesConstants; import com.jarosinski.jhipster.service.MailService; import com.jarosinski.jhipster.service.UserService; import com.jarosinski.jhipster.service.dto.PasswordChangeDTO; import com.jarosinski.jhipster.service.dto.UserDTO; import com.jarosinski.jhipster.web.rest.errors.ExceptionTranslator; import com.jarosinski.jhipster.web.rest.vm.KeyAndPasswordVM; import com.jarosinski.jhipster.web.rest.vm.ManagedUserVM; import org.apache.commons.lang3.RandomStringUtils; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.test.context.support.WithMockUser; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; import java.time.Instant; import java.util.*; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Integration tests for the {@link AccountResource} REST controller. */ @SpringBootTest(classes = JhipsterCamundaBpmnApplicationApp.class) public class AccountResourceIT { @Autowired private UserRepository userRepository; @Autowired private AuthorityRepository authorityRepository; @Autowired private UserService userService; @Autowired private PasswordEncoder passwordEncoder; @Autowired private HttpMessageConverter<?>[] httpMessageConverters; @Autowired private ExceptionTranslator exceptionTranslator; @Mock private UserService mockUserService; @Mock private MailService mockMailService; private MockMvc restMvc; private MockMvc restUserMockMvc; @BeforeEach public void setup() { MockitoAnnotations.initMocks(this); doNothing().when(mockMailService).sendActivationEmail(any()); AccountResource accountResource = new AccountResource(userRepository, userService, mockMailService); AccountResource accountUserMockResource = new AccountResource(userRepository, mockUserService, mockMailService); this.restMvc = MockMvcBuilders.standaloneSetup(accountResource) .setMessageConverters(httpMessageConverters) .setControllerAdvice(exceptionTranslator) .build(); this.restUserMockMvc = MockMvcBuilders.standaloneSetup(accountUserMockResource) .setControllerAdvice(exceptionTranslator) .build(); } @Test public void testNonAuthenticatedUser() throws Exception { restUserMockMvc.perform(get("/api/authenticate") .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().string("")); } @Test public void testAuthenticatedUser() throws Exception { restUserMockMvc.perform(get("/api/authenticate") .with(request -> { request.setRemoteUser("test"); return request; }) .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().string("test")); } @Test public void testGetExistingAccount() throws Exception { Set<Authority> authorities = new HashSet<>(); Authority authority = new Authority(); authority.setName(AuthoritiesConstants.ADMIN); authorities.add(authority); User user = new User(); user.setLogin("test"); user.setFirstName("john"); user.setLastName("doe"); user.setEmail("[email protected]"); user.setImageUrl("http://placehold.it/50x50"); user.setLangKey("en"); user.setAuthorities(authorities); when(mockUserService.getUserWithAuthorities()).thenReturn(Optional.of(user)); restUserMockMvc.perform(get("/api/account") .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.login").value("test")) .andExpect(jsonPath("$.firstName").value("john")) .andExpect(jsonPath("$.lastName").value("doe")) .andExpect(jsonPath("$.email").value("[email protected]")) .andExpect(jsonPath("$.imageUrl").value("http://placehold.it/50x50")) .andExpect(jsonPath("$.langKey").value("en")) .andExpect(jsonPath("$.authorities").value(AuthoritiesConstants.ADMIN)); } @Test public void testGetUnknownAccount() throws Exception { when(mockUserService.getUserWithAuthorities()).thenReturn(Optional.empty()); restUserMockMvc.perform(get("/api/account") .accept(MediaType.APPLICATION_PROBLEM_JSON)) .andExpect(status().isInternalServerError()); } @Test @Transactional public void testRegisterValid() throws Exception { ManagedUserVM validUser = new ManagedUserVM(); validUser.setLogin("test-register-valid"); validUser.setPassword("password"); validUser.setFirstName("Alice"); validUser.setLastName("Test"); validUser.setEmail("[email protected]"); validUser.setImageUrl("http://placehold.it/50x50"); validUser.setLangKey(Constants.DEFAULT_LANGUAGE); validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); assertThat(userRepository.findOneByLogin("test-register-valid").isPresent()).isFalse(); restMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(validUser))) .andExpect(status().isCreated()); assertThat(userRepository.findOneByLogin("test-register-valid").isPresent()).isTrue(); } @Test @Transactional public void testRegisterInvalidLogin() throws Exception { ManagedUserVM invalidUser = new ManagedUserVM(); invalidUser.setLogin("funky-log!n");// <-- invalid invalidUser.setPassword("password"); invalidUser.setFirstName("Funky"); invalidUser.setLastName("One"); invalidUser.setEmail("[email protected]"); invalidUser.setActivated(true); invalidUser.setImageUrl("http://placehold.it/50x50"); invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); restUserMockMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(invalidUser))) .andExpect(status().isBadRequest()); Optional<User> user = userRepository.findOneByEmailIgnoreCase("[email protected]"); assertThat(user.isPresent()).isFalse(); } @Test @Transactional public void testRegisterInvalidEmail() throws Exception { ManagedUserVM invalidUser = new ManagedUserVM(); invalidUser.setLogin("bob"); invalidUser.setPassword("password"); invalidUser.setFirstName("Bob"); invalidUser.setLastName("Green"); invalidUser.setEmail("invalid");// <-- invalid invalidUser.setActivated(true); invalidUser.setImageUrl("http://placehold.it/50x50"); invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); restUserMockMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(invalidUser))) .andExpect(status().isBadRequest()); Optional<User> user = userRepository.findOneByLogin("bob"); assertThat(user.isPresent()).isFalse(); } @Test @Transactional public void testRegisterInvalidPassword() throws Exception { ManagedUserVM invalidUser = new ManagedUserVM(); invalidUser.setLogin("bob"); invalidUser.setPassword("123");// password with only 3 digits invalidUser.setFirstName("Bob"); invalidUser.setLastName("Green"); invalidUser.setEmail("[email protected]"); invalidUser.setActivated(true); invalidUser.setImageUrl("http://placehold.it/50x50"); invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); restUserMockMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(invalidUser))) .andExpect(status().isBadRequest()); Optional<User> user = userRepository.findOneByLogin("bob"); assertThat(user.isPresent()).isFalse(); } @Test @Transactional public void testRegisterNullPassword() throws Exception { ManagedUserVM invalidUser = new ManagedUserVM(); invalidUser.setLogin("bob"); invalidUser.setPassword(null);// invalid null password invalidUser.setFirstName("Bob"); invalidUser.setLastName("Green"); invalidUser.setEmail("[email protected]"); invalidUser.setActivated(true); invalidUser.setImageUrl("http://placehold.it/50x50"); invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE); invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); restUserMockMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(invalidUser))) .andExpect(status().isBadRequest()); Optional<User> user = userRepository.findOneByLogin("bob"); assertThat(user.isPresent()).isFalse(); } @Test @Transactional public void testRegisterDuplicateLogin() throws Exception { // First registration ManagedUserVM firstUser = new ManagedUserVM(); firstUser.setLogin("alice"); firstUser.setPassword("password"); firstUser.setFirstName("Alice"); firstUser.setLastName("Something"); firstUser.setEmail("[email protected]"); firstUser.setImageUrl("http://placehold.it/50x50"); firstUser.setLangKey(Constants.DEFAULT_LANGUAGE); firstUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); // Duplicate login, different email ManagedUserVM secondUser = new ManagedUserVM(); secondUser.setLogin(firstUser.getLogin()); secondUser.setPassword(firstUser.getPassword()); secondUser.setFirstName(firstUser.getFirstName()); secondUser.setLastName(firstUser.getLastName()); secondUser.setEmail("[email protected]"); secondUser.setImageUrl(firstUser.getImageUrl()); secondUser.setLangKey(firstUser.getLangKey()); secondUser.setCreatedBy(firstUser.getCreatedBy()); secondUser.setCreatedDate(firstUser.getCreatedDate()); secondUser.setLastModifiedBy(firstUser.getLastModifiedBy()); secondUser.setLastModifiedDate(firstUser.getLastModifiedDate()); secondUser.setAuthorities(new HashSet<>(firstUser.getAuthorities())); // First user restMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(firstUser))) .andExpect(status().isCreated()); // Second (non activated) user restMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(secondUser))) .andExpect(status().isCreated()); Optional<User> testUser = userRepository.findOneByEmailIgnoreCase("[email protected]"); assertThat(testUser.isPresent()).isTrue(); testUser.get().setActivated(true); userRepository.save(testUser.get()); // Second (already activated) user restMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(secondUser))) .andExpect(status().is4xxClientError()); } @Test @Transactional public void testRegisterDuplicateEmail() throws Exception { // First user ManagedUserVM firstUser = new ManagedUserVM(); firstUser.setLogin("test-register-duplicate-email"); firstUser.setPassword("password"); firstUser.setFirstName("Alice"); firstUser.setLastName("Test"); firstUser.setEmail("[email protected]"); firstUser.setImageUrl("http://placehold.it/50x50"); firstUser.setLangKey(Constants.DEFAULT_LANGUAGE); firstUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER)); // Register first user restMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(firstUser))) .andExpect(status().isCreated()); Optional<User> testUser1 = userRepository.findOneByLogin("test-register-duplicate-email"); assertThat(testUser1.isPresent()).isTrue(); // Duplicate email, different login ManagedUserVM secondUser = new ManagedUserVM(); secondUser.setLogin("test-register-duplicate-email-2"); secondUser.setPassword(firstUser.getPassword()); secondUser.setFirstName(firstUser.getFirstName()); secondUser.setLastName(firstUser.getLastName()); secondUser.setEmail(firstUser.getEmail()); secondUser.setImageUrl(firstUser.getImageUrl()); secondUser.setLangKey(firstUser.getLangKey()); secondUser.setAuthorities(new HashSet<>(firstUser.getAuthorities())); // Register second (non activated) user restMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(secondUser))) .andExpect(status().isCreated()); Optional<User> testUser2 = userRepository.findOneByLogin("test-register-duplicate-email"); assertThat(testUser2.isPresent()).isFalse(); Optional<User> testUser3 = userRepository.findOneByLogin("test-register-duplicate-email-2"); assertThat(testUser3.isPresent()).isTrue(); // Duplicate email - with uppercase email address ManagedUserVM userWithUpperCaseEmail = new ManagedUserVM(); userWithUpperCaseEmail.setId(firstUser.getId()); userWithUpperCaseEmail.setLogin("test-register-duplicate-email-3"); userWithUpperCaseEmail.setPassword(firstUser.getPassword()); userWithUpperCaseEmail.setFirstName(firstUser.getFirstName()); userWithUpperCaseEmail.setLastName(firstUser.getLastName()); userWithUpperCaseEmail.setEmail("[email protected]"); userWithUpperCaseEmail.setImageUrl(firstUser.getImageUrl()); userWithUpperCaseEmail.setLangKey(firstUser.getLangKey()); userWithUpperCaseEmail.setAuthorities(new HashSet<>(firstUser.getAuthorities())); // Register third (not activated) user restMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(userWithUpperCaseEmail))) .andExpect(status().isCreated()); Optional<User> testUser4 = userRepository.findOneByLogin("test-register-duplicate-email-3"); assertThat(testUser4.isPresent()).isTrue(); assertThat(testUser4.get().getEmail()).isEqualTo("[email protected]"); testUser4.get().setActivated(true); userService.updateUser((new UserDTO(testUser4.get()))); // Register 4th (already activated) user restMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(secondUser))) .andExpect(status().is4xxClientError()); } @Test @Transactional public void testRegisterAdminIsIgnored() throws Exception { ManagedUserVM validUser = new ManagedUserVM(); validUser.setLogin("badguy"); validUser.setPassword("password"); validUser.setFirstName("Bad"); validUser.setLastName("Guy"); validUser.setEmail("[email protected]"); validUser.setActivated(true); validUser.setImageUrl("http://placehold.it/50x50"); validUser.setLangKey(Constants.DEFAULT_LANGUAGE); validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); restMvc.perform( post("/api/register") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(validUser))) .andExpect(status().isCreated()); Optional<User> userDup = userRepository.findOneByLogin("badguy"); assertThat(userDup.isPresent()).isTrue(); assertThat(userDup.get().getAuthorities()).hasSize(1) .containsExactly(authorityRepository.findById(AuthoritiesConstants.USER).get()); } @Test @Transactional public void testActivateAccount() throws Exception { final String activationKey = "some activation key"; User user = new User(); user.setLogin("activate-account"); user.setEmail("[email protected]"); user.setPassword(RandomStringUtils.random(60)); user.setActivated(false); user.setActivationKey(activationKey); userRepository.saveAndFlush(user); restMvc.perform(get("/api/activate?key={activationKey}", activationKey)) .andExpect(status().isOk()); user = userRepository.findOneByLogin(user.getLogin()).orElse(null); assertThat(user.getActivated()).isTrue(); } @Test @Transactional public void testActivateAccountWithWrongKey() throws Exception { restMvc.perform(get("/api/activate?key=wrongActivationKey")) .andExpect(status().isInternalServerError()); } @Test @Transactional @WithMockUser("save-account") public void testSaveAccount() throws Exception { User user = new User(); user.setLogin("save-account"); user.setEmail("[email protected]"); user.setPassword(RandomStringUtils.random(60)); user.setActivated(true); userRepository.saveAndFlush(user); UserDTO userDTO = new UserDTO(); userDTO.setLogin("not-used"); userDTO.setFirstName("firstname"); userDTO.setLastName("lastname"); userDTO.setEmail("[email protected]"); userDTO.setActivated(false); userDTO.setImageUrl("http://placehold.it/50x50"); userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); restMvc.perform( post("/api/account") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(userDTO))) .andExpect(status().isOk()); User updatedUser = userRepository.findOneByLogin(user.getLogin()).orElse(null); assertThat(updatedUser.getFirstName()).isEqualTo(userDTO.getFirstName()); assertThat(updatedUser.getLastName()).isEqualTo(userDTO.getLastName()); assertThat(updatedUser.getEmail()).isEqualTo(userDTO.getEmail()); assertThat(updatedUser.getLangKey()).isEqualTo(userDTO.getLangKey()); assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); assertThat(updatedUser.getImageUrl()).isEqualTo(userDTO.getImageUrl()); assertThat(updatedUser.getActivated()).isEqualTo(true); assertThat(updatedUser.getAuthorities()).isEmpty(); } @Test @Transactional @WithMockUser("save-invalid-email") public void testSaveInvalidEmail() throws Exception { User user = new User(); user.setLogin("save-invalid-email"); user.setEmail("[email protected]"); user.setPassword(RandomStringUtils.random(60)); user.setActivated(true); userRepository.saveAndFlush(user); UserDTO userDTO = new UserDTO(); userDTO.setLogin("not-used"); userDTO.setFirstName("firstname"); userDTO.setLastName("lastname"); userDTO.setEmail("invalid email"); userDTO.setActivated(false); userDTO.setImageUrl("http://placehold.it/50x50"); userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); restMvc.perform( post("/api/account") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(userDTO))) .andExpect(status().isBadRequest()); assertThat(userRepository.findOneByEmailIgnoreCase("invalid email")).isNotPresent(); } @Test @Transactional @WithMockUser("save-existing-email") public void testSaveExistingEmail() throws Exception { User user = new User(); user.setLogin("save-existing-email"); user.setEmail("[email protected]"); user.setPassword(RandomStringUtils.random(60)); user.setActivated(true); userRepository.saveAndFlush(user); User anotherUser = new User(); anotherUser.setLogin("save-existing-email2"); anotherUser.setEmail("[email protected]"); anotherUser.setPassword(RandomStringUtils.random(60)); anotherUser.setActivated(true); userRepository.saveAndFlush(anotherUser); UserDTO userDTO = new UserDTO(); userDTO.setLogin("not-used"); userDTO.setFirstName("firstname"); userDTO.setLastName("lastname"); userDTO.setEmail("[email protected]"); userDTO.setActivated(false); userDTO.setImageUrl("http://placehold.it/50x50"); userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); restMvc.perform( post("/api/account") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(userDTO))) .andExpect(status().isBadRequest()); User updatedUser = userRepository.findOneByLogin("save-existing-email").orElse(null); assertThat(updatedUser.getEmail()).isEqualTo("[email protected]"); } @Test @Transactional @WithMockUser("save-existing-email-and-login") public void testSaveExistingEmailAndLogin() throws Exception { User user = new User(); user.setLogin("save-existing-email-and-login"); user.setEmail("[email protected]"); user.setPassword(RandomStringUtils.random(60)); user.setActivated(true); userRepository.saveAndFlush(user); UserDTO userDTO = new UserDTO(); userDTO.setLogin("not-used"); userDTO.setFirstName("firstname"); userDTO.setLastName("lastname"); userDTO.setEmail("[email protected]"); userDTO.setActivated(false); userDTO.setImageUrl("http://placehold.it/50x50"); userDTO.setLangKey(Constants.DEFAULT_LANGUAGE); userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN)); restMvc.perform( post("/api/account") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(userDTO))) .andExpect(status().isOk()); User updatedUser = userRepository.findOneByLogin("save-existing-email-and-login").orElse(null); assertThat(updatedUser.getEmail()).isEqualTo("[email protected]"); } @Test @Transactional @WithMockUser("change-password-wrong-existing-password") public void testChangePasswordWrongExistingPassword() throws Exception { User user = new User(); String currentPassword = RandomStringUtils.random(60); user.setPassword(passwordEncoder.encode(currentPassword)); user.setLogin("change-password-wrong-existing-password"); user.setEmail("[email protected]"); userRepository.saveAndFlush(user); restMvc.perform(post("/api/account/change-password") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO("1"+currentPassword, "new password")))) .andExpect(status().isBadRequest()); User updatedUser = userRepository.findOneByLogin("change-password-wrong-existing-password").orElse(null); assertThat(passwordEncoder.matches("new password", updatedUser.getPassword())).isFalse(); assertThat(passwordEncoder.matches(currentPassword, updatedUser.getPassword())).isTrue(); } @Test @Transactional @WithMockUser("change-password") public void testChangePassword() throws Exception { User user = new User(); String currentPassword = RandomStringUtils.random(60); user.setPassword(passwordEncoder.encode(currentPassword)); user.setLogin("change-password"); user.setEmail("[email protected]"); userRepository.saveAndFlush(user); restMvc.perform(post("/api/account/change-password") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, "new password")))) .andExpect(status().isOk()); User updatedUser = userRepository.findOneByLogin("change-password").orElse(null); assertThat(passwordEncoder.matches("new password", updatedUser.getPassword())).isTrue(); } @Test @Transactional @WithMockUser("change-password-too-small") public void testChangePasswordTooSmall() throws Exception { User user = new User(); String currentPassword = RandomStringUtils.random(60); user.setPassword(passwordEncoder.encode(currentPassword)); user.setLogin("change-password-too-small"); user.setEmail("[email protected]"); userRepository.saveAndFlush(user); String newPassword = RandomStringUtils.random(ManagedUserVM.PASSWORD_MIN_LENGTH - 1); restMvc.perform(post("/api/account/change-password") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, newPassword)))) .andExpect(status().isBadRequest()); User updatedUser = userRepository.findOneByLogin("change-password-too-small").orElse(null); assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); } @Test @Transactional @WithMockUser("change-password-too-long") public void testChangePasswordTooLong() throws Exception { User user = new User(); String currentPassword = RandomStringUtils.random(60); user.setPassword(passwordEncoder.encode(currentPassword)); user.setLogin("change-password-too-long"); user.setEmail("[email protected]"); userRepository.saveAndFlush(user); String newPassword = RandomStringUtils.random(ManagedUserVM.PASSWORD_MAX_LENGTH + 1); restMvc.perform(post("/api/account/change-password") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, newPassword)))) .andExpect(status().isBadRequest()); User updatedUser = userRepository.findOneByLogin("change-password-too-long").orElse(null); assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); } @Test @Transactional @WithMockUser("change-password-empty") public void testChangePasswordEmpty() throws Exception { User user = new User(); String currentPassword = RandomStringUtils.random(60); user.setPassword(passwordEncoder.encode(currentPassword)); user.setLogin("change-password-empty"); user.setEmail("[email protected]"); userRepository.saveAndFlush(user); restMvc.perform(post("/api/account/change-password") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, "")))) .andExpect(status().isBadRequest()); User updatedUser = userRepository.findOneByLogin("change-password-empty").orElse(null); assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword()); } @Test @Transactional public void testRequestPasswordReset() throws Exception { User user = new User(); user.setPassword(RandomStringUtils.random(60)); user.setActivated(true); user.setLogin("password-reset"); user.setEmail("[email protected]"); userRepository.saveAndFlush(user); restMvc.perform(post("/api/account/reset-password/init") .content("[email protected]")) .andExpect(status().isOk()); } @Test @Transactional public void testRequestPasswordResetUpperCaseEmail() throws Exception { User user = new User(); user.setPassword(RandomStringUtils.random(60)); user.setActivated(true); user.setLogin("password-reset"); user.setEmail("[email protected]"); userRepository.saveAndFlush(user); restMvc.perform(post("/api/account/reset-password/init") .content("[email protected]")) .andExpect(status().isOk()); } @Test public void testRequestPasswordResetWrongEmail() throws Exception { restMvc.perform( post("/api/account/reset-password/init") .content("[email protected]")) .andExpect(status().isBadRequest()); } @Test @Transactional public void testFinishPasswordReset() throws Exception { User user = new User(); user.setPassword(RandomStringUtils.random(60)); user.setLogin("finish-password-reset"); user.setEmail("[email protected]"); user.setResetDate(Instant.now().plusSeconds(60)); user.setResetKey("reset key"); userRepository.saveAndFlush(user); KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM(); keyAndPassword.setKey(user.getResetKey()); keyAndPassword.setNewPassword("new password"); restMvc.perform( post("/api/account/reset-password/finish") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(keyAndPassword))) .andExpect(status().isOk()); User updatedUser = userRepository.findOneByLogin(user.getLogin()).orElse(null); assertThat(passwordEncoder.matches(keyAndPassword.getNewPassword(), updatedUser.getPassword())).isTrue(); } @Test @Transactional public void testFinishPasswordResetTooSmall() throws Exception { User user = new User(); user.setPassword(RandomStringUtils.random(60)); user.setLogin("finish-password-reset-too-small"); user.setEmail("[email protected]"); user.setResetDate(Instant.now().plusSeconds(60)); user.setResetKey("reset key too small"); userRepository.saveAndFlush(user); KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM(); keyAndPassword.setKey(user.getResetKey()); keyAndPassword.setNewPassword("foo"); restMvc.perform( post("/api/account/reset-password/finish") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(keyAndPassword))) .andExpect(status().isBadRequest()); User updatedUser = userRepository.findOneByLogin(user.getLogin()).orElse(null); assertThat(passwordEncoder.matches(keyAndPassword.getNewPassword(), updatedUser.getPassword())).isFalse(); } @Test @Transactional public void testFinishPasswordResetWrongKey() throws Exception { KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM(); keyAndPassword.setKey("wrong reset key"); keyAndPassword.setNewPassword("new password"); restMvc.perform( post("/api/account/reset-password/finish") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(keyAndPassword))) .andExpect(status().isInternalServerError()); } }
fffe7243a5bba60efbd8740534b717c6906ad2a0
b72632067f9b1845fbd6c73bda4d247b4039a3a4
/src/handler/print/menu/ScoreBoardMenu.java
469c3544d929ba2a274ab234f49ef8afbc018dc3
[]
no_license
thedavv/Oko-Game
334c6e9800ecb3317ca715a3ee8f000728039530
17641b464e499c3f3b98ce7b6b9cb302f00baec7
refs/heads/master
2021-01-15T10:20:24.666603
2017-09-14T11:47:14
2017-09-14T11:47:14
99,579,294
0
0
null
null
null
null
UTF-8
Java
false
false
1,125
java
package handler.print.menu; import util.Const; /** * Creates the ScoreBoardMenu menu. Use it for showing the Final Scores */ public class ScoreBoardMenu extends LineCreation implements MenuIO { @Override public String createMenu(String data) { StringBuilder sb = new StringBuilder(); sb.append(drawLine(settings.getMenuLenght(), Const.TLC, Const.TRC, Const.HL, null)); sb.append("\n"); sb.append(drawLine(settings.getMenuLenght(), Const.VL, Const.VL, Const.SP, "SCOREBOARD")); sb.append("\n"); sb.append(drawLine(settings.getMenuLenght(), Const.LMJ, Const.RMJ, Const.HL, null)); sb.append("\n"); sb.append(drawLine(settings.getMenuLenght(), Const.VL, Const.VL, Const.SP, null)); sb.append("\n"); for (String str : data.split("\n")) { sb.append(drawLine(settings.getMenuLenght(), Const.VL, Const.VL, Const.SP, str)); sb.append("\n"); } sb.append(drawLine(settings.getMenuLenght(), Const.VL, Const.VL, Const.SP, null)); sb.append("\n"); sb.append(drawLine(settings.getMenuLenght(), Const.BLC, Const.BRC, Const.HL, null)); return sb.toString(); } }
299d5e39971f36e804f0383e53bf1f408fc68a06
c43a892192412d00e1d1ab8f01603204d6c45f82
/app/src/main/java/com/example/rapfilm/custom/StringPresenter.java
a636fc1e15ea5aab2abc56a6623237a8ec89a2dd
[]
no_license
nhtlquan/rapfilm
987032efe781cdd98cccb31ea2ca1c0762014583
23e3aaa597c84b26d26b32d52550b6b8c9992c2f
refs/heads/master
2020-03-17T13:15:38.367398
2018-05-09T04:26:51
2018-05-09T04:26:51
133,624,127
0
0
null
null
null
null
UTF-8
Java
false
false
503
java
package com.example.rapfilm.custom; import android.content.Context; import com.example.rapfilm.ui.presenter.AbstractCardPresenter; public class StringPresenter extends AbstractCardPresenter<StringCardView> { public StringPresenter(Context context) { super(context); } protected StringCardView onCreateView() { return new StringCardView(getContext()); } public void onBindViewHolder(Object card, StringCardView cardView) { cardView.updateUi(card); } }
ac741528eb6fed746c55a3198c8b76ad5f35508c
f4a46e7c2e430a24f247086d505872c286787350
/integration-app/src/main/java/uk/gov/crowncommercial/esourcing/integration/app/RollbarConfigurationProperties.java
86c051e9160bd78a4a5cecac581fe30851aa7559
[]
no_license
RoweIT/ccs-esourcing-tenders-api
3f020f43529932d5432b94e846729949559680a0
509c42ed1dc2815cc525bd35647e019d00c1523a
refs/heads/main
2023-02-22T00:49:12.215452
2021-01-26T15:31:54
2021-01-26T15:31:54
322,259,102
1
0
null
2021-01-26T15:31:55
2020-12-17T10:26:11
Java
UTF-8
Java
false
false
1,112
java
package uk.gov.crowncommercial.esourcing.integration.app; import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "rollbar") public final class RollbarConfigurationProperties { private boolean enabled; private String accessToken; private String environment; private String framework; private String endpoint; public boolean isEnabled() { return enabled; } public String getAccessToken() { return accessToken; } public String getEnvironment() { return environment; } public String getFramework() { return framework; } public String getEndpoint() { return endpoint; } public void setEnabled(boolean enabled) { this.enabled = enabled; } public void setAccessToken(String accessToken) { this.accessToken = accessToken; } public void setEnvironment(String environment) { this.environment = environment; } public void setFramework(String framework) { this.framework = framework; } public void setEndpoint(String endpoint) { this.endpoint = endpoint; } }
4c174446e3bc7a0e32aefb8e25f26d859e6981f9
146067f701b115e63ed66d2fa35793c1987e7b0f
/src/main/java/ru/iammaxim/GUIlib/ToolbarButtons/CloseButton.java
3d0083b73c84a9a9f66ccb468a6049e6f263d00d
[]
no_license
IamMaxim/ConsoleLib
01be9e723db79ebeb4fcd5331f22b1c25c1af97e
4fadbbc75bb9d14875c85aac26ba2bb658749827
refs/heads/master
2020-09-21T19:58:11.534735
2016-09-08T16:51:43
2016-09-08T16:51:43
67,722,393
0
0
null
null
null
null
UTF-8
Java
false
false
683
java
package ru.iammaxim.GUIlib.ToolbarButtons; import javax.imageio.ImageIO; import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.io.File; import java.io.IOException; /** * Created by maxim on 24.08.2016. */ public class CloseButton extends ToolbarButton { public CloseButton() { super(); try { button = ImageIO.read(getClass().getResource("/data/images/buttons/closeButton.png")); hoveredButton = ImageIO.read(getClass().getResource("/data/images/buttons/closeButtonHovered.png")); } catch (IOException e) { e.printStackTrace(); } } }
8a595be8c32163ff0aac99e63b0911c3dc1ba897
124463320d11a37e5ef08dab7e3699f7d4a10c36
/day21/practise/Multiplyfloat.java
6daa616555a27147c0418db2ed2c4a09108ee43c
[ "Apache-2.0" ]
permissive
Anuhya98/MyRep
c65b4a78e9706781d63cce50b72713ad67881a3d
f28c6ffcb7abe0cef82b979f6216b0d6562a66fd
refs/heads/master
2023-01-13T23:43:23.081456
2020-02-19T12:41:02
2020-02-19T12:41:02
233,763,544
0
0
Apache-2.0
2023-01-07T14:08:47
2020-01-14T05:28:35
HTML
UTF-8
Java
false
false
321
java
package com.practise; import java.util.Scanner; public class Multiplyfloat { public static void main(String[] args) { System.out.println("Enter the values"); Scanner in=new Scanner(System.in); float a1=in.nextFloat(); float b1=in.nextFloat(); float c=(a1*b1); System.out.println("The result is "+c); } }
[ "Anuhya98" ]
Anuhya98
231ea1e15332de107faf23395c3609cea8c71f1c
9dc9f8dafb58dd27d4791379458b7bf60cdaebc5
/src/ua/practice/java/ch1_object/E10_ShowArgs.java
38b37691e0652f7f5eaa45838053829f800465b3
[]
no_license
vasiliykulik/Practice-with-Bruce-Eckel
00dc60563b42eb0a26b8aff4365c0c60cdd5bfe3
dc745eef472419b43adffbb35f15fd403dcff366
refs/heads/master
2021-01-22T21:22:48.764801
2020-06-18T15:49:31
2020-06-18T15:49:31
85,421,493
0
0
null
null
null
null
UTF-8
Java
false
false
1,180
java
package ch1_object; /** * Created by Vasiliy Kylik on 23.05.2017. */ /****************** Exercise 10 **************** * * Write a program that prints three arguments * taken from the command line. * You'll need to index into the command-line * array of Strings. ***********************************************/ public class E10_ShowArgs { public static void main(String[] args) { if (args.length < 3) { System.err.println("Need 3 arguments"); System.exit(1); } System.out.println(args[0]); System.out.println(args[1]); System.out.println(args[2]); } /*Remember, when you want to get an argument from the command line: • Arguments are provided in a String array. • args[0] is the first command-line argument and not the name of the program (as it is in C). • You’ll cause a runtime exception if you run the program without enough arguments.*/ /*System.exit( ) terminates the program and passes its argument back to the operating system as a status code. (With most operating systems, a non-zero status code indicates that the program execution failed.) Typically, you send error messages to System.err, as shown above.*/ }
26f7d3aaf0c7887ccda9d843c9007e7a44054744
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/23/23_3442324ccdcf45374b42e067a3a6b2ff102a0a9c/InstallWorker/23_3442324ccdcf45374b42e067a3a6b2ff102a0a9c_InstallWorker_t.java
dc24c36513d179106ec2a78cc12de8564ef7b94e
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
5,935
java
package de.haukerehfeld.quakeinjector; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import javax.swing.SwingWorker; /** * Install maps in a worker thread * Init once and let swing start it - don't reuse */ public class InstallWorker extends SwingWorker<PackageFileList, Void> { private String url; private String baseDirectory; private Package map; private long downloadSize = 0; private long downloaded = 0; private PackageFileList files; public InstallWorker(Package map, String url, String baseDirectory) { this.map = map; this.url = url; this.baseDirectory = baseDirectory; } @Override public PackageFileList doInBackground() throws IOException, FileNotFoundException, Installer.CancelledException { System.out.println("Installing " + map.getId()); try { files = download(url); } catch (Installer.CancelledException e) { System.out.println("cancelled exception!"); //throw e; throw new OnlineFileNotFoundException(); } map.setInstalled(true); return files; } public PackageFileList download(String urlString) throws java.io.IOException, Installer.CancelledException { URL url; try { url = new URL(urlString); } catch (java.net.MalformedURLException e) { throw new RuntimeException("Something is wrong with the way we construct URLs"); } URLConnection con; InputStream in; try { con = url.openConnection(); this.downloadSize = con.getContentLength(); in = (InputStream) url.getContent(); } catch (FileNotFoundException e) { throw new OnlineFileNotFoundException(e.getMessage()); } String relativedir = map.getRelativeBaseDir(); String unzipdir = baseDirectory; if (relativedir != null) { unzipdir += File.separator + relativedir; } return unzip(in, this.baseDirectory, unzipdir, map.getId()); } public PackageFileList unzip(InputStream in, String basedir, String unzipdir, String mapid) throws IOException, FileNotFoundException, Installer.CancelledException { files = new PackageFileList(mapid); ZipInputStream zis = new ZipInputStream(new BufferedInputStream(in)); ZipEntry entry; while((entry = zis.getNextEntry()) != null) { File f = new File(unzipdir + File.separator + entry.getName()); //System.out.println("Processing " + f); ArrayList<File> createdDirs = mkdirs(f); for (File dirname: createdDirs) { String relative = RelativePath.getRelativePath(new File(basedir), dirname); //System.out.println("adding to installpaths: " + relative); files.add(relative); } if (entry.isDirectory()) { continue; } String filename = RelativePath.getRelativePath(new File(basedir), f); files.add(filename); System.out.println("Writing " + filename + " (" + entry.getCompressedSize() + "b)"); try { writeFile(zis, f, new WriteToDownloadProgress(entry.getCompressedSize(), entry.getSize())); } catch (FileNotFoundException e) { files.remove(filename); throw new FileNotWritableException(e.getMessage()); } } //save the mapfile list so we can uninstall zis.close(); return files; } private ArrayList<File> mkdirs(File f) { ArrayList<File> files = new ArrayList<File>(); if (f.isDirectory()) { files.add(f); } File parentDir = f.getParentFile(); while (!parentDir.exists()) { files.add(parentDir); parentDir = parentDir.getParentFile(); } java.util.Collections.reverse(files); for (File dir: files) { System.out.println("Creating dir " + dir); dir.mkdir(); } return files; } private void writeFile(InputStream in, File file, WriteToDownloadProgress progress) throws FileNotFoundException, IOException, Installer.CancelledException { writeFile(in, file, 2048, progress); } private void writeFile(InputStream in, File file, int BUFFERSIZE, WriteToDownloadProgress progress) throws FileNotFoundException, IOException, Installer.CancelledException { byte data[] = new byte[BUFFERSIZE]; BufferedOutputStream dest = new BufferedOutputStream(new FileOutputStream(file), BUFFERSIZE); int readcount; while ((readcount = in.read(data, 0, BUFFERSIZE)) != -1) { progress.publish(readcount); dest.write(data, 0, readcount); } dest.flush(); dest.close(); } private class WriteToDownloadProgress { private long downloadSize; private long writeSize; public WriteToDownloadProgress(long downloadSize, long writeSize) { this.downloadSize = downloadSize; this.writeSize = writeSize; if (writeSize <= 0) { System.out.println("writeSize " + writeSize); } } public void publish(int writtenBytes) throws Installer.CancelledException { long downloaded = downloadSize * writtenBytes / writeSize; addDownloaded(downloaded); } } private void addDownloaded(long read) throws Installer.CancelledException { //we do this here because this is the most frequently called portion checkCancelled(); downloaded += read; int progress = (int) (100 * downloaded / downloadSize); //System.out.println("Progress(%): " + progress); if (progress <= 100) { setProgress(progress); } } private void checkCancelled() throws Installer.CancelledException { if (isCancelled()) { System.out.println("canceling..."); throw new Installer.CancelledException(); } } public PackageFileList getInstalledFiles() { return files; } }
fa46f50b702055dc7bdf17402492214be585bd21
6156e86920f97f5bf2b7559818b5c060e373fca0
/src/praktek1/kapalAksi.java
588e4a5a9ecaee454f10c8f69f630578306699d1
[]
no_license
firdiseptiady/praktek1
f8368ede4b5a880c7d2f0fa3890be9b810dbca6b
22dc9a7f9773b467bafab9a50dfec300aa55bf7c
refs/heads/master
2021-04-15T15:15:51.121138
2018-03-26T12:39:38
2018-03-26T12:39:38
126,827,649
0
0
null
null
null
null
UTF-8
Java
false
false
1,116
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 praktek1; /** * * @author TWINCOM */ public class kapalAksi { public static void main(String[] args) { kapal A = new kapal(); kapal B = new kapal(); kapal C = new kapal(); A.Jenis_kapal="kapal perang"; A.Bentuk_kapal="besar"; A.Warna_kapal="hitam"; A.Tempat_duduk="kelas ekonomi"; A.Pelampung="ban"; B.Jenis_kapal="kapal pesiar"; B.Bentuk_kapal="kecil"; B.Warna_kapal="putih"; B.Tempat_duduk="kelas bisnis"; B.Pelampung="baju"; C.Jenis_kapal="kapal feri"; C.Bentuk_kapal="sedang"; C.Warna_kapal="campuran"; C.Tempat_duduk="kelas VVIP"; C.Pelampung="perahu karet"; A.cetakInfo(); System.out.println(); B.cetakInfo(); System.out.println(); C.cetakInfo(); System.out.println(); } }
17b47896a6cc6333731fbac955fd8de1e56f0d05
6c2f5fd7b397f4e4237c6c082109e948bd71ad13
/src/test/java/io/vertx/web/VerticleTest.java
d54f18da5320b5f6e32745b37675ea11112ba1c7
[]
no_license
natanaeladit/gcp
ed0f50ab4a80c7e818cd7122e1ff81aa01f0ad78
87e133b3bfe7b4194df0b9892a6e5b9cfbbe0260
refs/heads/master
2022-09-16T22:13:21.117307
2019-07-16T15:30:04
2019-07-16T15:30:04
196,784,042
0
0
null
2022-02-16T00:57:57
2019-07-14T02:12:11
Java
UTF-8
Java
false
false
3,945
java
package io.vertx.web; import io.vertx.config.ConfigRetriever; import io.vertx.config.ConfigRetrieverOptions; import io.vertx.config.ConfigStoreOptions; import io.vertx.core.DeploymentOptions; import io.vertx.core.Vertx; import io.vertx.core.json.Json; import io.vertx.core.json.JsonObject; import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; import io.vertx.ext.unit.junit.VertxUnitRunner; import java.io.IOException; import java.net.ServerSocket; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(VertxUnitRunner.class) public class VerticleTest { private Vertx vertx; private int port; @Before public void setUp(TestContext context) { vertx = Vertx.vertx(); try { ServerSocket socket = new ServerSocket(0); port = socket.getLocalPort(); socket.close(); } catch (IOException e) { e.printStackTrace(); } ConfigStoreOptions fileStore = new ConfigStoreOptions().setType("file") .setConfig(new JsonObject().put("path", "my-it-config.json")); ConfigRetrieverOptions configOptions = new ConfigRetrieverOptions().addStore(fileStore); ConfigRetriever retriever = ConfigRetriever.create(vertx, configOptions); retriever.getConfig(ar -> { if (ar.failed()) { // Failed to retrieve the configuration } else { JsonObject fileConfig = ar.result(); DeploymentOptions options = new DeploymentOptions().setConfig(fileConfig.put("http.port", port)); vertx.deployVerticle(Verticle.class.getName(), options, context.asyncAssertSuccess()); } }); } @After public void tearDown(TestContext context) { vertx.close(context.asyncAssertSuccess()); } @Test public void testMyApplication(TestContext context) { final Async async = context.async(); vertx.createHttpClient().getNow(port, "localhost", "/", response -> { response.handler(body -> { context.assertTrue(body.toString().contains("Hello")); async.complete(); }); }); } @Test public void checkThatTheIndexPageIsServed(TestContext context) { final Async async = context.async(); vertx.createHttpClient().getNow(port, "localhost", "/assets/index.html", response -> { context.assertEquals(response.statusCode(), 200); context.assertTrue(response.headers().get("content-type").contains("text/html")); response.bodyHandler(body -> { context.assertTrue(body.toString().contains("<h1>My Whisky Collection</h1>")); async.complete(); }); }); } @Test public void checkThatWeCanAdd(TestContext context) { Async async = context.async(); final String json = Json.encodePrettily(new Whisky("Jameson", "Ireland")); final String length = Integer.toString(json.length()); vertx.createHttpClient().post(port, "localhost", "/api/whiskies").putHeader("content-type", "application/json") .putHeader("content-length", length).handler(response -> { context.assertEquals(response.statusCode(), 201); context.assertTrue(response.headers().get("content-type").contains("application/json")); response.bodyHandler(body -> { final Whisky whisky = Json.decodeValue(body.toString(), Whisky.class); context.assertEquals(whisky.getName(), "Jameson"); context.assertEquals(whisky.getOrigin(), "Ireland"); context.assertNotNull(whisky.getId()); async.complete(); }); }).write(json).end(); } }