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
3ca4f3da633f13e8326fcdfd73666f7587091b55
2935ed67070bdce9ff887342b95919251a269f48
/src/easy/MaximumDepth.java
78ee3a8688da7d4bd4d9bf6f4a7df275cd4c2248
[]
no_license
wenkie077/leet_code
e780c8fdcff1bafc9023d18fa8af2bf3cda27440
6c155b81486ef5e6379406fff961cc6a4f98f30b
refs/heads/master
2020-05-09T12:12:35.468100
2020-01-16T19:01:46
2020-01-16T19:01:46
181,105,305
0
0
null
2019-04-13T22:20:29
2019-04-13T01:24:42
null
UTF-8
Java
false
false
51
java
package easy; public class MaximumDepth { }
677493fe601e57bfefca28bed6177c33ca63da6c
6b526c9d489f7f466fa77e190929187c3f52b91a
/src/main/java/rien/bijl/Scoreboard/r/Main.java
e6859521c65bbe797e9880bb3522d1310e42882d
[]
no_license
Apisathan/Scoreboard-revision
f5cd129669e365e8da6e93c0f89dba3b629ac4c3
079d057e99a735b3035defd1395b749ecd486752
refs/heads/master
2023-03-31T07:05:24.225395
2021-03-24T18:58:02
2021-03-24T18:58:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
228
java
package rien.bijl.Scoreboard.r; import org.bukkit.plugin.java.JavaPlugin; public class Main extends JavaPlugin { public void onEnable() { new ScoreboardRevision(this, "board") .enable(); } }
b878f000c00103256e25aae7d24ed45d7e1618bd
a133808b36294d9a4e3dec4238e788936cffe117
/src/com/Day3/ForEachLoop.java
d79af0b9dee0f5bd2acaed246301a2a24ba770cd
[]
no_license
SahilTiwari22/Training-Assignments
26e4f95dd35d32006ab41407663464e20ded9356
0cb5c73abdb44273440cc4da28c4bb73b8594815
refs/heads/master
2022-12-19T17:30:55.888237
2020-09-28T05:11:20
2020-09-28T05:11:20
287,051,600
0
0
null
null
null
null
UTF-8
Java
false
false
343
java
package com.Day3; public class ForEachLoop { public static void main(String[] args) { /* int[] NumberArray = {1, 2, 3, 4, 5}; int number = HighestNumber(NumberArray); */ } } /*public static int HighestNumber(int[] numbers){ for (int traverse:numbers) { int result; result=*/
e1f5de3f6a6ae26bdebab1cc13d1774b048c6e3f
ce81794284403a139b2235411db3c69801836131
/exercicios-jpa/src/infra/DAO.java
065c3807db4b1ddcf4efeaa2f514171e2ba5f0d9
[]
no_license
jrxr/Programas_Java
b7d491aa4172c22e734b7fed8690e553500f20bb
19b3ffb39186c973487990861ddbee0545abf8b3
refs/heads/master
2022-11-06T22:36:59.042040
2020-06-27T15:43:18
2020-06-27T15:43:18
275,393,548
0
0
null
null
null
null
UTF-8
Java
false
false
1,929
java
package infra; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.persistence.TypedQuery; public class DAO<E> { private static EntityManagerFactory emf; private EntityManager em; private Class<E> classe; static { try { emf = Persistence .createEntityManagerFactory("exercicios-jpa"); } catch (Exception e) { // logar -> log4j } } public DAO() { this(null); } public DAO(Class<E> classe) { this.classe = classe; em = emf.createEntityManager(); } public DAO<E> abrirT(){ em.getTransaction().begin(); return this; } public DAO<E> fecharT(){ em.getTransaction().commit(); return this; } public DAO<E> incluir(E entidade){ em.persist(entidade); return this; } public DAO<E> incluirAtomico(E entidade){ return this.abrirT().incluir(entidade).fecharT(); } public E obterPorID(Object id) { return em.find(classe, id); } public List<E> obterTodos(){ return this.obterTodos(10, 0); } public List<E> obterTodos(int qtde, int deslocamento){ if(classe == null) { throw new UnsupportedOperationException("Classe nula."); } String jpql = "select e from" + classe.getName() + "e"; TypedQuery<E> query = em.createQuery(jpql, classe); query.setMaxResults(qtde); query.setFirstResult(deslocamento); return query.getResultList(); } public List<E> consultar(String nomeConsulta, Object... params){ TypedQuery<E> query = em.createNamedQuery(nomeConsulta, classe); for (int i = 0; i < params.length; i += 2) { query.setParameter(params[i].toString(), params[i + 1]); } return query.getResultList(); } public E consultarUm(String nomeConsulta, Object... params){ List<E> lista = consultar(nomeConsulta, params); return lista.isEmpty() ? null : lista.get(0); } public void fechar() { em.close(); } }
6cb04fe247bcc67bdabd36f7c0d6604a95b7fa19
91945432326100e7b6f069f7a234e21c8d6b18f6
/engsoft1globalcode/LojaCelular/src/Loja.java
cf9a125f286f350f189ca748af6a80bdf8fbabf1
[ "MIT" ]
permissive
andersonsilvade/workspacejava
15bd27392f68649fe92df31483f09c441d457e0e
dd85abad734b7d484175c2580fbaad3110653ef4
refs/heads/master
2016-09-05T13:03:02.963321
2014-09-16T12:49:41
2014-09-16T12:49:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
550
java
import java.util.LinkedList; import java.util.List; public class Loja { private List<Celular> celular; public Loja(){ celular =new LinkedList<Celular>(); } public void addCelular(Celular cel){ celular.add(cel); } public List<Celular> buscarCelular(Especificacao espCliente){ List<Celular> encontrado = new LinkedList<Celular>(); for(Object i : celular){ Celular celularEncontrado = (Celular)i; if(celularEncontrado.getEsp().matches(espCliente)==true)encontrado.add(celularEncontrado); } return encontrado; } }
0af37543b89f6c155c8ae1dbc11e4580ac8c7896
ae4dc0f7994beb9218f30754806d99781d889ce9
/src/main/java/br/com/caelum/carangobom/webapi/security/SecurityConfiguration.java
6cebf32ee84e5e3943b807569d72c840bf292aa2
[]
no_license
knuxbbs/carango-bom-api-base
e32dc9b0e0daab7e922d66922d0f7b11ffed9228
9a5c5396d0558d024dddcfa32fc9e2048e8b1cf3
refs/heads/main
2023-08-06T09:11:07.548915
2021-09-23T14:45:41
2021-09-23T14:45:41
402,888,489
0
0
null
2021-09-15T19:27:12
2021-09-03T20:18:41
Java
UTF-8
Java
false
false
2,031
java
package br.com.caelum.carangobom.webapi.security; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; @EnableWebSecurity @Configuration public class SecurityConfiguration extends WebSecurityConfigurerAdapter { @Autowired private UserService userService; @Autowired private JwtRequestFilter jwtFilter; @Override @Bean protected AuthenticationManager authenticationManager() throws Exception { return super.authenticationManager(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(userService).passwordEncoder(new BCryptPasswordEncoder()); } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/auth/login/**").permitAll() .antMatchers(HttpMethod.GET, "/veiculos/**").permitAll() .antMatchers(HttpMethod.GET, "/marcas/**").permitAll().anyRequest().authenticated().and() .cors().and().csrf().disable().sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() .addFilterAfter(jwtFilter, UsernamePasswordAuthenticationFilter.class); } }
8d5dbd502b11668a1c85bf49627031eb19a49df0
9bab563a41f780fefeec632d5570f871a31780b5
/src/main/java/gov/cqaudit/finance/hibernate/entities/BillDBackId.java
c2a4de3bae5fa6d882f61d201569e94eb22f2407
[]
no_license
cqqyd2014/finance
3304cf4891e115a601ca37bd2696738c5b44f668
1a705476b9eb823869b88192edd204cdd7942437
refs/heads/master
2021-09-16T03:00:35.975060
2018-06-15T06:58:20
2018-06-15T06:58:20
111,647,255
0
0
null
null
null
null
UTF-8
Java
false
false
2,315
java
package gov.cqaudit.finance.hibernate.entities; // Generated 2018-2-9 12:39:57 by Hibernate Tools 5.2.3.Final import javax.persistence.Column; import javax.persistence.Embeddable; /** * BillDBackId generated by hbm2java */ @Embeddable public class BillDBackId implements java.io.Serializable { private String billUuid; private String detailUuid; private String accountId; public BillDBackId() { } public BillDBackId(String billUuid, String detailUuid, String accountId) { this.billUuid = billUuid; this.detailUuid = detailUuid; this.accountId = accountId; } @Column(name = "bill_uuid", nullable = false, length = 36) public String getBillUuid() { return this.billUuid; } public void setBillUuid(String billUuid) { this.billUuid = billUuid; } @Column(name = "detail_uuid", nullable = false, length = 36) public String getDetailUuid() { return this.detailUuid; } public void setDetailUuid(String detailUuid) { this.detailUuid = detailUuid; } @Column(name = "account_id", nullable = false, length = 128) public String getAccountId() { return this.accountId; } public void setAccountId(String accountId) { this.accountId = accountId; } public boolean equals(Object other) { if ((this == other)) return true; if ((other == null)) return false; if (!(other instanceof BillDBackId)) return false; BillDBackId castOther = (BillDBackId) other; return ((this.getBillUuid() == castOther.getBillUuid()) || (this.getBillUuid() != null && castOther.getBillUuid() != null && this.getBillUuid().equals(castOther.getBillUuid()))) && ((this.getDetailUuid() == castOther.getDetailUuid()) || (this.getDetailUuid() != null && castOther.getDetailUuid() != null && this.getDetailUuid().equals(castOther.getDetailUuid()))) && ((this.getAccountId() == castOther.getAccountId()) || (this.getAccountId() != null && castOther.getAccountId() != null && this.getAccountId().equals(castOther.getAccountId()))); } public int hashCode() { int result = 17; result = 37 * result + (getBillUuid() == null ? 0 : this.getBillUuid().hashCode()); result = 37 * result + (getDetailUuid() == null ? 0 : this.getDetailUuid().hashCode()); result = 37 * result + (getAccountId() == null ? 0 : this.getAccountId().hashCode()); return result; } }
7d38b0bbe6dd74bd60860e4c8cf2cfa7cc027a5c
06610056bfd1c9aec25cf7ec19249e42ba737850
/UserModel.java
bf798ba589175ca0d65e01f00ade8ffe91cfe62d
[]
no_license
Jate099/ejercicioS4_2
4220ff80d67e72318f05bb6a7fb099e64b504a6a
d6bc89c1f0d4a7566428373a005941e94f76a255
refs/heads/master
2020-03-27T03:45:54.342915
2018-08-23T17:59:54
2018-08-23T17:59:54
145,888,119
0
0
null
null
null
null
UTF-8
Java
false
false
788
java
package com.example.estudiante.ejercicios4_2; //Se crea una clase modelo para controlr los datos public class UserModel { private String name; private String email; private String userName; public UserModel(String name, String email, String userName) { this.name = name; this.email = email; this.userName = userName; } public String getName() { return name; } public String getEmail() { return email; } public String getUserName() { return userName; } public void setName(String name) { this.name = name; } public void setEmail(String email) { this.email = email; } public void setUserName(String userName) { this.userName = userName; } }
068a6f139a510d9502339f416a6ba45414dcd795
7a5b587696528e3cc6d839534ac1b7e5ab2ef41f
/src/com/huxiqing/vo/JsonBean.java
c99736e3ec4a6e9cbf3edf8a509e2a09a0a30503
[]
no_license
h2440222798/booksys
d5d07375de823cf0630b435f4a27783215fed1b5
7c67c1cca7c7d720286d001907ae986955d6cb52
refs/heads/master
2020-03-24T17:05:36.048656
2018-07-30T10:41:02
2018-07-30T10:41:02
142,848,742
0
0
null
null
null
null
UTF-8
Java
false
false
324
java
package com.huxiqing.vo; public class JsonBean { private Integer code; private Object msg; public Integer getCode() { return code; } public void setCode(Integer code) { this.code = code; } public Object getMsg() { return msg; } public void setMsg(Object msg) { this.msg = msg; } }
0149b91b9d6b5d2c4f252e694adb148203bed2dd
4c9b4886f833b3a462ffc60f8fde5412e2826e68
/leetcode/Algorithms/953.VerifyingAnAlienDictionary/Solution.java
262d1768427e66ac09b027cf7ea132a00cd6a0b2
[ "MIT" ]
permissive
liupangzi/codekata
a99f015c9149b20565be85ed5c4f55cccdf5b5ee
079373707601198f79fb6215b876a4cbcab32ee9
refs/heads/master
2021-01-23T21:34:26.416592
2020-09-21T05:32:25
2020-09-21T05:32:25
57,054,901
58
8
null
null
null
null
UTF-8
Java
false
false
890
java
class Solution { public boolean isAlienSorted(String[] words, String order) { int[] orders = new int[26]; for (int i = 0; i < order.length(); i++) { orders[order.charAt(i) - 'a'] = i; } for (int i = 1; i < words.length; i++) { if (!isSorted(words[i - 1], words[i], orders)) { return false; } } return true; } private boolean isSorted(String a, String b, int[] orders) { int cursor = 0; while (cursor < Math.min(a.length(), b.length())) { if (orders[b.charAt(cursor) - 'a'] > orders[a.charAt(cursor) - 'a']) { return true; } else if (orders[b.charAt(cursor) - 'a'] < orders[a.charAt(cursor) - 'a']) { return false; } cursor++; } return a.length() == cursor; } }
e3e92fa027cf3b435902e89f58a1bcf7188a1905
7ccd6e86155802647561a856890f23450dea67b0
/app/src/main/java/com/zhuyu/retrofitdemo/netUtils/AppendHeaderParamInterceptor.java
31102a9ad192a16403bf051f222101afe4c22440
[]
no_license
zhuyu1022/RetrofitDemo
0b2aa83e7171c58de41a0d566b137df1db8fce99
3eee57035674ad1d615a6e010b18676b7c75ca60
refs/heads/master
2020-03-22T03:02:25.721426
2018-07-05T09:43:28
2018-07-05T09:43:28
139,409,629
1
0
null
null
null
null
UTF-8
Java
false
false
949
java
package com.zhuyu.retrofitdemo.netUtils; import java.io.IOException; import okhttp3.Headers; import okhttp3.Interceptor; import okhttp3.Request; import okhttp3.Response; /** * Name: AppendHeaderParamInterceptor header统一追加参数 * Author: zhu_yu * Email: * Comment: //TODO * Date: 2018-07-05 17:12 */ public class AppendHeaderParamInterceptor implements Interceptor { @Override public Response intercept(Chain chain) throws IOException { Request request = chain.request(); Headers.Builder builder = request.headers().newBuilder(); //追加参数,得到新的headers Headers newHeaders = builder.add("userid", "zhuyu") .add("token", "i am token") .build(); //利用新的headers,构建新request,发送给服务器 Request newRequest = request.newBuilder().headers(newHeaders).build(); return chain.proceed(newRequest); } }
9d6400aa9d26524b6457f303fab7e40017ccad89
dd5a7cdf2d6b7d20dc6fb51702c19912f0c2a44c
/baseweb/src/main/java/com/star/base/dataobject/CommonFileDOExample.java
684abdc2f1df137efbf6bdbf205234a9a1e14f98
[]
no_license
chirdxing/starplay
ef4a547117d9a59c05db8746ec257c8e2f018ac5
9e87c993fb84e497ec55e252e607e196b23c6b5b
refs/heads/master
2022-12-20T23:45:45.959412
2020-01-07T05:52:19
2020-01-07T05:53:25
232,250,403
1
0
null
2022-12-16T05:16:38
2020-01-07T05:36:49
Java
UTF-8
Java
false
false
17,604
java
package com.star.base.dataobject; import java.util.ArrayList; import java.util.Date; import java.util.List; public class CommonFileDOExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public CommonFileDOExample() { 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 andUidIsNull() { addCriterion("uid is null"); return (Criteria) this; } public Criteria andUidIsNotNull() { addCriterion("uid is not null"); return (Criteria) this; } public Criteria andUidEqualTo(Integer value) { addCriterion("uid =", value, "uid"); return (Criteria) this; } public Criteria andUidNotEqualTo(Integer value) { addCriterion("uid <>", value, "uid"); return (Criteria) this; } public Criteria andUidGreaterThan(Integer value) { addCriterion("uid >", value, "uid"); return (Criteria) this; } public Criteria andUidGreaterThanOrEqualTo(Integer value) { addCriterion("uid >=", value, "uid"); return (Criteria) this; } public Criteria andUidLessThan(Integer value) { addCriterion("uid <", value, "uid"); return (Criteria) this; } public Criteria andUidLessThanOrEqualTo(Integer value) { addCriterion("uid <=", value, "uid"); return (Criteria) this; } public Criteria andUidIn(List<Integer> values) { addCriterion("uid in", values, "uid"); return (Criteria) this; } public Criteria andUidNotIn(List<Integer> values) { addCriterion("uid not in", values, "uid"); return (Criteria) this; } public Criteria andUidBetween(Integer value1, Integer value2) { addCriterion("uid between", value1, value2, "uid"); return (Criteria) this; } public Criteria andUidNotBetween(Integer value1, Integer value2) { addCriterion("uid not between", value1, value2, "uid"); return (Criteria) this; } public Criteria andFilenameIsNull() { addCriterion("filename is null"); return (Criteria) this; } public Criteria andFilenameIsNotNull() { addCriterion("filename is not null"); return (Criteria) this; } public Criteria andFilenameEqualTo(String value) { addCriterion("filename =", value, "filename"); return (Criteria) this; } public Criteria andFilenameNotEqualTo(String value) { addCriterion("filename <>", value, "filename"); return (Criteria) this; } public Criteria andFilenameGreaterThan(String value) { addCriterion("filename >", value, "filename"); return (Criteria) this; } public Criteria andFilenameGreaterThanOrEqualTo(String value) { addCriterion("filename >=", value, "filename"); return (Criteria) this; } public Criteria andFilenameLessThan(String value) { addCriterion("filename <", value, "filename"); return (Criteria) this; } public Criteria andFilenameLessThanOrEqualTo(String value) { addCriterion("filename <=", value, "filename"); return (Criteria) this; } public Criteria andFilenameLike(String value) { addCriterion("filename like", value, "filename"); return (Criteria) this; } public Criteria andFilenameNotLike(String value) { addCriterion("filename not like", value, "filename"); return (Criteria) this; } public Criteria andFilenameIn(List<String> values) { addCriterion("filename in", values, "filename"); return (Criteria) this; } public Criteria andFilenameNotIn(List<String> values) { addCriterion("filename not in", values, "filename"); return (Criteria) this; } public Criteria andFilenameBetween(String value1, String value2) { addCriterion("filename between", value1, value2, "filename"); return (Criteria) this; } public Criteria andFilenameNotBetween(String value1, String value2) { addCriterion("filename not between", value1, value2, "filename"); return (Criteria) this; } public Criteria andUrlIsNull() { addCriterion("url is null"); return (Criteria) this; } public Criteria andUrlIsNotNull() { addCriterion("url is not null"); return (Criteria) this; } public Criteria andUrlEqualTo(String value) { addCriterion("url =", value, "url"); return (Criteria) this; } public Criteria andUrlNotEqualTo(String value) { addCriterion("url <>", value, "url"); return (Criteria) this; } public Criteria andUrlGreaterThan(String value) { addCriterion("url >", value, "url"); return (Criteria) this; } public Criteria andUrlGreaterThanOrEqualTo(String value) { addCriterion("url >=", value, "url"); return (Criteria) this; } public Criteria andUrlLessThan(String value) { addCriterion("url <", value, "url"); return (Criteria) this; } public Criteria andUrlLessThanOrEqualTo(String value) { addCriterion("url <=", value, "url"); return (Criteria) this; } public Criteria andUrlLike(String value) { addCriterion("url like", value, "url"); return (Criteria) this; } public Criteria andUrlNotLike(String value) { addCriterion("url not like", value, "url"); return (Criteria) this; } public Criteria andUrlIn(List<String> values) { addCriterion("url in", values, "url"); return (Criteria) this; } public Criteria andUrlNotIn(List<String> values) { addCriterion("url not in", values, "url"); return (Criteria) this; } public Criteria andUrlBetween(String value1, String value2) { addCriterion("url between", value1, value2, "url"); return (Criteria) this; } public Criteria andUrlNotBetween(String value1, String value2) { addCriterion("url not between", value1, value2, "url"); return (Criteria) this; } public Criteria andCreateTimeIsNull() { addCriterion("create_time is null"); return (Criteria) this; } public Criteria andCreateTimeIsNotNull() { addCriterion("create_time is not null"); return (Criteria) this; } public Criteria andCreateTimeEqualTo(Date value) { addCriterion("create_time =", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeNotEqualTo(Date value) { addCriterion("create_time <>", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeGreaterThan(Date value) { addCriterion("create_time >", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { addCriterion("create_time >=", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeLessThan(Date value) { addCriterion("create_time <", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeLessThanOrEqualTo(Date value) { addCriterion("create_time <=", value, "createTime"); return (Criteria) this; } public Criteria andCreateTimeIn(List<Date> values) { addCriterion("create_time in", values, "createTime"); return (Criteria) this; } public Criteria andCreateTimeNotIn(List<Date> values) { addCriterion("create_time not in", values, "createTime"); return (Criteria) this; } public Criteria andCreateTimeBetween(Date value1, Date value2) { addCriterion("create_time between", value1, value2, "createTime"); return (Criteria) this; } public Criteria andCreateTimeNotBetween(Date value1, Date value2) { addCriterion("create_time not between", value1, value2, "createTime"); return (Criteria) this; } public Criteria andDeletedIsNull() { addCriterion("deleted is null"); return (Criteria) this; } public Criteria andDeletedIsNotNull() { addCriterion("deleted is not null"); return (Criteria) this; } public Criteria andDeletedEqualTo(Boolean value) { addCriterion("deleted =", value, "deleted"); return (Criteria) this; } public Criteria andDeletedNotEqualTo(Boolean value) { addCriterion("deleted <>", value, "deleted"); return (Criteria) this; } public Criteria andDeletedGreaterThan(Boolean value) { addCriterion("deleted >", value, "deleted"); return (Criteria) this; } public Criteria andDeletedGreaterThanOrEqualTo(Boolean value) { addCriterion("deleted >=", value, "deleted"); return (Criteria) this; } public Criteria andDeletedLessThan(Boolean value) { addCriterion("deleted <", value, "deleted"); return (Criteria) this; } public Criteria andDeletedLessThanOrEqualTo(Boolean value) { addCriterion("deleted <=", value, "deleted"); return (Criteria) this; } public Criteria andDeletedIn(List<Boolean> values) { addCriterion("deleted in", values, "deleted"); return (Criteria) this; } public Criteria andDeletedNotIn(List<Boolean> values) { addCriterion("deleted not in", values, "deleted"); return (Criteria) this; } public Criteria andDeletedBetween(Boolean value1, Boolean value2) { addCriterion("deleted between", value1, value2, "deleted"); return (Criteria) this; } public Criteria andDeletedNotBetween(Boolean value1, Boolean value2) { addCriterion("deleted not between", value1, value2, "deleted"); 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); } } }
2c2c69ae70bddd792b3d24ece0c965bc5bb3b2f6
7e68bf8fb4f22d6b3de2250c8cbf1984b35b241c
/android/app/src/main/java/com/biometricspoc/MainApplication.java
de7c550d89f252d5642c9ec632d64e79a85fdf3a
[]
no_license
iujisato/biometricspoc
48890b4fcc748d2220ddac8e97e77f68089c669b
9462ed7352f64f298bd0792c0ac3b8cab3ad2a8b
refs/heads/master
2023-04-02T02:24:43.050776
2021-04-13T16:47:07
2021-04-13T16:47:07
357,625,253
0
0
null
null
null
null
UTF-8
Java
false
false
1,049
java
package com.biometricspoc; import android.app.Application; import com.facebook.react.ReactApplication; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; import java.util.Arrays; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage() ); } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); } }
1c43f5ebe74db53e7b23985199f995dafaf1bf0b
4e3ad3a6955fb91d3879cfcce809542b05a1253f
/schema/ab-products/common/resources/src/main/com/archibus/app/common/notification/dao/datasource/NotificationTemplateDataSource.java
79ae4d594ee5a9070dc8fb645299feedefd7c977
[]
no_license
plusxp/ARCHIBUS_Dev
bee2f180c99787a4a80ebf0a9a8b97e7a5666980
aca5c269de60b6b84d7871d79ef29ac58f469777
refs/heads/master
2021-06-14T17:51:37.786570
2017-04-07T16:21:24
2017-04-07T16:21:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,925
java
package com.archibus.app.common.notification.dao.datasource; import java.util.List; import com.archibus.app.common.notification.dao.INotificationTemplateDao; import com.archibus.app.common.notification.domain.NotificationTemplate; import com.archibus.datasource.*; import com.archibus.datasource.data.*; /** * * @see ObjectDataSourceImpl. * * @author Zhang Yi * */ public class NotificationTemplateDataSource extends ObjectDataSourceImpl<NotificationTemplate> implements INotificationTemplateDao { /** * Field names to property names mapping. All fields will be added to the DataSource. */ private static final String[][] FIELDS_TO_PROPERTIES = { { Constants.TEMPLATE_ID, "id" }, { Constants.TRIGGER_CONDITION_TO, "triggerConditionTo" }, { Constants.TRIGGER_CONDITION_FROM, "triggerConditionFrom" }, { Constants.TRIGGER_DATE_FIELD, "triggerDateField" }, { "notify_recipients", "recipients" }, { "notify_message_id", "messageId" }, { "notify_recipients_grp", "recipientsGroup" }, { "notify_message_refby", "messageReferencedBy" }, { Constants.ACTIVITY_ID, "activityId" }, { "notify_subject", "subject" }, { "notify_subject_id", "subjectId" }, { "notify_subject_refby", "subjectReferencedBy" }, { "notify_type", "type" }, { "metric_collect_group_by", "metricCollectGroupBy" } }; /** * Constructs NotificationTemplateDataSource, mapped to <code>notify_templates</code> table, * using <code>NotificationTemplate</code> bean. */ public NotificationTemplateDataSource() { super("notificationTemplateBean", "notify_templates"); } /** {@inheritDoc} */ @Override public List<NotificationTemplate> getAllNotificationTemplates() { return new DataSourceObjectConverter<NotificationTemplate>().convertRecordsToObjects( this.getAllRecords(), this.beanName, this.fieldToPropertyMapping, null); } /** {@inheritDoc} */ @Override public NotificationTemplate getByPrimaryKey(final String templateId) { final PrimaryKeysValues primaryKeysValues = new PrimaryKeysValues(); { final DataRecordField pkField = new DataRecordField(); pkField.setName(this.tableName + DOT + Constants.TEMPLATE_ID); pkField.setValue(templateId); primaryKeysValues.getFieldsValues().add(pkField); } return this.get(primaryKeysValues); } /** {@inheritDoc} */ @Override public List<NotificationTemplate> getConvertedNotificationTemplates( final List<DataRecord> records) { return new DataSourceObjectConverter<NotificationTemplate>().convertRecordsToObjects( records, this.beanName, this.fieldToPropertyMapping, null); } @Override protected String[][] getFieldsToProperties() { return FIELDS_TO_PROPERTIES.clone(); } }
74393793c5742f3b538d8286208bfb54104ab838
6eb998912ed789495f0a321cb6038ad618a1ced3
/src/main/java/io/vlingo/example/perf/model/greeting/Greeting.java
ec01e45f40ad43565ecf133f9d70716bbc84a3c2
[]
no_license
pflueras/vlingo-example-perf
2fcb3c44e2d688cad3a60bb243c20048b82b75b3
66ce8a48fb4c73383522b3ac989b988486195af9
refs/heads/main
2023-02-27T08:37:53.416739
2021-01-29T22:05:43
2021-01-29T22:05:43
334,273,930
0
0
null
null
null
null
UTF-8
Java
false
false
823
java
package io.vlingo.example.perf.model.greeting; import io.vlingo.actors.Address; import io.vlingo.actors.Stage; import io.vlingo.common.Completes; import io.vlingo.example.perf.infrastructure.data.GreetingData; import io.vlingo.example.perf.infrastructure.data.UpdateGreetingData; public interface Greeting { static Completes<GreetingState> defineGreeting(Stage stage, GreetingData data){ Address address = stage.world().addressFactory().uniquePrefixedWith("g-"); Greeting greeting = stage.actorFor(Greeting.class, GreetingEntity.class); return greeting.defineGreeting(data); } Completes<GreetingState> defineGreeting(GreetingData data); Completes<GreetingState> updateMessage(UpdateGreetingData data); Completes<GreetingState> updateDescription(UpdateGreetingData data); }
f7e304b029318c2951401116a7d48f976dfde513
7bd3005495d0ba120c43c0c5cd6e6384c95c5990
/meadjohnson/src/main/java/com/cpm/dailyentry/MccainType.java
d1ae95ecdc5d44a751fbe1e07db699f5bdc4c13d
[]
no_license
osgirl/ReckittBenckiser
a0f53ca5b662c24069644ebb5987cbca408054f1
01f95600920d3a7c870563c2b9df996e7f32d5fe
refs/heads/master
2020-04-21T12:02:17.479096
2019-03-04T19:25:38
2019-03-04T19:25:38
169,549,152
0
0
null
2019-02-07T09:45:24
2019-02-07T09:45:24
null
UTF-8
Java
false
false
17,331
java
package com.cpm.dailyentry; import java.util.ArrayList; import java.util.Calendar; import android.app.Activity; import android.app.AlertDialog; import android.app.TabActivity; import android.content.Context; import android.content.DialogInterface; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.text.Editable; import android.text.TextWatcher; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.AbsListView.OnScrollListener; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import android.widget.ToggleButton; import com.cpm.Constants.CommonString; import com.cpm.database.GSKDatabase; import com.cpm.delegates.CoverageBean; import com.cpm.capitalfoods.R; import com.cpm.xmlGetterSetter.DeepFreezerTypeGetterSetter; public class MccainType extends Activity implements OnClickListener{ //Spinner spin; private ArrayAdapter<CharSequence> dfAdapter; ArrayList<DeepFreezerTypeGetterSetter> deepFreezlist=new ArrayList<DeepFreezerTypeGetterSetter>(); //ArrayList<String> dflist=new ArrayList<String>(); ArrayList<String> statuslist=new ArrayList<String>(); boolean spinflag=false; //EditText etremarkone; //LinearLayout lv_layout; GSKDatabase db; ListView lv; Button btnsave; int listsize=0; String store_cd,visit_date,username,intime; private SharedPreferences preferences; String status; boolean mccainflag=false; String statusstr=""; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.deepfreezer_type_layout); //spin=(Spinner) findViewById(R.id.spin); lv=(ListView) findViewById(R.id.dfavallist); //etremarkone=(EditText) findViewById(R.id.etremarkone); btnsave=(Button) findViewById(R.id.btnsavedeepfz); //lv_layout=(LinearLayout) findViewById(R.id.lv_layout); dfAdapter= new ArrayAdapter<CharSequence>(this, android.R.layout.simple_spinner_item); statuslist.add("Status"); statuslist.add("Yes"); statuslist.add("No"); for(int i=0;i<statuslist.size();i++){ dfAdapter.add(statuslist.get(i)); } /* spin.setAdapter(dfAdapter); spin.setOnItemSelectedListener(this);*/ db=new GSKDatabase(getApplicationContext()); db.open(); preferences = PreferenceManager.getDefaultSharedPreferences(this); store_cd = preferences.getString(CommonString.KEY_STORE_CD, null); visit_date = preferences.getString(CommonString.KEY_DATE, null); username= preferences.getString(CommonString.KEY_USERNAME, null); intime=getCurrentTime(); setDataToListView(); lv.setOnScrollListener(new OnScrollListener() { @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { } @Override public void onScrollStateChanged(AbsListView arg0, int arg1) { lv.invalidateViews(); } }); /* etremarkone.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { // TODO Auto-generated method stub if (!hasFocus) { final EditText Caption = (EditText) v; String remark = Caption.getText().toString(); if (remark.equals("")) { deepFreezlist.get(0).setRemark(""); } else { deepFreezlist.get(0).setRemark(remark); } } } }); */ btnsave.setOnClickListener(this); } public void setDataToListView(){ try{ deepFreezlist = db.getDFTypeData("McCain",store_cd); if(deepFreezlist.size()<=0){ deepFreezlist = db.getDFMasterData("McCain"); } else{ statusstr=deepFreezlist.get(0).getStatus(); mccainflag=true; btnsave.setText("Update"); } } catch(Exception e){ Log.d("Exception when fetching Deepfreezer!!!!!!!!!!!!!!!!!!!!!", e.toString()); } if(deepFreezlist.size()>0){ listsize=deepFreezlist.size(); /*etremarkone.setText(deepFreezlist.get(0).getRemark()); spin.setSelection(statuslist.indexOf(deepFreezlist.get(0).getStatus()));*/ lv.setAdapter(new MyAdaptor()); } } private class MyAdaptor extends BaseAdapter{ @Override public int getCount() { return listsize; } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder = null; //spinflag=false; //final String status=""; if (convertView == null) { holder = new ViewHolder(); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = inflater.inflate(R.layout.df_list_item, null); holder.dfavail= (TextView) convertView .findViewById(R.id.tvdfav); //holder.spinstat=(Spinner) convertView.findViewById(R.id.spinstatus); holder.tbpresent=(ToggleButton) convertView.findViewById(R.id.tbpresent); holder.etremark=(EditText) convertView.findViewById(R.id.etremark); holder.stauslay=(LinearLayout) convertView.findViewById(R.id.status_layout); if(position==0 && deepFreezlist.get(position).getStatus().equals("") || position==0 && deepFreezlist.get(position).getStatus().equals("NO")){ listsize=1; notifyDataSetChanged(); } if(listsize==1){ holder.etremark.addTextChangedListener(new TextWatcher(){ @Override public void afterTextChanged(Editable arg0) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub } @Override public void onTextChanged(CharSequence s, int a, int b, int c) { // TODO Auto-generated method stub deepFreezlist.get(position).setRemark(s.toString()); }}); } else{ holder.etremark .setOnFocusChangeListener(new OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { final int position = v.getId(); final EditText Caption = (EditText) v; String value1 = Caption.getText().toString(); if (value1.equals("")) { deepFreezlist.get(position).setRemark(""); } else { deepFreezlist.get(position).setRemark(value1); } } } }); } /*holder.spinstat.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View v, int pos, long arg3) { // TODO Auto-generated method stub if(pos!=0){ status=statuslist.get(pos); final int position = arg0.getId(); if(position==0 && status.equals("No")){ listsize=1; //notifyDataSetChanged(); //lv.invalidateViews(); SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("opnestkmccaindf", false); editor.commit(); } else if(position==0 && status.equals("Yes")){ listsize=deepFreezlist.size(); SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("opnestkmccaindf", true); editor.commit(); } if(status.equals("No")){ //lv.setClickable(false); spinflag=false; deepFreezlist.get(position).setStatus("No"); //lv.getChildAt(position).findViewById(R.id.etremark).setVisibility(View.VISIBLE); } else{ deepFreezlist.get(position).setStatus("Yes"); spinflag=true; //lv.getChildAt(position).findViewById(R.id.etremark).setVisibility(View.INVISIBLE); } } } @Override public void onNothingSelected(AdapterView<?> arg0) { // TODO Auto-generated method stub } });*/ holder.tbpresent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub String val = ((ToggleButton) v).getText().toString(); /* status=statuslist.get(pos); final int position = arg0.getId(); */ final int position = v.getId(); if(position==0 && val.equals("NO")){ listsize=1; //notifyDataSetChanged(); //lv.invalidateViews(); SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("opnestkmccaindf", false); editor.commit(); } else if(position==0 && val.equals("YES")){ listsize=deepFreezlist.size(); /*if(mccainflag){ String msg; String user_type = preferences.getString(CommonString.KEY_USER_TYPE, null); if(user_type.equals("Merchandiser")){ msg="Fill Mccain DF in Opening Stock"; } else{ msg="Fill Mccain DF in Opening and Closing Stock"; } AlertDialog.Builder builder = new AlertDialog.Builder(MccainType.this); builder.setMessage(msg) .setCancelable(false) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); //finish(); } }); AlertDialog alert = builder.create(); alert.show(); }*/ SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean("opnestkmccaindf", true); editor.commit(); } deepFreezlist.get(position).setStatus(val); lv.invalidateViews(); } }); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } //holder.spinstat.setAdapter(dfAdapter); holder.dfavail.setId(position); holder.etremark.setId(position); holder.tbpresent.setId(position); //holder.spinstat.setId(position); if(deepFreezlist.get(position).getDeep_freezer().contains("Deep Freezer cooling")){ holder.stauslay.setVisibility(View.INVISIBLE); } else{ holder.stauslay.setVisibility(View.VISIBLE); } /*if(deepFreezlist.get(position).getDeep_freezer().contains("Material Wellness")){ holder.etremark.setVisibility(View.INVISIBLE); } else{ holder.etremark.setVisibility(View.VISIBLE); }*/ holder.dfavail.setText(deepFreezlist.get(position).getDeep_freezer()); holder.etremark.setText(deepFreezlist.get(position).getRemark()); status=deepFreezlist.get(position).getStatus(); if(status.equals("NO")){ holder.etremark.setVisibility(View.VISIBLE); //dfAdapter.notifyDataSetChanged(); // notifyDataSetChanged(); lv.invalidateViews(); } else if(status.equals("YES")){ holder.etremark.setVisibility(View.INVISIBLE); //dfAdapter.notifyDataSetChanged(); // notifyDataSetChanged(); //lv.invalidateViews(); /*if(position!=0){ //dfAdapter.notifyDataSetChanged(); lv.invalidateViews(); }*/ lv.invalidateViews(); // notifyDataSetChanged(); }/*else{ holder.etremark.setVisibility(View.VISIBLE); //dfAdapter.notifyDataSetChanged(); //lv.invalidateViews(); notifyDataSetChanged(); }*/ /*if(spinflag){ if(position!=0){ holder.etremark.setVisibility(View.INVISIBLE); dfAdapter.notifyDataSetChanged(); } } else{ holder.etremark.setVisibility(View.VISIBLE); dfAdapter.notifyDataSetChanged(); }*/ // int indexspin=statuslist.indexOf(status); holder.tbpresent.setChecked(deepFreezlist.get(position).getStatus().equals("YES")); //holder.spinstat.setSelection(indexspin); return convertView; } } private class ViewHolder { TextView dfavail; //Spinner spinstat; ToggleButton tbpresent; EditText etremark; LinearLayout stauslay; } @Override public void onClick(View v) { // TODO Auto-generated method stub if(v.getId()==R.id.btnsavedeepfz){ if(validateData(deepFreezlist)){ if(mccainflag && db.isOpeningDataFilled(store_cd) && !statusstr.equals(deepFreezlist.get(0).getStatus())){ AlertDialog.Builder builder = new AlertDialog.Builder(MccainType.this); builder.setTitle("Want To Update Data"); builder.setMessage("If you update, Stock data will be deleted and needed fresh entries") .setCancelable(false) .setPositiveButton("OK", new DialogInterface.OnClickListener() { @SuppressWarnings("deprecation") public void onClick(DialogInterface dialog, int id) { dialog.cancel(); getMid(); db.deleteStockData(); db.deleteStockHeaderData(); db.insertDeepFreezerTypeData(deepFreezlist,"McCain",store_cd); ((TabActivity) getParent()).getTabHost().setCurrentTab(1); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); /*Intent i = new Intent(getApplicationContext(), MainActivity.class); startActivity(i); finish();*/ } }); AlertDialog alert = builder.create(); alert.show(); } else{ AlertDialog.Builder builder = new AlertDialog.Builder(MccainType.this); builder.setTitle("Parinaam"); builder.setMessage("Want To Save Data") .setCancelable(false) .setPositiveButton("OK", new DialogInterface.OnClickListener() { @SuppressWarnings("deprecation") public void onClick(DialogInterface dialog, int id) { dialog.cancel(); getMid(); db.insertDeepFreezerTypeData(deepFreezlist,"McCain",store_cd); ((TabActivity) getParent()).getTabHost().setCurrentTab(1); } }) .setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); /*Intent i = new Intent(getApplicationContext(), MainActivity.class); startActivity(i); finish();*/ } }); AlertDialog alert = builder.create(); alert.show(); } } else{ Toast.makeText(getApplicationContext(), "Please fill all the fields", Toast.LENGTH_SHORT).show(); } } } public long checkMid() { return db.CheckMid(visit_date, store_cd); } public long getMid() { long mid = 0; mid = checkMid(); if (mid == 0) { CoverageBean cdata = new CoverageBean(); cdata.setStoreId(store_cd); cdata.setVisitDate(visit_date); cdata.setUserId(username); cdata.setInTime(intime); cdata.setOutTime(getCurrentTime()); cdata.setReason(""); cdata.setReasonid("0"); cdata.setLatitude("0.0"); cdata.setLongitude("0.0"); mid = db.InsertCoverageData(cdata); } return mid; } public String getCurrentTime() { Calendar m_cal = Calendar.getInstance(); String intime = m_cal.get(Calendar.HOUR_OF_DAY) + ":" + m_cal.get(Calendar.MINUTE) + ":" + m_cal.get(Calendar.SECOND); return intime; } boolean validateData(ArrayList<DeepFreezerTypeGetterSetter> deeplist) { boolean flag = true; for (int j = 0; j < deeplist.size(); j++) { /*String aspermccain = listDataChild2.get(listDataHeader2.get(i)).get(j).getAs_per_meccain();*/ /* String openstockcoldrm = deeplist.get(j).getRemark(); if ( openstockcoldrm.equalsIgnoreCase("")) { flag = false; break; } else{ flag = true; if(deeplist.get(0).getStatus().equals("No")){ break; } }*/ String status=deeplist.get(j).getStatus(); if(!status.equals("NO") && !status.equals("YES")){ flag = false; break; }else if(deeplist.get(j).getStatus().equals("NO")){ if(j==0){ String openstockcoldrm = deeplist.get(j).getRemark(); if ( openstockcoldrm.equalsIgnoreCase("")) { flag = false; break; } else{ for(int i=1;i<deeplist.size();i++){ deeplist.get(i).setStatus("NO"); deeplist.get(i).setRemark(""); } flag = true; break; } } else{ String openstockcoldrm = deeplist.get(j).getRemark(); if ( openstockcoldrm.equalsIgnoreCase("")) { flag = false; break; } } }else if(deeplist.get(j).getStatus().equals("YES")){ if(j==0){ deeplist.get(j).setRemark(""); } } } return flag; } }
6033152b3bcdfeb433149c496b687af9e24f9d39
9aa9f17fec143be82cc49408e37d2c6b690e815a
/src/main/java/com/dataart/fastforward/app/services/validation/MessageType.java
d7d59264c56707de4267aa537e97cb8d1458140d
[]
no_license
4kush/ideabank
48b6b8a4a4c1dd119f5bdbf5492d4012d05a6175
2c5148a3bf8f10f0195a4158b8c976093975a4c5
refs/heads/master
2021-01-13T03:43:39.498971
2016-12-21T19:07:08
2016-12-21T19:07:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
164
java
package com.dataart.fastforward.app.services.validation; /** * @author logariett on 20.12.2016. */ public enum MessageType { SUCCESS, INFO, WARNING, ERROR }
206cd112b9c036e7e53a792555e395b2300399c1
be055b703d30a87b1f90157987de620c0089f82b
/src/main/java/com/yuwenxin/blog/service/implement/QuestionServiceImpl.java
aad9efc34f1aa541561d1fef94d69e92280e5be4
[ "Apache-2.0" ]
permissive
wencynyu/blog
5783703c59e049230f84942dcb6bcf38f833e32c
aff3547d0d76f06b82d88c230afc5c5735c2ac54
refs/heads/master
2022-07-11T17:21:28.526567
2020-02-28T15:27:15
2020-02-28T15:27:15
242,655,341
0
0
Apache-2.0
2022-02-09T22:22:32
2020-02-24T05:38:24
HTML
UTF-8
Java
false
false
489
java
package com.yuwenxin.blog.service.implement; import com.yuwenxin.blog.core.BaseServiceImpl; import com.yuwenxin.blog.dao.QuestionDao; import com.yuwenxin.blog.model.Question; import com.yuwenxin.blog.service.QuestionService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class QuestionServiceImpl extends BaseServiceImpl<Question> implements QuestionService { @Autowired private QuestionDao dao; }
6aff7fee943f72d6284fbe5d26e3836dca3d5cc4
bbb746b6d324792c16871eb36155014a77a1444b
/src/ui/UIObject.java
b21f49e90d27c081a5fa79d39b38eda83e34b410
[]
no_license
L4v/game_00
d11e506c5f14d877645927168e9532f5cda7d7ca
f28e52a565c2c5dc29af3ccd3bdfe35a612665c1
refs/heads/master
2021-07-11T00:26:20.606474
2017-10-07T14:21:08
2017-10-07T14:21:08
104,204,328
0
0
null
null
null
null
UTF-8
Java
false
false
1,547
java
package ui; import input.MouseManager; import java.awt.*; import java.awt.event.MouseEvent; public abstract class UIObject { protected float x, y; protected int width, height; protected Rectangle bounds; protected boolean hovering = false; public UIObject(float x, float y, int width, int height) { this.x = x; this.y = y; this.width = width; this.height = height; bounds = new Rectangle((int)x, (int)y, width, height); } public abstract void update(); public abstract void render(Graphics g); public abstract void onClick(); public void onMouseMove(MouseEvent e){ if(bounds.contains(e.getX(), e.getY())) hovering = true; else hovering = false; } public void onMouseRelease(MouseEvent e){ if(hovering) onClick(); } //GETTERS AND SETTERS public float getX() { return x; } public void setX(float x) { this.x = x; } public float getY() { return y; } public void setY(float y) { this.y = y; } public int getWidth() { return width; } public void setWidth(int width) { this.width = width; } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } public boolean isHovering() { return hovering; } public void setHovering(boolean hovering) { this.hovering = hovering; } }
8921998587af678d389615c41f19eb698b1fbc92
8070da8c6ec4af55959cb7736730a0eb227b2cbb
/airport/AirportSimulation.java
fb7b455a536030521702244faec7412b19cbb647
[]
no_license
morganebridges/IntroToDataStructures
ec3e965a4807ffbfeabfa9eb6f384aa889837727
41e3b9fc453f8fdca13b469bb8d3b77eded9e95f
refs/heads/master
2020-12-31T04:56:03.194180
2016-04-21T11:14:24
2016-04-21T11:14:24
56,766,248
0
0
null
null
null
null
UTF-8
Java
false
false
1,303
java
package airport; import java.util.*; public class AirportSimulation { public static void main(String[] args) { System.out.println("Welcome to the airport simulator!"); runSimulation(); } public static void runSimulation() { Scanner input = new Scanner(System.in); char runAgain = 'y'; while (runAgain != 'n') { //create the airport System.out.println("Please enter the running time of the simulation: "); int runTime = input.nextInt(); System.out.println("Please enter the amount of time it takes a plane to land: "); int landTime = input.nextInt(); System.out.println("Please enter the amount of time it takes a plane to crash: "); int crashTime = input.nextInt(); System.out.println("Please enter the the probability (0 < x < 1 ) that a plane arrives" + "in either landing or departure queues: "); double probability = input.nextDouble(); Airport airport = new Airport(runTime, crashTime, probability, landTime); // run the simulation for(int i = 0; i <= airport.simulationTime; i++) { airport.advanceTime(); } airport.printResults(); System.out.println("Would you like to run another simulation? y/n "); runAgain = input.next().charAt(0); } } }
29b2bb4d2df358dbb1d2e01e6eb7caa95e1376b9
bedfd628d3ba6449b931bf6b7439c30195d35da8
/src/main/java/GestionEntretien/ServiceImpl/BonReparationServiceImpl.java
0e030dab83ed78ce61605f42032298f0a07abdd7
[]
no_license
bart-khalid/gestionEntretien
65b594933c741f8281effe1c5c0ce280a14bb7e9
6b5e3fbea910b0b1a49220fa8e76e70ea1ab4721
refs/heads/master
2022-10-18T23:20:20.602955
2020-06-11T21:02:54
2020-06-11T21:02:54
258,908,359
2
0
null
null
null
null
UTF-8
Java
false
false
3,045
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 GestionEntretien.ServiceImpl; import GestionEntretien.Bean.BonReparation; import GestionEntretien.Dao.BonReparationRepository; import GestionEntretien.Service.BonReparationService; import java.util.List; import org.apache.commons.lang3.RandomStringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * * @author Zakaria */ @Service public class BonReparationServiceImpl implements BonReparationService { @Autowired private BonReparationRepository bonrepo; @Override public BonReparation findByReference(String reference) { return bonrepo.findByReference(reference); } @Override public BonReparation findByNumbonR(String numbonr) { return bonrepo.findByNumbonR(numbonr); } @Override public int save(BonReparation bonreparation) { BonReparation founded = bonrepo.findByNumbonR(bonreparation.getNumbonR()); if (founded != null) { return -1; } BonReparation.setNbr(bonreparation.getNbr() + 1); bonreparation.setFourniassooci(bonreparation.getFournisseurR().getNomf() + " ," + bonreparation.getFournisseurR().getAdressef()); bonreparation.setVehiculeassooci(bonreparation.getVehiculeR().getMatricule() + " ," + bonreparation.getVehiculeR().getMarque()); bonreparation.setReference(RandomStringUtils.random(6, true, false) + String.valueOf(bonreparation.getNbr())); bonrepo.save(bonreparation); return 1; } @Override public int update(BonReparation bonreparation) { BonReparation founded = bonrepo.findByReference(bonreparation.getReference()); founded.setFourniassooci(bonreparation.getFournisseurR().getNomf() + " ," + bonreparation.getFournisseurR().getAdressef()); founded.setVehiculeassooci(bonreparation.getVehiculeR().getMatricule() + " ," + bonreparation.getVehiculeR().getMarque()); founded.setNumbonR(bonreparation.getNumbonR()); founded.setDatebonR(bonreparation.getDatebonR()); founded.setDescriptionR(bonreparation.getDescriptionR()); founded.setFournisseurR(bonreparation.getFournisseurR()); founded.setVehiculeR(bonreparation.getVehiculeR()); founded.setPrixunitaireR(bonreparation.getPrixunitaireR()); founded.setTotalbrutR(bonreparation.getTotalbrutR()); founded.setMontantvignetteR(bonreparation.getMontantvignetteR()); founded.setQuantiteR(bonreparation.getQuantiteR()); bonrepo.save(founded); return 1; } @Override public int delete(String reference) { BonReparation founded = bonrepo.findByReference(reference); bonrepo.delete(founded); return 1; } @Override public List<BonReparation> findAll() { return bonrepo.findAll(); } }
8454ad30d33384d1b0d4c3c4bfa8cb0a99a60051
e16bef8659687caef50d6dc4eb6913184da401c3
/Game2048/app/src/main/java/com/example/tian0312/game2048/MainActivity.java
cb40f074f0e89002b41acad921080c11a771e969
[]
no_license
tian0312/2048
147addc8a7b6dc36fcc7502658037f52206f36e1
2a906a8a0514d5fdd179626d1d4fc8eae6d87e86
refs/heads/master
2020-06-12T11:41:56.192032
2016-02-28T11:35:25
2016-02-28T11:35:25
50,188,509
0
0
null
null
null
null
UTF-8
Java
false
false
1,390
java
package com.example.tian0312.game2048; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.GridLayout; import android.widget.TextView; public class MainActivity extends ActionBarActivity { private Button restartBtn; private TextView scoreText; private int score = 0; private static MainActivity mainActivity = null; public MainActivity() { mainActivity = this; } public static MainActivity getMainActivity() { return mainActivity; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); scoreText = (TextView)findViewById(R.id.scoreText); restartBtn = (Button)findViewById(R.id.restartBtn); restartBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { GameView.getGameView().startGame(); } }); } public void clearScore() { score = 0; showScore(); } public void showScore() { scoreText.setText(score + ""); } public void addScore(int s) { score = score + s; showScore(); } }
3d09065b466691f397f48f8d01055cfd7e3adc2d
40c3de1fb1ecb65f944c2fa4e1025c31016ab541
/jrds-standalone/src/main/java/jrds/standalone/CheckJar.java
f8f784eb2997d62b98c657a9869c21ac21bdd2d9
[]
no_license
fbacchella/jrds
683ab9267135d083f459756b7d92296e64046912
1c2913641f35b913f5ff20e67928a71700f60418
refs/heads/master
2023-08-02T21:20:15.451991
2023-08-02T18:27:00
2023-08-02T18:27:00
2,334,806
72
45
null
2023-04-17T11:02:32
2011-09-06T14:12:03
Java
UTF-8
Java
false
false
4,201
java
package jrds.standalone; import java.io.File; import java.net.URL; import java.net.URLClassLoader; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.OutputKeys; import jrds.GraphDesc; import jrds.ProbeDesc; import jrds.PropertiesManager; import jrds.configuration.ConfigObjectFactory; import jrds.factories.ProbeMeta; import jrds.factories.xml.JrdsDocument; import jrds.starter.Starter; import jrds.starter.StarterNode; import jrds.webapp.DiscoverAgent; public class CheckJar extends CommandStarterImpl { public void start(String[] args) throws Exception { PropertiesManager pm = new PropertiesManager(); pm.importSystemProps(); pm.update(); pm.configdir = null; pm.strictparsing = true; System.getProperties().setProperty("java.awt.headless", "true"); System.out.println("Starting parsing descriptions"); ConfigObjectFactory conf = new ConfigObjectFactory(pm); Map<String, GraphDesc> grapMap = conf.setGraphDescMap(); Set<Class<? extends DiscoverAgent>> daList = new HashSet<>(); Set<Class<? extends Starter>> externalStarters = new HashSet<>(); for(String jarfile: args) { System.out.println("checking " + jarfile); // pm.setProperty("libspath", (new // File(jarfile).getCanonicalPath())); // pm.update(); pm.libspath.clear(); URL jarfileurl = new File(jarfile).toURI().toURL(); pm.libspath.add(jarfileurl.toURI()); pm.extensionClassLoader = new URLClassLoader(new URL[] { jarfileurl }, getClass().getClassLoader()) { /* * (non-Javadoc) * * @see java.lang.Object#toString() */ @Override public String toString() { return "JRDS' class loader"; } }; ConfigObjectFactory confjar = new ConfigObjectFactory(pm); Map<String, GraphDesc> grapMapjar = confjar.setGraphDescMap(); for(ProbeDesc<?> pd: confjar.setProbeDescMap().values()) { Class<?> pc = pd.getProbeClass(); while (pc != null && pc != StarterNode.class) { if(pc.isAnnotationPresent(ProbeMeta.class)) { ProbeMeta meta = pc.getAnnotation(ProbeMeta.class); daList.add(meta.discoverAgent()); externalStarters.add(meta.timerStarter()); } pc = pc.getSuperclass(); } Collection<String> graphs = pd.getGraphs(); if(graphs.size() == 0) { System.out.println("no graphs for probe desc: " + pd.getName()); continue; } for(String graph: graphs) { if(!grapMap.containsKey(graph) && !grapMapjar.containsKey(graph)) { System.out.println("Unknown graph " + graph + " for probe desc: " + pd.getName()); } } } } DocumentBuilderFactory instance = DocumentBuilderFactory.newInstance(); JrdsDocument doc = new JrdsDocument(instance.newDocumentBuilder().newDocument()); doc.doRootElement("div"); for(Class<? extends DiscoverAgent> daClass: daList) { DiscoverAgent da = daClass.getConstructor().newInstance(); da.doHtmlDiscoverFields(doc); } System.out.println("Discovery <div> will be:"); Map<String, String> prop = new HashMap<>(4); prop.put(OutputKeys.OMIT_XML_DECLARATION, "yes"); prop.put(OutputKeys.INDENT, "yes"); prop.put(OutputKeys.STANDALONE, "yes"); prop.put("{http://xml.apache.org/xslt}indent-amount", "4"); jrds.Util.serialize(doc, System.out, null, prop); System.out.println(externalStarters); } @Override public String getName() { return "checkjar"; } }
2a44d8d5ccee7907e911f36622207d428ffcaca5
631d3e97d9f77de5edd0e027f8a63ef1f317657a
/src/main/java/com/hntest/dao/StudentDao.java
cce1a8af8b612853c0b0d040fbf1109d107e307e
[]
no_license
want-fly-high/SpringBootCrud
e66b691a0f237a510401f98fea6511abce1cc684
161f3a0590b59e5a52ddbbf58cd565a77550c646
refs/heads/master
2020-09-22T16:30:09.107669
2019-12-02T01:19:06
2019-12-02T01:19:06
225,257,353
0
0
null
null
null
null
UTF-8
Java
false
false
512
java
package com.hntest.dao; import com.hntest.entity.Grade; import com.hntest.entity.Student; import org.springframework.stereotype.Repository; import java.util.List; import java.util.Map; @Repository("studentDao") public interface StudentDao { List<Student> listByPager(Map<String, Object> map); int getCounts(Student student); List<Grade> getAllGrade(); int update(Student student); int insert(Student student); int delete(Integer sno); Student getStudentBySno(Integer sno); }
f0daf9f000165c15903ec2abbdd9cd4a2a7823d4
8275f74facbbd4bfc8bb2bff98a94fd54b244011
/app/src/main/java/mobile/omandotkom/dakwahsosial/Initializer.java
d76e883cbdae58f2ea289e2b9dbee1b16bf84567
[]
no_license
omandotkom/DakwahSosial
85a5ec118a66ddc8deeb41c0ca3ad732a9417619
eee8cb99f8d1294c4d3c9ce6fbe62ed533420d28
refs/heads/master
2020-03-26T23:03:42.538243
2018-09-06T13:00:32
2018-09-06T13:00:32
145,507,110
0
0
null
null
null
null
UTF-8
Java
false
false
313
java
package mobile.omandotkom.dakwahsosial; import android.app.Application; import net.gotev.uploadservice.UploadService; public class Initializer extends Application { @Override public void onCreate() { super.onCreate(); UploadService.NAMESPACE = "mobile.omandotkom.dakwahsosial"; } }
0c187070e9c3de47ae9f4126a7e5929cc486b928
e9ebdad07cacd15ab84dc906167ec70dea6789b6
/gsi-maven-plugin-old/src/main/java/com/indracompany/jaxb/note/column/Display.java
829d035046fcb30798a6cc20ca5f714c6852e07a
[]
no_license
luizarantes/bep
33e048267280399fddeb5b136e8646994f2fe30d
011b7680f53e31c50fb2e4dc88271cb62d708f98
refs/heads/master
2021-01-20T11:14:26.970276
2017-03-16T21:11:30
2017-03-16T21:11:30
71,595,325
0
0
null
null
null
null
UTF-8
Java
false
false
1,668
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2012.01.26 at 10:06:28 PM BRST // package com.indracompany.jaxb.note.column; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for Display complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="Display"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="order" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Display", propOrder = { "order" }) public class Display { protected Integer order; /** * Gets the value of the order property. * * @return * possible object is * {@link Integer } * */ public Integer getOrder() { return order; } /** * Sets the value of the order property. * * @param value * allowed object is * {@link Integer } * */ public void setOrder(Integer value) { this.order = value; } }
fce16a840b50a9675ab7ce50d2936f4cf2eb0ff1
e01fa832cba9fa2e7f75afe5533ad2ce4a053976
/src/main/java/com/bjss/shopping_basket/model/Soup.java
2a0d36ec40e6e95d0855ea4cc7a5aff65fa3f332
[]
no_license
vilmoszsombori/shopping-basket
f98cfaf1193a74838e226ab915a632c2858ef6b0
58520b9b36cc56d7da489e630617fd126d1fb476
refs/heads/master
2021-01-10T21:56:51.296882
2016-02-12T13:06:49
2016-02-12T13:06:49
33,768,439
0
0
null
null
null
null
UTF-8
Java
false
false
290
java
package com.bjss.shopping_basket.model; public class Soup extends Item { public static final double UNIT_PRICE = .65; @Override public Type getType() { return Item.Type.SOUP; } @Override public double getUnitPrice() { return UNIT_PRICE; } }
b15d7e0a8d4b1b32ae4447934a2babc1a6d2e1c6
7464c36b876bc60e3e732efdf4ac9e5b38475c62
/HFBitsandPizzas/app/src/main/java/com/electromech/hfbitsandpizzas/StoresFragment.java
92d40f4df65d07f3a9ea0d9073cfde42cd8eac0d
[]
no_license
scorebrain/Test1
3d8ebc7c8881b38568485730ea79a5fd703a43e6
221c2aa3a5c5d9d8a670f06e704b7c65e9b535d6
refs/heads/master
2020-09-06T20:32:41.565788
2020-07-23T17:53:39
2020-07-23T17:53:39
220,542,712
0
0
null
null
null
null
UTF-8
Java
false
false
888
java
package com.electromech.hfbitsandpizzas; import android.os.Bundle; import android.support.v4.app.ListFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; public class StoresFragment extends ListFragment { public StoresFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ArrayAdapter<String> adapter = new ArrayAdapter<>( inflater.getContext(), android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.stores)); setListAdapter(adapter); return super.onCreateView(inflater, container, savedInstanceState); } }
8ffdb8eea5866178e214b7e13205222a62cefb78
506a31228dc6bba3bc38b1db640c3ca391af4b4e
/app/src/androidTest/java/com/example/myapplication/RecipeListActivityTest.java
927b51eb0d21133d6be9bc832e199815eee474d9
[]
no_license
ebteesaam/BakingApp
c83a85389fd7fa41c937109ea38912349b86e2d6
ee2bd3680073fa86c22c63c002a485e6f123052d
refs/heads/master
2020-04-24T23:58:43.783840
2019-11-01T21:35:57
2019-11-01T21:35:57
172,363,060
0
0
null
null
null
null
UTF-8
Java
false
false
1,164
java
package com.example.myapplication; import android.support.test.espresso.contrib.RecyclerViewActions; import android.support.test.rule.ActivityTestRule; import android.support.test.runner.AndroidJUnit4; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.action.ViewActions.click; import static android.support.test.espresso.matcher.ViewMatchers.withId; @RunWith(AndroidJUnit4.class) public class RecipeListActivityTest { @Rule public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class); public static void getMeToRecipeInfo(int recipePosition) { onView(withId(R.id.list)) .perform(RecyclerViewActions.actionOnItemAtPosition(recipePosition, click())); } @Test public void clickOnRecyclerViewStepItem_opensRecipeStepActivity_orFragment() { // onData(anything()).inAdapterView(withId(R.id.list)).atPosition(0).perform(click()); // onView(withId(R.id.toolbarTextV)).check(matches(withText("Nutella Pie"))); } }
438218da5651a03d9b792d0c0e208dbdfe135f85
fe5716b24c8696989722732542647ef00befd966
/chapter3/GridRecycleViewTest/app/src/main/java/com/dangerdasheng/gridrecycleviewtest/FruitAdapter.java
c44f0c4e2302c2fc0d39e07b7e462a414c942414
[]
no_license
dangerlds/AndroidLearn
b76f00a7db4bdda4a9ffe7e0c6c8a86cb8c300d6
cd5f6ed915d9f1310e7330ec6f21a2caab0f36d9
refs/heads/master
2022-10-10T23:22:09.819448
2020-06-10T15:29:41
2020-06-10T15:29:41
152,261,589
0
0
null
null
null
null
UTF-8
Java
false
false
2,579
java
package com.dangerdasheng.gridrecycleviewtest; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import java.util.List; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; public class FruitAdapter extends RecyclerView.Adapter<FruitAdapter.ViewHolder> { private List<Fruit> mFruitList; static class ViewHolder extends RecyclerView.ViewHolder{ ImageView fruitImage; TextView fruitName; View fruitView; public ViewHolder(@NonNull View itemView) { super(itemView); fruitView = itemView; fruitImage = (ImageView)itemView.findViewById(R.id.fruit_image); fruitName = (TextView)itemView.findViewById(R.id.fruit_name); } } public FruitAdapter(List<Fruit> fruitList){ mFruitList = fruitList; } @NonNull @Overridec public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fruit_item,parent,false); final ViewHolder holder = new ViewHolder(view); holder.fruitImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int position = holder.getAdapterPosition(); Fruit fruit = mFruitList.get(position); Toast.makeText(view.getContext(), "you clicked image " + fruit.getName(), Toast.LENGTH_SHORT).show(); } }); holder.fruitView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int position = holder.getAdapterPosition(); Fruit fruit = mFruitList.get(position); Toast.makeText(view.getContext(), "you clicked view " + fruit.getName(), Toast.LENGTH_SHORT).show(); } }); return holder; } @Override public void onBindViewHolder(@NonNull ViewHolder holder, int position) { Fruit fruit = mFruitList.get(position); holder.fruitImage.setImageResource(fruit.getImageId()); holder.fruitName.setText(fruit.getName()); } @Override public int getItemCount() { return mFruitList.size(); } }
07491a486954d212f4002a5f22d0f7243da76aaa
dd0f2611d0537f0085d4b262ecf3945152bd62b0
/src/test/java/inf/ufes/web/rest/QualitativaResourceIntTest.java
a3ba3642724a1d870271dfa0ddcc26232f91dde1
[]
no_license
nemo-ufes/INTERSEP
896093b090bf2caee112606c9b00d1ddcba4ee91
3394cd2b917d94ac75a5e44a9ab9adf667ac8804
refs/heads/master
2023-04-13T01:23:29.756266
2023-04-10T19:33:13
2023-04-10T19:33:13
216,617,772
0
0
null
2023-04-10T19:33:15
2019-10-21T16:45:00
Java
UTF-8
Java
false
false
8,854
java
package inf.ufes.web.rest; import inf.ufes.IntersepApp; import inf.ufes.domain.Qualitativa; import inf.ufes.repository.QualitativaRepository; import inf.ufes.web.rest.errors.ExceptionTranslator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; import javax.persistence.EntityManager; import java.util.List; import static inf.ufes.web.rest.TestUtil.createFormattingConversionService; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.hasItem; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Test class for the QualitativaResource REST controller. * * @see QualitativaResource */ @RunWith(SpringRunner.class) @SpringBootTest(classes = IntersepApp.class) public class QualitativaResourceIntTest { @Autowired private QualitativaRepository qualitativaRepository; @Autowired private MappingJackson2HttpMessageConverter jacksonMessageConverter; @Autowired private PageableHandlerMethodArgumentResolver pageableArgumentResolver; @Autowired private ExceptionTranslator exceptionTranslator; @Autowired private EntityManager em; private MockMvc restQualitativaMockMvc; private Qualitativa qualitativa; @Before public void setup() { MockitoAnnotations.initMocks(this); final QualitativaResource qualitativaResource = new QualitativaResource(qualitativaRepository); this.restQualitativaMockMvc = MockMvcBuilders.standaloneSetup(qualitativaResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setControllerAdvice(exceptionTranslator) .setConversionService(createFormattingConversionService()) .setMessageConverters(jacksonMessageConverter).build(); } /** * Create an entity for this test. * * This is a static method, as tests for other entities might also need it, * if they test an entity which requires the current entity. */ public static Qualitativa createEntity(EntityManager em) { Qualitativa qualitativa = new Qualitativa(); return qualitativa; } @Before public void initTest() { qualitativa = createEntity(em); } @Test @Transactional public void createQualitativa() throws Exception { int databaseSizeBeforeCreate = qualitativaRepository.findAll().size(); // Create the Qualitativa restQualitativaMockMvc.perform(post("/api/qualitativas") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(qualitativa))) .andExpect(status().isCreated()); // Validate the Qualitativa in the database List<Qualitativa> qualitativaList = qualitativaRepository.findAll(); assertThat(qualitativaList).hasSize(databaseSizeBeforeCreate + 1); Qualitativa testQualitativa = qualitativaList.get(qualitativaList.size() - 1); } @Test @Transactional public void createQualitativaWithExistingId() throws Exception { int databaseSizeBeforeCreate = qualitativaRepository.findAll().size(); // Create the Qualitativa with an existing ID qualitativa.setId(1L); // An entity with an existing ID cannot be created, so this API call must fail restQualitativaMockMvc.perform(post("/api/qualitativas") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(qualitativa))) .andExpect(status().isBadRequest()); // Validate the Qualitativa in the database List<Qualitativa> qualitativaList = qualitativaRepository.findAll(); assertThat(qualitativaList).hasSize(databaseSizeBeforeCreate); } @Test @Transactional public void getAllQualitativas() throws Exception { // Initialize the database qualitativaRepository.saveAndFlush(qualitativa); // Get all the qualitativaList restQualitativaMockMvc.perform(get("/api/qualitativas?sort=id,desc")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.[*].id").value(hasItem(qualitativa.getId().intValue()))); } @Test @Transactional public void getQualitativa() throws Exception { // Initialize the database qualitativaRepository.saveAndFlush(qualitativa); // Get the qualitativa restQualitativaMockMvc.perform(get("/api/qualitativas/{id}", qualitativa.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.id").value(qualitativa.getId().intValue())); } @Test @Transactional public void getNonExistingQualitativa() throws Exception { // Get the qualitativa restQualitativaMockMvc.perform(get("/api/qualitativas/{id}", Long.MAX_VALUE)) .andExpect(status().isNotFound()); } @Test @Transactional public void updateQualitativa() throws Exception { // Initialize the database qualitativaRepository.saveAndFlush(qualitativa); int databaseSizeBeforeUpdate = qualitativaRepository.findAll().size(); // Update the qualitativa Qualitativa updatedQualitativa = qualitativaRepository.findOne(qualitativa.getId()); // Disconnect from session so that the updates on updatedQualitativa are not directly saved in db em.detach(updatedQualitativa); restQualitativaMockMvc.perform(put("/api/qualitativas") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(updatedQualitativa))) .andExpect(status().isOk()); // Validate the Qualitativa in the database List<Qualitativa> qualitativaList = qualitativaRepository.findAll(); assertThat(qualitativaList).hasSize(databaseSizeBeforeUpdate); Qualitativa testQualitativa = qualitativaList.get(qualitativaList.size() - 1); } @Test @Transactional public void updateNonExistingQualitativa() throws Exception { int databaseSizeBeforeUpdate = qualitativaRepository.findAll().size(); // Create the Qualitativa // If the entity doesn't have an ID, it will be created instead of just being updated restQualitativaMockMvc.perform(put("/api/qualitativas") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(qualitativa))) .andExpect(status().isCreated()); // Validate the Qualitativa in the database List<Qualitativa> qualitativaList = qualitativaRepository.findAll(); assertThat(qualitativaList).hasSize(databaseSizeBeforeUpdate + 1); } @Test @Transactional public void deleteQualitativa() throws Exception { // Initialize the database qualitativaRepository.saveAndFlush(qualitativa); int databaseSizeBeforeDelete = qualitativaRepository.findAll().size(); // Get the qualitativa restQualitativaMockMvc.perform(delete("/api/qualitativas/{id}", qualitativa.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<Qualitativa> qualitativaList = qualitativaRepository.findAll(); assertThat(qualitativaList).hasSize(databaseSizeBeforeDelete - 1); } @Test @Transactional public void equalsVerifier() throws Exception { TestUtil.equalsVerifier(Qualitativa.class); Qualitativa qualitativa1 = new Qualitativa(); qualitativa1.setId(1L); Qualitativa qualitativa2 = new Qualitativa(); qualitativa2.setId(qualitativa1.getId()); assertThat(qualitativa1).isEqualTo(qualitativa2); qualitativa2.setId(2L); assertThat(qualitativa1).isNotEqualTo(qualitativa2); qualitativa1.setId(null); assertThat(qualitativa1).isNotEqualTo(qualitativa2); } }
f9ee1f0e194833dc7d38e86154c9984a30e84f46
7e412d6328fbecf670d2d1c86d4a4507c126f743
/metoo-api/src/main/java/com/metoo/api/order/NrOrderInvestApi.java
c89eb5eac506fcc5475cd1bfb678a4d3608e08ab
[]
no_license
18357697090/metooxinli
d6f353ecb29c961a78e447a330c922df52a08595
18fcf69461db60c44625e3defc35a95804e2e32b
refs/heads/master
2023-06-01T09:25:30.249658
2021-01-20T08:29:47
2021-01-20T08:29:47
376,896,165
0
0
null
null
null
null
UTF-8
Java
false
false
431
java
package com.metoo.api.order; import com.loongya.core.util.RE; import com.metoo.pojo.nr.vo.NrGoodsVo; import com.metoo.pojo.nr.vo.NrOrderInvestVo; import com.metoo.pojo.order.vo.NrBackpackVo; /** * <p> * 用户背包商品表 服务类 * </p> * * @author loongya * @since 2020-12-28 */ public interface NrOrderInvestApi { RE createInvestOrder(NrOrderInvestVo vo); RE investOrderSuccessBack(String out_trade_no); }
f63ec03c15bbecb76e6d07ae28952eafdd5735ca
c697b14836a01be88e6bbf43ac648be83426ade0
/Algorithms/1001-2000/1202. Smallest String With Swaps/Solution.java
01fa97f4a1e5b720c10a72368a3aa639315d5f48
[]
no_license
jianyimiku/My-LeetCode-Solution
8b916d7ebbb89606597ec0657f16a8a9e88895b4
48058eaeec89dc3402b8a0bbc8396910116cdf7e
refs/heads/master
2023-07-17T17:50:11.718015
2021-09-05T06:27:06
2021-09-05T06:27:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,918
java
class Solution { public String smallestStringWithSwaps(String s, List<List<Integer>> pairs) { Map<Integer, Set<Integer>> adjacentMap = new HashMap<Integer, Set<Integer>>(); for (List<Integer> pair : pairs) { int index1 = pair.get(0), index2 = pair.get(1); Set<Integer> set1 = adjacentMap.getOrDefault(index1, new HashSet<Integer>()); Set<Integer> set2 = adjacentMap.getOrDefault(index2, new HashSet<Integer>()); set1.add(index2); set2.add(index1); adjacentMap.put(index1, set1); adjacentMap.put(index2, set2); } char[] array = s.toCharArray(); int length = array.length; int[] groups = new int[length]; Arrays.fill(groups, -1); Map<Integer, Set<Integer>> groupNumsMap = new HashMap<Integer, Set<Integer>>(); int groupNum = 0; int ungrouped = length; Queue<Integer> queue = new LinkedList<Integer>(); int startIndex = 0; while (ungrouped > 0) { while (startIndex < length && groups[startIndex] >= 0) startIndex++; if (startIndex < length) queue.offer(startIndex); Set<Integer> groupSet = new HashSet<Integer>(); while (!queue.isEmpty()) { int index = queue.poll(); if (groups[index] < 0) { groups[index] = groupNum; groupSet.add(index); ungrouped--; Set<Integer> adjacentSet = adjacentMap.getOrDefault(index, new HashSet<Integer>()); for (int adjacent : adjacentSet) { if (groups[adjacent] < 0) queue.offer(adjacent); } } } groupNumsMap.put(groupNum, groupSet); groupNum++; startIndex++; } boolean[] sorted = new boolean[length]; for (int i = 0; i < length; i++) { if (!sorted[i]) { int group = groups[i]; if (group >= 0) { List<Integer> indicesList = new ArrayList<Integer>(groupNumsMap.get(group)); Collections.sort(indicesList); StringBuffer sb = new StringBuffer(); for (int index : indicesList) sb.append(array[index]); char[] subsequence = sb.toString().toCharArray(); Arrays.sort(subsequence); int size = indicesList.size(); for (int j = 0; j < size; j++) { int index = indicesList.get(j); array[index] = subsequence[j]; sorted[index] = true; } } } } return new String(array); } }
c0daa3d9082ae203700652dae1c9b6fc6ffecb0c
ee1e606989f12cbde2267bc50a1026be498ecf42
/src/main/java/com/thai/scraping/model/ProductUrl.java
9d3a362348f1d3fc1e6a7bb9357beca9b6ff5359
[]
no_license
thailt/scraping
4e4c8c1f7eac8dba0f35141185a6f517b8f0aa87
d5f189696286e9e695aedef5478b536074ba347a
refs/heads/master
2022-09-28T06:45:45.473836
2019-10-27T15:06:37
2019-10-27T15:06:37
97,114,123
0
0
null
2022-09-01T22:19:59
2017-07-13T11:15:10
Java
UTF-8
Java
false
false
1,067
java
package com.thai.scraping.model; import java.util.Date; import javax.persistence.Entity; import javax.persistence.Id; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; @Entity public class ProductUrl { @Id private String productUrl; private Date createdDate; public ProductUrl() { } public ProductUrl(String pageUrl, Date createdDate) { this.productUrl = pageUrl; this.createdDate = createdDate; } public ProductUrl(String productUrl) { this.productUrl = productUrl; this.createdDate = new Date(); } public String getPageUrl() { return productUrl; } public Date getCreatedDate() { return createdDate; } @Override public int hashCode() { return new HashCodeBuilder(17, 31).append(productUrl).toHashCode(); } @Override public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof ProductUrl)) { return false; } ProductUrl page = (ProductUrl) o; return new EqualsBuilder().append(productUrl, page.productUrl).isEquals(); } }
3fd0a7401be853df372e703a7853b74d04406b37
4b957545858abbd03d5d0e0172a568453a1923fd
/3rd Year/Android Individual Practical/Practical/src/com/assignment/practical/RestSpecific.java
70fa56547302c08fbf51502c502f772a02178599
[]
no_license
shofman/UniversityCoursework
0abd398c6391f0a7fda53857ef3f83f049d46828
2da36e87e796c533df6a596e95f6aa5204ca9450
refs/heads/master
2021-01-16T21:21:16.493769
2013-11-28T04:23:48
2013-11-28T04:23:48
14,734,641
0
2
null
null
null
null
UTF-8
Java
false
false
5,117
java
package com.assignment.practical; import android.app.Activity; import android.app.AlertDialog; import android.content.ActivityNotFoundException; import android.content.DialogInterface; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.RatingBar; import android.widget.TextView; public class RestSpecific extends Activity{ private RestDbAdapter dbHelper; private TextView name; private TextView address; private TextView number; private TextView distance; private TextView food; private RatingBar rating; private TextView website; private int directions; private Long row; private static final int ACTIVITY_PHONE = 2; private static final int FOOD = 3; protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.hotel_display); dbHelper = new RestDbAdapter(this); dbHelper.open(); name = (TextView) findViewById(R.id.hotelname); address = (TextView) findViewById(R.id.hoteladdress); number = (TextView) findViewById(R.id.hotelnumber); distance = (TextView) findViewById(R.id.hoteldistance); website = (TextView) findViewById(R.id.hotelwebsite); food = (TextView) findViewById(FOOD); rating = (RatingBar) findViewById(R.id.hotelrating); Button directionsButton = (Button) findViewById(R.id.directions); Button deleteButton = (Button) findViewById(R.id.delete); Bundle extras = getIntent().getExtras(); if (extras != null) { row = extras.getLong(HotelDbAdapter.KEY_ROWID); } populateFields(); directionsButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Bundle bundle = new Bundle(); bundle.putInt("Directions", directions); bundle.putCharSequence("Name", name.getText()); Intent i = new Intent(RestSpecific.this, HotelDirectionsTab.class); i.putExtras(bundle); startActivity(i); } }); deleteButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { AlertDialog.Builder builder2 = new AlertDialog.Builder(RestSpecific.this); builder2.setMessage("Are you sure you want to delete?") .setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int location) { if(row==null) { long id = dbHelper.createRest(" ", " ", " ", " ", " ", " ", 0, 0); if (id > 0) { row = id; } } setResult(RESULT_OK); finish(); dbHelper.deleteRest(row); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); builder2.show(); } }); } private void populateFields() { if (row != null) { Cursor hotel = dbHelper.fetchRest(row); startManagingCursor(hotel); name.setText(hotel.getString(hotel.getColumnIndexOrThrow(HotelDbAdapter.KEY_NAME))); address.setText(hotel.getString(hotel.getColumnIndexOrThrow(HotelDbAdapter.KEY_ADDRESS))); number.setText(hotel.getString(hotel.getColumnIndexOrThrow(HotelDbAdapter.KEY_NUMBER))); website.setText(hotel.getString(hotel.getColumnIndexOrThrow(HotelDbAdapter.KEY_WEBSITE))); distance.setText(hotel.getString(hotel.getColumnIndexOrThrow(HotelDbAdapter.KEY_DISTANCE))); rating.setRating(hotel.getFloat(hotel.getColumnIndexOrThrow(HotelDbAdapter.KEY_RANKING))); final String call = hotel.getString(hotel.getColumnIndexOrThrow(HotelDbAdapter.KEY_NUMBER)).replace(" ", ""); directions = hotel.getInt(hotel.getColumnIndexOrThrow(HotelDbAdapter.KEY_DIRECTIONS)); number.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { try { String url = "tel:"+call; Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse(url)); startActivityForResult(callIntent, ACTIVITY_PHONE); } catch (ActivityNotFoundException activityException) { Log.e("dialing-example", "Call failed", activityException); } } }); } } protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); dbHelper.updateRest(row, name.getText().toString(), address.getText().toString(), number.getText().toString(), website.getText().toString(), food.getText().toString(), distance.getText().toString(), rating.getRating(), directions); outState.putSerializable(HotelDbAdapter.KEY_ROWID, row); } @Override protected void onPause() { super.onPause(); dbHelper.updateRest(row, name.getText().toString(), address.getText().toString(), number.getText().toString(), website.getText().toString(), food.getText().toString(), distance.getText().toString(), rating.getRating(), directions); } @Override protected void onResume() { super.onResume(); populateFields(); } }
ab7924ea3fd07cc623e8c51bd113766e5fd74a51
c6c1a124eb1ff2fc561213d43d093f84d1ab2c43
/games/two-legs/desktop/assets-develop/tests/utils/IssueTest.java
07fb6ede4dd02b019ea7d50ab1c571dcb1dc4555
[]
no_license
fantasylincen/javaplus
69201dba21af0973dfb224c53b749a3c0440317e
36fc370b03afe952a96776927452b6d430b55efd
refs/heads/master
2016-09-06T01:55:33.244591
2015-08-15T12:15:51
2015-08-15T12:15:51
15,601,930
3
1
null
null
null
null
UTF-8
Java
false
false
750
java
package cn.javaplus.twolegs.tests.utils; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; /** * Placeholder class that's wired up with all backends so i can quickly test out * issues... * * @author badlogic * */ public class IssueTest extends GdxTest { SpriteBatch batch; Texture img; Texture img2; @Override public void create() { batch = new SpriteBatch(); img = new Texture("data/issue/bark.png"); img2 = new Texture("data/issue/leaf.png"); } @Override public void render() { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); batch.draw(img, 0, 0); batch.draw(img2, 512, 0); batch.end(); } }
[ "12-2" ]
12-2
7d35ab86ee5235dcb1c258f923a9c5452fd66ced
707896735da5f92f7615ad4181c91b3499993fda
/src/main/java/tools/MD5Decoder.java
af46cedf468c2edb7c6377134953e8afe06bbe7e
[ "Apache-2.0" ]
permissive
sentinalll/rotterdam
fc8d4810680ef01ae63e345208f4948621349041
41d6d4da254bfedc9b43d6f77d16b3b228257806
refs/heads/master
2021-01-13T02:36:02.634367
2014-12-13T10:01:20
2014-12-13T10:01:20
26,598,747
0
0
null
null
null
null
UTF-8
Java
false
false
1,006
java
package tools; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class MD5Decoder { private static MessageDigest md; public static String encryptPass(String pass){ try { byte[] passDigestBytes = getDigestBytes(pass); return getStringCode(passDigestBytes); }catch (NoSuchAlgorithmException e) { return null; } } private static String getStringCode(byte[] passDigestBytes) { StringBuffer passDigestString = new StringBuffer(); for (int i = 0; i < passDigestBytes.length; i++) { passDigestString.append(Integer.toHexString(0xff & passDigestBytes[i])); } return passDigestString.toString(); } private static byte[] getDigestBytes(String pass) throws NoSuchAlgorithmException { md = MessageDigest.getInstance("MD5"); md.reset(); byte[] passBytes = pass.getBytes(); return md.digest(passBytes); } }
7587a42cb1de1f2ca2740c1231cb4111618f2b5b
b056e1383381f6e9d15acc8589e8d6f172e498db
/src/Bootcamp/week1/TryCatch/CheckAge/TooYoungException.java
cc821d5a050e27a9855742b55a51aed1d63b6a45
[]
no_license
phanthienhoang/Java_Learn
264f3d8b213d5e283256aec941afa0c2c24b543d
9b671ce71569bdd27707efbd49e68b1e5b71faf4
refs/heads/master
2020-08-14T16:54:39.774650
2019-10-16T06:36:30
2019-10-16T06:36:30
215,203,193
0
0
null
null
null
null
UTF-8
Java
false
false
177
java
package Bootcamp.week1.TryCatch.CheckAge; public class TooYoungException extends AgeException { public TooYoungException(String message) { super(message); } }
b55b935b0330eb18fc7347dafb419c19bfbb5a5d
b31b2ab93994b59330005d24d2d788e80c4db9dc
/PaintDemo/src/com/example/paintdemo/mywidget/Game.java
e5bbfd066cceefb46f8c61b4af50b66f2d7aaa78
[]
no_license
crazysniper/MyDemoTest
31d04f209a1b546fa32f6dfedb678701377512a1
a75876319949ab8977d56e5059ee3206e7e61457
refs/heads/master
2021-01-21T12:43:43.075653
2015-08-06T15:20:48
2015-08-06T15:20:48
33,294,572
0
0
null
null
null
null
UTF-8
Java
false
false
1,228
java
package com.example.paintdemo.mywidget; public class Game { /** 初始化 九宫格的数据 */ private final String initStr = "360000000004230800000004200" + "070460003820000014500013020" + "001900000007048300000000045"; private int[] shuduku = new int[9 * 9]; public Game() { shuduku = fromPuzzleString(initStr); } /** * 通过传过来的坐标值获取该坐标的具体值(整数) * * @param x * x坐标 * @param y * y坐标 * @return */ private int getTitle(int x, int y) { return shuduku[y * 9 + x]; } /** * 把获取到的整数变成String * * @param x * @param y * @return */ public String getTitleString(int x, int y) { int v = getTitle(x, y); if (0 == v) { return ""; } return String.valueOf(v);// } /** * 把字符串 一个个分离出来,存放至 shudu数组中,通过返回值,赋值给 shuduku数组中 * * @param str * @return */ public int[] fromPuzzleString(String str) { int[] shudu = new int[str.length()]; for (int i = 0; i < str.length(); i++) { // 把获取的单个字符减去 '0' 转成整数,赋给 整形 shudu数组中 shudu[i] = str.charAt(i) - '0'; } return shudu; } }
87a34bd1eb2aefc0ea5f4a406040e41b002c3d6d
71821d22e511ff469a837d7708769449cb8d5e44
/src/main/java/com/bxthree/config/DateTimeFormatConfiguration.java
bf94cf78e776a2997e2eadbac84c7937ac30bc8b
[]
no_license
boardman/jhmono
61dc194239e87235117116757c2739e68ae3fb06
49c91715c8e230f8cc4d29bd79255d17908c69c2
refs/heads/master
2022-12-23T00:46:54.770340
2020-03-04T22:26:08
2020-03-04T22:26:08
245,126,945
0
0
null
2022-12-16T05:13:31
2020-03-05T09:59:00
Java
UTF-8
Java
false
false
718
java
package com.bxthree.config; import org.springframework.context.annotation.Configuration; import org.springframework.format.FormatterRegistry; import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; /** * Configure the converters to use the ISO format for dates by default. */ @Configuration public class DateTimeFormatConfiguration implements WebMvcConfigurer { @Override public void addFormatters(FormatterRegistry registry) { DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar(); registrar.setUseIsoFormat(true); registrar.registerFormatters(registry); } }
665df5b81bfde33a84e0329b34fb0cb81727d059
9afe98af45aa4497fe9b20f2f37b2405e754d29e
/src/main/java/com/pointlion/sys/mvc/admin/generator/Enjoy.java
e059ee9322225433a7491a49de09a968d6122e39
[ "Apache-2.0" ]
permissive
baslilon1978/JFinalOA
e9b2022abc604570e01c1f2e5821ed4bc2f7351c
9a83eee4490b3e7bc33705baeaf6a58e02c7e401
refs/heads/master
2022-06-30T12:40:20.082236
2019-12-17T04:17:01
2019-12-17T04:18:19
228,505,006
0
0
Apache-2.0
2022-06-29T17:51:11
2019-12-17T01:10:54
JavaScript
UTF-8
Java
false
false
2,688
java
package com.pointlion.sys.mvc.admin.generator; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import com.jfinal.kit.Kv; import com.jfinal.kit.PathKit; import com.jfinal.template.Engine; /*** * jfinal魔板引擎 * @author dufuzhong */ public class Enjoy { static final Integer FAIL = -1; static final Integer SUCCESS = 0; static final Integer EXIST = 1; /** * 根据具体模板生成文件 * @param templateFileName 模板文件名称 * @param kv 渲染参数 * @param filePath 输出目录 * @return * 1:已存在 * 0:成功 * -1:失败 */ public Integer render(String templateFileName, Kv kv, String filePath) { BufferedWriter output = null; try { String baseTemplatePath = new StringBuilder(PathKit.getRootClassPath()) .append("/") .append(PathKit.getPackagePath(this)) .append("/template") .toString(); File file = new File(filePath.toString()); if(file.exists()){//如果已经存在了 return EXIST; } File path = new File(file.getParent()); if ( ! path.exists() ) { path.mkdirs(); } output = new BufferedWriter(new FileWriter(file)); Engine.use() .setBaseTemplatePath(baseTemplatePath) //.setSourceFactory(new ClassPathSourceFactory()) .getTemplate(templateFileName) .render(kv, output); return SUCCESS; } catch (IOException e) { e.printStackTrace(); return FAIL; }finally{ try { if( output != null ) output.close(); } catch (IOException e) {} } } /** * 根据自定义内容生成文件 * @param data 自定义内容 * @param filePath 输出目录 * @return */ public boolean render(String data, StringBuilder filePath) { BufferedWriter output = null; try { File file = new File(filePath.toString()); File path = new File(file.getParent()); if ( ! path.exists() ) { path.mkdirs(); } output = new BufferedWriter(new FileWriter(file)); output.write(data); return true; } catch (IOException e) { e.printStackTrace(); return false; }finally{ try { if( output != null ) output.close(); } catch (IOException e) {} } } }
b60ee28e5c48f36ebe2b95df2bbc226f1145b107
65abc1a04dde58d0541571fe6af8c347a1b8f5eb
/kr/ac/snu/cares/sampleTrace/RandomPeriodGenerator.java
ffbc8dea460c5ae8970fd49b56dd4b09746a79e6
[]
no_license
atcle1/MDSim
42f93d7e3e454d41d78f2c75a67bd4f86aacfc7d
cdf6567bd6844dd9796c0ef9bced8ceb444bd8b0
refs/heads/master
2022-12-09T00:23:19.312626
2020-09-15T02:33:39
2020-09-15T02:33:39
295,593,702
0
0
null
null
null
null
UTF-8
Java
false
false
2,253
java
package kr.ac.snu.cares.sampleTrace; import java.util.ArrayList; import java.util.Random; public class RandomPeriodGenerator { Random random = new Random(); int minTerm; int slice; int startHour, startMin, startSeconds; int endHour, endMin, endSeconds; public static void main(String args[]) { RandomPeriodGenerator gen = new RandomPeriodGenerator(); for (int i = 0; i <100; i++) { SamplePeriod parent = new SamplePeriod(); parent.setTime(true, 1, 0, 0); parent.setTime(false, 3, 0, 0); SamplePeriod test = gen.getRandTerm(parent, 300000); //System.out.println(test); } SamplePeriod parent = new SamplePeriod(); for (int i = 0; i < 24; i ++) { parent.setTime(true, i, 0, 0); parent.setTime(false, i + 1, 0, 0); SamplePeriod test = gen.getRandTerm(parent, 5 * 60 * 1000); //System.out.println(test); } parent.setTime(true, 0, 0, 0); parent.setTime(false, 24, 0, 0); ArrayList<SamplePeriod> testSet = gen.getRandTerms(parent, 12, 5 * 60 * 1000); /* for (SamplePeriod period : testSet) { System.out.println(period); } */ } /** * parent shoud be start at 0 * @param parent : start and end time * @param sliceCnt : slice count * @param termLen : pick length with in slice * @return */ public ArrayList<SamplePeriod> getRandTerms(SamplePeriod parent, long sliceCnt, long termLen) { ArrayList<SamplePeriod> result = new ArrayList<SamplePeriod>(); SamplePeriod slice = new SamplePeriod(); SamplePeriod pickedSlice; long sliceSize = parent.end / sliceCnt; long endTime = 0; while (endTime + sliceSize <= parent.end) { slice.start = endTime; slice.end = endTime + sliceSize; //System.out.println(slice); pickedSlice = getRandTerm(slice, termLen); //System.out.println(pickedSlice); //System.out.println(); result.add(pickedSlice); endTime += sliceSize; } return result; } public SamplePeriod getRandTerm(SamplePeriod parent, long term) { SamplePeriod period = new SamplePeriod(); long totalLength = parent.getPeriodMillis(); long start = (Math.abs(random.nextLong())%(totalLength - term)); period.start = start + parent.start; period.end = start + term + parent.start; return period; } }
0cc64edd2ba6a82465b8b676f35e3e859ccc2e31
f205b149ba643ff48a48af4ffda05eef1813467a
/src/main/java/xbog/controller/QuestionController.java
12b97b7b0ac1ff05720373cc0d8999d9790bd781
[]
no_license
Godlvxbog/cims
2db146b7747842f60a6a062f6b7a9d1ed569cb0e
91efc1975c1aba92ecc8a30e760d78671afc710e
refs/heads/master
2020-06-14T20:33:17.791169
2016-12-04T15:07:04
2016-12-04T15:07:04
75,350,007
0
0
null
null
null
null
UTF-8
Java
false
false
5,626
java
package xbog.controller; import xbog.async.EventModel; import xbog.async.EventProducer; import xbog.async.EventType; import xbog.service.CommentService; import xbog.service.LikeService; import xbog.service.QuestionService; import xbog.service.UserService; import xbog.util.WendaUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import xbog.model.*; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Random; /** * Created by Administrator on 2016/10/9. * 这个是问题发布相关的类 */ @Controller public class QuestionController { //日志 private static final Logger logger = LoggerFactory.getLogger(QuestionController.class); @Autowired EventProducer eventProducer; @Autowired QuestionService questionService; @Autowired UserService userService; @Autowired CommentService commentService; @Autowired HostHolder hostHolder;//当前用户 @Autowired LikeService likeService; @RequestMapping("/questionForm") public String questionForm(){ return "questionForm"; } @RequestMapping(value = "/question/add1")//页面进来需要的处理 @ResponseBody public String addQuestion1(@RequestParam(value="title",required = false,defaultValue = "title1") String title, @RequestParam(value="content",required = false,defaultValue = "content1") String content){ try { Question question = new Question(); question.setTitle(title); question.setContent(content); question.setCreateDate(new Date()); question.setCommentCount(0); if (hostHolder.getUser() == null) { //question.setUserId(WendaUtil.ANNOYMOUS_USERID);//设置匿名用户,在utils包中谈价匿名用户的id return WendaUtil.getJSONString(999); } else { question.setUserId(hostHolder.getUser().getId()); } if (questionService.addQuestion(question) > 0) { //问题发布成功时候发一个异步事件 eventProducer.fireEvent(new EventModel(EventType.ADD_QUESTION) .setActorId(question.getUserId()) .setEntityId(question.getId()) .setExts("title", question.getTitle()) .setExts("content", question.getContent())); return WendaUtil.getJSONString(0); } } catch (Exception e){ logger.error("增加文章失败"+e.getMessage()); } return WendaUtil.getJSONString(1,"添加文章失败"); // questionService.addQuestion(question); // return "redirect:/"; } //下面写问答的详细页面 @RequestMapping("/question/{qid}") public String questionDetail(@PathVariable("qid") int qid, Model model){ Question question= questionService.selectById(qid); model.addAttribute("question",question); model.addAttribute("user",userService.getUser(question.getUserId())); List<Comment> commentList=commentService.getCommentByEntity(qid, EntityType.ENTITY_QUESTION); //这里不仅需要评论的东西,还需要评论用户的头像等东西 List<ViewOfObject> comments=new ArrayList<>(); for (Comment comment:commentList){ ViewOfObject vo=new ViewOfObject(); vo.set("comment",comment); vo.set("user",userService.getUser(comment.getUserId())); //添加赞与踩相关的功能; //判断当前用户是否喜欢 if (hostHolder.getUser()==null ){ vo.set("liked",0); }else{ vo.set("liked",likeService.getLikeStatus(hostHolder.getUser().getId(),EntityType.ENTITY_COMMENT,comment.getId())); } vo.set("likeCount",likeService.getLikeCount(EntityType.ENTITY_COMMENT,comment.getId() )); comments.add(vo); } model.addAttribute("comments",comments); return "detail"; } @RequestMapping(value = "/question/add") @ResponseBody public String addQuestion(@RequestParam("title") String title, @RequestParam("content") String content){ //提示,@param常见形式有:<input>标签提交请求参数 try{ Question questionNew=new Question(); questionNew.setTitle(title); questionNew.setContent(content); questionNew.setCreateDate(new Date()); Random random=new Random(); questionNew.setCommentCount(random.nextInt(1000)); if (hostHolder.getUser()==null){ questionNew.setUserId(WendaUtil.ANONYMOUS_USERID); }else{ questionNew.setUserId(hostHolder.getUser().getId()); } if (questionService.addQuestion(questionNew)>0){ return WendaUtil.getJSONString(0); } }catch (Exception e){ logger.error("增加文章失败"+e.getMessage()); } return WendaUtil.getJSONString(1,"添加文章失败"); } }
8c15a07156b259d5ecbf1dbfb8d976f57e1f119a
e45ef1e1a070666123d8f1cefdb1c2ec1791e998
/src/main/java/nz/ac/auckland/marketcomprehension/Document.java
18061dd465cb476ca66cc537d5c51e5be72b2caf
[]
no_license
bmil852/softeng754_6-feet-under
741342f66a60b5538d3c51a1feb4d331b36bc15c
07c8b987ecd6e6084b32afb70e48bd73d3cd9f4a
refs/heads/master
2020-03-16T12:42:30.615802
2018-05-18T19:52:47
2018-05-18T19:52:47
132,672,701
1
0
null
2018-05-18T19:51:40
2018-05-08T22:40:14
Java
UTF-8
Java
false
false
358
java
package nz.ac.auckland.marketcomprehension; public class Document { private String _documentText; private Category _category; public Document(String text, Category category) { _documentText = text; _category = category; } public String getDocumentText() { return _documentText; } public Category getCategory() { return _category; } }
bd8e402298477922716dd67304ac499e7d929bfc
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/23/23_a0844064c4bb8bbd4950554fa53c4b97a865c4f8/DataExporter/23_a0844064c4bb8bbd4950554fa53c4b97a865c4f8_DataExporter_t.java
ce69b036bf297579fc89e3e537b43df62e45484f
[]
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
3,808
java
/* * Copyright 2004-2013 ICEsoft Technologies Canada Corp. * * 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.icefaces.ace.component.dataexporter; import java.io.IOException; import javax.faces.FacesException; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.event.AbortProcessingException; import javax.faces.event.FacesEvent; import org.icefaces.ace.component.datatable.DataTable; public class DataExporter extends DataExporterBase { private transient String path = null; private transient String source = ""; public void broadcast(FacesEvent event) throws AbortProcessingException { super.broadcast(event); if (event != null) { DataTable table = null; UIComponent compositeParent = null; FacesContext facesContext = getFacesContext(); try { Object customExporter = getCustomExporter(); Exporter exporter; if (customExporter == null) { exporter = ExporterFactory.getExporterForType(getType()); } else { if (customExporter instanceof Exporter) { exporter = (Exporter) customExporter; } else { throw new FacesException("Object specified as custom exporter does not extend org.icefaces.ace.component.dataexporter.Exporter."); } } UIComponent targetComponent = event.getComponent().findComponent(getTarget()); if (targetComponent == null) targetComponent = findComponentCustom(facesContext.getViewRoot(), getTarget()); if (targetComponent == null) throw new FacesException("Cannot find component \"" + getTarget() + "\" in view."); if (!(targetComponent instanceof DataTable)) throw new FacesException("Unsupported datasource target:\"" + targetComponent.getClass().getName() + "\", exporter must target a ACE DataTable."); table = (DataTable) targetComponent; if (!UIComponent.isCompositeComponent(table)) { compositeParent = UIComponent.getCompositeComponentParent(table); } if (compositeParent != null) { compositeParent.pushComponentToEL(facesContext, null); } table.pushComponentToEL(facesContext, null); this.path = exporter.export(facesContext, this, table); } catch (IOException e) { throw new FacesException(e); } finally { if (table != null) { table.popComponentFromEL(facesContext); } if (compositeParent != null) { compositeParent.popComponentFromEL(facesContext); } } } } private UIComponent findComponentCustom(UIComponent base, String id) { if (base.getId().equals(id)) return base; java.util.List<UIComponent> children = base.getChildren(); UIComponent result = null; for (UIComponent child : children) { result = findComponentCustom(child, id); if (result != null) break; } return result; } public String getPath(String clientId) { if (this.source.equals(clientId)) { return this.path; } else { return null; } } public void setSource(String clientId) { this.source = clientId; } protected FacesContext getFacesContext() { return FacesContext.getCurrentInstance(); } }
69da0f65242fcc1e87d074072464eff8c42f2b11
536656cd89e4fa3a92b5dcab28657d60d1d244bd
/components/background_task_scheduler/internal/android/java/src/org/chromium/components/background_task_scheduler/internal/BackgroundTaskSchedulerJobService.java
85cb5208e7cfba25dce60f624ff295de3d53b40e
[ "BSD-3-Clause" ]
permissive
ECS-251-W2020/chromium
79caebf50443f297557d9510620bf8d44a68399a
ac814e85cb870a6b569e184c7a60a70ff3cb19f9
refs/heads/master
2022-08-19T17:42:46.887573
2020-03-18T06:08:44
2020-03-18T06:08:44
248,141,336
7
8
BSD-3-Clause
2022-07-06T20:32:48
2020-03-18T04:52:18
null
UTF-8
Java
false
false
11,084
java
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.components.background_task_scheduler.internal; import android.annotation.TargetApi; import android.app.job.JobInfo; import android.app.job.JobParameters; import android.app.job.JobScheduler; import android.content.ComponentName; import android.content.Context; import android.os.Build; import android.os.Bundle; import android.os.PersistableBundle; import androidx.annotation.VisibleForTesting; import org.chromium.base.Log; import org.chromium.base.ThreadUtils; import org.chromium.components.background_task_scheduler.TaskInfo; import org.chromium.components.background_task_scheduler.TaskParameters; import java.util.List; /** * An implementation of {@link BackgroundTaskSchedulerDelegate} that uses the system * {@link JobScheduler} to schedule jobs. */ @TargetApi(Build.VERSION_CODES.LOLLIPOP_MR1) class BackgroundTaskSchedulerJobService implements BackgroundTaskSchedulerDelegate { private static final String TAG = "BkgrdTaskSchedulerJS"; /** Delta time for expiration checks. Used to make checks after the end time. */ static final long DEADLINE_DELTA_MS = 1000; /** Clock to use so we can mock time in tests. */ public interface Clock { long currentTimeMillis(); } private static Clock sClock = System::currentTimeMillis; @VisibleForTesting static void setClockForTesting(Clock clock) { sClock = clock; } /** * Checks if a task expired, based on the current time of the service. * * @param jobParameters parameters sent to the service, which contain the scheduling information * regarding expiration. * @param currentTimeMs the current time of the service. * @return true if the task expired and false otherwise. */ static boolean didTaskExpire(JobParameters jobParameters, long currentTimeMs) { PersistableBundle extras = jobParameters.getExtras(); if (extras == null || !extras.containsKey(BACKGROUND_TASK_SCHEDULE_TIME_KEY)) { return false; } long scheduleTimeMs = extras.getLong(BACKGROUND_TASK_SCHEDULE_TIME_KEY); if (extras.containsKey(BACKGROUND_TASK_END_TIME_KEY)) { long endTimeMs = extras.getLong(BACKGROUND_TASK_END_TIME_KEY); return TaskInfo.OneOffInfo.getExpirationStatus( scheduleTimeMs, endTimeMs, currentTimeMs); } else { long intervalTimeMs = extras.getLong(BACKGROUND_TASK_INTERVAL_TIME_KEY); // Based on the JobInfo documentation, attempting to declare a smaller period than // this when scheduling a job will result in a job that is still periodic, but will // run with this effective period. if (intervalTimeMs < JobInfo.getMinPeriodMillis()) { intervalTimeMs = JobInfo.getMinPeriodMillis(); } if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { // Before Android N, there was no control over when the job will execute within // the given interval. This makes it impossible to check for an expiration time. return false; } // Since Android N, there was a minimum of 5 min set for the flex value. This // value is considerably lower from the previous one, since the minimum value // allowed for the interval time is of 15 min: // https://android.googlesource.com/platform/frameworks/base/+/refs/heads/oreo-release/core/java/android/app/job/JobInfo.java. long flexTimeMs = extras.getLong(BACKGROUND_TASK_FLEX_TIME_KEY, /*defaultValue=*/ JobInfo.getMinFlexMillis()); return TaskInfo.PeriodicInfo.getExpirationStatus( scheduleTimeMs, intervalTimeMs, flexTimeMs, currentTimeMs); } } /** * Retrieves the {@link TaskParameters} from the {@link JobParameters}, which are passed as * one of the keys. Only values valid for {@link android.os.BaseBundle} are supported, and other * values are stripped at the time when the task is scheduled. * * @param jobParameters the {@link JobParameters} to extract the {@link TaskParameters} from. * @return the {@link TaskParameters} for the current job. */ static TaskParameters getTaskParametersFromJobParameters(JobParameters jobParameters) { TaskParameters.Builder builder = TaskParameters.create(jobParameters.getJobId()); PersistableBundle jobExtras = jobParameters.getExtras(); PersistableBundle persistableTaskExtras = jobExtras.getPersistableBundle(BACKGROUND_TASK_EXTRAS_KEY); Bundle taskExtras = new Bundle(); taskExtras.putAll(persistableTaskExtras); builder.addExtras(taskExtras); return builder.build(); } @VisibleForTesting static JobInfo createJobInfoFromTaskInfo(Context context, TaskInfo taskInfo) { PersistableBundle jobExtras = new PersistableBundle(); PersistableBundle persistableBundle = getTaskExtrasAsPersistableBundle(taskInfo); jobExtras.putPersistableBundle(BACKGROUND_TASK_EXTRAS_KEY, persistableBundle); JobInfo.Builder builder = new JobInfo .Builder(taskInfo.getTaskId(), new ComponentName(context, BackgroundTaskJobService.class)) .setPersisted(taskInfo.isPersisted()) .setRequiresCharging(taskInfo.requiresCharging()) .setRequiredNetworkType(getJobInfoNetworkTypeFromTaskNetworkType( taskInfo.getRequiredNetworkType())); JobInfoBuilderVisitor jobInfoBuilderVisitor = new JobInfoBuilderVisitor(builder, jobExtras); taskInfo.getTimingInfo().accept(jobInfoBuilderVisitor); builder = jobInfoBuilderVisitor.getBuilder(); return builder.build(); } private static class JobInfoBuilderVisitor implements TaskInfo.TimingInfoVisitor { private final JobInfo.Builder mBuilder; private final PersistableBundle mJobExtras; JobInfoBuilderVisitor(JobInfo.Builder builder, PersistableBundle jobExtras) { mBuilder = builder; mJobExtras = jobExtras; } // Only valid after a TimingInfo object was visited. JobInfo.Builder getBuilder() { return mBuilder; } @Override public void visit(TaskInfo.OneOffInfo oneOffInfo) { if (oneOffInfo.expiresAfterWindowEndTime()) { mJobExtras.putLong( BackgroundTaskSchedulerDelegate.BACKGROUND_TASK_SCHEDULE_TIME_KEY, sClock.currentTimeMillis()); mJobExtras.putLong(BackgroundTaskSchedulerDelegate.BACKGROUND_TASK_END_TIME_KEY, oneOffInfo.getWindowEndTimeMs()); } mBuilder.setExtras(mJobExtras); if (oneOffInfo.hasWindowStartTimeConstraint()) { mBuilder.setMinimumLatency(oneOffInfo.getWindowStartTimeMs()); } long windowEndTimeMs = oneOffInfo.getWindowEndTimeMs(); if (oneOffInfo.expiresAfterWindowEndTime()) { windowEndTimeMs += DEADLINE_DELTA_MS; } mBuilder.setOverrideDeadline(windowEndTimeMs); } @Override public void visit(TaskInfo.PeriodicInfo periodicInfo) { if (periodicInfo.expiresAfterWindowEndTime()) { mJobExtras.putLong(BACKGROUND_TASK_SCHEDULE_TIME_KEY, sClock.currentTimeMillis()); mJobExtras.putLong(BACKGROUND_TASK_INTERVAL_TIME_KEY, periodicInfo.getIntervalMs()); if (periodicInfo.hasFlex()) { mJobExtras.putLong(BACKGROUND_TASK_FLEX_TIME_KEY, periodicInfo.getFlexMs()); } } mBuilder.setExtras(mJobExtras); if (periodicInfo.hasFlex() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { mBuilder.setPeriodic(periodicInfo.getIntervalMs(), periodicInfo.getFlexMs()); return; } mBuilder.setPeriodic(periodicInfo.getIntervalMs()); } @Override public void visit(TaskInfo.ExactInfo exactInfo) { throw new RuntimeException("Exact tasks should not be scheduled with " + "JobScheduler."); } } private static int getJobInfoNetworkTypeFromTaskNetworkType( @TaskInfo.NetworkType int networkType) { // The values are hard coded to represent the same as the network type from JobService. return networkType; } private static PersistableBundle getTaskExtrasAsPersistableBundle(TaskInfo taskInfo) { Bundle taskExtras = taskInfo.getExtras(); BundleToPersistableBundleConverter.Result convertedData = BundleToPersistableBundleConverter.convert(taskExtras); if (convertedData.hasErrors()) { Log.w(TAG, "Failed converting extras to PersistableBundle: " + convertedData.getFailedKeysErrorString()); } return convertedData.getPersistableBundle(); } @Override public boolean schedule(Context context, TaskInfo taskInfo) { ThreadUtils.assertOnUiThread(); JobInfo jobInfo = createJobInfoFromTaskInfo(context, taskInfo); JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); if (!taskInfo.shouldUpdateCurrent() && hasPendingJob(jobScheduler, taskInfo.getTaskId())) { return true; } // This can fail on heavily modified android builds. Catch so we don't crash. try { return jobScheduler.schedule(jobInfo) == JobScheduler.RESULT_SUCCESS; } catch (Exception e) { // Typically we don't catch RuntimeException, but this time we do want to catch it // because we are worried about android as modified by device manufacturers. Log.e(TAG, "Unable to schedule with Android.", e); return false; } } @Override public void cancel(Context context, int taskId) { ThreadUtils.assertOnUiThread(); JobScheduler jobScheduler = (JobScheduler) context.getSystemService(Context.JOB_SCHEDULER_SERVICE); try { jobScheduler.cancel(taskId); } catch (NullPointerException exception) { Log.e(TAG, "Failed to cancel task: " + taskId); } } private boolean hasPendingJob(JobScheduler jobScheduler, int jobId) { List<JobInfo> pendingJobs = jobScheduler.getAllPendingJobs(); for (JobInfo pendingJob : pendingJobs) { if (pendingJob.getId() == jobId) return true; } return false; } }
450c55e5dd96036e04cdf772630593010d30b5d7
be9cd50b4205ca997c4214c983e214ff3dfc4bec
/src/com/example/controlflujo/Condicionales_if_3.java
c40e84abcdb21af2f0fd696d9ef09f9fa24cbcae
[]
no_license
elaris6/JavaPildoras
9b5a7595cd8872a8adab74f5cc7ee4264bfed9fe
858621c4497d628c56b90016594e9f84446d0e15
refs/heads/master
2023-03-07T06:13:48.822989
2021-02-21T18:11:26
2021-02-21T18:11:26
340,969,210
0
0
null
null
null
null
UTF-8
Java
false
false
1,292
java
package com.example.controlflujo; import javax.swing.JOptionPane; public class Condicionales_if_3 { public static void main(String[] args) { /* USO OPERADORES LOGICOS Programa para evaluar las condiciones de un alumno para el acceso a una beca en función de los ingresos familiares, la distancia al centro de estudio y el número de hermanos en el centro. */ int distancia = Integer.parseInt(JOptionPane.showInputDialog("Introduce distancia al centro de estudios en km")); double renta = Double.parseDouble(JOptionPane.showInputDialog("Introduce la renta familiar")); byte hermanos = Byte.parseByte(JOptionPane.showInputDialog("Introduce número de hermanos en el centro")); // Si el bloque del if o del else solo tiene una instrucción, // se podrían omitir las llaves if ((distancia > 10 && renta < 20000) || (hermanos > 1)) { JOptionPane.showMessageDialog(null,"El alumno tiene derecho a beca"); } else if ((renta < 10000) || (distancia > 5 && hermanos > 0)){ JOptionPane.showMessageDialog(null,"El alumno tiene derecho a beca"); } else JOptionPane.showMessageDialog(null, "El alumno NO tiene derecho a beca"); } }
bd8762017721753fab7b150e8169bd0c88c3d083
542a54d1150a15d90f8636a863242598850a828c
/code/SqlRunner.java
948ae21d931a6a8bcaeb6d5ac5275607c5147521
[]
no_license
netwelfare/mybatis
92d7374f4306d0187169e10b7fee668a35a19aa8
5c64f7e948e498744e08e4c9130a5277b1180856
refs/heads/master
2020-05-22T06:41:03.728275
2017-06-13T10:05:40
2017-06-13T10:05:40
60,523,658
0
0
null
null
null
null
UTF-8
Java
false
false
1,996
java
package code; import java.io.IOException; import java.io.InputStream; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.apache.ibatis.builder.xml.XMLMapperBuilder; import org.apache.ibatis.executor.parameter.DefaultParameterHandler; import org.apache.ibatis.io.Resources; import org.apache.ibatis.mapping.BoundSql; import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.mapping.SqlSource; import org.apache.ibatis.reflection.MetaObject; import org.apache.ibatis.session.Configuration; public class SqlRunner { private String file; private Connection connection; public SqlRunner(String file, Connection connection) { this.file = file; this.connection = connection; } public ResultSet query(String statement, Object parameter) { InputStream inputStream = null; ResultSet resultSet = null; try { inputStream = Resources.getResourceAsStream(file); Configuration configuration = new Configuration(); // MetaObject metaObject = configuration.newMetaObject(parameter); // Object value = metaObject.getValue("startDate"); XMLMapperBuilder mapperParser = new XMLMapperBuilder(inputStream, configuration, file, configuration.getSqlFragments()); mapperParser.parse(); MappedStatement mapstatement = configuration.getMappedStatement(statement, false); SqlSource sql = mapstatement.getSqlSource(); BoundSql sql2 = sql.getBoundSql(parameter); DefaultParameterHandler handler = new DefaultParameterHandler(mapstatement, parameter, sql2); PreparedStatement ps = connection.prepareStatement(sql2.getSql()); handler.setParameters(ps); System.err.println(ps.toString()); resultSet = ps.executeQuery(); } catch (IOException | SQLException e) { e.printStackTrace(); } finally { try { if (inputStream != null) { inputStream.close(); } } catch (IOException e) { e.printStackTrace(); } } return resultSet; } }
3a477366345c6cb932fb049e7b517a2713411928
af2b3ba0c64f3b4c9d2059f73e79d4c377a0b5d1
/java基础/day0201_基本类型/src/tarena/day0201/Test2.java
06267fc651f475686898926a8a271618e476c654
[]
no_license
xuelang201201/Android
495b411a3bcdf70969ff01cf8fcb7ee8ea5abfd8
0829c4904193c07cb41048543defae83f6c5a226
refs/heads/master
2022-05-06T09:09:48.921737
2020-04-22T08:41:15
2020-04-22T08:41:15
257,838,791
0
0
null
null
null
null
GB18030
Java
false
false
406
java
package tarena.day0201; public class Test2 { public static void main(String[] args) { /* * 定义四个变量,分别保存两种浮点数的最小值和最大值 */ float a = Float.MAX_VALUE; float b = Float.MIN_VALUE; double c = Double.MAX_VALUE; double d = Double.MIN_VALUE; System.out.println(a); System.out.println(b); System.out.println(c); System.out.println(d); } }
c5e2e5416792a6b1b8f15ba49482a69de756c37e
f8a58cf39e58fbd53007f9fe3529cf5c6b5a85f8
/app/src/main/java/com/royll/demo/base/BasePresenter.java
e10b3da6fc9b01f259f5c8f9c018ff06bf33a360
[]
no_license
wherego/mvp-dagger2-rxjava-retrofit-demo
e675dce5d161c22550112d11c67d769d8aa74a85
908fac9f992bbba688cf67893c67e5e68149f3b7
refs/heads/master
2021-01-20T14:55:40.973338
2016-07-27T01:50:01
2016-07-27T01:50:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
114
java
package com.royll.demo.base; /** * Created by Roy on 2016/7/19. * desc: */ public interface BasePresenter { }
d081147e172f4bc413f72cd60393208813270ee5
21c70f242ba92c4f5c23b2ceb88f897413a71da4
/src/main/java/com/hujian/switcher/reactive/flowable/FlowableSubscriber.java
8eb1a836dda88c58606f5714a340540d21312d85
[ "Apache-2.0" ]
permissive
pandening/JSwitcher
fd16829be94f1001cd42e98b5c347357bf815742
c536f5ec71e0fea847aa2517ae030509b7fe5ff7
refs/heads/facade
2021-01-19T12:25:15.543666
2017-09-20T14:52:27
2017-09-20T14:52:27
100,784,178
2
0
null
2017-09-27T14:54:33
2017-08-19T09:28:29
Java
UTF-8
Java
false
false
1,222
java
/** * Copyright (c) 2017 hujian * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.hujian.switcher.reactive.flowable; /** * Created by hujian06 on 2017/8/28. */ /** * @param <T> the value type */ public interface FlowableSubscriber<T> extends Subscriber<T> { /** * Implementors of this method should make sure everything that needs * to be visible in {@link #onNext(Object)} is established before * calling {@link Subscription#request(long)}. In practice this means * no initialization should happen after the {@code request()} call and * additional behavior is thread safe in respect to {@code onNext}. */ @Override void onSubscribe(Subscription s); }
5831d7b0bc60c02296222a26760fb98b61fa0f82
e95c95867e9042a4d26ef0771f610cebc289b2bc
/app/src/test/java/com/zeus/javadevs/ExampleUnitTest.java
eb34cf6ddd96a4e571cb6481f8bfaafd43088a54
[]
no_license
iamzeus4u/JavaDevs
9a718ce32334fb61ce0367a96dcd9d4b7b952aff
da13cd333cf3a94b8fe12c2e9048001e70422b97
refs/heads/master
2020-05-21T06:27:17.311142
2017-03-10T19:02:32
2017-03-10T19:02:32
84,588,865
0
0
null
null
null
null
UTF-8
Java
false
false
406
java
package com.zeus.javadevs; import org.junit.Test; import static org.junit.Assert.assertEquals; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
c145ff99a9b9ce4d251f01d035375cb250b56d7e
ee889d9f2b3d38579ef36fc07e862100e6e3088e
/meta-sql-plugin-second/src/ru/bellski/metasql/lang/parser/MetaSqlParserUtil.java
67f387ff460503883ae6fbc110892ddb13b89af7
[]
no_license
Bellski/metadata
9bdc1960c7186d5e9ae80efb3ef6ae47e8152006
3e92b0b7c4ab26db733b4262b6e2ef29303a406d
refs/heads/master
2020-12-21T01:06:27.285208
2016-08-07T21:07:47
2016-08-07T21:07:47
57,114,613
2
0
null
null
null
null
UTF-8
Java
false
false
482
java
package ru.bellski.metasql.lang.parser; import com.intellij.lang.PsiBuilder; import com.intellij.lang.parser.GeneratedParserUtilBase; /** * Created by oem on 6/6/16. */ public class MetaSqlParserUtil extends GeneratedParserUtilBase { public static boolean parseGrammar(PsiBuilder builder_, int level, Parser parser) { ErrorState state = ErrorState.get(builder_); return parseAsTree(state, builder_, level, DUMMY_BLOCK, true, parser, TRUE_CONDITION); } }
7f172dd41b35f955e16457ba4dc68a401a0e094d
b9379b98e636990a597d096a9a80b5d8c2a46ed8
/serivce/service_edu/src/main/java/com/lsh/serviceedu/controller/EduVideoController.java
f5bed7d679b2be11ba7b9195429e2482abd23a54
[]
no_license
fhawke/edu_platform
6bbf1204e14c98bde2f8452fc3c69a5c0a5b31d9
088ad70f3492a337c920446eee485ec9389b7175
refs/heads/master
2023-02-08T20:36:44.041326
2020-12-25T02:47:39
2020-12-25T02:47:39
324,274,303
1
0
null
null
null
null
UTF-8
Java
false
false
2,176
java
package com.lsh.serviceedu.controller; import com.lsh.commonutils.util.R; import com.lsh.servicebase.exceptionhandler.EduException; import com.lsh.serviceedu.client.VodClient; import com.lsh.serviceedu.entity.EduVideo; import com.lsh.serviceedu.service.EduVideoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; /** * <p> * 课程视频 前端控制器 * </p> * * @author lsh * @since 2020-12-17 */ @RestController @RequestMapping("/serviceedu/edu-video") public class EduVideoController { @Autowired private EduVideoService eduVideoService; //注入vodClient @Autowired private VodClient vodClient; //添加小节 @PostMapping("addVideo") public R addVideo(@RequestBody EduVideo eduVideo){ eduVideoService.save(eduVideo); return R.ok(); } //删除小节 //TODO:需要完善:删除小节的时候,同时把阿里云里面的视频删除 //调用vod模块删除 @DeleteMapping("{id}") public R deleteVideo(@PathVariable String id){ //先根据小节id获取视频id,调用方法实现视频删除 EduVideo eduVideo = eduVideoService.getById(id); String videoSourceId = eduVideo.getVideoSourceId(); //根据视频id,远程调用实现视频删除 if(!StringUtils.isEmpty(videoSourceId)){ R result = vodClient.removeVideo(videoSourceId); if(result.getCode() == 20001){ //熔断器执行 throw new EduException(20001,"删除视频失败! 熔断器--------"); } } //删除小节 eduVideoService.removeById(id); return R.ok(); } //修改小节 @PostMapping("updateVideo") public R updateVideo(@RequestBody EduVideo video){ eduVideoService.updateById(video); return R.ok(); } //根据小节ID查询 @GetMapping("getVideoInfo/{id}") public R getVideoInfo(@PathVariable String id){ EduVideo video = eduVideoService.getById(id); return R.ok().data("video",video); } }
a03d0675e4475b2eb6cb3aba1c516453f629ec0c
4b0ca748c43c8d099b41551a330191d7c9793fed
/secondUber/src/main/java/com/app/comic/utils/VRSMLog.java
94ce1cff61f275100eaf0eb9ea5f44db9bdb155f
[ "MIT" ]
permissive
imalpasha/secondUB
ce2d2757b98b65af07830d2bb73c98f3cbc87c6f
d900f1083fa5ed6d20d42dff0c54d4a901a54e88
refs/heads/master
2021-01-11T18:15:33.356116
2017-01-22T14:18:34
2017-01-22T14:18:34
79,524,098
0
1
null
null
null
null
UTF-8
Java
false
false
2,643
java
package com.app.comic.utils; import android.os.Environment; import android.util.Log; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; import java.text.SimpleDateFormat; import java.util.Date; public class VRSMLog { public static void log(String text) { File logFile = new File("sdcard/pitstop_log.txt"); if (!logFile.exists()) { try { logFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } try { // BufferedWriter for performance, true to set append to file flag BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true)); buf.append(text); buf.newLine(); buf.newLine(); buf.close(); } catch (IOException e) { e.printStackTrace(); } } public static void write() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); File folder = new File(Environment.getExternalStorageDirectory() + "/VRSM/logs/"); if (!folder.exists()) { boolean success = folder.mkdir(); Log.e("mkdir", success + ""); } File logFile = new File(folder.toString() + "/" + sdf.format(new Date()) + ".txt"); if (!logFile.exists()) { try { logFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } try { // BufferedWriter for performance, true to set append to file flag BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true)); buf.append(VRSMLog.readLogCat()); buf.newLine(); buf.newLine(); buf.close(); } catch (IOException e) { e.printStackTrace(); } } public static StringBuilder readLogCat() { StringBuilder log = new StringBuilder(); try { Process process = Runtime.getRuntime().exec("logcat -d"); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; while ((line = bufferedReader.readLine()) != null) { log.append(line); } } catch (IOException e) { e.printStackTrace(); } return log; } /* Checks if external storage is available for read and write */ public static boolean isExternalStorageWritable() { String state = Environment.getExternalStorageState(); return Environment.MEDIA_MOUNTED.equals(state); } /* Checks if external storage is available to at least read */ public static boolean isExternalStorageReadable() { String state = Environment.getExternalStorageState(); return Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state); } }
ba4b67c4afccaad17c8d71ec57fb3205f0a2bcc5
f824ff98d4609a6cb632b15e6561284401890981
/pcgen-formula/src/test/java/pcgen/base/formula/parse/FormulaArithmeticTest.java
ef51e4d51520537af4b38dc2a55f18fe4d1498fc
[]
no_license
kypvalanx/pcgen-reactor
37a00c5ec3499dd8012fe88e090a6fd4d8f56ecb
07dcf84dabba92fe25a5061672a5fd496de617b2
refs/heads/master
2022-12-23T10:15:51.408142
2019-06-08T17:56:52
2019-06-08T17:56:52
170,901,532
1
0
null
2022-12-16T04:47:52
2019-02-15T17:16:27
Java
UTF-8
Java
false
false
107,366
java
/* * Copyright 2014 (C) Tom Parker <[email protected]> * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package pcgen.base.formula.parse; import java.util.Optional; import org.junit.Test; import pcgen.base.formatmanager.FormatUtilities; import pcgen.base.formula.inst.FormulaUtilities; import pcgen.base.formula.visitor.ReconstructionVisitor; import pcgen.base.testsupport.AbstractFormulaTestCase; import pcgen.base.testsupport.TestUtilities; import pcgen.base.util.FormatManager; public class FormulaArithmeticTest extends AbstractFormulaTestCase { private static final FormatManager<?> booleanManager = FormatUtilities.BOOLEAN_MANAGER; @Override protected void setUp() throws Exception { super.setUp(); FormulaUtilities.loadBuiltInOperators(getOperatorLibrary()); } @Test public void testIntegerPositive() { String formula = "1"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testIntegerZero() { String formula = "0"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(0)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testIntegerNegative() { String formula = "-5"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(-5)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDoubleOne() { String formula = "1.0"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(1.0)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDoublePositive() { String formula = "1.1"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(1.1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDoubleNegative() { String formula = "-4.5"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-4.5)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDoubleNegativeNoLeading() { String formula = "-.5"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-0.5)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDoublePositiveNoLeading() { String formula = ".2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(0.2)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testAddIntegerInteger() { String formula = "2+3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(5)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testAddIntegerDouble() { String formula = "2+3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(5.2)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testAddDoubleInteger() { String formula = "2.1+3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(5.1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testAddDoubleDouble() { String formula = "2.1+3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(5.5)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testAddIntegerNegativeInteger() { String formula = "2+-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(-1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testAddIntegerNegativeDouble() { String formula = "2+-3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-1.2)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testAddDoubleNegativeInteger() { String formula = "2.1+-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-0.9)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testAddDoubleNegativeDouble() { String formula = "2.1+-3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-1.3)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testAddNegativeIntegerInteger() { String formula = "-2+3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testAddNegativeIntegerDouble() { String formula = "-2+3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(1.2)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testAddNegativeDoubleInteger() { String formula = "-2.1+3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(0.9)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testAddNegativeDoubleDouble() { String formula = "-2.1+3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(1.3)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testAddMultiple() { String formula = "1+4+7"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(12)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testAddMultipleWithDouble1() { String formula = "1+4.1+7"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(12.1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testAddMultipleWithDouble2() { String formula = "1+4+7.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(12.2)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testAddLevelSetExpectationsOnIntegerMath() { String formula = "1.1+-1.1"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note this is a Double assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(0)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testSubtractIntegerInteger() { String formula = "2-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(-1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testSubtractIntegerDouble() { String formula = "2-3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-1.2)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testSubtractDoubleInteger() { String formula = "2.1-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-0.9)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testSubtractDoubleDouble() { String formula = "2.1-3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-1.3)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testSubtractIntegerNegativeInteger() { String formula = "2--3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(5)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testSubtractIntegerNegativeDouble() { String formula = "2--3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(5.2)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testSubtractDoubleNegativeInteger() { String formula = "2.1--3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(5.1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testSubtractDoubleNegativeDouble() { String formula = "2.1--3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(5.5)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testSubtractNegativeIntegerInteger() { String formula = "-2-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(-5)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testSubtractNegativeIntegerDouble() { String formula = "-2-3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-5.2)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testSubtractNegativeDoubleInteger() { String formula = "-2.1-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-5.1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testSubtractNegativeDoubleDouble() { String formula = "-2.1-3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-5.5)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testSubtractMultiple() { String formula = "1-4-7"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(-10)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testSubtractMultipleWithDouble1() { String formula = "1-4.1-7"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-10.1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testSubtractMultipleWithDouble2() { String formula = "1-4-7.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-10.2)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualIntegerInteger() { String formula = "2==3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualIntegerDouble() { String formula = "2==3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualDoubleInteger() { String formula = "2.1==3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualDoubleDouble() { String formula = "2.1==3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualIntegerNegativeInteger() { String formula = "2==-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualIntegerNegativeDouble() { String formula = "2==-3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualDoubleNegativeInteger() { String formula = "2.1==-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualDoubleNegativeDouble() { String formula = "2.1==-3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualNegativeIntegerInteger() { String formula = "-2==3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualNegativeIntegerDouble() { String formula = "-2==3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualNegativeDoubleInteger() { String formula = "-2.1==3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualNegativeDoubleDouble() { String formula = "-2.1==3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualPositiveInteger() { String formula = "6==6"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualNegativeInteger() { String formula = "-3==-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualPositiveDouble() { String formula = "3.3==3.3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualNegativeDouble() { String formula = "-0.3==-0.3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualDoubleFirst() { String formula = "2.0==2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testEqualDoubleSecond() { String formula = "3==3.0"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualIntegerInteger() { String formula = "2!=3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualIntegerDouble() { String formula = "2!=3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualDoubleInteger() { String formula = "2.1!=3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualDoubleDouble() { String formula = "2.1!=3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualIntegerNegativeInteger() { String formula = "2!=-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualIntegerNegativeDouble() { String formula = "2!=-3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualDoubleNegativeInteger() { String formula = "2.1!=-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualDoubleNegativeDouble() { String formula = "2.1!=-3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualNegativeIntegerInteger() { String formula = "-2!=3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualNegativeIntegerDouble() { String formula = "-2!=3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualNegativeDoubleInteger() { String formula = "-2.1!=3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualNegativeDoubleDouble() { String formula = "-2.1!=3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualPositiveInteger() { String formula = "6!=6"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualNegativeInteger() { String formula = "-3!=-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualPositiveDouble() { String formula = "3.3!=3.3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualNegativeDouble() { String formula = "-0.3!=-0.3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualDoubleFirst() { String formula = "2.0!=2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotEqualDoubleSecond() { String formula = "3!=3.0"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanIntegerInteger() { String formula = "2<3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanIntegerDouble() { String formula = "2<3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanDoubleInteger() { String formula = "2.1<3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanDoubleDouble() { String formula = "2.1<3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanIntegerNegativeInteger() { String formula = "2<-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanIntegerNegativeDouble() { String formula = "2<-3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanDoubleNegativeInteger() { String formula = "2.1<-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanDoubleNegativeDouble() { String formula = "2.1<-3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanNegativeIntegerInteger() { String formula = "-2<3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanNegativeIntegerDouble() { String formula = "-2<3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanNegativeDoubleInteger() { String formula = "-2.1<3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanNegativeDoubleDouble() { String formula = "-2.1<3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanPositiveInteger() { String formula = "6<6"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanNegativeInteger() { String formula = "-3<-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanPositiveDouble() { String formula = "3.3<3.3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanNegativeDouble() { String formula = "-0.3<-0.3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanDoubleFirst() { String formula = "2.0<2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanDoubleSecond() { String formula = "3<3.0"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanIntegerInteger() { String formula = "2>3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanIntegerDouble() { String formula = "2>3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanDoubleInteger() { String formula = "2.1>3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanDoubleDouble() { String formula = "2.1>3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanIntegerNegativeInteger() { String formula = "2>-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanIntegerNegativeDouble() { String formula = "2>-3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanDoubleNegativeInteger() { String formula = "2.1>-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanDoubleNegativeDouble() { String formula = "2.1>-3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanNegativeIntegerInteger() { String formula = "-2>3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanNegativeIntegerDouble() { String formula = "-2>3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanNegativeDoubleInteger() { String formula = "-2.1>3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanNegativeDoubleDouble() { String formula = "-2.1>3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanPositiveInteger() { String formula = "6>6"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanNegativeInteger() { String formula = "-3>-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanPositiveDouble() { String formula = "3.3>3.3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanNegativeDouble() { String formula = "-0.3>-0.3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanDoubleFirst() { String formula = "2.0>2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanDoubleSecond() { String formula = "3>3.0"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToIntegerInteger() { String formula = "2<=3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToIntegerDouble() { String formula = "2<=3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToDoubleInteger() { String formula = "2.1<=3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToDoubleDouble() { String formula = "2.1<=3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToIntegerNegativeInteger() { String formula = "2<=-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToIntegerNegativeDouble() { String formula = "2<=-3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToDoubleNegativeInteger() { String formula = "2.1<=-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToDoubleNegativeDouble() { String formula = "2.1<=-3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToNegativeIntegerInteger() { String formula = "-2<=3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToNegativeIntegerDouble() { String formula = "-4<=3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToNegativeDoubleInteger() { String formula = "-5.1<=3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToNegativeDoubleDouble() { String formula = "-5.1<=3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToPositiveInteger() { String formula = "6<=6"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToNegativeInteger() { String formula = "-3<=-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToPositiveDouble() { String formula = "3.3<=3.3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToNegativeDouble() { String formula = "-0.3<=-0.3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToDoubleFirst() { String formula = "2.0<=2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testLessThanOrEqualToDoubleSecond() { String formula = "3<=3.0"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToIntegerInteger() { String formula = "2>=3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToIntegerDouble() { String formula = "2>=3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToDoubleInteger() { String formula = "2.1>=3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToDoubleDouble() { String formula = "2.1>=3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToIntegerNegativeInteger() { String formula = "2>=-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToIntegerNegativeDouble() { String formula = "2>=-3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToDoubleNegativeInteger() { String formula = "2.1>=-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToDoubleNegativeDouble() { String formula = "2.1>=-3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToNegativeIntegerInteger() { String formula = "-2>=3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToNegativeIntegerDouble() { String formula = "-2>=3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToNegativeDoubleInteger() { String formula = "-2.1>=3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToNegativeDoubleDouble() { String formula = "-2.1>=3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.FALSE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToPositiveInteger() { String formula = "6>=6"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToNegativeInteger() { String formula = "-3>=-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToPositiveDouble() { String formula = "3.3>=3.3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToNegativeDouble() { String formula = "-0.3>=-0.3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToDoubleFirst() { String formula = "2.0>=2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testGreaterThanOrEqualToDoubleSecond() { String formula = "3>=3.0"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, booleanManager, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(booleanManager, formula, node, Boolean.TRUE); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testMultiplyIntegerInteger() { String formula = "2*3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(6)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testMultiplyIntegerDouble() { String formula = "2*3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(6.4)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testMultiplyDoubleInteger() { String formula = "2.1*3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(6.3)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testMultiplyDoubleDouble() { String formula = "2.1*3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(7.14)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testMultiplyIntegerNegativeInteger() { String formula = "2*-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(-6)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testMultiplyIntegerNegativeDouble() { String formula = "2*-3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-6.4)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testMultiplyDoubleNegativeInteger() { String formula = "2.1*-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-6.3)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testMultiplyDoubleNegativeDouble() { String formula = "2.1*-3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-7.14)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testMultiplyNegativeIntegerInteger() { String formula = "-2*3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(-6)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testMultiplyNegativeIntegerDouble() { String formula = "-2*3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-6.4)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testMultiplyNegativeDoubleInteger() { String formula = "-2.1*3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-6.3)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testMultiplyNegativeDoubleDouble() { String formula = "-2.1*3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-7.14)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testMultiplyMultiple() { String formula = "1*4*7"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(28)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testMultiplyMultipleWithDouble1() { String formula = "1*4.1*7"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(28.7)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testMultiplyMultipleWithDouble2() { String formula = "1*4*7.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(28.8)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testMultiplySetExpectations() { String formula = "1.3*0"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Don't expect a test for Integer == Zero, Double return is OK assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(0)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideIntegerInteger() { String formula = "2/3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(2.0 / 3.0)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideIntegerDouble() { String formula = "2/3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(0.625)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideDoubleInteger() { String formula = "2.1/3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(0.7)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideDoubleDouble() { String formula = "2.1/3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(2.1 / 3.4)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideIntegerNegativeInteger() { String formula = "2/-8"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-0.25)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideIntegerNegativeDouble() { String formula = "2/-3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-0.625)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideDoubleNegativeInteger() { String formula = "2.1/-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-0.7)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideDoubleNegativeDouble() { String formula = "2.1/-3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(2.1 / -3.4)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideNegativeIntegerInteger() { String formula = "-2/3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-2.0 / 3.0)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideNegativeIntegerDouble() { String formula = "-2/3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-0.625)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideNegativeDoubleInteger() { String formula = "-2.1/3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-0.7)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideNegativeDoubleDouble() { String formula = "-2.1/3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-2.1 / 3.4)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideMultiple() { String formula = "1/4/7"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(1.0 / 4.0 / 7.0)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideMultipleWithDouble1() { String formula = "1/4.1/7"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(1 / 4.1 / 7)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideMultipleWithDouble2() { String formula = "1/4/7.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(1.0 / 4.0 / 7.2)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideSetExpectationsNumerator() { String formula = "0/1.3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Don't expect a test for Numerator == Integer Zero, Double return is OK assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(0.0)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testDivideSetExpectations() { String formula = "1.3/0"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(Double.POSITIVE_INFINITY)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderIntegerInteger() { String formula = "2%3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(2)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderIntegerDouble() { String formula = "2%3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(2.0)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderDoubleInteger() { String formula = "3.1%2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(1.1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderDoubleDouble() { String formula = "2.1%3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(2.1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderIntegerNegativeInteger() { String formula = "2%-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(2)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderIntegerNegativeDouble() { String formula = "2%-3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(2.0)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderDoubleNegativeInteger() { String formula = "2.1%-3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(2.1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderDoubleNegativeDouble() { String formula = "2.1%-3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(2.1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderNegativeIntegerInteger() { String formula = "-2%3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(-2)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderNegativeIntegerDouble() { String formula = "-2%3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-2.0)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderNegativeDoubleInteger() { String formula = "-2.1%3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-2.1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderNegativeDoubleDouble() { String formula = "-2.1%3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-2.1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderMultiple() { String formula = "19%8%2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(1)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderMultipleWithDouble1() { String formula = "9%4.1%2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(0.8)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderMultipleWithDouble2() { String formula = "9%6%1.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(0.6)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderSetExpectationsNumerator() { String formula = "0%1.3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Don't expect a test for Numerator == Integer Zero, Double return is OK assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(0.0)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testRemainderSetExpectations() { String formula = "1.3%0"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(Double.NaN)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testExponentIntegerInteger() { String formula = "2^3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); //Note expectation setting here - NOT integer math evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(8)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testExponentIntegerDouble() { String formula = "2^3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(Math.pow(2.0, 3.2))); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testExponentDoubleInteger() { String formula = "2.1^3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(9.261)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testExponentDoubleDouble() { String formula = "2.1^3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(Math.pow(2.1, 3.4))); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testExponentNegativeIntegerInteger() { String formula = "-2^3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Note integer math assertTrue(getVariables(node).isEmpty()); //Note expectation setting here - NOT integer math evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-8)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testExponentNegativeIntegerDouble() { String formula = "-2^3.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-Math.pow(2.0, 3.2))); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testExponentNegativeDoubleInteger() { String formula = "-2.1^3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-9.261)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testExponentNegativeDoubleDouble() { String formula = "-2.1^3.4"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(-Math.pow(2.1, 3.4))); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testExponentMultiple() { String formula = "1.03^4^7"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(Math.pow(1.03, 28))); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testExponentMultipleWithDouble1() { String formula = "1.03^4.1^7"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(Math.pow(1.03, 28.7))); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testExponentMultipleWithDouble2() { String formula = "1.03^4^7.2"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(Math.pow(1.03, 28.8))); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testExponentSetExpectationsBase() { String formula = "0^1.3"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Don't expect a test for Numerator == Integer Zero, Double return is OK assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(0.0)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testExponentSetExpectationsPower() { String formula = "1.3^0"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); //Don't expect a test for Power == Integer Zero, Double return is OK assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(1.0)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testParens() { String formula = "3*(1+2)"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Integer.valueOf(9)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testExtraParens() { String formula = "((4/(((3-1)))))"; SimpleNode node = TestUtilities.doParse(formula); isValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isStatic(formula, node, true); assertTrue(getVariables(node).isEmpty()); evaluatesTo(FormatUtilities.NUMBER_MANAGER, formula, node, Double.valueOf(2)); Object rv = new ReconstructionVisitor().visit(node, new StringBuilder()); assertTrue(rv.toString().equals(formula)); } @Test public void testNotValidBooleanAdd() { String formula = "(4<5)+(5>6)"; SimpleNode node = TestUtilities.doParse(formula); isNotValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isNotValid(formula, node, booleanManager, Optional.empty()); } @Test public void testNotValidSubA() { String formula = "((4<5)+(5>6))-1"; SimpleNode node = TestUtilities.doParse(formula); isNotValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isNotValid(formula, node, booleanManager, Optional.empty()); } @Test public void testNotValidSubB() { String formula = "5+((4<5)+(5>6))"; SimpleNode node = TestUtilities.doParse(formula); isNotValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isNotValid(formula, node, booleanManager, Optional.empty()); } @Test public void testNotValidNoFunc() { String formula = "5+foo(5)"; SimpleNode node = TestUtilities.doParse(formula); isNotValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); } @Test public void testNotValidExponRoot() { String formula = "(4<5)^5"; SimpleNode node = TestUtilities.doParse(formula); isNotValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); } @Test public void testNotValidExpon() { String formula = "5^(9>8)"; SimpleNode node = TestUtilities.doParse(formula); isNotValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isNotValid(formula, node, booleanManager, Optional.empty()); } @Test public void testExponNotValidSubA() { String formula = "((4<5)+(5>6))^1"; SimpleNode node = TestUtilities.doParse(formula); isNotValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isNotValid(formula, node, booleanManager, Optional.empty()); } @Test public void testExponNotValidSubB() { String formula = "5^((4<5)+(5>6))"; SimpleNode node = TestUtilities.doParse(formula); isNotValid(formula, node, FormatUtilities.NUMBER_MANAGER, Optional.empty()); isNotValid(formula, node, booleanManager, Optional.empty()); } }
be1e74d888398a3884a8f1178451da6b991c101a
54ae4396bf18cec6484f6fcac767fa998f318f9d
/Escalonador/Escalonador/src/prioD/App.java
be0a9edf7cbf18c75e36a159d191cb45aba9111f
[]
no_license
rodrigobaptistonefilho/EscalonamentoSO
d61d883391b8fddeb4567decf04ad34a218cff0b
e6234865ad954a8c773e107b8922706aa0c3b858
refs/heads/master
2022-12-10T22:52:55.828999
2020-08-29T13:42:44
2020-08-29T13:42:44
291,278,475
0
0
null
null
null
null
UTF-8
Java
false
false
3,076
java
package prioD; import java.util.ArrayList; import java.util.List; /** * * @author Rodrigo */ public class App { public static void main(String[] args) throws InterruptedException { List<Process> process = new ArrayList(); List<Process> ready = new ArrayList(); Process aux = null; Process p1 = new Process("p1",300,3); Process p2 = new Process("p2",250,2); Process p3 = new Process("p3",100,5); Process p4 = new Process("p4",200,8); Process p5 = new Process("p5",250,3); Process p6 = new Process("p6",150,1); Process p7 = new Process("p7",100,1); Process p8 = new Process("p8",200,4); Process p9 = new Process("p9",300,6); Process p0 = new Process("p0",200,1); process.add(p1); process.add(p2); process.add(p3); process.add(p4); process.add(p5); process.add(p6); process.add(p7); process.add(p8); process.add(p9); process.add(p0); for(int i = 0; i < 2000; i += 30){ if(!ready.isEmpty()){ for(Process pr : ready){ if(pr.cont == 3){ ready.remove(pr); break; } } } System.out.print("\nt= " + i); for(Process proc : process){ if(proc.tempo <= i && proc.status == 0){ proc.status = 1; ready.add(proc); } } System.out.print("\tExec: "); if(ready.isEmpty()){ System.out.println("Nenhuma"); }else{ aux = getMaior(ready); aux.prioridade--; aux.cont++; System.out.println(aux.id + "\tPriority: " + aux.prioridade); for(Process proc : ready){ if(!proc.id.equals(aux.id)) proc.prioridade++; } ready.remove(aux); printProcess(ready, aux); ready.add(aux); aux = null; } System.out.println(""); } } public static Process getMaior(List<Process> vetor){ int x = 0; Process y = null; for(Process process : vetor){ if(process.prioridade > x){ x = process.prioridade; y = process; } } return y; } public static void printProcess(List<Process> vetor, Process x){ System.out.print("Fila: "); if(vetor.isEmpty()){ System.out.println("Empty"); }else{ for(Process process : vetor){ System.out.println(process.id + "\t"); } } } }
c2796366fff07b73c37df568fb6f5460ae637dba
f1b939abf4e02a687c6a3a0e16fd3cbf7e3bc5f0
/app/src/main/java/com/example/capstone0/BottomNavigationThings/Profile/D_Address.java
34ad53ce8989c1c0c4278c33bba58d32ac05a664
[]
no_license
Alexa200/Capstone0
57489c3c7b5995ab9cd5142f8241f59334265e4b
d490a532f5fddafcdf83587ecdec5a64479a7068
refs/heads/master
2022-03-12T20:37:53.309618
2019-12-02T17:20:56
2019-12-02T17:20:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,148
java
package com.example.capstone0.BottomNavigationThings.Profile; import androidx.annotation.NonNull; public class D_Address { public String PinCode; public String HouseNo; public String Road_Area_Colony; public String City; public String State; public String Name; public String Phone; public String AddressType; public String error=null; public D_Address() { } public D_Address(String error) { PinCode=null; HouseNo=null; Road_Area_Colony=null; City=null; State=null; Name=null; Phone=null; AddressType=null; this.error=error; } @NonNull @Override public String toString() { StringBuilder stringBuilder=new StringBuilder(); stringBuilder.append("Name:"+Name+"\n"); stringBuilder.append("Phone:"+Phone+"\n"); stringBuilder.append("HouseNo:"+HouseNo+"\n"); stringBuilder.append("State:"+State+"-"+PinCode+"\n"); stringBuilder.append("City:"+City+"\n"); stringBuilder.append("Road:"+Road_Area_Colony); return stringBuilder.toString(); } }
551dbb4e15b28eda9bbc1ebf184662de1a0d6547
c8d37adeda427699b22504ae7fc97b041751ede5
/gmall-manage-web/src/main/java/com/atguigu/gmall0311/manage/GmallManageWebApplication.java
9ee108471db554a8ef901e07236ca8281f9f3762
[]
no_license
cpeng1130/gmall0311
8bb729d841bc7f0df4d6852bff0c23debdb5fe0d
7e167fceb33d98038433b0dd7f002de13337c188
refs/heads/master
2022-09-23T00:20:21.662799
2019-11-03T08:06:14
2019-11-03T08:06:14
224,199,172
0
0
null
2022-09-01T23:16:11
2019-11-26T13:30:36
CSS
UTF-8
Java
false
false
337
java
package com.atguigu.gmall0311.manage; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class GmallManageWebApplication { public static void main(String[] args) { SpringApplication.run(GmallManageWebApplication.class, args); } }
a3baf7d6daa33b8b64048a96f5a0111ddd4e98a9
7518aff135206625fcad5ff872f50edbeac41b58
/Boletin_Tema_6_POO/Ejer_7_Agroalimentaria/Prueba_Herencia.java
19d39a31aee76292289f3a80f8d49988930f9c8a
[]
no_license
Royal6969/Ejercicios_Programacion_Java_1_DAM
ce19d6f2c259a99564cc7bfd46d6ea3b8f6b7617
d3ea7ca9671ecb1487c29093729de3ec8f25ba61
refs/heads/main
2023-08-06T12:59:35.557018
2021-09-15T21:31:23
2021-09-15T21:31:23
399,794,463
0
0
null
null
null
null
ISO-8859-10
Java
false
false
1,234
java
package Ejer_7_Agroalimentaria; public class Prueba_Herencia { public static void main(String[] args) { // TODO Auto-generated method stub Fecha cad=new Fecha(1, 1, 1); Fecha envasa=new Fecha(2, 2, 2); Frescos fresco=new Frescos(cad, envasa, 1, "Espaņa"); Frescos frescos=new Frescos(cad, envasa, 2, "Espaņa"); Refrigerados refri=new Refrigerados(cad, envasa, 3, "Francia", 111, -10); Refrigerados refro=new Refrigerados(cad, envasa, 4, "Francia", 222, -12); Refrigerados refru=new Refrigerados(cad, envasa, 5, "Francia", 333, -15); Agua agua=new Agua(cad, envasa, 6, "Portugal", -30, 50); Agua aguas=new Agua(cad, envasa, 7, "Portugal", -35, 60); Aire aire=new Aire(cad, envasa, 8, "America", -70, 30, 20, 45, 5); Aire aires=new Aire(cad, envasa, 9, "America", -78, 20, 30, 40, 10); Nitrogeno nitro=new Nitrogeno(cad, envasa, 10, "Australia", -160, "Metodo", 20); System.out.println(fresco); System.out.println(frescos); System.out.println(refri); System.out.println(refro); System.out.println(refru); System.out.println(agua); System.out.println(aguas); System.out.println(aire); System.out.println(aires); System.out.println(nitro); } }
85fd9e5c35c5103998ac4d16d84d538a405d75f3
942b915c089e0a97cd57bbdaac40ea5f1c9688c2
/src/main/java/com/liangxunwang/unimanager/mvc/member/RecordController.java
d76ae4e8e228430b4299cad2eb8924371016b53c
[]
no_license
eryiyi/LbinsManager
86e8648804b391beed69cab085a43f1ea6ee59c7
05f9f745178da26ac3e78fe6add37e56f02ecbde
refs/heads/master
2021-01-10T11:50:40.649724
2016-04-02T02:33:38
2016-04-02T02:33:38
55,196,053
0
1
null
null
null
null
UTF-8
Java
false
false
10,466
java
package com.liangxunwang.unimanager.mvc.member; import com.liangxunwang.unimanager.model.Advert; import com.liangxunwang.unimanager.model.Record; import com.liangxunwang.unimanager.model.tip.DataTip; import com.liangxunwang.unimanager.mvc.vo.CommentVO; import com.liangxunwang.unimanager.mvc.vo.RecordVO; import com.liangxunwang.unimanager.mvc.vo.ZanVO; import com.liangxunwang.unimanager.query.CommentQuery; import com.liangxunwang.unimanager.query.RecordQuery; import com.liangxunwang.unimanager.service.*; import com.liangxunwang.unimanager.util.*; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.ServletException; import javax.servlet.http.HttpSession; import java.io.File; import java.net.URL; import java.util.ArrayList; import java.util.List; /** * Created by liuzwei on 2015/2/2. */ @Controller public class RecordController extends ControllerConstants{ private static Logger logger = LogManager.getLogger(RecordController.class); @Autowired @Qualifier("recordService") private ListService recordListService; @Autowired @Qualifier("recordService") private SaveService recordSaveService; @Autowired @Qualifier("recordService") private FindService findRecordService; @Autowired @Qualifier("recordService") private DeleteService deleteRecordService; @Autowired @Qualifier("commentService") private ListService listCommentService; @RequestMapping(value = "/recordList", produces = "text/plain;charset=UTF-8") @ResponseBody public String getRecord(RecordQuery query, Page page){ query.setIndex(page.getPage()==0?1:page.getPage()); query.setSize(query.getSize()==0?page.getDefaultSize():query.getSize()); try { List<RecordVO> list = (List<RecordVO>) recordListService.list(query); DataTip tip = new DataTip(); tip.setData(list); return toJSONString(tip); }catch (ServiceException e){ return toJSONString(ERROR_1); } } @RequestMapping(value = "/sendRecord", produces = "text/plain;charset=UTF-8;") @ResponseBody public String save(Record record, HttpSession session){ try { if ("1".equals(record.getRecordType())){ //是退广 recordSaveService.save(record); return toJSONString(SUCCESS); }else { String recordId = UUIDFactory.random(); record.setRecordId(recordId); recordSaveService.save(record); RecordVO recordAdd = (RecordVO) findRecordService.findById(recordId); DataTip tip = new DataTip(); tip.setData(recordAdd); return toJSONString(tip); } }catch (ServiceException e){ if (e.getMessage().equals("HAS_PUBLISH")){ return toJSONString(ERROR_2); }else { return toJSONString(ERROR_1); } } } @RequestMapping(value = "/getRecordById", produces = "text/plain;charset=UTF-8;") @ResponseBody public String getRecordById(String recordId){ try { RecordVO record = (RecordVO) findRecordService.findById(recordId); DataTip tip = new DataTip(); tip.setData(record); return toJSONString(tip); }catch (ServiceException e){ return toJSONString(ERROR_1); } } /** * 通过上下文来取工程路径 * * @return * @throws Exception */ private String getAbsolutePathByContext(HttpSession session) throws Exception { String webPath = session.getServletContext().getRealPath("/"); webPath = webPath.replaceAll("[\\\\\\/]WEB-INF[\\\\\\/]classes[\\\\\\/]?", "/"); webPath = webPath.replaceAll("[\\\\\\/]+", "/"); webPath = webPath.replaceAll("%20", " "); if (webPath.matches("^[a-zA-Z]:.*?$")) { } else { webPath = "/" + webPath; } webPath += "/"; webPath = webPath.replaceAll("[\\\\\\/]+", "/"); return webPath; } /** * 通过类路径来取工程路径 * * @return * @throws Exception */ private String getAbsolutePathByClass(HttpSession session) throws Exception { String webPath = this.getClass().getResource("/").getPath().replaceAll("^\\/", ""); webPath = webPath.replaceAll("[\\\\\\/]WEB-INF[\\\\\\/]classes[\\\\\\/]?", "/"); webPath = webPath.replaceAll("[\\\\\\/]+", "/"); webPath = webPath.replaceAll("%20", " "); if (webPath.matches("^[a-zA-Z]:.*?$")) { } else { webPath = "/" + webPath; } webPath += "/"; webPath = webPath.replaceAll("[\\\\\\/]+", "/"); return webPath; } private String getAbsolutePathByResource(HttpSession session) throws Exception { URL url = session.getServletContext().getResource("/"); String path = new File(url.toURI()).getAbsolutePath(); if (!path.endsWith("\\") && !path.endsWith("/")) { path += File.separator; } return path; } public String init(HttpSession session) throws ServletException { String webPath = null; try { webPath = getAbsolutePathByContext(session); } catch (Exception e) { } // 在weblogic 11g 上可能无法从上下文取到工程物理路径,所以改为下面的 if (webPath == null) { try { webPath = getAbsolutePathByClass(session); } catch (Exception e) { } } if (webPath == null) { try { webPath = getAbsolutePathByResource(session); } catch (Exception e) { } } return webPath; } public boolean processImg(String veido_path,String ffmpeg_path) { File file = new File(veido_path); if (!file.exists()) { System.err.println("路径[" + veido_path + "]对应的视频文件不存在!"); return false; } List<String> commands = new java.util.ArrayList<String>(); commands.add(ffmpeg_path); commands.add("-i"); commands.add(veido_path); commands.add("-y"); commands.add("-f"); commands.add("image2"); commands.add("-ss"); commands.add("1");//这个参数是设置截取视频多少秒时的画面 //commands.add("-t"); //commands.add("0.001"); commands.add("-s"); commands.add("700x525"); commands.add(veido_path.substring(0, veido_path.lastIndexOf(".")).replaceFirst("vedio", "file") + ".jpg"); try { ProcessBuilder builder = new ProcessBuilder(); builder.command(commands); builder.start(); System.out.println("截取成功"); return true; } catch (Exception e) { e.printStackTrace(); return false; } } @RequestMapping("/deleteRecordById") @ResponseBody public String deleteRecordById(String recordId){ try { deleteRecordService.delete(recordId); return toJSONString(SUCCESS); }catch (ServiceException e){ return toJSONString(ERROR_1); } } @Autowired @Qualifier("zanService") private ListService zanListService; @Autowired @Qualifier("recordOneService") private ListService recordOneService; @RequestMapping(value = "/viewRecord", produces = "text/plain;charset=UTF-8;") public String viewRecord(String recordId, ModelMap map){ try { Object[] params = new Object[]{recordId}; Object[] result = (Object[]) findRecordService.findById(params); RecordVO record = (RecordVO) result[0]; Advert advert = (Advert) result[1]; map.put("record", record); map.put("advert", advert); if (!StringUtil.isNullOrEmpty(record.getRecordPicUrl())){ String[] pics = record.getRecordPicUrl().split(","); List<String> list = new ArrayList<String>(pics.length); for (int i=0; i<pics.length; i++){ list.add(i, pics[i]); } map.put("pics", pics); } //查询该动态的评论 CommentQuery query = new CommentQuery(); query.setIndex(1); query.setSize(10); query.setRecordId(recordId); List<CommentVO> list = (List<CommentVO>) listCommentService.list(query); map.put("list", list); //查询该动态的赞 List<ZanVO> listZan = (List<ZanVO>) zanListService.list(recordId); map.put("listZan", listZan); //查询精彩推荐 RecordQuery query1 = new RecordQuery(); query1.setIndex(1); query1.setSize(20); query1.setSchoolId(recordId); List<RecordVO> listRecord = new ArrayList<RecordVO>(); List<RecordVO> listRecord1 = (List<RecordVO>) recordOneService.list(query1); if(listRecord1 != null){ for (RecordVO recordVO:listRecord1){ // if(recordVO.getRecordPicUrl() != null && !"".equals(recordVO.getRecordPicUrl())){ String[] str = recordVO.getRecordPicUrl().split(","); if(str != null && str.length >0){ recordVO.setRecordPicUrl(str[0]); } listRecord.add(recordVO); } } } map.put("listRecord", listRecord); return "/record/viewRecord"; }catch (ServiceException e){ return toJSONString(ERROR_1); } } }
e992b374b76ea4c5f989f1c3e38502e409900cb4
7a3f2697878f51bcb536dcf756611e5d4a18c7f6
/app/src/main/java/com/receipt/invoice/stock/sirproject/Adapter/User_Listing_Adapter.java
bed0cc9f4a571e5ae0c997893b0541cdb0d6daf1
[]
no_license
pctguy/SirProject3
0b05cddc2c099cac0647ce7f87d6ece1930779a5
6418b7ff97326502c9addafb81c06dbeca036293
refs/heads/master
2022-05-22T11:33:39.326133
2020-05-02T01:58:25
2020-05-02T01:58:25
260,499,812
0
0
null
null
null
null
UTF-8
Java
false
false
3,422
java
package com.receipt.invoice.stock.sirproject.Adapter; import android.content.Context; import android.content.Intent; import android.graphics.Typeface; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import com.makeramen.roundedimageview.RoundedImageView; import com.receipt.invoice.stock.sirproject.Details.Customer_Detail_Activity; import com.receipt.invoice.stock.sirproject.Details.User_Detail_Activity; import com.receipt.invoice.stock.sirproject.R; import java.util.ArrayList; import java.util.List; /** * Created by Fawad on 4/15/2020. */ public class User_Listing_Adapter extends RecyclerView.Adapter<User_Listing_Adapter.ViewHolderForCat> { private Context mcontext ; List<String> musername=new ArrayList<>(); List<String> muserrole=new ArrayList<>(); List<Integer> mimages=new ArrayList<>(); public User_Listing_Adapter(Context mcontext , ArrayList<String> username,ArrayList<String> userrole,ArrayList<Integer> images){ this.mcontext = mcontext; musername=username; muserrole=userrole; mimages = images; } @NonNull @Override public User_Listing_Adapter.ViewHolderForCat onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View myitem = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.user_itemlayout , viewGroup , false); ViewHolderForCat viewHolderForCat =new ViewHolderForCat(myitem); return viewHolderForCat; } @Override public void onBindViewHolder(@NonNull final User_Listing_Adapter.ViewHolderForCat viewHolderForCat, final int i) { viewHolderForCat.username.setText(musername.get(i)); viewHolderForCat.userrole.setText(muserrole.get(i)); viewHolderForCat.image.setImageResource(mimages.get(i)); viewHolderForCat.userdetail.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(mcontext,User_Detail_Activity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); mcontext.startActivity(intent); } }); } @Override public int getItemCount() { return musername.size(); //return 2; } public class ViewHolderForCat extends RecyclerView.ViewHolder { TextView username,userrole,userdetail; RoundedImageView image; public ViewHolderForCat(@NonNull View itemView) { super(itemView); username = itemView.findViewById(R.id.username); userrole = itemView.findViewById(R.id.userrole); userdetail = itemView.findViewById(R.id.userdetail); image = itemView.findViewById(R.id.image); username.setTypeface(Typeface.createFromAsset(mcontext.getAssets(),"Fonts/AzoSans-Medium.otf")); userrole.setTypeface(Typeface.createFromAsset(mcontext.getAssets(),"Fonts/AzoSans-Light.otf")); userdetail.setTypeface(Typeface.createFromAsset(mcontext.getAssets(),"Fonts/Ubuntu-Light.ttf")); } } public void updateList(List<String> list){ musername = list; notifyDataSetChanged(); } }
[ "pctguy" ]
pctguy
6e742a8e9527c9c3eb62ef8b04fd59efdb3e59b3
82e0d1cf671be828adc80c673c29c0dfc674fa62
/mdl4ui-fields/src/main/java/org/mdl4ui/fields/model/component/TextBoxField.java
0a222c1f8a3f3c511ac6d6b53a535fc6b41c46f7
[]
no_license
lesfurets/mdl4ui
09b8f414e47163ba42283faec3607ac73d97143e
e986cdd0cc4698da526a6bc834f61403e183e8bb
refs/heads/master
2016-09-06T01:24:54.194853
2016-01-25T22:44:44
2016-01-25T22:44:57
7,135,530
6
1
null
null
null
null
UTF-8
Java
false
false
113
java
package org.mdl4ui.fields.model.component; public interface TextBoxField extends FieldComponent<String> { }
94608a333d3f1441a3d8f40a3b50ecf7a86ef33c
7a6c915aad309c2347aab9a92359a41b76b49943
/rompasaurus-week2-032.TheSumOfSetOfNumbers-1421111/src/TheSumOfSetOfNumbers.java
e13de319e49173b0982bbbdd84c87bfbc943a3ab
[]
no_license
rompasaurus/Helsinki-Mooc-Projects
62928f72d150ab544a7fa63eca53032ca19a96a0
d415eee31393ab313bbe001600cdddbdd932348f
refs/heads/master
2021-04-15T04:57:05.000948
2018-03-21T08:09:24
2018-03-21T08:09:24
126,144,493
0
0
null
null
null
null
UTF-8
Java
false
false
394
java
import java.util.Scanner; public class TheSumOfSetOfNumbers { public static void main(String[] args) { Scanner reader = new Scanner(System.in); System.out.println("Until what? "); int max = Integer.parseInt(reader.nextLine()); int sum=0; for(int i=0;i<=max;i++) { sum+=i; } System.out.println("Sum is "+sum); } }
8ed4493f057bdbee1fdd8399a1404afcfce13244
b4656118863153130dc04b92abc0e2105e966f16
/src/_06_kethua/baitap/PointendMoveablePoint/Testpoint.java
8474dfa3566ed272278aefbc6ffc2581b1e9d872
[]
no_license
huynhduc296/C1220G2_LeVanHuynhDuc_Module2
2c88ec3718063970eb406faaf45562217b97ca05
6222f4d2b65f97709734cb748d218b9780de18cd
refs/heads/master
2023-03-24T13:51:04.672165
2021-03-22T02:09:22
2021-03-22T02:09:22
334,828,573
0
0
null
null
null
null
UTF-8
Java
false
false
373
java
package _06_kethua.baitap.PointendMoveablePoint; public class Testpoint { public static void main(String[] args) { MovablePoint movablePoint=new MovablePoint(0,0,3,5); System.out.println(movablePoint); movablePoint.move(); System.out.println(movablePoint); movablePoint.move(); System.out.println(movablePoint); } }
218617d7e6f05b4d7f859fd491ca33a4beb1018e
8365760b774554aa7fa629c23f134e585ee2f13c
/Stack.java
1abe56fe3c8de41e0305d706f7aea0218d5b3b18
[]
no_license
Noor-Ahmed-12/DSA-Uni-tasks
f91d0290423c5f80b6b227888573163c294426aa
29e7dad764b35128bbbcae56d38f7db5cd3f76aa
refs/heads/main
2023-03-20T13:15:24.635646
2021-03-13T18:09:59
2021-03-13T18:09:59
347,337,657
0
0
null
null
null
null
UTF-8
Java
false
false
142
java
public interface Stack { void push(Object obj); Object pop(); Object peek(); boolean isEmpty(); int size(); }
989a87a9a7becc16dad2178a8878adf41aa85180
5b122bba77a21132e0ca4c6fa75b7ba12a51bd6b
/OpenClosedPrinciple/src/openclosedprinciple/Calculator.java
341cdc6cd91447047adec5b76ee3106ad559d02f
[]
no_license
elvinaliyev6/SOLID-Principles
b151688f748d746c48aa8616d943e6b21e7288a1
36001f24e81da4423088527193c41359a1861a16
refs/heads/master
2023-08-15T00:05:41.547796
2021-09-21T11:53:38
2021-09-21T11:53:38
359,348,234
0
0
null
null
null
null
UTF-8
Java
false
false
440
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 openclosedprinciple; public class Calculator { public void calculate(CalculatorOperation operation) { if (operation == null) { System.out.println("Cannot perform operation"); } operation.perform(); } }
886701c647180676794e32bc711ffd47a514db3e
6ffe52410356f2b3579fc9caec9188ff82a6447c
/src/me/sergivb01/sutils/player/StaffListener.java
895ed32f200b8c867180cc2c1ef75761d78b078e
[]
no_license
sergivb01/Zebra
1a70442db5f4a1bb9aaed52ccdc7ddcf6688a608
ff44ed0ee4ceb02e1cbe09821fdd7fae4737a5f9
refs/heads/master
2021-03-27T17:12:34.819894
2018-05-16T20:16:01
2018-05-16T20:16:01
118,378,604
0
0
null
null
null
null
UTF-8
Java
false
false
1,382
java
package me.sergivb01.sutils.player; import me.sergivb01.sutils.ServerUtils; import me.sergivb01.sutils.payload.PayloadSender; import me.sergivb01.sutils.utils.LogManager; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerCommandPreprocessEvent; public class StaffListener implements Listener{ private ServerUtils instance; private LogManager logManager; private String[] commands = { //TODO: Implement config (?) "more", "time", "sudo", "timer", "/set", "/stack", "crate", "lives", "tokens", "pex", "top", "enchant", "death", "/thru", "kill" }; public StaffListener(ServerUtils instance){ this.instance = instance; this.logManager = new LogManager(instance); Bukkit.getPluginManager().registerEvents(this, instance); } @EventHandler public void onWorldEditCommand(PlayerCommandPreprocessEvent event){ Player player = event.getPlayer(); if(!player.hasPermission("rank.staff")){ //TODO: Change permission return; } String command = event.getMessage(); for(String str : commands){ if(command.toLowerCase().startsWith("/" + str)){ logManager.formatMessage(player.getName(), "Executed command " + command); PayloadSender.sendStaffAbuse(player.getName(), command); } } } }
ccc5c7387363240382dd3aa0fe29dc487e5f3062
70eb068bd8379bd387ae169122ae7eb9a57360bc
/BallotBox/app/src/main/java/edu/rpi/rcos/ballotbox/PublicVotesActivity.java
e52e34613a43ef8a874574fb71b3d24316c548c8
[]
no_license
ballotbox/ballotbox-android
ee4d717f3a992946a384c103a66835ad027cd701
058690ac3fcded4590ba477c79c27254801cee82
refs/heads/master
2021-01-20T06:57:45.022088
2015-05-09T22:45:59
2015-05-09T22:45:59
31,624,773
0
0
null
null
null
null
UTF-8
Java
false
false
2,723
java
package edu.rpi.rcos.ballotbox; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ListView; import android.widget.Toast; import com.example.gulena.ballotbox.R; import java.util.List; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.RetrofitError; import retrofit.client.Response; public class PublicVotesActivity extends ListActivity { public String ENDPOINT = "http://ballot-box.herokuapp.com/"; protected List<Election> elections; ElectionAdapter array; DataManager dataManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); dataManager = getIntent().getParcelableExtra("data_manager"); if(dataManager == null) { assert false; } getData(); array = new ElectionAdapter(this, elections); setContentView(R.layout.public_votes); setListAdapter(array); findViewById(R.id.fab_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { addNewElection(); } }); } @Override protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); Election p = elections.get(position); Intent intent = new Intent(this,VoteActivity.class); intent.putExtra("random_id",p.getRandomAccessId()); intent.putExtra("data_manager",dataManager); Log.i("PublicVotesActivity","Transitioning to election with id " + p.getRandomAccessId()); startActivity(intent); } public void getData() { elections = dataManager.getPublicElections(); } public void requestData(String uri) { RestAdapter adapter = new RestAdapter.Builder() .setEndpoint(ENDPOINT) .build(); VotesAPI api = adapter.create(VotesAPI.class); api.getPublicElections(new Callback<List<Election>>() { @Override public void success(List<Election> elections, Response response) { PublicVotesActivity.this.elections = elections; } @Override public void failure(RetrofitError error) { Toast.makeText(PublicVotesActivity.this, "Could not get data", Toast.LENGTH_LONG); } }); } public void addNewElection() { Intent intent = new Intent(this,NewElectionActivity.class); intent.putExtra("data_manager",dataManager); startActivity(intent); } }
e686fab2f9af2fc319f500749bbcf8cc3d11f7b8
a739cae2c2d367ac3777155c32c161d1c3f749e0
/week1/src/Import.java
f3522e6230edc6e20ebe24a011f8c06b8f1e0a9b
[]
no_license
AnhLuc04/BaiModun2
03be4e6c800b944326a95b9a74c251da983e511c
4c85c0bc233fd8c8088cde2092683036f7c0a048
refs/heads/master
2022-09-14T21:20:14.705243
2020-05-23T08:13:19
2020-05-23T08:13:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
290
java
import java.util.Scanner; public class Import { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter your name: "); String name = scanner.nextLine(); System.out.println("Hello: " + name); } }
48b0cd4aaf079c824d013204bb78434fc6077e80
8c9ba566d5425c13de4716fc3972fe532bad22f6
/oauth2/oauthserver/src/main/java/com/flyonsky/config/OAuth2AuthorizationServer.java
c5796a81a95d20b31a8585d89cf7ecad52a57be5
[ "Apache-2.0" ]
permissive
flyonskycn/micro-service-study
0b75b25d5aa052587851b565c379ea7a836dc7bb
94e01e10e07b3888c68e791bd265dd387c6ec26c
refs/heads/master
2023-06-25T11:31:53.978694
2019-09-26T13:58:19
2019-09-26T13:58:19
155,157,833
0
0
Apache-2.0
2023-06-20T18:33:18
2018-10-29T05:42:27
Java
UTF-8
Java
false
false
906
java
package com.flyonsky.config; import org.springframework.context.annotation.Configuration; import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; @Configuration @EnableAuthorizationServer public class OAuth2AuthorizationServer extends AuthorizationServerConfigurerAdapter{ @Override public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.inMemory() .withClient("clientapp") .secret("112233") .redirectUris("http://localhost:9001/callback") // 授权码模式 .authorizedGrantTypes("authorization_code") .scopes("read_userinfo", "read_contacts"); } }
d9a487b0d8cecd5e3afecc1faa33f883d941548c
f0b0bf3624114f8cc12dd8a9e003fe5757b688ca
/E_comm/src/main/java/com/E_comm/domain/ShippingAddress.java
9141c28445fbb7c51b6ae163d757d2be19942db6
[]
no_license
Rushabh-C/RC_Tech
0a52819ce7482b57dc5fbcb20e344dccc1a00a48
d5225f6bd0f0d8ebaf974026bce7e92344003564
refs/heads/master
2023-06-04T12:44:10.182354
2021-06-26T08:54:33
2021-06-26T08:54:33
380,448,957
2
0
null
null
null
null
UTF-8
Java
false
false
2,374
java
package com.E_comm.domain; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToOne; import org.hibernate.annotations.GenericGenerator; @Entity public class ShippingAddress { @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = "native") @GenericGenerator(name = "native", strategy = "native") private Long id; private String ShippingAddressName; private String ShippingAddressStreet1; private String ShippingAddressStreet2; private String ShippingAddressCity; private String ShippingAddressState; private String ShippingAddressCountry; private String ShippingAddressPincode; @OneToOne private Order order; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getShippingAddressName() { return ShippingAddressName; } public void setShippingAddressName(String shippingAddressName) { ShippingAddressName = shippingAddressName; } public String getShippingAddressStreet1() { return ShippingAddressStreet1; } public void setShippingAddressStreet1(String shippingAddressStreet1) { ShippingAddressStreet1 = shippingAddressStreet1; } public String getShippingAddressStreet2() { return ShippingAddressStreet2; } public void setShippingAddressStreet2(String shippingAddressStreet2) { ShippingAddressStreet2 = shippingAddressStreet2; } public String getShippingAddressCity() { return ShippingAddressCity; } public void setShippingAddressCity(String shippingAddressCity) { ShippingAddressCity = shippingAddressCity; } public String getShippingAddressState() { return ShippingAddressState; } public void setShippingAddressState(String shippingAddressState) { ShippingAddressState = shippingAddressState; } public String getShippingAddressCountry() { return ShippingAddressCountry; } public void setShippingAddressCountry(String shippingAddressCountry) { ShippingAddressCountry = shippingAddressCountry; } public String getShippingAddressPincode() { return ShippingAddressPincode; } public void setShippingAddressPincode(String shippingAddressPincode) { ShippingAddressPincode = shippingAddressPincode; } public Order getOrder() { return order; } public void setOrder(Order order) { this.order = order; } }
118713b1ca49aac809adc7fa2e0d7e11458a61c8
3aaf9aec1a71a7c327504b0c4a6067d371d9927a
/app/src/main/java/ipnossoft/rma/ui/button/IsochronicSoundButton.java
952c51d38d6b5b0abea73a1da7abdd03c766b94e
[]
no_license
intrepiddhole/SleepSound
fc09ad0ed319d25f842abd952afcb781ceea397a
9980a02899e71d54ad5199fa080d1671d8417d70
refs/heads/master
2021-09-05T21:30:14.728309
2018-01-31T04:29:58
2018-01-31T04:29:58
119,634,610
1
0
null
null
null
null
UTF-8
Java
false
false
320
java
package ipnossoft.rma.ui.button; import android.content.Context; import com.ipnossoft.api.soundlibrary.Sound; public class IsochronicSoundButton extends BrainwaveSoundButton { public IsochronicSoundButton(Context var1, Sound var2, int var3, SoundButtonGestureListener var4) { super(var1, var2, var3, var4); } }
ff1a44495cb7ae4ef8a798ebdb0ddff7aae7f2d3
1121afd4366c2532515b65c3b569eca7e82169bf
/Reanimators/src/main/java/com/unco/reanimators/command/syntax/parsers/EnumParser.java
06d9deb8476ffc9994fb208d6c563b7b1949ed28
[]
no_license
Soulbond/Reanimators
6c13ca934ee46c1b46c137d9afeed4153f968588
3ddcf2164c1118bf93bab61697886b42220bc311
refs/heads/master
2021-05-22T18:09:15.477640
2020-05-01T05:20:13
2020-05-01T05:20:13
260,385,911
5
1
null
null
null
null
UTF-8
Java
false
false
1,202
java
package com.unco.reanimators.command.syntax.parsers; import com.unco.reanimators.command.syntax.SyntaxChunk; import java.util.ArrayList; import java.util.Collections; public class EnumParser extends AbstractParser { String[] modes; public EnumParser(String[] modes) { this.modes = modes; } @Override public String getChunk(SyntaxChunk[] chunks, SyntaxChunk thisChunk, String[] values, String chunkValue) { if (chunkValue == null){ String s = ""; for (String a : modes){ s += a + ":"; } s = s.substring(0, s.length()-1); return (thisChunk.isHeadless() ? "" : thisChunk.getHead()) + (thisChunk.isNecessary() ? "<" : "[") + s + (thisChunk.isNecessary() ? ">" : "]"); } ArrayList<String> possibilities = new ArrayList<String>(); for (String s : modes){ if (s.toLowerCase().startsWith(chunkValue.toLowerCase())) possibilities.add(s); } if (possibilities.isEmpty()) return ""; Collections.sort(possibilities); String s = possibilities.get(0); return s.substring(chunkValue.length()); } }
9ba795fb871a1bf7cb535f3e4a543c82bc52389c
bdf129fb93ac9c751f1ac58074cb7d0132f8f147
/src/main/java/icrperusa/servlet/reports/GuideReturnMaterials.java
c243b66dcc701b78079bc3a1a1e0a002c5df459f
[ "Apache-2.0" ]
permissive
cvaldezc/reports
7ab8702fc6bb502a5583da79c8d5f1ff87331b4e
a5c537049c176a83637f45803f4470084f4868fc
refs/heads/master
2021-01-19T13:42:00.755017
2017-09-19T22:53:42
2017-09-19T22:53:42
88,102,699
0
0
null
null
null
null
UTF-8
Java
false
false
2,383
java
package icrperusa.servlet.reports; import java.io.IOException; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import icrperusa.utils.Module; import icrperusa.utils.Reports; /** * Servlet implementation class GuideReturnMaterials */ public class GuideReturnMaterials extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public GuideReturnMaterials() { super(); } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse * response) */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("application/pdf;charset=UTF-8"); String SOURCE = getServletContext().getRealPath("/").concat(String.valueOf(Module.SEPARATOR)); String ruc = (request.getParameterMap().containsKey("ruc")) ? request.getParameter("ruc") : Module.defenterpise; boolean format = (request.getParameterMap().containsKey("format")) ? true : false; Map<String, Object> parameter = new HashMap<String, Object>(); Logger.getLogger(OrdenPurchase.class.getName()).info("SERVCER PATH DIR ".concat(SOURCE)); parameter.put("idguiadevmat", request.getParameter("nguide")); parameter.put("SOURCE", SOURCE); parameter.put("RUC", ruc); Reports rpt = new Reports(ruc); byte[] bytes = null; try { if (format) bytes = rpt.getReportcn(String.format("%sreports/storage/guidereturnmatformat.jasper", SOURCE), parameter); else bytes = rpt.getReportcn(String.format("%sreports/storage/guidereturnmat.jasper", SOURCE), parameter); } catch (SQLException e) { e.printStackTrace(); } response.setContentLength(bytes.length); ServletOutputStream ouputStream = response.getOutputStream(); ouputStream.write(bytes, 0, bytes.length); ouputStream.flush(); ouputStream.close(); } }
9419ed6b796d7a77d00b4e666e9084d70d099336
78ae6b125cbd8df23db5deab84a2474b3c2bc45b
/Subuwuliu/src/com/johan/subuwuliu/bean/DriverInfoBean.java
3d2ccee598ba7d872bcba42b89e4659c06fe1eb3
[]
no_license
henryxzw/subuwuliu
5778603b81a3c2a76d206142282acf86f36e72c7
b99927e80402b4cc21f9dc77478c8b9324047b17
refs/heads/master
2021-01-18T04:23:44.724637
2016-11-24T03:07:17
2016-11-24T03:07:17
13,641,579
0
0
null
null
null
null
UTF-8
Java
false
false
955
java
package com.johan.subuwuliu.bean; public class DriverInfoBean { public String status; public String driver_id; public String car_status; public String car_msg; public String nick_name; public String mobile; public String avatar; public String credit; public String timestamp; public String goods_comment; public String cid; public String identity_card; public String card_available_time; public String license; public String license_time; public String order_booking; public String order_total; public String order_near; public String collect; public String plate_number; public String engine_number; public String sizes; public String car_type; public String car_picture1; public String car_picture2; public String car_picture3; public String car_picture4; public String driving_license1; public String driving_license2; public String car_safe; public String taxi_license; public String customs; public String msg; }
2d914f45ef5423d34c3e626399e4a86da279a594
d40b228a3fa3480fc6a0c8a15e6ddbd3ae825f0d
/fleetap/src/main/java/com/kindsonthegenius/fleetap/models/VehicleHire.java
01b59dc9ffb1cd7c86646c70ddce886b723d406f
[]
no_license
Akif-jpg/FirstSpringApp
3f61a3bfa0501eec3901a848d92f408bb74ebce7
533497e915ca6ce4bd4c5051585a996db977e08b
refs/heads/main
2023-06-19T11:52:18.493935
2021-07-17T12:48:33
2021-07-17T12:48:33
385,668,567
0
0
null
2021-07-17T12:48:33
2021-07-13T16:29:39
HTML
UTF-8
Java
false
false
1,293
java
package com.kindsonthegenius.fleetap.models; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import org.springframework.format.annotation.DateTimeFormat; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Entity @Data @NoArgsConstructor @AllArgsConstructor public class VehicleHire { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="id") private int id; @ManyToOne @JoinColumn(name="vehicleid", insertable=false, updatable=false) private Vehicle vehicle; private Integer vehicleid; @DateTimeFormat(pattern = "yyyy-MM-dd") private Date dateOut; private String timeOut; @DateTimeFormat(pattern = "yyyy-MM-dd") private Date dateIn; private String timeIn; @ManyToOne @JoinColumn(name="clientid", insertable=false, updatable=false) private Client client; private Integer clientid; @ManyToOne @JoinColumn(name="locationid", insertable=false, updatable=false) private Location location; private Integer locationid; private String price; private String remarks; }
8c937436a446392f90da8e4dc34037be23970562
fe49198469b938a320692bd4be82134541e5e8eb
/scenarios/web/large/gradle/ClassLib043/src/main/java/ClassLib043/Class006.java
e7dfce8972d46e84932294ec05c5bcc9519709e6
[]
no_license
mikeharder/dotnet-cli-perf
6207594ded2d860fe699fd7ef2ca2ae2ac822d55
2c0468cb4de9a5124ef958b315eade7e8d533410
refs/heads/master
2022-12-10T17:35:02.223404
2018-09-18T01:00:26
2018-09-18T01:00:26
105,824,840
2
6
null
2022-12-07T19:28:44
2017-10-04T22:21:19
C#
UTF-8
Java
false
false
122
java
package ClassLib043; public class Class006 { public static String property() { return "ClassLib043"; } }
80f4e4024097061e247624c5d2072f48189b485b
6f75895b650a04e9a3daa5b03017624c2864c7d4
/src/main/java/com/matt/tech/service/controllers/RequestController.java
59a6dca348b733d46ad8abfd09b57372e8a891e3
[]
no_license
mattballvox/simple-web-service
3ec6f133e0da704a804099f7a39ae58043a5b458
146eb16b4ff14bec9e67d8a1d1117da74f101344
refs/heads/master
2020-03-16T15:16:22.226207
2018-05-09T10:09:28
2018-05-09T10:09:28
132,736,076
0
0
null
null
null
null
UTF-8
Java
false
false
2,901
java
package com.matt.tech.service.controllers; import com.matt.tech.service.models.CustomerRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.matt.tech.service.models.CustomerResponse; import com.matt.tech.service.utils.CustomerRequestValidator; import java.time.ZoneOffset; import java.time.ZonedDateTime; import com.matt.tech.service.external.ExternalServiceHandler; /** * Exposes 2 REST endpoints. One to accept incoming requests to send customer * data to a 3rd party service and another to act as a health check for the * service. * * @author mball */ @RestController public class RequestController { private static final Logger LOGGER = LoggerFactory.getLogger(RequestController.class); private ExternalServiceHandler sendCustomerHandler; @Autowired public void setSendMessageHandler(ExternalServiceHandler sendMessageHandler) { this.sendCustomerHandler = sendMessageHandler; } /** * A simple RESTful endpoint that will accept a PUT containing the JSON * of the customer you want to update to a third party to store. * * @param customerRequest * @return */ @RequestMapping(value = "/updateCustomer", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<String> sendCustomer(@RequestBody CustomerRequest customerRequest) { LOGGER.debug("Received " + customerRequest); try { CustomerRequestValidator.validate(customerRequest); CustomerResponse sendCustomerResponse = sendCustomerHandler.sendCustomerRequest(customerRequest); return new ResponseEntity<>(sendCustomerResponse.getResponse(), sendCustomerResponse.getSuccess() ? HttpStatus.CREATED : HttpStatus.INTERNAL_SERVER_ERROR); } catch (IllegalArgumentException iae) { return new ResponseEntity<>(iae.getMessage(), HttpStatus.BAD_REQUEST); } } /** * A simple health check endpoint that will accept a GET request with no parameters * and return 200 status code. * * @return */ @RequestMapping(value = "/healthCheck", method = RequestMethod.GET) public ResponseEntity<String> healthCheck() { LOGGER.info("HealthCheck endpoint hit at " + ZonedDateTime.now(ZoneOffset.UTC)); return new ResponseEntity<>(null, HttpStatus.OK); } }
[ "" ]
1f09e8faa05126ef16facf3f38061dee36a37ff6
a40c536770c2d505544d282eb117a3e2f86d78ad
/Tekram_Driver/captin/src/main/java/com/turnpoint/ticram/tekram_driver/modules/Order.java
6aa97d73ac35936dc3c6222495eb6c0601d509a7
[]
no_license
ersalye/ticramAndroid
42e9825abaafe68a12f760e70d7de2152f698b62
fde28eedc4060bcf1bac1404566c5ce609c3665f
refs/heads/master
2022-12-18T00:03:55.236005
2020-09-19T07:05:46
2020-09-19T07:05:46
297,832,463
1
0
null
2020-09-23T02:43:00
2020-09-23T02:43:00
null
UTF-8
Java
false
false
7,225
java
package com.turnpoint.ticram.tekram_driver.modules; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class Order { @SerializedName("id") @Expose private Integer id; @SerializedName("user_id") @Expose private Integer user_id; @SerializedName("user_name") @Expose private String userName; @SerializedName("user_mob") @Expose private String userMob; @SerializedName("user_rate") @Expose private String userRate; @SerializedName("user_photo") @Expose private String userPhoto; @SerializedName("order_no") @Expose private String orderNo; @SerializedName("location") @Expose private String location; @SerializedName("location_txt") @Expose private String locationTxt; @SerializedName("to_location") @Expose private String toLocation; @SerializedName("to_location_txt") @Expose private String toLocationTxt; @SerializedName("distance") @Expose private String distance; @SerializedName("time") @Expose private String time; @SerializedName("status") @Expose private String status; @SerializedName("status_txt") @Expose private String statusTxt; @SerializedName("canceled_by") @Expose private String canceledBy; @SerializedName("expect_fee") @Expose private String expectFee; @SerializedName("fee") @Expose private String fee; @SerializedName("final_fee") @Expose private String finalFee; @SerializedName("discount") @Expose private String discount; @SerializedName("base_fare") @Expose private String baseFare; @SerializedName("user_balance") @Expose private String userBalance; @SerializedName("time_to_user") @Expose private String timeToUser; @SerializedName("date_time") @Expose private String dateTime; @SerializedName("payment_type") @Expose private String paymentType; @SerializedName("taxi") @Expose private Integer taxi; @SerializedName("text_info") @Expose private String order_info; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getuserId() { return user_id; } public void setuserId(Integer user_id) { this.user_id = user_id; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getUserMob() { return userMob; } public void setUserMob(String userMob) { this.userMob = userMob; } public String getUserRate() { return userRate; } public void setUserRate(String userRate) { this.userRate = userRate; } public String getUserPhoto() { return userPhoto; } public void setUserPhoto(String userPhoto) { this.userPhoto = userPhoto; } public String getOrderNo() { return orderNo; } public void setOrderNo(String orderNo) { this.orderNo = orderNo; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public String getLocationTxt() { return locationTxt; } public void setLocationTxt(String locationTxt) { this.locationTxt = locationTxt; } public String getToLocation() { return toLocation; } public void setToLocation(String toLocation) { this.toLocation = toLocation; } public String getToLocationTxt() { return toLocationTxt; } public void setToLocationTxt(String toLocationTxt) { this.toLocationTxt = toLocationTxt; } public String getDistance() { return distance; } public void setDistance(String distance) { this.distance = distance; } public String getTime() { return time; } public void setTime(String time) { this.time = time; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getStatusTxt() { return statusTxt; } public void setStatusTxt(String statusTxt) { this.statusTxt = statusTxt; } public String getCanceledBy() { return canceledBy; } public void setCanceledBy(String canceledBy) { this.canceledBy = canceledBy; } public String getExpectFee() { return expectFee; } public void setExpectFee(String expectFee) { this.expectFee = expectFee; } public String getFee() { return fee; } public void setFee(String fee) { this.fee = fee; } public String getFinalFee() { return finalFee; } public void setFinalFee(String finalFee) { this.finalFee = finalFee; } public String getDiscount() { return discount; } public void setDiscount(String discount) { this.discount = discount; } public String getBaseFare() { return baseFare; } public void setBaseFare(String baseFare) { this.baseFare = baseFare; } public String getUserBalance() { return userBalance; } public void setUserBalance(String userBalance) { this.userBalance = userBalance; } public String getTimeToUser() { return timeToUser; } public void setTimeToUser(String timeToUser) { this.timeToUser = timeToUser; } public String getDateTime() { return dateTime; } public void setDateTime(String dateTime) { this.dateTime = dateTime; } public String getPaymentType() { return paymentType; } public void setPaymentType(String paymentType) { this.paymentType = paymentType; } public Integer getTaxi() { return taxi; } public void setTaxi(Integer taxi) { this.taxi = taxi; } public String getOrder_info() { return order_info; } public void setOrder_info(String order_info) { this.order_info = order_info; } }
5193ca25be309b0e3d7d395059ea1ac195be548d
28f56cfc9d684d8b2ec8ac3e9dfe83223306401f
/src/pdf/base/unit/DoubleArrowGraph.java
3d4668716b55f81438d370e9f031f5fa073b75de
[]
no_license
cyys/ITextDraw
fe5019c486defc18865fcb10edc5c41fa4598ac5
1e98a49ac22a8680b1a4384e1f5290b1d15f8f6f
refs/heads/master
2020-08-04T00:26:44.395015
2016-12-17T14:39:28
2016-12-17T14:39:28
73,534,921
0
0
null
null
null
null
UTF-8
Java
false
false
4,450
java
package pdf.base.unit; import com.itextpdf.text.BaseColor; import com.itextpdf.text.Document; import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfWriter; import pdf.base.AbstractBaseChart; import pdf.base.AbstractBaseUnitChart; import pdf.base.TPoint; /** * 双箭头图 * @author cheny * */ public class DoubleArrowGraph extends AbstractBaseUnitChart { //是横向还是纵向 public static final int LEVEL_X=1; public static final int LEVEL_Y=2; private float x; private float y; private float x0; private float y0; private float height;//箭头的高度 private float arrowWidth=5;//箭头的宽度 private int level=LEVEL_X;//箭头所在的水平线:LEVEL_X or LEVEL_Y private int color;//图形的颜色 private float arrowLineWidth=1.5f;//箭头线的宽度 public DoubleArrowGraph(AbstractBaseChart baseChart, PdfWriter writer, PdfContentByte contentByte, Document document) { super(baseChart, writer, contentByte, document); } public DoubleArrowGraph(PdfWriter writer, PdfContentByte contentByte, Document document) { super(writer, contentByte, document); } @Override public void chart() { TPoint onePoint=new TPoint(); TPoint onePoint_1=new TPoint(); TPoint anotherPoint=new TPoint(); TPoint anotherPoint_1=new TPoint(); switch (level) { case LEVEL_X:{ onePoint.setX(this.x+this.arrowWidth); onePoint.setY(this.y+this.height/2); onePoint_1.setX(this.x+this.arrowWidth); onePoint_1.setY(this.y-this.height/2); anotherPoint.setX(this.x0-this.arrowWidth); anotherPoint.setY(this.y0-this.height/2); anotherPoint_1.setX(this.x0-this.arrowWidth); anotherPoint_1.setY(this.y0+this.height/2); break; } case LEVEL_Y:{ onePoint.setX(this.x+this.height/2); onePoint.setY(this.y-this.arrowWidth); onePoint_1.setX(this.x-this.height/2); onePoint_1.setY(this.y-this.arrowWidth); anotherPoint.setX(this.x0-this.height/2); anotherPoint.setY(this.y0+this.arrowWidth); anotherPoint_1.setX(this.x0+this.height/2); anotherPoint_1.setY(this.y0+this.arrowWidth); break; } default: break; } this.getBaseChart().moveRect(this.contentByte, onePoint.getX(), onePoint.getY() , anotherPoint.getX(), anotherPoint.getY(), this.color); this.contentByte.setLineWidth(this.arrowLineWidth); this.contentByte.setColorStroke(new BaseColor(this.color)); this.getBaseChart().moveLine(this.contentByte, onePoint.getX(), onePoint.getY(), this.x, this.y); this.getBaseChart().moveLine(this.contentByte, onePoint_1.getX(), onePoint_1.getY(), this.x, this.y); this.getBaseChart().moveLine(this.contentByte, anotherPoint.getX(), anotherPoint.getY(), this.x0, this.y0); this.getBaseChart().moveLine(this.contentByte, anotherPoint_1.getX(), anotherPoint_1.getY(), this.x0, this.y0); } /** * 矩形的一个点的X坐标 * @param x * @return DoubleArrowGraph */ public DoubleArrowGraph setX(float x) { this.x = x; return this; } /** * 矩形的一个点的Y坐标 * @param y * @return DoubleArrowGraph */ public DoubleArrowGraph setY(float y) { this.y = y; return this; } /** * 矩形的下一个点的X坐标 * @param x0 * @return DoubleArrowGraph */ public DoubleArrowGraph setX0(float x0) { this.x0 = x0; return this; } /** * 矩形的下一个点的Y坐标 * @param y0 * @return DoubleArrowGraph */ public DoubleArrowGraph setY0(float y0) { this.y0 = y0; return this; } /** * 箭头的高度 * @param height * @return DoubleArrowGraph */ public DoubleArrowGraph setHeight(float height) { this.height = height; return this; } /** * 箭头的宽度 * @param arrowWidth * @return DoubleArrowGraph */ public DoubleArrowGraph setArrowWidth(float arrowWidth) { this.arrowWidth = arrowWidth; return this; } /** * 箭头所在的水平线:LEVEL_X or LEVEL_Y * @param level * @return DoubleArrowGraph */ public DoubleArrowGraph setLevel(int level) { this.level = level; return this; } /** * 图形的颜色 * @param color * @return DoubleArrowGraph */ public DoubleArrowGraph setColor(int color) { this.color = color; return this; } /** * 箭头线的宽度 * @param arrowLineWidth * @return DoubleArrowGraph */ public DoubleArrowGraph setArrowLineWidth(float arrowLineWidth) { this.arrowLineWidth = arrowLineWidth; return this; } }
b07ce3c20ccb52e28ee8aa9c48f1068f3e5f0e20
947f97a97c246e3d704f8ef88cfe4233fe339b35
/src/finalZ/module/ModuleInfo.java
06de294c478f4033a795ea166c44c41bc1395e7a
[]
no_license
nvn75/FinalZ
fd9285ad71b46e26f8db7feef2af1c9e170e3f01
045d5c8366d99ec9c171d7c8210656ef59c3c6ed
refs/heads/master
2021-07-09T01:57:45.338019
2020-08-13T04:44:35
2020-08-13T04:44:35
144,549,080
0
0
null
null
null
null
UTF-8
Java
false
false
3,348
java
package finalZ.module; import finalZ.FlowEnv; import finalZ.Log; import finalZ.ModuleIF; import finalZ.Port; import finalZ.annotation.Execute; import finalZ.annotation.Instantiate; import finalZ.annotation.InstantiationPolicy; import finalZ.annotation.Module; import finalZ.exceptions.*; import org.reflections.ReflectionUtils; import java.lang.annotation.Annotation; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.Set; public class ModuleInfo { public static final String DEFAULT_PORT = "DONE"; private String name; private Class<?> cls; private ArrayList<String> ports; private Method executor; private InstantiationPolicy policy; private Object instance; private ModuleIF moduleIF; public ModuleInfo(String name, Class<?> cls) throws LoadModuleException { this.name = name; this.cls = cls; ports = new ArrayList<String>(Arrays.asList(cls.getAnnotation(Module.class).value())); if (ports.isEmpty()) ports.add(DEFAULT_PORT); Instantiate anno = cls.getAnnotation(Instantiate.class); if (anno == null) policy = InstantiationPolicy.SINGLE; else policy = anno.value(); Set<Method> executors = ReflectionUtils.getAllMethods(cls, ReflectionUtils.withAnnotation(Execute.class)); executor = CheckExecutor(executors); moduleIF = new ModuleIF(ports); Log.Debug("Module: " + getName() + ports + " {" + policy + "} " + executor.getName() + "()"); } @Override public String toString() { return getName(); } private Method CheckExecutor(Set<Method> executors) throws LoadModuleException { if (executors.size() == 0) throw new ExecutorMissingException(this); if (executors.size() >= 2) throw new DuplicateExcuterException(this); Method executor = executors.iterator().next(); Class<?> returnType = executor.getReturnType(); if (!String.class.isAssignableFrom(returnType)) throw new ExecutorHasWrongReturnType(this); return executor; } public Port getPort(int id) { return new Port(id, ports.get(id)); } public int getPortId(String portName) throws PortNotExistsException { for (int i = 0; i < ports.size(); i++) { if (ports.get(i).equals(portName)) return i; } throw new PortNotExistsException(portName, this); } public ModuleIF getIF() { return moduleIF; } public String Execute(FlowEnv env) throws InvocationTargetException, IllegalAccessException { return (String)executor.invoke(getInstance(), env); } public String getName() { return name; } public InstantiationPolicy getPolicy() { return policy; } public Object getInstance() { try { switch (policy) { case SINGLE: if (instance == null) instance = cls.newInstance(); break; case MULTIPLE: instance = cls.newInstance(); break; } } catch (Exception e) { e.printStackTrace(); return null; } return instance; } }
bbe21e7ee85248df455cd58bbda62cef6808cd9d
fae6b35952e3fd7de173d1c21d7f2f7a95b5922e
/src/main/java/com/bean/FeedbackUser.java
4311003a2fef7ba5f9176a7397c05cad068c8ef8
[]
no_license
7FBI/ElderlyManagementSystem7FBI
23d1bcca63e45a210c3487a1d729856a17b2f02e
e0822760a7d1818c477952d78123369158d8050f
refs/heads/master
2021-08-24T05:14:08.878764
2017-12-08T05:43:00
2017-12-08T05:43:00
106,272,349
0
0
null
null
null
null
UTF-8
Java
false
false
522
java
package com.bean; public class FeedbackUser extends Feedback{ private String username; private String tell; private String address; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getTell() { return tell; } public void setTell(String tell) { this.tell = tell; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } }
d31a08bb0e6691b33bd2ba20ffca20f809deb7eb
d6c4abde7704e73f288e2b578b755cb9a2cabb51
/app/src/main/java/com/example/smart_mirror/BOARD/BoardRead_Request.java
f425e4b18436d4e241886029786ab8f1e5918646
[]
no_license
peter3476/Smart_Mirror
4df802ab1b1f413d503e9c3df0442d78b0d75ea4
fd768f679d75b5a51e6688d73e4f16e4affa1664
refs/heads/master
2023-04-21T12:36:03.358623
2021-05-11T04:26:13
2021-05-11T04:26:13
366,254,186
0
0
null
null
null
null
UTF-8
Java
false
false
772
java
package com.example.smart_mirror.BOARD; import com.android.volley.AuthFailureError; import com.android.volley.Response; import com.android.volley.toolbox.StringRequest; import java.util.HashMap; import java.util.Map; public class BoardRead_Request extends StringRequest { // 서버 URL 설정 ( PHP 파일 연동 ) final static private String URL = ""; private Map<String, String> map; public BoardRead_Request(String Title, String Content, Response.Listener<String> listener) { super(Method.POST, URL, listener, null); map = new HashMap<>(); map.put("Title", Title); map.put("Content", Content); } @Override protected Map<String, String> getParams() throws AuthFailureError { return map; } }
e47b70408fcdb69deada60cafe9cf6bf3a143b1c
e25fafa3b68c5a509a5a411e12259c9eaa7288f8
/CS 2410 - Java/Stoplight/Dogs/Dog.java
0fa162426cc300a4ca6359cf1255412e1a56e0e9
[]
no_license
Candlemancer/Freshman-Year
cab237adfabd3bb5fc1b0d6d29111c3c3978bf2c
ce1882601ef10be011ea963b2388941f04266c1a
refs/heads/master
2016-09-02T04:55:00.790034
2014-10-08T07:08:32
2014-10-08T07:08:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
619
java
//Jonathan Petersen //A01236750 //Dog Info package Dogs; public class Dog { private String name; private int age; public void setInfo(String nameInput, int ageInput) { name = nameInput; age = ageInput; } public String getName() { return name; } public int getAge() { return age; } public int dogAgeInPersonYears() { return (age * 7); } public String toString() { return ("This dog's name is " + name + " and he is " + Integer.toString(age) + " years old. \n" + "In person years that is " + Integer.toString(dogAgeInPersonYears()) + " years old."); } }
e4783d4c734678374e41cd48d963ad1c0b7ade82
07f98afc870110b7698351649d8ea77624d15dc8
/JFXCollectionSamples/src/shoppingcart/Model.java
8e50cdc3c95e1d04c4d710a215696f5e56245b4c
[]
no_license
snejka844/ShoppingCartProject
d274c518fd7e36f14befca0432f3942711897148
960b5becc5f8f0103a22a5534a40a21c19e8cade
refs/heads/master
2022-12-11T16:59:59.033125
2020-08-29T12:59:02
2020-08-29T12:59:02
291,271,352
0
0
null
null
null
null
UTF-8
Java
false
false
1,208
java
package shoppingcart; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.Arrays; import javafx.collections.FXCollections; import javafx.collections.ObservableList; public class Model { private ObservableList<Item> itemsObservableList = FXCollections.observableArrayList(); private Item items[] = new Item[]{ new Item("Eggs", "dozen",1 ,2.5), new Item("Bread", "loaf",1,3.25), new Item("Butter", "grams",250,2), new Item("Cereal", "grams",500,4), new Item("Milk", "bottle",1,1) }; public ObservableList<Item> getItemsObservableList() { loadData(); return itemsObservableList; } void loadData() { itemsObservableList.setAll(Arrays.asList(items)); } } // try (BufferedReader br = new BufferedReader(new FileReader("ItemsMaster.csv"))) { // String line = null; // while ((line = br.readLine()) != null) { // String[] values = line.split(","); // Item item = new Item(values[0], values[1], Double.parseDouble(values[2]), Double.parseDouble(values[3])); // itemsObservableList.add(item); // } // } catch (NumberFormatException | IOException e) { // e.printStackTrace(); // }
c17f7cd48c553f9d78482d3f6b4469d8c5b61566
11e9f185ff8cff4ada5f4cda7b9eb36394a31a75
/spring-boot-04-web-restfulcrud/src/main/java/com/dsxdmfz/servlet/MyServlet.java
2b392eb7b360cd0cb2b28770c0a05969205570e7
[]
no_license
dsxdmfz/springBoot
4dce9dbe7f43e64a51041ac917f420c5c5142de9
8c086b246a468cad680c691fa8c00cfaa6915427
refs/heads/master
2020-03-12T15:56:33.602323
2019-06-18T09:57:27
2019-06-18T09:57:27
130,703,341
0
0
null
null
null
null
UTF-8
Java
false
false
673
java
package com.dsxdmfz.servlet; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class MyServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doPost(req,resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.getWriter().write("hello myServlet"); System.out.println("hello myServlet"); } }
2e4eb4ff0f629e5e0c4f5b824bab8d86a7dad2e7
c31d4146f27dac81a7c80d61b0ea3fe49d7c1820
/Ejercicio1/src/test/java/org/urjc/isi/travis/AppTest.java
583e71eb6a6a0b88bda01eba6a674b39c991af45
[]
no_license
TomasGalindo/pruebas_grafos_2
4c8b60adcf8719c7307d648a503fa61d81958606
906b9db81d62dac92708846297e1c82739747173
refs/heads/master
2021-05-14T16:57:56.068129
2018-01-17T18:13:37
2018-01-17T18:13:37
116,034,986
0
0
null
null
null
null
UTF-8
Java
false
false
649
java
package org.urjc.isi.travis; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ /* public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
510667d9ad6978fab28907a4049e495901654f20
545aad674b28cd457bd41cb0b0c61ccb643c4499
/SD4.2_Project/SD4.2_Assignment/src/assignment/Date.java
f980be4c6e741446060c47301096ec90d0a7a715
[]
no_license
shubhamkj5/Software_Design
ba886a1ec1a5f23ae28f67b2a7c0083310d6164b
eaf67cc3be0ca68cf04e12e3858eae6280233080
refs/heads/master
2021-10-24T02:42:59.199577
2019-03-21T14:09:59
2019-03-21T14:09:59
149,273,644
0
0
null
null
null
null
UTF-8
Java
false
false
362
java
package assignment; public class Date { private String date,month,year; public Date(String d, String m, String y) { this.date=d; this.month=m; this.year=y; } public String toString(){ return " "+date+"/"+month+"/"+year; } public void reset(String d,String m,String y){ this.date=d; this.month=m; this.year=y; } }
e04f8a763ae2d5b2b325fc85625fdf505dd0be15
97d621d2b533b3535610cba21814ea046ed560bb
/app/src/main/java/br/com/github/kalilventura/products/models/ProductEvent.java
9d5f0bb6b93c843225f0d77e35e11f75f99c73e9
[]
no_license
kalilventura/java_aws
3b2d5d3b846321a90eab537a1d9cc8ba5f47b666
172fc9c0a6ef31f3c1ae95b090ba28c336275a95
refs/heads/main
2023-07-13T11:50:44.260337
2021-08-26T01:40:33
2021-08-26T01:40:33
350,541,736
0
0
null
null
null
null
UTF-8
Java
false
false
605
java
package br.com.github.kalilventura.products.models; public class ProductEvent { private Long productId; private String code; private String username; public Long getProductId() { return productId; } public void setProductId(Long productId) { this.productId = productId; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } }
c3c405697fd7cb8cf98c76ea12e33b856cf4f770
fd1fbc6226e84c9b6111e0a2b1247402a747230e
/Manager/src/service/FlowService.java
4262bc3a21c6fd1fb65824245292d520e5d78f0b
[]
no_license
innonxu/ManagerSSH
4b19b5a009fc5fe5622ea1395556b365e3307593
3b271a8ddb87e15c2d9de4cf552057fcd19036e8
refs/heads/master
2021-01-17T23:21:25.732842
2015-09-06T02:35:47
2015-09-06T02:35:47
null
0
0
null
null
null
null
GB18030
Java
false
false
5,653
java
package service; import java.io.*; import java.net.*; import java.util.*; import org.json.*; import model.*; import dao.impl.*; public class FlowService { private NodeDaoImpl nodeDaoImpl; private NetworkDaoImpl networkDaoImpl; private SubnetService subnetService; private SubnetDaoImpl subnetDaoImpl; public String getReturnData(String urlString) throws UnsupportedEncodingException { String res = ""; //获取JSON文件,字符串形式 try { URL url = new URL(urlString); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(),"GBK")); String line; while ((line = in.readLine()) != null) { res += line; } in.close(); } catch (Exception e) { System.out.println(e); } return res; } public Map<String,String> decodeJSON(String jsonString) throws JSONException { JSONObject jsonObject = new JSONObject(jsonString);//将JSON从字符串解析为哈希 Map<String,String> result = new HashMap<String,String>(); Iterator iterator = jsonObject.keys(); String key = null; String value = null; while (iterator.hasNext()) { key = (String) iterator.next(); value = jsonObject.getString(key); result.put(key, value); } return result; } public void save(Map<String,String> map, int node_id) { Node node = nodeDaoImpl.get(Node.class,node_id);//获取节点的流量,CPU,内存 long icnFlow = Long.parseLong(map.get("contentRecv"))+Long.parseLong(map.get("contentSend")); long idnFlow = Long.parseLong(map.get("idnSendpacket"))+Long.parseLong(map.get("idnRecvpacket")); long sum = icnFlow+idnFlow; node.setIcnFlow(icnFlow); node.setIdnFlow(idnFlow); node.setIanFlow(0); node.setIsnFlow(0); node.setSum(sum); node.setCpu(Integer.parseInt(map.get("cpuLevel"))); double free = Double.parseDouble((String) map.get("freeMemory")); double total = Double.parseDouble((String) map.get("totalMemory")); int memory = (int)(((total-free)/total)*100); node.setMemory(memory); nodeDaoImpl.update(node); } public void fetch(int nodeId) { //获取单个节点的信息 Properties props = new Properties(); try { props.load(this.getClass().getClassLoader().getResourceAsStream("config/router.properties")); } catch (IOException e1) { e1.printStackTrace(); } String name = props.getProperty("name"+nodeId); String IP = props.getProperty("IP"+nodeId); try { String s = getReturnData("http://"+IP+":6666/dataInfo?RouterName="+name+"&method=throughput"); Map<String,String> map = decodeJSON(s); save(map,nodeId); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } } public void nodesFlowUpdate() { //依次获取每个节点 List<Node> nodes = nodeDaoImpl.findAll(Node.class); for(Node n:nodes) { if(n.isEnable()) { //为了防止底层路由器关闭而导致无法建立连接产生异常 fetch(n.getId()); } } } public List<Network> networksFlowUpdate() { List<Network> networks = networkDaoImpl.findAll(Network.class); int icn=0,idn=0,ian=0,isn=0; for(Network n:networks) { if(n.getId()==1) { for(Node nn:n.getNodes()) { icn+=nn.getIcnFlow(); } n.setFlow(icn); } else if(n.getId()==2) { for(Node nn:n.getNodes()) { idn+=nn.getIdnFlow(); } n.setFlow(idn); } else if(n.getId()==3) { for(Node nn:n.getNodes()) { ian+=nn.getIanFlow(); } n.setFlow(ian); } else if(n.getId()==4) { for(Node nn:n.getNodes()) { isn+=nn.getIsnFlow(); } n.setFlow(isn); } networkDaoImpl.update(n); } return networks; } public List<Subnet> subnetFlowUpdate(int networkId) { List<Subnet> subnets = subnetService.getWithNetwork(networkId); if(networkId==1) { for(Subnet subnet:subnets) { int flow=0; for(Node n:subnet.getNodes()) flow+=n.getIcnFlow(); subnet.setFlow(flow); subnetDaoImpl.update(subnet); } } else if(networkId==2) { for(Subnet subnet:subnets) { int flow=0; for(Node n:subnet.getNodes()) flow+=n.getIdnFlow(); subnet.setFlow(flow); subnetDaoImpl.update(subnet); } } else if(networkId==3) { for(Subnet subnet:subnets) { int flow=0; for(Node n:subnet.getNodes()) flow+=n.getIanFlow(); subnet.setFlow(flow); subnetDaoImpl.update(subnet); } } else if(networkId==4) { for(Subnet subnet:subnets) { int flow=0; for(Node n:subnet.getNodes()) flow+=n.getIsnFlow(); subnet.setFlow(flow); subnetDaoImpl.update(subnet); } } return subnets; } public List<Node> get() { return nodeDaoImpl.findAll(Node.class); } public Node getById(int id) { return nodeDaoImpl.get(Node.class, id); } public NodeDaoImpl getNodeDaoImpl() { return nodeDaoImpl; } public void setNodeDaoImpl(NodeDaoImpl nodeDaoImpl) { this.nodeDaoImpl = nodeDaoImpl; } public NetworkDaoImpl getNetworkDaoImpl() { return networkDaoImpl; } public void setNetworkDaoImpl(NetworkDaoImpl networkDaoImpl) { this.networkDaoImpl = networkDaoImpl; } public SubnetService getSubnetService() { return subnetService; } public void setSubnetService(SubnetService subnetService) { this.subnetService = subnetService; } public SubnetDaoImpl getSubnetDaoImpl() { return subnetDaoImpl; } public void setSubnetDaoImpl(SubnetDaoImpl subnetDaoImpl) { this.subnetDaoImpl = subnetDaoImpl; } }
cdf012700363253ec5a2d3ad64148a1d8ed17be8
99b5aa95759e88ee49d32d753efac5d89268899a
/src/main/java/com/digital/devs/dao/ICitaDAO.java
4e95dc74dda95b90fae41695e42b4b1ae86721fd
[]
no_license
alfredjava/salud
fc26feb316cdeb259a990908b6696a1935a5297d
44c1eb835b59a8fc87c90ab6975239d7999f1772
refs/heads/master
2020-03-28T10:19:53.358985
2018-09-15T13:29:40
2018-09-15T13:29:40
148,100,735
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package com.digital.devs.dao; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import com.digital.devs.model.Cita; import com.digital.devs.model.Paciente; public interface ICitaDAO extends JpaRepository<Cita, Integer>{ public List<Cita> findByPaciente(Paciente paciente); public List<Cita> findByPacienteAndFecha(Paciente paciente,String fecha); }
004c820f3f266aa52f915e391e782a0d89007a9c
7b632c4996e14ef1d47460bc5b258a2f84eb8702
/src/main/java/viettel/huannt14/checklist/repository/ServerInfoRepo.java
8f6f9a1d1895d403ffda043a3786f86325e52cff
[]
no_license
Huan24121999/checklist2
d512bb8456108ee8dfe043b92d548f1978117f05
bfddd174283866a9a2d039ce41105a68cd5b1637
refs/heads/master
2023-04-06T17:46:07.950116
2021-04-08T10:46:41
2021-04-08T10:46:41
346,071,497
0
0
null
null
null
null
UTF-8
Java
false
false
359
java
package viettel.huannt14.checklist.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; import viettel.huannt14.checklist.entity.ServerInfo; @Repository public interface ServerInfoRepo extends JpaRepository<ServerInfo,Integer> { }
952af626ca660b912669575d66c40e5bed86472b
4410969f4087b88919c1b873129f28ac04f66c89
/main/java/com/pranayama/basic/ILabel.java
7b750de99237a01eb5c1a6d5dfe556bed9e9a8f8
[]
no_license
odinzero/PRANAYAMA
1526c1bedde45288dfa232b01b27218ba169a939
a43be71261561895cc7ba1e9fc49e9595d3d41bb
refs/heads/master
2020-04-21T01:32:18.087605
2020-01-09T12:01:37
2020-01-09T12:01:37
169,226,906
0
0
null
null
null
null
UTF-8
Java
false
false
478
java
package com.pranayama.basic; import java.awt.Color; public interface ILabel<T> { public void setDisabledStateColor(String name, T resource, int x, int y, int w, int h); // public void setDisabledStateColor( T resource); // public T getDisabledStateColor(); public void setEnabledStateColor(String name, T resource, int x, int y, int w, int h); // public void setEnabledStateColor( T resource); // public T getEnabledStateColor(); }
be04bb007483788a6119a6fe07d9ac2499a7df67
3a634c83c08d736ece6e2de12a2f2870fbbc6023
/java9-sample/mods/mod-collection/src/main/org.eugene.mod.collection/org/eugene/mod/collection/SetTest.java
154827d5cdf3e16d6b729dca85c3bc86b53e6486
[ "Apache-2.0" ]
permissive
eugenewyj/eugene-webapp-samples
db59e074d12954ee5718ec941625c370f3aa4df0
44ab68b847cdf4779c22bd82eedc20e00891f171
refs/heads/master
2021-01-20T08:25:49.591750
2017-11-14T08:36:16
2017-11-14T08:36:16
101,557,977
0
0
null
null
null
null
UTF-8
Java
false
false
1,084
java
package org.eugene.mod.collection; import java.util.Set; public class SetTest { public static void main(String[] args) { Set<Integer> emptySet = Set.of(); Set<Integer> luckyNumber = Set.of(19); Set<String> vowels = Set.of("A", "E", "I", "O", "U"); System.out.println("emptySet = " + emptySet); System.out.println("singletonSet = " + luckyNumber); System.out.println("vowels = " + vowels); try { Set<Integer> set = Set.of(1, 2, null, 3); } catch (Exception e) { System.out.println("Nulls not allowed in Set.of()."); } try { Set<Integer> set = Set.of(1, 2, 3, 2); } catch (Exception e) { System.out.println(e.getMessage()); } try { luckyNumber.add(8); } catch (Exception e) { System.out.println("Cannot add an element."); } try { luckyNumber.remove(0); } catch (Exception e) { System.out.println("Cannot remove an element."); } } }
51b99e1edb956c931e4dc60f093b8c69c9c40cc1
936a983e1992f917865ce751e9953101eb996ac9
/src/com/study/test/Test_1.java
f6ee707d1ad1186d8a9bebfc480a69128bb231d5
[]
no_license
xiaozhl/rippledemo
896f4cd0e71d8050d9631e536524bc6168a38286
de89e93468b7cba3ce9c07ff67360d3c64bb4523
refs/heads/master
2020-04-06T06:56:59.130851
2014-06-05T08:36:43
2014-06-05T08:36:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
800
java
package com.study.test; import java.util.List; import java.util.UUID; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.study.business.Business; import com.study.pojo.Book; public class Test_1 { @Test public void testQueryBooks() { ApplicationContext ac = new ClassPathXmlApplicationContext("beans.xml"); Business querybooks = (Business) ac.getBean("querybooks"); querybooks.doit(); List<Book> books = (List<Book>) querybooks.getResult(); for(Book book : books) { System.out.println(book.getTitle()); } } @Test public void test2() { String rnd = UUID.randomUUID().toString(); String r = rnd.replaceAll("-",""); System.out.println(r); } }
760485224c6a06ba7c70bab7735531175bd61954
fea266d6d031c075dc916369cbb98113d135e807
/db/src/main/java/me/ift8/basic/db/config/mybatis/MapperAutoConfiguration.java
6b690b1aae1951c7e446273c6d08f62c4a3c98c8
[ "Apache-2.0" ]
permissive
IFT8/basic
48c26420b6413b42f05bbf37d5a071c25a41102e
2ddd2be9bd8500ebd0a639362dc37cb2e9ff8963
refs/heads/master
2021-01-18T19:42:45.767000
2019-02-25T10:28:40
2019-02-25T10:28:40
86,907,613
0
0
null
2018-11-27T10:18:18
2017-04-01T10:59:54
Java
UTF-8
Java
false
false
2,188
java
package me.ift8.basic.db.config.mybatis; import me.ift8.basic.db.BaseMapper2; import lombok.extern.slf4j.Slf4j; import org.apache.ibatis.session.SqlSessionFactory; import org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Configuration; import tk.mybatis.mapper.mapperhelper.MapperHelper; import javax.annotation.PostConstruct; import java.util.List; /** * Mapper 配置 * * @author liuzh */ @Slf4j @Configuration @ConditionalOnBean(SqlSessionFactory.class) @EnableConfigurationProperties(MapperProperties.class) @AutoConfigureAfter(MybatisAutoConfiguration.class) public class MapperAutoConfiguration { @Autowired private MapperProperties properties; @Autowired private List<SqlSessionFactory> sqlSessionFactoryList; @Autowired private ApplicationContext applicationContext; @PostConstruct public void postContruct() { MapperHelper mapperHelper = new MapperHelper(); mapperHelper.setConfig(properties); if (!properties.getMappers().isEmpty()) { for (Class mapper : properties.getMappers()) { //提前初始化MapperFactoryBean,注册mappedStatements applicationContext.getBeansOfType(mapper); mapperHelper.registerMapper(mapper); } } else { //BaseKzMapper默认 //提前初始化MapperFactoryBean,注册mappedStatements applicationContext.getBeansOfType(BaseMapper2.class); mapperHelper.registerMapper(BaseMapper2.class); } for (SqlSessionFactory sqlSessionFactory : sqlSessionFactoryList) { mapperHelper.processConfiguration(sqlSessionFactory.getConfiguration()); } log.info("[config] 注册 tkMtBatis mappers={}", properties.getMappers()); } }
83c8bf8c3b571001d0bc61a47d45e7fce5cfb51a
3ad2d2bced76dfb9db65586bd2126c5af61f85a3
/src/main/java/messageModule/MessageModule.java
c108f6e5328ec4b085856cd4e509b7230ce2f241
[ "Apache-2.0" ]
permissive
Counterbalance/Bit-Runner-2048
66f75f5979a4af1e7544a0700df848f02611fb8a
7ad7d1a3dcfc6d4c056344b1251052553a7c5d25
refs/heads/master
2020-05-16T00:13:22.019928
2019-04-25T15:20:17
2019-04-25T15:20:17
182,573,794
0
1
Apache-2.0
2019-04-21T19:25:06
2019-04-21T19:25:05
null
UTF-8
Java
false
false
798
java
package messageModule; import java.util.ArrayList; import com.codingame.game.Player; import com.codingame.gameengine.core.Module; import com.codingame.gameengine.core.MultiplayerGameManager; import com.google.inject.Inject; public class MessageModule implements Module { MultiplayerGameManager<Player> gameManager; public ArrayList<Integer> messageIds = new ArrayList<>(); @Inject public MessageModule(MultiplayerGameManager<Player> gameManager) { this.gameManager = gameManager; gameManager.registerModule(this); } @Override public void onGameInit() { gameManager.setViewGlobalData("message", messageIds.toArray()); } @Override public void onAfterGameTurn() { } @Override public void onAfterOnEnd() { } }
43d52986c395134d722eaea6dc7d266826a04031
6a95484a8989e92db07325c7acd77868cb0ac3bc
/modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201502/cm/CustomerFeedErrorReason.java
a604a4d69779495108ae3d460dd5bfdbd1afe218
[ "Apache-2.0" ]
permissive
popovsh6/googleads-java-lib
776687dd86db0ce785b9d56555fe83571db9570a
d3cabb6fb0621c2920e3725a95622ea934117daf
refs/heads/master
2020-04-05T23:21:57.987610
2015-03-12T19:59:29
2015-03-12T19:59:29
33,672,406
1
0
null
2015-04-09T14:06:00
2015-04-09T14:06:00
null
UTF-8
Java
false
false
2,654
java
package com.google.api.ads.adwords.jaxws.v201502.cm; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for CustomerFeedError.Reason. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="CustomerFeedError.Reason"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;enumeration value="FEED_ALREADY_EXISTS_FOR_PLACEHOLDER_TYPE"/> * &lt;enumeration value="INVALID_ID"/> * &lt;enumeration value="CANNOT_ADD_FOR_DELETED_FEED"/> * &lt;enumeration value="CANNOT_ADD_ALREADY_EXISTING_CUSTOMER_FEED"/> * &lt;enumeration value="CANNOT_MODIFY_REMOVED_CUSTOMER_FEED"/> * &lt;enumeration value="INVALID_PLACEHOLDER_TYPES"/> * &lt;enumeration value="MISSING_FEEDMAPPING_FOR_PLACEHOLDER_TYPE"/> * &lt;enumeration value="PLACEHOLDER_TYPE_NOT_ALLOWED_ON_CUSTOMER_FEED"/> * &lt;enumeration value="UNKNOWN"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "CustomerFeedError.Reason") @XmlEnum public enum CustomerFeedErrorReason { /** * * An active feed already exists for this customer and place holder type. * * */ FEED_ALREADY_EXISTS_FOR_PLACEHOLDER_TYPE, /** * * The specified id does not exist. * * */ INVALID_ID, /** * * The specified feed is deleted. * * */ CANNOT_ADD_FOR_DELETED_FEED, /** * * The CustomerFeed already exists. SET should be used to modify the existing CustomerFeed. * * */ CANNOT_ADD_ALREADY_EXISTING_CUSTOMER_FEED, /** * * Cannot modify removed customer feed. * * */ CANNOT_MODIFY_REMOVED_CUSTOMER_FEED, /** * * Invalid placeholder types. * * */ INVALID_PLACEHOLDER_TYPES, /** * * Feed mapping for this placeholder type does not exist. * * */ MISSING_FEEDMAPPING_FOR_PLACEHOLDER_TYPE, /** * * Placeholder not allowed at the account level. * * */ PLACEHOLDER_TYPE_NOT_ALLOWED_ON_CUSTOMER_FEED, UNKNOWN; public String value() { return name(); } public static CustomerFeedErrorReason fromValue(String v) { return valueOf(v); } }
f55e8c4b4dce8c8548a0a2a726cb92168661e5b8
da294037101505324873870d4cf4eb0a73de55c0
/app/src/main/java/co/infinum/locationawareapp/LocationTrackDialog.java
ba4feccb4963ac4f79c425cced675c554282ed47
[]
no_license
mariciv/Location-Aware-App
4b09342b5d9d344b7176429eb05acc916a87618e
21952c2d501795ca333630c87457461ec4ee0954
refs/heads/master
2020-06-06T15:19:08.612694
2015-05-07T09:27:37
2015-05-07T09:27:37
35,210,932
0
0
null
null
null
null
UTF-8
Java
false
false
2,462
java
package co.infinum.locationawareapp; import com.google.android.gms.location.LocationListener; import com.google.android.gms.maps.LocationSource; import android.app.Dialog; import android.content.DialogInterface; import android.location.Location; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.Button; import android.widget.TextView; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import butterknife.ButterKnife; import butterknife.InjectView; import butterknife.OnClick; /** * Created by Ivan on 07/05/15. */ public class LocationTrackDialog extends DialogFragment implements LocationListener { @InjectView(R.id.location_updates_text_view) TextView locationUpdatesTextView; @OnClick(R.id.stop_tracking_btn) public void stopTracking() { dismiss(); } @Override public void onDismiss(DialogInterface dialog) { ((MainActivity)getActivity()).stopLocationUpdates(); super.onDismiss(dialog); } @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Dialog dialog = super.onCreateDialog(savedInstanceState); dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE); return dialog; } @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_track_location, container, false); ButterKnife.inject(this, view); return view; } @Override public void onLocationChanged(Location location) { if (location != null) { Date time = Calendar.getInstance().getTime(); SimpleDateFormat df = new SimpleDateFormat("'['HH:mm:sss']'"); String line = df.format(time) + " " + location.getLatitude() + ", " + location.getLongitude(); appendLine(line); } } private void appendLine(String line) { if (locationUpdatesTextView != null) { locationUpdatesTextView.append(line + "\n"); } } @Override public void onDestroyView() { super.onDestroyView(); ButterKnife.reset(this); } }