blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
9663b760a3895d480f94a59dac613b0c57748f53
83cfd825a83c6de41b5d591f42b5418d189000df
/shop/src/org/sibadi/discount/DiscountCard.java
1999f276d277ca9602e1e861ef450fac9bbcc69d
[]
no_license
AZhiva/org.sibadi
a208c273003d7f18a93d644e8402e4662ca353f3
f3a360cb6d3f8eed91a2a663edde90380df0d970
refs/heads/main
2023-08-31T16:47:36.628512
2021-11-03T10:21:14
2021-11-03T10:21:14
424,176,992
0
0
null
null
null
null
UTF-8
Java
false
false
2,082
java
package org.sibadi.discount; import org.sibadi.Receipt; import org.sibadi.product.Product; import java.math.BigDecimal; import java.util.*; public class DiscountCard { private final static List<DiscountCard> discountCards = new ArrayList<DiscountCard>(); private final String identification; private final Date birth; private final Date date; private String proprietor; private String phone; public DiscountCard(String phone, String proprietor, Date birth) { identification = UUID.randomUUID().toString(); date = Calendar.getInstance().getTime(); this.birth = birth; setProprietor(proprietor); setPhone(phone); discountCards.add(this); } protected void finalize() { discountCards.remove(this); } public static List<DiscountCard> getDiscountCards(){ return discountCards; } public BigDecimal getDiscount(Receipt receipt) { BigDecimal totalPrice = new BigDecimal(0); for (Product product : receipt.getProductList()) { if (Discount.getDiscounts().containsKey(product.getClass())) totalPrice = totalPrice.add(product.getPrice().multiply(Discount.getDiscounts().get(product.getClass()))); else totalPrice = totalPrice.add(product.getPrice()); } return totalPrice; } public void setProprietor(String proprietor) { this.proprietor = proprietor; } public void setPhone(String phone) { this.phone = phone; } public String getIdentification() { return identification; } public String getProprietor() { return proprietor; } public String getPhone() { return phone; } public Date getBirth() { return birth; } public Date getDate() { return date; } @Override public String toString(){ return proprietor + " " + birth + " " + phone + " " + date + " " + identification; } }
[ "noreply@github.com" ]
noreply@github.com
a0f793da12ba0e4e7c4204dc9cc0fcfe69b339f9
a44d75d7239e6003ecb58e9db3430655c7e3a0f7
/src/flowtimer/parsing/json/JSON.java
b2aa9563ea2edab38697b2747357876affd446be
[]
no_license
stringflow/FlowTimer-Java
99a89ff7e0620354144bb50fe4d01ee92905f563
88981318874dff7882d43a7fb84b9205011e9c1a
refs/heads/master
2020-03-24T19:16:48.061514
2020-02-26T01:28:55
2020-02-26T01:28:55
142,916,434
7
3
null
null
null
null
UTF-8
Java
false
false
1,692
java
package flowtimer.parsing.json; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.text.ParseException; import flowtimer.ErrorHandler; import flowtimer.parsing.TokenReader; public class JSON { private JSONValue value; public JSON(File file) throws Exception { this(new FileReader(file)); } public JSON(InputStream stream) throws Exception { this(new InputStreamReader(stream)); } public JSON(Reader reader) throws Exception { read(reader); } public JSON(String json) throws Exception { read(new StringReader(json)); } private void read(Reader reader) throws IOException, ParseException { TokenReader tokens; tokens = new TokenReader(reader); value = JSONValue.parse(tokens, tokens.next()); String token; tokens.parseAssert((token = tokens.next()) == null, "Expected EOF; instead got " + token); tokens.close(); } public JSON(JSONValue value) { this.value = value; } public void write(String fileName) { try { BufferedWriter br = new BufferedWriter(new FileWriter(fileName)); value.write(br); br.close(); } catch(IOException e) { ErrorHandler.handleException(e, false); } } public String toString() { try { StringWriter wr = new StringWriter(); value.write(wr); wr.close(); return wr.getBuffer().toString(); } catch(IOException e) { ErrorHandler.handleException(e, false); } return super.toString(); } public JSONValue get() { return value; } }
[ "Simon.oehmke@gmail.com" ]
Simon.oehmke@gmail.com
92e6c44e6785396670d6e2beb4675c87c28c1017
bc1e751a94a0613ec002d347811108fad0ee7d6c
/gateway-center/src/main/java/net/dloud/platform/gateway/pack/DubboInvoker.java
5b4ea38c0e0f8a7647b6ddbb649c32bd3a8cf2d1
[]
no_license
feilaoda/stand
8f009ff93e2e037ce7f7d6ba9ff5a484c2073dfc
ab6b475d6d0b0c2421305cd0bbe795f13df49a8d
refs/heads/master
2020-05-19T12:22:43.903823
2019-04-19T06:56:13
2019-04-19T06:56:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,176
java
package net.dloud.platform.gateway.pack; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import lombok.extern.slf4j.Slf4j; import net.dloud.platform.common.extend.CollectionUtil; import net.dloud.platform.common.extend.StringUtil; import net.dloud.platform.common.gateway.InjectEnum; import net.dloud.platform.common.gateway.bean.ApiResponse; import net.dloud.platform.common.gateway.bean.InvokeKey; import net.dloud.platform.common.gateway.bean.RequestInfo; import net.dloud.platform.common.gateway.bean.TokenKey; import net.dloud.platform.common.gateway.info.InjectionInfo; import net.dloud.platform.common.provider.CurrentLimit; import net.dloud.platform.extend.constant.PlatformConstants; import net.dloud.platform.extend.constant.PlatformExceptionEnum; import net.dloud.platform.extend.exception.PassedException; import net.dloud.platform.extend.exception.RefundException; import net.dloud.platform.extend.wrapper.AssertWrapper; import net.dloud.platform.gateway.bean.InvokeCache; import net.dloud.platform.gateway.bean.InvokeDetailCache; import net.dloud.platform.parse.utils.AddressGet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpCookie; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Component; import org.springframework.util.MultiValueMap; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.stream.IntStream; /** * @author QuDasheng * @create 2019-03-28 15:54 **/ @Slf4j @Component public class DubboInvoker { /** * 默认方法分隔符 */ private final String methodSplit = "|"; @Autowired private CurrentLimit currentLimit; @Autowired private GatewayCache gatewayCache; @Autowired private MethodResultCache methodResultCache; /** * 调用单个方法 */ public Mono<ApiResponse> doApi(RequestInfo request, String token, String inputTenant, String inputGroup, String invokeName, Map<String, Object> inputParam) { return doApi(request, token, inputTenant, inputGroup, Collections.singletonList(invokeName), Collections.singletonList(inputParam), true); } /** * 调用多个方法 */ public Mono<ApiResponse> doApi(RequestInfo request, String token, String inputTenant, String inputGroup, List<String> invokeNames, List<Map<String, Object>> inputParams) { return doApi(request, token, inputTenant, inputGroup, invokeNames, inputParams, false); } /** * 泛化调用方法 */ public Mono<ApiResponse> doApi(RequestInfo request, String token, String inputTenant, String inputGroup, List<String> invokeNames, List<Map<String, Object>> inputParams, boolean fromPath) { final String proof = UUID.randomUUID().toString(); final ApiResponse response = new ApiResponse(true, proof); log.info("[GATEWAY] 来源: {} | 分组: {} | 调用方法: {} | 输入参数: {} | 凭证: {}", inputTenant, inputGroup, invokeNames, inputParams, proof); AssertWrapper.isTrue(null != inputTenant && null != inputGroup, "调用方法输入错误!"); gatewayCache.setRpcContext(inputTenant, inputGroup, proof); int size = invokeNames.size(); InvokeCache paramCache = doCache(inputGroup, inputParams, invokeNames); //校验白名单及用户信息 Map<String, Object> memberInfo = doMember(inputTenant, inputGroup, paramCache, token); //用户或ip维度的限流 if (!currentLimit.tryConsume(request, memberInfo)) { throw new PassedException(PlatformExceptionEnum.API_ACCESS_LIMIT); } final Map<String, Integer> needs = paramCache.getNeedCaches(); final List<InvokeDetailCache> caches = paramCache.getInvokeDetails(); final Mono<List<Object>> outcome = Flux.fromStream(() -> IntStream.range(0, size).mapToObj(i -> { final String invokeName = invokeNames.get(i); final Map<String, Object> inputParam = null == inputParams.get(i) ? Collections.emptyMap() : inputParams.get(i); final InvokeDetailCache invokeDetailCache = caches.get(i); AssertWrapper.notNull(invokeName, "调用方法名不能为空"); AssertWrapper.notNull(invokeDetailCache, "调用方法名未找到"); final Object result; //处理网关缓存 final String needKey = invokeName + methodSplit + inputParam.size(); final Integer cacheTime = needs.getOrDefault(needKey, 0); if (cacheTime > 0) { final Object value = methodResultCache.getValue(needKey, inputParam, inputTenant, inputGroup, token); if (null == value) { result = doResult(request, invokeName, inputParam, memberInfo, invokeDetailCache, proof); methodResultCache.setValue(needKey, inputParam, inputTenant, inputGroup, token, result, cacheTime); } else { result = value; } } else { result = doResult(request, invokeName, inputParam, memberInfo, invokeDetailCache, proof); } return result; })).collectList(); final Mono<ApiResponse> result; if (response.getCode() == PlatformConstants.CORRECT_CODE) { result = outcome.map(list -> { if (fromPath) { if (list.isEmpty()) { response.exception(PlatformExceptionEnum.RESULT_ERROR); } else { response.setPreload(list.get(0)); } } else { response.setPreload(list); } if (!fromPath && response.getCode() != 0) { response.setPreload(Collections.singleton(response.getPreload())); } log.info("[GATEWAY] 来源: {} | 分组: {} | 调用方法: {} | 返回结果: {} | 凭证: {}", inputTenant, inputGroup, invokeNames, response.getPreload(), proof); return response; }); } else { response.setProof(proof); result = Mono.just(response); } return result; } private Map<String, Object> doMember(String inputTenant, String inoutGroup, InvokeCache paramCache, String token) { Map<String, Object> memberInfo = gatewayCache.tokenCache(new TokenKey(token, inputTenant, inoutGroup, paramCache.getInvokeName())); if (!paramCache.isWhitelist()) { if (StringUtil.isBlank(token)) { throw new RefundException(PlatformExceptionEnum.LOGIN_NONE); } if (memberInfo.isEmpty() || memberInfo.containsKey("code")) { throw new RefundException(PlatformExceptionEnum.LOGIN_EXPIRE); } } return memberInfo; } private InvokeCache doCache(String inputGroup, List<Map<String, Object>> inputParams, List<String> invokeNames) { final int size = invokeNames.size(); boolean whitelist = true; int invokeLevel = 0; String invokeMember = null; List<InvokeDetailCache> invokeDetails = Lists.newArrayListWithExpectedSize(size); Map<String, Integer> needCaches = Maps.newHashMapWithExpectedSize(size); for (int i = 0; i < size; i++) { String invokeName = invokeNames.get(i); int paramSize = 0; if (null != inputParams.get(i)) { paramSize = inputParams.get(i).size(); } //获取缓存的数据 final InvokeDetailCache invokeDetail = gatewayCache.invokeCache(new InvokeKey(inputGroup, invokeName, paramSize)); if (whitelist && !invokeDetail.getWhitelist()) { log.info("[GATEWAY] 方法 {} 没有设置白名单", invokeName); whitelist = false; } if (null != invokeDetail.getCacheTime() && invokeDetail.getCacheTime() > 0) { log.info("[GATEWAY] 方法 {}|{} 将使用网关缓存", invokeName, paramSize); needCaches.put(invokeName + methodSplit + paramSize, invokeDetail.getCacheTime()); } final Map<String, InjectionInfo> injects = invokeDetail.getInjects(); if (null != injects) { for (InjectionInfo inject : injects.values()) { final int newLevel = InjectEnum.getLevel(inject.getInjectType()); if (newLevel > invokeLevel) { invokeLevel = newLevel; invokeMember = inject.getInvokeName(); } } } invokeDetails.add(invokeDetail); } return new InvokeCache(whitelist, invokeMember, needCaches, invokeDetails); } private Object doResult(RequestInfo request, String invokeName, Map<String, Object> inputParam, Map<String, Object> memberInfo, InvokeDetailCache cache, String proof) { //分割获取方法名 String methodName = StringUtil.splitLastByDot(invokeName); // 获取注入信息 final Map<String, InjectionInfo> injects = cache.getInjects(); //拼装输入参数 final List<Object> invokeParams = new ArrayList<>(); final String[] invokeCacheNames = cache.getNames(); for (int j = 0; j < invokeCacheNames.length; j++) { String getName = invokeCacheNames[j]; Object getParam = inputParam.get(getName); if (null != injects && injects.keySet().contains(getName)) { getParam = doInject(getParam, injects.get(getName), memberInfo, request); } invokeParams.add(getParam); } log.debug("[GATEWAY] 将调用的方法参数为:, {} = {} | 凭证: {}", methodName, cache, proof); Object result = gatewayCache.referenceConfig(cache.getClassName()).get() .$invoke(methodName, cache.getTypes(), invokeParams.toArray()); if (null == result) { throw new PassedException(PlatformExceptionEnum.RESULT_ERROR); } return result; } @SuppressWarnings("unchecked") private Object doInject(Object getParam, InjectionInfo info, Map<String, Object> member, RequestInfo request) { if (null == info) { return null == getParam ? Collections.emptyMap() : getParam; } if (InjectEnum.getLevel(info.getInjectType()) > 1) { return member; } else { final Object userId = member.get("userId"); if (getParam instanceof Map) { final HttpHeaders headers = request.getHttpHeaders(); final Map<String, Object> mapParam = (Map) getParam; if (null != userId) { mapParam.put("userId", userId); } if (info.getHaveAddress()) { mapParam.put("requestIp", AddressGet.remoteAddress(request)); } final Set<String> cookieNames = info.getCookieNames(); if (null != cookieNames && cookieNames.size() > 0) { final MultiValueMap<String, HttpCookie> getCookies = request.getHttpCookies(); if (CollectionUtil.notEmpty(getCookies)) { final Map<String, String> retCookies = Maps.newHashMapWithExpectedSize(cookieNames.size()); for (String cookieName : cookieNames) { final List<HttpCookie> httpCookies = getCookies.get(cookieName); if (null != httpCookies && !httpCookies.isEmpty()) { retCookies.put(cookieName, httpCookies.get(0).getValue()); } } mapParam.put("requestCookies", retCookies); } } final Set<String> headerNames = info.getHeaderNames(); if (null != headerNames && headerNames.size() > 0) { final Map<String, byte[]> retHeaders = Maps.newHashMapWithExpectedSize(headerNames.size()); for (String headerName : headerNames) { final List<String> httpHeader = headers.get(headerName); if (CollectionUtil.notEmpty(httpHeader)) { retHeaders.put(headerName, httpHeader.get(0).getBytes()); } } mapParam.put("requestHeaders", retHeaders); } return mapParam; } else { return userId; } } } }
[ "dneht#msn" ]
dneht#msn
3e9cb213f6a1642f0d53ac996bdbfe02ff82b776
288cfde56612f9935f84846737d9ee631ddd25b5
/TFS.IRP.V8 Project/Project/src/com/tfs/irp/template/dao/impl/IrpTemplateDAOImpl.java
cbf85526dd26e26dc828db5049fd3a61bb7bad6a
[]
no_license
tfsgaotong/irpv8
b97d42e616a71d8d4f4260b27d2b26dc391d4acc
6d2548544903dcfbcb7dfdb8e95e8f73937691f2
refs/heads/master
2021-05-15T07:25:15.874960
2017-11-22T09:51:27
2017-11-22T09:51:27
111,659,185
0
0
null
null
null
null
UTF-8
Java
false
false
7,435
java
package com.tfs.irp.template.dao.impl; import com.tfs.irp.template.dao.IrpTemplateDAO; import com.tfs.irp.template.entity.IrpTemplate; import com.tfs.irp.template.entity.IrpTemplateExample; import com.tfs.irp.util.PageUtil; import java.sql.SQLException; import java.util.List; import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; public class IrpTemplateDAOImpl extends SqlMapClientDaoSupport implements IrpTemplateDAO { /** * This method was generated by Apache iBATIS ibator. This method corresponds to the database table IRP_TEMPLATE * @ibatorgenerated Wed Jul 02 10:43:37 CST 2014 */ public int countByExample(IrpTemplateExample example) throws SQLException { Integer count = (Integer) getSqlMapClientTemplate().queryForObject( "IRP_TEMPLATE.ibatorgenerated_countByExample", example); return count; } /** * This method was generated by Apache iBATIS ibator. This method corresponds to the database table IRP_TEMPLATE * @ibatorgenerated Wed Jul 02 10:43:37 CST 2014 */ public int deleteByExample(IrpTemplateExample example) throws SQLException { int rows = getSqlMapClientTemplate().delete( "IRP_TEMPLATE.ibatorgenerated_deleteByExample", example); return rows; } /** * This method was generated by Apache iBATIS ibator. This method corresponds to the database table IRP_TEMPLATE * @ibatorgenerated Wed Jul 02 10:43:37 CST 2014 */ public int deleteByPrimaryKey(Long tid) throws SQLException { IrpTemplate key = new IrpTemplate(); key.setTid(tid); int rows = getSqlMapClientTemplate().delete( "IRP_TEMPLATE.ibatorgenerated_deleteByPrimaryKey", key); return rows; } /** * This method was generated by Apache iBATIS ibator. This method corresponds to the database table IRP_TEMPLATE * @ibatorgenerated Wed Jul 02 10:43:37 CST 2014 */ public void insert(IrpTemplate record) throws SQLException { getSqlMapClientTemplate().insert("IRP_TEMPLATE.ibatorgenerated_insert", record); } /** * This method was generated by Apache iBATIS ibator. This method corresponds to the database table IRP_TEMPLATE * @ibatorgenerated Wed Jul 02 10:43:37 CST 2014 */ public void insertSelective(IrpTemplate record) throws SQLException { getSqlMapClientTemplate().insert("IRP_TEMPLATE.ibatorgenerated_insertSelective", record); } /** * This method was generated by Apache iBATIS ibator. This method corresponds to the database table IRP_TEMPLATE * @ibatorgenerated Wed Jul 02 10:43:37 CST 2014 */ @SuppressWarnings("unchecked") public List<IrpTemplate> selectByExampleWithBLOBs(IrpTemplateExample example) throws SQLException { List<IrpTemplate> list = getSqlMapClientTemplate().queryForList( "IRP_TEMPLATE.ibatorgenerated_selectByExampleWithBLOBs", example); return list; } /** * This method was generated by Apache iBATIS ibator. This method corresponds to the database table IRP_TEMPLATE * @ibatorgenerated Wed Jul 02 10:43:37 CST 2014 */ @SuppressWarnings("unchecked") public List<IrpTemplate> selectByExampleWithoutBLOBs( IrpTemplateExample example) throws SQLException { List<IrpTemplate> list = getSqlMapClientTemplate().queryForList( "IRP_TEMPLATE.ibatorgenerated_selectByExample", example); return list; } /** * This method was generated by Apache iBATIS ibator. This method corresponds to the database table IRP_TEMPLATE * @ibatorgenerated Wed Jul 02 10:43:37 CST 2014 */ public IrpTemplate selectByPrimaryKey(Long tid) throws SQLException { IrpTemplate key = new IrpTemplate(); key.setTid(tid); IrpTemplate record = (IrpTemplate) getSqlMapClientTemplate().queryForObject( "IRP_TEMPLATE.ibatorgenerated_selectByPrimaryKey", key); return record; } /** * This method was generated by Apache iBATIS ibator. This method corresponds to the database table IRP_TEMPLATE * @ibatorgenerated Wed Jul 02 10:43:37 CST 2014 */ public int updateByExampleSelective(IrpTemplate record, IrpTemplateExample example) throws SQLException { UpdateByExampleParms parms = new UpdateByExampleParms(record, example); int rows = getSqlMapClientTemplate().update( "IRP_TEMPLATE.ibatorgenerated_updateByExampleSelective", parms); return rows; } /** * This method was generated by Apache iBATIS ibator. This method corresponds to the database table IRP_TEMPLATE * @ibatorgenerated Wed Jul 02 10:43:37 CST 2014 */ public int updateByExampleWithBLOBs(IrpTemplate record, IrpTemplateExample example) throws SQLException { UpdateByExampleParms parms = new UpdateByExampleParms(record, example); int rows = getSqlMapClientTemplate().update( "IRP_TEMPLATE.ibatorgenerated_updateByExampleWithBLOBs", parms); return rows; } /** * This method was generated by Apache iBATIS ibator. This method corresponds to the database table IRP_TEMPLATE * @ibatorgenerated Wed Jul 02 10:43:37 CST 2014 */ public int updateByExampleWithoutBLOBs(IrpTemplate record, IrpTemplateExample example) throws SQLException { UpdateByExampleParms parms = new UpdateByExampleParms(record, example); int rows = getSqlMapClientTemplate().update( "IRP_TEMPLATE.ibatorgenerated_updateByExample", parms); return rows; } /** * This method was generated by Apache iBATIS ibator. This method corresponds to the database table IRP_TEMPLATE * @ibatorgenerated Wed Jul 02 10:43:37 CST 2014 */ public int updateByPrimaryKeySelective(IrpTemplate record) throws SQLException { int rows = getSqlMapClientTemplate().update( "IRP_TEMPLATE.ibatorgenerated_updateByPrimaryKeySelective", record); return rows; } /** * This method was generated by Apache iBATIS ibator. This method corresponds to the database table IRP_TEMPLATE * @ibatorgenerated Wed Jul 02 10:43:37 CST 2014 */ public int updateByPrimaryKeyWithBLOBs(IrpTemplate record) throws SQLException { int rows = getSqlMapClientTemplate().update( "IRP_TEMPLATE.ibatorgenerated_updateByPrimaryKeyWithBLOBs", record); return rows; } /** * This method was generated by Apache iBATIS ibator. This method corresponds to the database table IRP_TEMPLATE * @ibatorgenerated Wed Jul 02 10:43:37 CST 2014 */ public int updateByPrimaryKeyWithoutBLOBs(IrpTemplate record) throws SQLException { int rows = getSqlMapClientTemplate().update( "IRP_TEMPLATE.ibatorgenerated_updateByPrimaryKey", record); return rows; } /** * This class was generated by Apache iBATIS ibator. This class corresponds to the database table IRP_TEMPLATE * @ibatorgenerated Wed Jul 02 10:43:37 CST 2014 */ private static class UpdateByExampleParms extends IrpTemplateExample { private Object record; public UpdateByExampleParms(Object record, IrpTemplateExample example) { super(example); this.record = record; } public Object getRecord() { return record; } } @Override public List<IrpTemplate> selectByExampleWithBLOBs( IrpTemplateExample example, PageUtil _pageUtil) throws SQLException { // TODO Auto-generated method stub List<IrpTemplate> list = getSqlMapClientTemplate().queryForList("IRP_TEMPLATE.ibatorgenerated_selectByExampleWithBLOBs", example,_pageUtil.getPageIndex(),_pageUtil.getPageSize()); return list; } }
[ "gao.tong@ruisiming.com.cn" ]
gao.tong@ruisiming.com.cn
ed6e788b8bcf8490c1ffcb9ae81ab8e709d8d7be
2259a1032e6d8d35fb7e5be0514d042150a80a2b
/src/com/testnetdeve/custom/database/UpdateClientIdRunnable.java
aa095c03e2432ebcdae1aea50eea627aca98171b
[]
no_license
bright60/TestNetDeve
b5ed505e955f605960464a24055e994dc9bdb25b
99c21da2f1edc901030f82f5b4865717a87cfe6c
refs/heads/master
2020-07-13T20:28:20.071233
2019-06-03T07:20:52
2019-06-03T07:20:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
973
java
package com.testnetdeve.custom.database; import com.testnetdeve.custom.server.Observer; import com.testnetdeve.custom.server.Subject; import java.util.HashSet; public class UpdateClientIdRunnable implements Runnable{ private EndListener listener; private int count; @Override public void run() { try { int currentCount = 0; synchronized (UpdateClientIdRunnable.class) { currentCount = count++; System.out.println("线程:" + Thread.currentThread().getName() + "进行第" + currentCount + "次请求"); } Thread.sleep(100); System.out.println("线程:" + Thread.currentThread().getName() + "第" + currentCount + "次请求完成"); } catch (InterruptedException e) { e.printStackTrace(); } listener.end(); } public void setEndListener(EndListener listener) { this.listener = listener; } }
[ "1498821723@qq.com" ]
1498821723@qq.com
9483798575f69debccba7ef42d18f7d81bd074db
c2745516073be0e243c2dff24b4bb4d1d94d18b8
/sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/network/generated/VpnLinkConnectionsGetIkeSasSamples.java
309c665e83f833f42c751c90e21ac2f5786b8764
[ "MIT", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-warranty-disclaimer", "BSD-3-Clause", "CC0-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later" ]
permissive
milismsft/azure-sdk-for-java
84b48d35e3fca8611933b3f86929788e5e8bceed
f4827811c870d09855417271369c592412986861
refs/heads/master
2022-09-25T19:29:44.973618
2022-08-17T14:43:22
2022-08-17T14:43:22
90,779,733
1
0
MIT
2021-12-21T21:11:58
2017-05-09T18:37:49
Java
UTF-8
Java
false
false
1,005
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.network.generated; import com.azure.core.util.Context; /** Samples for VpnLinkConnections GetIkeSas. */ public final class VpnLinkConnectionsGetIkeSasSamples { /* * x-ms-original-file: specification/network/resource-manager/Microsoft.Network/stable/2022-01-01/examples/VpnSiteLinkConnectionGetIkeSas.json */ /** * Sample code: GetVpnLinkConnectionIkeSa. * * @param azure The entry point for accessing resource management APIs in Azure. */ public static void getVpnLinkConnectionIkeSa(com.azure.resourcemanager.AzureResourceManager azure) { azure .networks() .manager() .serviceClient() .getVpnLinkConnections() .getIkeSas("rg1", "gateway1", "vpnConnection1", "Connection-Link1", Context.NONE); } }
[ "noreply@github.com" ]
noreply@github.com
1d55c09361fccd4ea2835c4ed8d6bf9db7f95f66
145ec3aa6b2dceb53aa646f3c614d0c5d85dccfd
/StämmeMaster/src/ch/gbssg/master/view/BillButtonTextAreaPanel.java
0d978d07fc8e30a0abc8e73db486ace4af985770
[]
no_license
livior/St-mme
2d283c5ff706acce7c2e7ddfe19b4af6c3141465
7e44effd21321d1e45dddd9a4187ba49c7a82470
refs/heads/master
2021-01-04T14:18:58.320526
2015-06-25T19:40:28
2015-06-25T19:40:28
38,069,936
0
0
null
null
null
null
UTF-8
Java
false
false
1,619
java
package ch.gbssg.master.view; import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionListener; import javax.swing.*; public class BillButtonTextAreaPanel extends JPanel{ private static final long serialVersionUID = 1L; JScrollPane scrollPane; JTextArea txtAreaDescription; JButton btnSave; JButton btnPrint; JButton btnClose; public BillButtonTextAreaPanel(){ JPanel pnlButtons; JPanel pnlButtonLeft; JPanel pnlButtonRight; pnlButtons = new JPanel(new GridLayout(1,2)); pnlButtonLeft = new JPanel(new FlowLayout(FlowLayout.LEFT,5,5)); pnlButtonRight = new JPanel(new FlowLayout(FlowLayout.RIGHT,5,5)); pnlButtons.add(pnlButtonLeft); pnlButtons.add(pnlButtonRight); setLayout(new BorderLayout()); txtAreaDescription = new JTextArea(); scrollPane = new JScrollPane(txtAreaDescription); btnSave = new JButton("Speichern..."); btnPrint = new JButton("Drucken..."); btnClose = new JButton("Schliessen"); add(new JLabel("Beschreibung:"), BorderLayout.NORTH); pnlButtonLeft.add(btnSave); pnlButtonLeft.add(btnPrint); pnlButtonRight.add(btnClose); add(scrollPane, BorderLayout.CENTER); add(pnlButtons, BorderLayout.SOUTH); } public String getDescription(){ return(txtAreaDescription.getText()); } public void setBtnSaveActionListener(ActionListener a){ this.btnSave.addActionListener(a); } public void setBtnPrintActionListener(ActionListener a){ this.btnPrint.addActionListener(a); } public void setBtnCloseActionListener(ActionListener a){ this.btnClose.addActionListener(a); } }
[ "livio.rinaldi@hotmail.com" ]
livio.rinaldi@hotmail.com
ae7a70ca4a931060d426b76210eaa1799381400b
c7b15fe5c8d5d4e64c0e093406ae5aa7d6485491
/src/main/java/com/github/lithualien/webcrawler/service/VintedWebCrawlerServiceImpl.java
fd2c30d559caf09487cc5233e66e97c9bae37f29
[]
no_license
lithualien/web-crawler
9c9b3119b54cb27223b2addbfdd4426106a9f796
17347fb1104f431d9fea163d43e73411b0a8f3b8
refs/heads/main
2023-02-15T11:20:25.918856
2021-01-14T08:56:10
2021-01-14T08:56:10
329,559,323
0
0
null
null
null
null
UTF-8
Java
false
false
4,030
java
package com.github.lithualien.webcrawler.service; import com.github.lithualien.webcrawler.Main; import com.github.lithualien.webcrawler.converter.vinted.VintedConvertAdvertToLinks; import com.github.lithualien.webcrawler.converter.vinted.VintedStringSetToAdvertisementSet; import com.github.lithualien.webcrawler.crawler.VintedCrawler; import com.github.lithualien.webcrawler.io.IORepository; import com.github.lithualien.webcrawler.io.IORepositoryImpl; import com.github.lithualien.webcrawler.models.Advertisement; import lombok.extern.slf4j.Slf4j; import org.json.JSONArray; import org.json.JSONObject; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import java.util.HashSet; import java.util.Iterator; import java.util.Set; @Slf4j public class VintedWebCrawlerServiceImpl implements WebCrawlerService { private final IORepository ioRepository; private final VintedCrawler vintedCrawler = new VintedCrawler(); public VintedWebCrawlerServiceImpl(IORepository ioRepository) { this.ioRepository = ioRepository; } @Override public void checkIfNew(Set<String> urls) { Set<Advertisement> advertisements = VintedStringSetToAdvertisementSet.convert(urls); String FILE_NAME = "/vinted.csv"; Set<Advertisement> oldAdvertisements = ioRepository.fetchData(FILE_NAME); Set<Advertisement> newAdvertisements = getNewAdvertisements(advertisements, oldAdvertisements); if(!newAdvertisements.isEmpty()) { ioRepository.addData(newAdvertisements, FILE_NAME); setMessageVinted(newAdvertisements); } else { log.info("No new advertisements were found."); } } private void setMessageVinted(Set<Advertisement> advertisements) { String message = VintedConvertAdvertToLinks.htmlMessage(advertisements); Main.setMessageToSend(message); } private Set<Advertisement> getNewAdvertisements(Set<Advertisement> advertisements, Set<Advertisement> oldAdvertisements) { Set<Advertisement> newAdvertisements = new HashSet<>(); if (advertisements != null) { advertisements.forEach(advertisement -> { if(!oldAdvertisements.contains(advertisement)) { newAdvertisements.add(advertisement); } }); } log.info("Added new advertisements to set."); return newAdvertisements; } public Set<String> getDocUrls(Document doc) { Set<String> urls = new HashSet<>(); Elements advertisements = doc.select("a"); for (Element advertisement : advertisements) { String url = advertisement.absUrl("href"); if(vintedCrawler.shouldVisit(url)) { urls.add(url); } } log.info("Added vinted HTML links."); return urls; } public Set<String> getJsonUrls(Document doc) { Set<String> urls = new HashSet<>(); IORepositoryImpl ioRepository = new IORepositoryImpl(); Element scriptElement = doc.select("script").last(); JSONObject jsonObject = new JSONObject(scriptElement.html()); JSONObject items = jsonObject.getJSONObject("items"); JSONObject byId = items.getJSONObject("byId"); // ioRepository.writevintedHtml(doc.html()); for (String key : byId.keySet()) { JSONObject jsonAdvertisement = byId.getJSONObject(key); String url = jsonAdvertisement.optString("url"); // ioRepository.writeVintedJson(jsonAdvertisement.toString()); if( (jsonAdvertisement.has("url")) && (vintedCrawler.shouldVisit(url)) ) { urls.add(url); } } // Main.addOne(); log.info("Added vinted JSON links."); return urls; } }
[ "tomas.dominauskas@protonmail.com" ]
tomas.dominauskas@protonmail.com
212b9b13ba3fc882b5d4f507b4c5e4ac0d34120e
87383dadc9cab0666a452e100701f07ac5a344e7
/CharCompare.java
6f1909db70ae38d674c9f4c90dd065780d96da8a
[]
no_license
Ranjugowd/first
a069a76222790e548e6f8ec183188d98fdd8dddc
2b2f258b1fa74ecd70f921fb104f0385f09e1ebe
refs/heads/master
2020-03-26T14:07:40.075358
2018-08-16T10:29:25
2018-08-16T10:29:25
144,973,304
0
0
null
null
null
null
UTF-8
Java
false
false
189
java
class CharCompare{ public static void main(String[] args) { System.out.println('0'<'A'); System.out.println('1'>'0'); System.out.println(100>'0'); System.out.println('6'<'Z'); } }
[ "42263288+Ranjugowd@users.noreply.github.com" ]
42263288+Ranjugowd@users.noreply.github.com
cd16a5e40775d15df5519f706766280902859b40
14a39f156cb530727977cfc12e90c311174ee101
/my-tigase-webservice/src/test/java/com/letv/test/tigase/rest/dto/TigMaTags.java
bd88bd79b89108ff34eb4d960b68c4e8bfc5f068
[]
no_license
radtek/myTigaseManager
99757d075cfe9545b466498c3460b5774104611f
a82a0f90ed411308176b80972265c423ea976d25
refs/heads/master
2020-06-15T18:52:36.632590
2015-07-27T03:58:23
2015-07-27T03:58:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
940
java
package com.letv.test.tigase.rest.dto; import com.letv.common.sdk.api.LetvObject; import java.util.Date; /** * TigMaTagsResponse:返回对象<br/> * 提供rest接口时方法的返回对象 * * @author zhengxin * @version 2015-7-27 11:25:02 * */ public class TigMaTags implements LetvObject { /** 序列化标识 */ private static final long serialVersionUID = 1L; /** */ private Long tagId; /** */ private String tag; /** */ private Long ownerId; public Long getTagId(){ return tagId; } public void setTagId(Long tagId) { this.tagId = tagId; } public String getTag(){ return tag; } public void setTag(String tag) { this.tag = tag; } public Long getOwnerId(){ return ownerId; } public void setOwnerId(Long ownerId) { this.ownerId = ownerId; } }
[ "zhengxin@CNBJWK23J4512.letv.local" ]
zhengxin@CNBJWK23J4512.letv.local
d94492f78039444ffbefb230b1cfab240a964d60
d1e24e1195e9fad490c4f5e5b1ac191b7b25b9ec
/src/main/java/honestit/akwilina/promises/config/SecurityConfiguration.java
46070226f9f13a9fb469a524b15ecaf4387aedc0
[]
no_license
BergerMarcin/promises
c4f9de5ac03b05f83c59ba07fbedbcc797c22567
ab3e2a5e7d93d216e89ec0c0abf16df4c63d6c07
refs/heads/master
2020-09-28T22:39:53.683014
2019-12-12T15:05:25
2019-12-12T15:05:25
226,882,537
0
0
null
null
null
null
UTF-8
Java
false
false
6,152
java
package honestit.akwilina.promises.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; 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.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.crypto.factory.PasswordEncoderFactories; import org.springframework.security.crypto.password.PasswordEncoder; import javax.sql.DataSource; @Configuration public class SecurityConfiguration extends WebSecurityConfigurerAdapter { // DataSource z konfiguracji application.properties. DataSource możemy sobie wstrzykiwać private final DataSource dataSource; public SecurityConfiguration(DataSource dataSource) { this.dataSource = dataSource; } // ziarno dla hasłowania - metoda passwordEncoder @Bean public PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.jdbcAuthentication() .dataSource(dataSource) // z bazy danych MySQL (klasa z application.properties) .passwordEncoder(passwordEncoder()) // konfiguracja hasła -> wystawiamy Beana powyżej i mamy passwordEncoder .usersByUsernameQuery("SELECT username, password, active FROM users WHERE username = ?") // pobierz nazwę, hasło, rolę/active poprzez nazwę użytkownika .authoritiesByUsernameQuery("SELECT u.username, r.name FROM users u JOIN users_roles ur ON u.id = ur.user_id JOIN roles r ON ur.roles_id = r.id WHERE u.username = ?"); } @Override public void configure(WebSecurity web) throws Exception { // Security nie sprawdza żadnego elementu z katalogu media (gdzie trzymane są zdjęcia) web.ignoring() .antMatchers("/media/**"); } @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() // opcje ścieżek: .antMatchers("/user", "user/*", "user/**"); - tylko ścieżka user, // tylko user i pierwsza podścieżka, user i wszystkie zagłębione podścieżki // .antMatchers("/").permitAll() - zezwala wszystkim // .antMatchers("/login").anonymous() - zezwala niezweryfikowanym // .antMatchers("/logout").authenticated() - zezwala zweryfikowanym // .antMatchers("/user", "/user/**").hasRole("USER") - zezwala zweryfikowanym/zalogowanym użytkownikom // hasRole dodaje "ROLE_" do "USER" // .antMatchers("/admin", "/admin/**").hasRole("ADMIN") - zezwala zweryfikowanym/zalogowanym administratorom, // hasRole dodaje "ROLE_" do "ADMIN" // .anyRequest().authenticated() - zezwala dla wszystkich nie zdefiniowanych powyżej ścieżek zalogowanych .antMatchers("/").permitAll() .antMatchers("/registration").permitAll() .antMatchers("/login").anonymous() .antMatchers("/logout").authenticated() .antMatchers("/user", "/user/**").hasRole("USER") .antMatchers("/admin", "/admin/**").hasRole("ADMIN") .anyRequest().authenticated() .and() // Login page settings. // .defaultSuccessUrl("/") - przejście do danej strony po zalogowaniu .formLogin() .loginPage("/login") // Security obsługuje działanie logowania na ścieżce "/login" (w tym wypadku // LoginController.java + login.jsp; LoginController.java przekierowuje // przez Get na login.jsp) .loginProcessingUrl("/login") // wysłanie/zwrócenie wypełnionego formularza (z login.jsp) .usernameParameter("username") // Security sam odbiera POST i sprawdza zgodność username i password // z formularza - JUŻ NIE POTRZEBA obsługi post w LoginController.java .passwordParameter("password") // j.w. .defaultSuccessUrl("/") // jeżeli logowanie się powiodło Security przekierowuje na ścieżkę // "/" (de facto index.jsp) .and() // Finishing after logout .logout() .logoutUrl("/logout") // Security sam obsługuje działanie wylogowania przez POST na ścieżce // "/logout" (w tym wypadku ten POST przychodzi bezpośrednio z viewera // tj. z header.jsp. // Dzięki temu nie potrzeba ani kontrolera ani viewera dla logout .logoutSuccessUrl("/") // jeżeli logowanie się powiodło Security przekierowuje na ścieżkę // "/" (de facto index.jsp) .and() .csrf(); // generuje identyfikacyjny numer do kożdego pola formularza (w // formularzu *.jsp dodajemy <set:csrfInput/> w obrębie adnotacji <form> // Ponad powyższe globalne zabezpieczenia (typu ".antMatchers("/").permitAll()") można też indywidualnie/osobno // zabezpieczać metody dodając nad nimi adnotację @Security i parametryzując tą adnotację } }
[ "marcin.berger@wp.pl" ]
marcin.berger@wp.pl
65a01adaba55e00f70d0df4cf791df5864b3e10d
2eedbb7773b365d2656e1c2d970452d3e98dc3c3
/src/main/java/com/levy/web/UserController.java
601f7d0a5134ef22884c9a71075f88a78bc6c431
[]
no_license
ez2Code/dynamicDSdemo
acbbf6fadc49f4793b3d4fa3a0498b9bd3d60546
b74aab547bb0e69c2f198d023d428cb365774d94
refs/heads/master
2020-12-02T18:16:34.291270
2017-07-07T06:40:10
2017-07-07T06:40:10
96,507,160
1
1
null
null
null
null
UTF-8
Java
false
false
579
java
package com.levy.web; import com.levy.dao.UserDao; import com.levy.entity.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController public class UserController { private final UserDao userDao; @Autowired public UserController(UserDao userDao) { this.userDao = userDao; } @RequestMapping("/getUsers") public List<User> getUsers() { return userDao.getAllSite(); } }
[ "li_weia@ctrip.com" ]
li_weia@ctrip.com
fae73fbcae8664eb60a39ce5246087feb748b127
aa9a769b611f60aa5159a15226a11f743dc8b397
/college/src/main/java/com/vesna1010/college/repositories/DepartmentRepository.java
ce6710c513fdf5204b37f11672c64e2ed5c1ab8b
[]
no_license
vesna1010/spring_boot_java2
e890d6fb3faeb815a5c23523b3c88a89f671495c
77c3703640d15f1dce136c95aa50c116a4e3f004
refs/heads/master
2023-08-18T01:56:15.513564
2023-08-12T16:32:31
2023-08-12T16:32:31
179,874,061
0
0
null
null
null
null
UTF-8
Java
false
false
247
java
package com.vesna1010.college.repositories; import org.springframework.data.jpa.repository.JpaRepository; import com.vesna1010.college.models.Department; public interface DepartmentRepository extends JpaRepository<Department, Long> { }
[ "Vesna@Vesna-PC" ]
Vesna@Vesna-PC
2d291a933be58e08d0b1e36a966c8cd705839592
cfa45995dfeed7eea8abf34c054e3ca45a45fa3f
/faceye-shop-entity/src/main/java/com/faceye/component/order/entity/Item.java
574689cb7b9cff9f37f91adc103231b7386a732b
[]
no_license
haipenge/faceye-shop
56cd6011d12ae3da5a06ec46350b43edb9130527
fa96ea74efbf6739ab2ee826b3bf3d97edb196e0
refs/heads/master
2021-09-10T09:14:08.159964
2018-03-23T10:23:57
2018-03-23T10:23:57
109,273,846
0
0
null
null
null
null
UTF-8
Java
false
false
4,961
java
package com.faceye.component.order.entity; import java.io.Serializable; import java.util.Date; import java.util.List; import org.springframework.data.annotation.Transient; import org.springframework.data.mongodb.core.mapping.DBRef; import com.faceye.component.setting.entity.Shop; import com.faceye.component.product.entity.Product; import com.faceye.component.product.entity.ProductSku; import javax.persistence.Id; import org.springframework.data.mongodb.core.mapping.Document; /** * 模块:订单->order->Item<br> * 说明:<br> * 实体:订单条目->com.faceye.component.order.entity.Item Mongo 对像<br> * mongo数据集:order_item<br> * @author haipenge <br> * 联系:haipenge@gmail.com<br> * 创建日期:2015-6-13 11:31:36<br> *spring-data-mongo支持的注释类型<br> *@Id - 文档的唯一标识,在mongodb中为ObjectId,它是唯一的,通过时间戳+机器标识+进程ID+自增计数器(确保同一秒内产生的Id不会冲突)构成。<br> *@Document - 把一个java类声明为mongodb的文档,可以通过collection参数指定这个类对应的文档。<br> *@DBRef - 声明类似于关系数据库的关联关系。ps:暂不支持级联的保存功能,当你在本实例中修改了DERef对象里面的值时,单独保存本实例并不能保存DERef引用的对象,它要另外保存<br> *@Indexed - 声明该字段需要索引,建索引可以大大的提高查询效率。<br> *@CompoundIndex - 复合索引的声明,建复合索引可以有效地提高多字段的查询效率。<br> *@GeoSpatialIndexed - 声明该字段为地理信息的索引。<br> *@Transient - 映射忽略的字段,该字段不会保存到<br> *@PersistenceConstructor - 声明构造函数,作用是把从数据库取出的数据实例化为对象。该构造函数传入的值为从DBObject中取出的数据。<br> *@CompoundIndexes({ * @CompoundIndex(name = "age_idx", def = "{'lastName': 1, 'age': -1}") *}) *@Indexed(unique = true) */ @Document(collection="order_item") public class Item implements Serializable { private static final long serialVersionUID = 8926119711730830203L; @Id private Long id=null; public Long getId() { return id; } public void setId(Long id) { this.id = id; } /** * 说明:店铺<br> * 属性名: shop<br> * 类型: com.faceye.component.setting.entity.Shop<br> * 数据库字段:shop<br> * @author haipenge<br> */ @DBRef private Shop shop; public Shop getShop() { return shop; } public void setShop(Shop shop) { this.shop = shop; } /** * 说明:产品<br> * 属性名: product<br> * 类型: com.faceye.component.product.entity.Product<br> * 数据库字段:product<br> * @author haipenge<br> */ @DBRef private Product product; public Product getProduct() { return product; } public void setProduct(Product product) { this.product = product; } /** * 说明:产品SKU<br> * 属性名: productSku<br> * 类型: com.faceye.component.product.entity.ProductSku<br> * 数据库字段:productSku<br> * @author haipenge<br> */ @DBRef private ProductSku productSku; public ProductSku getProductSku() { return productSku; } public void setProductSku(ProductSku productSku) { this.productSku = productSku; } /** * 说明:价格<br> * 属性名: price<br> * 类型: java.lang.Float<br> * 数据库字段:<br> * @author haipenge<br> * 价格->分 */ private Integer price=0; public Integer getPrice() { return price; } public void setPrice(Integer price) { this.price = price; } @Transient private Float priceYuan = 0F; public Float getPriceYuan() { priceYuan=new Float(this.getPrice())/100; return priceYuan; } public void setPriceYuan(Float priceYuan) { this.priceYuan = priceYuan; this.setPrice(new Float(priceYuan * 100).intValue()); } /** * 说明:数量<br> * 属性名: quantity<br> * 类型: java.lang.Integer<br> * 数据库字段:<br> * @author haipenge<br> */ private Integer quantity=0; public Integer getQuantity() { return quantity; } public void setQuantity(Integer quantity) { this.quantity = quantity; } /** * 说明:订单<br> * 属性名: order<br> * 类型: com.faceye.component.order.entity.Order<br> * 数据库字段:order<br> * @author haipenge<br> */ @DBRef private Order order; public Order getOrder() { return order; } public void setOrder(Order order) { this.order = order; } /** * 说明:创建日期<br> * 属性名: createDate<br> * 类型: Date<br> * 数据库字段:createDate<br> * @author haipenge<br> */ private Date createDate=new Date(); public Date getCreateDate() { return createDate; } public void setCreateDate(Date createDate) { this.createDate = createDate; } }/**@generate-entity-source@**/
[ "haipenge@gmail.com" ]
haipenge@gmail.com
ea6721dd2afef059b65c04400170adeb4194ef7c
afff53cc26dc3126f5cbb08365c30edc5add1ee4
/src/main/java/xinQing/springsecurity/configuration/WebSecurityConfig.java
4069cd81793f8883d8c249cfe6a68154b6a2d25f
[]
no_license
xuanbo/spring-security-example
353f1cef838120d29a3a106e9a9f10c70ad7bb13
fec91d18e3bab5ee1a00eb8558fceac6cc278ea7
refs/heads/master
2020-01-23T21:56:21.074576
2016-11-28T10:41:08
2016-11-28T10:41:08
74,727,689
1
0
null
null
null
null
UTF-8
Java
false
false
6,900
java
package xinQing.springsecurity.configuration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; 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.core.userdetails.UserDetailsService; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.authentication.AuthenticationFailureHandler; import org.springframework.security.web.authentication.rememberme.JdbcTokenRepositoryImpl; import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository; import xinQing.springsecurity.security.LimitLoginAuthenticationProvider; import xinQing.springsecurity.security.LoginAuthenticationFilter; import xinQing.springsecurity.security.MyAuthenticationFailureHandler; import xinQing.springsecurity.security.MyUserDetailsServiceImpl; import javax.sql.DataSource; /** * Spring Security配置 * * Created by xuan on 16-11-23. */ @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private DataSource dataSource; @Override protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .authorizeRequests() .antMatchers("/", "/welcome").permitAll()// 首页不需要认证 .antMatchers("/captcha").permitAll()// 验证码不需要认证 .antMatchers("/admin").hasRole("ADMIN")// 需要ROLE_ADMIN角色 .anyRequest().authenticated() .and() .formLogin()// 自定义登录页面 .loginPage("/login") .permitAll() .usernameParameter("username") .passwordParameter("password") .failureHandler(authenticationFailureHandler())// 登录失败处理 .defaultSuccessUrl("/welcome")// 登录成功处理 .and() .logout()// 注销,如果不禁用csrf,那么需要post请求才能注销;可以自己在Controller中处理/logout,注销session .logoutUrl("/logout") .permitAll() .invalidateHttpSession(true) .clearAuthentication(true) .and() .rememberMe() .tokenRepository(persistentTokenRepository()) .tokenValiditySeconds(60 * 60 * 24 * 7) .and() .addFilter(loginAuthenticationFilter());// 登录过滤,校验验证码 } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { // // 使用内存记住用户名和密码 // auth.inMemoryAuthentication() // .withUser("admin").password("admin").roles("USER", "ADMIN") // .and() // .withUser("user").password("user").roles("USER") // .and() // .passwordEncoder(new Md5PasswordEncoder()); // 自定义AuthenticationProvider auth .authenticationProvider(authenticationProvider()); } /** * 全局安全方法必须配置authenticationManagerBean * * @return AuthenticationManagerDelegator * @throws Exception 异常信息 */ @Bean @Override public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } /** * 自定义UserDetailsService * 主要是根据username获取UserDetails信息 * 跟Shiro的Realm类似 * * @return MyUserDetailsServiceImpl */ @Bean public UserDetailsService userDetailsService() { return new MyUserDetailsServiceImpl(); } /** * 自定义身份认证Provider * 默认是DaoAuthenticationProvider * 实现AuthenticationProvider,自定义自己的身份认证Provider * * @return LimitLoginAuthenticationProvider 对登录失败尝试限制 */ @Bean public AuthenticationProvider authenticationProvider() { LimitLoginAuthenticationProvider authenticationProvider = new LimitLoginAuthenticationProvider(); authenticationProvider.setUserDetailsService(userDetailsService()); authenticationProvider.setPasswordEncoder(passwordEncoder()); return authenticationProvider; } /** * 自定义认证失败处理 * 实现了AuthenticationFailureHandler,根据身份认证Provider抛出的身份认证异常做不同的处理 * * @return MyAuthenticationFailureHandler 返回身份认证失败信息,请求转发到/login */ @Bean public AuthenticationFailureHandler authenticationFailureHandler() { return new MyAuthenticationFailureHandler(null); } /** * 持久化Token * * @return JdbcTokenRepositoryImpl */ @Bean public PersistentTokenRepository persistentTokenRepository() { JdbcTokenRepositoryImpl jdbcTokenRepository = new JdbcTokenRepositoryImpl(); jdbcTokenRepository.setDataSource(dataSource); return jdbcTokenRepository; } /** * 加密 * * @return BCryptPasswordEncoder */ @Bean public PasswordEncoder passwordEncoder(){ return new BCryptPasswordEncoder(9); } /** * 登录过滤,认证验证码是否正确 * 然后调用super.attemptAuthentication(request, response) * 必须设置AuthenticationManager * * @return LoginAuthenticationFilter */ @Bean public LoginAuthenticationFilter loginAuthenticationFilter() throws Exception { LoginAuthenticationFilter loginAuthenticationFilter = new LoginAuthenticationFilter(); loginAuthenticationFilter.setAuthenticationManager(authenticationManager()); // 设置自定义AuthenticationFailureHandler,默认会401状态码 loginAuthenticationFilter.setAuthenticationFailureHandler(authenticationFailureHandler()); return loginAuthenticationFilter; } }
[ "1345545983@qq.com" ]
1345545983@qq.com
506088afd7aa3bc41a04dcc1f56269e33e863d16
833c5bc7dc93de9a7394244aaf772fdc92baf15a
/core/src/main/java/org/zeroref/borg/UnicastMessageBus.java
22832528d7da8679321eef687f68f1f0042ab513
[]
no_license
i95n/borg
2f39832301c44b95d330b6bcade24e45f77e3c62
33ab1ff5b214897e05e3111c4cfb840a61032b70
refs/heads/master
2021-09-16T12:51:40.867458
2018-05-18T17:51:41
2018-05-18T17:51:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,927
java
package org.zeroref.borg; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.zeroref.borg.directions.MessageDestinations; import org.zeroref.borg.runtime.EndpointId; import org.zeroref.borg.transport.KafkaMessageSender; import java.util.Arrays; import java.util.List; public class UnicastMessageBus implements MessageBus { private KafkaMessageSender transport; private MessageEnvelope envelope; private EndpointId endpointId; private MessageBuilder builder; private MessageDestinations router; private static final Logger LOGGER = LoggerFactory.getLogger(UnicastMessageBus.class); public UnicastMessageBus(KafkaMessageSender transport, MessageEnvelope envelope, EndpointId endpointId, MessageDestinations router) { this.transport = transport; this.envelope = envelope; this.endpointId = endpointId; this.builder = new MessageBuilder(endpointId.getInputTopicName()); this.router = router; } @Override public void publish(Object message) { List<String> dest = Arrays.asList(endpointId.getEventsTopicName()); MessageEnvelope envelope = builder.buildMessage(message); transport.send(dest, envelope); LOGGER.info("Published {}", message.getClass().getSimpleName()); } @Override public void send(Object message) { List<String> dest = router.destinations(message.getClass()); MessageEnvelope envelope = builder.buildMessage(message); transport.send(dest, envelope); LOGGER.info("Sent {} ", message.getClass().getSimpleName()); } @Override public void reply(Object message) { List<String> dest = Arrays.asList(envelope.getReturnAddress()); MessageEnvelope envelope = builder.buildMessage(message); transport.send(dest, envelope); LOGGER.info("Replied with {}", message.getClass().getSimpleName()); } }
[ "masquerade2ruslan@gmail.com" ]
masquerade2ruslan@gmail.com
980cc2e68a3a6ad674952e106016db20c0bb1763
2650a12195147758e68019cdef8e8b097e663091
/service/parkinglot-service/src/main/java/com/bht/saigonparking/service/parkinglot/repository/custom/ParkingLotEmployeeRepositoryCustom.java
82c9f11b89e7e6ec4b9d37f440be3d09dd4b43b0
[ "Apache-2.0" ]
permissive
huynhthanhbinh/saigonparking
7e9ac17bd246af9970b3dbb26dcac890e1136bfe
0ae6da03120a92e411ecb6bef2a983ab31b0b716
refs/heads/master
2022-12-24T15:13:12.471734
2020-09-20T05:56:36
2020-09-20T05:56:36
240,213,924
1
0
null
null
null
null
UTF-8
Java
false
false
281
java
package com.bht.saigonparking.service.parkinglot.repository.custom; import javax.validation.constraints.NotNull; /** * * @author bht */ public interface ParkingLotEmployeeRepositoryCustom { Long getParkingLotIdByParkingLotEmployeeId(@NotNull Long parkingLotEmployeeId); }
[ "1653006@student.hcmus.edu.vn" ]
1653006@student.hcmus.edu.vn
4d5870acd2f86d2e1ba16b0e0a000d8fa8103ca3
fd07ba0e1aa0542d3035a7d0a25d30d276bb5315
/src/main/java/dev/ruben/peliculasrecomendadas/dao/UtilCargaPeliculas.java
7d66e31bdd3007a04982ca0e32b52bef524db0a1
[]
no_license
rubdev/peliculas-recomendadas-spring-core
939cc05ae48f13063e3489e0fa63081bb2c823d3
3b6346a1cfa349d48f8ee0e283cbbd60977e2c0e
refs/heads/master
2022-12-16T15:59:44.744279
2020-09-05T10:27:47
2020-09-05T10:27:47
293,052,732
0
0
null
null
null
null
UTF-8
Java
false
false
1,469
java
package dev.ruben.peliculasrecomendadas.dao; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; import org.springframework.util.ResourceUtils; import dev.ruben.peliculasrecomendadas.model.Pelicula; /** * <h1>Clase UtilCargaPeliculas</h1> * <p> * Clase de utilidad, que incluye un método estático para la lectura y * procesamiento del fichero CSV que incluye todos los datos. * </p> * * @author rsegr * */ public class UtilCargaPeliculas { /** * <p>Lectura y procesamiento de fichero CSV con los datos de las películas</p> * @param path * @param separator * @param listSeparator * @return List<Pelicula> */ public static List<Pelicula> leerArchivo(final String path, final String separator, final String listSeparator) { List<Pelicula> result = new ArrayList<>(); try { // @formatter:off result = Files.lines(Paths.get(ResourceUtils.getFile(path).toURI())).skip(1).map(line -> { String[] values = line.split(separator); return new Pelicula(Long.parseLong(values[0]), values[1], values[2], Arrays.asList(values[3].split(listSeparator))); }).collect(Collectors.toList()); // @formatter:on } catch (Exception e) { System.err.println("Error de lectura del fichero de datos: imdb_data"); System.exit(-1); } return result; } }
[ "noreply@github.com" ]
noreply@github.com
1b9690e009748e658d7b2f43b506908b9c39791c
201a1b7c1ca75ad45b10e37adc2fe72c3d2874fc
/src/programming/interviews/exposed/junit/weakreferences/WeakReferencesTest.java
c3b8d069386f9ab019c1261106f1db53ebb2efe0
[]
no_license
edwardz10/crackingthecodeinterview
f1e07526cc46af116b550e981c4e44bdab6e6d41
b1ad9174d74774b4e2fdeea060d411064ee2b7e5
refs/heads/master
2021-01-15T10:42:31.060639
2017-12-29T14:49:05
2017-12-29T14:49:05
99,596,328
0
0
null
null
null
null
UTF-8
Java
false
false
863
java
package programming.interviews.exposed.junit.weakreferences; import static org.junit.Assert.*; import java.util.Date; import org.junit.Test; public class WeakReferencesTest { @Test public void weakReferenceStackManipulation() { final WeakReferenceStack<ValueContainer> stack = new WeakReferenceStack<>(); final ValueContainer vcExpected = new ValueContainer("Value for the stack"); stack.push(new ValueContainer("Value for the stack")); ValueContainer peekedValue = stack.peek(); assertEquals(peekedValue, vcExpected); assertEquals(stack.peek(), vcExpected); peekedValue = null; System.gc(); assertNull(stack.peek()); } @Test public void addShutdownHook() { Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { System.err.println("Shutting down JVM at time: " + new Date()); } }); } }
[ "edzi1113@netcracker.com" ]
edzi1113@netcracker.com
08af5bd34bb9216f8e9a359129113c6df975a6eb
d1a0cf78df813913c9aaa8256026200fb0ea06bf
/app/src/main/java/vmc/in/mrecorder/gcm/PushNotificationService.java
852f5aabcd8811f224e1c8cdfa9d08fc70630412
[]
no_license
mukesh525/BMT
18e7991231c230665b75e3f6c73a8596eb355da1
67b44392fa6f3048394da19e63f727d0d564a8cd
refs/heads/master
2020-05-07T22:36:30.574461
2019-04-12T07:11:18
2019-04-12T07:11:18
180,951,605
0
0
null
null
null
null
UTF-8
Java
false
false
8,479
java
package vmc.in.mrecorder.gcm; import android.annotation.TargetApi; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.TaskStackBuilder; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.NotificationCompat; import android.support.v4.content.ContextCompat; import android.util.Log; import com.google.android.gms.gcm.GcmListenerService; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import vmc.in.mrecorder.R; import vmc.in.mrecorder.activity.Login; import vmc.in.mrecorder.callbacks.TAG; import vmc.in.mrecorder.myapplication.CallApplication; import vmc.in.mrecorder.util.Utils; /** * Created by gousebabjan on 17/3/16. */ public class PushNotificationService extends GcmListenerService implements vmc.in.mrecorder.callbacks.TAG { private NotificationManager mNotificationManager; // public static int NOTIFICATION_ID = 1; private String TAG = "GCMPRO"; private String url; private String message = "n/a"; private String enable = "n/a"; private boolean recording, monitor, both; @Override public void onMessageReceived(String from, Bundle data) { super.onMessageReceived(from, data); //by admin to enable disable if (data.containsKey("enable")) { enable = data.getString("enable"); recording = true; monitor = false; both = false; SharedPreferences sharedPrefs = PreferenceManager .getDefaultSharedPreferences(getApplicationContext()); SharedPreferences.Editor ed = sharedPrefs.edit(); if (recording) { CallApplication.getInstance().startRecording(); ed.putBoolean("prefRecording", true); ed.putBoolean("prefCallUpdate", false); ed.commit(); } else if (monitor) { CallApplication.getInstance().startRecording(); ed.putBoolean("prefRecording", false); ed.putBoolean("prefCallUpdate", true); ed.commit(); } else if (both) { ed.putBoolean("prefRecording", false); ed.putBoolean("prefCallUpdate", false); CallApplication.getInstance().stopRecording(); } } if (data.containsKey("message")) { message = data.getString("message"); Log.d(TAG, message); // sendStickyNotification(message); // if (message != null && message.length() > 5) { // if (Utils.isLogin(getApplicationContext())) { // sendStickyNotification(message); // CallApplication.getWritabledatabase().DeleteAllData(); // CallApplication.getInstance().stopRecording(); // SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); // prefs.edit().clear().commit(); // Log.d("Logout", "Logout on gcm"); // // } // // } } } @TargetApi(Build.VERSION_CODES.JELLY_BEAN) private void sendNotification(String msg) { Intent resultIntent = new Intent(this, Login.class); TaskStackBuilder TSB = TaskStackBuilder.create(this); TSB.addParentStack(Login.class); TSB.addNextIntent(resultIntent); PendingIntent resultPendingIntent = TSB.getPendingIntent( 0, PendingIntent.FLAG_UPDATE_CURRENT ); //Create notification object and set the content. NotificationCompat.Builder nb = new NotificationCompat.Builder(this); nb.setSmallIcon(R.drawable.mcube); nb.setContentTitle("Set your title"); nb.setContentText("Set Content text"); nb.setTicker("Set Ticker text"); nb.addAction(R.drawable.mcube, "Share", resultPendingIntent); // nb.setContent(new RemoteViews(new Tex)) nb.setContentText(msg); //get the bitmap to show in notification bar // Bitmap bitmap_image = BitmapFactory.decodeResource(this.getResources(), R.drawable.drawerr); // Bitmap bitmap_image = getBitmapFromURL("http://images.landscapingnetwork.com/pictures/images/500x500Max/front-yard-landscaping_15/front-yard-hillside-banyon-tree-design-studio_1018.jpg"); Bitmap bitmap_image = getBitmapFromURL(url); NotificationCompat.BigPictureStyle s = new NotificationCompat.BigPictureStyle().bigPicture(bitmap_image); s.setSummaryText("Summary text appears on expanding the notification"); nb.setStyle(s); // Intent resultIntent = new Intent(this, MainActivity.class); // TaskStackBuilder TSB = TaskStackBuilder.create(this);/home/gousebabjan/Desktop/mcube.png // TSB.addParentStack(MainActivity.class); // Adds the Intent that starts the Activity to the top of the stack nb.setContentIntent(resultPendingIntent); nb.setAutoCancel(true); NotificationManager mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); // mId allows you to update the notification later on. mNotificationManager.notify(11221, nb.build()); } private void sendNotification1(String message) { Intent intent = new Intent(this, Login.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.mcube) .setContentTitle("GCM Message") .setContentText(message) .setAutoCancel(true) .setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); } private void sendStickyNotification(String message) { Bitmap bm = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.BigTextStyle s = new NotificationCompat.BigTextStyle(); s.setBigContentTitle("MTracker"); // s.bigText("You have been logout by Admin."); s.bigText(message); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.mipmap.ic_launcher) .setColor(ContextCompat.getColor(getApplicationContext(), R.color.accent)) .setContentTitle("MTracker") .setAutoCancel(false) .setOngoing(true) .setSound(defaultSoundUri) .setLargeIcon(bm) .setStyle(s) .setContentText(message) .setContentIntent(PendingIntent.getActivity(this, 0, new Intent(this, Login.class), 0)); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(NOTIFICATION_ID, mBuilder.build()); } public Bitmap getBitmapFromURL(String strURL) { try { URL url = new URL(strURL); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.connect(); InputStream input = connection.getInputStream(); Bitmap myBitmap = BitmapFactory.decodeStream(input); return myBitmap; } catch (IOException e) { e.printStackTrace(); return null; } } }
[ "mukeshjha2007@gmail.com" ]
mukeshjha2007@gmail.com
5b879205bf7f20f495c49f2679bb4f2c6af50397
969c988ca7a787af48504abe69f4cf42436fd273
/Entree.java
ec08122e726baf05047df542c96319c1eb6ac6f1
[]
no_license
JGProg/ReseauDeNeurone
dd3f636900754ec8730154e080e94462040b395a
a23e500e00abdf636ecbe1c6c007fd025b3c4773
refs/heads/master
2020-03-26T08:05:03.163702
2013-12-09T10:06:50
2013-12-09T10:06:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
167
java
package pack.epsi; /** * User: jessygiacomoni * Date: 04/11/2013 * Time: 11:48 */ public class Entree { private double _poidsEntree; public Entree() { } }
[ "jessy.giacomoni@me.com" ]
jessy.giacomoni@me.com
a42218057f43fb85b6ac3ba5b3f649d93568db75
f4fd782488b9cf6d99d4375d5718aead62b63c69
/com/planet_ink/coffee_mud/Abilities/Spells/Spell_MassDisintegrate.java
8b5242410604d5b8c460064446e5ee7cbacf06e6
[ "Apache-2.0" ]
permissive
sfunk1x/CoffeeMud
89a8ca1267ecb0c2ca48280e3b3930ee1484c93e
0ac2a21c16dfe3e1637627cb6373d34615afe109
refs/heads/master
2021-01-18T11:20:53.213200
2015-09-17T19:16:30
2015-09-17T19:16:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,077
java
package com.planet_ink.coffee_mud.Abilities.Spells; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.core.collections.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.util.*; /* Copyright 2003-2015 Bo Zimmerman Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ @SuppressWarnings({"unchecked","rawtypes"}) public class Spell_MassDisintegrate extends Spell { @Override public String ID() { return "Spell_MassDisintegrate"; } private final static String localizedName = CMLib.lang().L("Mass Disintegrate"); @Override public String name() { return localizedName; } @Override public int maxRange(){return adjustedMaxInvokerRange(2);} @Override public int abstractQuality(){return Ability.QUALITY_MALICIOUS;} @Override public int classificationCode(){ return Ability.ACODE_SPELL|Ability.DOMAIN_EVOCATION;} @Override public int overrideMana(){return 200;} @Override public boolean invoke(MOB mob, Vector commands, Physical givenTarget, boolean auto, int asLevel) { Set<MOB> h=properTargets(mob,givenTarget,auto); if((h==null)||(h.size()<0)) { if(mob.location().numItems()==0) { mob.tell(L("There doesn't appear to be anyone here worth disintgrating.")); return false; } h=new HashSet(); } if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; int avgLevel=0; for (final Object element : h) { final MOB mob2=(MOB)element; avgLevel+=mob2.phyStats().level(); } if(h.size()>0) avgLevel=avgLevel/h.size(); int levelDiff=avgLevel-(mob.phyStats().level()+(2*getXLEVELLevel(mob))); if(levelDiff<0) levelDiff=0; boolean success=false; success=proficiencyCheck(mob,-(levelDiff*25),auto); if(success) { if(avgLevel <= 0) avgLevel = 1; if(mob.location().show(mob,null,this,somanticCastCode(mob,null,auto),auto?L("Something is happening!"):L("^S<S-NAME> wave(s) <S-HIS-HER> arms and utter(s) a trecherous spell!^?"))) for (final Object element : h) { final MOB target=(MOB)element; if((target.phyStats().level()/avgLevel)<2) { final CMMsg msg=CMClass.getMsg(mob,target,this,somanticCastCode(mob,target,auto),null); if(mob.location().okMessage(mob,msg)) { mob.location().send(mob,msg); if(msg.value()<=0) { if(target.curState().getHitPoints()>0) CMLib.combat().postDamage(mob,target,this,target.curState().getHitPoints()*100,CMMsg.MASK_ALWAYS|CMMsg.TYP_CAST_SPELL,Weapon.TYPE_BURSTING,("^SThe spell <DAMAGE> <T-NAME>!^?")+CMLib.protocol().msp("spelldam2.wav",40)); } } } } mob.location().recoverRoomStats(); final Vector V=new Vector(); for(int i=mob.location().numItems()-1;i>=0;i--) { final Item I=mob.location().getItem(i); if((I!=null)&&(I.container()==null)) { final List<DeadBody> DBs=CMLib.utensils().getDeadBodies(I); boolean ok=true; for(final DeadBody DB : DBs) { if(DB.isPlayerCorpse() &&(!((DeadBody)I).getMobName().equals(mob.Name()))) ok=false; } if(ok) V.addElement(I); } } for(int i=0;i<V.size();i++) { final Item I=(Item)V.elementAt(i); if((!(I instanceof DeadBody)) ||(!((DeadBody)I).isPlayerCorpse()) ||(((DeadBody)I).getMobName().equals(mob.Name()))) { final CMMsg msg=CMClass.getMsg(mob,I,this,somanticCastCode(mob,I,auto),L("@x1 disintegrates!",I.name())); if(mob.location().okMessage(mob,msg)) { mob.location().send(mob,msg); if(msg.value()<=0) I.destroy(); } } } mob.location().recoverRoomStats(); } else maliciousFizzle(mob,null,L("<S-NAME> wave(s) <S-HIS-HER> arms and utter(s) a treacherous but fizzled spell!")); return success; } }
[ "bo@zimmers.net" ]
bo@zimmers.net
de6f13dfb12ad9ff214f5ac139ffc3e3e1e5aa0c
663427daf2d0cbb297cc5f9a7ae0f37a9c91b3cc
/Flute/src/org/black/pipe/PipeSurfaceView.java
0010b0eab081874f9b4da64c80c5e351b22b309a
[]
no_license
BilalAsiff/android-flute
e227d06fc11fc849bb0331d6820d34901ef90dd9
0e2d5e190eb1ba246d1e42a79f288e6fc253b4a4
refs/heads/master
2016-09-01T05:50:43.753390
2012-11-17T04:37:24
2012-11-17T04:37:24
54,264,167
0
0
null
null
null
null
UTF-8
Java
false
false
14,204
java
package org.black.pipe; import android.content.Context; import android.content.SharedPreferences; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Paint.Style; import android.graphics.Path; import android.util.Log; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; /** * To draw hole and compute note value. * * @author black * */ public class PipeSurfaceView extends SurfaceView implements SurfaceHolder.Callback { private SurfaceHolder holder; private Integer screenWidth; private Integer screenHeight; private Float pointRadius; private Circle firstCircle, secondCircle, thirdCircle, bottomSemiCircle; public PipeSurfaceView(Context context) { super(context); this.holder = this.getHolder(); this.holder.addCallback(this); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { this.screenWidth = width; this.screenHeight = height; this.pointRadius = screenWidth / 8f; Log.i(PipeConstant.APP_TAG, "Screen width: " + this.screenWidth); Log.i(PipeConstant.APP_TAG, "Screen height: " + this.screenHeight); this.bottomSemiCircle = new Circle(screenWidth / 2, screenHeight, (screenWidth / 14) - 5); } @Override public void surfaceCreated(SurfaceHolder holder) { } @Override public void surfaceDestroyed(SurfaceHolder holder) { } /** * A public method for audio input to draw. */ public int draw(double audioVelocity) { Canvas canvas = null; int result = 0; try { canvas = holder.lockCanvas(null); if (canvas != null) { Paint paint = new Paint(); paint.setAntiAlias(true); // Clear canvas paint.setColor(Color.BLACK); canvas.drawRect(0, 0, this.screenWidth, this.screenHeight, paint); if (audioVelocity > PipeConstant.DEFAULT_MIN_BLOW_PRESSURE) { paint.setColor(Color.argb(255, 102, 171, 255)); } else { paint.setColor(Color.argb(255, 0, 113, 255)); } Path innerCirclePath = new Path(); Path outerCirclePath = new Path(); innerCirclePath.addCircle(bottomSemiCircle.getX(), bottomSemiCircle.getY(), bottomSemiCircle.getRadius(), Path.Direction.CW); outerCirclePath.addCircle(bottomSemiCircle.getX(), bottomSemiCircle.getY(), bottomSemiCircle.getRadius() + 15, Path.Direction.CW); paint.setStyle(Style.STROKE); paint.setStrokeWidth(5); canvas.drawPath(innerCirclePath, paint); canvas.drawPath(outerCirclePath, paint); paint.setStyle(Style.FILL); SharedPreferences sharedPreferences = this.getContext() .getSharedPreferences(PipeConstant.SHARED_PERFERENCE, Context.MODE_PRIVATE); int holeNumber = sharedPreferences.getInt( PipeConstant.HOLE_NUMBER, PipeConstant.DEFAULT_INSTRUMENT_HOLE_NUMBER); Log.i(PipeConstant.APP_TAG, "hole number: " + holeNumber); if (holeNumber == 2) { boolean touchOnFirstCircle = false; boolean touchOnSecondCircle = false; this.firstCircle = new Circle(screenWidth * 0.75f, screenHeight * 0.25f, pointRadius); this.secondCircle = new Circle(screenWidth * 0.25f, screenHeight * 0.67f, pointRadius); MotionEvent motionEvent = PipeGlobalValue.getMotionEvent(); if (motionEvent != null && motionEvent.getAction() != MotionEvent.ACTION_UP) { int pointCount = motionEvent.getPointerCount(); if (pointCount > 0) { for (int i = 0; i < pointCount; i++) { float pointX = motionEvent.getX(i); float pointY = motionEvent.getY(i); double firstDistance = Math.sqrt(Math.pow( pointX - firstCircle.getX(), 2) + Math.pow(pointY - firstCircle.getY(), 2)); if (firstDistance >= 0 && firstDistance < firstCircle .getRadius()) { touchOnFirstCircle = true; } double secondDistance = Math .sqrt(Math.pow( pointX - secondCircle.getX(), 2) + Math.pow(pointY - secondCircle.getY(), 2)); if (secondDistance >= 0 && secondDistance < secondCircle .getRadius()) { touchOnSecondCircle = true; } } } } // Draw hole drawHole(canvas, paint, firstCircle.getX(), firstCircle.getY(), firstCircle.getRadius(), touchOnFirstCircle); drawHole(canvas, paint, secondCircle.getX(), secondCircle.getY(), secondCircle.getRadius(), touchOnSecondCircle); // Compute note value if (touchOnFirstCircle == true && touchOnSecondCircle == true) { result = PipeConstant.NOTE_VALUES[0]; } else if (touchOnFirstCircle == false && touchOnSecondCircle == true) { result = PipeConstant.NOTE_VALUES[1]; } else if (touchOnFirstCircle == true && touchOnSecondCircle == false) { result = PipeConstant.NOTE_VALUES[2]; } else { result = PipeConstant.NOTE_VALUES[3]; } } else if (holeNumber == 3) { boolean touchOnFirstCircle = false; boolean touchOnSecondCircle = false; boolean touchOnThirdCircle = false; this.firstCircle = new Circle(screenWidth * 0.25f, screenHeight * 0.25f, pointRadius); this.thirdCircle = new Circle(screenWidth * 0.25f, screenHeight * 0.67f, pointRadius); this.secondCircle = new Circle(screenWidth * 0.75f, (firstCircle.getY() + thirdCircle.getY()) / 2, pointRadius); MotionEvent motionEvent = PipeGlobalValue.getMotionEvent(); if (motionEvent != null && motionEvent.getAction() != MotionEvent.ACTION_UP) { int pointCount = motionEvent.getPointerCount(); if (pointCount > 0) { for (int i = 0; i < pointCount; i++) { float pointX = motionEvent.getX(i); float pointY = motionEvent.getY(i); double firstDistance = Math.sqrt(Math.pow( pointX - firstCircle.getX(), 2) + Math.pow(pointY - firstCircle.getY(), 2)); if (firstDistance >= 0 && firstDistance < firstCircle .getRadius()) { touchOnFirstCircle = true; } double secondDistance = Math .sqrt(Math.pow( pointX - secondCircle.getX(), 2) + Math.pow(pointY - secondCircle.getY(), 2)); if (secondDistance >= 0 && secondDistance < secondCircle .getRadius()) { touchOnSecondCircle = true; } double thirdDistance = Math.sqrt(Math.pow( pointX - thirdCircle.getX(), 2) + Math.pow(pointY - thirdCircle.getY(), 2)); if (thirdDistance >= 0 && thirdDistance < thirdCircle .getRadius()) { touchOnThirdCircle = true; } } } } // Draw hole drawHole(canvas, paint, firstCircle.getX(), firstCircle.getY(), firstCircle.getRadius(), touchOnFirstCircle); drawHole(canvas, paint, secondCircle.getX(), secondCircle.getY(), secondCircle.getRadius(), touchOnSecondCircle); drawHole(canvas, paint, thirdCircle.getX(), thirdCircle.getY(), thirdCircle.getRadius(), touchOnThirdCircle); // Compute note value if (touchOnFirstCircle == true && touchOnSecondCircle == true && touchOnThirdCircle == true) { result = PipeConstant.NOTE_VALUES[0]; } else if (touchOnFirstCircle == false && touchOnSecondCircle == true && touchOnThirdCircle == true) { result = PipeConstant.NOTE_VALUES[1]; } else if (touchOnFirstCircle == true && touchOnSecondCircle == false && touchOnThirdCircle == true) { result = PipeConstant.NOTE_VALUES[2]; } else if (touchOnFirstCircle == true && touchOnSecondCircle == true && touchOnThirdCircle == false) { result = PipeConstant.NOTE_VALUES[3]; } else if (touchOnFirstCircle == false && touchOnSecondCircle == false && touchOnThirdCircle == true) { result = PipeConstant.NOTE_VALUES[4]; } else if (touchOnFirstCircle == false && touchOnSecondCircle == true && touchOnThirdCircle == false) { result = PipeConstant.NOTE_VALUES[5]; } else if (touchOnFirstCircle == true && touchOnSecondCircle == false && touchOnThirdCircle == false) { result = PipeConstant.NOTE_VALUES[6]; } else { result = PipeConstant.NOTE_VALUES[7]; } } } } catch (Exception e) { Log.e(PipeConstant.APP_TAG, "Detect touch error.", e); result = 0; } finally { try { holder.unlockCanvasAndPost(canvas); } catch (Exception e) { Log.e(PipeConstant.APP_TAG, "unlockCanvasAsPost fail!", e); } } Log.d(PipeConstant.APP_TAG, "Return note : " + result); return result; } private void drawHole(Canvas canvas, Paint paint, float x, float y, float radius, boolean onTouch) { if (onTouch == true) { paint.setColor(Color.WHITE); canvas.drawCircle(x, y, radius + 10, paint); paint.setColor(Color.argb(255, 102, 171, 255)); canvas.drawCircle(x, y, radius + 5, paint); } else { paint.setColor(Color.argb(255, 0, 113, 255)); canvas.drawCircle(x, y, radius, paint); } } /** * Private class to store circle information. * * @author black * */ private class Circle { private float x; private float y; private float radius; public Circle(float x, float y, float radius) { this.x = x; this.y = y; this.radius = radius; } public float getX() { return x; } public float getY() { return y; } public float getRadius() { return radius; } @Override public String toString() { return "Circle [x=" + x + ", y=" + y + ", radius=" + radius + "]"; } } }
[ "mrblack.tw@gmail.com" ]
mrblack.tw@gmail.com
389d35e48c3d3f719187a29a1044a58baec4e34d
8525bce83a58469ef871372a6d39798f6d27b062
/object-oriented-programming/providing-a-default-method-implementation-in-an-interface/src/main/java/java8recipes/Volume.java
0cce0f870ed0c5a14b8f5a321c7159825519152e
[]
no_license
kdnc/java-reference-application
f344db8e60f0138973ffba4bcdb819ef84ed8f08
f5324afbba597c8b47db70cfb0d89931c955b4f7
refs/heads/master
2020-06-05T05:50:49.463249
2016-01-13T11:41:27
2016-01-13T11:41:27
41,031,695
0
0
null
null
null
null
UTF-8
Java
false
false
1,618
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 java8recipes; /** * * @author Juneau */ public interface Volume { /** * Calculate pool volume given depth values and measurement values. For * a pool with variable depth, the minDepth should be depthValues[0], and * the maxDepth should be passed as depthValues[1]. * * This interface can accept multiple measurement values, but it expects * measurementValues[0] == length, or measurementValues[0] == radius * measurementValues[1] == width * @param depthValues * @param measurementValues * @return */ default double calculateVolume(Double[] depthValues, Double[] measurementValues) { double length, width, radius, minDepth, maxDepth, avgDepth = 0; if(depthValues.length > 1){ minDepth = depthValues[0]; maxDepth = depthValues[1]; avgDepth = (minDepth + maxDepth)/2; } else if (depthValues.length == 1){ avgDepth = depthValues[0]; } if(measurementValues.length > 1){ length = measurementValues[0]; width = measurementValues[1]; radius = 0; } else { length = 0; width = 0; radius = measurementValues[0]; } if (radius == 0){ return length * width * avgDepth; } else { return (radius * radius) * 3.14 * avgDepth; } }; }
[ "nuwanlanka@gmail.com" ]
nuwanlanka@gmail.com
5bffd7fc569ea99507d4cdd48f95b3f5be977989
3f5e494339f09de4483237bd94932a1743970efc
/DocumentEbook/English-Doc/EnglishPracticalDocument.java
d38ec346ccfdd99e3c4763f97f81eb2f66729e2c
[]
no_license
saddamEDocument123/AllDocumentEbook
4e63c3f689670c577d773caba621135b64e19d43
67dad3e0f21443013dd032c0d0d4aa331524cba1
refs/heads/master
2020-03-10T11:43:36.275201
2018-06-21T12:55:16
2018-06-21T12:55:16
129,362,253
0
0
null
null
null
null
UTF-8
Java
false
false
1,712
java
/** */ 1. Simple past tense => When we used * the action start and end in the past * that action happend specific point of time * we can used repeted action in the past like evey year ,week ,houre,month u need change ur verbe that means regular verbe verbe+ed (this is only regular verbe) start like started walk like waked irregular verbs - no rule eat lik ate speak like spock make like made Used them and make sentence go - went They went to the gym every day last week - > here we can not used go , so go became went in past tense forget - forgot i forgot to tell my boss about my schedule Make - made i dont think they made reservation at the restaurant eat - ate we ate junk food almost evey day ** How to report information or share information which u hard to ur friend used reporting verbe like say - said here - hard have - had sleep - slept speak - spoke she said she had a great time at the party yesterday, I slept late, went shopping , and spoke my month 2. Simple Future tense => Whe we used : Going TO or gonna / NOT GOING TO : * plans decided before the conversation - u make desision before conversation going to * or that plans u decided in past telling now for future that time we used going to * going to or not going to used when my decision already made by in past WILL / WONT * decision of moment of speaking * low certanty / probabily i will probabily * lower chance * will and wont used when make my decision in that momento or a very quick , plan are jsuxt made Example : Maybe i'll go hiking tomorrow
[ "sksddmhosan@gmail.com" ]
sksddmhosan@gmail.com
8c2a5f780ae5dbfa889304431b80c8ffbe8e04fb
838576cc2e44f590d4c59f8a4d120f629969eedf
/src/com/sino/soa/td/eip/fi/gl/sb_fi_gl_inquiryouorganizationsrv/msgheader/ObjectFactory.java
813bae60c1e29ed5d6620bfdb5d7522cc8ec5eb8
[]
no_license
fancq/CQEAM
ecbfec8290fc4c213101b88365f7edd4b668fdc8
5dbb23cde5f062d96007f615ddae8fd474cb37d8
refs/heads/master
2021-01-16T20:33:40.983759
2013-09-03T16:00:57
2013-09-03T16:00:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,222
java
package com.sino.soa.td.eip.fi.gl.sb_fi_gl_inquiryouorganizationsrv.msgheader; import javax.xml.bind.annotation.XmlRegistry; /** * This object contains factory methods for each * Java content interface and Java element interface * generated in the com.sino.soa.td.eip.fi.gl.sb_fi_gl_inquiryouorganizationsrv.msgheader package. * <p>An ObjectFactory allows you to programatically * construct new instances of the Java representation * for XML content. The Java representation of XML * content can consist of schema derived interfaces * and classes representing the binding of schema * type definitions, element declarations and model * groups. Factory methods for each of these are * provided in this class. * */ @XmlRegistry public class ObjectFactory { /** * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.sino.soa.td.eip.fi.gl.sb_fi_gl_inquiryouorganizationsrv.msgheader * */ public ObjectFactory() { } /** * Create an instance of {@link MsgHeader } * */ public MsgHeader createMsgHeader() { return new MsgHeader(); } }
[ "lq_xm@163.com" ]
lq_xm@163.com
ac26f013a9af02bdbea96996d7489f2254ee1410
e8688c0f47e962e8489b4a8aa2b00099c0399f4d
/src/ru/vang/songoftheday/util/AlarmHelper.java
f19a7cacbb89d2bb3dd1aa0a5f804f3080c480f9
[]
no_license
bracadabra/SongOfTheDay
f835ea00af21075f784d4ca21f2cb6c3b76fc5a0
d1e53e84f12bae7832721fe7c30a63454825e582
refs/heads/master
2021-05-27T04:05:13.195905
2014-03-12T03:56:13
2014-03-12T03:56:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,919
java
package ru.vang.songoftheday.util; import android.app.AlarmManager; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.text.format.DateFormat; import java.util.Calendar; import ru.vang.songoftheday.R; import ru.vang.songoftheday.SongOfTheDaySettings; import ru.vang.songoftheday.SongOfTheDayWidget; import ru.vang.songoftheday.preference.TimePreference; public final class AlarmHelper { public static final String DATE_PATTERN = "dd-MM-yyyy hh:mm:ss a"; public static final String EXTRA_ALARM_UPDATE = "ru.vang.songoftheday.EXTRA_ALARM_UPDATE"; private static final String TAG = AlarmHelper.class.getSimpleName(); private AlarmHelper() { } public static void setAlarm(final Context context) { final Calendar calendar = Calendar.getInstance(); setUpdateTimeFromPreferences(context, calendar); setAlarm(context, calendar); } public static void setAlarm(final Context context, final int hours, final int minutes) { final Calendar calendar = Calendar.getInstance(); setUpdateTime(calendar, hours, minutes); setAlarm(context, calendar); } public static void setAlarm(final Context context, final Calendar calendar) { if (calendar.getTimeInMillis() < System.currentTimeMillis()) { calendar.add(Calendar.DATE, 1); } final AlarmManager alarmManager = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); final PendingIntent alarmIntent = createAlarmIntent(context); alarmManager .set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), alarmIntent); Logger.debug( TAG, "Alarm is set to: " + DateFormat.format(DATE_PATTERN, calendar.getTimeInMillis()) ); } public static void cancelAlarm(final Context context) { final PendingIntent alarmIntent = createAlarmIntent(context); final AlarmManager alarmManager = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); alarmManager.cancel(alarmIntent); } public static void resetAlarm(final Context context, final int hours, final int minutes) { cancelAlarm(context); setAlarm(context, hours, minutes); } private static void setUpdateTimeFromPreferences(final Context context, final Calendar calendar) { final SharedPreferences preferences = context.getSharedPreferences( SongOfTheDaySettings.SHARED_PREF_NAME, Context.MODE_PRIVATE); final String key = context.getString(R.string.key_time); final String time = preferences.getString(key, SongOfTheDaySettings.DEFAULT_UPDATE_TIME); final int[] timeParts = TimePreference.parseTime(time); setUpdateTime(calendar, timeParts[0], timeParts[1]); } private static void setUpdateTime(final Calendar calendar, final int hours, final int minutes) { calendar.set(Calendar.HOUR_OF_DAY, hours); calendar.set(Calendar.MINUTE, minutes); calendar.set(Calendar.SECOND, 0); } private static PendingIntent createAlarmIntent(final Context context) { final Intent intent = new Intent(context, SongOfTheDayWidget.class); intent.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE); intent.putExtra(EXTRA_ALARM_UPDATE, true); // Add fake id to launch update. onUpdate won't called w/o widget id in // extra intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[]{AppWidgetManager.INVALID_APPWIDGET_ID}); return PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); } }
[ "prehistoric2003@gmail.com" ]
prehistoric2003@gmail.com
8e410a2ca99c928dafb39cc218e3a58b7e766351
2d6b2fcf5a23e5be495104aa21078d8216b8d893
/src/main/java/akka/tutorial/first/java/remote/Remote.java
ba933f1d229c9e24a0824edfd946897417a9d0f5
[]
no_license
rohanmmit/AkkaLibraries
4869a6924b1794662efd6a04322b27402d192a1d
9f2c67ebd66f6b58f888032eaa89307f35f78752
refs/heads/master
2016-08-04T19:23:45.164997
2015-09-09T21:55:57
2015-09-09T21:55:57
42,135,971
0
0
null
null
null
null
UTF-8
Java
false
false
1,300
java
package akka.tutorial.first.java.remote; import akka.actor.*; import akka.tutorial.first.java.gossip.Master; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; import java.io.File; import java.util.Random; /** * Created by rohanm on 4/29/15. */ public class Remote { public static void main (String [] args) { Remote r = new Remote(); } public byte [] createRandomArray(int size) { byte [] values = new byte [size]; Random r = new Random(); r.nextBytes(values); return values; } public Remote() { ClassLoader classLoader = getClass().getClassLoader(); File localFile = new File((classLoader).getResource("remote_application.conf").getFile()); Config localConfig = ConfigFactory.parseFile(localFile); ActorSystem actorSystem = ActorSystem.create("remotesystem", localConfig); final ActorRef localActor = actorSystem.actorFor("akka://local@127.0.0.1:2552/user/worker"); final byte [] values = createRandomArray(1000000); final ActorRef remoteActor = actorSystem.actorOf(new Props(new UntypedActorFactory() { public UntypedActor create() { return new RemoteActor(localActor,values); } }), "worker"); } }
[ "rohanm@31-33-99.wireless.csail.mit.edu" ]
rohanm@31-33-99.wireless.csail.mit.edu
274231035808d3fc5741f4fefdd610b9117f5d91
7603afd32c2698a55cc345b83e16e8eb74fcd28b
/src/Problems/Chapter16_Arrays/d_MultidimensionalArrays/MultidimensionalPrimitiveArrays.java
2869d9822d6b6b192883a3a41780af9213be9bc7
[]
no_license
khyzhun/Thinking-In-Java-4th-Edition
d869484c7db7eb3873d8f0a1189b57d20bcf1991
6be19c5b855f458255ea5a531dd6912db2964963
refs/heads/master
2021-06-26T05:48:30.846311
2017-09-12T21:30:59
2017-09-12T21:30:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
429
java
package Problems.Chapter16_Arrays.d_MultidimensionalArrays; import java.util.Arrays; /** * @author SashaKhyzhun on 4/21/17. Page 608. * Многомернные массивы */ public class MultidimensionalPrimitiveArrays { public static void main(String[] args) { int[][] a = { { 1, 2, 3 }, { 4, 5, 6 } }; System.out.println(Arrays.deepToString(a)); } }
[ "sasha.khyzhun@gmail.com" ]
sasha.khyzhun@gmail.com
c5f19ba8626f7dc72fdf34889a59a180687bfeec
e05000d95bb2411569090cfad99b06c5ffa38f3f
/src/main/java/ie/ul/hbs2/GUI/CommandJButton.java
a92d2a064a366ed18956b078f0020fecbe85aa0b
[]
no_license
MrSwayne/Hotel-Booking-System-V2
eb9c4261c626ef6c6f025ffc3d551cccf4c6b8f6
68c6bf5f0f766d6716408921c037b5aa54509a17
refs/heads/master
2021-07-10T21:02:05.211751
2019-11-24T22:08:59
2019-11-24T22:08:59
210,862,337
1
3
null
2020-10-13T17:36:54
2019-09-25T14:14:08
Java
UTF-8
Java
false
false
437
java
package ie.ul.hbs2.GUI; import ie.ul.hbs2.common.Command; import javax.swing.*; public class CommandJButton extends JButton implements Command { private Command command; public CommandJButton(Command command){ super(); this.command=command; } public void setCommand(Command command){ this.command = command; } @Override public void execute() { command.execute(); } }
[ "paddy760@gmail.com" ]
paddy760@gmail.com
18682fe29ef7d5b453a27c1c1e8b5fd1cbef7f4c
dd472e12384c4070c5a7086924fe9f44f54ecadd
/StepCounter/src/stepcounter/app/Main.java
aa6a74c472656c33e1f2512ad3c82b074132b7ef
[]
no_license
TinizaraRodriguez/StepCounter
4707fbf7684870edc71548194498098622cbb049
00f92c49750fe9cba7f42c22f9ef50aa0efd4f6a
refs/heads/main
2023-02-16T06:09:01.687066
2021-01-18T20:29:16
2021-01-18T20:29:16
330,779,317
0
0
null
null
null
null
UTF-8
Java
false
false
62
java
package stepcounter.app; public class Main { }
[ "noreply@github.com" ]
noreply@github.com
c53a8bbadfa23c1a3797f581673fe17c419df78c
b633dde7db70e076f40fddea1a7d985c199dba4f
/red5_base/src/main/java/org/red5/server/net/rtmp/RTMPOriginConnection.java
a4c888f4e6cafeed0b86862ae520aa638e7c5fd9
[]
no_license
Igicom/red5-mavenized
a9eeb592ec8ffa685855646d8107b2b41cd6f80d
2c9bdcdcb0fcad9128bd70660a9af65d00b4afb3
refs/heads/master
2021-01-15T20:43:08.758873
2012-01-11T18:03:34
2012-01-11T18:03:34
3,155,998
0
0
null
null
null
null
UTF-8
Java
false
false
3,996
java
package org.red5.server.net.rtmp; /* * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2009 by respective authors (see below). All rights reserved. * * 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 */ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.mina.common.ByteBuffer; import org.red5.server.api.scheduling.ISchedulingService; import org.red5.server.net.mrtmp.IMRTMPConnection; import org.red5.server.net.mrtmp.IMRTMPOriginManager; import org.red5.server.net.mrtmp.OriginMRTMPHandler; import org.red5.server.net.rtmp.codec.RTMP; import org.red5.server.net.rtmp.message.Packet; /** * A pseudo-connection on Origin that represents a client * on Edge. * * The connection is created behind a MRTMP connection so * no handshake job or keep-alive job is necessary. No raw byte * data write is needed either. * * @author Steven Gong (steven.gong@gmail.com) * @version $Id$ */ public class RTMPOriginConnection extends RTMPConnection { private static final Logger log = LoggerFactory.getLogger(RTMPOriginConnection.class); private int ioSessionId; private IMRTMPOriginManager mrtmpManager; private OriginMRTMPHandler handler; private RTMP state; public RTMPOriginConnection(String type, int clientId) { this(type, clientId, 0); } public RTMPOriginConnection(String type, int clientId, int ioSessionId) { super(type); setId(clientId); this.ioSessionId = ioSessionId; state = new RTMP(RTMP.MODE_SERVER); state.setState(RTMP.STATE_CONNECTED); } public int getIoSessionId() { return ioSessionId; } public void setMrtmpManager(IMRTMPOriginManager mrtmpManager) { this.mrtmpManager = mrtmpManager; } public void setHandler(OriginMRTMPHandler handler) { this.handler = handler; } public RTMP getState() { return state; } @Override protected void onInactive() { // Edge already tracks the activity // no need to do again here. } @Override public void rawWrite(ByteBuffer out) { // won't write any raw data on the wire // XXX should we throw exception here // to indicate an abnormal state ? log.warn("Erhhh... Raw write. Shouldn't be in here!"); } @Override public void write(Packet packet) { IMRTMPConnection conn = mrtmpManager.lookupMRTMPConnection(this); if (conn == null) { // the connect is gone log.debug("Client " + getId() + " is gone!"); return; } if (!type.equals(PERSISTENT)) { mrtmpManager.associate(this, conn); } log.debug("Origin writing packet to client " + getId() + ":" + packet.getMessage()); conn.write(getId(), packet); } @Override public void startRoundTripMeasurement() { // Edge already tracks the RTT // no need to track RTT here. } @Override protected void startWaitForHandshake(ISchedulingService service) { // no handshake in MRTMP, simply ignore } @Override synchronized public void close() { if (state.getState() == RTMP.STATE_DISCONNECTED) { return; } IMRTMPConnection conn = mrtmpManager.lookupMRTMPConnection(this); if (conn != null) { conn.disconnect(getId()); } handler.closeConnection(this); } synchronized public void realClose() { if (state.getState() != RTMP.STATE_DISCONNECTED) { state.setState(RTMP.STATE_DISCONNECTED); super.close(); } } }
[ "michael.guymon@gmail.com" ]
michael.guymon@gmail.com
e24c1dc988aaecd9f3ac507f18c97085e935212a
5424e34eb04cb7bffd1e7305bfe2a989914383d0
/src/main/java/ch/post/pf/gradus/Controller/SubjectController.java
6a0c432acc163585e05fbf4bb32c3430cf43b868
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
mirioeggmann/gradus
444f15cddfd4dbc13fd6056119e9fa9da2582f27
5cf046d15b86f7baf9e3bc945f11d01dae60c4ec
refs/heads/develop
2021-05-01T16:26:49.497073
2017-01-17T23:34:15
2017-01-17T23:34:15
67,482,190
4
1
null
2017-02-08T19:10:25
2016-09-06T07:00:16
CSS
UTF-8
Java
false
false
3,217
java
package ch.post.pf.gradus.Controller; import ch.post.pf.gradus.Models.Subject; import ch.post.pf.gradus.Models.User; import ch.post.pf.gradus.Repositorys.SubjectRepo; import ch.post.pf.gradus.Repositorys.UserRepo; import ch.post.pf.gradus.Response.Response; import ch.post.pf.gradus.ViewModel.SubjectView; import ch.post.pf.gradus.ViewModel.User.UserView; import org.dozer.DozerBeanMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import java.util.Collections; import java.util.List; import java.util.Objects; @RestController @CrossOrigin public class SubjectController { @Autowired private DozerBeanMapper mapper; @Autowired private SubjectRepo subjectRepo; @Autowired private UserRepo userRepo; @RequestMapping(value = "webresources/subject/create", method = RequestMethod.POST) public ResponseEntity<?> createSubject(@RequestBody SubjectView subjectView) { Response createResponse = new Response(); List<Subject> subjects = subjectRepo.findAll(); Boolean isUsed = subjects.stream().anyMatch(subject -> Objects.equals(subject.getName(), subjectView.getName())); createResponse.checkIfTrue(isUsed, "name already used"); createResponse.checkIfNull(subjectView.getName(), "name not set"); if(!createResponse.getState()) { Subject subject = mapper.map(subjectView, Subject.class); subjectRepo.save(subject); createResponse.setMessage("subject created"); } return new ResponseEntity<Response>(createResponse, HttpStatus.OK); } @RequestMapping(value = "webresources/subject/delete", method = RequestMethod.POST) public ResponseEntity<?> deleteSubject(@RequestBody Subject subject) { Response deleteResponse = new Response(); if(!deleteResponse.getState()) { subjectRepo.delete(subject); deleteResponse.setMessage("subject deleted"); } return new ResponseEntity<Response>(deleteResponse, HttpStatus.OK); } @RequestMapping(value = "/webresources/subject/{userID}", method = RequestMethod.GET) public ResponseEntity<?> all(@PathVariable Long userID) { User creator = userRepo.findOne(userID); List<Subject> subjects = subjectRepo.findAllByCreator(creator); if (subjects.size() > 0) { return new ResponseEntity<List<Subject>>(subjects, HttpStatus.OK); } else { return new ResponseEntity<List<Subject>>(Collections.emptyList(), HttpStatus.OK); } } @RequestMapping(value = "webresources/subject/one/{id}", method = RequestMethod.GET) public ResponseEntity<?> one(@PathVariable String id) { if(id!="" && id.matches("\\d*")) { Long longId = Long.valueOf(id); Subject subject = subjectRepo.findOne(longId); if(subject!=null) { return new ResponseEntity<Subject>(subject, HttpStatus.OK); } } return new ResponseEntity<>(null, HttpStatus.NOT_FOUND); } }
[ "bierimanu@gmail.com" ]
bierimanu@gmail.com
758ed60356608e8b97a617925abf153ca1ae00ae
e69054394f5e7e0c3f1a8089d633e862d14a68e6
/src/main/java/com/jnape/palatable/shoki/Sequence.java
ff2796985fe98fe590e973051c9faff3aeaff253
[ "MIT" ]
permissive
nomicflux/shoki
cd7c81a3722cc60ec20921dd59f6077f2a4f1487
40f7c065baa720689e8b3a91e2934a08e175398f
refs/heads/master
2020-05-18T21:18:38.293553
2018-06-24T19:30:24
2018-06-24T19:30:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,852
java
package com.jnape.palatable.shoki; import com.jnape.palatable.lambda.adt.Maybe; import java.util.Iterator; import java.util.NoSuchElementException; import static com.jnape.palatable.lambda.functions.builtin.fn1.Constantly.constantly; /** * A recursive, homogeneous data structure supporting singly-linked iteration. * * @param <A> the element type * @see ImmutableStack * @see ImmutableQueue */ public interface Sequence<A> extends Iterable<A> { /** * If this {@link Sequence} is not empty, return the next element wrapped in {@link Maybe#just}, according to the * supported iteration strategy. Otherwise, return {@link Maybe#nothing()}; * * @return {@link Maybe} the next element */ Maybe<A> head(); /** * Return the elements of this {@link Sequence} without the head, if there is one. * * @return the tail {@link Sequence} */ Sequence<A> tail(); /** * Returns <code>true</code> if calling {@link Sequence#head()} on this {@link Sequence} would return {@link * Maybe#nothing()}; <code>false</code>, otherwise. * <p> * This default implementation relies on {@link Sequence#head()}, but subtypes of {@link Sequence} may be able to * answer this question more directly. Note that if a subtype overrides this method, the contract with {@link * Sequence#head()} must be preserved. * * @return true if this {@link Sequence} is empty; false, otherwise */ default boolean isEmpty() { return head().fmap(constantly(false)).orElse(true); } /** * Return an {@link Iterator} over all of the elements contained in this {@link Sequence}; that is, return an * {@link Iterator} that iterates all values of this {@link Sequence} for which {@link Sequence#head()} does not * return {@link Maybe#nothing()}. * <p> * As with {@link Sequence#isEmpty()}, subtypes of {@link Sequence} can very likely provide faster implementations * of this method, but should always honor the contract with {@link Sequence#head()}/{@link Sequence#isEmpty()}. * * @return an {@link Iterator} over the elements in this {@link Sequence} */ @Override default Iterator<A> iterator() { class NaiveIterator implements Iterator<A> { private Sequence<A> sequence; private NaiveIterator(Sequence<A> sequence) { this.sequence = sequence; } @Override public boolean hasNext() { return !sequence.isEmpty(); } @Override public A next() { A next = sequence.head().orElseThrow(NoSuchElementException::new); sequence = sequence.tail(); return next; } } return new NaiveIterator(this); } }
[ "jnape09@gmail.com" ]
jnape09@gmail.com
6e36c36d7d02d66269bee5a7b76886e3f73125e4
349c5f0e996b878882b59cec7d645fc93f25d156
/src/main/java/com/braffa/structural/adapter/journaldev/Socket.java
8f1bfd87fd7c89f7a69b6234e4beef7de4a9467a
[]
no_license
Braffa/DesignPatterns
2b523a5970704d2e7db3d17af02536142cd29e91
5fe675d2594331f986f838096039fea500b12024
refs/heads/master
2021-01-13T13:20:10.990900
2015-11-30T15:12:01
2015-11-30T15:12:01
47,107,617
0
0
null
null
null
null
UTF-8
Java
false
false
129
java
package com.braffa.structural.adapter.journaldev; public class Socket { public Volt getVolt() { return new Volt(120); } }
[ "David.Brayfield@boxinnovationgroup.local" ]
David.Brayfield@boxinnovationgroup.local
bc850ba495e6f90ea258eb6c656cfd8580b5bff2
fabcdfc804bcdf4b040750e7d9a0bc694a48721d
/src/test/java/selenium/utils/annotations/browser/Browsers.java
b14b0d19eb2a33cf088298b314a363ba494100c9
[]
no_license
Agata05/sample-project-outlook
3948325c7e402c315ce293c81e7eacc7d01fa3f2
4c40dfb91496d8a81bdbe79ecf51969ab984707b
refs/heads/master
2021-07-02T07:19:38.792315
2020-02-10T23:15:02
2020-02-10T23:49:06
239,624,917
1
0
null
2021-06-07T18:41:04
2020-02-10T22:16:08
Java
UTF-8
Java
false
false
519
java
package selenium.utils.annotations.browser; public enum Browsers { FIREFOX("firefox"), FIREFOX_HEADLESS("firefox-headless"), CHROME("chrome"), CHROME_HEADLESS("chrome-headless"), OPERA("opera"), EDGE("MicrosoftEdge"), INTERNET_EXPLORER("internet-explorer"); private String value; Browsers(final String value) { this.value = value; } public String getValue() { return this.value; } public enum options { SKIPPED, REQUIRED } }
[ "anonymous@email.com" ]
anonymous@email.com
14d8cba29420da278f111e7e608a99c613eb9951
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/eclipsejdt_cluster/21152/tar_1.java
c45d50f8d7037dca590a6bae22dbb52756d76061
[]
no_license
martinezmatias/GenPat-data-C3
63cfe27efee2946831139747e6c20cf952f1d6f6
b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4
refs/heads/master
2022-04-25T17:59:03.905613
2020-04-15T14:41:34
2020-04-15T14:41:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
45,129
java
/******************************************************************************* * Copyright (c) 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.jdt.core.tests.model; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import junit.framework.Test; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IMethod; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.search.IJavaSearchConstants; import org.eclipse.jdt.core.search.IJavaSearchScope; import org.eclipse.jdt.core.search.SearchEngine; import org.eclipse.jdt.core.search.SearchMatch; import org.eclipse.jdt.core.search.SearchPattern; // The size of JavaSearchBugsTests.java is very big, Hence continuing here. public class JavaSearchBugsTests2 extends AbstractJavaSearchTests { public JavaSearchBugsTests2(String name) { super(name); this.endChar = ""; } static { //TESTS_NAMES = new String[] {"testBug378390"}; } public static Test suite() { return buildModelTestSuite(JavaSearchBugsTests2.class); } class TestCollector extends JavaSearchResultCollector { public List matches = new ArrayList(); public void acceptSearchMatch(SearchMatch searchMatch) throws CoreException { super.acceptSearchMatch(searchMatch); this.matches.add(searchMatch); } } protected void setUp() throws Exception { super.setUp(); this.resultCollector = new TestCollector(); this.resultCollector.showAccuracy(true); } /** * Test that missing types in the class shouldn't impact the search of a type in an inner class */ public void testBug362633() throws CoreException, IOException { try { IJavaProject p = createJavaProject("P", new String[] {}, new String[] { "/P/lib325418.jar", "JCL15_LIB" }, "", "1.5"); org.eclipse.jdt.core.tests.util.Util.createJar(new String[] { "p325418M/Missing.java", "package p325418M;\n" + "public class Missing{}\n" }, p.getProject().getLocation().append("lib325418M.jar").toOSString(), "1.5"); org.eclipse.jdt.core.tests.util.Util.createJar( new String[] { "p325418/Test.java", "package p325418;\n" + "public class Test{\n" + " public void foo(p325418M.Missing a) {}\n" + " public <T> T foo(int a) {\n" + " return new Inner<T>() {T run() { return null; }}.run();\n" + " }\n" + "}\n", "p325418/Inner.java", "package p325418;\n" + "abstract class Inner <T> {\n" + " abstract T run();\n" + "}\n" }, null, p.getProject().getLocation().append("lib325418.jar").toOSString(), new String[] { p.getProject().getLocation().append("lib325418M.jar").toOSString() }, "1.5"); refresh(p); int mask = IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.SOURCES; IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { p }, mask); search("Inner.run()", IJavaSearchConstants.METHOD, IJavaSearchConstants.DECLARATIONS, scope, this.resultCollector); assertSearchResults( "Unexpected search results!", "lib325418.jar T p325418.Inner.run() [No source] EXACT_MATCH\n" + "lib325418.jar T p325418.<anonymous>.run() [No source] EXACT_MATCH", this.resultCollector); } finally { deleteProject("P"); } } /** * @bug 123836: [1.5][search] for references to overriding method with bound type variable is not polymorphic * @test Search for references to an overridden method with bound variables should yield. * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=123836" */ public void testBug123836a() throws CoreException { IJavaProject project = null; try { project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Sub.java", "abstract class Sup<C> {\n" + " protected void m(C classifier) {}\n"+ " public void use(C owner) { m (owner); }\n" + "}\n" + "public class Sub extends Sup<String>{\n" + " @Override\n"+ " protected void m(String classifier) {}\n"+ "}\n"); IType type = getCompilationUnit("/P/Sub.java").getType("Sub"); IMethod method = type.getMethod("m", new String[]{"QString;"}); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Sub.java void Sup.use(C) [m (owner)] EXACT_MATCH"); } finally { deleteProject(project); } } // Search for a non-overriden method with same name as which could have been overriden should // not have results public void testBug123836b() throws CoreException { IJavaProject project = null; try { project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Sub.java", "abstract class Sup<C> {\n" + " protected void m(C classifier) {}\n"+ " public void use(C owner) { m (owner); }\n" + "}\n" + "public class Sub extends Sup<String>{\n" + " @Override\n"+ " protected void m(String classifier) {}\n"+ " protected void m(Sub classifier) {}\n"+ "}\n" ); // search IType type = getCompilationUnit("/P/Sub.java").getType("Sub"); IMethod method = type.getMethod("m", new String[]{"QSub;"}); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults(""); } finally { deleteProject(project); } } // another variant of the testcase public void testBug123836c() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Test.java", "class Test {\n"+ " void calc(Property prop, Property<? extends Serializable> p2) {\n"+ " prop.compute(null);\n"+ " p2.compute(null);\n"+ " }\n"+ "}\n"+ "abstract class Property<E> {\n"+ " public abstract void compute(E e);\n"+ "}\n"+ "class StringProperty extends Property<String> {\n"+ " @Override public void compute(String e) {\n"+ " System.out.println(e);\n"+ " }"); IType type = getCompilationUnit("/P/Test.java").getType("StringProperty"); IMethod method = type.getMethod("compute", new String[]{"QString;"}); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH\n" + "Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH"); } finally { deleteProject(project); } } // Test inner class public void testBug123836d() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Test.java", "class Test {\n"+ " void calc(Property prop, Property<? extends Serializable> p2) {\n"+ " prop.compute(null);\n"+ " p2.compute(null);\n"+ " }\n"+ " class StringProperty extends Property<String> {\n"+ " @Override public void compute(String e) {\n"+ " System.out.println(e);\n"+ " }\n"+ "}\n"+ "abstract class Property<E> {\n"+ " public abstract void compute(E e);\n"+ "}"); IType type = getCompilationUnit("/P/Test.java").getType("Test").getType("StringProperty"); IMethod method = type.getMethod("compute", new String[]{"QString;"}); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH\n" + "Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH"); } finally { deleteProject(project); } } // Test local class public void testBug123836e() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Test.java", "class Test {\n"+ " void calc(Property prop, Property<? extends Serializable> p2) {\n"+ " prop.compute(null);\n"+ " p2.compute(null);\n"+ " class StringProperty extends Property<String> {\n"+ " @Override public void compute(String e) {\n"+ " System.out.println(e);\n"+ " }\n"+ " }\n"+ " }\n"+ "}\n"+ "abstract class Property<E> {\n"+ " public abstract void compute(E e);\n"+ "}"); IMethod method = selectMethod(getCompilationUnit("/P/Test.java"), "compute", 3); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH\n" + "Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH"); } finally { deleteProject(project); } } // test inner class public void testBug123836f() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Test.java", "class Test {\n"+ " void calc(Property prop, Property<? extends Serializable> p2) {\n"+ " prop.compute(null);\n"+ " p2.compute(null);\n"+ " new Property<String>() {\n"+ " @Override public void compute(String e) {\n"+ " System.out.println(e);\n"+ " }\n"+ " };\n"+ " }\n"+ "}\n"+ "abstract class Property<E> {\n"+ " public abstract void compute(E e);\n"+ "}"); IMethod method = selectMethod(getCompilationUnit("/P/Test.java"), "compute", 3); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH\n" + "Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH"); } finally { deleteProject(project); } } // test in initializer block public void testBug123836g() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Test.java", "class Test {\n"+ " {\n" + " new Property<String>() {\n" + " @Override public void compute(String e) {}\n" + " };\n"+ " }\n"+ " void calc(Property prop, Property<? extends Serializable> p2) {\n"+ " prop.compute(null);\n"+ " p2.compute(null);\n"+ " }\n"+ "}\n"+ "abstract class Property<E> {\n"+ " public abstract void compute(E e);\n"+ "}"); IMethod method = selectMethod(getCompilationUnit("/P/Test.java"), "compute", 1); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH\n" + "Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH"); } finally { deleteProject(project); } } // test in static initializer public void testBug123836h() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Test.java", "class Test {\n"+ " static {\n" + " new Property<String>() {\n" + " @Override public void compute(String e) {}\n" + " };\n"+ " }\n"+ " void calc(Property prop, Property<? extends Serializable> p2) {\n"+ " prop.compute(null);\n"+ " p2.compute(null);\n"+ " }\n"+ "}\n"+ "abstract class Property<E> {\n"+ " public abstract void compute(E e);\n"+ "}"); IMethod method = selectMethod(getCompilationUnit("/P/Test.java"), "compute", 1); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH\n" + "Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH"); } finally { deleteProject(project); } } // test in static initializer public void testBug123836i() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Test.java", "class Test {\n"+ " Property <?>p = new Property<String>() {\n" + " @Override public void compute(String e) {}\n" + " };\n"+ " void calc(Property prop, Property<? extends Serializable> p2) {\n"+ " prop.compute(null);\n"+ " p2.compute(null);\n"+ " }\n"+ "}\n"+ "abstract class Property<E> {\n"+ " public abstract void compute(E e);\n"+ "}"); IMethod method = selectMethod(getCompilationUnit("/P/Test.java"), "compute", 1); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH\n" + "Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH"); } finally { deleteProject(project); } } public void testBug123836j() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Test.java", "class Test {\n"+ " void calc(Property prop, Property<? extends Serializable> p2) {\n"+ " prop.compute(null);\n"+ " p2.compute(null);\n"+ " }\n"+ "}\n"+ "abstract class Property<E> {\n"+ " public abstract void compute(E e);\n"+ "}\n"+ "class StringProperty extends Property<String> {\n"+ " @Override public void compute(String e) {\n"+ " new Property<String>() {\n"+ " @Override public void compute(String e) {\n"+ " new Property<String>() {\n"+ " @Override public void compute(String e) {}\n"+ " };\n"+ " }\n"+ " };\n"+ " }\n"+ "}"); IMethod method = selectMethod(getCompilationUnit("/P/Test.java"), "compute", 6); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH\n" + "Test.java void Test.calc(Property, Property<? extends Serializable>) [compute(null)] EXACT_MATCH"); } finally { deleteProject(project); } } // test search of name public void _testBug123836g1() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Sub.java", "abstract class Sup<C> {\n" + " protected void m(C classifier) {}\n"+ " public void use(C owner) { m (owner); }\n" + "}\n" + "public class Sub extends Sup<String>{\n" + " @Override\n"+ " protected void m(String classifier) {}\n"+ " protected void m(Sub classifier) {}\n"+ "}\n" ); waitUntilIndexesReady(); // search SearchPattern pattern = SearchPattern.createPattern("Sub.m(String)", METHOD, REFERENCES, EXACT_RULE); search(pattern, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Sub.java void Sup.use(C) [m (owner)] EXACT_MATCH"); } finally { deleteProject(project); } } // test search of name (negative) public void _testBug123836h1() throws CoreException { IJavaProject project = null; try { // create the common project and create an interface project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "","1.5"); createFile("/P/Sub.java", "abstract class Sup<C> {\n" + " protected void m(C classifier) {}\n"+ " public void use(C owner) { m (owner); }\n" + "}\n" + "public class Sub extends Sup<String>{\n" + " @Override\n"+ " protected void m(String classifier) {}\n"+ " protected void m(Sub classifier) {}\n"+ "}\n" ); // search SearchPattern pattern = SearchPattern.createPattern("Sub.m(Sub)", METHOD, REFERENCES, EXACT_RULE); search(pattern, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults(""); } finally { deleteProject(project); } } /** * @bug 342393: Anonymous class' occurrence count is incorrect when two methods in a class have the same name. * @test Search for Enumerators with anonymous types * * @throws CoreException * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=342393" */ public void testBug342393() throws CoreException { try { IJavaProject project = createJavaProject("P", new String[] {""}, new String[] {"JCL15_LIB"}, "bin", "1.5"); String content = "package b342393;\n" + "class Generic {\n" + "enum A {\n" + "ONE {\n" + "A getSquare() {\n" + "return ONE;\n" + "}\n" + "},\n" + "TWO {\n" + "A getSquare() {\n" + "return TWO;\n" + "}\n" + "};\n" + "abstract A getSquare();\n" + "}\n" + "}"; createFolder("/P/b342393"); createFile("/P/b342393/Generic.java", content); IJavaSearchScope scope = SearchEngine. createJavaSearchScope( new IJavaElement[] { project }, IJavaSearchScope.SOURCES); search("getSquare", METHOD, DECLARATIONS, EXACT_RULE, scope, this.resultCollector); assertSearchResults("b342393/Generic.java A b342393.Generic$A.ONE:<anonymous>#1.getSquare() [getSquare] EXACT_MATCH\n" + "b342393/Generic.java A b342393.Generic$A.TWO:<anonymous>#1.getSquare() [getSquare] EXACT_MATCH\n" + "b342393/Generic.java A b342393.Generic$A.getSquare() [getSquare] EXACT_MATCH"); } finally { deleteProject("P"); } } /** * @bug 376673: DBCS4.2 Can not rename the class names when DBCS (Surrogate e.g. U+20B9F) is in it * @test Search for DBCS type should report the match * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=376673" */ public void testBug376673a() throws CoreException { try { if ("macosx".equals(System.getProperty("osgi.os"))) { System.out.println("testBug376673* may fail on macosx"); return; } IJavaProject project = createJavaProject("P", new String[] {""}, new String[] {"JCL17_LIB"}, "bin", "1.7"); String content = "package pkg;\n" + "class \uD842\uDF9F1 {}\n"; createFolder("/P/pkg"); try { IFile file = createFile("/P/pkg/\uD842\uDF9F1.java", content, "UTF-8"); file.setCharset("UTF-8", null); } catch (UnsupportedEncodingException e) { System.out.println("unsupported encoding"); } waitUntilIndexesReady(); IJavaSearchScope scope = SearchEngine. createJavaSearchScope( new IJavaElement[] { project }, IJavaSearchScope.SOURCES); search("\uD842\uDF9F1", TYPE, DECLARATIONS, EXACT_RULE, scope, this.resultCollector); assertSearchResults("pkg/\uD842\uDF9F1.java pkg.\uD842\uDF9F1 [\uD842\uDF9F1] EXACT_MATCH"); } finally { deleteProject("P"); } } // Search for DBCS method should report the match public void testBug376673b() throws CoreException { try { if ("macosx".equals(System.getProperty("osgi.os"))) { return; } IJavaProject project = createJavaProject("P", new String[] {""}, new String[] {"JCL17_LIB"}, "bin", "1.7"); String content = "package pkg;\n" + "class \uD842\uDF9F1 {" + " public void \uD842\uDF9Fm() {}\n" + "}\n"; createFolder("/P/pkg"); try { IFile file = createFile("/P/pkg/\uD842\uDF9F1.java", content, "UTF-8"); file.setCharset("UTF-8", null); } catch (UnsupportedEncodingException e) { System.out.println("unsupported encoding"); } waitUntilIndexesReady(); IJavaSearchScope scope = SearchEngine. createJavaSearchScope( new IJavaElement[] { project }, IJavaSearchScope.SOURCES); search("\uD842\uDF9Fm", METHOD, DECLARATIONS, EXACT_RULE, scope, this.resultCollector); assertSearchResults("pkg/\uD842\uDF9F1.java void pkg.\uD842\uDF9F1.\uD842\uDF9Fm() [\uD842\uDF9Fm] EXACT_MATCH"); } finally { deleteProject("P"); } } // Search for DBCS constructor should report the match public void testBug376673c() throws CoreException { try { if ("macosx".equals(System.getProperty("osgi.os"))) { return; } IJavaProject project = createJavaProject("P", new String[] {""}, new String[] {"JCL17_LIB"}, "bin", "1.7"); String content = "package pkg;\n" + "class \uD842\uDF9F1 {" + " public \uD842\uDF9F1() {}\n" + "}\n"; createFolder("/P/pkg"); try { IFile file = createFile("/P/pkg/\uD842\uDF9F1.java", content, "UTF-8"); file.setCharset("UTF-8", null); } catch (UnsupportedEncodingException e) { System.out.println("unsupported encoding"); } waitUntilIndexesReady(); IJavaSearchScope scope = SearchEngine. createJavaSearchScope( new IJavaElement[] { project }, IJavaSearchScope.SOURCES); search("\uD842\uDF9F1", CONSTRUCTOR, DECLARATIONS, EXACT_RULE, scope, this.resultCollector); assertSearchResults("pkg/\uD842\uDF9F1.java pkg.\uD842\uDF9F1() [\uD842\uDF9F1] EXACT_MATCH"); } finally { deleteProject("P"); } } // Search for DBCS field should report the match public void testBug376673d() throws CoreException { try { if ("macosx".equals(System.getProperty("osgi.os"))) { return; } IJavaProject project = createJavaProject("P", new String[] {""}, new String[] {"JCL17_LIB"}, "bin", "1.7"); String content = "package pkg;\n" + "class \uD842\uDF9F1 {" + " public int \uD842\uDF9Ff;\n" + "}\n"; createFolder("/P/pkg"); try { IFile file = createFile("/P/pkg/\uD842\uDF9F1.java", content, "UTF-8"); file.setCharset("UTF-8", null); } catch (UnsupportedEncodingException e) { System.out.println("unsupported encoding"); } waitUntilIndexesReady(); IJavaSearchScope scope = SearchEngine. createJavaSearchScope( new IJavaElement[] { project }, IJavaSearchScope.SOURCES); search("\uD842\uDF9Ff", FIELD, DECLARATIONS, EXACT_RULE, scope, this.resultCollector); assertSearchResults("pkg/\uD842\uDF9F1.java pkg.\uD842\uDF9F1.\uD842\uDF9Ff [\uD842\uDF9Ff] EXACT_MATCH"); } finally { deleteProject("P"); } } // Search for DBCS package name from a jar also should report the match public void testBug376673e() throws CoreException, IOException { try { if ("macosx".equals(System.getProperty("osgi.os"))) { return; } IJavaProject p = createJavaProject("P", new String[] {}, new String[] { "/P/lib376673.jar", "JCL17_LIB" }, "", "1.7"); org.eclipse.jdt.core.tests.util.Util.createJar( new String[] { "p\uD842\uDF9F/i\uD842\uDF9F/Test.java", "package p\uD842\uDF9F.i\uD842\uDF9F;\n" + "public class Test{}\n" }, p.getProject().getLocation().append("lib376673.jar").toOSString(), "1.7"); refresh(p); waitUntilIndexesReady(); int mask = IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.SOURCES; IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { p }, mask); search("Test", TYPE, DECLARATIONS, scope, this.resultCollector); assertSearchResults("lib376673.jar p\uD842\uDF9F.i\uD842\uDF9F.Test [No source] EXACT_MATCH"); } finally { deleteProject("P"); } } /** * @bug 357547: [search] Search for method references is returning methods as overriden even if the superclass's method is only package-visible * @test Search for a non-overriden method because of package visibility should not be found * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=357547" */ public void testBug357547a() throws CoreException { IJavaProject project = null; try { project = createJavaProject("P"); createFolder("/P/p1"); createFile("/P/p1/B.java", "package p1;\n" + "import p2.*;\n" + "public class B extends A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "}\n"); createFolder("/P/p2"); createFile("/P/p2/A.java", "package p2;\n" + "public class A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "public long m(){\n"+ "return new A().k();\n" + "}\n"+ "}\n"); IType type = getCompilationUnit("/P/p1/B.java").getType("B"); IMethod method = type.getMethod("k", new String[]{}); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Should not get any results", "", this.resultCollector); } finally { deleteProject(project); } } // search for the method name should also not return matches if not-overriden because of package-visible public void testBug357547b() throws CoreException { IJavaProject project = null; try { project = createJavaProject("P"); createFolder("/P/p1"); createFile("/P/p1/B.java", "package p1;\n" + "import p2.*;\n" + "public class B extends A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "}\n"); createFolder("/P/p2"); createFile("/P/p2/A.java", "package p2;\n" + "public class A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "public long m(){\n"+ "return new A().k();\n" + "}\n"+ "}\n"); waitUntilIndexesReady(); // search SearchPattern pattern = SearchPattern.createPattern("p*.B.k()", METHOD, REFERENCES , 0 ); search(pattern, SearchEngine.createJavaSearchScope(new IJavaElement[] { project }), this.resultCollector); assertSearchResults("Should not get any results", "", this.resultCollector); } finally { deleteProject(project); } } // search for the method name should return the match if same package public void testBug357547c() throws CoreException { IJavaProject project = null; try { project = createJavaProject("P"); createFolder("/P/p2"); createFile("/P/p2/B.java", "package p2;\n" + "public class B extends A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "}\n"); createFile("/P/p2/A.java", "package p2;\n" + "public class A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "public long m(){\n"+ "return new A().k();\n" + "}\n"+ "}\n"); waitUntilIndexesReady(); // search SearchPattern pattern = SearchPattern.createPattern("B.k()", METHOD, REFERENCES, EXACT_RULE); search(pattern, SearchEngine.createJavaSearchScope(new IJavaElement[] { project }), this.resultCollector); assertSearchResults("Wrong results", "p2/A.java long p2.A.m() [k()] EXACT_MATCH", this.resultCollector); } finally { deleteProject(project); } } public void testBug357547d() throws CoreException { IJavaProject project = null; try { project = createJavaProject("P"); createFolder("/P/p1"); createFile("/P/p1/B.java", "package p1;\n" + "import p2.*;\n" + "public class B extends A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "}\n"); createFolder("/P/p2"); createFile("/P/p2/A.java", "package p2;\n" + "public class A{ \n" + "long k(){\n" + "return 0;\n" + "}\n" + "public long m(){\n"+ "return new A().k();\n" + "}\n"+ "}\n"); createFile("/P/p2/B.java", "package p2;\n" + "public class B {\n" + "}\n"); waitUntilIndexesReady(); // search SearchPattern pattern = SearchPattern.createPattern("B.k()", METHOD, REFERENCES, EXACT_RULE); search(pattern, SearchEngine.createJavaSearchScope(new IJavaElement[] { project }), this.resultCollector); assertSearchResults("Should not get any results", "", this.resultCollector); } finally { deleteProject(project); } } // search for the method name should also not return matches if not-overriden because of package-visible // even if they are in jars public void testBug357547e() throws CoreException, IOException { IJavaProject project = null; try { project = createJavaProject("P", new String[] {""}, new String[] { "/P/lib357547.jar", "JCL15_LIB" }, "", "1.5"); org.eclipse.jdt.core.tests.util.Util.createJar(new String[] { "p2/A.java", "package p2;\n" + "public class A{}\n" }, project.getProject().getLocation().append("libStuff.jar").toOSString(), "1.5"); org.eclipse.jdt.core.tests.util.Util.createJar( new String[] { "p1/B.java", "package p1;\n"+ "import p2.*;\n"+ "public class B extends A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "}\n"}, null, project.getProject().getLocation().append("lib357547.jar").toOSString(), new String[] { project.getProject().getLocation().append("libStuff.jar").toOSString() }, "1.5"); refresh(project); createFolder("/P/p2"); createFile("/P/p2/A.java", "package p2;\n" + "public class A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "public long m(){\n"+ "return new A().k();\n" + "}\n"+ "}\n"); waitUntilIndexesReady(); // search SearchPattern pattern = SearchPattern.createPattern("B.k()", METHOD, REFERENCES, EXACT_RULE); search(pattern, SearchEngine.createJavaSearchScope(new IJavaElement[] { project }, IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.SOURCES), this.resultCollector); assertSearchResults("Wrong results", "", this.resultCollector); } finally { deleteProject(project); } } // search for the method name should also not return matches if not-overriden because of package-visible // even if they are in jars public void testBug357547f() throws CoreException, IOException { IJavaProject project = null; try { project = createJavaProject("P", new String[] {""}, new String[] { "/P/lib357547.jar", "JCL15_LIB" }, "", "1.5"); org.eclipse.jdt.core.tests.util.Util.createJar(new String[] { "p2/A.java", "package p2;\n" + "public class A{}\n" }, project.getProject().getLocation().append("libStuff.jar").toOSString(), "1.5"); org.eclipse.jdt.core.tests.util.Util.createJar( new String[] { "p2/B.java", "package p2;\n" + "import p2.*;\n" + "public class B extends A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "}\n"}, null, project.getProject().getLocation().append("lib357547.jar").toOSString(), new String[] { project.getProject().getLocation().append("libStuff.jar").toOSString() }, "1.5"); refresh(project); createFolder("/P/p2"); createFile("/P/p2/A.java", "package p2;\n" + "public class A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "public long m(){\n"+ "return new A().k();\n" + "}\n"+ "}\n"); waitUntilIndexesReady(); // search SearchPattern pattern = SearchPattern.createPattern("B.k()", METHOD, REFERENCES, EXACT_RULE); search(pattern, SearchEngine.createJavaSearchScope(new IJavaElement[] { project }, IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.SOURCES), this.resultCollector); assertSearchResults("Wrong results", "p2/A.java long p2.A.m() [k()] EXACT_MATCH", this.resultCollector); } finally { deleteProject(project); } } // search for declarations also should take care of default public void testBug357547g() throws CoreException { IJavaProject project = null; try { project = createJavaProject("P"); createFolder("/P/p1"); createFile("/P/p1/B.java", "package p1;\n" + "import p2.*;\n" + "public class B extends A {\n" + "long k(int a){\n" + "return 0;\n" + "}\n" + "}\n"); createFile("/P/p1/C.java", "package p1;\n" + "public class C extends B {\n" + "long k(int a){\n" + "return 0;\n" + "}\n" + "}\n"); createFolder("/P/p2"); createFile("/P/p2/A.java", "package p2;\n" + "public class A{ \n" + "long k(int a){\n" + "return 0;\n" + "}\n" + "public long m(){\n"+ "return new A().k(0);\n" + "}\n"+ "}\n"); createFile("/P/p2/B.java", "package p2;\n" + "public class B {\n" + "}\n"); waitUntilIndexesReady(); // search SearchPattern pattern = SearchPattern.createPattern("A.k(int)", METHOD, DECLARATIONS, EXACT_RULE); search(pattern, SearchEngine.createJavaSearchScope(new IJavaElement[] { project }), this.resultCollector); assertSearchResults("Wrong results", "p2/A.java long p2.A.k(int) [k] EXACT_MATCH", this.resultCollector); } finally { deleteProject(project); } } public void testBug378390() throws CoreException { IJavaProject project = null; try { project = createJavaProject("P"); createFolder("/P/p1"); createFile("/P/p1/B.java", "package p1;\n" + "import p2.*;\n" + "public class B extends A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "}\n"); createFolder("/P/p2"); createFile("/P/p2/A.java", "package p2;\n" + "public class A {\n" + "class B extends A {\n" + "long k(){\n" + "return 0;\n" + "}\n" + "}\n" + "long k(){\n" + "return 0;\n" + "}\n" + "public long m(){\n"+ "return new A().k();\n" + "}\n"+ "}\n"); IType type = getCompilationUnit("/P/p2/A.java").getType("A"); type = type.getTypes()[0]; IMethod method = type.getMethod("k", new String[]{}); search(method, REFERENCES, EXACT_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("Wrong results", "p2/A.java long p2.A.m() [k()] EXACT_MATCH", this.resultCollector); } finally { deleteProject(project); } } /** * @bug 375971: [search] Not finding method references with generics * @test TODO * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=375971" */ public void testBug375971a() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI <K, V>{\n"+ " public void addListener();\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> implements InterfaceI<K, V>{\n"+ " public void addListener() {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB extends ClassA<String, String, String>{\n"+ " public void doSomething() {" + " addListener();\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search IType type = getCompilationUnit("/P/InterfaceI.java").getType("InterfaceI"); IMethod method = type.getMethod("addListener", new String[]{}); this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething() [addListener()] ERASURE_MATCH"); } finally { deleteProject("P"); } } public void testBug375971b() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI <K, V>{\n"+ " public void addListener();\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> {\n"+ " public void addListener() {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB extends ClassA<String, String, String> implements InterfaceI<String, String>{\n"+ " public void doSomething() {" + " addListener();\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search IType type = getCompilationUnit("/P/InterfaceI.java").getType("InterfaceI"); IMethod method = type.getMethod("addListener", new String[]{}); this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething() [addListener()] ERASURE_MATCH"); } finally { deleteProject("P"); } } public void testBug375971c() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI <K, V>{\n"+ " public void addListener();\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> {\n"+ " public void addListener() {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB extends ClassA<String, String, String> implements InterfaceI<String, String>{\n"+ " public void doSomething() {" + " addListener();\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search IType type = getCompilationUnit("/P/ClassA.java").getType("ClassA"); IMethod method = type.getMethod("addListener", new String[]{}); this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething() [addListener()] ERASURE_MATCH"); } finally { deleteProject("P"); } } public void testBug375971d() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI <K, V>{\n"+ " public void addListener();\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> implements InterfaceI<K, V>{\n"+ " public void addListener() {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB {\n"+ " public void doSomething(ClassA a) {" + " a.addListener();\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search IType type = getCompilationUnit("/P/InterfaceI.java").getType("InterfaceI"); IMethod method = type.getMethod("addListener", new String[]{}); this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething(ClassA) [addListener()] ERASURE_RAW_MATCH"); } finally { deleteProject("P"); } } public void testBug375971e() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI <K, V>{\n"+ " public void addListener();\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> implements InterfaceI<K, V> {\n"+ " public void addListener() {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB implements InterfaceI<String, String> {\n"+ " public void doSomething() {" + " addListener();\n"+ "}\n" + "}\n"); createFile("/P/ClassC.java", "public class ClassC extends ClassA<Integer, String, String> {\n"+ " public void doSomething() {" + " addListener();\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search ICompilationUnit unit = getCompilationUnit("/P/ClassB.java"); IMethod method = selectMethod(unit, "addListener"); this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething() [addListener()] EXACT_MATCH\n" + "ClassC.java void ClassC.doSomething() [addListener()] ERASURE_MATCH"); } finally { deleteProject("P"); } } public void testBug375971f() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI {\n"+ " public void addListener();\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> implements InterfaceI{\n"+ " public void addListener() {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB extends ClassA<String, String, String>{\n"+ " public void doSomething() {" + " addListener();\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search IType type = getCompilationUnit("/P/InterfaceI.java").getType("InterfaceI"); IMethod method = type.getMethod("addListener", new String[]{}); this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething() [addListener()] EXACT_MATCH"); } finally { deleteProject("P"); } } public void testBug375971g() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI {\n"+ " public void addListener();\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> implements InterfaceI{\n"+ " public void addListener() {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB<K, V, B> extends ClassA<K, V, B>{\n"+ " public void doSomething() {" + " addListener();\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search IType type = getCompilationUnit("/P/InterfaceI.java").getType("InterfaceI"); IMethod method = type.getMethod("addListener", new String[]{}); this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething() [addListener()] EXACT_MATCH"); } finally { deleteProject("P"); } } public void testBug375971h() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI<K,V> {\n"+ " public void addListener();\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> implements InterfaceI<K, V>{\n"+ " public void addListener() {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB<K, V, B> extends ClassA<K, V, B>{\n"+ " public void doSomething(InterfaceI<String, String> i) {" + " i.addListener();\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search IType type = getCompilationUnit("/P/ClassA.java").getType("ClassA"); IMethod method = type.getMethod("addListener", new String[]{}); this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething(InterfaceI<String,String>) [addListener()] EXACT_MATCH"); } finally { deleteProject("P"); } } public void testBug375971i() throws CoreException { try { createJavaProject("P"); createFile("/P/InterfaceI.java", "public interface InterfaceI<K,V> {\n"+ " public void addListener(K k);\n"+ "}\n"); createFile("/P/ClassA.java", "public class ClassA <K, V, B> implements InterfaceI<K, V>{\n"+ "public void addListener(K k) {\n" + "}\n" + "}\n"); createFile("/P/ClassB.java", "public class ClassB<K, V, B> extends ClassA<K, V, B>{\n"+ " public void doSomething(K k) {" + " addListener(k);\n"+ "}\n" + "}\n"); waitUntilIndexesReady(); // search IType type = getCompilationUnit("/P/InterfaceI.java").getType("InterfaceI"); IMethod method = type.getMethods()[0]; this.resultCollector.showRule(); search(method, REFERENCES, ERASURE_RULE, SearchEngine.createWorkspaceScope(), this.resultCollector); assertSearchResults("ClassB.java void ClassB.doSomething(K) [addListener(k)] ERASURE_MATCH"); } finally { deleteProject("P"); } } }
[ "375833274@qq.com" ]
375833274@qq.com
88b5b543bb6416954fe4d4b2d3c353017131657e
26b7f30c6640b8017a06786e4a2414ad8a4d71dd
/src/number_of_direct_superinterfaces/i49291.java
b23d1f439759d7abd874e6c2d6ec429accc7c072
[]
no_license
vincentclee/jvm-limits
b72a2f2dcc18caa458f1e77924221d585f23316b
2fd1c26d1f7984ea8163bc103ad14b6d72282281
refs/heads/master
2020-05-18T11:18:41.711400
2014-09-14T04:25:18
2014-09-14T04:25:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
69
java
package number_of_direct_superinterfaces; public interface i49291 {}
[ "vincentlee.dolbydigital@yahoo.com" ]
vincentlee.dolbydigital@yahoo.com
7da912d9fe9a8cd5e158851d2a93dfa08f664f9b
4492fc9479cd3f9d1d297e9d73d4193fafc1b65d
/src/main/java/com/pruebams/dao/TestFacturaDetalleDao.java
ade8ec35ec6ff101fd92401e6899848c3b2365af
[]
no_license
tovarvictor986/pruebams
be0ae9f9a9ac33ae65b972c95969a4a191c56884
dd85c374ef868c45d7040b80ff7087392d2abff8
refs/heads/master
2023-03-23T13:27:43.045229
2021-03-23T00:17:39
2021-03-23T00:17:39
350,523,817
0
0
null
null
null
null
UTF-8
Java
false
false
1,365
java
package com.pruebams.dao; import java.io.FileNotFoundException; import java.io.IOException; import java.math.BigInteger; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import com.pruebams.Utils.*; import com.pruebams.model.TestFacturaDetalleModel; public class TestFacturaDetalleDao { public List<TestFacturaDetalleModel> getFacturasDetalle() throws SQLException, FileNotFoundException, IOException { Connection conexion = Utils.getConexion(); List<TestFacturaDetalleModel> lstFacturasDetalle = new ArrayList<TestFacturaDetalleModel>(); Statement s = conexion.createStatement(); ResultSet rs = s.executeQuery ("select * from TEST_FACTURA_DETALLE"); while (rs.next()) { TestFacturaDetalleModel tempFacturaDetalleModel = new TestFacturaDetalleModel(); tempFacturaDetalleModel.setIdFacturaDetalle(rs.getInt(1)); tempFacturaDetalleModel.setIdFactura(rs.getInt(2)); tempFacturaDetalleModel.setIdProducto(rs.getInt(3)); tempFacturaDetalleModel.setCantidad(rs.getInt(4)); tempFacturaDetalleModel.setValorUnidad(BigInteger.valueOf(rs.getInt(5))); tempFacturaDetalleModel.setValorTotal(BigInteger.valueOf(rs.getInt(6))); lstFacturasDetalle.add(tempFacturaDetalleModel); } return lstFacturasDetalle; } }
[ "you@example.com" ]
you@example.com
babe1eab2dfe1aa2aaf184b210f668388806c31a
4c91b6e1551cd02a739b942a0c1d289b0a52a1ba
/MIW Programeren/NewCirkel/src/cirkelNew/Cirkel.java
57ab0628732ec835c369e879404dac59308bfcf1
[]
no_license
CocoHuissoon/oldprojects
983078ac6172cca5e1ad9e04c385a9e696ee0924
872ce2ed73e756435f32fa14416b72af7a5106dc
refs/heads/master
2022-12-05T07:27:05.367179
2019-09-01T14:29:53
2019-09-01T14:29:53
205,686,427
0
0
null
2022-11-24T09:45:36
2019-09-01T14:17:26
JavaScript
UTF-8
Java
false
false
439
java
package cirkelNew; import java.util.Scanner; public class Cirkel { /* * Dit programma vraag om de straal en geeft de oppervlakte van de cirkel terug */ public static void main(String[] args) { double PI= 3.14; Scanner input = new Scanner(System.in); System.out.println("Geef de straal van een cirkel: "); double radius=input.nextDouble(); double area=Math.pow(radius, 2)*Math.PI; System.out.println(area); } }
[ "chuissoon@hotmail.com" ]
chuissoon@hotmail.com
473585fba93b829190671b89651e820a85203884
463a58ba3983084ee876be9889b2683f1b39a965
/src/main/java/com/bookstore/entity/Review.java
46363e696227b4d27b99bac52620a6ba8f967f6e
[]
no_license
sameervogeti/Bookstore-legacy
61abbf2e4311dfeb000ee4c51d84b4fbf84cfd4e
fb61dc3cf86590d1025aec067c728446d514b3f8
refs/heads/master
2022-12-14T09:04:54.403265
2019-10-20T11:18:35
2019-10-20T11:18:35
216,241,158
0
0
null
2022-11-24T08:17:24
2019-10-19T17:02:53
Java
UTF-8
Java
false
false
1,032
java
package com.bookstore.entity; import lombok.Data; import javax.persistence.*; import java.io.Serializable; import java.util.Date; @Data @Entity @Table(name = "review") public class Review implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(insertable = false, name = "review_id", nullable = false) private Integer reviewId; @Column(name = "rating", nullable = false) private Integer rating; @Column(name = "headline", nullable = false) private String headline; @Column(name = "comment", nullable = false) private String comment; @Column(name = "review_time", nullable = false) private Date reviewTime; @ManyToOne @JoinColumn(name = "book_id", referencedColumnName = "book_id", nullable = false) private Book bookByBookId; @ManyToOne @JoinColumn(name = "customer_id", referencedColumnName = "customer_id", nullable = false) private Customer customerByCustomerId; }
[ "sameervogeti@gmail.com" ]
sameervogeti@gmail.com
a63747f7d96edef88d7c8098a7245687ac28b84b
d9d5cf4e10dd06f6e0b6a3a8e32d3a3b0dcbc5f6
/src/com/class21/School.java
dc17200f856a7519940fae6b7d8392b63d401b5a
[]
no_license
asifkhanakak/javaClasses
02d6c12bf408a487fc08f948c50a8abeb80edf2a
e9b37a1d1f5b381ce892932932f45a60df305a0b
refs/heads/master
2020-09-04T21:04:55.535837
2020-02-05T00:25:48
2020-02-05T00:25:48
219,891,560
0
0
null
null
null
null
UTF-8
Java
false
false
735
java
package com.class21; public class School { public static void main(String[] args) { Student.school = "Morning School"; Student student0 = new Student(); student0.displayInfo(); Student student1 = new Student(); //assigning instance variables student1.studentName = "Eric"; student1.GPA = 3.95; student1.displayInfo(); Student student2 = new Student(); student2.studentName = "Jaime"; student2.GPA = 3.90; Student.school = "Syntax Technologies"; student2.displayInfo(); System.out.println("student1 again"); student1.displayInfo(); System.out.println("student0 info"); student0.displayInfo(); // int hour1 = 3, hour2; // hour1 = 4; // student1.study(hour1); } }
[ "emaleasif@gmail.com" ]
emaleasif@gmail.com
00f5343f3b31d1dce64c9c20320a453d63efd9df
2fc72989a9f0877a0b2586f6781ba46719f9354c
/watch/service.gui.horloge/src/main/java/org/emp/gl/service/gui/horloge/GuiHorlogeService.java
df48885120bcfff795d4e027986b4e442179419f
[]
no_license
herzallahAymen/watch-engine-implementation
0aebd1f43c739d513af508b75edc732e91f30753
626a90426b18e8d6d0b5a3719e6692cf33cda723
refs/heads/main
2023-04-11T18:11:13.255575
2021-05-17T22:29:43
2021-05-17T22:29:43
368,332,150
0
0
null
null
null
null
UTF-8
Java
false
false
644
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 org.emp.gl.service.gui.horloge; /** * * @author yacin */ public interface GuiHorlogeService { public void show(); public void setBlocked(boolean blocked); public void incrementSeconds(); public void incrementMinutes(); public void incrementHours(); public void highlightSeconds(boolean light); public void highlightMinutes(boolean light); public void highlightHours(boolean light); }
[ "noreply@github.com" ]
noreply@github.com
047f522aa39d5071596bed4a9b7e2140c1347c99
a8550b4c4037f90a82d2297c7bc39152a9b03728
/icy/search/SearchResultProducer.java
00220337324b5f33fa365d844c3cca33d7c0ade0
[]
no_license
valdyucl/Icy-Kernel
3975fdfd8b82881fdd344da45dc5225acc4d8daa
1bf0fe7f1a7bf40626f538f571124d11e14fca6c
refs/heads/master
2021-05-04T04:49:54.502232
2016-10-21T14:36:10
2016-10-21T14:36:10
70,886,559
1
0
null
2016-10-14T07:44:24
2016-10-14T07:44:24
null
UTF-8
Java
false
false
6,851
java
/* * Copyright 2010-2015 Institut Pasteur. * * This file is part of Icy. * * Icy is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Icy is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Icy. If not, see <http://www.gnu.org/licenses/>. */ package icy.search; import icy.system.IcyExceptionHandler; import icy.system.thread.SingleProcessor; import icy.system.thread.ThreadUtil; import icy.util.StringUtil; import java.util.ArrayList; import java.util.List; /** * The SearchResultProducer create {@link SearchResult} objects from given search keywords.<br> * These {@link SearchResult} are then consumed by a {@link SearchResultConsumer}. * * @author Thomas Provoost & Stephane Dallongeville */ public abstract class SearchResultProducer implements Comparable<SearchResultProducer> { private class SearchRunner implements Runnable { private final String[] words; private final SearchResultConsumer consumer; public SearchRunner(String[] words, SearchResultConsumer consumer) { super(); this.words = words; this.consumer = consumer; } @Override public void run() { // perform search if we have at least one not empty keyword if ((words.length > 1) || !StringUtil.isEmpty(words[0])) { try { doSearch(words, consumer); } catch (Throwable t) { // just display the exception and continue IcyExceptionHandler.showErrorMessage(t, true, true); } } else { final boolean notEmpty; synchronized (results) { // clear the list if necessary notEmpty = !results.isEmpty(); if (notEmpty) results.clear(); } // avoid death lock by sending event after synchronization if (notEmpty) consumer.resultsChanged(SearchResultProducer.this); } // search completed (do it after searching set to false) consumer.searchCompleted(SearchResultProducer.this); } } /** Result list */ protected List<SearchResult> results; /** Internals */ protected final SingleProcessor processor; public SearchResultProducer() { super(); results = new ArrayList<SearchResult>(); processor = new SingleProcessor(true, this.getClass().getSimpleName()); } /** Returns the result producer order */ public int getOrder() { // default return 10; } /** Returns the result producer name */ public abstract String getName(); /** * Returns the tooltip displayed on the menu (in small under the label). */ public String getTooltipText() { return "Click to run"; } /** Returns the result list */ public List<SearchResult> getResults() { return results; } /** * Performs the search request (asynchronous), mostly build the search result list.<br> * Only one search request should be processed at one time so take care of waiting for previous * search request completion.<br> * * @param words * Search keywords * @param consumer * Search result consumer for this search request.<br> * The consumer should be notified of new results by using the * {@link SearchResultConsumer#resultsChanged(SearchResultProducer)} method. */ public void search(String[] words, SearchResultConsumer consumer) { processor.submit(new SearchRunner(words, consumer)); } /** * Performs the search request (internal).<br> * The method is responsible for filling the <code>results</code> list :<br> * - If no result correspond to the requested search then <code>results</code> should be * cleared.<br> * - Else it should contains the founds results.<br> * <code>results</code> variable access should be synchronized as it can be externally accessed.<br> * The method could return earlier if {@link #hasWaitingSearch()} returns true. * * @param words * Search keywords * @param consumer * Search result consumer for this search request.<br> * The consumer should be notified of new results by using the * {@link SearchResultConsumer#resultsChanged(SearchResultProducer)} method. * @see #hasWaitingSearch() */ public abstract void doSearch(String[] words, SearchResultConsumer consumer); /** * Wait for the search request to complete. */ public void waitSearchComplete() { while (isSearching()) ThreadUtil.sleep(1); } /** * Returns true if the search result producer is currently processing a search request. */ public boolean isSearching() { return processor.isProcessing(); } /** * Returns true if there is a waiting search pending.<br> * This method should be called during search process to cancel it if another search is waiting. */ public boolean hasWaitingSearch() { return processor.hasWaitingTasks(); } /** * Add the SearchResult to the result list. * * @param result * Result to add to the result list. * @param consumer * If not null then consumer is notified about result change */ public void addResult(SearchResult result, SearchResultConsumer consumer) { if (result != null) { synchronized (results) { results.add(result); } // notify change to consumer if (consumer != null) consumer.resultsChanged(this); } } @Override public int compareTo(SearchResultProducer o) { // sort on order return getOrder() - o.getOrder(); } }
[ "stephane.dallongeville@pasteur.fr" ]
stephane.dallongeville@pasteur.fr
377eeed10ad4653a9e3a884c714f9e729d9fe416
b3980f7e33de6fb86263347da97d7b7d64612f3a
/src/main/java/com/buffalokiwi/aerodrome/jet/IJetDate.java
ef7905483e50ad79762ffccf8215226da3f40213
[ "Apache-2.0" ]
permissive
rajtrivedi2001/aerodrome-for-jet
db11306d0cf7e9de9f51e82d80dfe4b9bb6f38cb
c642582ce81331bafda0c7c31ed69dc892274c26
refs/heads/master
2021-01-22T20:59:33.102541
2017-03-16T23:43:05
2017-03-16T23:43:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,158
java
/** * This file is part of the Aerodrome package, and is subject to the * terms and conditions defined in file 'LICENSE', which is part * of this source code package. * * Copyright (c) 2016 All Rights Reserved, John T. Quinn III, * <johnquinn3@gmail.com> * * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A * PARTICULAR PURPOSE. */ package com.buffalokiwi.aerodrome.jet; import java.sql.Timestamp; import java.util.Date; /** * A jet date * @author John Quinn */ public interface IJetDate { /** * Retrieve the date. * Note: this can be incorrect if the formatter failed. * @return Date */ public Date getDate(); /** * Retrieve the exact string retrieved from the jet api response that * represents a date. * @return date string */ public String getDateString(); /** * Convert this date into some sql representation. * This effectively drops timezone information. * @return timestamp */ public Timestamp toSqlTimestamp(); }
[ "johnquinn3@gmail.com" ]
johnquinn3@gmail.com
b4c7100adbedfce2b53301915ac636586a0dff0b
126fbe646e2c5144f5f2f8835df67d4b339cccd3
/Workspace_Automation/ExampleJavaPrograms/src/com/sgtesting/javapractice/Table2.java
32094381abc8a92fd6c8d166b705e78cd5033f81
[]
no_license
Deekshith188/Automation-using-Java
f5c82ec94250fa3f8af61a19e8ebc5e8340b917c
560667fae6264cd36691c893936049afccd530d4
refs/heads/master
2023-04-04T01:25:15.182179
2021-04-04T06:02:01
2021-04-04T06:02:01
354,462,081
0
0
null
null
null
null
UTF-8
Java
false
false
221
java
package com.sgtesting.javapractice; public class Table2 { public static void main(String[] args) { // TODO Auto-generated method stub for(int i=10;i>=1;i--) { System.out.println("4*+"+i+"="+(i*4)); } } }
[ "deekshithbu95@gmail.com" ]
deekshithbu95@gmail.com
8feec36620702eed2f01ae22ba360fb9ba23f092
34abb85ee829294513a53485cc5c34531a552661
/app/src/androidTest/java/amrudesh/com/locationtodoreminder/ExampleInstrumentedTest.java
039d8a9c06938f6b15cd7368de4298ddfc034634
[]
no_license
amrudesh1/TodoLocation
65fd33dbc71ad16bcf119b15494f257148dd307c
f326158883ad40d00049d5d23b7ed0177c997d90
refs/heads/master
2020-03-28T19:57:11.347718
2019-01-29T12:26:56
2019-01-29T12:26:56
149,024,708
1
0
null
null
null
null
UTF-8
Java
false
false
750
java
package amrudesh.com.locationtodoreminder; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("amrudesh.com.locationtodoreminder", appContext.getPackageName()); } }
[ "amrbal@gmail.com" ]
amrbal@gmail.com
19bc48e80306c5b7cdc75a6bf5e6f041781d6e1c
ea008a7db6afeb1fc0dfcc2fb7a9b644b1da1b2e
/Programmers/Level3/멀리 뛰기.java
ad6002bfd1b0c4c44ea404a0a1c46f51f2e45fb8
[]
no_license
park-sang-hyun/Algorithm
dd58984ec0ae863b1011e3f3298bc039d952ac2c
1a89be49ad3aedfaa4ef321a5b36f9989e66ce59
refs/heads/master
2023-05-05T18:29:10.277728
2021-05-20T12:40:56
2021-05-20T12:40:56
359,505,691
0
0
null
null
null
null
UTF-8
Java
false
false
257
java
class Solution { long[] dp = new long[2001]; public long solution(int n) { dp[1] = 1; dp[2] = 2; for(int i=3; i<=n; i++) dp[i] = (dp[i-1] + dp[i-2]) % 1234567; return dp[n]; } }
[ "park03851@naver.com" ]
park03851@naver.com
1b6178bbee0dabff07e84f85c59d9a9785c4e77f
628e111904955e746b89df11108fdb936fee01e2
/app/src/main/java/com/example/houshuai/mymaterialdesigndemo/MainActivity.java
0fd386d7564ad32fa93bd3d5104f4b494b582c31
[]
no_license
LikeRainDay/MyMaterialDesignDemo
45f64453d0df8e18d5cf979a9315d60d7ccb9a93
8a538678a76c97e3ebb8a40dbfce051989f8ebcc
refs/heads/master
2021-06-03T22:40:22.180682
2016-06-24T03:41:27
2016-06-24T03:41:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,991
java
package com.example.houshuai.mymaterialdesigndemo; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MotionEvent; import android.view.View; import com.example.houshuai.base.BaseActivity; import com.example.houshuai.fragment.FirstFragment; import com.example.houshuai.fragment.ThreeFragment; import com.example.houshuai.fragment.TwoFragment; import java.util.LinkedList; import java.util.List; import butterknife.BindView; //登录界面ACtivity public class MainActivity extends BaseActivity { @BindView(R.id.tl_title) Toolbar mToolBar; @BindView(R.id.tb_BottomTitle) TabLayout mTablayout; protected void initView() { setSupportActionBar(mToolBar); // 准备tablayout的数据源 initTablayoutView(); } private void initTablayoutView() { String[] stringArray = getResources().getStringArray(R.array.tabLayoutData); for (int i = 0; i < stringArray.length; i++) { TabLayout.Tab tab = mTablayout.newTab(); tab.setText(stringArray[i]); mTablayout.addTab(tab); } } private void initTablayout() { mTablayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { List<Fragment> fragments = new LinkedList<>(); fragments.add(new FirstFragment()); fragments.add(new TwoFragment()); fragments.add(new ThreeFragment()); android.support.v4.app.FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); switch (view.getId()) { case R.id.menu_01: fragmentTransaction.replace(R.id.fl_BaseFragment, fragments.get(0)).addToBackStack(null).commit(); break; case R.id.menu_02: fragmentTransaction.replace(R.id.fl_BaseFragment, fragments.get(1)).addToBackStack(null).commit(); break; case R.id.menu_03: fragmentTransaction.replace(R.id.fl_BaseFragment, fragments.get(2)).addToBackStack(null).commit(); break; default: break; } } }); } @Override protected void initLayout() { //初始化跳转的各个界面 initTablayout(); } @Override protected int inflateLayoutId() { return R.layout.activity_main; } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.bottom_menu, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onTouchEvent(MotionEvent event) { //收缩CollpaseActionbar return true; } }
[ "houshuai0816@126.com" ]
houshuai0816@126.com
ce86e38839a15b163593b7796160936a7b370566
73d8d406e5ac30e03c82551b2fa85472e68521ad
/src/main/test/java/com/jutils/ImageTest.java
1e22518c849e47d3c5fe60c4b4b16e52d52164cf
[]
no_license
zyhui98/jutils
4c57bedb8ed194a6a33874f42ca4ba0c53366092
e62e542e966e3fa8f25d1529f00129c2dfc22852
refs/heads/master
2020-03-26T07:26:31.721479
2019-07-08T06:22:48
2019-07-08T06:22:48
144,654,500
0
0
null
2018-08-14T01:49:50
2018-08-14T01:49:50
null
UTF-8
Java
false
false
1,967
java
package com.jutils; import org.im4java.core.*; import org.im4java.process.ProcessStarter; import java.io.IOException; /** * Created with IntelliJ IDEA. * * @author: zhuyh * @date: 2018/8/16 */ public class ImageTest { public static final String E_GIT_WORKSPACE_JUTILS_SRC_MAIN_TEST_RESOURCES_IMAGE = "E:\\git-workspace\\jutils\\src\\main\\test\\resources\\image\\"; static String myPath="C:\\Program Files\\GraphicsMagick-1.3.28-Q8"; public static void main(String[] args) { IMOperation op = new IMOperation(); op.addImage(E_GIT_WORKSPACE_JUTILS_SRC_MAIN_TEST_RESOURCES_IMAGE + "2.png"); // 输入要压缩的文件路径 op.resize(640); // 多番尝试后才知道这是限定width,height等比缩放 op.addImage(E_GIT_WORKSPACE_JUTILS_SRC_MAIN_TEST_RESOURCES_IMAGE + "2-new.png"); // 压缩后的文件的输出路径,当然可以没有扩展名! ImageCommand cmd = getImageCommand(1); try { cmd.run(op); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } catch (IM4JavaException e) { e.printStackTrace(); } } private static ImageCommand getImageCommand(int type) { ImageCommand cmd = null; Boolean USE_GRAPHICS_MAGICK_PATH = true; switch (type) { case 1: cmd = new ConvertCmd(USE_GRAPHICS_MAGICK_PATH); break; case 2: cmd = new IdentifyCmd(USE_GRAPHICS_MAGICK_PATH); break; case 3: cmd = new CompositeCmd(USE_GRAPHICS_MAGICK_PATH); break; } if (cmd != null && System.getProperty("os.name").toLowerCase().indexOf("windows") != -1) { cmd.setSearchPath(USE_GRAPHICS_MAGICK_PATH ? myPath : myPath); } return cmd; } }
[ "zyhui98@qq.com" ]
zyhui98@qq.com
fb82f9b84eadf02c25aec9812cd02dd0bc928449
2ff80ea7862a0379b1ce94f44fa5414b6c90ee16
/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/loader/R.java
ac4a024ae1e64514388e14f469e4da477b13a5ce
[]
no_license
zahrakeshavarz/kvr
0dedcb51ae8c0905dc6a0667a8ac60ff652dc1ff
64646c189fd5f21c595bb039a6a88175acc7e7b0
refs/heads/master
2020-06-04T02:20:02.984741
2019-06-14T13:31:19
2019-06-14T13:31:19
191,831,600
0
0
null
null
null
null
UTF-8
Java
false
false
10,453
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.loader; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f020027; public static final int font = 0x7f020085; public static final int fontProviderAuthority = 0x7f020087; public static final int fontProviderCerts = 0x7f020088; public static final int fontProviderFetchStrategy = 0x7f020089; public static final int fontProviderFetchTimeout = 0x7f02008a; public static final int fontProviderPackage = 0x7f02008b; public static final int fontProviderQuery = 0x7f02008c; public static final int fontStyle = 0x7f02008d; public static final int fontVariationSettings = 0x7f02008e; public static final int fontWeight = 0x7f02008f; public static final int ttcIndex = 0x7f020150; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f04004a; public static final int notification_icon_bg_color = 0x7f04004b; public static final int ripple_material_light = 0x7f040056; public static final int secondary_text_default_material_light = 0x7f040058; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f05004b; public static final int compat_button_inset_vertical_material = 0x7f05004c; public static final int compat_button_padding_horizontal_material = 0x7f05004d; public static final int compat_button_padding_vertical_material = 0x7f05004e; public static final int compat_control_corner_material = 0x7f05004f; public static final int compat_notification_large_icon_max_height = 0x7f050050; public static final int compat_notification_large_icon_max_width = 0x7f050051; public static final int notification_action_icon_size = 0x7f05005b; public static final int notification_action_text_size = 0x7f05005c; public static final int notification_big_circle_margin = 0x7f05005d; public static final int notification_content_margin_start = 0x7f05005e; public static final int notification_large_icon_height = 0x7f05005f; public static final int notification_large_icon_width = 0x7f050060; public static final int notification_main_column_padding_top = 0x7f050061; public static final int notification_media_narrow_margin = 0x7f050062; public static final int notification_right_icon_size = 0x7f050063; public static final int notification_right_side_padding_top = 0x7f050064; public static final int notification_small_icon_background_padding = 0x7f050065; public static final int notification_small_icon_size_as_large = 0x7f050066; public static final int notification_subtext_size = 0x7f050067; public static final int notification_top_pad = 0x7f050068; public static final int notification_top_pad_large_text = 0x7f050069; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f06006c; public static final int notification_bg = 0x7f06006d; public static final int notification_bg_low = 0x7f06006e; public static final int notification_bg_low_normal = 0x7f06006f; public static final int notification_bg_low_pressed = 0x7f060070; public static final int notification_bg_normal = 0x7f060071; public static final int notification_bg_normal_pressed = 0x7f060072; public static final int notification_icon_background = 0x7f060073; public static final int notification_template_icon_bg = 0x7f060074; public static final int notification_template_icon_low_bg = 0x7f060075; public static final int notification_tile_bg = 0x7f060076; public static final int notify_panel_notification_icon_bg = 0x7f060077; } public static final class id { private id() {} public static final int action_container = 0x7f07000e; public static final int action_divider = 0x7f070010; public static final int action_image = 0x7f070011; public static final int action_text = 0x7f070017; public static final int actions = 0x7f070018; public static final int async = 0x7f070020; public static final int blocking = 0x7f070024; public static final int chronometer = 0x7f07002f; public static final int forever = 0x7f07004e; public static final int icon = 0x7f070058; public static final int icon_group = 0x7f070059; public static final int info = 0x7f07005d; public static final int italic = 0x7f07005f; public static final int line1 = 0x7f070066; public static final int line3 = 0x7f070067; public static final int normal = 0x7f070077; public static final int notification_background = 0x7f070078; public static final int notification_main_column = 0x7f070079; public static final int notification_main_column_container = 0x7f07007a; public static final int right_icon = 0x7f07008a; public static final int right_side = 0x7f07008b; public static final int tag_transition_group = 0x7f0700b4; public static final int tag_unhandled_key_event_manager = 0x7f0700b5; public static final int tag_unhandled_key_listeners = 0x7f0700b6; public static final int text = 0x7f0700b8; public static final int text2 = 0x7f0700b9; public static final int time = 0x7f0700d1; public static final int title = 0x7f0700d2; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f080005; } public static final class layout { private layout() {} public static final int notification_action = 0x7f090027; public static final int notification_action_tombstone = 0x7f090028; public static final int notification_template_custom_big = 0x7f09002f; public static final int notification_template_icon_group = 0x7f090030; public static final int notification_template_part_chronometer = 0x7f090034; public static final int notification_template_part_time = 0x7f090035; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0b003c; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0c00ec; public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00ed; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00ef; public static final int TextAppearance_Compat_Notification_Time = 0x7f0c00f2; public static final int TextAppearance_Compat_Notification_Title = 0x7f0c00f4; public static final int Widget_Compat_NotificationActionContainer = 0x7f0c015d; public static final int Widget_Compat_NotificationActionText = 0x7f0c015e; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f020087, 0x7f020088, 0x7f020089, 0x7f02008a, 0x7f02008b, 0x7f02008c }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f020085, 0x7f02008d, 0x7f02008e, 0x7f02008f, 0x7f020150 }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
[ "50234789+zahrakeshavarz@users.noreply.github.com" ]
50234789+zahrakeshavarz@users.noreply.github.com
fa35b068f1fd9517dfb6e9ca3f97e7187ad9906c
4a21e6475ca6ab2d692876b98598abe67bd176bb
/views/src/main/java/com/rd/views/editText/EditTextWithDrawable.java
82d331ff72fbee93679b3d92b6d7e4fa4a8da61f
[]
no_license
niarehtni/Android
9b54fbcb77b52ed0297901269bcd7a414e5b92f2
cae6bba1b6afdfcb2f7b28dabe19dc19650d1044
refs/heads/master
2020-04-20T12:54:54.231329
2018-03-01T08:05:10
2018-03-01T08:05:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,156
java
package com.rd.views.editText; import android.content.Context; import android.graphics.drawable.Drawable; import android.support.v7.widget.AppCompatEditText; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; /** * Author: TinhoXu * E-mail: xth@erongdu.com * Date: 2016/5/17 15:56 * <p/> * Description: 带drawable的EditText */ public class EditTextWithDrawable extends AppCompatEditText { /** 左侧图片点击监听 */ private DrawableLeftListener mLeftListener; /** 顶部图片点击监听 */ private DrawableTopListener mTopListener; /** 右侧图片点击监听 */ private DrawableRightListener mRightListener; /** 底部图片点击监听 */ private DrawableBottomListener mBottomListener; // 左侧图片 final int DRAWABLE_LEFT = 0; // 顶部图片 final int DRAWABLE_TOP = 1; // 右侧图片 final int DRAWABLE_RIGHT = 2; // 底部图片 final int DRAWABLE_BOTTOM = 3; public EditTextWithDrawable(Context context) { super(context); } public EditTextWithDrawable(Context context, AttributeSet attrs) { super(context, attrs); } public EditTextWithDrawable(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } public void setLeftListener(DrawableLeftListener leftListener) { this.mLeftListener = leftListener; } public void setTopListener(DrawableTopListener topListener) { this.mTopListener = topListener; } public void setRightListener(DrawableRightListener rightListener) { this.mRightListener = rightListener; } public void setBottomListener(DrawableBottomListener bottomListener) { this.mBottomListener = bottomListener; } @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_UP: // 左侧图片监听 if (null != mLeftListener) { Drawable drawableLeft = getCompoundDrawables()[DRAWABLE_LEFT]; if (null != drawableLeft && event.getRawX() <= (getLeft() + drawableLeft.getBounds().width())) { mLeftListener.onDrawableLeftClick(this); return true; } } // 顶部图片监听 if (null != mTopListener) { Drawable drawableTop = getCompoundDrawables()[DRAWABLE_TOP]; if (null != drawableTop && event.getRawY() <= (getTop() + drawableTop.getBounds().width())) { mTopListener.onDrawableTopClick(this); return true; } } // 右侧图片监听 if (null != mRightListener) { Drawable drawableRight = getCompoundDrawables()[DRAWABLE_RIGHT]; if (null != drawableRight && event.getRawX() >= (getRight() - drawableRight.getBounds().width())) { mRightListener.onDrawableRightClick(this); return true; } } // 底部图片监听 if (null != mBottomListener) { Drawable drawableBottom = getCompoundDrawables()[DRAWABLE_BOTTOM]; if (null != drawableBottom && event.getRawY() >= (getBottom() - drawableBottom.getBounds().width())) { mBottomListener.onDrawableBottomClick(this); return true; } } break; } return super.onTouchEvent(event); } public interface DrawableLeftListener { void onDrawableLeftClick(View view); } public interface DrawableTopListener { void onDrawableTopClick(View view); } public interface DrawableRightListener { void onDrawableRightClick(View view); } public interface DrawableBottomListener { void onDrawableBottomClick(View view); } }
[ "gogs@fake.local" ]
gogs@fake.local
c257b2f6ccd85814c1917daae4e53ad04e835a5d
f3de5e80aa3dd60223613b2a25c8d7e2c0ebcae0
/ContentType/src/HelloWorld.java
d2f2aba45247748b1d27fd6cad48601e9673f117
[ "Apache-2.0" ]
permissive
scp504677840/JavaWeb
25e294afb44c134860f07d26d6466f797dcff8a4
dd7584a9127240a6e4a9edd29a73bf2cc5038314
refs/heads/master
2021-09-18T02:54:57.533946
2018-07-09T05:48:32
2018-07-09T05:48:32
103,276,458
0
0
null
null
null
null
UTF-8
Java
false
false
1,375
java
import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.InputStream; @WebServlet(name = "HelloWorld", urlPatterns = {"/hello"}) public class HelloWorld extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // 设置文档属于什么MIME类型。客户端按照服务器返回的文档类型进行解析。 response.setHeader("Content-Type", "image/png"); // 获取输入流 InputStream in = getServletContext().getResourceAsStream("/logo.png"); // 获取输出流 ServletOutputStream out = response.getOutputStream(); // 缓冲区 byte[] buf = new byte[1024]; // 每次读取的字节数 int length; // 遍历读取 while ((length = in.read(buf)) > 0) { out.write(buf, 0, length); } // 关闭流 in.close(); out.close(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } }
[ "15335747148@163.com" ]
15335747148@163.com
cf5ca7d85f1c6b5cc152fa8649e07e837ad820a3
f8abe9c49d82f3048d9efa6d3bf560aadec84c44
/library/src/main/java/com/download/library/DownloadListener.java
3e50de9893f94918cd2564551913d469790fca37
[ "Apache-2.0" ]
permissive
HardyLiang/Downloader
1df1dfc31676534c49e6406fca76b1deff6f46f3
7703690b81b14dc6c6387e65b0a9bfab97efb19e
refs/heads/master
2020-04-24T01:49:23.353517
2019-02-19T12:54:54
2019-02-19T12:54:54
171,613,858
1
0
Apache-2.0
2019-02-20T06:25:16
2019-02-20T06:25:15
null
UTF-8
Java
false
false
1,693
java
/* * Copyright (C) Justson(https://github.com/Justson/Downloader) * * 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.download.library; import android.net.Uri; import android.support.annotation.MainThread; /** * @author cenxiaozhong * @date 2018/6/21 * @update 4.0.0 * @since 1.0.0 */ public interface DownloadListener { /** * @param url 下载链接 * @param userAgent UserAgent * @param contentDisposition ContentDisposition * @param mimetype 资源的媒体类型 * @param contentLength 文件长度 * @param extra 下载配置 * @return true 处理了该下载事件 , false 交给 Downloader 下载 */ @MainThread void onStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength, Extra extra); /** * @param throwable 如果异常,返回给异常 * @param path 文件的绝对路径 * @param url 下载的地址 * @return true 处理了下载完成后续的事件 ,false 默认交给Downloader 处理 */ @MainThread boolean onResult(Throwable throwable, Uri path, String url, Extra extra); }
[ "xiaozhongcen@gmail.com" ]
xiaozhongcen@gmail.com
bfdc0fa6968ac9646574855946e21f7a93bea490
1c1d5e28d9a47a146337b1fb63a1bd4178f1ee5f
/app/src/main/java/com/ibamb/udm/activity/LoadParamDefActivity.java
b34fb9a49575cda286ee86fb2b3426b40f6fd5b6
[]
no_license
ibambu/udm
c2d741f5fdf146f1231fe1ad4aa92be172178f6f
fc62b57f17ad40f61a72cdc15cef577adcd255f3
refs/heads/master
2021-05-02T09:46:18.664356
2018-12-02T17:04:50
2018-12-02T17:04:50
118,343,546
0
0
null
null
null
null
UTF-8
Java
false
false
597
java
package com.ibamb.udm.activity; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import com.ibamb.udm.R; import com.ibamb.dnet.module.constants.Constants; import com.ibamb.udm.component.constants.UdmConstant; import com.ibamb.udm.util.TaskBarQuiet; public class LoadParamDefActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_load_param_def); TaskBarQuiet.setStatusBarColor(this, UdmConstant.TASK_BAR_COLOR); } }
[ "taonlyt@aliyun.com" ]
taonlyt@aliyun.com
ff456eba1f047a647e80394ba374c2bdb0792dc6
1596ac54089ba6def828e6ebc79287a5464b0d93
/src/main/java/reducejoin/JoinDriver.java
3ffae9925980abf0b9a5372bc9a077b687801f3a
[]
no_license
naeemlyon/DistributedComputing
324e5bd1b9301e3764b8015c84741577ca427920
737f36a86075b80f9f17ff41a71c6389de11dc4f
refs/heads/master
2020-06-10T05:34:46.932247
2016-12-09T21:03:11
2016-12-09T21:03:11
76,069,650
0
0
null
null
null
null
UTF-8
Java
false
false
3,235
java
package reducejoin; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.lib.input.MultipleInputs; import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import miscUtils.CommonUtil; import miscUtils.SC; public class JoinDriver { static CommonUtil cmn = new CommonUtil(); public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); Job job = new Job(conf, "Reduce Side Join"); /* conf.set("dfs.socket.timeout", "90000"); conf.set("dfs.client.socket-timeout", "90000"); conf.set("dfs.datanode.socket.write.timeout", "90000"); */ String output = cmn.PrepareConfigurationData(args, "output"); job.getConfiguration().set("output", output); // Use multiple inputs to set which input uses what mapper // This will keep parsing of each data set separate from a logical // standpoint // However, this version of Hadoop has not upgraded MultipleInputs // to the mapreduce package, so we have to use the deprecated API. // Future releases have this in the "mapreduce" package. String input = cmn.PrepareConfigurationData(args, "input"); String[] inp = input.split(SC.SPACE); MultipleInputs.addInputPath(job, new Path(inp[0].trim()), TextInputFormat.class, JoinMapperA.class); MultipleInputs.addInputPath(job, new Path(inp[1].trim()), TextInputFormat.class, JoinMapperB.class); // Configure the join type String joinType = cmn.PrepareConfigurationData(args, "joinType"); if (!(joinType.equalsIgnoreCase("inner") || joinType.equalsIgnoreCase("leftouter") || joinType.equalsIgnoreCase("rightouter") || joinType.equalsIgnoreCase("fullouter") || joinType .equalsIgnoreCase("anti"))) { System.err .println("Join type not set to inner, leftouter, rightouter, fullouter, or anti"); System.exit(2); } job.getConfiguration().set("joinType", joinType.toLowerCase()); String KeysA = cmn.PrepareConfigurationData(args, "KeysA"); job.getConfiguration().set("KeysA", KeysA); String ValA = cmn.PrepareConfigurationData(args, "ValA"); job.getConfiguration().set("ValA", ValA); String DLMT = cmn.PrepareConfigurationData(args, "DLMT"); job.getConfiguration().set("DLMT", DLMT); String KeysB = cmn.PrepareConfigurationData(args, "KeysB"); job.getConfiguration().set("KeysB", KeysB); String ValB = cmn.PrepareConfigurationData(args, "ValB"); job.getConfiguration().set("ValB", ValB); job.setJarByClass(JoinDriver.class); job.setReducerClass(JoinReducer.class); FileOutputFormat.setOutputPath(job, new Path(output)); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); // delete the outout folder at hdfs if it exists already Path OutputPath = new Path(output); // output path FileOutputFormat.setOutputPath(job, OutputPath); cmn.deleteFolder(conf, OutputPath); System.exit(job.waitForCompletion(true) ? 0 : 3); } ///////////////////////////////////////////////////////////////////////////////// }
[ "Muhammad.Naeem@univ-lyon2.fr" ]
Muhammad.Naeem@univ-lyon2.fr
791257863944128634d2c02da697f1d66a276cc2
a55b9027b8d3699c6dfaca4b3228cc75ff9996bb
/kiby/src/test/java/org/eddy/test/Test.java
2a3e56dbe665fb904ecceacd46f5c44d24939ec3
[ "Apache-2.0" ]
permissive
vic-liang/kiby
0775ef39bcdec66ed273c1a4276074115982c3a7
0e95068094e4374c494546d25633f2cfb53f64a6
refs/heads/master
2020-12-11T02:11:26.643112
2014-10-20T03:20:21
2014-10-20T03:20:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,127
java
/** * * @creatTime 下午3:23:52 * @author Eddy */ package org.eddy.test; import org.eddy.annotation.Algorithm; import org.eddy.annotation.ClearValidate; import org.eddy.annotation.Validate; import org.eddy.annotation.ValidateRule; import org.springframework.stereotype.Component; /** * @author Eddy * */ @Component("test") public class Test { @ValidateRule(name="defaultRule2") public void test123(@Validate(algorithm = Algorithm.NOTNULL, expect = "") String str1, @Validate(algorithm = Algorithm.REGX, expect = "\\w*")String str2) { System.out.println("参数验证框架测试" + str1 + " " + str2); } @ValidateRule(name="defaultRule2") public void test124(@ClearValidate @Validate(algorithm = Algorithm.NOTNULL, expect = "") String str1) { System.out.println("参数验证框架测试" + str1); } @ValidateRule(name="defaultRule3") public void test2(String in) { System.out.println("参数验证框架测试" + in); } public void test3(@Validate(algorithm=Algorithm.IN, exception="must in a,b,c", expect = "a,b,c") String in) { System.out.println("参数验证框架测试" + in); } }
[ "eddyxu1213@126.com" ]
eddyxu1213@126.com
9bea26a994c3755c0e29a7012bc61ed0b43cee6b
6be39fc2c882d0b9269f1530e0650fd3717df493
/weixin反编译/sources/com/tencent/mm/plugin/emoji/f/g.java
18306a4cb6fff902579c628262fa49fed1ad521d
[]
no_license
sir-deng/res
f1819af90b366e8326bf23d1b2f1074dfe33848f
3cf9b044e1f4744350e5e89648d27247c9dc9877
refs/heads/master
2022-06-11T21:54:36.725180
2020-05-07T06:03:23
2020-05-07T06:03:23
155,177,067
5
0
null
null
null
null
UTF-8
Java
false
false
9,241
java
package com.tencent.mm.plugin.emoji.f; import com.tencent.mm.ad.b; import com.tencent.mm.ad.e; import com.tencent.mm.ad.k; import com.tencent.mm.f.a.cr; import com.tencent.mm.modelcdntran.d; import com.tencent.mm.modelcdntran.i.a; import com.tencent.mm.modelcdntran.keep_ProgressInfo; import com.tencent.mm.modelcdntran.keep_SceneResult; import com.tencent.mm.network.q; import com.tencent.mm.plugin.emoji.e.c; import com.tencent.mm.plugin.emoji.model.EmojiLogic; import com.tencent.mm.plugin.emoji.model.i; import com.tencent.mm.protocal.c.sp; import com.tencent.mm.protocal.c.ti; import com.tencent.mm.protocal.c.tj; import com.tencent.mm.sdk.platformtools.bi; import com.tencent.mm.sdk.platformtools.x; import com.tencent.mm.storage.emotion.EmojiGroupInfo; import com.tencent.mm.y.as; import java.io.ByteArrayOutputStream; import java.io.File; public final class g extends k implements com.tencent.mm.network.k { private final b gLB; private e gQm; public String hCY; boolean hpb; private int itU; public String lEs; public String lEt; public String lEu; private int lEv; private a lEw; EmojiGroupInfo lEx; static /* synthetic */ void ac(String str, boolean z) { if (!bi.oN(str)) { x.i("MicroMsg.emoji.NetSceneExchangeEmotionPack", "[cpan] publicStoreEmojiDownLoadTaskEvent productId:%s success:%b", str, Boolean.valueOf(z)); com.tencent.mm.sdk.b.b crVar = new cr(); crVar.frL.frM = str; crVar.frL.fql = 2; crVar.frL.success = z; com.tencent.mm.sdk.b.a.xmy.m(crVar); } } private g(String str, String str2, String str3, int i, int i2) { this.hCY = ""; this.lEw = new a() { public final int a(String str, int i, keep_ProgressInfo keep_progressinfo, keep_SceneResult keep_sceneresult, boolean z) { if (bi.oN(g.this.hCY) || !str.equals(g.this.hCY)) { x.d("MicroMsg.emoji.NetSceneExchangeEmotionPack", "cdntra mediaId is no equal"); } else if (i == -21006) { x.d("MicroMsg.emoji.NetSceneExchangeEmotionPack", "cdntra ERR_CNDCOM_MEDIA_IS_DOWNLOADING clientid:%s", g.this.hCY); g.g(g.this.lEs, 6, 0, g.this.hCY); } else if (i != 0) { x.e("MicroMsg.emoji.NetSceneExchangeEmotionPack", "download emoji pack failed. mProductId:%s:", g.this.lEs); g.g(g.this.lEs, -1, 0, g.this.hCY); } else if (keep_progressinfo != null) { if (keep_progressinfo.field_finishedLength == keep_progressinfo.field_toltalLength) { x.d("MicroMsg.emoji.NetSceneExchangeEmotionPack", "cdntra ignore progress 100%"); } else { x.d("MicroMsg.emoji.NetSceneExchangeEmotionPack", "cdntra progresscallback id:%s finish:%d total:%d", g.this.hCY, Integer.valueOf(keep_progressinfo.field_finishedLength), Integer.valueOf(keep_progressinfo.field_toltalLength)); if (!g.this.hpb) { g.g(g.this.lEs, 6, (int) ((((float) keep_progressinfo.field_finishedLength) / ((float) keep_progressinfo.field_toltalLength)) * 100.0f), g.this.hCY); } } } else if (keep_sceneresult != null) { com.tencent.mm.plugin.report.service.g.pWK.h(10625, Integer.valueOf(2), keep_sceneresult.field_fileId, g.this.lEs, keep_sceneresult.field_transInfo); if (keep_sceneresult.field_retCode != 0) { x.e("MicroMsg.emoji.NetSceneExchangeEmotionPack", "donwload emoji pack faild. ProductId:%s code:%d ", g.this.lEs, Integer.valueOf(keep_sceneresult.field_retCode)); g.g(g.this.lEs, -1, 0, g.this.hCY); } else { x.d("MicroMsg.emoji.NetSceneExchangeEmotionPack", "donwload emoji success."); try { c aBv = c.aBv(); String str2 = g.this.lEs; if (aBv.lBi != null && aBv.lBi.contains(str2)) { aBv.lBi.remove(str2); } EmojiLogic.a(g.this.lEs, g.this.lEt, g.this.lEx); i.aCl().lCw.doNotify(); g.g(g.this.lEs, 7, 100, g.this.hCY); File file = new File(com.tencent.mm.compatible.util.e.gJd + g.this.lEs); if (file.isFile() && file.exists()) { file.delete(); } g.ac(g.this.lEs, true); } catch (Exception e) { x.e("MicroMsg.emoji.NetSceneExchangeEmotionPack", "unzip emoji package Error." + bi.chl()); g.g(g.this.lEs, -1, 0, g.this.hCY); g.ac(g.this.lEs, false); return 0; } catch (OutOfMemoryError e2) { x.e("MicroMsg.emoji.NetSceneExchangeEmotionPack", "unzip emoji package Out Of Memory Error." + bi.chl()); g.g(g.this.lEs, -1, 0, g.this.hCY); g.ac(g.this.lEs, false); return 0; } } } return 0; } public final void a(String str, ByteArrayOutputStream byteArrayOutputStream) { } public final byte[] h(String str, byte[] bArr) { return null; } }; this.lEs = str; this.lEt = str3; this.lEu = str2; this.lEx = null; this.lEv = i; this.itU = i2; b.a aVar = new b.a(); aVar.hnT = new ti(); aVar.hnU = new tj(); aVar.uri = "/cgi-bin/micromsg-bin/exchangeemotionpack"; aVar.hnS = 423; aVar.hnV = com.tencent.mm.plugin.appbrand.jsapi.bio.face.c.CTRL_INDEX; aVar.hnW = 1000000213; this.gLB = aVar.Kf(); } public g(String str, String str2, String str3) { this(str, str2, str3, 0, 0); } public g(String str, String str2) { this(str, null, str2, 0, 0); } public g(String str) { this(str, null, "", 1, 0); } public g(String str, byte b) { this(str, null, "", 1, 1); } public final int getType() { return 423; } public final void a(int i, int i2, int i3, String str, q qVar, byte[] bArr) { x.d("MicroMsg.emoji.NetSceneExchangeEmotionPack", "onGYNetEnd ErrType:%d, errCode:%d, errMsg", Integer.valueOf(i2), Integer.valueOf(i3), str); if (i2 == 0 && i3 == 0) { if (this.itU == 0) { File file = new File(com.tencent.mm.compatible.util.e.gJd); if (!file.exists()) { file.mkdirs(); } long currentTimeMillis = System.currentTimeMillis(); StringBuilder stringBuilder = new StringBuilder(); as.Hm(); this.hCY = d.a("downzip", currentTimeMillis, stringBuilder.append(com.tencent.mm.y.c.Cn()).toString(), "emoji"); sp spVar = ((tj) this.gLB.hnR.hnY).wiu; com.tencent.mm.modelcdntran.i iVar = new com.tencent.mm.modelcdntran.i(); iVar.field_mediaId = this.hCY; iVar.field_fullpath = com.tencent.mm.compatible.util.e.gJd + this.lEs; iVar.field_fileType = com.tencent.mm.modelcdntran.b.MediaType_FILE; iVar.field_totalLen = spVar.wfl; iVar.field_aesKey = spVar.wgS; iVar.field_fileId = spVar.nlE; iVar.field_priority = com.tencent.mm.modelcdntran.b.htu; iVar.hve = this.lEw; iVar.field_needStorage = true; this.hpb = false; if (!com.tencent.mm.modelcdntran.g.MP().b(iVar, -1)) { x.e("MicroMsg.emoji.NetSceneExchangeEmotionPack", "add task failed:"); } } else { x.i("MicroMsg.emoji.NetSceneExchangeEmotionPack", "add custom emoji.need no download pack"); } this.gQm.a(i2, i3, str, this); as.CN().a(new k(this.lEs), 0); return; } this.gQm.a(i2, i3, str, this); g(this.lEs, -1, 0, this.hCY); } public final int a(com.tencent.mm.network.e eVar, e eVar2) { x.d("MicroMsg.emoji.NetSceneExchangeEmotionPack", "doScene"); this.gQm = eVar2; if (this.itU == 0) { g(this.lEs, 6, 0, this.hCY); } ti tiVar = (ti) this.gLB.hnQ.hnY; tiVar.vPI = this.lEs; tiVar.wis = this.lEu; tiVar.wit = this.lEv; tiVar.sfa = this.itU; return a(eVar, this.gLB, this); } static void g(String str, int i, int i2, String str2) { i.aCn().g(str, i, i2, str2); } protected final void cancel() { super.cancel(); this.hpb = true; } }
[ "denghailong@vargo.com.cn" ]
denghailong@vargo.com.cn
51550559c451cc2c4e8ab08a899f45dc4a76fcf0
b852c9d9cb1d479d009b80fe46f7434d4e0633a9
/launcher/src/main/java/com/changren/android/upgrade/util/FileUtils.java
ce11c88b1fe2d9c3f05b7aeb7e2565cb9410d920
[]
no_license
zhxk/Launcher
7d6a5f86538d40ae479e87365cf479c7692f68df
c5cc62c6982bcb49d2d5c46e89b04f69e9e1910b
refs/heads/master
2021-01-09T16:25:54.926949
2020-02-27T09:35:17
2020-02-27T09:35:17
242,371,268
0
0
null
null
null
null
UTF-8
Java
false
false
3,326
java
package com.changren.android.upgrade.util; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.Environment; import com.changren.android.launcher.util.LogUtils; import java.io.File; /** * Author: wangsy * Create: 2019-01-17 16:39 * Description: TODO(描述文件做什么) */ public class FileUtils { public static String getDownloadApkCachePath() { String appCachePath = null; if (checkSDCard()) { appCachePath = Environment.getExternalStorageDirectory() + "/Launcher/"; } else { appCachePath = Environment.getDataDirectory().getPath() + "/Launcher/"; } File file = new File(appCachePath); if (!file.exists()) { file.mkdirs(); } return appCachePath; } private static boolean checkSDCard() { return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED); } /** * 获取app缓存路径 * * @param context * @return */ public String getCachePath(Context context) { String cachePath; if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) || !Environment.isExternalStorageRemovable()) { //外部存储可用 cachePath = context.getExternalCacheDir().getPath(); } else { //外部存储不可用 cachePath = context.getCacheDir().getPath(); } return cachePath; } /** * * @param context * @param downloadPath apk的完整路径 * @param newestVersionCode 开发者认为的最新的版本号 * @return */ public static boolean checkAPKIsExists(Context context, String downloadPath, int newestVersionCode) { File file = new File(downloadPath); boolean result = false; if (file.exists()) { try { PackageManager pm = context.getPackageManager(); PackageInfo info = pm.getPackageArchiveInfo(downloadPath, PackageManager.GET_ACTIVITIES); int curVersionCode = DeviceUtils.getVersionCode(context); //判断安装包存在并且包名一样并且版本号不一样 LogUtils.e("本地安装包版本号:" + info.versionCode + "\n 当前app版本号:" + curVersionCode); if (context.getPackageName().equalsIgnoreCase(info.packageName) && curVersionCode != info.versionCode) { //判断开发者传入的最新版本号是否大于缓存包的版本号,大于那么相当于没有缓存 if (newestVersionCode > 0 && info.versionCode < newestVersionCode) { result = false; } else { result = true; } } } catch (Exception e) { result = false; } } return result; } public static void deleteApk(Context context, String downloadPath) { if (null == downloadPath) { return; } File downloadFile = new File(downloadPath); if (downloadFile.exists()) { downloadFile.delete(); } } }
[ "931767244@qq.com" ]
931767244@qq.com
973e9af23f8c32eeed9b6e230bccf322989367d4
60619cb2e41b978bf3c2f231b728ab2678124f1d
/gaibu-core/src/main/java/is/hello/gaibu/core/models/ExternalAuthorizationState.java
155c3721d5ef61ea626f60531069fe9365b5279c
[]
no_license
hello/gaibu
3457a14eb18ec57c5e90b058614c34734eea86c3
7cd320457c5b6d0927eb8aa19d9e52bdb29cb6fa
refs/heads/master
2021-03-27T17:17:26.984351
2017-05-03T21:50:40
2017-05-03T21:50:40
66,605,582
0
0
null
null
null
null
UTF-8
Java
false
false
3,091
java
package is.hello.gaibu.core.models; import com.google.common.base.Objects; import com.google.common.base.Preconditions; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import java.util.UUID; public class ExternalAuthorizationState { @JsonProperty("auth_state") public final UUID authState; @JsonIgnore public final DateTime createdAt; @JsonProperty("device_id") final public String deviceId; @JsonIgnore public final Long appId; public ExternalAuthorizationState( final UUID authState, final DateTime createdAt, final String deviceId, final Long appId) { Preconditions.checkNotNull(authState, "authState can not be null"); Preconditions.checkNotNull(createdAt, "createdAt can not be null"); Preconditions.checkNotNull(deviceId, "deviceId can not be null"); Preconditions.checkNotNull(appId, "appId can not be null"); this.authState = authState; this.createdAt = createdAt; this.deviceId = deviceId; this.appId = appId; } public static class Builder { private UUID authState; private DateTime createdAt; private String deviceId; private Long appId; public Builder() { createdAt = DateTime.now(DateTimeZone.UTC); } public Builder withAuthState(final UUID authState) { this.authState = authState; return this; } public Builder withCreatedAt(final DateTime createdAt) { this.createdAt = createdAt; return this; } public Builder withDeviceId(final String deviceId) { this.deviceId = deviceId; return this; } public Builder withAppId(final Long appId) { this.appId = appId; return this; } public ExternalAuthorizationState build() { return new ExternalAuthorizationState(authState, createdAt, deviceId, appId); } } @Override public int hashCode() { return Objects.hashCode(authState, deviceId, appId); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; final ExternalAuthorizationState that = (ExternalAuthorizationState) o; return Objects.equal(this.authState, that.authState) && Objects.equal(this.createdAt, that.createdAt) && Objects.equal(this.deviceId, that.deviceId) && Objects.equal(this.appId, that.appId); } @Override public String toString() { return Objects.toStringHelper(ExternalAuthorizationState.class) .add("authState", authState) .add("created_at", createdAt) .add("device_id", deviceId) .add("app_id", appId) .toString(); } }
[ "josef@sayhello.com" ]
josef@sayhello.com
916b29fe07485699a5f10543fc64513eb93f4598
eaff7d750adcfb6a86c5a37a39ffae7de1c03ee4
/spring-boot-data-aggregator-example/src/test/java/io/github/lvyahui8/spring/example/DataBeanAggregateQueryFacadeTest.java
0f701c6cb5e56d9ca2be59db630721658006bb2a
[ "Apache-2.0" ]
permissive
apple006/spring-boot-data-aggregator
26dea164c960f60398eff1b9b5344e19d122bdeb
3f083eca84bce1b3346e8d4e0c318602a6c05e73
refs/heads/master
2020-06-18T08:23:27.075754
2019-07-10T14:22:32
2019-07-10T14:22:32
196,231,288
1
0
null
2019-07-10T15:31:44
2019-07-10T15:31:44
null
UTF-8
Java
false
false
1,763
java
package io.github.lvyahui8.spring.example; import io.github.lvyahui8.spring.aggregate.facade.DataBeanAggregateQueryFacade; import io.github.lvyahui8.spring.autoconfigure.BeanAggregateProperties; import io.github.lvyahui8.spring.example.model.User; import lombok.extern.slf4j.Slf4j; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.util.Assert; import java.util.Collections; /** * @author lvyahui (lvyahui8@gmail.com,lvyahui8@126.com) * @since 2019/6/16 0:07 */ @RunWith(SpringRunner.class) @SpringBootTest @Slf4j public class DataBeanAggregateQueryFacadeTest { @Autowired private DataBeanAggregateQueryFacade dataBeanAggregateQueryFacade; @Autowired private BeanAggregateProperties beanAggregateProperties; @Test public void testExceptionProcessing() throws Exception { boolean success = false; if(! beanAggregateProperties.isIgnoreException()) { try { dataBeanAggregateQueryFacade.get("userWithPosts", Collections.singletonMap("userId", 0L), User.class); } catch (Exception e) { log.info("default settings is SUSPEND, catch an exception: {}",e.getMessage(),e); success = true; } } else { User user = dataBeanAggregateQueryFacade.get("userWithPosts", Collections.singletonMap("userId", 0L), User.class); System.out.println(user); success = true; } Assert.isTrue(success,"exception handle success"); } }
[ "lvyahui8@126.com" ]
lvyahui8@126.com
1cd61f977c01c3f7f26963c792777dd08d34332d
533173cfd3834bf73ece2d3926f7f38a8c16adbd
/app/src/main/java/com/example/geniuscredit1/rejectedrequest.java
2f0aed59bec6d74b7addff41792708a143c02e17
[]
no_license
anujkaushik1/Genius-Credit-Defaulter-Application
ec8b7dd6b9f62d645d5bb43dd68006d70cb951dd
2971035052dc3b821ff549a446a0e10a8b1a97db
refs/heads/master
2023-01-21T20:31:49.182449
2020-11-26T06:56:19
2020-11-26T06:56:19
316,146,251
1
0
null
null
null
null
UTF-8
Java
false
false
10,455
java
package com.example.geniuscredit1; import android.app.AlertDialog; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.cardview.widget.CardView; import androidx.fragment.app.Fragment; import androidx.navigation.Navigation; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.os.Handler; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.Query; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; /** * A simple {@link Fragment} subclass. * Use the {@link rejectedrequest#newInstance} factory method to * create an instance of this fragment. */ public class rejectedrequest extends Fragment { static String submittedby; String newsubmittedby; static String profileemail; String fetchedgstnumber,fetchedtradename,fetcheduniqueid,fetcheddueamount,fetcheddefaultersubmitteddate,fetchedbalance,fetchedstatus,fetchedadmincomment; String address,city,date,email,legalname,mobilenumber,naturebusiness,state,statejuri,legalcase,duedate; CardView nodataavailable; RecyclerView recyclerView; ArrayList<String> recyclersubmittedby= new ArrayList<>(); ArrayList<String> recyclergstnumber = new ArrayList<>(); ArrayList<String> recyclertradename = new ArrayList<>(); ArrayList<String> recycleruniqueid = new ArrayList<>(); ArrayList<String> recyclerdueamount = new ArrayList<>(); ArrayList<String> recyclerdefaultersubmitteddate = new ArrayList<>(); ArrayList<String> recyclerbalance = new ArrayList<>(); ArrayList<String> recyclerstatus = new ArrayList<>(); ArrayList<String> recycleradmincomment = new ArrayList<>(); ArrayList<String> recycleraddress = new ArrayList<>(); ArrayList<String> recyclercity = new ArrayList<>(); ArrayList<String> recyclerdate = new ArrayList<>(); ArrayList<String> recycleremail = new ArrayList<>(); ArrayList<String> recyclerlegalname = new ArrayList<>(); ArrayList<String> recyclermobilenumber = new ArrayList<>(); ArrayList<String> recyclernaturebusiness = new ArrayList<>(); ArrayList<String> recyclerstate = new ArrayList<>(); ArrayList<String> recyclerstatejuri = new ArrayList<>(); ArrayList<String> recyclerlegalcase = new ArrayList<>(); ArrayList<String> recyclerduedate = new ArrayList<>(); // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; public rejectedrequest() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment rejectedrequest. */ // TODO: Rename and change types and number of parameters public static rejectedrequest newInstance(String param1, String param2) { rejectedrequest fragment = new rejectedrequest(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { navigationdrawer navigationdrawer = (com.example.geniuscredit1.navigationdrawer)getActivity(); profileemail=navigationdrawer.getemail(); return inflater.inflate(R.layout.fragment_rejectedrequest, container, false); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); recyclerView=(RecyclerView)view.findViewById(R.id.recyclerview); nodataavailable=(CardView)view.findViewById(R.id.cardviewnodataavailable); nodataavailable.setVisibility(View.VISIBLE); final AlertDialog.Builder alert = new AlertDialog.Builder(getActivity()); View view1 = getLayoutInflater().inflate(R.layout.loadingalertdialog, null); alert.setView(view1); final AlertDialog alertDialog = alert.create(); alertDialog.show(); alertDialog.setCanceledOnTouchOutside(false); new Handler().postDelayed(new Runnable() { @Override public void run() { alertDialog.dismiss(); legalname(); } }, 1500); } public void legalname(){ try{ } catch (Exception e) { e.printStackTrace(); } Query query = FirebaseDatabase.getInstance().getReference().child("Company").orderByChild("Email").equalTo(profileemail); query.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()) { signupmodel model = dataSnapshot1.getValue(signupmodel.class); submittedby=model.getLegalName(); } rejectrequest(); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } public void rejectrequest(){ try { DatabaseReference query = FirebaseDatabase.getInstance().getReference().child("Rejected Request").child(submittedby); query.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { for(DataSnapshot dataSnapshot1: dataSnapshot.getChildren()){ signupmodel model = dataSnapshot1.getValue(signupmodel.class); newsubmittedby = model.getSubmittedBy(); fetchedgstnumber=model.getGSTNumber(); fetchedtradename=model.getTradeName(); fetcheduniqueid=model.getUdin(); fetcheddueamount=model.getAmount(); fetcheddefaultersubmitteddate=model.getDefaulterSubmittedDate(); fetchedbalance=model.getAmount(); fetchedstatus=model.getStatus(); fetchedadmincomment=model.getAdminComment(); address=model.getAddress(); city=model.getCity(); date=model.getDefaulterSubmittedDate(); email=model.getEmail(); legalname=model.getLegalName(); mobilenumber=model.getMobileNumber(); naturebusiness=model.getBusinessCategory(); state=model.getState(); statejuri=model.getStateJurisdiction(); legalcase=model.getLegalCase(); duedate=model.getDueDate(); recyclersubmittedby.add(newsubmittedby); recyclergstnumber.add(fetchedgstnumber); recyclertradename.add(fetchedtradename); recycleruniqueid.add(fetcheduniqueid); recyclerdueamount.add(fetcheddueamount); recyclerdefaultersubmitteddate.add(fetcheddefaultersubmitteddate); recyclerbalance.add(fetchedbalance); recyclerstatus.add(fetchedstatus); recycleradmincomment.add(fetchedadmincomment); recycleraddress.add(address); recyclercity.add(city); recyclerdate.add(date); recycleremail.add(email); recyclerlegalname.add(legalname); recyclermobilenumber.add(mobilenumber); recyclernaturebusiness.add(naturebusiness); recyclerstate.add(state); recyclerstatejuri.add(statejuri); recyclerlegalcase.add(legalcase); recyclerduedate.add(duedate); if(newsubmittedby!=null){ nodataavailable.setVisibility(View.GONE); sendingdatatorecyclerview(); } } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { Toast toast = Toast.makeText(getActivity(),databaseError.getMessage(),Toast.LENGTH_LONG); toast.show(); System.out.println(databaseError.getMessage()); } }); } catch (Exception e) { System.out.println(e.getMessage()); } } public void sendingdatatorecyclerview(){ recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); recyclerView.setAdapter(new rejectedrequestrecyclerview(getActivity(),recyclersubmittedby,recyclergstnumber,recyclertradename,recycleruniqueid,recyclerdueamount,recyclerdefaultersubmitteddate,recyclerbalance,recyclerstatus,recycleradmincomment,recycleraddress,recyclercity,recyclerdate,recycleremail,recyclerlegalname,recyclermobilenumber,recyclernaturebusiness,recyclerstate,recyclerstatejuri,recyclerlegalcase,recyclerduedate)); } }
[ "anujkaushik1512@gmail.com" ]
anujkaushik1512@gmail.com
ebbea496a4dce043c407ed78f9ff809c01249fbf
c1950573fe81f0fe9db377085edec109dc1b3992
/src/com/ly/yida/view/ClearEditText.java
def476cb08fb4a077c833ed7892abe73fa5dc4b7
[]
no_license
magichill33/yida
81f497b7c87569ce7b01af33cfcf459db309ac23
9ad351dc2f1e05de44e818a64d811dc80fc1be28
refs/heads/master
2016-08-04T08:00:53.120710
2015-06-08T15:18:50
2015-06-08T15:18:50
37,019,210
0
0
null
null
null
null
GB18030
Java
false
false
4,610
java
package com.ly.yida.view; import com.ly.yida.R; import android.content.Context; import android.graphics.drawable.Drawable; import android.text.Editable; import android.text.TextWatcher; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.view.View.OnFocusChangeListener; import android.view.animation.Animation; import android.view.animation.CycleInterpolator; import android.view.animation.TranslateAnimation; import android.widget.EditText; public class ClearEditText extends EditText implements OnFocusChangeListener, TextWatcher { /** * 删除按钮的引用 */ private Drawable mClearDrawable; /** * 控件是否有焦点 */ private boolean hasFoucs; public ClearEditText(Context context) { this(context, null); } public ClearEditText(Context context, AttributeSet attrs) { //这里构造方法也很重要,不加这个很多属性不能再XML里面定义 this(context, attrs, android.R.attr.editTextStyle); } public ClearEditText(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); } private void init() { //获取EditText的DrawableRight,假如没有设置我们就使用默认的图片 mClearDrawable = getCompoundDrawables()[2]; if (mClearDrawable == null) { // throw new NullPointerException("You can add drawableRight attribute in XML"); mClearDrawable = getResources().getDrawable(R.drawable.delete_selector); } mClearDrawable.setBounds(0, 0, mClearDrawable.getIntrinsicWidth(), mClearDrawable.getIntrinsicHeight()); //默认设置隐藏图标 setClearIconVisible(false); //设置焦点改变的监听 setOnFocusChangeListener(this); //设置输入框里面内容发生改变的监听 addTextChangedListener(this); } /** * 因为我们不能直接给EditText设置点击事件,所以我们用记住我们按下的位置来模拟点击事件 * 当我们按下的位置 在 EditText的宽度 - 图标到控件右边的间距 - 图标的宽度 和 * EditText的宽度 - 图标到控件右边的间距之间我们就算点击了图标,竖直方向就没有考虑 */ @Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_UP) { if (getCompoundDrawables()[2] != null) { boolean touchable = event.getX() > (getWidth() - getTotalPaddingRight()) && (event.getX() < ((getWidth() - getPaddingRight()))); if (touchable) { this.setText(""); } } } return super.onTouchEvent(event); } /** * 当ClearEditText焦点发生变化的时候,判断里面字符串长度设置清除图标的显示与隐藏 */ @Override public void onFocusChange(View v, boolean hasFocus) { this.hasFoucs = hasFocus; if (hasFocus) { setClearIconVisible(getText().length() > 0); } else { setClearIconVisible(false); } } /** * 设置清除图标的显示与隐藏,调用setCompoundDrawables为EditText绘制上去 * @param visible */ protected void setClearIconVisible(boolean visible) { Drawable right = visible ? mClearDrawable : null; setCompoundDrawables(getCompoundDrawables()[0], getCompoundDrawables()[1], right, getCompoundDrawables()[3]); } /** * 当输入框里面内容发生变化的时候回调的方法 */ @Override public void onTextChanged(CharSequence s, int start, int count, int after) { if(hasFoucs){ setClearIconVisible(s.length() > 0); } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } /** * 设置晃动动画 */ public void setShakeAnimation(){ this.setAnimation(shakeAnimation(5)); } /** * 晃动动画 * @param counts 1秒钟晃动多少下 * @return */ public static Animation shakeAnimation(int counts){ Animation translateAnimation = new TranslateAnimation(0, 10, 0, 0); translateAnimation.setInterpolator(new CycleInterpolator(counts)); translateAnimation.setDuration(1000); return translateAnimation; } }
[ "986417576@qq.com" ]
986417576@qq.com
7db1cf2ca45ce6d72ac7f1f48c4992466c22d3d4
c6ca27900fd5e70f6f6d623938f915916b91e42d
/app/src/androidTest/java/com/example/nombu/myplaces/ExampleInstrumentedTest.java
25204db5814645e0784f7098712f1f8e6360223f
[]
no_license
nombumurage/myPlaces
ce705325328807391889d1c0bb3fafb9d8e2bf2d
a5385ed67f6dfc1c7ed33773afa5800ebc38b868
refs/heads/master
2021-01-22T20:13:18.227802
2017-03-17T15:47:45
2017-03-17T15:47:45
85,297,135
1
0
null
null
null
null
UTF-8
Java
false
false
756
java
package com.example.nombu.myplaces; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.nombu.myplaces", appContext.getPackageName()); } }
[ "nombumurage@gmail.com" ]
nombumurage@gmail.com
06f7d158cd9c7e36e067e42290d8536d4370c56d
5adf5d08f40dc3b9f7769d677536d897cfa4c027
/org.mmisw.orrportal/src/org/mmisw/orrportal/gwt/client/voc2rdf/VocabClassPanel.java
f667a30b412baef71c061a4aad862e6d88aaa769
[]
no_license
ESIPFed/mmiorr
e4e419f3b5361139dff0ba3ff68f501fc6817d89
1bbfb225672c7e799b1c9e2eb3cfde07619ddbcd
refs/heads/master
2021-01-15T09:43:33.216867
2015-05-29T04:34:08
2015-05-29T04:34:08
36,482,272
3
0
null
2015-05-29T04:22:46
2015-05-29T04:22:45
null
UTF-8
Java
false
false
21,112
java
package org.mmisw.orrportal.gwt.client.voc2rdf; import java.util.HashMap; import java.util.List; import java.util.Map; import org.mmisw.orrclient.gwt.client.rpc.ClassInfo; import org.mmisw.orrclient.gwt.client.rpc.VocabularyDataCreationInfo; import org.mmisw.orrclient.gwt.client.rpc.VocabularyOntologyData.ClassData; import org.mmisw.orrportal.gwt.client.portal.BaseOntologyContentsPanel; import org.mmisw.orrportal.gwt.client.portal.IVocabPanel; import org.mmisw.orrportal.gwt.client.util.MyDialog; import org.mmisw.orrportal.gwt.client.util.OrrUtil; import org.mmisw.orrportal.gwt.client.util.StatusPopup; import org.mmisw.orrportal.gwt.client.util.TLabel; import org.mmisw.orrportal.gwt.client.util.table.IRow; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.DeferredCommand; import com.google.gwt.user.client.IncrementalCommand; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.CellPanel; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.DockPanel; import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.HasVerticalAlignment; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.KeyboardListener; import com.google.gwt.user.client.ui.KeyboardListenerAdapter; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.MenuBar; import com.google.gwt.user.client.ui.MenuItem; import com.google.gwt.user.client.ui.PopupPanel; import com.google.gwt.user.client.ui.PushButton; import com.google.gwt.user.client.ui.RadioButton; import com.google.gwt.user.client.ui.ScrollPanel; import com.google.gwt.user.client.ui.TextArea; import com.google.gwt.user.client.ui.TextBoxBase; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; /** * Panel for showing/capturing the definition of a class of terms in a vocabulary. * * <p> * Adapted (simplified) from ClassPanel * * @author Carlos Rueda */ public class VocabClassPanel extends BaseOntologyContentsPanel implements TermTableInterface { private static final String CLASS_TOOTIP = "The class for the terms defined in this vocabulary; should be a singular noun. " + "Each term is considered an instance of this class; for example, if the selected class is Parameter, " + "each term is considered a Parameter. Terms from several controlled vocabularies are provided as " + "possible sources of the 'Class' for the ontology; if you want to select another term not in one " + "of these vocabularies, talk to MMI folks about how to make this change. " + "(It involves editing the resulting ontology.)"; // TODO do we still want the classUri? // private static final String CLASS_URI_TOOTIP = // "Ideally the class is selected from, and described in, a controlled vocabulary with URIs " + // "defined. If so, enter the URI naming the term in this field. " + // "If the term is in a controlled vocabulary but does not have its own URI, enter the " + // "controlled vocabulary URI. Otherwise, leave this field blank."; private static final String CONTENTS_DEFAULT = "name,description\n" + " , \n" ; private static final String CLASS_NAME_EXAMPLE = "MyParameter"; private static final String CONTENTS_EXAMPLE = "name,description,comment\n" + "sea surface salinity, sea water salinity, salinity at the sea surface (above 3m.)\n" + "sst, water temperature, temperature at the sea surface (above 3m.)\n" + "depth, measurement depth, derived from pressure\n" ; // private static final String INTRO = // "The class refers to the main theme associated with your vocabulary. " + // "Each term is considered an instance of this class. " + // "The terms are the 'words' (concepts, labels, unique IDs or code, or similar unique tags) of your vocabulary. " + // "Click the cells of the table for editing the contents. " + // "The CSV button display the contents of the table in CSV format allowing direct editing on the text format. " // ; private VerticalPanel widget = new VerticalPanel(); private CellPanel contentsContainer = new VerticalPanel(); private TextBoxBase classNameTextBox; private final StatusPopup statusPopup = new StatusPopup("250px", false); private final boolean useTableScroll = false; private ScrollPanel tableScroll = useTableScroll ? new ScrollPanel() : null; private TermTable termTable; private PushButton importCsvButton; private PushButton exportCsvButton; private IVocabPanel vocabPanel; private final ClassData classData; private HorizontalPanel classNamePanel; public VocabClassPanel(ClassData classData, IVocabPanel vocabPanel, boolean readOnly) { super(readOnly); this.classData = classData; this.vocabPanel = vocabPanel; widget.setWidth("100%"); widget.add(createForm()); updateContents(CONTENTS_DEFAULT); } public void setReadOnly(boolean readOnly) { if ( isReadOnly() == readOnly ) { return; } super.setReadOnly(readOnly); prepareClassNamePanel(classNamePanel); termTable.setReadOnly(readOnly); } private String getClassNameFromClassData() { String classUri = classData.getClassUri(); ClassInfo classInfo = classData.getClassInfo(); String className; if ( classInfo != null ) { className = classInfo.getLocalName(); } else { // should not happen; extract simple name for URI? For now, just use the whole URI: className = classUri; } return className; } private HorizontalPanel createClassNamePanel() { HorizontalPanel classNamePanel = new HorizontalPanel(); classNamePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); prepareClassNamePanel(classNamePanel); return classNamePanel; } private void prepareClassNamePanel(HorizontalPanel classNamePanel) { String label = "Class name"; String tooltip = "<b>" +label+ "</b>:<br/>" +CLASS_TOOTIP; String className = getClassNameFromClassData(); classNamePanel.clear(); classNamePanel.add(new TLabel(label, !isReadOnly(), tooltip)); if ( isReadOnly() ) { Label lbl = new Label(className); lbl.setTitle(classData.getClassUri()); classNamePanel.add(lbl); } else { classNameTextBox = OrrUtil.createTextBoxBase(1, "300", null); classNameTextBox.setText(className); classNamePanel.add(classNameTextBox); } } /** * Creates the main form */ private Widget createForm() { // contentsContainer.setBorderWidth(1); if ( useTableScroll ) { tableScroll.setSize("1000", "180"); } FlexTable flexPanel = new FlexTable(); // flexPanel.setBorderWidth(1); // flexPanel.setWidth("850"); flexPanel.setWidth("100%"); int row = 0; // general information // HTML infoLabel = new HTML(INTRO); // flexPanel.getFlexCellFormatter().setColSpan(row, 0, 4); // flexPanel.setWidget(row, 0, infoLabel); // flexPanel.getFlexCellFormatter().setAlignment(row, 0, // HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_MIDDLE // ); // row++; classNamePanel = createClassNamePanel(); flexPanel.getFlexCellFormatter().setColSpan(row, 0, 3); flexPanel.setWidget(row, 0, classNamePanel); // flexPanel.setWidget(row, 0, new TLabel(label, true, tooltip)); flexPanel.getFlexCellFormatter().setAlignment(row, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_MIDDLE ); row++; if ( useTableScroll ) { contentsContainer.add(tableScroll); } if ( true ) { VerticalPanel vp = new VerticalPanel(); // vp.setBorderWidth(1); vp.setWidth("100%"); vp.add(flexPanel); vp.add(contentsContainer); return vp; } else { flexPanel.getFlexCellFormatter().setColSpan(row, 0, 4); flexPanel.setWidget(row, 0, contentsContainer); flexPanel.getFlexCellFormatter().setAlignment(row, 0, HasHorizontalAlignment.ALIGN_LEFT, HasVerticalAlignment.ALIGN_MIDDLE ); row++; return flexPanel; } } // private CellPanel _createCsvButtons() { // CellPanel panel = new HorizontalPanel(); // panel.setSpacing(2); // // importCsvButton = new PushButton("Import", new ClickListener() { // public void onClick(Widget sender) { // dispatchImportAction(); // } // }); // importCsvButton.setTitle("Import contents in CSV format"); // panel.add(importCsvButton); // // exportCsvButton = new PushButton("Export", new ClickListener() { // public void onClick(Widget sender) { // exportContents(); // } // }); // exportCsvButton.setTitle("Exports the contents in a CSV format"); // panel.add(exportCsvButton); // // return panel; // } // public void dispatchTableMenu(int left, int top) { MenuBar menu = new MenuBar(true); final PopupPanel menuPopup = new PopupPanel(true); menu.addItem(new MenuItem("Import...", new Command() { public void execute() { menuPopup.hide(); dispatchImportAction(); } })); menu.addItem(new MenuItem("Export...", new Command() { public void execute() { menuPopup.hide(); exportContents(); } })); menuPopup.setWidget(menu); menuPopup.setPopupPosition(left, top); menuPopup.show(); } String getClassName() { String primaryClass = classNameTextBox.getText().trim(); return primaryClass; } public String checkData(boolean isNewVersion) { // isNewVersion: ignored -- param introduced later on String primaryClass = getClassName(); if ( primaryClass.length() == 0 ) { return "Please, select a class for the terms in your vocabulary"; } // TODO do we still want the classUri ? // String classUri = resourceTypeWidget.getRelatedValue().trim(); // if ( classUri.length() > 0 ) { // values.put("classUri", classUri); // } CheckError error = termTable.check(); if ( error != null ) { return error.toString(); } return null; } /** * * @param contents */ private void updateContents(String contents) { StringBuffer errorMsg = new StringBuffer(); TermTable tt = TermTableCreator.createTermTable(this, ',', contents, false, errorMsg); if ( errorMsg.length() > 0 ) { // statusLabel.setHTML("<font color=\"red\">" +errorMsg+ "</font>"); return; } // OK: termTable = tt; if ( useTableScroll ) { tableScroll.setWidget(termTable); termTable.setScrollPanel(tableScroll); } else { contentsContainer.clear(); contentsContainer.add(termTable); } } void reset() { // statusLabel.setText(""); if ( classNameTextBox != null ) { classNameTextBox.setText(""); } updateContents(CONTENTS_DEFAULT); } private void insertTermTable() { if ( useTableScroll ) { tableScroll.setWidget(termTable); termTable.setScrollPanel(tableScroll); } else { contentsContainer.clear(); contentsContainer.add(termTable); } } /** * Incremental command to create the resulting table. */ private class ImportCommand implements IncrementalCommand { private static final int rowIncrement = 34; private char separator; private String text; // private TermTable incrTermTable; private boolean firstStep = true; private int numHeaderCols; private String[] lines; private int rowInTermTable = -1; private int currFromRow; private boolean preDone; ImportCommand(char separator, String text) { assert text.length() > 0; this.separator = separator; this.text = text; } public boolean execute() { if ( preDone ) { done(); return false; } if ( firstStep ) { // if ( incrTermTable == null ) { firstStep = false; lines = text.split("\n|\r\n|\r"); if ( lines.length == 0 || lines[0].trim().length() == 0 ) { // A 1-column table to allow the user to insert columns (make column menu will be available) // incrTermTable = termTable = new TermTable(VocabClassPanel.this, 1, false); insertTermTable(); preDone(); return true; } List<String> headerCols = TermTableCreator.parseLine(lines[0], separator); numHeaderCols = headerCols.size(); // incrTermTable = termTable = new TermTable(VocabClassPanel.this, numHeaderCols, isReadOnly()); // header: for ( int c = 0; c < numHeaderCols; c++ ) { String str = headerCols.get(c).trim(); // incrTermTable. termTable.setHeader(c, str); } insertTermTable(); if ( lines.length == 1 ) { preDone(); return true; } rowInTermTable = -1; currFromRow = 1; } // add a chunk of rows: if ( _addRows(currFromRow, currFromRow + rowIncrement) ) { preDone(); } else { updateStatus(); currFromRow += rowIncrement; } return true; } private void updateStatus() { statusPopup.setStatus("Preparing ... (" +(1+rowInTermTable)+ ")"); } private void preDone() { updateStatus(); preDone = true; // termTable = incrTermTable; } private void done() { // insertTermTable(); statusPopup.hide(); vocabPanel.statusPanelsetWaiting(false); vocabPanel.statusPanelsetHtml(""); vocabPanel.enable(true); } private boolean _addRows(int fromRow, int toRow) { int rr = fromRow; for ( ; rr < lines.length && rr < toRow; rr++ ) { List<String> cols = TermTableCreator.parseLine(lines[rr], separator); final int numCols = cols.size(); // skip empty line boolean empty = true; for ( int c = 0; empty && c < numCols; c++ ) { String str = cols.get(c).trim(); if ( str.length() > 0 ) { empty = false; } } if ( empty ) { continue; } rowInTermTable++; // incrTermTable. termTable.addRow(numCols); for ( int c = 0; c < numCols; c++ ) { String str = cols.get(c).trim(); // incrTermTable. termTable.setCell(rowInTermTable, c, str); } // any missing columns? if ( numCols < numHeaderCols ) { for ( int c = numCols; c < numHeaderCols; c++ ) { // incrTermTable. termTable.setCell(rowInTermTable, c, ""); } } } return rr >= lines.length; // DONE } } private void dispatchImportAction() { final MyDialog popup = new MyDialog(null) { public boolean onKeyUpPreview(char key, int modifiers) { // avoid ENTER close the popup if ( key == KeyboardListener.KEY_ESCAPE ) { hide(); return false; } return true; } }; popup.setText("Import terms"); final TextArea textArea = popup.addTextArea(null); textArea.setReadOnly(false); textArea.setSize("800", "270"); VerticalPanel vp = new VerticalPanel(); vp.setSpacing(10); popup.getDockPanel().add(vp, DockPanel.NORTH); vp.add(new HTML( "Select the separator character, insert the new contents into the text area, " + "and click the \"Import\" button to update the table." ) ); final SeparatorPanel separatorPanel = new SeparatorPanel(); vp.add(separatorPanel); final HTML status = new HTML(""); textArea.addKeyboardListener(new KeyboardListenerAdapter(){ public void onKeyUp(Widget sender, char keyCode, int modifiers) { status.setText(""); } }); PushButton importButton = new PushButton("Import", new ClickListener() { public void onClick(Widget sender) { final String text = textArea.getText().trim(); if ( text.length() == 0 ) { status.setHTML("<font color=\"red\">Empty contents</font>"); return; } if ( ! Window.confirm("This action will update the term table. (Previous contents will be discarded.)") ) { return; } popup.hide(); importContents(separatorPanel.getSelectedSeparator().charAt(0), text); } }); popup.getButtonsPanel().insert(importButton, 0); popup.getButtonsPanel().insert(status, 0); popup.center(); popup.show(); } /** * Imports the given text into the term table. * @param separator * @param text */ public void importContents(List<String> headerCols, List<IRow> rows) { IncrementalCommand incrCommand = createImportContentsCommand(headerCols, rows); DeferredCommand.addCommand(incrCommand); } private IncrementalCommand createImportContentsCommand(final List<String> headerCols, List<IRow> rows) { String statusMsg = "Starting ..."; statusPopup.show(0, 0); // TODO locate statusPopup statusPopup.setStatus(statusMsg); int numHeaderCols = headerCols.size(); termTable = new TermTable(this, numHeaderCols, isReadOnly()); vocabPanel.statusPanelsetWaiting(true); vocabPanel.statusPanelsetHtml(statusMsg); vocabPanel.enable(false); // header: for ( int c = 0; c < numHeaderCols; c++ ) { String str = headerCols.get(c).trim(); // incrTermTable. termTable.setHeader(c, str); } insertTermTable(); final IncrementalCommand incrCommand = new PopulateTermTableCommand(termTable, rows ) { @Override boolean start() { return true; } @Override void done() { statusPopup.hide(); vocabPanel.statusPanelsetWaiting(false); vocabPanel.statusPanelsetHtml(""); vocabPanel.enable(true); } @Override boolean updateStatus() { statusPopup.setStatus(termTable.getNumRows()+ ""); return ! cancelRequested(); } }; return incrCommand; } /** * Imports the given text into the term table. * @param separator * @param text */ public void importContents(char separator, String text) { String statusMsg = "Importing ..."; statusPopup.show(0, 0); // TODO locate statusPopup statusPopup.setStatus(statusMsg); // if using tableScroll // tableScroll.setWidget(statusHtml); termTable = null; vocabPanel.statusPanelsetWaiting(true); vocabPanel.statusPanelsetHtml(statusMsg); vocabPanel.enable(false); final IncrementalCommand incrCommand = new ImportCommand(separator, text); // the timer is to give a chance for pending UI changes to be reflected (eg., a popup to disappear) new Timer() { public void run() { DeferredCommand.addCommand(incrCommand); } }.schedule(1000); } /** * Dispatches the "export" action. */ private void exportContents() { final MyDialog popup = new MyDialog(null) { public boolean onKeyUpPreview(char key, int modifiers) { // avoid ENTER close the popup if ( key == KeyboardListener.KEY_ESCAPE ) { hide(); return false; } return true; } }; popup.setText("Table of terms in CSV format"); final TextArea textArea = popup.addTextArea(null); textArea.setReadOnly(true); textArea.setText(termTable.getCsv(null, ",")); textArea.setSize("800", "270"); VerticalPanel vp = new VerticalPanel(); vp.setSpacing(10); popup.getDockPanel().add(vp, DockPanel.NORTH); vp.add(new HTML( "Select the separator character for your CSV formatted contents. " ) ); CellPanel separatorPanel = new SeparatorPanel() { public void onClick(Widget sender) { super.onClick(sender); textArea.setText(termTable.getCsv(null, getSelectedSeparator())); } }; vp.add(separatorPanel); popup.center(); popup.show(); } /** Helper class to capture desired separator for CSV contents */ private static class SeparatorPanel extends HorizontalPanel implements ClickListener { private String selectedOption; // option -> separator private Map<String,String> optionSeparatorMap= new HashMap<String,String>(); SeparatorPanel() { super(); this.add(new Label("Separator:")); String[] separators = { // label, separator "Comma (,)", ",", "Semi-colon (;)", ";", "Tab", "\t", "Vertical bar (|)", "|", }; for (int i = 0; i < separators.length; i += 2 ) { String label = separators[i]; String separator = separators[i + 1]; optionSeparatorMap.put(label, separator); RadioButton rb = new RadioButton("separator", label); if ( i == 0 ) { rb.setChecked(true); selectedOption = label; } rb.addClickListener(this); this.add(rb); } } public void onClick(Widget sender) { RadioButton rb = (RadioButton) sender; selectedOption = rb.getText(); } String getSelectedSeparator() { return optionSeparatorMap.get(selectedOption); } } void example() { // statusLabel.setText(""); if ( classNameTextBox != null ) { classNameTextBox.setText(CLASS_NAME_EXAMPLE); } updateContents(CONTENTS_EXAMPLE); } void enable(boolean enabled) { if ( classNameTextBox != null ) { classNameTextBox.setReadOnly(!enabled); } importCsvButton.setEnabled(enabled); exportCsvButton.setEnabled(enabled); } public Widget getWidget() { return widget; } public VocabularyDataCreationInfo getCreateOntologyInfo() { VocabularyDataCreationInfo cvi = new VocabularyDataCreationInfo(); cvi.setClassName(getClassName()); cvi.setColNames(termTable.getHeaderCols()); cvi.setRows(termTable.getRows()); return cvi; } }
[ "carueda@gmail.com" ]
carueda@gmail.com
de827a64a766ee5bd522538e8f314d779c86b9e3
618ae58cd48381cc91726488367ba23a7e3ec2d9
/app/src/main/java/com/example/b10626/myapplication/Indicator.java
ce9317a188f9120d89aee40cb1c36117640cdada
[]
no_license
cksgh1539/MyApplication
e744de70014b27602a8c06ebe8d708fbad7dbdf6
9a3d518aedf9365b3c21f16b7f8f49ae81915794
refs/heads/master
2020-03-06T23:01:50.616272
2018-12-25T05:35:34
2018-12-25T05:35:34
127,121,231
0
0
null
null
null
null
UTF-8
Java
false
false
3,946
java
package com.example.b10626.myapplication; import android.content.Context; import android.util.AttributeSet; import android.view.Gravity; import android.view.View; import android.view.animation.Animation; import android.view.animation.ScaleAnimation; import android.widget.ImageView; import android.widget.LinearLayout; /** * Created by hp on 2018-05-24. */ public class Indicator extends LinearLayout { private Context mContext; //원 사이의 간격 private int itemMargin = 10; //애니메이션 시간 private int animDuration = 250; private int mDefaultCircle; private int mSelectCircle; private ImageView[] imageDot; public void setAnimDuration(int animDuration) { this.animDuration = animDuration; } public void setItemMargin(int itemMargin) { this.itemMargin = itemMargin; } public Indicator(Context context) { super(context); mContext = context; } public Indicator(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; } /** * 기본 점 생성 * @param count 점의 갯수 * @param defaultCircle 점의 이미지 */ public void createDotPanel(int count , int defaultCircle , int selectCircle) { mDefaultCircle = defaultCircle; mSelectCircle = selectCircle; imageDot = new ImageView[count]; for (int i = 0; i < count; i++) { imageDot[i] = new ImageView(mContext); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); params.topMargin = itemMargin; params.bottomMargin = itemMargin; params.leftMargin = itemMargin; params.rightMargin = itemMargin; params.gravity = Gravity.CENTER; imageDot[i].setLayoutParams(params); imageDot[i].setImageResource(defaultCircle); imageDot[i].setTag(imageDot[i].getId(), false); this.addView(imageDot[i]); } //첫인덱스 선택 selectDot(0); } /** * 선택된 점 표시 * @param position */ public void selectDot(int position) { for (int i = 0; i < imageDot.length; i++) { if (i == position) { imageDot[i].setImageResource(mSelectCircle); selectScaleAnim(imageDot[i],1f,1.5f); } else { if((boolean)imageDot[i].getTag(imageDot[i].getId()) == true){ imageDot[i].setImageResource(mDefaultCircle); defaultScaleAnim(imageDot[i], 1.5f, 1f); } } } } /** * 선택된 점의 애니메이션 * @param view * @param startScale * @param endScale */ public void selectScaleAnim(View view, float startScale, float endScale) { Animation anim = new ScaleAnimation( startScale, endScale, startScale, endScale, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); anim.setFillAfter(true); anim.setDuration(animDuration); view.startAnimation(anim); view.setTag(view.getId(),true); } /** * 선택되지 않은 점의 애니메이션 * @param view * @param startScale * @param endScale */ public void defaultScaleAnim(View view, float startScale, float endScale) { Animation anim = new ScaleAnimation( startScale, endScale, startScale, endScale, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); anim.setFillAfter(true); anim.setDuration(animDuration); view.startAnimation(anim); view.setTag(view.getId(),false); } }
[ "cksgh1539@naver.com" ]
cksgh1539@naver.com
4426213162b2c6d1e490ec51a80fa960e25e9035
1929f0afc252cd9814fc29050a9da2352a08f98a
/dss-framework/dss-appconn-framework/src/main/java/com/webank/wedatasphere/dss/framework/appconn/conf/AppConnConf.java
c0c1d17ef4445592ef7e250900490ffbc9ab75e7
[ "Apache-2.0" ]
permissive
demonray/DataSphereStudio
04d8176e4e14cadb5aee199f1e97abf42082d051
d8a8515cf1dc80e27c5e9864f01434e1ae54fa91
refs/heads/master
2022-10-06T10:38:59.320281
2022-08-29T06:56:37
2022-08-29T06:56:37
226,268,750
0
2
Apache-2.0
2019-12-06T07:14:24
2019-12-06T07:14:23
null
UTF-8
Java
false
false
1,129
java
package com.webank.wedatasphere.dss.framework.appconn.conf; import org.apache.commons.lang.StringUtils; import org.apache.linkis.common.conf.CommonVars; import java.util.Arrays; import java.util.Collections; import java.util.List; public class AppConnConf { public static final CommonVars<Boolean> IS_APPCONN_MANAGER = CommonVars.apply("wds.dss.appconn.framework.ismanager", true); public static final CommonVars<String> PROJECT_QUALITY_CHECKER_IGNORE_LIST = CommonVars.apply("wds.dss.appconn.checker.project.ignore.list", ""); public static final CommonVars<String> DEVELOPMENT_QUALITY_CHECKER_IGNORE_LIST = CommonVars.apply("wds.dss.appconn.checker.development.ignore.list", ""); public static final List<String> DISABLED_APP_CONNS = getDisabledAppConns(); private static List<String> getDisabledAppConns() { String disabledAppConns = CommonVars.apply("wds.dss.appconn.disabled", "").getValue(); if(StringUtils.isBlank(disabledAppConns)) { return Collections.emptyList(); } else { return Arrays.asList(disabledAppConns.split(",")); } } }
[ "690574002@qq.com" ]
690574002@qq.com
2bf6765f9e6c5f559772d0120977ce8190525ea3
407cd50e19f695a7c247c06ab68316b47bd509b1
/src/test/java/com/example/wbdvsp2103FurongTianserverjava/DemoApplicationTests.java
294b3a9fe659afb90271f6a29155f27aae014056
[]
no_license
emmarise/wbdv-sp21-03-FurongTian-server-java
1fb3e0ea042619d6cc1b10d2b0097bd5245026d1
bf3f4188370a3c78dd39c353ee17fb0814870052
refs/heads/main
2023-04-06T06:03:43.435403
2021-04-03T01:12:50
2021-04-03T01:12:50
333,683,157
0
0
null
null
null
null
UTF-8
Java
false
false
232
java
package com.example.wbdvsp2103FurongTianserverjava; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class DemoApplicationTests { @Test void contextLoads() { } }
[ "tianfurong@gmail.com" ]
tianfurong@gmail.com
74e9444dc9e564630ec2675bb8c04300f5c4fc6b
75169e303545f102d2d14729bebdde8d035aa5aa
/src/main/java/nl/jk5/pumpkin/api/mappack/Mappack.java
ba337dfadd42502d7c57b08df3337d0ce001c9b3
[]
no_license
Pumpkin-Framework/Pumpkin
354ab2067f2f726a245ebd8ff9a4cb279eef43f5
0331f5dedbcac2a324208c3778f875b8966dbfd7
refs/heads/master
2020-04-16T15:41:40.087599
2018-07-15T14:51:56
2018-07-15T14:51:56
36,647,034
1
0
null
null
null
null
UTF-8
Java
false
false
402
java
package nl.jk5.pumpkin.api.mappack; import nl.jk5.pumpkin.api.mappack.game.stat.StatConfig; import java.util.Collection; public interface Mappack { int getId(); String getName(); Collection<MappackAuthor> getAuthors(); Collection<MappackWorld> getWorlds(); Collection<MappackTeam> getTeams(); Collection<StatConfig> getStats(); //Optional<IMount> createMount(); }
[ "jeffrey.kog@gmail.com" ]
jeffrey.kog@gmail.com
e2e43a439736d28ff8dff45f298bb7e2854a445d
90a8b311abe7751d9aea4101d4aba662b7646f3d
/src/main/java/com/santosh/springredis/bean/CustomRedisTemplate.java
2375b72e5cf8d2c85480527d4adb125b42a3c0c2
[]
no_license
santoshpun/spring-redis
8ede71201170b037a9de383c45ee786173ed50e8
852cb0f62b31f802f9c2884e9d3c86d740443579
refs/heads/master
2022-11-24T14:30:57.667476
2020-07-28T10:39:03
2020-07-28T10:39:03
283,176,816
0
0
null
null
null
null
UTF-8
Java
false
false
2,361
java
package com.santosh.springredis.bean; import lombok.extern.slf4j.Slf4j; import org.springframework.data.redis.core.RedisCallback; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.SessionCallback; import org.springframework.data.redis.core.script.RedisScript; import org.springframework.data.redis.serializer.RedisSerializer; import java.util.List; @Slf4j public class CustomRedisTemplate<K, V> extends RedisTemplate<K, V> { @Override public <T> T execute(RedisCallback<T> action) { try { return super.execute(action); } catch (Throwable redis) { log.error(redis.getMessage()); return null; } } @Override public <T> T execute(RedisCallback<T> action, boolean exposeConnection) { try { return super.execute(action, false); } catch (Throwable redis) { log.error(redis.getMessage()); return null; } } @Override public <T> T execute(RedisCallback<T> action, boolean exposeConnection, boolean pipeline) { try { return super.execute(action, exposeConnection, pipeline); } catch (Throwable redis) { log.error(redis.getMessage()); return null; } } @Override public <T> T execute(final RedisScript<T> script, final List<K> keys, final Object... args) { try { return super.execute(script, keys, args); } catch (final Throwable t) { log.error("Error executing cache operation: {}", t.getMessage()); return null; } } @Override public <T> T execute(final RedisScript<T> script, final RedisSerializer<?> argsSerializer, final RedisSerializer<T> resultSerializer, final List<K> keys, final Object... args) { try { return super.execute(script, argsSerializer, resultSerializer, keys, args); } catch (final Throwable t) { log.warn("Error executing cache operation: {}", t.getMessage()); return null; } } @Override public <T> T execute(SessionCallback<T> session) { try { return super.execute(session); } catch (final Throwable redis) { log.error(redis.getMessage()); return null; } } }
[ "santosh@f1soft.com" ]
santosh@f1soft.com
453f00d8e17e73630f8eb6231a670ee35a10489f
43ba600da33a71191d6c3f574fe1cb2ca8c5fd1e
/app/src/main/java/com/idyllix/bol_tech/models/User.java
21c25d6aabba652edfb87588a58b2b4dc07300bc
[]
no_license
ababutcu/Bol_tech
27f9d2b0a077b2f6709c6dcdb4294502caefd874
07bc5c9fe3498e42b3c6d44084f867184a6eebe6
refs/heads/master
2021-03-29T05:53:10.967447
2020-03-17T09:06:20
2020-03-17T09:06:20
247,924,205
0
0
null
null
null
null
UTF-8
Java
false
false
2,414
java
package com.idyllix.bol_tech.models; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class User { @Expose @SerializedName("ID") private int userID; @Expose @SerializedName("kullaniciAdi") private String userName; @Expose @SerializedName("sifre") private String password; @Expose @SerializedName("yetkiID") private int privilege; @Expose @SerializedName("telefon") private String telefon; @Expose @SerializedName("email") private String email; public User(int userID, String userName, String password, int privilege, String telefon, String email) { this.userID = userID; this.userName = userName; this.password = password; this.privilege = privilege; this.telefon = telefon; this.email = email; } public User(int userID, String userName) { this.userID = userID; this.userName = userName; } public User(String userName, String password) { this.userName = userName; this.password = password; } public User(String userName, String password, int privilege) { this.userName = userName; this.password = password; this.privilege = privilege; } public User(int userID, String userName, String password, int privilege) { this.userID = userID; this.userName = userName; this.password = password; this.privilege = privilege; } public String getTelefon() { return telefon; } public void setTelefon(String telefon) { this.telefon = telefon; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public int getPrivilege() { return privilege; } public void setPrivilege(int privilege) { this.privilege = privilege; } public int getUserID() { return userID; } public void setUserID(int userID) { this.userID = userID; } }
[ "adbabtech@gmail.com" ]
adbabtech@gmail.com
e73954c4959e3c882f474beb28537835601d47cc
682bfd40c3cc651a6196e8e368696e930370a618
/order-service/src/main/java/ekol/orders/transportOrder/elastic/shipment/model/BucketItem.java
827bbdff89b00f389c1623c3774ba9408bc094a2
[]
no_license
seerdaryilmazz/OOB
3b27b67ce1cbf3f411f7c672d0bed0d71bc9b127
199f0c18b82d04569d26a08a1a4cd8ee8c7ba42d
refs/heads/master
2022-12-30T09:23:25.061974
2020-10-09T13:14:39
2020-10-09T13:14:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
777
java
package ekol.orders.transportOrder.elastic.shipment.model; /** * Created by ozer on 03/10/16. */ public class BucketItem { private Object key; private long count; private boolean selected; public BucketItem(Object key, long count, boolean selected) { this.key = key; this.count = count; this.selected = selected; } public Object getKey() { return key; } public void setKey(Object key) { this.key = key; } public long getCount() { return count; } public void setCount(long count) { this.count = count; } public boolean isSelected() { return selected; } public void setSelected(boolean selected) { this.selected = selected; } }
[ "dogukan.sahinturk@ekol.com" ]
dogukan.sahinturk@ekol.com
52bef4ba4fa8c54a477934f4eb4f9024c4c030ed
58eb6162d1364bf53064c3178b044c56273a326b
/src/main/java/abeille/cool/repository/IClientEvenementRepository.java
198a9c5408e2fb53bb84d4822ee8cb826951a272
[]
no_license
rgrizou/abeille-cool-back
264858fe42a4fe813ac3e8ce774a3d49a1a6641c
083d7ebebd37eea046166371e3d917acc74ff105
refs/heads/master
2020-05-10T00:00:58.594806
2019-04-19T11:54:31
2019-04-19T11:54:31
181,516,894
0
0
null
null
null
null
UTF-8
Java
false
false
763
java
package abeille.cool.repository; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import abeille.cool.model.Client; import abeille.cool.model.ClientEvenement; import abeille.cool.model.Evenement; public interface IClientEvenementRepository extends JpaRepository<ClientEvenement,Long> { @Query("select ce.client from ClientEvenement ce where ce.event.id = :eventId") List<Client> findAllClientByEvent(@Param("eventId") Long eventId); @Query("select ce.event from ClientEvenement ce where ce.client.id = :clientId") List<Evenement> findAllEventByClient(@Param("clientId") Long clientId); }
[ "adri.chataigneau@gmail.com" ]
adri.chataigneau@gmail.com
135c1cc454b5a1edee45bf0db95e3c5c25481f3b
49b9758a4e959f5974c9192b9f0e7834e93c6c7a
/Original Files/source/src/com/nirhart/parallaxscroll/views/ParallaxScrollView.java
5723b3ce9c8330799f193453de04970fe817d58a
[ "Apache-2.0" ]
permissive
renanalves/MiBandDecompiled
88855d3182d3a66c4c59c6202c8ccc9f5d38c5cf
2c12ea0a68e55d776551ad70ed4ef26b0ed87a70
refs/heads/master
2021-05-02T18:26:40.875129
2015-05-04T12:49:22
2015-05-04T12:49:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,921
java
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.nirhart.parallaxscroll.views; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.view.View; import android.view.ViewGroup; import android.widget.ScrollView; import java.util.ArrayList; import java.util.Iterator; // Referenced classes of package com.nirhart.parallaxscroll.views: // ParallaxedView public class ParallaxScrollView extends ScrollView { private static final int a = 1; private static final float b = 1.9F; private static final float c = 1.9F; private static final String d = "ParallaxedScrollView"; private static final int m = 0; private static final int o = 50; private static final boolean p; private int e; private float f; private float g; private ArrayList h; private Drawable i; private View j; private View k; private int l; private int n; private OnScrollListener q; public ParallaxScrollView(Context context) { super(context); e = 1; f = 1.9F; g = 1.9F; h = new ArrayList(); i = null; j = null; k = null; l = 0; } public ParallaxScrollView(Context context, AttributeSet attributeset) { super(context, attributeset); e = 1; f = 1.9F; g = 1.9F; h = new ArrayList(); i = null; j = null; k = null; l = 0; init(context, attributeset); } public ParallaxScrollView(Context context, AttributeSet attributeset, int i1) { super(context, attributeset, i1); e = 1; f = 1.9F; g = 1.9F; h = new ArrayList(); i = null; j = null; k = null; l = 0; init(context, attributeset); } private void a() { if (getChildCount() > 0 && (getChildAt(0) instanceof ViewGroup)) { ViewGroup viewgroup = (ViewGroup)getChildAt(0); int i1 = Math.min(e, viewgroup.getChildCount()); for (int j1 = 0; j1 < i1; j1++) { ParallaxedScrollView parallaxedscrollview = new ParallaxedScrollView(viewgroup.getChildAt(j1)); h.add(parallaxedscrollview); } j = viewgroup.getChildAt(0); k = viewgroup.getChildAt(1); } } private void a(View view, boolean flag) { if (p) { byte byte0; if (flag) { byte0 = 2; } else { byte0 = 0; } if (byte0 != view.getLayerType()) { view.setLayerType(byte0, null); return; } } } public void draw(Canvas canvas) { super.draw(canvas); if (k != null) { int i1 = k.getRight(); int j1 = k.getTop() - l; int k1 = k.getTop(); int l1 = k.getLeft(); if (i != null) { i.setBounds(l1, j1, i1, k1); i.draw(canvas); return; } } } protected void init(Context context, AttributeSet attributeset) { TypedArray typedarray = context.obtainStyledAttributes(attributeset, com.xiaomi.hm.health.R.styleable.ParallaxScroll); g = typedarray.getFloat(0, 1.9F); f = typedarray.getFloat(1, 1.9F); e = typedarray.getInt(2, 1); typedarray.recycle(); i = getResources().getDrawable(0x7f020001); float f1 = context.getResources().getDisplayMetrics().density; l = (int)(0.0F * f1); n = (int)(f1 * 50F); } protected void onFinishInflate() { super.onFinishInflate(); a(); } protected void onScrollChanged(int i1, int j1, int k1, int l1) { super.onScrollChanged(i1, j1, k1, l1); if (q != null) { q.onScrollChanged(i1, j1, k1, l1); } if (j1 >= 0) { float f1 = g; Iterator iterator = h.iterator(); float f2 = f1; while (iterator.hasNext()) { ((ParallaxedView)iterator.next()).setOffset((float)j1 / f2); f2 *= f; } } } protected boolean overScrollBy(int i1, int j1, int k1, int l1, int i2, int j2, int k2, int l2, boolean flag) { if (j1 + l1 >= 0) { return super.overScrollBy(i1, j1, k1, l1, i2, j2, k2, n, flag); } else { return super.overScrollBy(i1, 0, k1, 0, i2, j2, k2, l2, flag); } } public void setOnScrollListener(OnScrollListener onscrolllistener) { q = onscrolllistener; } static { boolean flag; if (android.os.Build.VERSION.SDK_INT >= 11) { flag = true; } else { flag = false; } p = flag; } private class ParallaxedScrollView extends ParallaxedView { final ParallaxScrollView a; protected void translatePreICS(View view, float f1) { view.offsetTopAndBottom((int)f1 - lastOffset); lastOffset = (int)f1; } public ParallaxedScrollView(View view) { a = ParallaxScrollView.this; super(view); } } private class OnScrollListener { public abstract void onScrollChanged(int i1, int j1, int k1, int l1); } }
[ "kvishnudev-office@yahoo.com" ]
kvishnudev-office@yahoo.com
a23b3baefb2b34296e9b0696ab83d4fe9cf7df71
4f8e34e873bad9b72aa9e6cfc3e095ff0cb3009d
/zwierzeta/src/zwierzeta/Pies.java
ac52a41c269eaecd1421e495401425f203886c3f
[]
no_license
PiotrIzak/nauka
144d2164b500955cecbb786ace50f21e39d2f80d
8c12265024e0984bce20b781776ab362af01a6e3
refs/heads/master
2020-06-04T15:35:19.548295
2019-06-15T14:23:52
2019-06-15T14:23:52
192,081,944
0
0
null
null
null
null
UTF-8
Java
false
false
291
java
package zwierzeta; public class Pies { private String imie; private int wiek; public String getImie() { return imie; } public void setImie(String imie) { this.imie = imie; } public int getWiek() { return wiek; } public void setWiek(int wiek) { this.wiek = wiek; } }
[ "pizak@objectivity.co.uk" ]
pizak@objectivity.co.uk
fe5e0f941dfbb22a09795404911a2515400d514b
72c62302629bc902ca73e7f6307c433bdb3f1958
/src/main/java/com/tapdancingmonk/payload/dao/JdoTransactionDao.java
29a6eabad2017b17f4d6798cadf268d65463ca61
[]
no_license
IgorMinar/payload
d97177092b4e3541faffae913d6871528fbdb4d2
8639efc467343e03c60cf29fdd3dc6e49773f53b
refs/heads/master
2021-01-20T06:57:40.568944
2010-04-13T05:56:48
2010-04-13T05:56:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,434
java
package com.tapdancingmonk.payload.dao; import java.util.List; import com.google.appengine.api.datastore.KeyFactory; import com.google.inject.Inject; import com.tapdancingmonk.payload.model.Transaction; import javax.jdo.JDOObjectNotFoundException; import javax.jdo.PersistenceManager; import javax.jdo.PersistenceManagerFactory; import javax.jdo.Query; public class JdoTransactionDao implements TransactionDao { private final PersistenceManagerFactory pmf; @Inject public JdoTransactionDao(PersistenceManagerFactory pmf) { this.pmf = pmf; } public Transaction save(Transaction txn) { PersistenceManager pm = pmf.getPersistenceManager(); try { return pm.makePersistent(txn); } finally { pm.close(); } } public Transaction find(String id) { PersistenceManager pm = pmf.getPersistenceManager(); try { return pm.getObjectById(Transaction.class, KeyFactory.stringToKey(id)); } catch (JDOObjectNotFoundException ex) { throw new EntityNotFoundException( String.format("entity with id %s doesn't exist", id), ex); } finally { pm.close(); } } public void delete(Transaction transaction) { PersistenceManager pm = pmf.getPersistenceManager(); try { pm.makePersistent(transaction); pm.deletePersistent(transaction); } finally { pm.close(); } } @SuppressWarnings("unchecked") public Transaction findByTxId(String txId) { PersistenceManager pm = pmf.getPersistenceManager(); Query query = pm.newQuery(Transaction.class); query.setFilter("transactionId == txId"); query.declareParameters("String txId"); Transaction txn = null; try { List<Transaction> results = (List<Transaction>) query.execute(txId); if (results.size() > 1) { throw new DuplicateTransactionIdException(); } else if (results.size() == 0) { throw new EntityNotFoundException( String.format("transaction with txId %s doesn't exist", txId)); } else { txn = results.get(0); } } finally { query.closeAll(); } return txn; } }
[ "j@lollyshouse.net" ]
j@lollyshouse.net
6972b0a17f16c653628b52d2104bd7ec1876f34b
1bb55e316b2882a64145c1f7b2fff0fb554276a1
/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsGlobalExtensionSerializer.java
18681ec814d6219d614c1ffec48a257fdb153cad
[ "Apache-2.0" ]
permissive
dnkoutso/intellij-community
70109525a6ff1a5e8b39559dc12b27055373bbb8
b61f35ff2604cab5e4df217d9debdb656674a9b6
refs/heads/master
2021-01-16T20:57:03.721492
2012-12-10T21:31:21
2012-12-10T21:53:52
7,098,498
1
0
null
null
null
null
UTF-8
Java
false
false
460
java
package org.jetbrains.jps.model.serialization; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.jps.model.JpsGlobal; /** * @author nik */ public abstract class JpsGlobalExtensionSerializer extends JpsElementExtensionSerializerBase<JpsGlobal> { protected JpsGlobalExtensionSerializer(@Nullable String configFileName, @NotNull String componentName) { super(configFileName, componentName); } }
[ "Nikolay.Chashnikov@jetbrains.com" ]
Nikolay.Chashnikov@jetbrains.com
2d84160377de3d54bc1cb9036c053cb766305a85
5b4db3b746f9fb61f4c0eb7b7cfa60b77695279d
/_trash/stalkr/src/stalkrlib/enums/GenderList.java
337e5c713ebe9fe4e600e16a15faab6b00e611aa
[]
no_license
iensenfirippu/stalkr
c811d63d186e94e9d2a132b06f07f12d1daa4900
4c59d3d002330e3eea234a72e16ef4e444aa873f
refs/heads/master
2021-01-10T09:42:21.152526
2013-05-14T10:24:01
2013-05-14T10:24:01
8,554,601
1
1
null
null
null
null
UTF-8
Java
false
false
1,785
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package stalkrlib.enums; import java.util.ArrayList; /** * * @author Philip */ public class GenderList extends EnumList<GenderType> { // Constructors public GenderList(GenderType single) { super(single); } public GenderList(ArrayList<GenderType> plural) { super(plural); } // Returns all instances of the enum T, as strings. public ArrayList<String> getEnumAsStringList() { ArrayList<String> value = new ArrayList<String>(); for (GenderType t : GenderType.values()) { value.add(t.toString()); } return value; } // Creates an EnumList from a binary formatted string representation of the given enum public static GenderList FromString(String s) { ArrayList<GenderType> l = new ArrayList<GenderType>(); GenderType[] enumvalues = GenderType.values(); char[] booleanchars = s.toCharArray(); if (enumvalues.length == booleanchars.length) { for (int i = 0; i < enumvalues.length; i++) { if (booleanchars[i] == '1') { l.add(enumvalues[i]); } } } return new GenderList(l); } // Converts the object to a binary formatted string representation of itself public @Override String toString() { StringBuilder sb = new StringBuilder(); GenderType[] enumvalues = GenderType.values(); for (GenderType t : enumvalues) { if (Contains(t)) { sb.append("1"); } else { sb.append("0"); } } return sb.toString(); } // Creates an EnumList from a list of strings public static GenderList FromStringList(ArrayList<String> strings) { ArrayList<GenderType> l = new ArrayList<GenderType>(); for (String s : strings) { l.add(GenderType.valueOf(s)); } return new GenderList(l); } }
[ "me@iensenfirippu.dk" ]
me@iensenfirippu.dk
094605c481aa739508a0cb96d33771782bef99c4
8f6f0e659b7aa70e4ea0595311650c9343d12320
/JAVA/Others/JavaApplication52_designs_patterns_player_role/src/javaapplication52_designs_patterns_player_role/seviye.java
cabc5780b4fafa5f6ed963f529c4e4f4c07e987a
[]
no_license
mremreozan/JAVA-and-Python
5e3b2b179b8d3a0db5e3006e3c249db2d3cd8c8f
bd3db346927df4eba0c8f1a3045970c3d3b98eea
refs/heads/master
2023-03-22T22:32:37.280282
2021-03-20T07:35:37
2021-03-20T07:35:37
226,519,806
1
1
null
null
null
null
UTF-8
Java
false
false
360
java
package javaapplication52_designs_patterns_player_role; /* * 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. */ /** * * @author Utilisateur */ public abstract class seviye { public abstract boolean mezuniyet(double not); }
[ "mremreozan@gmail.com" ]
mremreozan@gmail.com
16ac375ff74cd838ee0bd1a7cc4c7ddfc3cc8407
64c27d49494bb8795aa647d62466f5669db0cea4
/src/Proyecto/Pars.java
71c87cd02a3264ff229dd8c45949e52a9b7b48c3
[]
no_license
jmiguelsolano/AutomatasII
035674b966a509d311b2d2d978c674f5a8723298
f0aad5bd6da95ef794bacbc1b00f4c37cd76e6a3
refs/heads/master
2020-04-07T14:33:39.653227
2019-05-27T02:12:30
2019-05-27T02:12:30
158,452,144
1
0
null
null
null
null
ISO-8859-1
Java
false
false
9,493
java
package Proyecto; import java.util.StringTokenizer; import java.util.Vector; public class Pars { String mensaje,linea,auxiliar,auxiliar2,estructura,error; boolean valida=true; boolean dec=true; String x,g ; Vector<String> table=new Vector<String>(); Vector<String> token=new Vector<String>(); Vector<Tok> tokin=new Vector<Tok>(); StringTokenizer tk ,tk2; int c,z=-1,ins=0 ,xero; Tabla tab; ArbolRecur arbol=new ArbolRecur(); Nodo2 n; Nodo2 declar; Nodo2 if3; //{ int coPi=0; String pila[] ={"iload_","iconstant_","iadd","istore_","ifne","if_acmpne ","if_icmple ","if_icmplt","goto "}; Vector<Inst> instrucciones =new Vector<Inst>(); //} public Pars(String g) { c =0; tk=new StringTokenizer(g,"\n"); while(tk.hasMoreTokens()&&valida){ linea=tk.nextToken(); tk2=new StringTokenizer(linea," "); n=new Nodo2("programa"); arbol.raiz=n; programa(); } } private void programa() { next(); if(x.equals("<EOF>")){ eof(); if3=new Nodo2(x); arbol.InsertarRecursivo(arbol.raiz,if3.info , arbol.raiz.info); valida=true; } else if((x.equals("int")||x.equals("boolean"))&&dec==true){ if3=new Nodo2(x); arbol.InsertarRecursivo(n,if3.info ,n.info ); String tipo=x; vDec(); next();iden(); String toke=x; Tok tokenZ=new Tok (tipo,toke,z++); Inst inst=new Inst(coPi++,pila[1],z,toke); instrucciones.add(inst); tokin.add(tokenZ); tokenZ=new Tok (tipo,toke,z); inst=new Inst(coPi++,pila[3],z,toke); instrucciones.add(inst); next();punto(); }else if(x.equals("if")||x.equals("while")||esVariable()){ if3=new Nodo2(x); arbol.InsertarRecursivo(n,if3.info ,n.info ); dec=false; statement(); } else valida=false; } //-----------------------------------------------------STATEMENT String ayuda; void statement(){ ////System.out.println("Estructura=========="+estructura); if(x.equals("if")){ xero=coPi; estructura=x; sIf();next();abre();next(); expression(); }else if(x.equals("while")){ xero=coPi; estructura=x; whil();next();abre();next(); error= x; expression(); }else if(token.contains(x)){ int as =load(x); ayuda=x; next(); if(x.equals("=")){ igual(); next(); int aas =load(x); String ayudax=x; Inst inst=new Inst(coPi++,pila[0],aas+2,ayudax); instrucciones.add(inst); inst=new Inst(coPi++,pila[3],as,ayuda); instrucciones.add(inst); auxiliar2=x; if(token.contains(x)||esVariable()){ if(tipo2(auxiliar,auxiliar2)){ next(); if(estructura.equals("while")){ for ( int i= 0; i>=0; i=i-1) { //lo que sea } } if(x.equals(";")){ if(estructura.equals("while")){ inst=new Inst(coPi++,pila[8],xero,""); instrucciones.add(inst); } punto(); //instrucciones.lastElement().ind; }else valida=false; }else{valida=false; mensaje="Not the same type of variable"/**/;} }else {valida=false; mensaje="Variable not in scope";} } }else { valida=false;valida=false; mensaje="Variable not in scope";} } //------------------------------------------------EXPRESSION-------------------- int ayuda2; void expression(){ if(token.contains(x)||esVariable()){ auxiliar=""; auxiliar=x; // //System.out.println("----------------------"+x); ayuda2=(load(auxiliar)); next(); if(x.equals(")")){ //System.out.println("auxiliar ------"+auxiliar); if(tipo(auxiliar,"boolean")){ // //System.out.println("-:_:_:_:::_:_:_:__::_:_:"); // // valida=false; // mensaje="Expected boolean expression"; // linea=null; // g=null; // // if(!daval()){ // next(); // valida=false; // mensaje="Expected boolean expression"; // } // }else{ // // } //// //{ Código intermedio Inst inst=new Inst(coPi++,pila[0],ayuda2+1,auxiliar); instrucciones.add(inst); //} int t; if(estructura.equals("while")){ t=coPi+6; }else t=coPi+5; inst=new Inst(coPi++,pila[6],t,/**/estructura); coPi=coPi+2; instrucciones.add(inst); c();next(); auxiliar=x; if(x.equals("if")||x.equals("while")){ statement(); }else{ if(token.contains(x)||esVariable()){ if(tk.hasMoreTokens()){ statement(); }else{ valida=false;mensaje="Variable not in scope";} }else {valida=false;mensaje ="Variable not in scope";} } } }else if(x.equals("==")){ //{ Código intermedio Inst inst=new Inst(coPi++,pila[0],ayuda2,auxiliar); instrucciones.add(inst); //} igualIgual(); next(); //{ Código intermedio inst=new Inst(coPi++,pila[0],load(x),x); instrucciones.add(inst); //} if(tipo2(auxiliar,x)){ } int t; if(estructura.equals("while")){ t=coPi+6; }else t=coPi+5; inst=new Inst(coPi++,pila[5],t,/**/estructura); coPi=coPi+2; instrucciones.add(inst); auxiliar2=x; if(tipo2(auxiliar,auxiliar2)){ if(token.contains(x)||esVariable()){ next(); c(); next(); if(x.equals("if")||x.equals("while")){ statement(); }else{ if(token.contains(x)||esVariable()){ if(tk.hasMoreTokens()){ statement(); }else valida=false; }else valida=false; } }else valida=false; }else{ valida=false; mensaje="Not the same type of variable"; } }else if(x.equals("+")){ mas(); next(); auxiliar2=x; if(tipo2(auxiliar,auxiliar2)){ if(token.contains(x)||esVariable()){ next(); c();next(); if(x.equals("if")||x.equals("while")){ statement(); } else if(token.contains(x)||esVariable()){ if(tk.hasMoreTokens()){ statement(); }else valida=false; }else valida=false; }else{ valida=false; mensaje="Operand expected";} }else{valida=false; mensaje="Not the same type of variable";} }}else{ valida=false; mensaje ="Variable not in scope";} } void igual(){ if(x.equals("=")){ } } void mas(){ if(x.equals("+")){ }else valida=false; } void igualIgual(){ if(x.equals("==")){ } } void other(){ if(x.equals("|")){ } } void whil(){ if(x.equals("while")){ } } void sIf(){ if (x.equals("if")) { }else valida=false; } void abre(){ if (x.equals("(")) { }else valida=false; } void c(){ if (x.equals(")")) { } } void eof(){ if(x.equals("<EOF>")){ if(tk.hasMoreTokens()){ valida=false; }else if(daval()){ //System.out.println("-------------------------------------------------------------------------------------------------------LLena la tabla"); tab=new Tabla(table,token); for (int i = 0; i < instrucciones.size(); i++) { //System.out.println(instrucciones.elementAt(i).toString()); } @SuppressWarnings("unused") Bytecode b=new Bytecode(instrucciones); } } } //----------------------------Métodos finales, no modificar-------------------------------------------------------------------------- void next(){ c++; x=tk2.nextToken(); //System.out.println((c)+"\t-- "+x); } public boolean daval(){ return valida; } String getTok(){ return x; } String getMensaje(){ return mensaje; } //-----------------------------------------------------------------------------------------Declaración de variables void vDec(){//TIPO DE DATO if((x.equals("int")||x.equals("boolean"))&&tk2.hasMoreTokens()){ table.add("variable"); token.add(x); }else valida=false; } boolean esVariable(){//ES VARIABLE int aux=0; boolean resp=false; for (int i = 0; i < token.size(); i++) { if(token.elementAt(i).toString().equals(x)){ aux=i; } } if(table.elementAt(aux).toString().equals("Identifier")){ resp=true; } if(!resp) mensaje="Variable not in scope"; return resp; } void iden(){//CORROBORAR SI EL IDENTIFICADOR ES VÁLIDO if(Character.isLetter(x.charAt(0))&&tk2.hasMoreTokens()){ for (int i = 0; i < x.length(); i++) { if(Character.isDigit(x.charAt(i))||Character.isLetter(x.charAt(i))){ } else{ i=x.length()+1; valida=false; } } } table.add("Identifier"); token.add(x); } void punto(){//PUNTO Y COMA if(x.equals(";")){ }else valida=false; } boolean tipo(String auxiliar,String tipo){ boolean boo = false; for (int i = 0; i < tokin.size() ; i++) { if(auxiliar.equals(tokin.elementAt(i).token)&&(tipo.equals(tokin.elementAt(i).tipo))){ boo=true; i=tokin.size()+1; } } if(!boo){ mensaje="Expected boolean expression"; valida=false; } return boo; } boolean tipo2(String auxiliar,String auxiliar2){ String a = "",s = ""; boolean boo = false; for (int i = 0; i < tokin.size() ; i++) { if(auxiliar.equals(tokin.elementAt(i).token)){ a=tokin.elementAt(i).tipo; } if(auxiliar2.equals(tokin.elementAt(i).token)){ s=tokin.elementAt(i).tipo; } } if(a.equals(s)){ boo=true; } return boo; } int load(String auxiliar){ int numero = 0 ; for (int i = 0; i < tokin.size(); i++) { if(auxiliar.equals(tokin.elementAt(i).token)){ numero=tokin.elementAt(i).nV; i=tokin.size()+1; // //System.out.println("se encontro esta mierda"); } } return numero; } }
[ "jmsg_17@hotmail.com" ]
jmsg_17@hotmail.com
61b934b314ca23dc251e3049a1dcbe62f5fed34e
7397cf7adc234cc371fb7fea8fc29bd92b8fa9db
/src/com/ipartek/formacion/clases/Profesor.java
14556229c7ff9b2c1eda09e05ef755e098caee5b
[]
no_license
sebastisalazar/Java-Standard-Edition
894a7351e9e81a548f7fac73f6ff0a25cc38ce5c
abd895f247331d38571b7fce0b28e49399c8c708
refs/heads/master
2021-02-10T04:05:01.147866
2020-04-21T14:57:39
2020-04-21T14:57:39
244,350,474
0
0
null
null
null
null
UTF-8
Java
false
false
656
java
package com.ipartek.formacion.clases; public class Profesor extends Persona1 { private float sueldo; private String materia; // CONSTRUCTOR public Profesor() { super(); this.sueldo = 2000; this.materia = ""; } // GETTERS AND SETTERS public float getSueldo() { return sueldo; } public void setSueldo(float sueldo) { this.sueldo = sueldo; } public String getMateria() { return materia; } public void setMateria(String materia) { this.materia = materia; } // TO STRING @Override public String toString() { return "Profesor [sueldo=" + sueldo + ", materia=" + materia + ", toString()=" + super.toString() + "]"; } }
[ "Curso@PORT-Z12.ipartekaula.com" ]
Curso@PORT-Z12.ipartekaula.com
fa0ec45e0023a1fcd7e4dda71e0d5957438af189
60b010eabd85d21968727276080d2f4a5394612f
/zk/src/main/java/com/bruce/zk/throwable/recipe/TreeCacheDemo.java
74f10618a083e87615eb4f54fb71b65653eba839
[]
no_license
BruceWhiteBai/bruceBoot
ae4eed48ff6762b34b62d366cf0e54c26f4d1dc7
0e2212b665094c985c85d80932ea9d62754927a4
refs/heads/master
2022-11-27T02:13:59.708305
2019-12-06T10:13:37
2019-12-06T10:13:37
143,003,062
0
1
null
2022-11-16T12:22:39
2018-07-31T11:06:40
Java
UTF-8
Java
false
false
1,482
java
package com.bruce.zk.throwable.recipe; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.CuratorFrameworkFactory; import org.apache.curator.framework.recipes.cache.TreeCache; import org.apache.curator.framework.recipes.cache.TreeCacheListener; import org.apache.curator.retry.ExponentialBackoffRetry; import org.apache.curator.test.TestingServer; /** * @author throwable * @version v1.0 * @description * @since 2017/5/11 22:52 */ public class TreeCacheDemo { private static final String PATH = "/example/cache"; public static void main(String[] args) throws Exception { TestingServer server = new TestingServer(); CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new ExponentialBackoffRetry(1000, 3)); client.start(); client.create().creatingParentsIfNeeded().forPath(PATH); TreeCache cache = new TreeCache(client, PATH); TreeCacheListener listener = (client1, event) -> System.out.println("事件类型:" + event.getType() + " | 路径:" + (null != event.getData() ? event.getData().getPath() : null)); cache.getListenable().addListener(listener); cache.start(); client.setData().forPath(PATH, "01".getBytes()); Thread.sleep(100); client.setData().forPath(PATH, "02".getBytes()); Thread.sleep(100); client.delete().deletingChildrenIfNeeded().forPath(PATH); Thread.sleep(1000 * 2); cache.close(); client.close(); System.out.println("OK!"); } }
[ "1258444549@qq.com" ]
1258444549@qq.com
418c7936f7203f98355c299aabea4ccfac747543
cb3ecbbe8f3b50042e06582c2b4f811bd0aa1998
/svj/manualAnalysis/ee10eec7d09f8b5025d1edf5d35849f4666bccea/JsonNodeDeserializer/JsonNodeDeserializer_right.java
c7a9fec4fd78a6c7e12f724e396f4c93fa2600d7
[]
no_license
leusonmario/s3m
2ed78229a14296691353d743ce63f7423f3fc8c8
ba751ebca7bf432aad9420ae850fe179a818df85
refs/heads/master
2022-04-09T20:28:45.262607
2020-02-14T23:43:15
2020-02-14T23:43:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
15,037
java
package com.fasterxml.jackson.databind.deser.std; import java.io.IOException; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; import com.fasterxml.jackson.databind.node.*; import com.fasterxml.jackson.databind.util.RawValue; /** * Deserializer that can build instances of {@link JsonNode} from any * JSON content, using appropriate {@link JsonNode} type. */ @SuppressWarnings("serial") public class JsonNodeDeserializer extends BaseNodeDeserializer<JsonNode> { /** * Singleton instance of generic deserializer for {@link JsonNode}. * Only used for types other than JSON Object and Array. */ private final static JsonNodeDeserializer instance = new JsonNodeDeserializer(); protected JsonNodeDeserializer() { super(JsonNode.class); } /** * Factory method for accessing deserializer for specific node type */ public static JsonDeserializer<? extends JsonNode> getDeserializer(Class<?> nodeClass) { if (nodeClass == ObjectNode.class) { return ObjectDeserializer.getInstance(); } if (nodeClass == ArrayNode.class) { return ArrayDeserializer.getInstance(); } // For others, generic one works fine return instance; } /* /********************************************************** /* Actual deserializer implementations /********************************************************** */ @Override public JsonNode getNullValue(DeserializationContext ctxt) { return NullNode.getInstance(); } @Override @Deprecated // since 2.6, remove from 2.7 public JsonNode getNullValue() { return NullNode.getInstance(); } /** * Implementation that will produce types of any JSON nodes; not just one * deserializer is registered to handle (in case of more specialized handler). * Overridden by typed sub-classes for more thorough checking */ @Override public JsonNode deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { switch (p.getCurrentTokenId()) { case JsonTokenId.ID_START_OBJECT: return deserializeObject(p, ctxt, ctxt.getNodeFactory()); case JsonTokenId.ID_START_ARRAY: return deserializeArray(p, ctxt, ctxt.getNodeFactory()); default: return deserializeAny(p, ctxt, ctxt.getNodeFactory()); } } /* /********************************************************** /* Specific instances for more accurate types /********************************************************** */ final static class ObjectDeserializer extends BaseNodeDeserializer<ObjectNode> { private static final long serialVersionUID = 1L; protected final static ObjectDeserializer _instance = new ObjectDeserializer(); protected ObjectDeserializer() { super(ObjectNode.class); } public static ObjectDeserializer getInstance() { return _instance; } @Override public ObjectNode deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { if (p.isExpectedStartObjectToken() || p.hasToken(JsonToken.FIELD_NAME)) { return deserializeObject(p, ctxt, ctxt.getNodeFactory()); } // 23-Sep-2015, tatu: Ugh. We may also be given END_OBJECT (similar to FIELD_NAME), // if caller has advanced to the first token of Object, but for empty Object if (p.hasToken(JsonToken.END_OBJECT)) { return ctxt.getNodeFactory().objectNode(); } throw ctxt.mappingException(ObjectNode.class); } } final static class ArrayDeserializer extends BaseNodeDeserializer<ArrayNode> { private static final long serialVersionUID = 1L; protected final static ArrayDeserializer _instance = new ArrayDeserializer(); protected ArrayDeserializer() { super(ArrayNode.class); } public static ArrayDeserializer getInstance() { return _instance; } @Override public ArrayNode deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { if (p.isExpectedStartArrayToken()) { return deserializeArray(p, ctxt, ctxt.getNodeFactory()); } throw ctxt.mappingException(ArrayNode.class); } } } /** * Base class for all actual {@link JsonNode} deserializer * implementations */ @SuppressWarnings("serial") abstract class BaseNodeDeserializer<T extends JsonNode> extends StdDeserializer<T> { public BaseNodeDeserializer(Class<T> vc) { super(vc); } @Override public Object deserializeWithType(JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer) throws IOException { /* Output can be as JSON Object, Array or scalar: no way to know * a priori. So: */ return typeDeserializer.deserializeTypedFromAny(p, ctxt); } /* 07-Nov-2014, tatu: When investigating [databind#604], realized that it makes * sense to also mark this is cachable, since lookup not exactly free, and * since it's not uncommon to "read anything" */ @Override public boolean isCachable() { return true; } /* /********************************************************** /* Overridable methods /********************************************************** */ protected void _reportProblem(JsonParser p, String msg) throws JsonMappingException { throw JsonMappingException.from(p, msg); } /** * Method called when there is a duplicate value for a field. * By default we don't care, and the last value is used. * Can be overridden to provide alternate handling, such as throwing * an exception, or choosing different strategy for combining values * or choosing which one to keep. * * @param fieldName Name of the field for which duplicate value was found * @param objectNode Object node that contains values * @param oldValue Value that existed for the object node before newValue * was added * @param newValue Newly added value just added to the object node */ protected void _handleDuplicateField(JsonParser p, DeserializationContext ctxt, JsonNodeFactory nodeFactory, String fieldName, ObjectNode objectNode, JsonNode oldValue, JsonNode newValue) throws JsonProcessingException { // [Issue#237]: Report an error if asked to do so: if (ctxt.isEnabled(DeserializationFeature.FAIL_ON_READING_DUP_TREE_KEY)) { _reportProblem(p, "Duplicate field '"+fieldName+"' for ObjectNode: not allowed when FAIL_ON_READING_DUP_TREE_KEY enabled"); } } /* /********************************************************** /* Helper methods /********************************************************** */ protected final ObjectNode deserializeObject(JsonParser p, DeserializationContext ctxt, final JsonNodeFactory nodeFactory) throws IOException { ObjectNode node = nodeFactory.objectNode(); String key; if (p.isExpectedStartObjectToken()) { key = p.nextFieldName(); } else { JsonToken t = p.getCurrentToken(); if (t == JsonToken.END_OBJECT) { return node; } if (t != JsonToken.FIELD_NAME) { throw ctxt.mappingException(handledType(), p.getCurrentToken()); } key = p.getCurrentName(); } for (; key != null; key = p.nextFieldName()) { JsonNode value; JsonToken t = p.nextToken(); if (t == null) { throw ctxt.mappingException("Unexpected end-of-input when binding data into ObjectNode"); } switch (t.id()) { case JsonTokenId.ID_START_OBJECT: value = deserializeObject(p, ctxt, nodeFactory); break; case JsonTokenId.ID_START_ARRAY: value = deserializeArray(p, ctxt, nodeFactory); break; case JsonTokenId.ID_EMBEDDED_OBJECT: value = _fromEmbedded(p, ctxt, nodeFactory); break; case JsonTokenId.ID_STRING: value = nodeFactory.textNode(p.getText()); break; case JsonTokenId.ID_NUMBER_INT: value = _fromInt(p, ctxt, nodeFactory); break; case JsonTokenId.ID_TRUE: value = nodeFactory.booleanNode(true); break; case JsonTokenId.ID_FALSE: value = nodeFactory.booleanNode(false); break; case JsonTokenId.ID_NULL: value = nodeFactory.nullNode(); break; default: value = deserializeAny(p, ctxt, nodeFactory); } JsonNode old = node.replace(key, value); if (old != null) { _handleDuplicateField(p, ctxt, nodeFactory, key, node, old, value); } } return node; } protected final ArrayNode deserializeArray(JsonParser p, DeserializationContext ctxt, final JsonNodeFactory nodeFactory) throws IOException { ArrayNode node = nodeFactory.arrayNode(); while (true) { JsonToken t = p.nextToken(); if (t == null) { throw ctxt.mappingException("Unexpected end-of-input when binding data into ArrayNode"); } switch (t.id()) { case JsonTokenId.ID_START_OBJECT: node.add(deserializeObject(p, ctxt, nodeFactory)); break; case JsonTokenId.ID_START_ARRAY: node.add(deserializeArray(p, ctxt, nodeFactory)); break; case JsonTokenId.ID_END_ARRAY: return node; case JsonTokenId.ID_EMBEDDED_OBJECT: node.add(_fromEmbedded(p, ctxt, nodeFactory)); break; case JsonTokenId.ID_STRING: node.add(nodeFactory.textNode(p.getText())); break; case JsonTokenId.ID_NUMBER_INT: node.add(_fromInt(p, ctxt, nodeFactory)); break; case JsonTokenId.ID_TRUE: node.add(nodeFactory.booleanNode(true)); break; case JsonTokenId.ID_FALSE: node.add(nodeFactory.booleanNode(false)); break; case JsonTokenId.ID_NULL: node.add(nodeFactory.nullNode()); break; default: node.add(deserializeAny(p, ctxt, nodeFactory)); break; } } } protected final JsonNode deserializeAny(JsonParser p, DeserializationContext ctxt, final JsonNodeFactory nodeFactory) throws IOException { switch (p.getCurrentTokenId()) { case JsonTokenId.ID_START_OBJECT: case JsonTokenId.ID_END_OBJECT: // for empty JSON Objects we may point to this case JsonTokenId.ID_FIELD_NAME: return deserializeObject(p, ctxt, nodeFactory); case JsonTokenId.ID_START_ARRAY: return deserializeArray(p, ctxt, nodeFactory); case JsonTokenId.ID_EMBEDDED_OBJECT: return _fromEmbedded(p, ctxt, nodeFactory); case JsonTokenId.ID_STRING: return nodeFactory.textNode(p.getText()); case JsonTokenId.ID_NUMBER_INT: return _fromInt(p, ctxt, nodeFactory); case JsonTokenId.ID_NUMBER_FLOAT: return _fromFloat(p, ctxt, nodeFactory); case JsonTokenId.ID_TRUE: return nodeFactory.booleanNode(true); case JsonTokenId.ID_FALSE: return nodeFactory.booleanNode(false); case JsonTokenId.ID_NULL: return nodeFactory.nullNode(); // These states can not be mapped; input stream is // off by an event or two //case END_OBJECT: //case END_ARRAY: default: throw ctxt.mappingException(handledType()); } } protected final JsonNode _fromInt(JsonParser p, DeserializationContext ctxt, JsonNodeFactory nodeFactory) throws IOException { JsonParser.NumberType nt; int feats = ctxt.getDeserializationFeatures(); if ((feats & F_MASK_INT_COERCIONS) != 0) { if (DeserializationFeature.USE_BIG_INTEGER_FOR_INTS.enabledIn(feats)) { nt = JsonParser.NumberType.BIG_INTEGER; } else if (DeserializationFeature.USE_LONG_FOR_INTS.enabledIn(feats)) { nt = JsonParser.NumberType.LONG; } else { nt = p.getNumberType(); } } else { nt = p.getNumberType(); } if (nt == JsonParser.NumberType.INT) { return nodeFactory.numberNode(p.getIntValue()); } if (nt == JsonParser.NumberType.LONG) { return nodeFactory.numberNode(p.getLongValue()); } return nodeFactory.numberNode(p.getBigIntegerValue()); } protected final JsonNode _fromFloat(JsonParser p, DeserializationContext ctxt, final JsonNodeFactory nodeFactory) throws IOException { JsonParser.NumberType nt = p.getNumberType(); if (nt == JsonParser.NumberType.BIG_DECIMAL || ctxt.isEnabled(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS)) { return nodeFactory.numberNode(p.getDecimalValue()); } if (nt == JsonParser.NumberType.FLOAT) { return nodeFactory.numberNode(p.getFloatValue()); } return nodeFactory.numberNode(p.getDoubleValue()); } protected final JsonNode _fromEmbedded(JsonParser p, DeserializationContext ctxt, JsonNodeFactory nodeFactory) throws IOException { // [JACKSON-796] Object ob = p.getEmbeddedObject(); if (ob == null) { // should this occur? return nodeFactory.nullNode(); } Class<?> type = ob.getClass(); if (type == byte[].class) { // most common special case return nodeFactory.binaryNode((byte[]) ob); } // [databind#743]: Don't forget RawValue if (ob instanceof RawValue) { return nodeFactory.rawValueNode((RawValue) ob); } if (ob instanceof JsonNode) { // [Issue#433]: but could also be a JsonNode hiding in there! return (JsonNode) ob; } // any other special handling needed? return nodeFactory.pojoNode(ob); } }
[ "gjcc@cin.ufpe.br" ]
gjcc@cin.ufpe.br
708b5050ca689abe8bc6ae680c12e2491f92e172
7ffc2b755849484511318d6041a10dcf2d0a3419
/src/main/java/gt/com/edu/model/services/IContenidoService.java
26db5fb2944907854e6c5a8cecd0fdb2e90f81bf
[]
no_license
Eth0Ath0/deployedheroku1
7dc49acf715400d64f080f5ad470e98aa835c23b
0a75ff93aaaaddc903a0d3301ae0ea6c8818105e
refs/heads/master
2023-09-05T02:37:48.630170
2021-10-27T12:19:58
2021-10-27T12:19:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
364
java
package gt.com.edu.model.services; import java.util.List; import gt.com.edu.models.entity.Contenido; public interface IContenidoService { //listar contenido List<Contenido> findAll(); //buscar contenido por id Contenido findById(Long id); //guardar contenido Contenido save(Contenido contenido); //eliminar contenido void delete(Long id); }
[ "etho0101@gmail.com" ]
etho0101@gmail.com
04722434010bebaf8317933aaba403c489a741a4
92c2284ba70ababe4f54158a8416df7ba8d973da
/simple/src/main/java/virh/sense/trade/domain/BackOrder.java
04be5e8527a5a9ee0eb2cb98d7bffea920b42c23
[]
no_license
virh/case-study-sense
a13854fac74ba1b261611f81d04dbf983bf34137
7500af7761e54a3e7ea20981ab751be43fc272d2
refs/heads/master
2022-02-15T13:21:23.581907
2019-07-31T05:38:20
2019-07-31T05:38:20
198,378,640
0
0
null
null
null
null
UTF-8
Java
false
false
188
java
package virh.sense.trade.domain; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; @Entity @DiscriminatorValue("B") public class BackOrder extends Order { }
[ "virgil.hong@aliyun.com" ]
virgil.hong@aliyun.com
f3955f97bd76dba6d78d78a339888b672b43e97d
095d1b9fe10fbc7857f49e9bc1992572f569e067
/fastup-maven-plugin/src/main/java/io/fastup/maven/plugin/app/DeployPutRequestMaker.java
c6c9609ccb9cab2ec45402960aad9453e1503798
[]
no_license
sdole/fastup
2e83eb829e8851d8ff1f8c23034b0c838ed90b1c
b1586b3a3f2884b3112ff25206ee3f5986126df0
refs/heads/master
2021-01-12T12:58:14.060527
2016-10-11T01:08:32
2016-10-20T12:35:40
69,760,066
0
1
null
null
null
null
UTF-8
Java
false
false
4,101
java
/* * Tvarit is an AWS DevOps Automation Tool for JEE applications. * See http://www.tvarit.io * Copyright (C) 2016. Sachin Dole. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ package io.fastup.maven.plugin.app; import com.amazonaws.services.s3.model.ObjectMetadata; import com.amazonaws.services.s3.model.PutObjectRequest; import io.fastup.maven.plugin.TemplateUrlMaker; import io.fastup.maven.plugin.env.TvaritEnvironment; import org.apache.maven.plugin.MojoExecutionException; import java.io.File; import java.net.MalformedURLException; import java.net.URL; import java.util.HashMap; import java.util.Map; class DeployPutRequestMaker { PutObjectRequest makePutRequest() throws MojoExecutionException { final TvaritEnvironment tvaritEnvironment = TvaritEnvironment.getInstance(); tvaritEnvironment.<AppDeployerMojo>getMojo().getArtifactBucketName(); final File warFile = tvaritEnvironment.getMavenProject().getArtifact().getFile(); String projectArtifactId = tvaritEnvironment.getMavenProject().getArtifactId(); String projectVersion = tvaritEnvironment.getMavenProject().getVersion(); final String projectGroupId = tvaritEnvironment.getMavenProject().getGroupId(); final String key = "deployables/" + projectGroupId + "/" + projectArtifactId + "/" + projectVersion + "/" + warFile.getName(); final String bucketName = tvaritEnvironment.getArtifactBucketName(); final PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, key, warFile); final ObjectMetadata metadata = new ObjectMetadata(); final Map<String, String> userMetadata = new HashMap<>(); userMetadata.put("project_name", tvaritEnvironment.getProjectName()); userMetadata.put("health_check_url", tvaritEnvironment.<AppDeployerMojo>getMojo().getHealthCheckUrl()); userMetadata.put("private_key_name", tvaritEnvironment.<AppDeployerMojo>getMojo().getSshKeyName()); userMetadata.put("db-version", tvaritEnvironment.<AppDeployerMojo>getMojo().getDbVersion()); userMetadata.put("group-id", tvaritEnvironment.getMavenProject().getGroupId()); userMetadata.put("artifact-id", tvaritEnvironment.getMavenProject().getArtifactId()); userMetadata.put("version", tvaritEnvironment.getMavenProject().getVersion()); userMetadata.put("app_fqdn", tvaritEnvironment.<AppDeployerMojo>getMojo().getAppFqdn()); userMetadata.put("db-name", tvaritEnvironment.<AppDeployerMojo>getMojo().getDbName()); userMetadata.put("db-username", tvaritEnvironment.<AppDeployerMojo>getMojo().getDbUsername()); userMetadata.put("db-password", tvaritEnvironment.<AppDeployerMojo>getMojo().getDbPassword()); final String contextConfigUrl = tvaritEnvironment.<AppDeployerMojo>getMojo().getContextConfigUrl(); final URL url; try { url = new TemplateUrlMaker().makeUrl(contextConfigUrl); } catch (MalformedURLException e) { throw new MojoExecutionException("failed", e); } userMetadata.put("context_config_url", url.toString()); final String contextRoot = tvaritEnvironment.<AppDeployerMojo>getMojo().getContextRoot(); userMetadata.put("context_root", contextRoot.equals("/") ? "ROOT" : contextRoot); metadata.setUserMetadata(userMetadata); putObjectRequest.withMetadata(metadata); return putObjectRequest; } }
[ "sdole@genvega.com" ]
sdole@genvega.com
1e568c6fd62d36c17c29b590735ccb7f4cbbdf32
ef76e79342fbedecb002acd75c0a521e547ca0a7
/basic-code/src/main/java/com/basic/datastructure/sample/SortPractice.java
8689c63735b69ba567888415bc5f550c3de3384c
[ "MIT" ]
permissive
qjws/java-tutorial
e4417f313e6d5bef306f8e4770c0ec32311724fa
3a3979f5e0d5e470f1682744fc47ec840ea73f0a
refs/heads/master
2020-05-20T04:01:15.915859
2019-04-30T08:22:37
2019-04-30T08:22:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,055
java
package com.basic.datastructure.sample; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * 排序算法 * * @author : Jarvis * @date : 2018/5/23 */ public class SortPractice { /** * 直接插入排序,时间复杂度:O(n^2),空间复杂度:O(1) * 稳定 * * @param arr */ public int[] insertSort(int[] arr) { int i, j; int n = arr.length; int target; //假定第一个元素被放到了正确的位置上 //这样,仅需遍历1 - n-1 for (i = 1; i < n; i++) { j = i; target = arr[i]; while (j > 0 && target < arr[j - 1]) { arr[j] = arr[j - 1]; j--; } arr[j] = target; } return arr; } /** * 希尔排序,时间复杂度:O(n^2),空间复杂度:O(1) * 希尔排序是非稳定排序算法 * 不稳定 * * @param arr 数组 */ public int[] sheelSort(int[] arr) { //单独把数组长度拿出来,提高效率 int len = arr.length; while (len != 0) { len = len / 2; //分组 for (int i = 0; i < len; i++) { //元素从第二个开始 for (int j = i + len; j < arr.length; j += len) { //k为有序序列最后一位的位数 int k = j - len; //要插入的元素 int temp = arr[j]; /*for(;k>=0&&temp<arr[k];k-=len){ arr[k+len]=arr[k]; }*/ //从后往前遍历 while (k >= 0 && temp < arr[k]) { arr[k + len] = arr[k]; //向后移动len位 k -= len; } arr[k + len] = temp; } } } return arr; } /** * 冒泡排序:时间复杂度:O(n^2),空间复杂度:O(1) * 基本上很少使用 * 将序列中所有元素两两比较,将最大的放在最后面。 * 将剩余序列中所有元素两两比较,将最大的放在最后面。 * 稳定 * * @param arr int 数组 * @return */ public int[] bubbleSort(int[] arr) { for (int i = 0; i < arr.length; i++) { //注意第二重循环的条件 for (int j = 0; j < arr.length - i - 1; j++) { if (arr[j] > arr[j + 1]) { int tmp = arr[j]; //小的放前面 arr[j] = arr[j + 1]; //交换 arr[j + 1] = tmp; } } } return arr; } /** * 简单选择排序 ,时间复杂度:O(n^2),空间复杂度:O(1) * 遍历整个序列,将最小的数放在最前面。 * 遍历剩下的序列,将最小的数放在最前面。 * 不稳定 * * @param arr * @return */ public int[] selectionSort(int[] arr) { int len = arr.length; //循环次数 for (int i = 0; i < len; i++) { int value = arr[i]; int position = i; //找到最小的值和位置 for (int j = i + 1; j < len; j++) { if (arr[j] < value) { value = arr[j]; position = j; } } //进行交换 arr[position] = arr[i]; arr[i] = value; } return arr; } /** * 快速排序,时间复杂度:O (nlogn),空间复杂度:O(nlog2n) * 用时最少 * 选择第一个数为p,小于p的数放在左边,大于p的数放在右边。 * 递归的将p左边和右边的数都按照第一步进行,直到不能递归。 * 不稳定 * * @param arr * @return */ public int[] quickSort(int[] arr) { int left = 0; int right = arr.length - 1; // 轴值,默认选取数组的第一个数字 while (left < right) { while (left < right && arr[left] <= arr[right]) { right--; } if (left < right) { int tmp = arr[left]; arr[left] = arr[right]; arr[right] = tmp; } while (left < right && arr[left] <= arr[right]) { left++; } if (left < right) { int tmp = arr[left]; arr[left] = arr[right]; arr[right] = tmp; } } return arr; } /** * 归并排序,时间复杂度:O(n log n),空间复杂度:O(n) * 速度仅次于快速排序,内存少的时候使用,可以进行并行计算的时候使用。 * 选择相邻两个数组成一个有序序列。 * 选择相邻的两个有序序列组成一个有序序列。 * 重复第二步,直到全部组成一个有序序列。 * 稳定 * * @return */ public int[] mergeSort(int[] arr) { int low = 0; int high = arr.length - 1; int mid = (low + high) / 2; if (low < high) { // 左边 sort(arr, low, mid); // 右边 sort(arr, mid + 1, high); // 左右归并 merge(arr, low, mid, high); } return arr; } /** * 基数排序,时间复杂度:O(d(n+r)),空间复杂度:O(n+r) * 用于大量数,很长的数进行排序时。 * 将所有的数的个位数取出,按照个位数进行排序,构成一个序列。 * 将新构成的所有的数的十位数取出,按照十位数进行排序,构成一个序列。 * 稳定 * * @param arr * @return */ public int[] baseSort(int[] arr) { // 找到最大数,确定要排序几趟 int max = 0; for (int i = 0; i < arr.length; i++) { if (max < arr[i]) { max = arr[i]; } } // 判断位数 int times = 0; while (max > 0) { max = max / 10; times++; } // 建立十个队列 List<ArrayList> queue = new ArrayList<>(); for (int i = 0; i < 10; i++) { ArrayList queue1 = new ArrayList(); queue.add(queue1); } // 进行times次分配和收集 for (int i = 0; i < times; i++) { // 分配 for (int j = 0; j < arr.length; j++) { int x = arr[j] % (int) Math.pow(10, i + 1) / (int) Math.pow(10, i); ArrayList queue2 = queue.get(x); queue2.add(arr[j]); queue.set(x, queue2); } // 收集 int count = 0; for (int j = 0; j < 10; j++) { while (queue.get(j).size() > 0) { ArrayList<Integer> queue3 = queue.get(j); arr[count] = queue3.get(0); queue3.remove(0); count++; } } } return arr; } private static void sort(int[] arr, int left, int right) { if (left < right) { int mid = (left + right) / 2; sort(arr, left, mid); sort(arr, mid + 1, right); merge(arr, left, mid, right); } } private static void merge(int[] arr, int low, int mid, int high) { int[] temp = new int[high - low + 1]; // 左指针 int i = low; // 右指针 int j = mid + 1; int k = 0; // 把较小的数先移到新数组中 while (i <= mid && j <= high) { if (arr[i] < arr[j]) { temp[k++] = arr[i++]; } else { temp[k++] = arr[i++]; } } // 把左边剩余的数移入数组 while (i <= mid) { temp[k++] = arr[i++]; } // 把右边边剩余的数移入数组 while (j <= high) { temp[k++] = arr[j++]; } // 把新数组中的数覆盖arr数组 for (int k2 = 0; k2 < temp.length; k2++) { arr[k2 + low] = temp[k2]; } } } class AppClient { public static void main(String[] args) { int[] nums = {1, 34, 9, 45, 676, 23, 11111, 1002, 2333, 33, 77, 73, 78, 90, 92, 102, 553, 450, 5578, 1024, 30154}; SortPractice sortPractice = new SortPractice(); //基本排序 var result = sortPractice.baseSort(nums); Arrays.stream(result).forEach(value -> System.out.print(value + " ")); //直接插入排序 System.out.println(); result = sortPractice.insertSort(nums); Arrays.stream(result).forEach(value -> System.out.print(value + " ")); } }
[ "qdw8911@sina.com" ]
qdw8911@sina.com
04eeba4d22a5cf543ff41f5855328ca2dde77672
11d311b8ea8a91cd566015d5521ead21b2d872b0
/src/main/java/com/sed/app/security/jwt/TokenProvider.java
5b0cc885be9d13a1e18ddf3552a3e9901b875108
[]
no_license
FredPi17/sed-web
1069f6c2461a1ade040044e6ade7f5a759cdda66
9e94a4cff0251fc9658c4feb959da2b334f880b2
refs/heads/master
2022-12-21T08:52:55.928143
2021-03-25T16:18:29
2021-03-25T16:18:29
195,403,376
0
1
null
2022-12-16T05:01:33
2019-07-05T12:09:40
Java
UTF-8
Java
false
false
4,773
java
package com.sed.app.security.jwt; import java.nio.charset.StandardCharsets; import java.security.Key; import java.util.*; import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.User; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; import io.github.jhipster.config.JHipsterProperties; import io.jsonwebtoken.*; import io.jsonwebtoken.io.Decoders; import io.jsonwebtoken.security.Keys; @Component public class TokenProvider implements InitializingBean { private final Logger log = LoggerFactory.getLogger(TokenProvider.class); private static final String AUTHORITIES_KEY = "auth"; private Key key; private long tokenValidityInMilliseconds; private long tokenValidityInMillisecondsForRememberMe; private final JHipsterProperties jHipsterProperties; public TokenProvider(JHipsterProperties jHipsterProperties) { this.jHipsterProperties = jHipsterProperties; } @Override public void afterPropertiesSet() throws Exception { byte[] keyBytes; String secret = jHipsterProperties.getSecurity().getAuthentication().getJwt().getSecret(); if (!StringUtils.isEmpty(secret)) { log.warn("Warning: the JWT key used is not Base64-encoded. " + "We recommend using the `jhipster.security.authentication.jwt.base64-secret` key for optimum security."); keyBytes = secret.getBytes(StandardCharsets.UTF_8); } else { log.debug("Using a Base64-encoded JWT secret key"); keyBytes = Decoders.BASE64.decode(jHipsterProperties.getSecurity().getAuthentication().getJwt().getBase64Secret()); } this.key = Keys.hmacShaKeyFor(keyBytes); this.tokenValidityInMilliseconds = 1000 * jHipsterProperties.getSecurity().getAuthentication().getJwt().getTokenValidityInSeconds(); this.tokenValidityInMillisecondsForRememberMe = 1000 * jHipsterProperties.getSecurity().getAuthentication().getJwt() .getTokenValidityInSecondsForRememberMe(); } public String createToken(Authentication authentication, boolean rememberMe) { String authorities = authentication.getAuthorities().stream() .map(GrantedAuthority::getAuthority) .collect(Collectors.joining(",")); long now = (new Date()).getTime(); Date validity; if (rememberMe) { validity = new Date(now + this.tokenValidityInMillisecondsForRememberMe); } else { validity = new Date(now + this.tokenValidityInMilliseconds); } return Jwts.builder() .setSubject(authentication.getName()) .claim(AUTHORITIES_KEY, authorities) .signWith(key, SignatureAlgorithm.HS512) .setExpiration(validity) .compact(); } public Authentication getAuthentication(String token) { Claims claims = Jwts.parser() .setSigningKey(key) .parseClaimsJws(token) .getBody(); Collection<? extends GrantedAuthority> authorities = Arrays.stream(claims.get(AUTHORITIES_KEY).toString().split(",")) .map(SimpleGrantedAuthority::new) .collect(Collectors.toList()); User principal = new User(claims.getSubject(), "", authorities); return new UsernamePasswordAuthenticationToken(principal, token, authorities); } public boolean validateToken(String authToken) { try { Jwts.parser().setSigningKey(key).parseClaimsJws(authToken); return true; } catch (io.jsonwebtoken.security.SecurityException | MalformedJwtException e) { log.info("Invalid JWT signature."); log.trace("Invalid JWT signature trace: {}", e); } catch (ExpiredJwtException e) { log.info("Expired JWT token."); log.trace("Expired JWT token trace: {}", e); } catch (UnsupportedJwtException e) { log.info("Unsupported JWT token."); log.trace("Unsupported JWT token trace: {}", e); } catch (IllegalArgumentException e) { log.info("JWT token compact of handler are invalid."); log.trace("JWT token compact of handler are invalid trace: {}", e); } return false; } }
[ "fpinaud17@gmail.com" ]
fpinaud17@gmail.com
ce1eb0735912f21f859afeea89deb5d5e61526e0
c88cf388e5b65d115010a82e815293e516486955
/ABS-ORM/ABS/StdLib/Set_EmptySet.java
8bb4a4f9eb5cb004a78300fe0ccff2aea7d891ff
[]
no_license
kandito/abs-db-orm
69bdfaea99f0b383761893b52788187a7fccd2d1
aa7562a1ee02f4c476e7b56cb314bdfa23781bf3
refs/heads/master
2020-12-25T08:43:14.160644
2015-08-12T11:54:05
2015-08-12T11:54:05
32,813,392
1
0
null
null
null
null
UTF-8
Java
false
false
876
java
package ABS.StdLib; // abslang.abs:57:15: public final class Set_EmptySet<A extends abs.backend.java.lib.types.ABSValue> extends Set<A> { public Set_EmptySet() { } protected abs.backend.java.lib.types.ABSValue[] getArgs() { return new abs.backend.java.lib.types.ABSValue[] { }; } public java.lang.String getConstructorName() { return "EmptySet";} public abs.backend.java.lib.types.ABSBool eq(abs.backend.java.lib.types.ABSValue o) { if (! (o instanceof Set_EmptySet)) return abs.backend.java.lib.types.ABSBool.FALSE; Set_EmptySet other = (Set_EmptySet) o; return abs.backend.java.lib.types.ABSBool.TRUE; } public boolean match(abs.backend.java.lib.expr.PatternConstructor c, abs.backend.java.lib.expr.PatternBinding b) { if (!c.constructorClass.equals(this.getClass())) return false; return true; } }
[ "kandito.agung@ui.ac.id" ]
kandito.agung@ui.ac.id
06f1c3249cfaf6dc72f78c0b83ea508808c4dd2d
959e66de177c24fd05e49a1337d6c470a9a4edd6
/src/main/java/com/dj/ssm/pojo/User.java
6fb0074aef17f332da4d22ea7bb33549e35cefe4
[]
no_license
13003517491/test
d1b84e97cdd4bdef4e3e9e62c60c48dc091c4ca1
a94c69ef683490a257d156c6b20b2f0b861eda5d
refs/heads/master
2022-07-10T04:34:29.484752
2020-02-28T08:46:49
2020-02-28T08:46:49
243,705,906
0
0
null
2022-06-21T02:53:02
2020-02-28T07:41:52
JavaScript
UTF-8
Java
false
false
858
java
package com.dj.ssm.pojo; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.experimental.Accessors; @Data @Accessors(chain = true) @TableName("wp_user") public class User { /** * 主键id */ @TableId(type = IdType.AUTO) private Integer id; /** * 用户名 */ @TableField("user_name") private String userName; /** * 密码 */ private String password; /** * 年龄 */ private Integer age; /** * 手机号 */ private String phone; /** * 邮箱 */ private String email; /** * 展示:1 伪删除:2 */ private Integer isDel; }
[ "13003517491@163.com" ]
13003517491@163.com
2619c15b0209d359a8b6243c917e0f8a8ca6e444
b6016323c570b454b21cf89f559c19a2ecfc900d
/src/test/java/com/carlson/categoryservice/CategoryServiceApplicationTests.java
deefafc916d496bbcc0621a6dd99af655b9a2b69
[]
no_license
dgcarlso3/categoryService
b8a5841fbd80e6189881403c8132321eb8e19849
28eed2bd04a5bb0ecd0e1e74f62c25e6d5a3d318
refs/heads/main
2023-08-22T21:23:41.050237
2021-10-08T22:16:36
2021-10-08T22:16:36
412,909,975
0
0
null
null
null
null
UTF-8
Java
false
false
228
java
package com.carlson.categoryservice; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class CategoryServiceApplicationTests { @Test void contextLoads() { } }
[ "gshpsrule@charter.net" ]
gshpsrule@charter.net
88dca4978d7ad7c1285a6fe8d90091e8ffd3b8ae
3bf56653c3aea862ed239fd0a65d000bb5352a90
/Samostiyna/app/src/main/java/com/example/sergey/samostiyna/Thickness.java
79b2f582d6633ea0a241db3bfa989dba8c8412ed
[]
no_license
SergeyBotl/AndroidCoreHW
2b1fb6861ee215e8dd218bad8c0a57aa6c4f7009
7e1cea18fa8271f5cd544f106a7d63af3acbfebb
refs/heads/master
2020-06-20T02:59:09.810407
2017-01-10T21:16:28
2017-01-10T21:16:28
74,885,326
1
0
null
null
null
null
UTF-8
Java
false
false
82
java
package com.example.sergey.samostiyna; public enum Thickness { thick,thin }
[ "bot74@mail.ru" ]
bot74@mail.ru
cbf03bf7167877ad777e6a3538b83a2d31daa299
c0bc2446ce1ba8d513156eacd9c2efd5c7549107
/app/src/main/java/com/example/whatsapp/fragments/chatFragment.java
dc23c293141dc0f4926c354efddf830cafcd346d
[]
no_license
Shreshth707/Connect
08f9267ee607ad3b3e81f0aea4c075f86ba28bf8
f6460ac9b73328936b2bd0ae26cb6f3079623d2e
refs/heads/master
2022-11-14T09:41:36.226686
2020-07-07T12:49:44
2020-07-07T12:49:44
256,931,614
0
0
null
null
null
null
UTF-8
Java
false
false
8,636
java
package com.example.whatsapp.fragments; import android.Manifest; import android.annotation.SuppressLint; import android.os.Build; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import com.example.whatsapp.Chat.ChatListAdapter; import com.example.whatsapp.Chat.ChatObject; import com.example.whatsapp.R; import com.example.whatsapp.User.UserObject; import com.example.whatsapp.Utilis.SpacingDecorator; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.onesignal.OneSignal; import java.util.ArrayList; /** * A simple {@link Fragment} subclass. */ public class chatFragment extends Fragment { public chatFragment() { // Required empty public constructor } View ChatFragment; private RecyclerView mChatList; private RecyclerView.Adapter mChatListAdapter; private RecyclerView.LayoutManager mChatListLayoutManager; ArrayList<ChatObject> chatList; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment ChatFragment = inflater.inflate(R.layout.fragment_chat, container, false); //Code OneSignal.startInit(getContext()).init(); OneSignal.setSubscription(true); OneSignal.idsAvailable(new OneSignal.IdsAvailableHandler() { @Override public void idsAvailable(String userId, String registrationId) { FirebaseDatabase.getInstance().getReference().child("user").child(FirebaseAuth.getInstance().getUid()).child("notificationKey").setValue(userId); } }); OneSignal.setInFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification); getPermissions(); initialiseRecyclerView(); getUserChatList(); return ChatFragment; } private void getUserChatList(){ DatabaseReference mUserChatDB = FirebaseDatabase.getInstance().getReference().child("user").child(FirebaseAuth.getInstance().getUid()).child("chat"); mUserChatDB.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { if(dataSnapshot.exists()){ for (DataSnapshot childSnapshot : dataSnapshot.getChildren()) { String chatIconLink = ""; if (childSnapshot.hasChild("chatIcon")) { if (childSnapshot.child("chatName").getValue() != null) { if (childSnapshot.child("chatIcon").getValue() != null) chatIconLink = childSnapshot.child("chatIcon").getValue().toString(); ChatObject mChat = new ChatObject(childSnapshot.getKey(), childSnapshot.child("chatName").getValue().toString()); mChat.setChatIconLink(chatIconLink); boolean exists = false; for (ChatObject mChatIterator : chatList) { if (mChatIterator.getChatId().equals(mChat.getChatId())) exists = true; } if (exists) continue; chatList.add(mChat); mChatListAdapter.notifyDataSetChanged(); getChatData(mChat.getChatId()); } }else { if (childSnapshot.child("chatName").getValue() != null) { ChatObject mChat = new ChatObject(childSnapshot.getKey(), childSnapshot.child("chatName").getValue().toString()); mChat.setChatIconLink(chatIconLink); boolean exists = false; for (ChatObject mChatIterator : chatList) { if (mChatIterator.getChatId().equals(mChat.getChatId())) exists = true; } if (exists) continue; chatList.add(mChat); mChatListAdapter.notifyDataSetChanged(); getChatData(mChat.getChatId()); } } } } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } private void getChatData(String chatId) { DatabaseReference mChatDB = FirebaseDatabase.getInstance().getReference().child("chat").child(chatId).child("info"); mChatDB.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { if (dataSnapshot.exists()){ String chatId = ""; if (dataSnapshot.child("id").getValue()!=null){ chatId = dataSnapshot.child("id").getValue().toString(); } for (DataSnapshot userSnapshot : dataSnapshot.child("users").getChildren()){ for (ChatObject mChat : chatList){ if(mChat.getChatId().equals(chatId)){ UserObject mUser = new UserObject(userSnapshot.getKey()); mChat.addUserToArrayList(mUser); getUserData(mUser); } } } } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } private void getUserData(UserObject mUser) { DatabaseReference mUserDb = FirebaseDatabase.getInstance().getReference().child("user").child(mUser.getUid()); mUserDb.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { UserObject mUser = new UserObject(dataSnapshot.getKey()); if (dataSnapshot.child("notificationKey").getValue()!=null){ mUser.setNotificationKey(dataSnapshot.child("notificationKey").getValue().toString()); } for (ChatObject mChat : chatList){ for (UserObject mUserIterator : mChat.getUserObjectArrayList()){ if (mUserIterator.getUid().equals(mUser.getUid())){ mUserIterator.setNotificationKey(mUser.getNotificationKey()); } } } mChatListAdapter.notifyDataSetChanged(); } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } @SuppressLint("WrongConstant") private void initialiseRecyclerView() { chatList = new ArrayList<>(); mChatList = ChatFragment.findViewById(R.id.chatList); mChatList.setNestedScrollingEnabled(false); mChatList.setHasFixedSize(false); mChatListLayoutManager = new LinearLayoutManager(getContext(), LinearLayout.VERTICAL,false); mChatList.setLayoutManager(mChatListLayoutManager); SpacingDecorator itemDecorator = new SpacingDecorator(4); mChatList.addItemDecoration(itemDecorator); mChatListAdapter = new ChatListAdapter(chatList); mChatList.setAdapter(mChatListAdapter); } private void getPermissions() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { requestPermissions(new String[] {Manifest.permission.WRITE_CONTACTS,Manifest.permission.READ_CONTACTS},1); } } }
[ "55982438+Shreshth707@users.noreply.github.com" ]
55982438+Shreshth707@users.noreply.github.com
19b79068f7089a10437d1e1eb3e1d9a9440a18c9
d56296e3444ca78238a580c22b8ceef0490b1c60
/app/src/main/java/com/example/myevent/EventPlanner/EventPlannerCustomerPost.java
36d939aee8d5c9453d56c6110890f399f5fcd887
[]
no_license
Dilshanushara/Event-Management-System
748b122e30d61b82dc2e615d4b4e2871b5fb2085
c69c361506828ac3eda224611032fd73e3d22619
refs/heads/master
2021-08-28T00:23:55.288828
2021-08-13T16:26:00
2021-08-13T16:26:00
199,304,474
0
0
null
null
null
null
UTF-8
Java
false
false
394
java
package com.example.myevent.EventPlanner; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import com.example.myevent.R; public class EventPlannerCustomerPost extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_evtcust12); } }
[ "promodarvinda95@gmil.com" ]
promodarvinda95@gmil.com
e992e02da29c6107bd46ef3b75d12b1f191215b2
d84fb60595312136aeb1069baad585da325c218d
/HuaShanApp/app/src/main/java/com/karazam/huashanapp/manage/main/model/retrofit/ManagedataDataSource.java
30721d62fba153435c27edeb27a10c45d476aa9a
[]
no_license
awplying12/huashanApp
d6a72b248c94a65e882385edf92231552214340c
86bd908ec2f82fc030a9d83238144a943461c842
refs/heads/master
2021-01-11T00:21:10.870110
2017-02-10T11:27:06
2017-02-10T11:27:06
70,544,770
0
0
null
null
null
null
UTF-8
Java
false
false
661
java
package com.karazam.huashanapp.manage.main.model.retrofit; import com.karazam.huashanapp.main.retorfitMain.BaseDataSource; import com.karazam.huashanapp.main.retorfitMain.BaseReturn; import com.karazam.huashanapp.manage.main.model.databinding.ManagedataBean; import rx.Observable; /** * Created by Administrator on 2016/12/26. */ public class ManagedataDataSource extends BaseDataSource { ManagedataApi service = retrofit1.create(ManagedataApi.class); public Observable<BaseReturn<ManagedataBean>> getManagedata(String borrowingType, String currentPage){ return service.getManagedata(borrowingType,currentPage,"XMLHttpRequest"); } }
[ "awplying14@163.com" ]
awplying14@163.com
28afe74b70b5b9fab86373c07b11e2105c522c39
949c9d796c6779418d1b13c730a0acc3c22a7be0
/src/oasis/names/specification/ubl/schema/xsd/commonbasiccomponents_2/LotNumberIDType.java
aaa119c01774fc6daf942670cfef1e2e988f7471
[]
no_license
gvilauy/XpandeDIAN
2c649a397e7423bffcbe5efc68824a4ee207eb3a
e27966b3b668ba2f3d4b89920e448aeebe3a3dbb
refs/heads/master
2023-04-02T09:35:04.702985
2021-04-06T14:52:52
2021-04-06T14:52:52
333,752,128
0
0
null
null
null
null
UTF-8
Java
false
false
1,229
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // 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: 2021.01.28 at 09:51:24 AM UYT // package oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; import oasis.names.specification.ubl.schema.xsd.unqualifieddatatypes_2.IdentifierType; /** * <p>Java class for LotNumberIDType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="LotNumberIDType"> * &lt;simpleContent> * &lt;extension base="&lt;urn:oasis:names:specification:ubl:schema:xsd:UnqualifiedDataTypes-2>IdentifierType"> * &lt;/extension> * &lt;/simpleContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "LotNumberIDType") public class LotNumberIDType extends IdentifierType { }
[ "gabrielvila13@gmail.com" ]
gabrielvila13@gmail.com
4933e41334897fd1ff07013b590f7c1d1e9af98b
14467cddadb5f18eab8786e58d3ce2f527969bb3
/WarehouseControlPanel/src/java/facades/PositionsFacade.java
5da6adc5f26050d79045f89d7a33e4f844129e17
[]
no_license
Rahmabadr/Work
b37a89c6f1d42247eb85e14420d65eb9cc1e08a2
aaf355ce4cac1e8f4baa4dec65e6309adbb0e2d9
refs/heads/master
2022-07-16T08:14:15.750573
2020-05-18T19:47:34
2020-05-18T19:47:34
265,043,775
0
0
null
null
null
null
UTF-8
Java
false
false
701
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 facades; import entitys.Positions; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; /** * * @author */ @Stateless public class PositionsFacade extends AbstractFacade<Positions> { @PersistenceContext(unitName = "WarehouseControlPanelPU") private EntityManager em; @Override protected EntityManager getEntityManager() { return em; } public PositionsFacade() { super(Positions.class); } }
[ "rahmabadr45@gmail.com" ]
rahmabadr45@gmail.com
1f5e7a269dcd10d4b3a9f3e1cd710353bce040e7
76ed080635936859162456b82871395e882a6462
/src/main/java/com/waterman/leetcode/算法/数组/拥有最多糖果的孩子/Solution.java
1e8e5745fd2fea3062d98750878be29750d525d9
[]
no_license
WaterMan666666/leetcode
18ec28b1989bb8ff8f0b33d8ae3f1977f881c84f
d37327742038bbeef4b339eda65e16a719fe34e2
refs/heads/master
2023-02-24T19:50:19.094847
2021-01-22T07:29:29
2021-01-22T07:29:29
268,445,385
0
0
null
null
null
null
UTF-8
Java
false
false
2,293
java
package com.waterman.leetcode.算法.数组.拥有最多糖果的孩子; import java.util.ArrayList; import java.util.List; /** * @author tongdong * @Date: 2020/6/1 * @Description: 1431. 拥有最多糖果的孩子 * 给你一个数组 candies 和一个整数 extraCandies ,其中 candies[i] 代表第 i 个孩子拥有的糖果数目。 * * 对每一个孩子,检查是否存在一种方案,将额外的 extraCandies 个糖果分配给孩子们之后,此孩子有 最多 的糖果。注意,允许有多个孩子同时拥有 最多 的糖果数目。 * *   * * 示例 1: * * 输入:candies = [2,3,5,1,3], extraCandies = 3 * 输出:[true,true,true,false,true] * 解释: * 孩子 1 有 2 个糖果,如果他得到所有额外的糖果(3个),那么他总共有 5 个糖果,他将成为拥有最多糖果的孩子。 * 孩子 2 有 3 个糖果,如果他得到至少 2 个额外糖果,那么他将成为拥有最多糖果的孩子。 * 孩子 3 有 5 个糖果,他已经是拥有最多糖果的孩子。 * 孩子 4 有 1 个糖果,即使他得到所有额外的糖果,他也只有 4 个糖果,无法成为拥有糖果最多的孩子。 * 孩子 5 有 3 个糖果,如果他得到至少 2 个额外糖果,那么他将成为拥有最多糖果的孩子。 * 示例 2: * * 输入:candies = [4,2,1,1,2], extraCandies = 1 * 输出:[true,false,false,false,false] * 解释:只有 1 个额外糖果,所以不管额外糖果给谁,只有孩子 1 可以成为拥有糖果最多的孩子。 * 示例 3: * * 输入:candies = [12,1,12], extraCandies = 10 * 输出:[true,false,true] */ public class Solution { public static void main(String[] args) { Solution solution = new Solution(); int[] nums = {4,2,1,1,2}; System.out.println(solution.kidsWithCandies(nums , 1)); } public List<Boolean> kidsWithCandies(int[] candies, int extraCandies) { int max = 0; for (int i = 0; i < candies.length; i++) { max = Math.max(max, candies[i]); } List<Boolean> result = new ArrayList<>(); for (int i = 0; i < candies.length; i++) { result.add(max <= candies[i] + extraCandies ); } return result; } }
[ "tongdong@xiaomi.com" ]
tongdong@xiaomi.com
b61cc63a0a022a0b2cfaf00dc9a95d5138ff52a6
73ea5a76382b21436a0bb625300e889ca6e06cf7
/src/test/java/com/mumu/page/LoginPage.java
2ff86a29521c1598d7bc2cd6cc458d833e7ebcbf
[]
no_license
mumumll/webMooc
11399c0f0a6dbecf79f7101d1e1df656b608b0e8
0ba5e79bb765b0f99910c6cc771dac237db7d388
refs/heads/main
2023-04-11T00:40:10.060606
2021-04-27T15:11:47
2021-04-27T15:11:47
358,302,065
0
0
null
null
null
null
UTF-8
Java
false
false
1,130
java
package com.mumu.page; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; /** * @author mumu * @Description: * @date 2021/4/15 17:18 */ public class LoginPage extends BasePage{ public LoginPage(WebDriver driver) { super(driver); // TODO Auto-generated constructor stub } //RegisterPage.java //获取元素 /** * 获取 手机号 元素 * 获取 验证码 元素 * 获取 注册按钮 元素 * */ public WebElement GetEmailElement() { return GetElement("username"); } public WebElement GetPasswordElement() { return GetElement("password"); } public WebElement GetSenvenElement() { return GetElement("senven"); } public WebElement GetLoginButtonElement() { return GetElement("loginbutton"); } public WebElement GetUsePngElement() { return GetElement("headpng"); } public WebElement GetUseInfoElement() { return GetElement("userinfo"); } public WebElement GetSigninButtonElement() { return GetElement("signin_button"); } }
[ "1270102724@qq.com" ]
1270102724@qq.com
c72b0e0a0b031a02434b015b4faad36b230d1fe9
50fa02889f0b4453228daaafbab85d0d05d7e27b
/Multiplication1.java
59d86ec443f75c2623751192c05ed5a4e566aa26
[]
no_license
charankatta2207/JavaBook
1fcfab71022a85fffa7a31e66243e0a3c1c762a6
6d2dcfac5a498a2fb9cb3088424fe4c5e9b842fe
refs/heads/master
2020-05-25T06:35:50.012279
2019-11-08T07:54:58
2019-11-08T07:54:58
187,670,298
0
0
null
null
null
null
UTF-8
Java
false
false
169
java
public class Multiplication1 { public static void main(String args[]) { int i,j; for(j=1;j<=20;j++) { for(i=1;i<=10;i++) { System.out.println(j+"*"+i+"="+j*i); } } } }
[ "cha6nkatta@gmail.com" ]
cha6nkatta@gmail.com