blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
98a8c2a98ded4b706c3c386eb025ea3931d580f0 | d54c7360b13e84aeab5daabde9aa504b1ce457e0 | /Ess/src/main/java/com/ulfric/ess/commands/CommandSetmotd.java | 3f2b3ed0845f7f2420b8e3f3b94171a77e355259 | [] | no_license | ThatForkyDev/LuckyPrison | 0fa1abfd4a83280522c6f100de2ac72c0e97c754 | ea0dd1a57986c2f8a5f8f6200f705bdb49f16e69 | refs/heads/master | 2022-01-17T18:30:15.317081 | 2016-12-27T13:29:19 | 2016-12-27T13:29:19 | 77,457,692 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,017 | java | package com.ulfric.ess.commands;
import java.util.regex.Pattern;
import com.ulfric.ess.modules.ModuleMotd;
import com.ulfric.lib.api.command.Argument;
import com.ulfric.lib.api.command.SimpleCommand;
import com.ulfric.lib.api.command.arg.ArgStrategy;
import com.ulfric.lib.api.java.Strings;
import com.ulfric.lib.api.locale.Locale;
public class CommandSetmotd extends SimpleCommand {
public CommandSetmotd()
{
this.withIndexUnusedArgs();
this.withArgument(Argument.builder().withPath("start").withStrategy(ArgStrategy.STRING).withRemovalExclusion());
}
@Override
public void run()
{
if (!this.hasObjects())
{
ModuleMotd.get().disable();
ModuleMotd.get().enable();
Locale.sendSuccess(this.getSender(), "ess.motd_reset");
return;
}
String[] parts = this.getUnusedArgs().split(Pattern.quote("-b"));
ModuleMotd.get().clear();
ModuleMotd.get().addMotd(parts[0].trim(), parts.length == 1 ? Strings.BLANK : parts[1].trim());
Locale.send(this.getSender(), "ess.motd_set");
}
} | [
"[email protected]"
] | |
097a6821d33387b61a7c7912629801328285cfef | 079ca0da2c1ab66569894f2a73d7375fca579c2b | /utils-apl-derived-table/src/main/java/org/omnaest/utils/table/StripeTransformer.java | 62ad8793788805149e90d4dd2bb3eb61cb7e1d96 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | zizopen/utils-apl-derived | 63666ccb6eb19502f73e19a1086283f7452d4626 | f97f31bd4f0b86c930f15ee53e6dc742a158bdba | refs/heads/master | 2021-01-23T19:45:42.197296 | 2015-02-01T16:10:05 | 2015-02-01T16:10:05 | 34,396,787 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,634 | java | /*******************************************************************************
* Copyright 2012 Danny Kunz
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package org.omnaest.utils.table;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Transforms the elements of a {@link Stripe} into a new independent other container instance
*
* @see StripeTransformerPlugin
* @see ImmutableStripe#to()
* @author Omnaest
* @param <E>
*/
public interface StripeTransformer<E> extends Serializable
{
/**
* Returns a new {@link Set} instance containing all elements
*
* @return
*/
public Set<E> set();
/**
* Returns an new array containing all elements
*
* @return
*/
public E[] array();
/**
* Returns an array of the given {@link Class} type
*
* @param type
* @return
*/
public <T> T[] array( Class<T> type );
/**
* Returns a new {@link List} instance containing all elements
*
* @return
*/
public List<E> list();
/**
* Returns a new {@link StripeEntity} instance
*
* @return
*/
public StripeEntity<E> entity();
/**
* Returns the {@link Stripe} transformed into the given type. <br>
* <br>
* To allow this to work there has to be a {@link StripeTransformerPlugin} registered to the underlying {@link Table}.
*
* @param type
* {@link Class}
* @return
*/
public <T> T instanceOf( Class<T> type );
/**
* Similar to {@link #instanceOf(Class)} using a given instance which is returned enriched with the data of the {@link Stripe}
*
* @param instance
* @return given instance
*/
public <T> T instance( T instance );
/**
* Returns the {@link Stripe} as a {@link Map}. The keys are the orthogonal titles and the values are the actual elements of the
* {@link Stripe}
*
* @return
*/
public Map<String, E> map();
}
| [
"[email protected]@4c589bc5-3898-6224-771f-302820b144f8"
] | [email protected]@4c589bc5-3898-6224-771f-302820b144f8 |
462fc5d36ebd8a454c5a66ee34049cf52dea90c4 | 40717edf78e7eeafdb28d7c9f133f45b5cd7d9f8 | /src/com/fuyue/util/ui/adapter/SectionAdapter.java | ef10af5e200fb3f2ba8ef40ce21239147dcf496b | [] | no_license | CalvinXuw/FuYueFrame | 965d6b9b002a8245786e5c012d485e1f7bcf62e3 | 9d8f71d9f587d413fb21aedacd71799efacc2fbe | refs/heads/master | 2021-01-10T21:28:22.207667 | 2013-12-19T08:50:29 | 2013-12-19T08:50:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,931 | java | package com.fuyue.util.ui.adapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
/**
* section适配器
*
* @author Calvin
*
*/
public abstract class SectionAdapter extends BaseAdapter {
@Override
public int getCount() {
int sectionCount = sectionCount();
int count = 0;
for (int i = 0; i < sectionCount; i++) {
count += getCountWithSection(i);
}
return count;
}
@Override
public Object getItem(int position) {
// 分配给各个section
for (int i = 0; i < sectionCount(); i++) {
if (getCountWithSection(i) > position) {
return getItemWithSection(i, position);
} else {
position -= getCountWithSection(i);
}
}
return null;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// 分配给各个section
for (int i = 0; i < sectionCount(); i++) {
if (getCountWithSection(i) > position) {
return getViewWithSection(i, position, convertView);
} else {
position -= getCountWithSection(i);
}
}
return null;
}
/**
* 获取分栏条数
*
* @return
*/
public abstract int sectionCount();
/**
* 获取指定sectionId下的item数量
*
* @param sectionId
* @return
*/
public abstract int getCountWithSection(int sectionId);
/**
* 获取是定sectionId下的某个item
*
* @param sectionId
* @param position
* @return
*/
public abstract Object getItemWithSection(int sectionId, int position);
/**
* 获取指定sectionId下的section name
*
* @param sectionId
* @return
*/
public abstract String getSectionName(int sectionId);
/**
* 根据sectionId和postion获取View
*
* @param sectionId
* @param position
* @param convertView
* @return
*/
public abstract View getViewWithSection(int sectionId, int position,
View convertView);
}
| [
"[email protected]"
] | |
52c355b96755a65f43a0f6cc8729f638cd27fc2e | 7130882e0708a1835dc6bc13ee92bbde1ef4abda | /src/main/java/org/monarch/golr/GolrLoaderModule.java | ad83f7edffa887268fcba6e94691a8840bbabe2a | [
"Apache-2.0"
] | permissive | SciGraph/golr-loader | cc95a5f6d16efd7f88d3d06f211862f47d87ba86 | 7368d11d074c3d010e824d58a9337466ab1f8f39 | refs/heads/master | 2022-11-23T03:44:34.760371 | 2021-12-09T20:04:07 | 2021-12-10T16:13:54 | 34,288,103 | 2 | 4 | Apache-2.0 | 2022-11-16T09:30:47 | 2015-04-20T21:41:40 | Java | UTF-8 | Java | false | false | 420 | java | package org.monarch.golr;
import io.scigraph.neo4j.Graph;
import io.scigraph.neo4j.GraphTransactionalImpl;
import javax.inject.Singleton;
import com.google.inject.AbstractModule;
import com.google.inject.assistedinject.FactoryModuleBuilder;
class GolrLoaderModule extends AbstractModule {
@Override
protected void configure() {
bind(Graph.class).to(GraphTransactionalImpl.class).in(Singleton.class);
}
}
| [
"[email protected]"
] | |
c6189b5d71de87668657f83a1b4aae38ad7ab6bc | 116447e0159b96bbdbd08c387e2ee774a0e31316 | /src/main/java/com/web/liuda/business/service/impl/.svn/text-base/PrizeOptionServiceImpl.java.svn-base | 27211bfafb19a0a33383466a164e7b9f30b3d247 | [] | no_license | SongJian0926/liuda | 675037dd38b5d7755b4a22ce43ac391e65a24076 | 438a81833c092fca27b3e91a13f0d707000d7457 | refs/heads/master | 2021-01-20T15:23:29.125554 | 2017-05-09T15:26:17 | 2017-05-09T15:26:17 | 90,762,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,006 | package com.web.liuda.business.service.impl;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.domain.Sort.Order;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSON;
import com.web.webstart.base.service.impl.BaseService;
import com.web.webstart.base.exception.BusinessException;
import com.web.webstart.base.constant.XaConstant;
import com.web.webstart.base.util.DynamicSpecifications;
import com.web.webstart.base.util.SearchFilter;
import com.web.webstart.base.util.SearchFilter.Operator;
import com.web.webstart.base.util.XaResult;
import com.web.webstart.base.util.XaUtil;
import com.web.liuda.business.entity.GuessLog;
import com.web.liuda.business.entity.PrizeOption;
import com.web.liuda.business.entity.PrizeResult;
import com.web.liuda.business.repository.GuessLogRepository;
import com.web.liuda.business.repository.PrizeOptionRepository;
import com.web.liuda.business.repository.PrizeResultRepository;
import com.web.liuda.business.service.PrizeOptionService;
import com.web.liuda.remote.vo.PrizeOptionVo;
import com.web.liuda.remote.vo.PrizeResultVo;
import com.web.liuda.remote.vo.UserVo;
@Service("PrizeOptionService")
@Transactional(readOnly = false)
public class PrizeOptionServiceImpl extends BaseService<PrizeOption> implements PrizeOptionService {
@Autowired
private PrizeOptionRepository prizeOptionRepository;
@Autowired
private PrizeResultRepository prizeResultRepository;
@Autowired
private GuessLogRepository guessLogRepository;
/**
* 查询单条PrizeOption信息
* @param tId
* @return 返回单个PrizeOption对象
* @throws BusinessException
*/
@Transactional(readOnly = true, rollbackFor = Exception.class)
public XaResult<PrizeOption> findOne(Long modelId) throws BusinessException {
PrizeOption obj = new PrizeOption();
if(modelId != 0){
obj = prizeOptionRepository.findByIdAndStatusNot(modelId,XaConstant.Status.delete);
}
XaResult<PrizeOption> xr = new XaResult<PrizeOption>();
if (XaUtil.isNotEmpty(obj)) {
xr.setObject(obj);
} else {
throw new BusinessException(XaConstant.Message.object_not_find);
}
return xr;
}
/**
* 分页查询状态非status的PrizeOption数据
* @param status
* @param filterParams
* @param pageable
* @return 返回对象PrizeOption集合
* @throws BusinessException
*/
@Transactional(readOnly = true, rollbackFor = Exception.class)
public XaResult<Page<PrizeOption>> findListNEStatusByFilter(
Integer status, Map<String, Object> filterParams, Pageable pageable) throws BusinessException {
Map<String, SearchFilter> filters = SearchFilter.parse(filterParams);
if(status == null){// 默认显示非删除的所有数据
status = XaConstant.Status.delete;
}
filters.put("status", new SearchFilter("status", Operator.NE, status));
Page<PrizeOption> page = prizeOptionRepository.findAll(DynamicSpecifications
.bySearchFilter(filters.values(), PrizeOption.class), pageable);
XaResult<Page<PrizeOption>> xr = new XaResult<Page<PrizeOption>>();
xr.setObject(page);
return xr;
}
/**
* 分页查询状态status的PrizeOption数据
* @param status
* @param filterParams
* @param pageable
* @return 返回对象PrizeOption集合
* @throws BusinessException
*/
@Transactional(readOnly = true, rollbackFor = Exception.class)
public XaResult<Page<PrizeOption>> findListEQStatusByFilter(
Integer status, Map<String, Object> filterParams, Pageable pageable) throws BusinessException {
Map<String, SearchFilter> filters = SearchFilter.parse(filterParams);
if(status == null){// 默认显示正常数据
status = XaConstant.Status.valid;
}
filters.put("status", new SearchFilter("status", Operator.EQ, status));
Page<PrizeOption> page = prizeOptionRepository.findAll(DynamicSpecifications
.bySearchFilter(filters.values(), PrizeOption.class), pageable);
XaResult<Page<PrizeOption>> xr = new XaResult<Page<PrizeOption>>();
xr.setObject(page);
return xr;
}
/**
* 保存PrizeOption信息
* @param model
* @return
* @throws BusinessException
*/
@Transactional(rollbackFor = Exception.class)
public XaResult<PrizeOption> saveOrUpdate(PrizeOption model) throws BusinessException {
PrizeOption obj = null;
if(XaUtil.isNotEmpty(model.getId())){
obj = prizeOptionRepository.findOne(model.getId());
}else{
obj = new PrizeOption();
}
obj.setMatchId(model.getMatchId());
obj.setLevel(model.getLevel());
obj.setNum(model.getNum());
obj.setPrize(model.getPrize());
obj = prizeOptionRepository.save(obj);
XaResult<PrizeOption> xr = new XaResult<PrizeOption>();
xr.setObject(obj);
return xr;
}
/**
* 修改PrizeOption状态,可一次修改多条 3删除 -1锁定 1正常
* @param userId
* @param modelIds
* @param status
* @return 返回PrizeOption对象
* @throws BusinessException
*/
@Transactional(rollbackFor = Exception.class)
public XaResult<PrizeOption> multiOperate(
String modelIds,Integer status) throws BusinessException {
XaResult<PrizeOption> xr = new XaResult<PrizeOption>();
if(status == null){
status = XaConstant.Status.delete;
}
if(modelIds != null){
String[] ids = modelIds.split(",");
for(String id : ids){
PrizeOption obj = prizeOptionRepository.findByIdAndStatusNot(Long.parseLong(id),status);
if (XaUtil.isNotEmpty(obj)) {
obj.setStatus(status);
obj = prizeOptionRepository.save(obj);
} else {
throw new BusinessException(XaConstant.Message.object_not_find);
}
}
}
return xr;
}
@Override
public XaResult<List<PrizeOptionVo>> findByMacthIdAndNotStatus(Long matchId, Integer status) throws BusinessException {
Map<String, SearchFilter> filters = new HashMap<String, SearchFilter>();
if(XaUtil.isNotEmpty(status))
{
filters.put("status", new SearchFilter("status", Operator.NE, status));
}
if(XaUtil.isNotEmpty(matchId))
{
filters.put("matchId", new SearchFilter("matchId", Operator.EQ, matchId));
}
//查二次抽奖内容
List<PrizeOption> polst = prizeOptionRepository.findAll(DynamicSpecifications.bySearchFilter(filters.values(), PrizeOption.class));
List<PrizeOptionVo> lstpo = new ArrayList<PrizeOptionVo>();
Map<Long,PrizeOptionVo> mappo = new HashMap<Long,PrizeOptionVo>();
for(int i=0;i<polst.size();i++)
{
PrizeOptionVo pov = JSON.parseObject(JSON.toJSONString(polst.get(i)),PrizeOptionVo.class);
pov.setPrizeResultList(new ArrayList<PrizeResultVo>());
lstpo.add(pov);
mappo.put(pov.getId(), pov);
}
//查二次抽奖中奖人数
if(polst.size()>0)
{
List<Object[]> prlst = prizeResultRepository.findByMatchIdAndStatusNot(XaConstant.Status.delete,matchId);
for(Object[] obj : prlst)
{
if(mappo.containsKey(Long.parseLong(obj[4].toString())))
{
PrizeResultVo grv = new PrizeResultVo();
grv.setId(Long.parseLong(obj[0].toString()));
grv.setCreateTime(obj[1]==null?null:obj[1].toString());
grv.setUserId(Long.parseLong(obj[2].toString()));
grv.setMatchId(Long.parseLong(obj[3].toString()));
grv.setPrizeOptionId(Long.parseLong(obj[4].toString()));
grv.setStatus(Integer.parseInt(obj[7].toString()));
UserVo userVo = new UserVo();
userVo.setId(Long.parseLong(obj[2].toString()));
userVo.setUserName(obj[5]==null?null:obj[5].toString());
userVo.setPhoto(obj[6]==null?null:obj[6].toString());
userVo.setMobile(obj[8]==null?null:obj[8].toString());
grv.setUserVo(userVo);
mappo.get(Long.parseLong(obj[4].toString())).getPrizeResultList().add(grv);
}
}
}
XaResult<List<PrizeOptionVo>> xr = new XaResult<List<PrizeOptionVo>>();
xr.setObject(lstpo);
return xr;
}
@Override
public XaResult<List<PrizeOptionVo>> setPrizeOptionResult(Long matchId) throws BusinessException {
XaResult<List<PrizeOptionVo>> xr = new XaResult<List<PrizeOptionVo>>();
//查询是否已经发布抽奖
List<Object[]> prlst = prizeResultRepository.findByMatchId(XaConstant.Status.publish,matchId);
if(prlst.size()>0)
{
xr.error("抽奖结果已经发布,无法再次抽奖");
return xr;
}
Map<String, SearchFilter> filters = new HashMap<String, SearchFilter>();
filters.put("status", new SearchFilter("status", Operator.NE, XaConstant.Status.delete));
filters.put("matchId", new SearchFilter("matchId", Operator.EQ, matchId));
//查二次抽奖内容(抽奖内容要排序)
Sort sort = new Sort(new Order(Direction.ASC, "level"));
List<PrizeOption> polst = prizeOptionRepository.findAll(DynamicSpecifications.bySearchFilter(filters.values(), PrizeOption.class),sort);
if(polst.size()==0)
{
xr.error("未设置抽奖内容,无法抽奖");
return xr;
}
//查询竞猜总人数
List<GuessLog> gllst = guessLogRepository.findAll(DynamicSpecifications.bySearchFilter(filters.values(), GuessLog.class));
if(gllst.size()==0)
{
xr.error("没有人竞猜,无法抽奖");
return xr;
}
//删除之前的抽奖结果
List<PrizeResult> oprlst = prizeResultRepository.findAll(DynamicSpecifications.bySearchFilter(filters.values(), PrizeResult.class));
prizeResultRepository.delete(oprlst);
//以下开始抽奖
Integer totlePrize = 0; //所有奖品总数
//Map<Long,Integer> plmap = new HashMap<Long,Integer>(); //奖品等级,奖品数量
List<Long> plist = new ArrayList<Long>();
for(PrizeOption po : polst)
{
totlePrize += po.getNum();
//plmap.put(po.getId(), po.getNum());
for(int i=0;i<po.getNum();i++)
{
plist.add(po.getId());
}
}
Collections.shuffle(gllst);//把候选人名单排序打乱
List<GuessLog> prizePople;//中奖人名单
if(totlePrize>=gllst.size())//所有人都中奖
{
prizePople = gllst;
}
else//选取部分人中奖
{
prizePople = new ArrayList<GuessLog>();
int totalPople = gllst.size(); //总人数
for(int i=0;i<totlePrize;i++)
{
int num = (int) (Math.random() * totalPople); // 注意不要写成(int)Math.random()*3,这个结果为0,因为先执行了强制转换
prizePople.add(gllst.get(num));
gllst.remove(num);
totalPople --;
}
}
Collections.shuffle(prizePople);//把中奖人名单排序打乱
//中奖过程赋值
for(int i=0;i<prizePople.size();i++)
{
PrizeResult pr = new PrizeResult();
pr.setMatchId(matchId);
pr.setStatus(XaConstant.Status.valid);
pr.setPrizeOptionId(plist.get(i));
pr.setUserId(prizePople.get(i).getUserId());
pr.setCreateTime(XaUtil.getToDayStr());
prizeResultRepository.save(pr);
}
return xr;
}
@Override
public XaResult<List<PrizeOptionVo>> publishPrize(Long matchId) throws BusinessException {
XaResult<List<PrizeOptionVo>> xr = new XaResult<List<PrizeOptionVo>>();
//查询是否已经发布抽奖
List<Object[]> prlst = prizeResultRepository.findByMatchId(XaConstant.Status.publish,matchId);
if(prlst.size()>0)
{
xr.error("抽奖结果已经发布过了");
return xr;
}
Map<String, SearchFilter> filters = new HashMap<String, SearchFilter>();
filters.put("status", new SearchFilter("status", Operator.NE, XaConstant.Status.delete));
filters.put("matchId", new SearchFilter("matchId", Operator.EQ, matchId));
List<PrizeResult> oprlst = prizeResultRepository.findAll(DynamicSpecifications.bySearchFilter(filters.values(), PrizeResult.class));
if(oprlst.size()==0)
{
xr.error("尚未抽奖,无法发布");
return xr;
}
for(PrizeResult pr : oprlst)
{
pr.setStatus(XaConstant.Status.publish);
prizeResultRepository.save(pr);
}
return xr;
}
}
| [
"[email protected]"
] | ||
89dc7fd695458c70567156aaffbb68387ecb30e0 | fc160694094b89ab09e5c9a0f03db80437eabc93 | /java-confidentialcomputing/google-cloud-confidentialcomputing/src/main/java/com/google/cloud/confidentialcomputing/v1alpha1/stub/GrpcConfidentialComputingStub.java | 8acf53afca45e96b89778e7aff3433c3cb847748 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | googleapis/google-cloud-java | 4f4d97a145e0310db142ecbc3340ce3a2a444e5e | 6e23c3a406e19af410a1a1dd0d0487329875040e | refs/heads/main | 2023-09-04T09:09:02.481897 | 2023-08-31T20:45:11 | 2023-08-31T20:45:11 | 26,181,278 | 1,122 | 685 | Apache-2.0 | 2023-09-13T21:21:23 | 2014-11-04T17:57:16 | Java | UTF-8 | Java | false | false | 11,995 | java | /*
* Copyright 2023 Google LLC
*
* 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
*
* https://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.google.cloud.confidentialcomputing.v1alpha1.stub;
import static com.google.cloud.confidentialcomputing.v1alpha1.ConfidentialComputingClient.ListLocationsPagedResponse;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
import com.google.api.gax.grpc.GrpcCallSettings;
import com.google.api.gax.grpc.GrpcStubCallableFactory;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.RequestParamsBuilder;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.confidentialcomputing.v1alpha1.Challenge;
import com.google.cloud.confidentialcomputing.v1alpha1.CreateChallengeRequest;
import com.google.cloud.confidentialcomputing.v1alpha1.VerifyAttestationRequest;
import com.google.cloud.confidentialcomputing.v1alpha1.VerifyAttestationResponse;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.longrunning.stub.GrpcOperationsStub;
import io.grpc.MethodDescriptor;
import io.grpc.protobuf.ProtoUtils;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* gRPC stub implementation for the ConfidentialComputing service API.
*
* <p>This class is for advanced usage and reflects the underlying API directly.
*/
@BetaApi
@Generated("by gapic-generator-java")
public class GrpcConfidentialComputingStub extends ConfidentialComputingStub {
private static final MethodDescriptor<CreateChallengeRequest, Challenge>
createChallengeMethodDescriptor =
MethodDescriptor.<CreateChallengeRequest, Challenge>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.confidentialcomputing.v1alpha1.ConfidentialComputing/CreateChallenge")
.setRequestMarshaller(
ProtoUtils.marshaller(CreateChallengeRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Challenge.getDefaultInstance()))
.build();
private static final MethodDescriptor<VerifyAttestationRequest, VerifyAttestationResponse>
verifyAttestationMethodDescriptor =
MethodDescriptor.<VerifyAttestationRequest, VerifyAttestationResponse>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName(
"google.cloud.confidentialcomputing.v1alpha1.ConfidentialComputing/VerifyAttestation")
.setRequestMarshaller(
ProtoUtils.marshaller(VerifyAttestationRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(VerifyAttestationResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor<ListLocationsRequest, ListLocationsResponse>
listLocationsMethodDescriptor =
MethodDescriptor.<ListLocationsRequest, ListLocationsResponse>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.location.Locations/ListLocations")
.setRequestMarshaller(
ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance()))
.setResponseMarshaller(
ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance()))
.build();
private static final MethodDescriptor<GetLocationRequest, Location> getLocationMethodDescriptor =
MethodDescriptor.<GetLocationRequest, Location>newBuilder()
.setType(MethodDescriptor.MethodType.UNARY)
.setFullMethodName("google.cloud.location.Locations/GetLocation")
.setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance()))
.setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance()))
.build();
private final UnaryCallable<CreateChallengeRequest, Challenge> createChallengeCallable;
private final UnaryCallable<VerifyAttestationRequest, VerifyAttestationResponse>
verifyAttestationCallable;
private final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable;
private final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable;
private final UnaryCallable<GetLocationRequest, Location> getLocationCallable;
private final BackgroundResource backgroundResources;
private final GrpcOperationsStub operationsStub;
private final GrpcStubCallableFactory callableFactory;
public static final GrpcConfidentialComputingStub create(
ConfidentialComputingStubSettings settings) throws IOException {
return new GrpcConfidentialComputingStub(settings, ClientContext.create(settings));
}
public static final GrpcConfidentialComputingStub create(ClientContext clientContext)
throws IOException {
return new GrpcConfidentialComputingStub(
ConfidentialComputingStubSettings.newBuilder().build(), clientContext);
}
public static final GrpcConfidentialComputingStub create(
ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException {
return new GrpcConfidentialComputingStub(
ConfidentialComputingStubSettings.newBuilder().build(), clientContext, callableFactory);
}
/**
* Constructs an instance of GrpcConfidentialComputingStub, using the given settings. This is
* protected so that it is easy to make a subclass, but otherwise, the static factory methods
* should be preferred.
*/
protected GrpcConfidentialComputingStub(
ConfidentialComputingStubSettings settings, ClientContext clientContext) throws IOException {
this(settings, clientContext, new GrpcConfidentialComputingCallableFactory());
}
/**
* Constructs an instance of GrpcConfidentialComputingStub, using the given settings. This is
* protected so that it is easy to make a subclass, but otherwise, the static factory methods
* should be preferred.
*/
protected GrpcConfidentialComputingStub(
ConfidentialComputingStubSettings settings,
ClientContext clientContext,
GrpcStubCallableFactory callableFactory)
throws IOException {
this.callableFactory = callableFactory;
this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory);
GrpcCallSettings<CreateChallengeRequest, Challenge> createChallengeTransportSettings =
GrpcCallSettings.<CreateChallengeRequest, Challenge>newBuilder()
.setMethodDescriptor(createChallengeMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("parent", String.valueOf(request.getParent()));
return builder.build();
})
.build();
GrpcCallSettings<VerifyAttestationRequest, VerifyAttestationResponse>
verifyAttestationTransportSettings =
GrpcCallSettings.<VerifyAttestationRequest, VerifyAttestationResponse>newBuilder()
.setMethodDescriptor(verifyAttestationMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("challenge", String.valueOf(request.getChallenge()));
return builder.build();
})
.build();
GrpcCallSettings<ListLocationsRequest, ListLocationsResponse> listLocationsTransportSettings =
GrpcCallSettings.<ListLocationsRequest, ListLocationsResponse>newBuilder()
.setMethodDescriptor(listLocationsMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
GrpcCallSettings<GetLocationRequest, Location> getLocationTransportSettings =
GrpcCallSettings.<GetLocationRequest, Location>newBuilder()
.setMethodDescriptor(getLocationMethodDescriptor)
.setParamsExtractor(
request -> {
RequestParamsBuilder builder = RequestParamsBuilder.create();
builder.add("name", String.valueOf(request.getName()));
return builder.build();
})
.build();
this.createChallengeCallable =
callableFactory.createUnaryCallable(
createChallengeTransportSettings, settings.createChallengeSettings(), clientContext);
this.verifyAttestationCallable =
callableFactory.createUnaryCallable(
verifyAttestationTransportSettings,
settings.verifyAttestationSettings(),
clientContext);
this.listLocationsCallable =
callableFactory.createUnaryCallable(
listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
this.listLocationsPagedCallable =
callableFactory.createPagedCallable(
listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
this.getLocationCallable =
callableFactory.createUnaryCallable(
getLocationTransportSettings, settings.getLocationSettings(), clientContext);
this.backgroundResources =
new BackgroundResourceAggregation(clientContext.getBackgroundResources());
}
public GrpcOperationsStub getOperationsStub() {
return operationsStub;
}
@Override
public UnaryCallable<CreateChallengeRequest, Challenge> createChallengeCallable() {
return createChallengeCallable;
}
@Override
public UnaryCallable<VerifyAttestationRequest, VerifyAttestationResponse>
verifyAttestationCallable() {
return verifyAttestationCallable;
}
@Override
public UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() {
return listLocationsCallable;
}
@Override
public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse>
listLocationsPagedCallable() {
return listLocationsPagedCallable;
}
@Override
public UnaryCallable<GetLocationRequest, Location> getLocationCallable() {
return getLocationCallable;
}
@Override
public final void close() {
try {
backgroundResources.close();
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new IllegalStateException("Failed to close resource", e);
}
}
@Override
public void shutdown() {
backgroundResources.shutdown();
}
@Override
public boolean isShutdown() {
return backgroundResources.isShutdown();
}
@Override
public boolean isTerminated() {
return backgroundResources.isTerminated();
}
@Override
public void shutdownNow() {
backgroundResources.shutdownNow();
}
@Override
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
return backgroundResources.awaitTermination(duration, unit);
}
}
| [
"[email protected]"
] | |
6c605c82905cdf1a99d08bfa67cfac2df8d07080 | 3ab5f3c529e281b7a83e499368c94eb79094dd3a | /src/main/java/ar/gob/gcba/dgisis/aplicaciones/config/FeignConfiguration.java | 954737697d152e622a25e44330b9d607b570bfd3 | [] | no_license | scarabetta/mapa360-aplicaciones | 6cabaa0c5aebe15337f8d76406647e5b0c98152d | 9410977eb5c2813d7a19347c0dea5213be8a768d | refs/heads/master | 2020-03-29T10:25:25.364175 | 2018-09-21T18:48:44 | 2018-09-21T18:48:44 | 149,804,528 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 533 | java | package ar.gob.gcba.dgisis.aplicaciones.config;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableFeignClients(basePackages = "ar.gob.gcba.dgisis.aplicaciones")
public class FeignConfiguration {
/**
* Set the Feign specific log level to log client REST requests
*/
@Bean
feign.Logger.Level feignLoggerLevel() {
return feign.Logger.Level.BASIC;
}
}
| [
"[email protected]"
] | |
8ccc82f19b6c3d72296b2ba04ce3de301bece3c0 | b99dbac37852ef4210409e577d00c670fe7da48c | /src/main/java/com/manager/common/service/impl/DoiTuongServiceImpl.java | cb6051e2da56e93816bebc812637bc2266ea0ec0 | [] | no_license | devhvm/snv_common | e0973888d3422ab16a98566e51445dd214db0b10 | 5a862c8a2470c66fe4f263e853c985d066dd619a | refs/heads/master | 2022-12-11T02:56:42.890668 | 2019-04-01T01:43:19 | 2019-04-01T01:43:19 | 178,160,963 | 0 | 0 | null | 2022-12-08T19:47:11 | 2019-03-28T08:36:36 | Java | UTF-8 | Java | false | false | 2,596 | java | package com.manager.common.service.impl;
import com.manager.common.service.DoiTuongService;
import com.manager.common.domain.DoiTuong;
import com.manager.common.repository.DoiTuongRepository;
import com.manager.common.service.dto.DoiTuongDTO;
import com.manager.common.service.mapper.DoiTuongMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
/**
* Service Implementation for managing DoiTuong.
*/
@Service
@Transactional
public class DoiTuongServiceImpl implements DoiTuongService {
private final Logger log = LoggerFactory.getLogger(DoiTuongServiceImpl.class);
private final DoiTuongRepository doiTuongRepository;
private final DoiTuongMapper doiTuongMapper;
public DoiTuongServiceImpl(DoiTuongRepository doiTuongRepository, DoiTuongMapper doiTuongMapper) {
this.doiTuongRepository = doiTuongRepository;
this.doiTuongMapper = doiTuongMapper;
}
/**
* Save a doiTuong.
*
* @param doiTuongDTO the entity to save
* @return the persisted entity
*/
@Override
public DoiTuongDTO save(DoiTuongDTO doiTuongDTO) {
log.debug("Request to save DoiTuong : {}", doiTuongDTO);
DoiTuong doiTuong = doiTuongMapper.toEntity(doiTuongDTO);
doiTuong = doiTuongRepository.save(doiTuong);
return doiTuongMapper.toDto(doiTuong);
}
/**
* Get all the doiTuongs.
*
* @param pageable the pagination information
* @return the list of entities
*/
@Override
@Transactional(readOnly = true)
public Page<DoiTuongDTO> findAll(Pageable pageable) {
log.debug("Request to get all DoiTuongs");
return doiTuongRepository.findAll(pageable)
.map(doiTuongMapper::toDto);
}
/**
* Get one doiTuong by id.
*
* @param id the id of the entity
* @return the entity
*/
@Override
@Transactional(readOnly = true)
public Optional<DoiTuongDTO> findOne(Long id) {
log.debug("Request to get DoiTuong : {}", id);
return doiTuongRepository.findById(id)
.map(doiTuongMapper::toDto);
}
/**
* Delete the doiTuong by id.
*
* @param id the id of the entity
*/
@Override
public void delete(Long id) {
log.debug("Request to delete DoiTuong : {}", id); doiTuongRepository.deleteById(id);
}
}
| [
"[email protected]"
] | |
6ac600a3d1fb8076336de3f2131ec99af47caaea | 53c33acafd582501bd21c359ef55f4f9425911d2 | /TeamCode/src/main/java/org/firstinspires/ftc/teamcode/RobotDirectionDrive.java | 147ed6336a71a3de3087bf81f53be422b27afac6 | [
"BSD-3-Clause"
] | permissive | MessMaker236/HFRoboticsAppMaster | 8e3676136b484fdc60d43936efa57cf5467429e0 | 57c5de44670b09a87214e89f9c3c61563b6f111f | refs/heads/master | 2020-06-16T03:03:58.139851 | 2017-01-16T17:43:55 | 2017-01-16T17:43:55 | 75,250,996 | 0 | 0 | null | 2016-12-03T22:54:47 | 2016-12-01T03:22:26 | Java | UTF-8 | Java | false | false | 256 | java | package org.firstinspires.ftc.teamcode;
/**
* Created by bm121 on 12/14/2016.
*/
public enum RobotDirectionDrive {
FORWARD, BACK, LEFT, RIGHT, DFLEFT, DFRIGHT, DBLEFT, DBRIGHT, SPINLEFT, SPINRIGHT; //Sets enum values for direction driving
}
| [
"[email protected]"
] | |
2c947c6adecafeb117303493ba97399b4519ae95 | 53874726c184947a6f08beb9c0d990bfe3da8038 | /Anastasiya_Bezmen/OOP-task/src/by/task/soundrecording/Main.java | 72e0ff9784a50610a83f820f43d691d1da44d80e | [] | no_license | IharSuvorau1/training2020 | 839efd20cd08fc8d469102435f1088890db4e8f4 | 9e4d559b0cf875d86ebacd8b9067cb3bd44d46f5 | refs/heads/master | 2023-03-11T23:21:12.943371 | 2021-03-02T09:31:14 | 2021-03-02T09:31:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,151 | java | package by.task.soundrecording;
import by.task.soundrecording.domain.Disk;
import by.task.soundrecording.domain.MusicComposition;
import by.task.soundrecording.exception.SystemInputException;
import by.task.soundrecording.service.DiskService;
import by.task.soundrecording.service.IDiskService;
import by.task.soundrecording.service.IMusicService;
import by.task.soundrecording.service.MusicService;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
private static IMusicService musicService = MusicService.getInstance();
private static IDiskService diskService = DiskService.getInstance();
private static boolean isRunning = true;
public static void main(String[] args) {
while (isRunning) {
printActionList();
handleSelection(enterIntValue());
}
}
private static void printActionList() {
System.out.println("==============================");
System.out.println("Выберите необходимое действие:");
System.out.println();
System.out.println("1. Вывести всю музыку");
System.out.println("2. Вывести всe имеющиеся диски");
System.out.println("3. Создать чистый диск");
System.out.println("4. Записать сборку на диск");
System.out.println("5. Вывести весь список композиций на диске");
System.out.println("6. Сортировать композиции на диске по жанрам");
System.out.println("7. Рассчитать общую продолжительность треков на диске");
System.out.println("8. Фильтровать композиции на диске по заданному диапазону длины треков");
System.out.println("9. Выход");
}
private static int enterIntValue() {
Scanner scan = new Scanner(System.in);
if (scan.hasNextInt()) {
return scan.nextInt();
}
return 0;
}
private static String enterStringValue() {
Scanner scan = new Scanner(System.in);
return scan.nextLine();
}
private static void handleSelection(int choice) {
if (choice == 1) {
printAllMusic();
} else if (choice == 2) {
printAllDisks();
} else if (choice == 3) {
createDisc();
} else if (choice == 4) {
writeDiskWithMusic();
} else if (choice == 5) {
printMusicOnDisk();
} else if (choice == 6) {
printMusicSortedByGenre();
} else if (choice == 7) {
getMusicLength();
} else if (choice == 8) {
filterByLength();
} else if (choice == 9) {
isRunning = false;
} else {
System.out.println("Выберите один из предложенных вариантов!!!");
}
}
private static String enterDiscName() throws SystemInputException {
System.out.println("Введите название необходимого диска");
String diskName = selectDisk();
if (diskName == null) {
throw new SystemInputException("Вы ввели не правильное имя диска");
}
return diskName;
}
private static void filterByLength() {
try {
String discName = enterDiscName();
System.out.println("Введите минимальное значение продолжительности композиций");
int minLength = enterIntValue();
System.out.println("Введите максимальное значение продолжительности композиций");
int maxLength = enterIntValue();
List<MusicComposition> musicRange = diskService.getMusicRange(discName, minLength, maxLength);
for (MusicComposition musicComposition : musicRange) {
System.out.println(musicComposition);
}
} catch (SystemInputException ex) {
System.out.println(ex.getMessage());
}
}
private static void getMusicLength() {
try {
System.out.println(diskService.getMusicLength(enterDiscName()));
} catch (SystemInputException ex) {
System.out.println(ex.getMessage());
}
}
private static void printMusic(List<MusicComposition> musicCompositions) {
if (musicCompositions == null || musicCompositions.isEmpty()) {
System.out.println("Диск пуст");
} else {
for (MusicComposition musicComposition : musicCompositions) {
System.out.println(musicComposition);
}
}
}
private static void printMusicSortedByGenre() {
try {
String discName = enterDiscName();
List<MusicComposition> sortedMusic = diskService.getSortedMusic(discName);
printMusic(sortedMusic);
} catch (SystemInputException ex) {
System.out.println(ex.getMessage());
}
}
private static void printMusicOnDisk() {
try {
String discName = enterDiscName();
List<MusicComposition> musicOnDisk = diskService.getMusicOnDisk(discName);
printMusic(musicOnDisk);
} catch (SystemInputException ex) {
System.out.println(ex.getMessage());
}
}
private static void printAllDisks() {
List<Disk> disks = diskService.getAll();
disks.forEach(System.out::println);
}
private static void printAllMusic() {
List<MusicComposition> allMusic = musicService.getAll();
allMusic.forEach(System.out::println);
}
private static void createDisc() {
System.out.println("Введите название диска");
String diskName = enterStringValue();
while (diskName.trim().equals("")) {
System.out.println("Введите название диска (не может быть пустым).");
diskName = enterStringValue();
}
diskService.createNewDisk(diskName);
}
private static void writeDiskWithMusic() {
try {
String discName = enterDiscName();
List<Long> musicIds = selectMusic();
if (musicIds.isEmpty()) {
System.out.println("Выберите композиции для записи");
} else {
writeMusic(discName, musicIds);
}
} catch (SystemInputException ex) {
System.out.println(ex.getMessage());
}
}
private static List<Long> selectMusic() throws SystemInputException {
System.out.println("Введите через пробел Id музыкальных композиций");
String musicIds = enterStringValue();
String[] musicIdsArray = musicIds.split("");
List<Long> result = new ArrayList<>();
try {
for (int i = 0; i < musicIdsArray.length; i++) {
result.add(Long.valueOf(musicIdsArray[i]));
}
} catch (NumberFormatException e) {
throw new SystemInputException("id композиций введены не корректно");
}
return result;
}
private static void writeMusic(String diskName, List<Long> musicIds) {
diskService.writeMusic(diskName, musicIds);
}
private static String selectDisk() {
String diskName = enterStringValue().trim();
if (diskName.equals("")) {
return null;
}
if (diskService.isDiskExists(diskName)) {
return diskName;
} else {
return null;
}
}
}
| [
"[email protected]"
] | |
adafd1bdd46d2d5ecf290d55eb16d681b2b10e95 | 163332a7912b1d385f431289df963744d0d7916f | /src/utils/GsonTest.java | 7651948292268abe37a52cc290ca5809d2d2bb70 | [
"MIT"
] | permissive | ivanbravi/RinascimentoFramework | 90ee1016a67e303d30f038d18a63c4ec92ba1e78 | ce31592f78572096ceedd5ced1bac4f82c5f08db | refs/heads/master | 2023-05-25T12:18:07.777143 | 2023-05-11T06:53:03 | 2023-05-11T06:53:03 | 188,228,414 | 6 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,023 | java | package utils;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.Reader;
import java.io.Writer;
import java.util.ArrayList;
public class GsonTest {
public static void main(String[] args){
String path = "agents.json";
AgentsConfig playerData = new AgentsConfig(new AgentDescription[]{new AgentDescription("RHEA",new int[]{0,0,0,0,0,0}),
new AgentDescription("MCTS",new int[]{0,0,0,0,0,0}),
new AgentDescription("SRHEA", new int[]{1,3}),
new AgentDescription("OSLA",null)});
try (Writer w = new FileWriter(path)){
Gson writer = new GsonBuilder().setPrettyPrinting().create();
writer.toJson(playerData, w);
}catch (Exception e){
e.printStackTrace();
}
AgentsConfig playerDataRead = null;
try (Reader r = new FileReader(path)) {
Gson parser = new Gson();
playerDataRead = parser.fromJson(r, AgentsConfig.class);
}catch (Exception e){
e.printStackTrace();
}
System.out.println();
}
}
| [
"[email protected]"
] | |
cc64da55ee4035f147185c98e022e12e6d28dbd7 | 29693c21f1958f1dc8573d47828726e2ed41bdc1 | /src/engine/network/SomeRequest.java | a83b447dcd97e4af003f405725075cdaf8ce9f4c | [
"MIT"
] | permissive | mikeant42/Vulture | ff82fe40ef07d95975b40db59d6869dde40e6575 | e944fefe30eb489401b39f6077e49c59d34ade70 | refs/heads/master | 2021-09-09T09:53:56.534256 | 2018-03-14T22:44:51 | 2018-03-14T22:44:51 | 77,869,585 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 78 | java | package engine.network;
public class SomeRequest {
public String text;
}
| [
"[email protected]"
] | |
0bffa7dba36af31b8b8b82afe808a7a046f51147 | 8c8e721bb3dca431bd8e29f0f6d28afa7410184e | /src/test/java/com/application/pages/EmailPage.java | 7390d081ef50e7e36166785be8a32e15442a0123 | [] | no_license | qashack/numberz | 888ae56c63d9dced9c90e934ff0dfddfded2840b | 8021a9640539432c9292cbc565dd6cd8ffe96467 | refs/heads/master | 2021-05-07T15:46:34.997058 | 2017-12-20T12:28:12 | 2017-12-20T12:28:12 | 108,539,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,763 | java | package com.application.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.testng.Assert;
import com.application.libraries.GenericUtils;
public class EmailPage extends TaxInvoicePage {
WebDriver driver;
@FindBy(xpath = "//div[@class='modal-body']//button[text()='Send']")
private WebElement emailSendButton;
@FindBy(xpath = "//div[@class='modal-body']//button[text()='Cancel']")
private WebElement emailcancelButton;
@FindBy(xpath = "//div[@class='modal-body']//input[@placeholder='Email ID']")
private WebElement emailtoField1;
@FindBy(xpath = "//div[@class='modal-body']//input[@placeholder='Use comma(,) to add multiple emails']")
private WebElement emailccField1;
@FindBy(xpath = "//div[@class='modal-body']//input[@placeholder='Subject']")
private WebElement emailSubjectField;
@FindBy(xpath = "//body[@id='tinymce']/p")
private WebElement emailBody;
@FindBy(xpath = "(//div[@class='modal-body']//input[@type='checkbox'])[1]")
private WebElement emailGetFinance;
@FindBy(xpath = "(//div[@class='modal-body']//input[@type='checkbox'])[2]")
private WebElement emailPayNow;
public EmailPage(WebDriver driver) {
super(driver);
this.driver = driver;
PageFactory.initElements(driver, this);
}
public EmailPage addEmailTo(String emailto) {
emailtoField1.clear();
emailtoField1.sendKeys(emailto);
return this;
}
public EmailPage addEmailCc(String emailcc) {
emailccField1.clear();
emailccField1.sendKeys(emailcc);
return this;
}
public EmailPage verifyEmailTocc() {
String emailTo = emailtoField1.getAttribute("value");
String emailcc = emailccField1.getAttribute("value");
System.out.println("email to" + emailTo + ":emailcc" + emailcc);
int et = emailTo.length();
int et1 = emailcc.length();
System.out.println("t and t1" + et + " :" + et1);
if ((et1 == 0) || (et == 0)) {
Assert.assertFalse(true, "Email to and cc not populated Automatically");
} else {
Assert.assertTrue(true);
}
return this;
}
public EmailPage verifyEmailSubject(String data) {
String subject = emailSubjectField.getAttribute("value");
if (subject.contains(data)) {
Assert.assertFalse(true, "Subject not populated properly");
} else {
Assert.assertTrue(true);
}
return this;
}
public EmailPage verifyEmailBody(String data) {
driver.switchTo().frame("react-tinymce-0_ifr");
String subject = emailBody.getText();
if (subject.contains(data)) {
Assert.assertFalse(true, "Subject not populated properly");
} else {
Assert.assertTrue(true);
}
return this;
}
public EmailPage clickOnGetFinance() {
GenericUtils.delay(2);
if (!emailGetFinance.isSelected()) {
emailGetFinance.click();
}
return this;
}
public EmailPage verifyGetFianance(int k) {
System.out.println("k is" + k);
if (k > 0) {
} else {
Assert.fail("Get fianance is not in recieved email");
}
return this;
}
public EmailPage setEmailTo(String email_to) {
emailtoField1.clear();
emailtoField1.sendKeys(email_to);
return this;
}
public EmailPage clickOnPayNow() {
if (!emailPayNow.isSelected()) {
emailPayNow.click();
}
return this;
}
public EmailPage verifyPaynowOptions() {
GenericUtils.delay(2);
int op1 = driver.findElements(By.id("rzp-key-number")).size();
int op2 = driver.findElements(By.id("rzp-secret-number")).size();
int op0 = driver.findElements(By.xpath("//label[text()='Select Payment Method']")).size();
if (op1 == 0 || op0 == 0 || op2 == 0) {
Assert.fail("Pay now all options are not displayed");
} else {
Assert.assertTrue(true);
}
return this;
}
}
| [
"[email protected]"
] | |
3610f5ab7c61879e1c0e2ead219c4ffbafd045bb | 8af2ec5f19c6bfc1af4b8552f64bc6b8b1ea51ec | /src/main/java/az/company/resume/ResumeApplication.java | 69c74f0e7f9fb82768dd3b6f145bb073ead32c52 | [] | no_license | ism4i1ov/resume-web-app-with-spring-boot | 7f5718761e065dbee3b5c309c82f180d50221699 | 9d239cbc92fec36a1f940ddf2479d7af02da2006 | refs/heads/master | 2023-04-22T00:47:35.045157 | 2021-05-12T10:40:39 | 2021-05-12T10:40:39 | 366,680,365 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package az.company.resume;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ResumeApplication {
public static void main(String[] args) {
SpringApplication.run(ResumeApplication.class, args);
}
}
| [
"[email protected]"
] | |
e13243b3e84e1dc0f4716fa0d11c5a0ef7095053 | 10dd0d94b749e7f10fbbd50b4344704561d415f2 | /algorithm/src/algorithm/chapter2/template/LeetCode_105_519.java | 59c7e88b029a0c82981152e3be212415b71a7b40 | [] | no_license | chying/algorithm_group | 79d0bffea56e6dc0b327f879a309cfd7c7e4133e | cd85dd08f065ae0a6a9d57831bd1ac8c8ce916ce | refs/heads/master | 2020-09-13T19:10:19.074546 | 2020-02-13T04:12:56 | 2020-02-13T04:12:56 | 222,877,592 | 7 | 3 | null | null | null | null | UTF-8 | Java | false | false | 670 | java | package algorithm.chapter2.template;
import javax.swing.tree.TreeNode;
/**
* 【105. 从前序与中序遍历序列构造二叉树】根据一棵树的前序遍历与中序遍历构造二叉树。 注意: 你可以假设树中没有重复的元素。 例如,给出 前序遍历
* preorder = [3,9,20,15,7] 中序遍历 inorder = [9,3,15,20,7] 来源:力扣(LeetCode)
* 链接:https://leetcode-cn.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal
*
* @author chying
*
*/
public class LeetCode_105_519 {
public TreeNode buildTree(int[] preorder, int[] inorder) {
return null;
}
public static void main(String[] args) {
}
}
| [
"[email protected]"
] | |
a705965170f2f2f3c49c133580ddc0534263ecfc | 4bbc98f4e9fa92f350b4816fa331d470880e1df6 | /testdocbuild11/src/main/java/com/fastcode/testdocbuild11/addons/reporting/application/reportversion/dto/UpdateReportversionInput.java | cbec8d1959fbd96dcd08c167a422e8e84cc4147e | [] | no_license | sunilfastcode/testdocbuild11 | 07d7b8a96df7d07ef8e08325463e8eb85ac0da5c | d6a22d880015ed8cd7e10dae67f6b70e222a1849 | refs/heads/master | 2023-02-12T17:43:15.443849 | 2020-12-26T22:57:11 | 2020-12-26T22:57:11 | 319,411,987 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 588 | java | package com.fastcode.testdocbuild11.addons.reporting.application.reportversion.dto;
import lombok.Getter;
import lombok.Setter;
import org.json.simple.JSONObject;
@Getter
@Setter
public class UpdateReportversionInput {
private String ctype;
private String description;
private JSONObject query;
private String reportType;
private String title;
private String reportVersion;
private Long userId;
private String userDescriptiveField;
private String reportWidth;
private Long reportId;
private Boolean isRefreshed;
private Long versiono;
}
| [
"[email protected]"
] | |
31718fa460065ce49369ae6b21d2e39491e1ed87 | 700afb7d46b6042cc344eed044c5bfee758010bc | /at.o2xfs.win32/src/at/o2xfs/win32/SHORT.java | c225a46161fb93b2b14904c2c3a29b0d170faf08 | [
"BSD-2-Clause"
] | permissive | techhyuk/O2Xfs | 3488b9b8b60a18c8c6c6465733a4dae136bbc18e | a307775652459d830d363f3e9c8ec0df9bdc2d73 | refs/heads/master | 2021-01-01T17:06:16.375800 | 2012-11-24T18:41:48 | 2012-11-24T18:41:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,010 | java | /*
* Copyright (c) 2012, Andreas Fagschlunger. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package at.o2xfs.win32;
/**
* A 16-bit integer. The range is –32768 through 32767 decimal.
*
* {@link http://msdn.microsoft.com/en-us/library/aa383751%28v=vs.85%29.aspx}
*
* @author Andreas Fagschlunger
*/
public class SHORT extends Type {
private final static int SIZE = 2;
public SHORT(final short s) {
allocate();
put(s);
}
public void put(final short value) {
buffer().putShort(getOffset(), value);
}
public short shortValue() {
return buffer().getShort(getOffset());
}
@Override
public int getSize() {
return SIZE;
}
}
| [
"[email protected]"
] | |
d641dbc199adcedc5c412dfc72b395ebf3618000 | 2f3824f2b7478e222b8b90b9d8ebbf1892b39a68 | /app/src/main/java/com/vignesh/healthcare/validator/MedicineValidator.java | 4e87ba06bb4971317bdd84e5634e02964296b655 | [] | no_license | BVigneshwar/HealthCare | 2bd4269619382965e2db5e0d953cf60e487983a0 | 0449157bd8b875113658b0f6483a82b37474bc9e | refs/heads/master | 2021-02-08T09:04:32.670876 | 2020-06-22T13:34:35 | 2020-06-22T13:34:35 | 244,133,602 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,736 | java | package com.vignesh.healthcare.validator;
import com.vignesh.healthcare.R;
import com.vignesh.healthcare.entity.MedicineEntity;
import java.util.LinkedList;
import java.util.List;
public class MedicineValidator {
MedicineEntity medicineEntity;
List<Integer> error_list;
public MedicineValidator(MedicineEntity medicineEntity){
this.medicineEntity = medicineEntity;
error_list = new LinkedList<>();
}
public List<Integer> getError_list(){
return error_list;
}
public boolean validate_and_SetName(String value){
if(value == null || value.equals("")){
error_list.add(R.string.name);
return false;
}
medicineEntity.setName(value);
return true;
}
public boolean validate_and_SetDescription(String value){
medicineEntity.setDescription(value);
return true;
}
public boolean validate_and_SetDuration(String value, String unit){
if(value == null || value.equals("") || unit == null || unit.equals("")){
error_list.add(R.string.duration);
return false;
}
medicineEntity.setDuration(value+" "+unit);
return true;
}
public boolean validate_and_SetMorning(boolean value){
medicineEntity.setMorning(value);
return true;
}
public boolean validate_and_SetAfternoon(boolean value){
medicineEntity.setAfternoon(value);
return true;
}
public boolean validate_and_SetNight(boolean value){
medicineEntity.setNight(value);
return true;
}
public boolean validate_and_SetAfterMeal(boolean value){
medicineEntity.setAfter_meal(value);
return true;
}
}
| [
"[email protected]"
] | |
433b88c94dc28abfb52c0fa2042ec3e9bb8e4b74 | 36e40efcfa317432c192f169da2d330b1b284831 | /src/main/java/Rasad/Core/Net/IPAddressRangeGenerator/Bits.java | 87ea8bd2683f4669199d50494a2db346590224d8 | [] | no_license | MrezaPasha/Communication | 06a31879e089c4f14985add67d958b414332e4cf | b312ef27dd60037086f0e32ddf235a9cc103a793 | refs/heads/master | 2020-05-29T21:38:59.551104 | 2019-05-31T09:52:28 | 2019-05-31T09:52:28 | 189,385,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,247 | java | package Rasad.Core.Net.IPAddressRangeGenerator;
import Rasad.Core.*;
import Rasad.Core.Net.*;
public final class Bits
{
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: public static byte[] Not(byte[] bytes)
public static byte[] Not(byte[] bytes)
{
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: return bytes.Select(b => (byte)~b).ToArray();
return bytes.Select(b -> (byte)~b).ToArray();
}
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: public static byte[] And(byte[] A, byte[] B)
public static byte[] And(byte[] A, byte[] B)
{
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: return A.Zip(B, (a, b) => (byte)(a & b)).ToArray();
return A.Zip(B, (a, b) -> (byte)(a & b)).ToArray();
}
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: public static byte[] Or(byte[] A, byte[] B)
public static byte[] Or(byte[] A, byte[] B)
{
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: return A.Zip(B, (a, b) => (byte)(a | b)).ToArray();
return A.Zip(B, (a, b) -> (byte)(a | b)).ToArray();
}
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: public static bool GE(byte[] A, byte[] B)
public static boolean GE(byte[] A, byte[] B)
{
return A.Zip(B, (a, b) -> a == b ? 0 : a < b ? 1 : -1).SkipWhile(c -> c == 0).FirstOrDefault() >= 0;
}
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: public static bool LE(byte[] A, byte[] B)
public static boolean LE(byte[] A, byte[] B)
{
return A.Zip(B, (a, b) -> a == b ? 0 : a < b ? 1 : -1).SkipWhile(c -> c == 0).FirstOrDefault() <= 0;
}
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: public static byte[] GetBitMask(int sizeOfBuff, int bitLen)
public static byte[] GetBitMask(int sizeOfBuff, int bitLen)
{
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: var maskBytes = new byte[sizeOfBuff];
byte[] maskBytes = new byte[sizeOfBuff];
int bytesLen = bitLen / 8;
int bitsLen = bitLen % 8;
for (int i = 0; i < bytesLen; i++)
{
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: maskBytes[i] = 0xff;
maskBytes[i] = (byte)0xff;
}
if (bitsLen > 0)
{
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: maskBytes[bytesLen] = (byte)~Enumerable.Range(1, 8 - bitsLen).Select(n => 1 << n - 1).Aggregate((a, b) => a | b);
maskBytes[bytesLen] = (byte)~Enumerable.Range(1, 8 - bitsLen).Select(n -> 1 << n - 1).Aggregate((a, b) -> a | b);
}
return maskBytes;
}
/**
Counts the number of leading 1's in a bitmask.
Returns null if value is invalid as a bitmask.
@param bytes
@return
*/
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: public static Nullable<int> GetBitMaskLength(byte[] bytes)
public static Integer GetBitMaskLength(byte[] bytes)
{
if (bytes == null)
{
throw new NullPointerException("bytes");
}
int bitLength = 0;
int idx = 0;
// find beginning 0xFF
for (; idx < bytes.length && bytes[idx] == 0xff; idx++)
{
;
}
bitLength = 8 * idx;
if (idx < bytes.length)
{
switch (bytes[idx])
{
case 0xFE:
bitLength += 7;
break;
case 0xFC:
bitLength += 6;
break;
case 0xF8:
bitLength += 5;
break;
case 0xF0:
bitLength += 4;
break;
case 0xE0:
bitLength += 3;
break;
case 0xC0:
bitLength += 2;
break;
case 0x80:
bitLength += 1;
break;
case 0x00:
break;
default: // invalid bitmask
return null;
}
// remainder must be 0x00
if (bytes.Skip(idx + 1).Any(x -> x != 0x00))
{
return null;
}
}
return bitLength;
}
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: public static byte[] Increment(byte[] bytes)
public static byte[] Increment(byte[] bytes)
{
if (bytes == null)
{
throw new NullPointerException("bytes");
}
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: var incrementIndex = Array.FindLastIndex(bytes, x => x < byte.MaxValue);
int incrementIndex = Array.FindLastIndex(bytes, x -> x < Byte.MAX_VALUE);
if (incrementIndex < 0)
{
throw new OverflowException();
}
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: return bytes.Take(incrementIndex).Concat(new byte[] { (byte)(bytes[incrementIndex] + 1) }).Concat(new byte[bytes.Length - incrementIndex - 1]).ToArray();
return bytes.Take(incrementIndex).Concat(new byte[] {(byte)(bytes[incrementIndex] + 1)}).Concat(new byte[bytes.length - incrementIndex - 1]).ToArray();
}
} | [
"[email protected]"
] | |
3ee2379660c06ed28ed88721ab2a723da8309113 | 8a49c7bbb56caff8f51db02e7fa8ae9f6ac74f2c | /src/arg_component/ComboBoxItem.java | 89fab1be6e039d5190ca239fabf4cd99f1828256 | [] | no_license | qwert2603/Radio-Database | 542d7fc26bf4d7ee68c06780affa3526c4e0ca46 | c36b97e70184c8c5467898d1e93628ff7fbacd01 | refs/heads/master | 2016-09-14T14:49:19.765278 | 2016-05-14T11:37:34 | 2016-05-14T11:37:34 | 56,308,770 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 399 | java | package arg_component;
public class ComboBoxItem {
public ComboBoxItem(int id, String s) {
this.s = s;
this.id = id;
}
public String s;
public int id;
@Override
public boolean equals(Object obj) {
return (obj instanceof ComboBoxItem) && (id == ((ComboBoxItem) obj).id);
}
@Override
public String toString() {
return s;
}
}
| [
"[email protected]"
] | |
c6e5d62760a4ab3a3e024d0f73233a7d41d13035 | 013025053382ff1d1b68b89cc497e05d462aa0be | /hw3/gnuplot/src/main/java/SplitResult.java | ddeda47c9f05f8b1f74a125f094e3e9d2231eaec | [] | no_license | sanha/CM2016 | fae5d5cdc0f02bb5970ef8ae505684b8afc7d511 | 3955602c3c0cb7e9064dbd54b1128719427ef70f | refs/heads/master | 2021-01-24T09:16:13.753009 | 2016-12-15T15:00:14 | 2016-12-15T15:00:14 | 69,885,048 | 0 | 0 | null | 2016-12-15T15:00:14 | 2016-10-03T15:40:53 | C++ | UTF-8 | Java | false | false | 3,063 | java | import java.io.FileInputStream;
import java.io.FileOutputStream;
public final class SplitResult {
final static int scale = 100;
public static void main(final String[] args) throws Exception {
splitResult();
}
private static void splitResult() {
final String filePath = "ideal/L/";
final String targetName = "AnalL";
final boolean LOrW = true;
final FileInputStream fileStream;
final FileOutputStream outputStream1;
final FileOutputStream outputStream2;
final FileOutputStream outputStream3;
final FileOutputStream outputStream4;
FileOutputStream outputStream5 = null;
try
{
fileStream = new FileInputStream(filePath + "ideal" + targetName + ".txt");
outputStream1 = new FileOutputStream(filePath + targetName + "1.txt");
outputStream2 = new FileOutputStream(filePath + targetName + "2.txt");
outputStream3 = new FileOutputStream(filePath + targetName + "3.txt");
outputStream4 = new FileOutputStream(filePath + targetName + "4.txt");
if (LOrW) {
outputStream5 = new FileOutputStream(filePath + targetName + ".txt");
}
byte[ ] readBuffer = new byte[fileStream.available()];
while (fileStream.read(readBuffer) != -1);
final String result = new String(readBuffer);
final String[] array = result.split("\n");
for(int i = 0; i < array.length; i++) {
final String[] tmpStr = array[i].trim().replaceAll(" + ", " ").split(" ");
outputStream1.write((tmpStr[0] + " " + tmpStr[1] + "\n").getBytes());
outputStream2.write((tmpStr[0] + " " + tmpStr[2] + "\n").getBytes());
outputStream3.write((tmpStr[0] + " " + tmpStr[3] + "\n").getBytes());
outputStream4.write((tmpStr[0] + " " + tmpStr[4] + "\n").getBytes());
if (LOrW) {
outputStream5.write((tmpStr[0] + " " + tmpStr[5] + "\n").getBytes());
}
}
outputStream1.close();
outputStream2.close();
outputStream3.close();
outputStream4.close();
if (LOrW) {
outputStream1.close();
}
fileStream.close();
}
catch (final Exception e) {
System.err.println(e);
}
}
private static void makeCmd(final int clusterCount) {
String filePath = "plot/plot.cmd";
final FileOutputStream outputStream;
try
{
String result = "set nokey\n" +
"set xlab \"x\" \n" +
"set ylab \"y\" \n" +
"set grid\n" +
"set xrange[-" + scale + ".0:" + scale + ".0]\n" +
"set yrange[-" + scale + ".0:" + scale + ".0]\n" +
"set xtics -" + scale + ".0, 10.0, " + scale + ".0\n" +
"set ytics -" + scale + ".0, 10.0, " + scale + ".0\n" +
"plot \"cluster1.txt\"\n";
for (int i = 2; i <= clusterCount; i++) {
result += "replot \"cluster" + i + ".txt\"\n";
}
outputStream = new FileOutputStream(filePath);
outputStream.write(result.getBytes());
outputStream.close();
}
catch (final Exception e) {
System.err.println(e);
}
}
}
| [
"[email protected]"
] | |
9921cd5d6add7da66d334da4c978287391e854db | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-opensearch/src/main/java/com/amazonaws/services/opensearch/model/transform/VPCDerivedInfoMarshaller.java | 3e32d0f8a419cc7d6edaa65cbf5c990f80978be5 | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 2,929 | java | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.opensearch.model.transform;
import java.util.List;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.opensearch.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* VPCDerivedInfoMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class VPCDerivedInfoMarshaller {
private static final MarshallingInfo<String> VPCID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("VPCId").build();
private static final MarshallingInfo<List> SUBNETIDS_BINDING = MarshallingInfo.builder(MarshallingType.LIST).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("SubnetIds").build();
private static final MarshallingInfo<List> AVAILABILITYZONES_BINDING = MarshallingInfo.builder(MarshallingType.LIST)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("AvailabilityZones").build();
private static final MarshallingInfo<List> SECURITYGROUPIDS_BINDING = MarshallingInfo.builder(MarshallingType.LIST)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("SecurityGroupIds").build();
private static final VPCDerivedInfoMarshaller instance = new VPCDerivedInfoMarshaller();
public static VPCDerivedInfoMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(VPCDerivedInfo vPCDerivedInfo, ProtocolMarshaller protocolMarshaller) {
if (vPCDerivedInfo == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(vPCDerivedInfo.getVPCId(), VPCID_BINDING);
protocolMarshaller.marshall(vPCDerivedInfo.getSubnetIds(), SUBNETIDS_BINDING);
protocolMarshaller.marshall(vPCDerivedInfo.getAvailabilityZones(), AVAILABILITYZONES_BINDING);
protocolMarshaller.marshall(vPCDerivedInfo.getSecurityGroupIds(), SECURITYGROUPIDS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
95e460b5f5f49c093f7bc519961ab0ebb5e3ed93 | ef8bbfe9cc17412e9d97cc530edb8eb561f548e2 | /src/com/jfernandez/categoria/model/Categoria.java | 6112803b1947781db43b0322a27beaf1ad450f95 | [] | no_license | juanymdq/Facturacion-JAVA | f86fed7a618827cdb0240c481671804984a82848 | ea69becffe1b28eefe70ebd560317c9f7b4788ef | refs/heads/master | 2022-12-22T05:29:09.779716 | 2019-11-04T22:58:28 | 2019-11-04T22:58:28 | 216,685,594 | 0 | 0 | null | 2022-12-15T23:38:55 | 2019-10-21T23:49:17 | Java | UTF-8 | Java | false | false | 865 | java | package com.jfernandez.categoria.model;
public class Categoria {
private int id_categoria;
private String nombre_categoria;
//-----CONSTRUCTORES---------------------------------------------------
public Categoria() {}
public Categoria(int id_categoria) {
this.id_categoria = id_categoria;
}
public Categoria(int id_categoria, String nombre_categoria) {
this.id_categoria = id_categoria;
this.nombre_categoria = nombre_categoria;
}
//-------GETTERS AND SETTERS-------------------------------------------
public int getId_categoria() {
return id_categoria;
}
public void setId_categoria(int id_categoria) {
this.id_categoria = id_categoria;
}
public String getNombre_categoria() {
return nombre_categoria;
}
public void setNombre_categoria(String nombre_categoria) {
this.nombre_categoria = nombre_categoria;
}
}
| [
"[email protected]"
] | |
6c838dab55e37c5d8411f3c4106586a500054ff7 | 043c40bae28ee71147e0746524cf61b1c643de4a | /app/src/main/java/auroratech/traber/TBMyCarAddCarActivity.java | 02517aa878735293c3dc8499eacc7b12beb02978 | [] | no_license | zhuanglm/Traffic_Ticket | 9a4d36a7314af03a93561f612250ac03e85572c0 | 6026b4ac81bbe0e4fbe508710d297651d37767e8 | refs/heads/master | 2021-01-01T05:15:55.595570 | 2016-05-04T15:10:41 | 2016-05-04T15:10:41 | 57,993,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,825 | java | package auroratech.traber;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import auroratech.traber.base.TBActivityBase;
import auroratech.traber.common.ui.TBUIBindingObj;
import auroratech.traber.managers.TBTransitionObjectManager;
import auroratech.traber.managers.TBUIManager;
import auroratech.traber.util.ITBViewAnimator;
public class TBMyCarAddCarActivity extends TBActivityBase implements ITBViewAnimator {
TBActivityBase current;
auroratech.traber.common.ui.TBHeader profileHeaderSection;
RelativeLayout myCarViewListItemsContent;
RelativeLayout myCarAddNewItemsContent;
RelativeLayout car_picture_section;
ImageView crossBox;
ImageView car_picture;
TextView my_ticket_press_to_take_picture;
LinearLayout plate_number_content;
EditText plate_number;
LinearLayout insurance_section;
TextView insurance_section_title;
TextView add_car_company_text;
EditText insurance_company;
TextView add_car_number_text;
EditText insurance_number;
TextView add_car_exp_text;
EditText insurance_expiry_date;
ImageButton insurance_expiry_date_button;
LinearLayout car_info_section;
TextView car_info_section_title;
TextView car_info_sticker_exp_date_text;
EditText car_info_sticker_expiry_date;
ImageButton car_info_sticker_expiry_date_button;
TextView car_info_car_model_date_text;
EditText car_info_car_model_date;
TextView car_info_car_year_text;
EditText car_info_car_year;
Button car_info_add_car_btn;
auroratech.traber.common.ui.TBFooter profileFooterSection;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tb_my_car_add_car);
current = this;
profileHeaderSection = (auroratech.traber.common.ui.TBHeader) findViewById(R.id.profileHeaderSection);
myCarViewListItemsContent = (RelativeLayout) findViewById(R.id.myCarViewListItemsContent);
myCarAddNewItemsContent = (RelativeLayout) findViewById(R.id.myCarAddNewItemsContent);
car_picture_section = (RelativeLayout) findViewById(R.id.car_picture_section);
crossBox = (ImageView) findViewById(R.id.crossBox);
car_picture = (ImageView) findViewById(R.id.car_picture);
my_ticket_press_to_take_picture = (TextView) findViewById(R.id.my_ticket_press_to_take_picture);
plate_number_content = (LinearLayout) findViewById(R.id.plate_number_content);
plate_number = (EditText) findViewById(R.id.plate_number);
insurance_section = (LinearLayout) findViewById(R.id.insurance_section);
insurance_section_title = (TextView) findViewById(R.id.insurance_section_title);
add_car_company_text = (TextView) findViewById(R.id.add_car_company_text);
insurance_company = (EditText) findViewById(R.id.insurance_company);
add_car_number_text = (TextView) findViewById(R.id.add_car_number_text);
insurance_number = (EditText) findViewById(R.id.insurance_number);
add_car_exp_text = (TextView) findViewById(R.id.add_car_exp_text);
insurance_expiry_date = (EditText) findViewById(R.id.insurance_expiry_date);
insurance_expiry_date_button = (ImageButton) findViewById(R.id.insurance_expiry_date_button);
car_info_section = (LinearLayout) findViewById(R.id.car_info_section);
car_info_section_title = (TextView) findViewById(R.id.car_info_section_title);
car_info_sticker_exp_date_text = (TextView) findViewById(R.id.car_info_sticker_exp_date_text);
car_info_sticker_expiry_date = (EditText) findViewById(R.id.car_info_sticker_expiry_date);
car_info_sticker_expiry_date_button = (ImageButton) findViewById(R.id.car_info_sticker_expiry_date_button);
car_info_car_model_date_text = (TextView) findViewById(R.id.car_info_car_model_date_text);
car_info_car_model_date = (EditText) findViewById(R.id.car_info_car_model_date);
car_info_car_year_text = (TextView) findViewById(R.id.car_info_car_year_text);
car_info_car_year = (EditText) findViewById(R.id.car_info_car_year);
car_info_add_car_btn = (Button) findViewById(R.id.car_info_add_car_btn);
profileFooterSection = (auroratech.traber.common.ui.TBFooter) findViewById(R.id.profileFooterSection);
// need reference
profileHeaderSection.setActivityReference(current);
profileFooterSection.setActivityReference(current);
// hardware accelerate this... (apparently needed for quick fix)
myCarViewListItemsContent.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
car_picture_section.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TBUIManager.getInstance().ToPhotoActivity(current, TBPhotoActivity.CONST_FROM_ADD_CAR);
}
});
// load initial state of the page
loadInitialState();
loadTakenImage();
}
private void loadInitialState() {
}
@Override
public void BackPressed() {
//
TBTransitionObjectManager.getInstance().deleteAllImage();
TBUIManager.getInstance().ToMyCarList(current);
}
@Override
public void addButtonPressed() {
}
@Override
public void itemPressed(TBUIBindingObj data) {
}
@Override
public void onAnimationStart(View fromView, View toView) {
}
@Override
public void onAnimationEnd(View fromView, View toView) {
}
private void loadTakenImage() {
Uri fileUri = TBTransitionObjectManager.getInstance().acceptableFile;
if(fileUri != null) {
crossBox.setVisibility(View.GONE);
my_ticket_press_to_take_picture.setVisibility(View.GONE);
// bitmap factory
BitmapFactory.Options options = new BitmapFactory.Options();
// downsizing image as it throws OutOfMemory Exception for larger
// images
options.inSampleSize = 8;
final Bitmap bitmap = BitmapFactory.decodeFile(fileUri.getPath(),
options);
car_picture.setImageBitmap(bitmap);
}
}
@Override
protected void onDestroy() {
super.onDestroy();
profileHeaderSection.deReference();
profileFooterSection.deReference();
profileHeaderSection = null;
myCarViewListItemsContent = null;
myCarAddNewItemsContent = null;
car_picture_section = null;
car_picture = null;
my_ticket_press_to_take_picture = null;
plate_number_content = null;
plate_number = null;
insurance_section = null;
insurance_section_title = null;
add_car_company_text = null;
insurance_company = null;
add_car_number_text = null;
insurance_number = null;
add_car_exp_text = null;
insurance_expiry_date = null;
insurance_expiry_date_button = null;
car_info_section = null;
car_info_section_title = null;
car_info_sticker_exp_date_text = null;
car_info_sticker_expiry_date = null;
car_info_sticker_expiry_date_button = null;
car_info_car_model_date_text = null;
car_info_car_model_date = null;
car_info_car_year_text = null;
car_info_car_year = null;
car_info_add_car_btn = null;
profileFooterSection = null;
}
}
| [
"[email protected]"
] | |
28b46c5ed9c5fa0055bc4ecb61008165234ac8d1 | 6ec5469ec2bca932a2418de61fee961a04a503e3 | /CtyManager-shoper/src/main/java/com/yard/manager/platform/action/LoginAction.java | 321a6e23d1e91238d2d00b011f4cd814da30ff09 | [] | no_license | Qiuyingx/CtyManager | e6cdb83c15dc9c46936c4d09046f25f9ce2ad250 | 8ec9ae87fe580b32f28fa77f8b182cb94119087d | refs/heads/master | 2020-12-31T07:32:16.224703 | 2016-05-08T13:20:53 | 2016-05-08T13:20:53 | 58,313,077 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,392 | java | package com.yard.manager.platform.action;
import java.io.IOException;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.LockedAccountException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import com.yard.core.kaptcha.Constants;
import com.yard.core.security.sha.sha4j.ShaUtil;
import com.yard.core.struts.action.JsonServletAction;
/**
* 登录验证
*
* @Description:用户登录处理,后台主界面
*/
@Results({
// 管理中心
@Result(name = "CENTER", type = "chain", location = "center"),
// 登录页面
@Result(name = "LOGIN", type = "freemarker", location = "/WEB-INF/content/login.html"),
// 商户登录页面
@Result(name = "SHOPLOGIN", type = "freemarker", location = "/WEB-INF/content/shopLogin.html"),
// 主界面
@Result(name = "LOGOUT", type = "redirect", location = "main") })
public class LoginAction extends JsonServletAction {
private static final long serialVersionUID = 1L;
private static final String LOGIN = "LOGIN";
// 用户登陆信息
private String account;
private String pwd;
private String code;
/**
* 直接跳转到主界面(后台登录界面)
*
* @return
* @throws Exception
*/
@Action("/main")
public String main() throws Exception {
return LOGIN;
}
/**
* 商户后台登录页面
*
* @return
* @throws Exception
*/
@Action("/")
public String shopLogin() throws Exception {
return LOGIN;
}
/**
* 登录处理
*
* @return
*/
@Action("/login")
public String login() {
try {
// 判断验证码是否正确
String kaptchaExpected = (String) request.getSession().getAttribute(Constants.KAPTCHA_SESSION_KEY);
if (code == null || !code.equalsIgnoreCase(kaptchaExpected)) {
setResult(false, "验证码错误");
return MAP;
}
// 验证用户名密码
Subject currentUser = SecurityUtils.getSubject();
UsernamePasswordToken token = new UsernamePasswordToken(account, ShaUtil.toSha256String(pwd));
currentUser.login(token);
setResult(true, "成功");
} catch (UnknownAccountException uae) {
setResult(false, "用户名无效");
} catch (IncorrectCredentialsException ice) {
setResult(false, "密码无效");
} catch (LockedAccountException lae) {
setResult(false, "帐号锁定");
} catch (AuthenticationException ae) {
setResult(false, "认证未通过,请输入正确的用户名和密码");
} catch (IOException e) {
e.printStackTrace();
setResult(false, "认证未通过,发生异常");
}
return MAP;
}
/**
* 登出
*
* @return
*/
@Action("/logout")
public String logout() {
Subject currentUser = SecurityUtils.getSubject();
currentUser.logout();
return LOGIN;
}
public void setAccount(String account) {
this.account = account;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
public void setCode(String code) {
this.code = code;
}
} | [
"[email protected]"
] | |
9af0bb17c85a95d3e29ea8fd8cef1c1d8eb69cd4 | 7178ee1842813f270eaecfda6db98ff5eb05632f | /common-module/src/main/java/ch/selise/assessment/model/request/TransactionRequest.java | f202706f8de3fa73e82bed42035c7894d42c8b40 | [] | no_license | shahedbhuiyan/selise-assessment | a33d043f2a8077e20ba8772783c7efaf0553f9b1 | 62f1e285030806d81834560c89bdfa6af777cba5 | refs/heads/main | 2023-06-25T23:31:43.458066 | 2021-07-31T10:07:26 | 2021-07-31T10:07:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 885 | java | package ch.selise.assessment.model.request;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
/**
* @author dipanjal
* @since 0.0.1
*/
@Getter
@Setter
public class TransactionRequest {
@NotBlank(message = "Request ID can not be empty")
private String requestId;
@NotBlank(message = "Requester can not be empty")
private String requester;
@NotBlank(message = "Transaction Type can not be empty")
private String transactionType;
@NotBlank(message = "Source Account Number can not be empty")
private String sourceAccountNumber;
@NotBlank(message = "Amount can not be empty")
private String amount;
@NotBlank(message = "Destination Account Number can not be empty")
private String destinationAccountNumber;
@NotBlank(message = "Transaction Note can not be empty")
private String note;
}
| [
"[email protected]"
] | |
2498f8fb554492ea27a7192945988421d61306bc | ac7444d1612a3639a297fa6cc88b8d9a2b89417c | /src/com/tomica/nioserver/events/EventListener.java | 6b8b3ce81464f13de1d2eba97e069b99ba1b6393 | [] | no_license | trapstar321/NIOServer_Java | 2cdab1051fdc2b27337fb3ca89c320a0c6ead4c9 | 348d5a60074010501eec5ef11491c300a6163523 | refs/heads/master | 2021-01-17T09:11:08.790818 | 2017-03-05T15:39:38 | 2017-03-05T15:39:38 | 83,981,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 75 | java | package com.tomica.nioserver.events;
public interface EventListener {
}
| [
"[email protected]"
] | |
092d2f62b72c20d1331ad836c29638584950a2c1 | 13286918b4614fc6d4c55dbcc620fc38a198e841 | /app/src/main/java/id/or/pelkesi/actmedis/data/component/AboutActivityComponent.java | 0fcebf50db9eb858d3ea5f8cad5eb054a9d5f445 | [] | no_license | jeruji/actmedis | 792630520a4fb017a95e94b66fbce34c8665f7c7 | a9f0ff934cf0f9fba0ec501c4ec1f86b05d748df | refs/heads/master | 2020-05-18T06:37:03.600597 | 2019-05-05T01:16:54 | 2019-05-05T01:16:54 | 184,239,640 | 0 | 0 | null | 2019-05-05T01:08:36 | 2019-04-30T10:09:54 | Java | UTF-8 | Java | false | false | 427 | java | package id.or.pelkesi.actmedis.data.component;
import dagger.Component;
import id.or.pelkesi.actmedis.data.module.AboutActivityModule;
import id.or.pelkesi.actmedis.util.CustomScope;
import id.or.pelkesi.actmedis.view.about.AboutActivity;
@CustomScope
@Component(dependencies = NetComponent.class, modules = AboutActivityModule.class)
public interface AboutActivityComponent {
void inject(AboutActivity aboutActivity);
}
| [
"[email protected]"
] | |
7adb18a56692ae5de96f79ffdd631c307b326b36 | 028478a70cedced94e81703f7165cba89038c7cb | /app/src/main/java/com/example/filipinoapp/Results.java | 9ff1986d4c95a050efc56655237e7e0e83829e6f | [] | no_license | Yinkci/FillApp | 0bbb9b377323875b15e0c7ad4c38ace40dcd9232 | 5b560a7238e4646e9cdfdb978c34825e6669a172 | refs/heads/master | 2020-06-03T19:35:01.301024 | 2019-06-13T06:38:15 | 2019-06-13T06:38:15 | 191,704,425 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,916 | java | package com.example.filipinoapp;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
public class Results extends AppCompatActivity {
TextView time, time2, score1, score2;
Button back;
String timeread;
LinearLayout reading;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_results);
reading = (LinearLayout) findViewById(R.id.LinearReading);
time = (TextView) findViewById(R.id.tvTimer);
time2 = (TextView) findViewById(R.id.tvTimer2);
score1 = (TextView) findViewById(R.id.tvScore1);
score2 = (TextView) findViewById(R.id.tvScore2);
back = (Button) findViewById(R.id.btnBack);
timeread = getIntent().getStringExtra("timerread");
time2.setText(timeread);
int a = time2.length();
if (a == 0) {
reading.setVisibility(View.GONE);
} else {
time2.setText(timeread);
reading.setVisibility(View.VISIBLE);
}
time.setText(getIntent().getStringExtra("timer"));
score1.setText(getIntent().getStringExtra("score") + " sa 10 mga tanong ay nasagutan mo ng tama.");
score2.setText("(" + getIntent().getStringExtra("score") + " of 10 questions you answered correctly)");
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Results.this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
});
}
}
| [
"[email protected]"
] | |
7c6a0c436a2027bc46f6a31463b5c6fa3c8c939a | 37500a2105ed2f82144761f5093acfb6a86202b6 | /src/main/java/org/bank/me/metier/PageOperations.java | 16b27f52a4b8abd4a81ee1dbeb9b69cecc6d0f98 | [] | no_license | MedRist/Spring-Boot-App | d9d91306156237c734e17dfdba410dcec96b555c | 8009e3cd5c5179805065f8635e3e464307e8fb82 | refs/heads/master | 2021-08-31T14:23:37.991718 | 2017-12-21T17:07:19 | 2017-12-21T17:07:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 973 | java | package org.bank.me.metier;
import org.bank.me.entities.Operation;
import java.io.Serializable;
import java.util.List;
public class PageOperations implements Serializable{
private List<Operation> operations;
private int page;
private int nombre_Operations;
private int total_page;
public List<Operation> getOperations() {
return operations;
}
public void setOperations(List<Operation> operations) {
this.operations = operations;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getNombre_Operations() {
return nombre_Operations;
}
public void setNombre_Operations(int nombre_Operations) {
this.nombre_Operations = nombre_Operations;
}
public int getTotal_page() {
return total_page;
}
public void setTotal_page(int total_page) {
this.total_page = total_page;
}
}
| [
"[email protected]"
] | |
fb2224d514cbf449ee47a32918e214494c05a2e4 | 676057a83fde9c388445b311ef00be306070fa63 | /019.巨大なソース修正/JavaUserManagementSystem_ver2.0/src/java/jums/UpdateResult.java | d5d15454cb8ceb146510d250efdcbd51f48fda10 | [] | no_license | kanon2810/GEEK-JOB_Challenge | 2e820b5d4069cfbb2de3fdc0a424cf060a3c9a2d | 43bbd2c7181c1223a6c9615e79788813389c1bf7 | refs/heads/master | 2020-03-14T21:34:03.659920 | 2018-07-30T17:16:08 | 2018-07-30T17:16:08 | 131,799,437 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,563 | java | package jums;
import java.beans.Beans;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
*
* @author hayashi-s
*/
public class UpdateResult extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
/* TODO output your page here. You may use following sample code. */
out.println("<!DOCTYPE html>");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet UpdateResult</title>");
out.println("</head>");
out.println("<body>");
//パラメーター文字コードの取得
request.setCharacterEncoding("UTF-8");
//セッションのセッティング
HttpSession session = request.getSession();
UserDataDTO ud = (UserDataDTO)session.getAttribute("resultData");
ud.setUserID(Integer.parseInt(request.getParameter("id")));
//getで"Bean"を再度呼び出す
UserDataBeans Bean = (UserDataBeans)session.getAttribute("Bean");
Bean.setName(request.getParameter("name"));
Bean.setYear(request.getParameter("year"));
Bean.setMonth(request.getParameter("month"));
Bean.setDay(request.getParameter("day"));
Bean.setType(request.getParameter("type"));
Bean.setTell(request.getParameter("tell"));
Bean.setComment(request.getParameter("comment"));
//DB型にしてマッピングを行う
Bean.UD2DTOMapping(ud);
//DBへデータの挿入
UserDataDAO.getInstance().UPdata(ud);
//uddを格納する これにてResultDatailのデータを再度jsp側で呼び出せるようになる
session.setAttribute("UpData",Bean);
//成功したのでセッションの値を削除
session.invalidate();
request.getRequestDispatcher("./updateresult.jsp").forward(request, response);
out.println("</body>");
out.println("</html>");
}catch(Exception e){
request.setAttribute("error", e.getMessage());
request.getRequestDispatcher("/error.jsp").forward(request, response);
}finally {
out.close();
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"[email protected]"
] | |
52ffb4eb100fe7dcf1ce68a6b01c2d188ec70e89 | ca35a94b1dbf356d55f47ad890d78b45b7ffb399 | /src/questions/q_024.java | 1152318ecbe8921e34948b32212f7e044fef8b3f | [] | no_license | jkpark512/CodeUp_Basics100 | f92f101f19a3dd56cbf42af4c217afbf7292c2f7 | a8c2df3ff5b786efdb7a89e75120f47ea3baaa62 | refs/heads/master | 2020-08-29T20:19:41.113693 | 2020-03-23T12:58:16 | 2020-03-23T12:58:16 | 218,164,157 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 524 | java | // 기초 입출력 : 단어 1개 입력받아 나누어 출력하기
package questions;
import java.util.Scanner;
public class q_024 {
public static void main(String[] args) {
String inputVoca;
int VocaLength;
char[] array = null;
Scanner sc = new Scanner(System.in);
inputVoca = sc.nextLine();
VocaLength = inputVoca.length();
for(int i=0; i<VocaLength; i++) {
array = inputVoca.toCharArray();
}
for(int i=0; i<VocaLength; i++) {
System.out.println("'"+array[i]+"'");
}
}
}
| [
"[email protected]"
] | |
27bfcf556abfa06c13f87a8e13bea5238571d0a1 | cfb9ed3866d459daef66b06f19c3296856ab0f15 | /Java/Javalin/src/main/java/io/kidbank/WebEntrypoint.java | 8ae670300c2b79ce6909779cced5602aa54c41da | [] | no_license | marwan1023/Toolbelt | ef465b5dd19dd6b58b3061b9377450fe92735c6d | c0a65bbb40b2a68bb1843993421cf9cb26550244 | refs/heads/master | 2023-02-21T05:53:03.297250 | 2021-01-24T15:06:40 | 2021-01-24T15:06:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 690 | java | package io.kidbank;
import com.google.inject.Inject;
import io.alzuma.AppEntrypoint;
import io.alzuma.Routing;
import io.javalin.Javalin;
import javax.inject.Singleton;
import java.util.Collections;
import java.util.Set;
@Singleton
class WebEntrypoint implements AppEntrypoint {
private Javalin app;
@Inject(optional = true)
private Set<Routing> routes = Collections.emptySet();
@Inject
public WebEntrypoint(Javalin app) {
this.app = app;
}
@Override
public void boot(String[] args) {
bindRoutes();
app.port(7000);
app.start();
}
private void bindRoutes() {
routes.forEach(r -> r.bindRoutes());
}
}
| [
"[email protected]"
] | |
8bcc5e2ee4154096bdc14ffb8f6cd4e2a95ffd9b | 45f424aebe870b4ba7d771dbde302ade51f3186d | /app/src/main/java/com/zby/ibeacon/agreement/CmdParse.java | e275dac0f6ff441f9d929d2c729fca44ace5a61c | [] | no_license | dashuizhu/LED | 313e57ce29c1f73b4d185d2911a5346a5141f25a | d9dd85231ba440967e02e4cd84885168c3ca6aa0 | refs/heads/master | 2021-07-13T21:32:08.447906 | 2019-09-25T03:47:51 | 2019-09-25T03:47:51 | 91,320,711 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,474 | java | package com.zby.ibeacon.agreement;
import java.io.UnsupportedEncodingException;
import android.app.Activity;
import android.content.Intent;
import android.os.Handler;
import android.util.Log;
import android.widget.Toast;
import com.zby.ibeacon.bean.DeviceBean;
import com.zby.ibeacon.bean.TimingBean;
import com.zby.ibeacon.bluetooth.DataProtocolInterface;
import com.zby.ibeacon.constants.AppConstants;
import com.zby.ibeacon.util.MyByte;
import com.zby.ibeacon.util.Myhex;
public class CmdParse implements DataProtocolInterface {
public static final int Cmd_A0_status = 160;
public static final int Cmd_A1_timing = 161;
public static final int Cmd_A2_password = 162;
public static final int Cmd_A3_name = 163;
public static final int Cmd_D5_timer = (0xD5);
private DeviceBean bean;
private final static String TAG = "cmdParseTag";
private Activity mContext;
private CmdParse() {
};
public CmdParse(Activity activity, DeviceBean bean) {
this.mContext = activity;
this.bean = bean;
}
public void parseData(byte[] buffer) {
Log.i(TAG, "解析 " + Myhex.buffer2String(buffer));
if(buffer==null ) return;
String name;
byte[] nameBuff;
int type;
switch (buffer[0]) {
case (byte) 0xA0:// 开关,亮, 黄, 白
bean.setOnOff(MyByte.byteToInt(buffer[1]) == 1);
bean.setBrightness(MyByte.byteToInt(buffer[2]));
bean.setColorYellow(MyByte.byteToInt(buffer[3]));
// 这里有隐患, 这里是算 字节的 10进制
type = MyByte.byteToInt(0xA0);
handlerSendBroadcast(type);
break;
case (byte) 0xD0:
bean.setOnOff(MyByte.byteToInt(buffer[1]) >0);
bean.setBrightness(MyByte.byteToInt(buffer[1]));
bean.setColorYellow(MyByte.byteToInt(buffer[2]));
// 这里有隐患, 这里是算 字节的 10进制
type = MyByte.byteToInt(0xD0);
handlerSendBroadcast(type);
break;
case (byte) 0xA1:// timing
case (byte) 0xD2:
TimingBean bin = new TimingBean();
bin.setId( MyByte.byteToInt(buffer[1]));
bin.setYear(MyByte.byteToInt(buffer[2]) * 256 + MyByte.byteToInt(buffer[3]));
bin.setMonth(MyByte.byteToInt(buffer[4]));
//if(bin.getMonth()>12 || bin.getMonth()<=0 ) return;
bin.setDay(MyByte.byteToInt(buffer[5]));
bin.setHour(MyByte.byteToInt(buffer[6]));
bin.setMinute(MyByte.byteToInt(buffer[7]));
bin.setBrightness(MyByte.byteToInt(buffer[8]));
bin.setColorYellow(MyByte.byteToInt(buffer[9]));
//只有0-9
if (bin.getId()>=10) {
break;
}
if(MyByte.byteToInt(buffer[11]) !=2) { //2是删除的意思
bin.setEnable(MyByte.byteToInt(buffer[11])==1);
bean.updateTimingBean(bin);
// 这里有隐患, 这里是算 字节的 10进制
type = MyByte.byteToInt(0xA1);
handlerSendBroadcast(type);
}
break;
case (byte) 0xA2:// password
case (byte) 0xD3:
nameBuff = new byte[6];
System.arraycopy(buffer, 1, nameBuff, 0, nameBuff.length);
//name = Myhex.parse02DString(nameBuff);
name = new String(nameBuff);
name = name.replace("0", "");
bean.setDevicePassword(name.replace(" ", ""));
// 这里有隐患, 这里是算 字节的 10进制
type = MyByte.byteToInt(0xA2);
handlerSendBroadcast(type);
break;
case (byte) 0xA3:// name
case (byte) 0xD4:
nameBuff = new byte[buffer.length-1];
System.arraycopy(buffer, 1, nameBuff, 0, nameBuff.length);
try {
name = new String(nameBuff, AppConstants.charSet);
bean.setName(name);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// 这里有隐患, 这里是算 字节的 10进制
type = MyByte.byteToInt(0xA3);
handlerSendBroadcast(type);
break;
case (byte) 0xD5:
bean.setTimerCount(MyByte.byteToInt(MyByte.byteToInt(buffer[2])));
type = MyByte.byteToInt(0xD5);
handlerSendBroadcast(type);
break;
default:
}
}
private void handlerSendBroadcast(int type) {// 发送广播
if (mContext != null) {
Intent intent = new Intent(
ConnectBroadcastReceiver.BROADCAST_ACTION);
intent.putExtra(ConnectBroadcastReceiver.BROADCAST_DATA_TYPE, type);
// intent.putExtra(ConnectBroadcastReceiver.BROADCAST_DATA_KEY,
// data);
intent.putExtra(ConnectBroadcastReceiver.BROADCAST_DEVICE_MAC,
bean.getDeviceAddress());
Log.d("ConnectBraodcast", TAG + ".sendBroadcast " + type + " "
+ bean.getDeviceAddress());
mContext.sendBroadcast(intent);
}
}
}
| [
"[email protected]"
] | |
1db5037019e06ca7bd12bdbcd568769f484c8e28 | 248ebd7387994ac1aae4cf480395a13ace28c6e4 | /src/main/java/com/huawei/ibc/model/common/NodeType.java | 450ee24e5e853df172f5406e7bcd9712c06f0903 | [] | no_license | oferby/sim-net | e40bf499b06a89996c1db27e9bb031e1f4b4d1db | 697c240fa102ea15b264bf33d3edd18cb415bd6d | refs/heads/master | 2023-04-29T04:48:24.787066 | 2021-05-19T07:46:10 | 2021-05-19T07:46:10 | 290,185,471 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 227 | java | package com.huawei.ibc.model.common;
public enum NodeType {
COMPUTE_NODE, SWITCH, ROUTER, FIREWALL, GATEWAY, NAT, APPLICATION, INTERNET, SUBNET, ACL, LB, GROUP, POLICY, POLICY_ALLOW, POLICY_DENY, SERVICE, MPLS_SWITCH;
}
| [
"[email protected]"
] | |
397bb33746ef400ab11abf3d7ecdc811d017946c | 57a056fe4c33e53a84b986d081cd457a09da6f2f | /Project_01/src/main/java/com/dxc/controller/MarksController.java | c5bdf596012c8f3bc3a22590459b6afdf52d365a | [] | no_license | hnimmagadda/spring-jpa | 403393e8cd62c0eedcb414ecef89d5a8b6a311de | d887cb190de10455314978cc15feadafcba0fc67 | refs/heads/master | 2022-12-16T01:19:59.642987 | 2020-09-19T14:34:05 | 2020-09-19T14:34:05 | 296,887,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,004 | java | package com.dxc.controller;
import java.text.ParseException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.dxc.beans.Marks;
import com.dxc.beans.Student;
import com.dxc.repository.MarksRepository;
@Controller
public class MarksController {
@Autowired
MarksRepository marksRepository;
@RequestMapping("displaymarks")
public ModelAndView displaymarks() {
ModelAndView modelAndView = new ModelAndView("displaymarks");
List<Marks> marks = (List<Marks>) marksRepository.findAll();
modelAndView.addObject("mrks", marks);
return modelAndView;
}
@RequestMapping("addmarks")
public String newmarksform() {
return "addmarks";
}
@RequestMapping("savemarks")
public String addMarks(@RequestParam("exid") String exid, @RequestParam("stid") int stid,
@RequestParam("sub1") int sub1, @RequestParam("sub2") int sub2, @RequestParam("sub3") int sub3)
throws ParseException {
Marks marks = new Marks(exid, stid, sub1, sub2, sub3);
marksRepository.save(marks);
return "redirect:/displaymarks";
}
@RequestMapping("editmarks")
public String editmarksform() {
return "editmarks";
}
@RequestMapping("updatemarks")
public String updatemarks(@RequestParam("exid") String exid, @RequestParam("stid") int stid,
@RequestParam("sub1") int sub1, @RequestParam("sub2") int sub2, @RequestParam("sub3") int sub3)
throws ParseException {
Marks marks = new Marks(exid, stid, sub1, sub2, sub3);
marksRepository.save(marks);
return "redirect:/displaymarks";
}
@RequestMapping("marksdelete")
public String deleteStudent(@RequestParam("stid") int stid) {
marksRepository.deleteById(stid);
return "redirect:/displaymarks";
}
}
| [
"hnimmagadda@IN-5CG0251NNP"
] | hnimmagadda@IN-5CG0251NNP |
38e9ec94cc9eb9eedb79f2a158a4c9f7b96c90a4 | 082e26b011e30dc62a62fae95f375e4f87d9e99c | /docs/weixin_7.0.4_source/反编译源码/未反混淆/src/main/java/com/tencent/mm/plugin/game/ui/w.java | db8036910da03f8d5c36386700af9eca83d5716a | [] | no_license | xsren/AndroidReverseNotes | 9631a5aabc031006e795a112b7ac756a8edd4385 | 9202c276fe9f04a978e4e08b08e42645d97ca94b | refs/heads/master | 2021-04-07T22:50:51.072197 | 2019-07-16T02:24:43 | 2019-07-16T02:24:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,906 | java | package com.tencent.mm.plugin.game.ui;
import android.graphics.Color;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ImageView;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.plugin.appbrand.jsapi.g.n;
public final class w implements OnTouchListener {
private int mColor;
public w() {
this(Color.argb(221, n.CTRL_INDEX, n.CTRL_INDEX, n.CTRL_INDEX));
AppMethodBeat.i(112218);
AppMethodBeat.o(112218);
}
private w(int i) {
this.mColor = i;
}
public final boolean onTouch(View view, MotionEvent motionEvent) {
AppMethodBeat.i(112219);
int action = motionEvent.getAction();
Drawable drawable;
if (action == 0) {
if (view instanceof ImageView) {
ImageView imageView = (ImageView) view;
drawable = imageView.getDrawable();
if (drawable != null) {
drawable.setColorFilter(this.mColor, Mode.MULTIPLY);
imageView.setImageDrawable(drawable);
}
} else if (view.getBackground() != null) {
view.getBackground().setColorFilter(this.mColor, Mode.MULTIPLY);
}
} else if (action == 1 || action == 3) {
if (view instanceof ImageView) {
drawable = ((ImageView) view).getDrawable();
if (drawable != null) {
drawable.clearColorFilter();
}
} else {
drawable = view.getBackground();
if (drawable != null) {
drawable.clearColorFilter();
}
}
}
AppMethodBeat.o(112219);
return false;
}
}
| [
"[email protected]"
] | |
4ef6112340e1c78de21e698ef0aa45c8e97f6b86 | ddb08f5c2c7a8412a663df7b90d02b4a79af88ab | /fundamentals/src/main/java/co/edu/sena/fundamentals/les09/ClassMap.java | e430b5ec3ba36c2539da2ddcfba1c17abb17a515 | [] | no_license | ParticleDuality/hm-t4g12s4-ra19-actividades-Dasapugo4444 | baee49de1aebf7599fecded4f9545d723969aa83 | de2f8587f6d958a9b9ec4692b1144d3c4a6444d0 | refs/heads/master | 2021-09-26T01:05:50.992421 | 2018-10-26T20:00:08 | 2018-10-26T20:00:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,691 | java | package co.edu.sena.fundamentals.les09;
public class ClassMap {
public String[][] deskArray;
public String name;
public void setClassMap(){
deskArray=new String[3][4];
}
public void setDesk(){
boolean flag=false;
for (int row = 0; row < 3; row++) {
for (int col = 0; col < 4; col++) {
if (deskArray[row][col]==null) {
deskArray[row][col] = name;
System.out.println
(name+" está ubicado en el escritorio: "+row+", "+col);
flag=true;
break;
}
}
if (flag==true){
break;
}
}
if (flag==false){
System.out.println("Todos los escritorios están ocupados");
}
}
public void displayDeskMap(){
for (int row = 0; row < 3; row++) {
for (int col = 0; col < 4; col++) {
System.out.print(" "+deskArray[row][col]+" ");
}
System.out.println();
}
}
public void searchDesk(){
boolean flag=false;
for (int row = 0; row < 3; row++) {
for (int col = 0; col < 4; col++) {
if (deskArray[row][col]!=null && deskArray[row][col].equals(name)){
System.out.println(name+" está en: "+row+" "+col);
flag=true;
break;
}
}
if (flag==true){
break;
}
}
if (flag==false){
System.out.println(name + " No encontrado");
}
}
}
| [
"[email protected]"
] | |
3bee105930310acf2fdbf15bc7add903d0f745d1 | 163a66e7865093d4ea1043f2c307fff1bc74f8aa | /app/src/main/java/com/atendimento/adapter/AdapterEmpresasApp.java | 6b53cf951137b5cd4eb6996227cd205f716da7c4 | [] | no_license | HendrixGit/Atendimento | 1478e1c2655826c875b4e85ac0f3541151a18655 | b8730b4d60d666f607856ce1e38bb5ac3f27f75d | refs/heads/master | 2021-05-09T18:44:50.318975 | 2018-11-30T17:37:53 | 2018-11-30T17:37:53 | 119,171,783 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,643 | java | package com.atendimento.adapter;
import android.content.Context;
import android.view.View;
import com.atendimento.R;
import com.atendimento.model.Empresa;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import java.util.List;
public class AdapterEmpresasApp extends AdapterGenerico {
private List<Empresa> empresas;
public AdapterEmpresasApp(List<Empresa> objects ,Context context) {
super(context);
this.empresas = objects;
}
@Override
public void onBindViewHolder(final MyViewHoder holder, int position) {
holder.progressBar.setVisibility(View.VISIBLE);
Empresa empresa = empresas.get(position);
holder.textViewTitulo.setText(empresa.getNome());
holder.textViewSubTitulo.setText(empresa.getCategoria());
Picasso.with(contexto).load(empresa.getUrlImagem()).error(R.drawable.atendimento).into(holder.circleImageViewImagemListagem, new Callback() {
@Override
public void onSuccess() {
holder.progressBar.setVisibility(View.GONE);
}
@Override
public void onError() {
holder.progressBar.setVisibility(View.GONE);
}
});
if (empresa.getSelecionado()){ Picasso.with(contexto).load(R.drawable.checkmarkblue).resize(64,64).into(holder.circleImageViewSelecaoListagem);}
else{ holder.circleImageViewSelecaoListagem.setImageDrawable(null); }
}
@Override
public int getItemCount() {
return empresas.size();
}
@Override
public List getList() {
return empresas;
}
}
| [
"[email protected]"
] | |
461cbdf34d50e52867cb9facc74acea43143413f | cdbd53ceb24f1643b5957fa99d78b8f4efef455a | /vertx-gaia/vertx-co/src/main/java/io/vertx/up/commune/exchange/BType.java | c8f8498fdbcb1f2f86db4c79fcf16f86168a0afd | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | chundcm/vertx-zero | f3dcb692ae6b9cc4ced52386cab01e5896e69d80 | d2a2d096426c30d90be13b162403d66c8e72cc9a | refs/heads/master | 2023-04-27T18:41:47.489584 | 2023-04-23T01:53:40 | 2023-04-23T01:53:40 | 244,054,093 | 0 | 0 | Apache-2.0 | 2020-02-29T23:00:59 | 2020-02-29T23:00:58 | null | UTF-8 | Java | false | false | 947 | java | package io.vertx.up.commune.exchange;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/*
* Type Mapping here
* Definition for type conversation of `DualItem`
*/
class BType {
private static final ConcurrentMap<String, Class<?>> TYPES = new ConcurrentHashMap<String, Class<?>>() {
{
this.put("BOOLEAN", Boolean.class);
this.put("INT", Integer.class);
this.put("LONG", Long.class);
this.put("DECIMAL", BigDecimal.class);
this.put("DATE1", LocalDate.class);
this.put("DATE2", LocalDateTime.class);
this.put("DATE3", Long.class);
this.put("DATE4", LocalTime.class);
}
};
static Class<?> type(final String typeFlag) {
return TYPES.get(typeFlag);
}
}
| [
"[email protected]"
] | |
4b5085d4b66d1f2df87d1020a9e2165fe21603dd | 4068b4a2e477f177efc3932de044d011d74b8b25 | /picocli-codegen/src/main/java/picocli/codegen/annotation/processing/internal/CompletionCandidatesMetaData.java | 9e4eb3edaac821fadeb222bcbc7f930ec9b52d97 | [
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] | permissive | kakawait/picocli | d80b5ed0efb8cbe76a440dbf413b7393433d2bc7 | 3ba184ef0330df3052afe64aa0039f67bca38528 | refs/heads/master | 2020-06-07T21:14:59.559002 | 2019-06-26T08:06:58 | 2019-06-26T08:06:58 | 193,094,608 | 0 | 0 | Apache-2.0 | 2019-06-21T12:31:07 | 2019-06-21T12:31:07 | null | UTF-8 | Java | false | false | 3,323 | java | package picocli.codegen.annotation.processing.internal;
import picocli.codegen.annotation.processing.ITypeMetaData;
import picocli.codegen.util.Assert;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeMirror;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* Implementation of the {@link Iterable} interface that provides metadata on the
* {@code @Command(completionCandidates = xxx.class)} annotation.
*
* @since 4.0
*/
public class CompletionCandidatesMetaData implements Iterable<String>, ITypeMetaData {
private final TypeMirror typeMirror;
public CompletionCandidatesMetaData(TypeMirror typeMirror) {
this.typeMirror = Assert.notNull(typeMirror, "typeMirror");
}
/**
* Returns the completion candidates from the annotations present on the specified element.
* @param element the method or field annotated with {@code @Option} or {@code @Parameters}
* @return the completion candidates or {@code null} if not found
*/
public static Iterable<String> extract(Element element) {
List<? extends AnnotationMirror> annotationMirrors = element.getAnnotationMirrors();
for (AnnotationMirror mirror : annotationMirrors) {
DeclaredType annotationType = mirror.getAnnotationType();
if (TypeUtil.isOption(annotationType) || TypeUtil.isParameter(annotationType)) {
Map<? extends ExecutableElement, ? extends AnnotationValue> elementValues = mirror.getElementValues();
for (ExecutableElement attribute : elementValues.keySet()) {
if ("completionCandidates".equals(attribute.getSimpleName().toString())) {
AnnotationValue typeMirror = elementValues.get(attribute);
return new CompletionCandidatesMetaData((TypeMirror) typeMirror);
}
}
}
}
return null;
}
/**
* Returns {@code true} if the command did not have a {@code completionCandidates} annotation attribute.
* @return {@code true} if the command did not have a {@code completionCandidates} annotation attribute.
*/
public boolean isDefault() {
return false;
}
/**
* Returns the TypeMirror that this TypeConverterMetaData was constructed with.
* @return the TypeMirror of the {@code @Command(completionCandidates = xxx.class)} annotation.
*/
public TypeMirror getTypeMirror() {
return typeMirror;
}
public TypeElement getTypeElement() {
return (TypeElement) ((DeclaredType) typeMirror).asElement();
}
/** Always returns {@code null}. */
@Override
public Iterator<String> iterator() {
return null;
}
/**
* Returns a string representation of this object, for debugging purposes.
* @return a string representation of this object
*/
@Override
public String toString() {
return String.format("%s(%s)", getClass().getSimpleName(), isDefault() ? "default" : typeMirror);
}
}
| [
"[email protected]"
] | |
caf174db3b4f344d8032394fdb2c054a922e888d | fb80d88d8cdc81d0f4975af5b1bfb39d194e0d97 | /Platform_TreeFramework/src/net/sf/anathema/platform/tree/presenter/view/ISpecialNodeView.java | 6c01a0eb245e30f75af815a6fa55081c18ebacb2 | [] | no_license | mindnsoul2003/Raksha | b2f61d96b59a14e9dfb4ae279fc483b624713b2e | 2533cdbb448ee25ff355f826bc1f97cabedfdafe | refs/heads/master | 2021-01-17T16:43:35.551343 | 2014-02-19T19:28:43 | 2014-02-19T19:28:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 137 | java | package net.sf.anathema.platform.tree.presenter.view;
public interface ISpecialNodeView extends SpecialControl {
String getNodeId();
} | [
"[email protected]"
] | |
626bc877496256460d5483eba2e170e596442326 | 7bc4e9bed9a114329acd358785e1e34f8fe21cdb | /app/src/main/java/com/example/ex9/credits.java | cad22d777d395ea1ea04141e89fed1ff33bdd44e | [] | no_license | ns6991/ex9 | 97fec01af0f373527b471c47aa597b110aeec634 | 4e975b145a3e0bf017f9cd4a8b4cab7068d7abe5 | refs/heads/master | 2023-04-17T20:36:40.890262 | 2021-05-05T22:17:08 | 2021-05-05T22:17:08 | 364,719,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 967 | java | package com.example.ex9;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
public class credits extends AppCompatActivity {
double result;
Intent gi;
TextView textView;
@SuppressLint("SetTextI18n")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_credits);
textView = findViewById(R.id.textView);
gi = getIntent();
result = gi.getDoubleExtra("result", 1);
textView.setText("the last result is " + result + "\n Thank to Albert Levi the best teacher :)");
}
public void backTo(View view) {
Intent si = new Intent(this,MainActivity.class);
si.putExtra("result",result);
startActivity(si);
}
} | [
"[email protected]"
] | |
9a2a8177ad9bc7ba83ca5f0d7968f89ea7f7aca9 | 2a2e6b194d85678176ae4c4022dbd341073a9610 | /app/src/main/java/com/meiquick/vitimageload/MainActivity.java | b0d510a1ddef19b7cc635b917b2d7735915503e5 | [] | no_license | KeWeize/VitImageLoader | 2fb093ed5f21d8a1a28afd5ba04720a17aa4919c | d900b7bc70d3ff5e4bcbc6f653f880a8f47f8852 | refs/heads/master | 2020-03-28T05:55:51.340099 | 2018-09-10T08:15:23 | 2018-09-10T08:15:23 | 147,804,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,497 | java | package com.meiquick.vitimageload;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.meiquick.imageload.MImageLoader;
import com.meiquick.imageload.config.GlobalConfig;
import com.meiquick.imageload.config.ImageConfig;
import com.meiquick.imageload.loader.GlideLoader;
public class MainActivity extends AppCompatActivity {
TextView tvCacheSize;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView image01 = findViewById(R.id.test01);
ImageView image02 = findViewById(R.id.test02);
ImageView image03 = findViewById(R.id.test03);
ImageView image04 = findViewById(R.id.test04);
ImageView image05 = findViewById(R.id.test05);
MImageLoader.with(this).res(R.drawable.test01).into(image01);
MImageLoader.with(this).url("http://pic1.win4000.com/wallpaper/2017-12-04/5a24c0e98479b.jpg")
// .withCrossFade()
.asCircle()
// .centerCrop()
.into(image02);
MImageLoader.with(this).asserts("test03.jpg").into(image03);
MImageLoader.with(this).res(R.drawable.testgif).into(image04);
MImageLoader.with(this).raw(R.raw.test05).into(image05);
}
}
| [
"[email protected]"
] | |
4b258295a52d99b302c3f3784c5ac47dcfef0f80 | 3f811f5d0bcaa52d527b75bf30b0fa2133715675 | /app/src/main/java/com/example/r569642/imagescalingpoc/MyFragment.java | c413c7e0cbbbea79685b032d7a1b0f74fa52302f | [] | no_license | sheetal-hemrom/ImageScalingSample | 1dc2900b540f813601fce9165f0d552a011d8c9d | 2370c5c31def00b6f522418bfc5c2bf002a9cba9 | refs/heads/master | 2021-01-18T18:18:45.137939 | 2016-05-31T23:33:44 | 2016-05-31T23:33:44 | 60,130,536 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,325 | java | package com.example.r569642.imagescalingpoc;
import android.content.Context;
import android.media.Image;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
/**
* Created by r569642 on 5/12/16.
*/
public class MyFragment extends Fragment {
public static final String EXTRA_MESSAGE = "EXTRA_MESSAGE";
private ImageLoader imageLoader;
public static final MyFragment newInstance(String url,ImageLoader loader)
{
MyFragment f = new MyFragment();
Bundle bdl = new Bundle(1);
f.imageLoader = loader;
bdl.putString(EXTRA_MESSAGE, url);
f.setArguments(bdl);
return f;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
String message = getArguments().getString(EXTRA_MESSAGE);
View v = inflater.inflate(R.layout.grid_view_cell, container, false);
ImageView imageView = (ImageView)v.findViewById(R.id.imageView1);
//DisplayImage function from ImageLoader Class
imageLoader.displayImage(message,imageView);
return v;
}
}
| [
"[email protected]"
] | |
90c88ad4fa6beb1bc836ffaccbff75612705f5ec | 1acd3611676bf717320e8a7b05b23517c5ffe5b2 | /src/main/java/com/selenium/configure/environment/PropertiesHandler.java | 0bb19de5331a2c388aabd17a9c7b0a4749aeac04 | [
"Apache-2.0"
] | permissive | estefafdez/selenium-cucumber | f5e3de19d1258364d8326118c1f11945873e73d2 | 942dd9f679032f17ef28a81981d627c552f2ea1d | refs/heads/master | 2023-08-07T22:44:56.296053 | 2023-07-27T06:35:24 | 2023-07-27T06:35:24 | 81,545,385 | 10 | 34 | Apache-2.0 | 2023-09-06T16:43:22 | 2017-02-10T08:45:15 | Java | UTF-8 | Java | false | false | 2,619 | java | package com.selenium.configure.environment;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.apache.log4j.Logger;
import org.openqa.selenium.By;
/**
* Custom class to handle the properties files.
* @author estefafdez
*
*/
public class PropertiesHandler {
private static String properties = "selector.properties";
private static Properties selectorProp = new Properties();
private static InputStream in = WebDriverFactory.class.getResourceAsStream("/selectors/selector.properties");
static String selector;
/******** Log Attribute ********/
private static Logger log = Logger.getLogger(PropertiesHandler.class);
private PropertiesHandler(){
}
/**
* Get the selector of a properties file with its key.
*/
public static String getSelectorFromProperties(String key){
try {
log.info("***********************************************************************************************************");
log.info("[ Properties Configuration ] - Read the selector properties from: " + properties);
selectorProp.load(in);
selector = selectorProp.getProperty(key);
} catch (IOException e) {
log.error("getSelectorFromProperties Error", e);
}
return selector;
}
/**
* Get the complete element with a selected type and key.
*/
public static By getCompleteElement(String type, String key) {
By result;
String selector = getSelectorFromProperties(key);
switch (type) {
case "className":
result = By.className(selector);
break;
case "cssSelector":
result = By.cssSelector(selector);
break;
case "id":
result = By.id(selector);
break;
case "linkText":
result = By.linkText(selector);
break;
case "name":
result = By.name(selector);
break;
case "partialLinkText":
result = By.partialLinkText(selector);
break;
case "tagName":
result = By.tagName(selector);
break;
case "xpath":
result = By.xpath(selector);
break;
default:
throw new IllegalArgumentException("By type " + type + " is not found.");
}
return result;
}
} | [
"[email protected]"
] | |
b84b27be17275c1e6acd783e4fb29fe2defc9388 | 9e517eba94bdb135dd87399d87cdb63dc9632b1a | /app/src/main/java/com/troyanskiievgen/carowners/repository/dao/CarDAO.java | 82664f4763c8c8619b777b8511e9b80c8ccd2862 | [] | no_license | Troyanskii/CarOwners | 680f869710ffb8ca2ca7395c7211424507fcd6df | febaf340f868c90f07564e4f8bf52eaedb41294c | refs/heads/master | 2020-12-02T06:45:00.078523 | 2017-07-11T13:55:01 | 2017-07-11T13:55:01 | 96,892,803 | 0 | 0 | null | 2017-07-11T13:55:02 | 2017-07-11T12:53:39 | Java | UTF-8 | Java | false | false | 254 | java | /*
* Copyright (c) 2017. Eugene Troyanskii
* [email protected]
*/
package com.troyanskiievgen.carowners.repository.dao;
import android.arch.persistence.room.Dao;
/**
* Created by Relax on 11.07.2017.
*/
@Dao
public interface CarDAO {
}
| [
"[email protected]"
] | |
52bba51f3bfd6d9612156304b3378c6ab19f5835 | 9e15febb6dc37e6e17d7ab06b4157232aa054fb3 | /Week14/week14day1/src/main/java/com/tts/week14day1/model/Greeting.java | b86928445fcf5bf4f5c2b11f604bbe6c56fad04d | [
"MIT"
] | permissive | Phillip-Revak/WIN | c8d2689b708e3288f177e9fc890dec0206317c3f | 4a5032e84c60bd34ebbe45c48efe6601c1f421ec | refs/heads/main | 2023-05-07T12:33:14.763134 | 2021-06-03T13:54:50 | 2021-06-03T13:54:50 | 343,567,447 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package com.tts.week14day1.model;
public class Greeting {
private Long id;
private String content;
public Greeting(Long id, String content) {
this.id = id;
this.content = content;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
| [
"[email protected]"
] | |
6ec264ac82ac3475b8ca89a81283c2a9f17d77e3 | f2feced5772f7b2be4fb299d60a84e7dd292c665 | /app/src/main/java/com/example/hp/railwaymanager/TrainSearchActivity.java | ddee94aa60fcb4df991115904eef6a2d983f3db4 | [] | no_license | sadia-sust/RailwayManager | ed02216a8059f1bf7226d26d5f45ae8f85427a11 | 4df416ff4f80f46884bba05b5eadf257f148a0be | refs/heads/master | 2021-07-25T02:51:18.489965 | 2017-11-06T07:41:56 | 2017-11-06T07:41:56 | 109,662,643 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,385 | java | package com.example.hp.railwaymanager;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView;
import java.util.ArrayList;
public class TrainSearchActivity extends ActionBarActivity {
ListView list2;
static int tSA;
@Override
protected void onCreate(Bundle savedInstanceState)
{
tSA = -1;
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_train_search);
list2 = (ListView)findViewById(R.id.trainlist);
ArrayList<String> items = new ArrayList<String>();
// items.add(Integer.toString(TrackTrainActivity.toStation) +" "+ Integer.toString(TrackTrainActivity.frmStation));
if(TrackTrainActivity.frmStation==2 && TrackTrainActivity.toStation==0)
{
items.add("Parabot");
items.add("Kalni");
items.add("Joyontica");
items.add("Upaban");
}
if(TrackTrainActivity.frmStation==0 && TrackTrainActivity.toStation==2)
{
items.add("parabot");
items.add("kalni");
items.add("joyontica");
items.add("upaban");
}
if(TrackTrainActivity.frmStation==1 && TrackTrainActivity.toStation==2)
{
items.add("udayan");
items.add("paharika");
}
if(TrackTrainActivity.frmStation==2 && TrackTrainActivity.toStation==1)
{
items.add("Udayan");
items.add("Paharika");
}
if(TrackTrainActivity.frmStation==1 && TrackTrainActivity.toStation==0)
{
items.add("Mahanagar Provati");
items.add("Shuborno Express");
items.add("Mohanagar Godhuli");
items.add("Turna Nishitha");
}
if(TrackTrainActivity.frmStation==0 && TrackTrainActivity.toStation==1)
{
items.add("mahanagar provati");
items.add("shuborno express");
items.add("mohanagar godhuli");
items.add("turna nishitha");
}
if(TrackTrainActivity.frmStation==0 && TrackTrainActivity.toStation==3)
{
items.add("silkCity express");
items.add("padma express");
items.add("dhumkatu express");
}
if(TrackTrainActivity.frmStation==3 && TrackTrainActivity.toStation==0)
{
items.add("SilkCity Express");
items.add("Padma Express");
items.add("Dhumkatu Express");
}
list2.setAdapter(new CustomAdapter2(this, items));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_train_search, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
} | [
"[email protected]"
] | |
fd9602b8aae8d2a363f97c30592faa76a78f62bb | 714fe59341fbaee9c8e899fbb35e5b16fd361718 | /src/main/java/com/study/hu/rpc/common/protocol/Response.java | e495fbdd42540bf64edd5b5d233500c55da67c07 | [] | no_license | hudongdong129/rpc | 09fdfd6731bd46c5999fba552aaa62f808f029a3 | 94cd605424fdf8d81a93fbb5bfb5d5aa2341cabc | refs/heads/master | 2022-06-24T21:57:42.622214 | 2019-12-25T05:34:49 | 2019-12-25T05:34:49 | 229,012,328 | 0 | 0 | null | 2022-06-17T02:48:24 | 2019-12-19T08:45:31 | Java | UTF-8 | Java | false | false | 1,413 | java | package com.study.hu.rpc.common.protocol;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* @Author hudongdong
* @Date 2019/12/19 14:33
*/
public class Response implements Serializable {
private static final long serialVersionUID = -4444706353612846553L;
private Status status;
private Map<String, String> headers = new HashMap<String, String>();
private Object returnValue;
private Exception exception;
public Response(Status status) {
this.status = status;
}
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
public Map<String, String> getHeaders() {
return headers;
}
public void setHeaders(Map<String, String> headers) {
this.headers = headers;
}
public Object getReturnValue() {
return returnValue;
}
public void setReturnValue(Object returnValue) {
this.returnValue = returnValue;
}
public Exception getException() {
return exception;
}
public void setException(Exception exception) {
this.exception = exception;
}
public void setHeader(String key, String value) {
this.headers.put(key, value);
}
public String getHeader(String key) {
return this.headers == null ? null : this.headers.get(key);
}
}
| [
"[email protected]"
] | |
1a7f33686fe3f0d15619ad95161bd54d7a84fca4 | 322c962b1058ea654d382b83a1225047bcc34a00 | /src/main/java/com/bigdatapassion/prodcon/KafkaProducerExample.java | 5023f4b66ebb9035059d29177ca538832a080914 | [] | no_license | zkarol/kafka-training | 712d09c51d77174cf2aa09aef2fcfc85c40b37a6 | e66af2dfaa0cd87cfa1a882eeb18f598ad8b6b38 | refs/heads/master | 2020-12-12T16:09:01.092678 | 2019-08-23T14:10:04 | 2019-08-23T14:10:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,920 | java | package com.bigdatapassion.prodcon;
import com.bigdatapassion.callback.LoggerCallback;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.log4j.Logger;
import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;
import static com.bigdatapassion.KafkaConfigurationFactory.*;
public class KafkaProducerExample {
private static final Logger LOGGER = Logger.getLogger(KafkaProducerExample.class);
private static final AtomicInteger MESSAGE_ID = new AtomicInteger(1);
private static final String[] MESSAGES = {"Ala ma kota, Ela ma psa", "W Szczebrzeszynie chrzaszcz brzmi w trzcinie", "Byc albo nie byc"};
public static void main(String[] args) {
Producer<String, String> producer = new KafkaProducer<>(createProducerConfig());
LoggerCallback callback = new LoggerCallback();
Random random = new Random(System.currentTimeMillis());
try {
while (true) {
for (long i = 0; i < 10; i++) {
int id = random.nextInt(MESSAGES.length);
String key = "key-" + id;
String value = MESSAGES[id];
ProducerRecord<String, String> data = new ProducerRecord<>(TOPIC, key, value);
producer.send(data, callback); // async with callback
// producer.send(data); // async without callback
// producer.send(data).get(); // sync send
MESSAGE_ID.getAndIncrement();
}
LOGGER.info("Sended messages");
Thread.sleep(SLEEP);
}
} catch (Exception e) {
LOGGER.error("Błąd...", e);
} finally {
producer.flush();
producer.close();
}
}
}
| [
"[email protected]"
] | |
ff51c5f97c95a009f5ff1a55be83047521a56196 | ff87d16bd74624d4953449cc4c408cf70229bfcb | /app/src/main/java/com/huyingbao/rxflux2/base/application/BaseApplication.java | c065c734aa97475be7ea2924bebc0212193ed524 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | HuYingBao/DmRxFlux | f380b8b9d6162c1b8134f65a44cfc9160ca4fe36 | ea32e015d044ac468b8c77caa120bcd6ed3b28df | refs/heads/master | 2021-08-15T03:52:25.628555 | 2017-11-17T08:47:39 | 2017-11-17T08:47:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,721 | java | package com.huyingbao.rxflux2.base.application;
import android.app.Application;
import android.content.Context;
import android.support.multidex.MultiDex;
import com.alibaba.sdk.android.man.MANService;
import com.alibaba.sdk.android.man.MANServiceProvider;
import com.huyingbao.dm.BuildConfig;
import com.huyingbao.rxflux2.inject.component.ApplicationComponent;
import com.huyingbao.rxflux2.inject.component.DaggerApplicationComponent;
import com.huyingbao.rxflux2.inject.module.application.ApplicationModule;
import com.huyingbao.rxflux2.store.AppStore;
import com.huyingbao.rxflux2.util.AppUtils;
import com.huyingbao.rxflux2.util.CommonUtils;
import com.huyingbao.rxflux2.util.DevUtils;
import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.FormatStrategy;
import com.orhanobut.logger.Logger;
import com.orhanobut.logger.PrettyFormatStrategy;
import com.taobao.sophix.PatchStatus;
import com.taobao.sophix.SophixManager;
import javax.inject.Inject;
/**
* Application multidex分包 依赖注入 初始化注释
* Created by liujunfeng on 2017/1/1.
*/
public class BaseApplication extends Application {
@Inject
AppStore mAppStore;
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);// multidex分包
}
@Override
public void onCreate() {
super.onCreate();
// 初始化hotfix
initHotfix();
// 初始化analytics
initAnalytics();
// 保存application实例对象
AppUtils.setApplication(this);
//初始化debug
initDebug();
// 初始化dagger
initDagger();
// 依赖注入
AppUtils.getApplicationComponent().inject(this);
// 注册全局store
mAppStore.register();
// Stetho调试
//Stetho.initializeWithDefaults(this);
}
/**
* 初始化hotfix
*/
private void initHotfix() {
SophixManager.getInstance().setContext(this)
.setAppVersion(DevUtils.getAppVersion(this))
.setAesKey(null)
.setEnableDebug(BuildConfig.LOG_DEBUG)
.setPatchLoadStatusStub((mode, code, info, handlePatchVersion) -> {
// 补丁加载回调通知
switch (code) {
case PatchStatus.CODE_LOAD_SUCCESS://表明补丁加载成功
Logger.d("表明补丁加载成功");
break;
case PatchStatus.CODE_LOAD_RELAUNCH://表明新补丁生效需要重启. 开发者可提示用户或者强制重启; 建议: 用户可以监听进入后台事件, 然后应用自杀
Logger.d("表明新补丁生效需要重启");
if (!CommonUtils.isTopActivity(this) || !CommonUtils.isVisible(this))
android.os.Process.killProcess(android.os.Process.myPid());
break;
case PatchStatus.CODE_LOAD_FAIL://内部引擎异常, 推荐此时清空本地补丁, 防止失败补丁重复加载
Logger.d("内部引擎异常");
SophixManager.getInstance().cleanPatches();
break;
default:// 其它错误信息, 查看PatchStatus类说明
Logger.d("hotfix:" + code + "\n" + info);
break;
}
})
.initialize();
}
/**
* 初始化analytics
*/
private void initAnalytics() {
// 获取MAN服务
MANService manService = MANServiceProvider.getService();
// 打开调试日志,线上版本建议关闭
if (BuildConfig.DEBUG) manService.getMANAnalytics().turnOnDebug();
// MAN初始化方法之一,从AndroidManifest.xml中获取appKey和appSecret初始化
manService.getMANAnalytics().init(this, getApplicationContext());
}
/**
* 初始化debug工具
*/
private void initDebug() {
//.logStrategy(customLog) // (Optional) Changes the log strategy to print out. Default LogCat
//.methodOffset(5) // (Optional) Hides internal method calls up to offset. Default 5
FormatStrategy formatStrategy = PrettyFormatStrategy.newBuilder()
.showThreadInfo(false) // (Optional) Whether to show thread info or not. Default true
.methodCount(2) // (Optional) How many method line to show. Default 2
.tag("DmRxFlux") // (Optional) Global tag for every log. Default PRETTY_LOGGER
.build();
Logger.addLogAdapter(new AndroidLogAdapter(formatStrategy) {
@Override
public boolean isLoggable(int priority, String tag) {
return BuildConfig.LOG_DEBUG;
}
});
// if (BuildConfig.LOG_DEBUG) {
// if (LeakCanary.isInAnalyzerProcess(this)) return;
// LeakCanary.install(this);
// }
}
/**
* 初始化dagger
*/
private void initDagger() {
// Module实例的创建
// 如果Module只有有参构造器,则必须显式传入Module实例,
// 单例的有效范围随着其依附的Component,
// 为了使得@Singleton的作用范围是整个Application,需要添加以下代码
ApplicationComponent applicationComponent = DaggerApplicationComponent.builder()
.applicationModule(new ApplicationModule(this)).build();
AppUtils.setApplicationComponent(applicationComponent);
}
}
| [
"[email protected]"
] | |
955f947e5ecfe581b0379dac902dcab71d767850 | d234cc1777205a569a026a1f1f45a6633bc502c9 | /Android/UniversalRemote/src/com/remote/universalremote/irapi/IrApi.java | 402816df6e6a3fcc7fbaab0379add6271dfdff7d | [] | no_license | deepalidk/andemos | ed0c5c590ce6e9982d43e1518116431b8c7cf5f3 | 03f7cf5d69d6ff9c4e4d60b7bcfa88eeae73ac63 | refs/heads/master | 2021-01-10T11:54:11.237390 | 2013-01-10T09:34:14 | 2013-01-10T09:34:14 | 51,981,513 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 20,450 | java | package com.remote.universalremote.irapi;
import java.util.LinkedList;
import android.text.format.Time;
import android.util.Log;
/**
* @author walker
* @date 2011.06.23
*/
public class IrApi implements IOnRead {
// Debugging
private static final String TAG = "Irapi";
private static final boolean D = false;
/**
* IO Control handle
*/
private IIo mmIIo;
/**
* the ack packet recevied from RT300
*/
private LinkedList<Frame> mmFrames;
/**
* the state of Parser
*/
private EParseState mmParseState;
/**
* Frame data of RT300
*/
private Frame mmFrame;
/**
* temp of current command id;
*/
private byte mmTempCmdId;
/**
* time to Retransimit(ms)
*/
private int mmRetransimitTime = 500;
/**
* time to Retransimit(ms)
*/
private int mmRetransimitCount = 2;
public static IrApi getHandle() {
return mmIrApi;
}
private static IrApi mmIrApi = new IrApi();
private IrApi() {
mmIIo = null;
mmParseState = EParseState.cmd;
mmFrames = new LinkedList<Frame>();
}
/* RT300 and 400 header */
private static final byte[] RT400_HEADER = new byte[] { 0x45, 0x5a };
private static final byte[] RT300_HEADER = new byte[] { 0x45, 0x34 };
/* RT400 Key Code */
private static final byte[] RT400_ENCY_KEY = new byte[] { 0x38, 0x34, 0x33,
0x30 };
/*
* RT300 marker. Set in function Init(). true-rt300 false-rt400
*/
private boolean mIsRT300 = false;
/*
* THE Header for communication.
*/
private byte[] getHeader() {
if (mIsRT300 == true) {
return RT400_HEADER;
} else {
return RT300_HEADER;
}
}
/**
* transmit data with RT300
*
* @param TXbuf
* data to send to RT300
* @param timeOut
* retransmit timeout
* @param retransmitCount
* retransmit count
* @return Ack packet
* @throws InterruptedException
*/
private boolean transmit_data(byte[] TXbuf, int timeOut, int retransmitCount)
throws InterruptedException {
if (mmIIo == null)
return false;
mmFrames.clear();
Time t1 = new Time(); // or Time t=new Time("GMT+8"); 加上Time Zone资料。
Time t2 = new Time(); // or Time t=new Time("GMT+8"); 加上Time Zone资料。
Time t3;
t1.setToNow(); // 取得系统时间。
do {
mmIIo.write(TXbuf);
synchronized (mmFrames) {
mmFrames.wait(timeOut);
if (mmFrames.size() > 0) {
if (mmFrames.getLast().getPayloadBuffer()[0] == EFrameStatus.Succeed
.getValue()) {
t2.setToNow();
long t = t2.toMillis(true) - t1.toMillis(true);
String msg = String.format("%d", t);
if (D)
Log.d("TimeElapsed", msg);
return true;
} else {
return false;
}
}
}
} while (retransmitCount-- > 0);
return false;
}
/**
* transmit data with RT300
*
* @param TXbuf
* data to send to RT300
* @return Ack packet
* @throws InterruptedException
*/
private boolean transmit_data(byte[] TXbuf) throws InterruptedException {
return transmit_data(TXbuf, mmRetransimitTime, mmRetransimitCount);
}
/**
* transmit data with RT300
*
* @param TXbuf
* data to send to RT300
* @return Ack status
* @throws InterruptedException
*/
private byte transmit_data_ex(byte[] TXbuf) throws InterruptedException {
if (mmIIo == null)
return (byte) EFrameStatus.ErrorGeneral.getValue();
mmIIo.write(TXbuf);
synchronized (mmFrames) {
mmFrames.wait(3000);
if (mmFrames.size() > 0) {
return mmFrames.getLast().getPayloadBuffer()[0];
}
}
return (byte) EFrameStatus.ErrorGeneral.getValue();
}
/***** IR API *******************/
/**
* @param in
* iIo the interface of IO
*
* @return the firmware version of RT300.
*
*/
public String init(IIo iIo) {
if(D)
Log.d(TAG, "init");
mmIIo = iIo;
mmIIo.setOnReadFunc(this);
mmParseState = EParseState.cmd;
/* try rt400 protocol */
mIsRT300 = false;
byte[] versionTemp = IrGetVersion();
/* try rt400 protocol */
if (versionTemp == null) {
mIsRT300 = true;
versionTemp = IrGetVersion();
}
String result = null;
if (!D) {
if (versionTemp == null) {
mmIIo.setOnReadFunc(null);
mmIIo = null;
} else {
result = String.format("%02x%02x", versionTemp[1],
versionTemp[2]);
}
}
return result;
}
/**
* get RT300 version info
*
* @param version
* @return true-success false-failed
*/
public byte[] IrGetVersion() {
if (D)
Log.d(TAG, "IrGetVersion");
Frame frame = new Frame(0);
frame.setCmdID((byte) 0x09);
byte[] version = null;
try {
boolean result = transmit_data(frame.getPacketBuffer());
if (result) {
if (D)
Log.d(TAG, "IRGetVersion, mmFrames.removeFirst()");
Frame rsultframe = mmFrames.removeFirst();
if (D)
Log.d(TAG, "rsultframe.getPayloadBuffer();");
version = rsultframe.getPayloadBuffer();
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
if (D)
Log.d(TAG, "IRGetVersion, exception");
e.printStackTrace();
}
return version;
}
/*******************************
* stop IR transmission
*******************************/
public void IrTransmitStop() {
byte buffer[] = new byte[1];
buffer[0] = 0x00;
mmIIo.write(buffer);
}
/**
* TRANSMIT PREPROGRAMMED IR CODE
*
* @param type
* IR transmission type
* @param devId
* device ID
* @param codeNum
* code Number or Code location Number
* @param keyId
* Key ID
* @return
*/
public boolean transmitPreprogramedCode(byte type, byte devId, int codeNum,
byte keyId) {
if (D)
Log.d(TAG, "transmitPreprogramedCode");
Frame frame = new Frame(5);
frame.setCmdID((byte) 0x01);
boolean result = false;
try {
frame.addPayload(type);
frame.addPayload(devId);
frame.addPayload((byte) (codeNum >> 8));
frame.addPayload((byte) (codeNum & 0xFF));
frame.addPayload(keyId);
result = transmit_data(frame.getPacketBuffer());
} catch (InterruptedException e) {
// TODO Auto-generated catch block
if (D)
Log.d(TAG, "transmitPreprogramedCode, exception");
e.printStackTrace();
}
return result;
}
/**
* TRANSMIT PREPROGRAMMED IR CODE
*
* @param type
* IR transmission type
* @param devId
* device ID
* @param codeNum
* code Number or Code location Number
* @param keyId
* Key ID
* @return
*/
public boolean transmitIrData(byte type, byte[] data) {
if (mIsRT300 == true) {
return transmitIrDataRT300(type, data);
} else {
return transmitIrDataRT400(type, data);
}
}
/**
* TRANSMIT PREPROGRAMMED IR CODE
*
* @param type
* IR transmission type
* @param devId
* device ID
* @param codeNum
* code Number or Code location Number
* @param keyId
* Key ID
* @return
*/
public boolean transmitIrDataRT300(byte type, byte[] data) {
if (D)
Log.d(TAG, "transmitPreprogramedCode");
if (data == null) {
return false;
}
Frame frame = new Frame(81);
frame.setCmdID((byte) 0x20);
boolean result = false;
try {
frame.addPayload(type);
frame.addPayload(data);
Log.d("DeviceKeyActivity", "" + "changed");
result = transmit_data(frame.getPacketBuffer());
Log.d("DeviceKeyActivity", "result" + result);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
if (D)
Log.d(TAG, "transmitPreprogramedCode, exception");
e.printStackTrace();
}
return result;
}
/**
* TRANSMIT PREPROGRAMMED IR CODE
*
* @param type
* IR transmission type
* @param devId
* device ID
* @param codeNum
* code Number or Code location Number
* @param keyId
* Key ID
* @return
*/
public boolean transmitIrDataRT400(byte type, byte[] data) {
if (D)
Log.d(TAG, "transmitPreprogramedCode");
if (data == null) {
return false;
}
Frame frame = new Frame(85);
frame.setCmdID((byte) 0x26);
boolean result = false;
try {
frame.addPayload(type);
frame.addPayload(RT400_ENCY_KEY);
frame.addPayload(data);
Log.d("DeviceKeyActivity", "" + "changed");
result = transmit_data(frame.getPacketBuffer());
Log.d("DeviceKeyActivity", "result" + result);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
if (D)
Log.d(TAG, "transmitPreprogramedCode, exception");
e.printStackTrace();
}
return result;
}
/**
* GET KEY FLAG
*
* @param devId
* device ID
* @param codeNum
* code Number or Code location Number
* @return 1 byte status 8 bytes flag.
*/
public byte[] getKeyFlag(byte devId, int codeNum) {
if (D)
Log.d(TAG, "getKeyFlag");
Frame frame = new Frame(3);
frame.setCmdID((byte) 0x03);
byte flags[] = null;
try {
boolean result = false;
frame.addPayload(devId);
frame.addPayload((byte) (codeNum >> 8));
frame.addPayload((byte) (codeNum & 0xFF));
result = transmit_data(frame.getPacketBuffer());
if (result) {
flags = mmFrames.getLast().getPayloadBuffer();
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
if (D)
Log.d(TAG, "getKeyFlag, exception");
e.printStackTrace();
}
return flags;
}
/**
* STORE SUPPLEMENTRARY LIBRARY TO E2PROM
*
* @param location
* the location of library.
*
* @param data
* the data to be write.
*
* @return
*/
public boolean StoreLibrary2E2prom(byte location, byte[] data) {
if (D)
Log.d(TAG, "StoreLibrary2E2prom");
boolean result = false;
if (data.length != 592) {
return result;
}
try {
// transform the first 4 packages.
int curStart = 0;
int curLength = 121;
byte status = 0;
Frame frame;
int i = 0;
for (i = 0; i < 4; i++) {
frame = new Frame(123);
frame.setCmdID((byte) 0x07);
frame.addPayload(location);
frame.addPayload((byte) i);
frame.addPayload(data, curStart, curLength);
status = transmit_data_ex(frame.getPacketBuffer());
if (status != 0x31) {
break;
}
if (D)
Log.d(TAG, " " + status);
curStart += 121;
}
if (status != 0x31) {
return result;
}
frame = new Frame(110);
frame.setCmdID((byte) 0x07);
frame.addPayload(location);
frame.addPayload((byte) 4);
frame.addPayload(data, 484, 108);
if (D)
Log.d(TAG, " " + status);
status = transmit_data_ex(frame.getPacketBuffer());
result = (status == 0x30);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
if (D)
Log.d(TAG, "transmitPreprogramedCode, exception");
e.printStackTrace();
}
return result;
}
/**
* TRANSMIT PREPROGRAMMED IR CODE
*
* @param type
* type: 0 av
* type: 1 ac
* @return
*/
public byte[] learnIrCode(byte type) {
if (D)
Log.d(TAG, "transmitPreprogramedCode");
// byte[] leanCmd;
// = new byte[] { 0x45, 0x34, 0x24, 0x04, (byte) 0xa1 };
Frame frame = new Frame(0);
if(type==0){
frame.setCmdID((byte) 0x24);
}else{
frame.setCmdID((byte)0x27);
}
byte[] result = null;
try {
boolean tResult = transmit_data(frame.getPacketBuffer());
if (tResult) {
synchronized (mmFrames) {
mmFrames.wait(20000);
if (mmFrames.size() > 1) {
byte[] payloadBuffer = mmFrames.getLast()
.getPayloadBuffer();
if (payloadBuffer[0] == EFrameStatus.Succeed.getValue()) {
result = new byte[80];
for (int i = 0; i < 80; i++) {
result[i] = payloadBuffer[i + 1];
}
}
}
}
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
if (D)
Log.d(TAG, "transmitPreprogramedCode, exception");
e.printStackTrace();
}
return result;
}
/**
* TRANSMIT PREPROGRAMMED IR CODE
*
* @param loc
* IR Code Storage Location(0-100)
* @return 81 byte data.
*/
public byte[] readLearnData(byte loc) {
if (D)
Log.d(TAG, "transmitPreprogramedCode");
Frame frame = new Frame(1);
frame.setCmdID((byte) 0x12);
boolean result = false;
byte[] resultFrame = null;
try {
frame.addPayload(loc);
result = transmit_data(frame.getPacketBuffer());
if (result) {
Frame resultframe = mmFrames.removeFirst();
if (D)
Log.d(TAG, "rsultframe.getPayloadBuffer();");
resultFrame = resultframe.getPayloadBuffer();
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
if (D)
Log.d(TAG, "transmitPreprogramedCode, exception");
e.printStackTrace();
}
return resultFrame;
}
/**
* TRANSMIT LEARNED IR CODE
*
* @param type
* IR transmission type
* @param loc
* Learned IR Code Storage Location
* @return
*
*/
public boolean transmitLearnData(byte type, byte[] data) {
if (D)
Log.d(TAG, "transmitPreprogramedCode");
if (data == null) {
return false;
}
Frame frame = new Frame(81);
frame.setCmdID((byte) 0x25);
boolean result = false;
try {
frame.addPayload(type);
frame.addPayload(data);
Log.d("DeviceKeyActivity", "" + "changed");
result = transmit_data(frame.getPacketBuffer());
Log.d("DeviceKeyActivity", "result" + result);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
if (D)
Log.d(TAG, "transmitPreprogramedCode, exception");
e.printStackTrace();
}
return result;
}
/**
* TRANSMIT PREPROGRAMMED IR CODE
*
* @param type
* IR Code Storage Location(0-100)
* @param data
* IR learn data.
* @return
*
*/
public boolean storeLearnData(byte loc, byte[] data) {
if (D)
Log.d(TAG, "transmitPreprogramedCode");
if (data == null)
return false;
Frame frame = new Frame(82);
frame.setCmdID((byte) 0x13);
boolean result = false;
try {
frame.addPayload(loc);
frame.addPayload(data);
result = transmit_data(frame.getPacketBuffer());
} catch (InterruptedException e) {
// TODO Auto-generated catch block
if (D)
Log.d(TAG, "transmitPreprogramedCode, exception");
e.printStackTrace();
}
return result;
}
/***** end of ir api *******************/
/**
* parse of RT300 protocol ack packet
*
* @param buffer
* data to be Parse
*/
private void Parse(byte buffer) {
if (D)
Log.d(TAG,
"state=" + mmParseState
+ String.format("Buffer=%H ", buffer));
if (mmParseState == EParseState.cmd) {
mmTempCmdId = buffer;
mmParseState = EParseState.length;
} else if (mmParseState == EParseState.length) {
mmFrame = new Frame(buffer - 2);
mmFrame.setCmdID(mmTempCmdId);
if (buffer != 2) {
mmParseState = EParseState.data;
} else {
mmParseState = EParseState.checkSum;
}
} else if (mmParseState == EParseState.data) {
mmFrame.addPayload(buffer);
if (mmFrame.isPayloadFull()) {
mmParseState = EParseState.checkSum;
}
} else if (mmParseState == EParseState.checkSum) {
if (buffer == mmFrame.calcAckChecksum()) {
// if (mmFrame.getPayloadBuffer()[0] == EFrameStatus.Succeed
// .getValue()) {
synchronized (mmFrames) {
mmFrames.add(mmFrame);
mmFrames.notify();
}
// }
}
mmParseState = EParseState.cmd;
}
}
@Override
public void OnRead(byte[] buffer, int len) {
// TODO Auto-generated method stub
for (int i = 0; i < len; i++) {
Parse(buffer[i]);
}
}
/**
* Frame of the RT300 protocol
*
* @author walker
*
*/
class Frame {
/**
* data buffer
*/
private byte[] mmPayloadBuffer;
/*
* buffer len
*/
private int mmPayloadLen;
/**
* the idx of current data buffer
*/
private int mmPayloadIdx;
/**
* max length of data buffer
*/
private int MaxBufLen = 150;
/*
* command id of frame
*/
private byte mmCmdId;
/**
* set the frame cmd id;
*
* @param cmdId
*/
public void setCmdID(byte cmdId) {
mmCmdId = cmdId;
}
/**
* set the frame cmd id;
*
* @param cmdId
*/
public byte getCmdID() {
return mmCmdId;
}
public Frame(int len) {
mmPayloadBuffer = new byte[300];
mmPayloadLen=len;
mmPayloadIdx = 0;
}
/**
* get the frame data
*
* @return
*/
public byte[] getPayloadBuffer() {
byte[] result=new byte[mmPayloadIdx];
System.arraycopy(mmPayloadBuffer, 0, result, 0,
mmPayloadIdx);
return result;
}
/**
* get frame is complete.
*/
public boolean isPayloadFull() {
return mmPayloadIdx == mmPayloadLen;
}
/**
* add data to frame
*
* @param buffer
* the data to be added.
*/
public void addPayload(byte buffer) {
mmPayloadBuffer[mmPayloadIdx++] = buffer;
}
/**
* add data to frame
*
* @param buffer
* the data to be added.
*/
public void addPayload(byte[] buffer) {
System.arraycopy(buffer, 0, mmPayloadBuffer, mmPayloadIdx,
buffer.length);
mmPayloadIdx += buffer.length;
}
/**
* add data to frame
*
* @param buffer
* the data to be added.
*/
public void addPayload(byte[] buffer, int start, int length) {
System.arraycopy(buffer, start, mmPayloadBuffer, mmPayloadIdx,
length);
mmPayloadIdx += length;
}
public void clearPayload() {
mmPayloadIdx = 0;
}
/**
* calculate ack packet checksum
*
* @param pData
* : the data for calculate checksum
* @return: the length of pData
*/
public byte calcAckChecksum() {
byte result = 0;
result += mmCmdId;
result += mmPayloadIdx + 2;
for (int i = 0; i < mmPayloadIdx; i++) {
result += mmPayloadBuffer[i];
}
return result;
}
/**
* get ack packet buffer
*
* @return
*/
public byte[] getAckPacketBuffer() {
byte[] result = new byte[mmPayloadIdx + 3];
result[0] = mmCmdId;
result[1] = (byte) (mmPayloadIdx + 2);
System.arraycopy(mmPayloadBuffer, 0, result, 2,
mmPayloadIdx);
result[result.length - 1] = calcAckChecksum();
return result;
}
/**
* calculate ack packet checksum
*
* @param pData
* : the data for calculate checksum
* @return: the length of pData
*/
public byte calcChecksum() {
byte result = 0;
byte[] header = getHeader();
result += header[0];
result += header[1];
result += mmCmdId;
result += mmPayloadIdx + 4;
for (int i = 0; i < mmPayloadIdx; i++) {
result += mmPayloadBuffer[i];
}
return result;
}
/**
* get ack packet buffer
*
* @return
*/
public byte[] getPacketBuffer() {
byte[] result = new byte[mmPayloadIdx + 5];
byte[] header = getHeader();
result[0] = header[0];
result[1] = header[1];
result[2] = mmCmdId;
result[3] = (byte) (mmPayloadIdx + 4);
System.arraycopy(mmPayloadBuffer, 0, result, 4,
mmPayloadIdx);
result[result.length - 1] = calcChecksum();
return result;
}
};
/**
* Parse State
*
* @author walker
*
*/
enum EParseState {
cmd, // cmd Id
length, // data length
data, // data
checkSum, // checksum
};
/**
* the status of current frame.
*
* @author walker
*
*/
enum EFrameStatus {
Succeed(0x30), ErrorGeneral(0x40);
private int value;
EFrameStatus(int value) {
this.value = value;
}
public int getValue() {
return value;
}
};
}
| [
"walkerwk@febdd8de-34b2-09fa-199c-44fb402a6750"
] | walkerwk@febdd8de-34b2-09fa-199c-44fb402a6750 |
de7e9981cbfd28a2c60de5dee21bbde84af0ef84 | 2040b6b739beb73a744e4b6e635c0d86192ff39e | /src/main/java/com/matthewyao/designpattern/template/Teacher.java | 9cb13fe5c349547becba3ce3a7f9ef461844b8ce | [] | no_license | matthewyao/JavaLearning | fc7d173406b4ee83cbd52cdb16bd6050cbb674b2 | e12d4d634a71e82e00d1ab4a769c3785bb518cbe | refs/heads/master | 2020-05-21T04:45:53.127910 | 2018-10-25T06:05:41 | 2018-10-25T06:05:41 | 49,195,263 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 440 | java | package com.matthewyao.designpattern.template;
/**
* Created by yaokuan on 2018/6/6.
*/
public class Teacher extends AbstractPerson {
@Override
public void getUp() {
System.out.println("洗漱、换衣服");
}
@Override
public void eatBreakfast() {
System.out.println("吃了:面包+鸡蛋");
}
@Override
public void goToWork() {
System.out.println("开车去学校");
}
}
| [
"[email protected]"
] | |
d493a9a060b2f682f40538f6d0adf39bc4d777dd | d9e37149704735d776684a15c9f2fbe6cf760993 | /ijwb/src/com/google/idea/blaze/ijwb/typescript/TsConfigRuleSection.java | e0f0d5b492bdf9f268a70e505fa2fee6e33cc558 | [
"Apache-2.0"
] | permissive | jacquesqiao/intellij | 4f3da33c5257e9beb54b68281d69730ff14da48c | 015973d885a258d9b3921e5c06572bb4e1b30045 | refs/heads/master | 2021-06-25T18:28:26.343747 | 2017-08-31T14:52:05 | 2017-08-31T14:52:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,531 | java | /*
* Copyright 2016 The Bazel Authors. All rights reserved.
*
* 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.google.idea.blaze.ijwb.typescript;
import com.google.common.collect.Lists;
import com.google.idea.blaze.base.model.primitives.Label;
import com.google.idea.blaze.base.projectview.parser.ParseContext;
import com.google.idea.blaze.base.projectview.parser.ProjectViewParser;
import com.google.idea.blaze.base.projectview.section.ScalarSection;
import com.google.idea.blaze.base.projectview.section.ScalarSectionParser;
import com.google.idea.blaze.base.projectview.section.SectionKey;
import com.google.idea.blaze.base.projectview.section.SectionParser;
import com.google.idea.blaze.base.ui.BlazeValidationError;
import java.util.List;
import javax.annotation.Nullable;
/** Points to the ts_config rule. */
@Deprecated
public class TsConfigRuleSection {
public static final SectionKey<Label, ScalarSection<Label>> KEY = SectionKey.of("ts_config_rule");
public static final SectionParser PARSER = new TsConfigRuleSectionParser();
private static class TsConfigRuleSectionParser extends ScalarSectionParser<Label> {
public TsConfigRuleSectionParser() {
super(KEY, ':');
}
@Nullable
@Override
protected Label parseItem(ProjectViewParser parser, ParseContext parseContext, String rest) {
List<BlazeValidationError> errors = Lists.newArrayList();
if (!Label.validate(rest, errors)) {
parseContext.addErrors(errors);
return null;
}
return Label.create(rest);
}
@Override
protected void printItem(StringBuilder sb, Label value) {
sb.append(value.toString());
}
@Override
public ItemType getItemType() {
return ItemType.Label;
}
@Override
public boolean isDeprecated() {
return true;
}
@Nullable
@Override
public String getDeprecationMessage() {
return "Use `ts_config_rules` instead, which allows specifying multiple `ts_config` targets.";
}
}
}
| [
"[email protected]"
] | |
f8f206ec400e61c36b45cd6bb0a1b9b7fc70b654 | 907d7b42f1277f929bdcfe6e73266b5071f524c5 | /common/src/main/java/com/example/runner/ExampleRunner.java | f1033289886ca8dd5e52c3954c0447c8ae9ad3f1 | [] | no_license | faleev/testing-example-java | 10171fb653645003d6ab6cbf281d66cd30a801be | befb254fd722777c90ae5aef11919d3d35ea285f | refs/heads/master | 2020-04-25T11:50:20.326864 | 2014-10-24T12:42:38 | 2014-10-24T12:42:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 183 | java | package com.example.runner;
public class ExampleRunner {
public static void main(String[] args) {
//TODO: Interaction with the outside world will be added here.
}
}
| [
"[email protected]"
] | |
9c3a1925fe8b9401d8afebf00f998e587368e7c5 | d05cf6ca0ec1c1155de78d5e14b39f7773756eac | /src/main/java/br/edu/ifpb/collegialis/model/Coordenacao.java | e52b93b180f3f66d2ec7d12f98d2fb1f28f6e4c1 | [] | no_license | henriquefeIix/collegialis | 6b531aff89af98485fff9d0c7531944a7572a3a1 | f4663c782ac3c1df8269e70d7ae01d9e2711369a | refs/heads/master | 2022-05-21T05:03:50.539142 | 2022-03-23T12:31:07 | 2022-03-23T12:31:07 | 216,666,666 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,594 | java | package br.edu.ifpb.collegialis.model;
import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
@Entity
public class Coordenacao implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "coordenacao_sequence")
@SequenceGenerator(name = "coordenacao_sequence", sequenceName = "coordenacao_seq_id", initialValue = 3, allocationSize = 1)
private Long id;
@OneToOne
private Curso curso;
private boolean ativo;
@OneToOne
private Professor coordenador;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Curso getCurso() {
return curso;
}
public void setCurso(Curso curso) {
this.curso = curso;
}
public boolean isAtivo() {
return ativo;
}
public void setAtivo(boolean ativo) {
this.ativo = ativo;
}
public Professor getCoordenador() {
return coordenador;
}
public void setCoordenador(Professor coordenador) {
this.coordenador = coordenador;
}
@Override
public int hashCode() {
return Objects.hash(id);
}
@Override
public boolean equals(Object obj) {
Coordenacao other = (Coordenacao) obj;
return this.id == other.id;
}
}
| [
"[email protected]"
] | |
2f685e24f4e4b12e57a288150d6de1d06de0c3a7 | 68f8b810d485022394ef107b0360aa03df2b4a1d | /app/src/main/java/com/example/a50/vocabulary/MyViewPager.java | d5f01d0e5e3be29c6c16af4c2a7ea6cbd417aa34 | [
"MIT"
] | permissive | 50mengzhu/vocabulary | a01cd35ede2360ef42ba012eaada1aa70a0288af | b06b80c9df4936697634f64c9bc07505103c683b | refs/heads/master | 2021-01-20T13:17:49.134255 | 2017-09-03T02:08:09 | 2017-09-03T02:08:09 | 101,742,469 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,289 | java | package com.example.a50.vocabulary;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
/**
* Created by 50萌主 on 2017/9/1.
*/
public class MyViewPager extends ViewPager {
private boolean canScroll;
public MyViewPager(Context context) {
super(context);
canScroll = true;
}
public MyViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
canScroll = true;
}
public void setCanScroll(boolean isScroll){
this.canScroll = isScroll;
}
public boolean isCanScroll() {
return canScroll;
}
/*重写这个方法能够实现对viewPager的滑动进行控制, 如果允许滑动则直接继承父类的方法就好,若不允许滑动则是返回false使事件不在继续向下传递*/
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (isCanScroll()){
return super.onTouchEvent(ev);
}
return false;
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (isCanScroll()){
return super.onInterceptTouchEvent(ev);
}
return false;
}
}
| [
"[email protected]"
] | |
173f5ebdeb0e50112fb4938c976b67b6d18d86aa | 159088adff2e6b6a572b3bb3b144e8f1c5fcc24d | /Day 5/Classroom Program/MathOperation2.java | 369e37687823441c23ad0cba33c554b9a2bc4fb1 | [] | no_license | pratikparab912/Java-Technologies-Core-Java- | 27433b4365e5057c0f64163ada34a966ea5f22e7 | 493f97c20c70883c4bae52a5d9ea3074f36cf256 | refs/heads/master | 2022-12-27T05:16:25.878256 | 2020-10-10T14:38:57 | 2020-10-10T14:38:57 | 296,431,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | class MathOperation1
{
static void sum ( int i , int j )
{
int k = i + j ;
System.out.println ( k ) ;
}
static void sum ( float i , float j )
{
float k = i + j ;
System.out.println ( k ) ;
}
}
class A7
{
static public void main ( String args [] )
{
MathOperation1.sum ( 12 , 13 ) ;
MathOperation1.sum ( 12.2f , 13.3f ) ;
}
} | [
"[email protected]"
] | |
c96d2cdb53fa6155f94ba73ac93dfe8a487fbd55 | 1a4f308ba2778c9af35a60f8f5cbc14109cc6882 | /Commit1/src/commit1/Commit1.java | aa8cc8cdb1808652c8f5da9db7fb6118265dc5cf | [] | no_license | JeffersonAguirre/DeberConTravis | 99c772048376603293188ba6e0b681f4e28c716e | 961869edff1ed871f4f3587cc7e1659460b4291b | refs/heads/master | 2020-12-05T07:10:55.773740 | 2016-09-14T14:12:21 | 2016-09-14T14:12:21 | 67,429,532 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 482 | 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 commit1;
/**
*
* @author Pc
*/
public class Commit1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
System.out.println(" Hola Profe ");
}
}
| [
"Pc@DESKTOP-2VUBUTH"
] | Pc@DESKTOP-2VUBUTH |
c7cc2eca37ff7df9c4bfe22350a659c38a25c522 | 93613d9ab42e023a5b1ecab0918691b93b698607 | /activity/src/main/java/com/yonyou/aco/cloudydisk/test/TableToEntity.java | 218a1c3ca712d8807e7070f4a6a59ac67fd5e324 | [] | no_license | lihuihui123456/OA | 6aafe4b93a09305ee9b169d1f8974a07855f3e79 | f50787dd1d8517989d2ffa16d4c24bdccc477f3c | refs/heads/master | 2022-12-24T08:56:17.793951 | 2019-12-17T06:09:06 | 2019-12-17T06:09:06 | 228,515,435 | 0 | 2 | null | 2022-12-16T00:59:51 | 2019-12-17T02:24:31 | JavaScript | UTF-8 | Java | false | false | 2,646 | java | package com.yonyou.aco.cloudydisk.test;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
public class TableToEntity
{
public static void main(String[] args)
{
String schema = "cap-aco-test";
String tableName = "cloud_authority_ref_user";
try {
createFields(schema, tableName);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void createFields(String schema, String tableName) throws Exception
{
String url = "jdbc:mysql://127.0.0.1:3306/cap-aco-test?useUnicode=true&characterEncoding=utf-8";
String username = "root";
String passwd = "root";
String classDriver = "com.mysql.jdbc.Driver";
Class.forName(classDriver);
Connection connection = DriverManager.getConnection(url, username,
passwd);
Statement statement = connection.createStatement();
String sql = "select column_name,column_comment,column_key,is_nullable,data_type from information_schema.columns where table_schema = '" + schema + "' and table_name='" + tableName + "'";
ResultSet resultSet = statement.executeQuery(sql);
List<java.util.HashMap<String, Object>> list = resultSetToList(resultSet);
for (java.util.HashMap<String, Object> column : list) {
System.out.println("/** " + column.get("COLUMN_COMMENT").toString() +
" */\nprivate String " +
getSName(column.get("COLUMN_NAME").toString()) + ";");
}
}
private static String getSName(String columnName) {
if ((columnName.charAt(columnName.length() - 1)+"").equals("_")) {
return columnName;
}
String name = "";
String[] str = columnName.split("_");
for (int i = 0; i < str.length; i++) {
if (i == 0) {
name = name + str[i].toLowerCase();
} else {
name =
name + str[i].charAt(0) + str[i].substring(1).toLowerCase();
}
}
return name;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
private static List<java.util.HashMap<String, Object>> resultSetToList(ResultSet rs)
throws SQLException
{
List<java.util.HashMap<String, Object>> list = new ArrayList();
ResultSetMetaData md = rs.getMetaData();
int columnCount = md.getColumnCount();
while (rs.next()) {
java.util.HashMap<String, Object> rowData = new java.util.HashMap();
for (int i = 1; i <= columnCount; i++) {
rowData.put(md.getColumnName(i), rs.getObject(i));
}
list.add(rowData);
}
return list;
}
}
| [
"[email protected]"
] | |
e8b94c658cab6c762190c4ff255decd0dfb320e8 | 84d35af6e763527dfc4f2af66db9aace76f12eb1 | /kit/src/androidTest/java/com/jerryjin/kit/ExampleInstrumentedTest.java | 8eb14d617f9301df52cd6af4a9e22ef1286e696d | [
"Apache-2.0"
] | permissive | JerryJin93/AndroidCommonKit | af27866fe00bb6c232733aedd4439e93e1b60e67 | e99df0640b1ca9fa6c1eef4b8995f14cc370d750 | refs/heads/master | 2022-06-05T06:23:02.808669 | 2022-05-12T03:21:00 | 2022-05-12T03:21:00 | 193,690,561 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | package com.jerryjin.kit;
import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.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("com.jerryjin.kit.test", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
ac877d235df0433f97fe87158391405a37d77d74 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_9b910f6ffc295254d91d7a258c9cb0e33c646005/LWCPlugin/2_9b910f6ffc295254d91d7a258c9cb0e33c646005_LWCPlugin_s.java | 17972cebdda2d53926e73435cc77209c48cd5932 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 16,672 | java | package com.griefcraft.lwc;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.logging.Level;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.ContainerBlock;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockListener;
import org.bukkit.event.entity.EntityListener;
import org.bukkit.event.player.PlayerListener;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import com.griefcraft.listeners.LWCBlockListener;
import com.griefcraft.listeners.LWCEntityListener;
import com.griefcraft.listeners.LWCPlayerListener;
import com.griefcraft.logging.Logger;
import com.griefcraft.model.Protection;
import com.griefcraft.modules.admin.AdminCache;
import com.griefcraft.modules.admin.AdminCleanup;
import com.griefcraft.modules.admin.AdminClear;
import com.griefcraft.modules.admin.AdminConfig;
import com.griefcraft.modules.admin.AdminConvert;
import com.griefcraft.modules.admin.AdminFind;
import com.griefcraft.modules.admin.AdminFlush;
import com.griefcraft.modules.admin.AdminForceOwner;
import com.griefcraft.modules.admin.AdminGetLimits;
import com.griefcraft.modules.admin.AdminLimits;
import com.griefcraft.modules.admin.AdminLocale;
import com.griefcraft.modules.admin.AdminPurge;
import com.griefcraft.modules.admin.AdminReload;
import com.griefcraft.modules.admin.AdminRemove;
import com.griefcraft.modules.admin.AdminReport;
import com.griefcraft.modules.admin.AdminUpdate;
import com.griefcraft.modules.admin.AdminVersion;
import com.griefcraft.modules.admin.AdminView;
import com.griefcraft.modules.admin.BaseAdminModule;
import com.griefcraft.modules.create.CreateModule;
import com.griefcraft.modules.destroy.DestroyModule;
import com.griefcraft.modules.flag.FlagModule;
import com.griefcraft.modules.free.FreeModule;
import com.griefcraft.modules.info.InfoModule;
import com.griefcraft.modules.lists.ListsModule;
import com.griefcraft.modules.menu.MenuModule;
import com.griefcraft.modules.modes.DropTransferModule;
import com.griefcraft.modules.modes.PersistModule;
import com.griefcraft.modules.modify.ModifyModule;
import com.griefcraft.modules.owners.OwnersModule;
import com.griefcraft.modules.redstone.RedstoneModule;
import com.griefcraft.modules.unlock.UnlockModule;
import com.griefcraft.modules.worldguard.WorldGuardModule;
import com.griefcraft.scripting.Module;
import com.griefcraft.scripting.Module.Result;
import com.griefcraft.scripting.ModuleLoader;
import com.griefcraft.scripting.ModuleLoader.Event;
import com.griefcraft.sql.Database;
import com.griefcraft.util.Colors;
import com.griefcraft.util.LWCResourceBundle;
import com.griefcraft.util.LocaleClassLoader;
import com.griefcraft.util.StringUtils;
import com.griefcraft.util.UTF8Control;
import com.griefcraft.util.Updater;
public class LWCPlugin extends JavaPlugin {
/**
* The block listener
*/
private BlockListener blockListener;
/**
* The entity listener
*/
private EntityListener entityListener;
/**
* The locale for LWC
*/
private LWCResourceBundle locale;
/**
* The logging object
*/
private Logger logger = Logger.getLogger("LWC");
/**
* The LWC instance
*/
private LWC lwc;
/**
* The player listener
*/
private PlayerListener playerListener;
/**
* LWC updater
*
* TODO: Remove when Bukkit has an updater that is working
*/
private Updater updater;
public LWCPlugin() {
log("Loading shared objects");
updater = new Updater();
lwc = new LWC(this);
playerListener = new LWCPlayerListener(this);
blockListener = new LWCBlockListener(this);
entityListener = new LWCEntityListener(this);
/*
* Set the SQLite native library path
*/
System.setProperty("org.sqlite.lib.path", updater.getOSSpecificFolder());
// we want to force people who used sqlite.purejava before to switch:
System.setProperty("sqlite.purejava", "");
// BUT, some can't use native, so we need to give them the option to use
// pure:
String isPureJava = System.getProperty("lwc.purejava");
if (isPureJava != null && isPureJava.equalsIgnoreCase("true")) {
System.setProperty("sqlite.purejava", "true");
}
log("Native library: " + updater.getFullNativeLibraryPath());
}
/**
* @return the locale
*/
public ResourceBundle getLocale() {
return locale;
}
/**
* @return the LWC instance
*/
public LWC getLWC() {
return lwc;
}
/**
* @return the Updater instance
*/
public Updater getUpdater() {
return updater;
}
/**
* Verify a command name
*
* @param name
* @return
*/
public boolean isValidCommand(String name) {
name = name.toLowerCase();
if (name.equals("lwc")) {
return true;
} else if (name.equals("cpublic")) {
return true;
} else if (name.equals("cpassword")) {
return true;
} else if (name.equals("cprivate")) {
return true;
} else if (name.equals("cinfo")) {
return true;
} else if (name.equals("cmodify")) {
return true;
} else if (name.equals("cunlock")) {
return true;
} else if (name.equals("cremove")) {
return true;
} else if (name.equals("climits")) {
return true;
} else {
return false;
}
}
/**
* Load the database
*/
public void loadDatabase() {
String database = lwc.getConfiguration().getString("database.adapter");
if (database.equals("mysql")) {
Database.DefaultType = Database.Type.MySQL;
} else {
Database.DefaultType = Database.Type.SQLite;
}
}
@Override
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
String commandName = command.getName().toLowerCase();
String argString = StringUtils.join(args, 0);
boolean isPlayer = (sender instanceof Player); // check if they're a player
if (!isValidCommand(commandName)) {
return false;
}
// these can only apply to players, not the console (who has absolute player :P)
if (isPlayer) {
if (lwc.getPermissions() != null && !lwc.getPermissions().permission((Player) sender, "lwc.protect")) {
sender.sendMessage(Colors.Red + "You do not have permission to do that");
return true;
}
/*
* Aliases
*/
if (commandName.equals("cpublic")) {
lwc.getModuleLoader().dispatchEvent(Event.COMMAND, sender, "create", "public".split(" "));
return true;
} else if (commandName.equals("cpassword")) {
lwc.getModuleLoader().dispatchEvent(Event.COMMAND, sender, "create", ("password" + argString).split(" "));
return true;
} else if (commandName.equals("cprivate")) {
lwc.getModuleLoader().dispatchEvent(Event.COMMAND, sender, "create", ("private" + argString).split(" "));
return true;
} else if (commandName.equals("cmodify")) {
lwc.getModuleLoader().dispatchEvent(Event.COMMAND, sender, "modify", argString.split(" "));
return true;
} else if (commandName.equals("cinfo")) {
lwc.getModuleLoader().dispatchEvent(Event.COMMAND, sender, "info", "".split(" "));
return true;
} else if (commandName.equals("cunlock")) {
lwc.getModuleLoader().dispatchEvent(Event.COMMAND, sender, "unlock", argString.split(" "));
return true;
} else if (commandName.equals("cremove")) {
lwc.getModuleLoader().dispatchEvent(Event.COMMAND, sender, "remove", "protection".split(" "));
return true;
} else if (commandName.equals("climits")) {
lwc.getModuleLoader().dispatchEvent(Event.COMMAND, sender, "info", "limits".split(" "));
return true;
}
}
if (args.length == 0) {
lwc.sendFullHelp(sender);
return true;
}
///// Dispatch command to modules
if(lwc.getModuleLoader().dispatchEvent(Event.COMMAND, sender, args[0].toLowerCase(), args.length > 1 ? StringUtils.join(args, 1).split(" ") : new String[0]) == Result.CANCEL) {
sender.sendMessage("(MODULE)");
return true;
}
if (!isPlayer) {
sender.sendMessage(Colors.Red + "That LWC command is not supported through the console :-)");
return true;
}
return false;
}
@Override
public void onDisable() {
if (lwc != null) {
LWC.ENABLED = false;
lwc.destruct();
}
}
@Override
public void onEnable() {
String localization = lwc.getConfiguration().getString("core.locale");
try {
ResourceBundle defaultBundle = null;
ResourceBundle optionalBundle = null;
// load the default locale first
defaultBundle = ResourceBundle.getBundle("lang.lwc", new Locale("en"), new UTF8Control());
// and now check if a bundled locale the same as the server's locale exists
try {
optionalBundle = ResourceBundle.getBundle("lang.lwc", new Locale(localization), new UTF8Control());
} catch (MissingResourceException e) {
}
// ensure both bundles arent the same
if(defaultBundle == optionalBundle) {
optionalBundle = null;
}
locale = new LWCResourceBundle(defaultBundle);
if(optionalBundle != null) {
locale.addExtensionBundle(optionalBundle);
}
} catch (MissingResourceException e) {
log("We are missing the default locale in LWC.jar.. What happened to it? :-(");
log("###########################");
log("## SHUTTING DOWN LWC !!! ##");
log("###########################");
getServer().getPluginManager().disablePlugin(this);
return;
}
// located in plugins/LWC/locale/, values in that overrides the ones in the default :-)
ResourceBundle optionalBundle = null;
try {
optionalBundle = ResourceBundle.getBundle("lwc", new Locale(localization), new LocaleClassLoader(), new UTF8Control());
} catch (MissingResourceException e) {
}
if (optionalBundle != null) {
locale.addExtensionBundle(optionalBundle);
log("Loaded override bundle: " + optionalBundle.getLocale().toString());
}
int overrides = optionalBundle != null ? optionalBundle.keySet().size() : 0;
log("Loaded " + locale.keySet().size() + " locale strings (" + overrides + " overrides)");
loadDatabase();
registerEvents();
updater.loadVersions(false);
lwc.load();
registerCoreModules();
LWC.ENABLED = true;
log("At version: " + LWCInfo.FULL_VERSION);
Runnable runnable = new Runnable() {
public void run() {
for(World world : getServer().getWorlds()) {
String worldName = world.getName();
List<Entity> entities = world.getEntities();
Iterator<Entity> iterator = entities.iterator();
while(iterator.hasNext()) {
Entity entity = iterator.next();
if(!(entity instanceof Item)) {
continue;
}
Item item = (Item) entity;
ItemStack itemStack = item.getItemStack();
Location location = item.getLocation();
int x = location.getBlockX();
int y = location.getBlockY();
int z = location.getBlockZ();
List<Protection> protections = lwc.getPhysicalDatabase().loadProtections(worldName, x, y, z, 3);
Block block = null;
Protection protection = null;
for(Protection temp : protections) {
protection = temp;
block = world.getBlockAt(protection.getX(), protection.getY(), protection.getZ());
if(!(block.getState() instanceof ContainerBlock)) {
continue;
}
if(!protection.hasFlag(Protection.Flag.MAGNET)) {
continue;
}
// Remove the items and suck them up :3
Map<Integer, ItemStack> remaining = lwc.depositItems(block, itemStack);
if(remaining.size() == 1) {
ItemStack other = remaining.values().iterator().next();
if(itemStack.getTypeId() == other.getTypeId() && itemStack.getAmount() == other.getAmount() && itemStack.getData() == other.getData() && itemStack.getDurability() == other.getDurability()) {
break;
}
}
// remove the item on the ground
item.remove();
// if we have a remainder, we need to drop them
if(remaining.size() > 0) {
for(ItemStack stack : remaining.values()) {
world.dropItemNaturally(location, stack);
}
}
break;
}
}
}
}
};
getServer().getScheduler().scheduleSyncRepeatingTask(this, runnable, 50, 50);
}
/**
* Register the core modules for LWC
*/
private void registerCoreModules() {
// core
registerModule(new CreateModule());
registerModule(new ModifyModule());
registerModule(new DestroyModule());
registerModule(new FreeModule());
registerModule(new InfoModule());
registerModule(new MenuModule());
registerModule(new UnlockModule());
registerModule(new OwnersModule());
// admin commands
registerModule(new BaseAdminModule());
registerModule(new AdminCache());
registerModule(new AdminCleanup());
registerModule(new AdminClear());
registerModule(new AdminConfig());
registerModule(new AdminConvert());
registerModule(new AdminFind());
registerModule(new AdminFlush());
registerModule(new AdminForceOwner());
registerModule(new AdminGetLimits());
registerModule(new AdminLimits());
registerModule(new AdminLocale());
registerModule(new AdminPurge());
registerModule(new AdminReload());
registerModule(new AdminRemove());
registerModule(new AdminReport());
registerModule(new AdminUpdate());
registerModule(new AdminVersion());
registerModule(new AdminView());
// flags
registerModule(new FlagModule());
registerModule(new RedstoneModule());
// modes
registerModule(new PersistModule());
registerModule(new DropTransferModule());
// non-core modules but are included with LWC anyway
registerModule(new ListsModule());
registerModule(new WorldGuardModule());
}
/**
* Register a module
*
* @param module
*/
private void registerModule(Module module) {
lwc.getModuleLoader().registerModule(this, module);
}
/**
* Log a string to the console
*
* @param str
*/
private void log(String str) {
logger.log(str);
}
/**
* Register a hook with default priority
*
* TODO: Change priority back to NORMAL when real permissions are in
*
* @param hook
* the hook to register
*/
private void registerEvent(Listener listener, Type eventType) {
registerEvent(listener, eventType, Priority.Highest);
}
/**
* Register a hook
*
* @param hook
* the hook to register
* @priority the priority to use
*/
private void registerEvent(Listener listener, Type eventType, Priority priority) {
logger.log("-> " + eventType.toString(), Level.CONFIG);
getServer().getPluginManager().registerEvent(eventType, listener, priority, this);
}
/**
* Register all of the events used by LWC
*
* TODO: Change priority back to NORMAL when real permissions are in
*/
private void registerEvents() {
/* Player events */
registerEvent(playerListener, Type.PLAYER_QUIT, Priority.Monitor);
registerEvent(playerListener, Type.PLAYER_DROP_ITEM);
registerEvent(playerListener, Type.PLAYER_INTERACT);
/* Entity events */
registerEvent(entityListener, Type.ENTITY_EXPLODE);
/* Block events */
registerEvent(blockListener, Type.BLOCK_DAMAGE);
registerEvent(blockListener, Type.BLOCK_BREAK);
registerEvent(blockListener, Type.BLOCK_PLACE);
registerEvent(blockListener, Type.REDSTONE_CHANGE);
registerEvent(blockListener, Type.SIGN_CHANGE);
}
}
| [
"[email protected]"
] | |
2a65c590a25fdeff4d484b3aecb066870ada5a37 | ef38d70d9b0c20da068d967e089046e626b60dea | /hibernate-orm/HibBugResults/49/Satd-Fix-Diff.java | 14bf25df44a3df6b4761f8973a41e7927241e521 | [] | no_license | martapanc/SATD-replication-package | 0ea0e8a27582750d39f8742b3b9b2e81bb7ec25d | e3235d25235b3b46416239ee9764bfeccd2d7433 | refs/heads/master | 2021-07-18T14:28:24.543613 | 2020-07-10T09:04:40 | 2020-07-10T09:04:40 | 94,113,844 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 42,909 | java | diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java
index 8196261aaa..0d9ed53e2d 100644
--- a/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java
+++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java
@@ -1,1105 +1,823 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.persister.entity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy;
import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
import org.hibernate.engine.spi.Mapping;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.internal.DynamicFilterAliasGenerator;
import org.hibernate.internal.FilterAliasGenerator;
import org.hibernate.internal.util.MarkerObject;
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Formula;
import org.hibernate.mapping.Join;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Selectable;
import org.hibernate.mapping.Subclass;
import org.hibernate.mapping.Table;
import org.hibernate.mapping.Value;
-import org.hibernate.metamodel.binding.AttributeBinding;
-import org.hibernate.metamodel.binding.CustomSQL;
-import org.hibernate.metamodel.binding.EntityBinding;
-import org.hibernate.metamodel.binding.SimpleValueBinding;
-import org.hibernate.metamodel.binding.SingularAttributeBinding;
-import org.hibernate.metamodel.relational.DerivedValue;
-import org.hibernate.metamodel.relational.SimpleValue;
-import org.hibernate.metamodel.relational.TableSpecification;
import org.hibernate.sql.InFragment;
import org.hibernate.sql.Insert;
import org.hibernate.sql.SelectFragment;
import org.hibernate.type.AssociationType;
import org.hibernate.type.DiscriminatorType;
import org.hibernate.type.Type;
/**
* The default implementation of the <tt>EntityPersister</tt> interface.
* Implements the "table-per-class-hierarchy" or "roll-up" mapping strategy
* for an entity class and its inheritence hierarchy. This is implemented
* as a single table holding all classes in the hierarchy with a discrimator
* column used to determine which concrete class is referenced.
*
* @author Gavin King
*/
public class SingleTableEntityPersister extends AbstractEntityPersister {
// the class hierarchy structure
private final int joinSpan;
private final String[] qualifiedTableNames;
private final boolean[] isInverseTable;
private final boolean[] isNullableTable;
private final String[][] keyColumnNames;
private final boolean[] cascadeDeleteEnabled;
private final boolean hasSequentialSelects;
private final String[] spaces;
private final String[] subclassClosure;
private final String[] subclassTableNameClosure;
private final boolean[] subclassTableIsLazyClosure;
private final boolean[] isInverseSubclassTable;
private final boolean[] isNullableSubclassTable;
private final boolean[] subclassTableSequentialSelect;
private final String[][] subclassTableKeyColumnClosure;
private final boolean[] isClassOrSuperclassTable;
// properties of this class, including inherited properties
private final int[] propertyTableNumbers;
// the closure of all columns used by the entire hierarchy including
// subclasses and superclasses of this class
private final int[] subclassPropertyTableNumberClosure;
private final int[] subclassColumnTableNumberClosure;
private final int[] subclassFormulaTableNumberClosure;
// discriminator column
private final Map subclassesByDiscriminatorValue = new HashMap();
private final boolean forceDiscriminator;
private final String discriminatorColumnName;
private final String discriminatorColumnReaders;
private final String discriminatorColumnReaderTemplate;
private final String discriminatorFormula;
private final String discriminatorFormulaTemplate;
private final String discriminatorAlias;
private final Type discriminatorType;
private final Object discriminatorValue;
private final String discriminatorSQLValue;
private final boolean discriminatorInsertable;
private final String[] constraintOrderedTableNames;
private final String[][] constraintOrderedKeyColumnNames;
//private final Map propertyTableNumbersByName = new HashMap();
private final Map propertyTableNumbersByNameAndSubclass = new HashMap();
private final Map sequentialSelectStringsByEntityName = new HashMap();
private static final Object NULL_DISCRIMINATOR = new MarkerObject("<null discriminator>");
private static final Object NOT_NULL_DISCRIMINATOR = new MarkerObject("<not null discriminator>");
private static final String NULL_STRING = "null";
private static final String NOT_NULL_STRING = "not null";
//INITIALIZATION:
public SingleTableEntityPersister(
final PersistentClass persistentClass,
final EntityRegionAccessStrategy cacheAccessStrategy,
final NaturalIdRegionAccessStrategy naturalIdRegionAccessStrategy,
final SessionFactoryImplementor factory,
final Mapping mapping) throws HibernateException {
super( persistentClass, cacheAccessStrategy, naturalIdRegionAccessStrategy, factory );
// CLASS + TABLE
joinSpan = persistentClass.getJoinClosureSpan()+1;
qualifiedTableNames = new String[joinSpan];
isInverseTable = new boolean[joinSpan];
isNullableTable = new boolean[joinSpan];
keyColumnNames = new String[joinSpan][];
final Table table = persistentClass.getRootTable();
qualifiedTableNames[0] = table.getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
);
isInverseTable[0] = false;
isNullableTable[0] = false;
keyColumnNames[0] = getIdentifierColumnNames();
cascadeDeleteEnabled = new boolean[joinSpan];
// Custom sql
customSQLInsert = new String[joinSpan];
customSQLUpdate = new String[joinSpan];
customSQLDelete = new String[joinSpan];
insertCallable = new boolean[joinSpan];
updateCallable = new boolean[joinSpan];
deleteCallable = new boolean[joinSpan];
insertResultCheckStyles = new ExecuteUpdateResultCheckStyle[joinSpan];
updateResultCheckStyles = new ExecuteUpdateResultCheckStyle[joinSpan];
deleteResultCheckStyles = new ExecuteUpdateResultCheckStyle[joinSpan];
customSQLInsert[0] = persistentClass.getCustomSQLInsert();
insertCallable[0] = customSQLInsert[0] != null && persistentClass.isCustomInsertCallable();
insertResultCheckStyles[0] = persistentClass.getCustomSQLInsertCheckStyle() == null
? ExecuteUpdateResultCheckStyle.determineDefault( customSQLInsert[0], insertCallable[0] )
: persistentClass.getCustomSQLInsertCheckStyle();
customSQLUpdate[0] = persistentClass.getCustomSQLUpdate();
updateCallable[0] = customSQLUpdate[0] != null && persistentClass.isCustomUpdateCallable();
updateResultCheckStyles[0] = persistentClass.getCustomSQLUpdateCheckStyle() == null
? ExecuteUpdateResultCheckStyle.determineDefault( customSQLUpdate[0], updateCallable[0] )
: persistentClass.getCustomSQLUpdateCheckStyle();
customSQLDelete[0] = persistentClass.getCustomSQLDelete();
deleteCallable[0] = customSQLDelete[0] != null && persistentClass.isCustomDeleteCallable();
deleteResultCheckStyles[0] = persistentClass.getCustomSQLDeleteCheckStyle() == null
? ExecuteUpdateResultCheckStyle.determineDefault( customSQLDelete[0], deleteCallable[0] )
: persistentClass.getCustomSQLDeleteCheckStyle();
// JOINS
Iterator joinIter = persistentClass.getJoinClosureIterator();
int j = 1;
while ( joinIter.hasNext() ) {
Join join = (Join) joinIter.next();
qualifiedTableNames[j] = join.getTable().getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
);
isInverseTable[j] = join.isInverse();
isNullableTable[j] = join.isOptional();
cascadeDeleteEnabled[j] = join.getKey().isCascadeDeleteEnabled() &&
factory.getDialect().supportsCascadeDelete();
customSQLInsert[j] = join.getCustomSQLInsert();
insertCallable[j] = customSQLInsert[j] != null && join.isCustomInsertCallable();
insertResultCheckStyles[j] = join.getCustomSQLInsertCheckStyle() == null
? ExecuteUpdateResultCheckStyle.determineDefault( customSQLInsert[j], insertCallable[j] )
: join.getCustomSQLInsertCheckStyle();
customSQLUpdate[j] = join.getCustomSQLUpdate();
updateCallable[j] = customSQLUpdate[j] != null && join.isCustomUpdateCallable();
updateResultCheckStyles[j] = join.getCustomSQLUpdateCheckStyle() == null
? ExecuteUpdateResultCheckStyle.determineDefault( customSQLUpdate[j], updateCallable[j] )
: join.getCustomSQLUpdateCheckStyle();
customSQLDelete[j] = join.getCustomSQLDelete();
deleteCallable[j] = customSQLDelete[j] != null && join.isCustomDeleteCallable();
deleteResultCheckStyles[j] = join.getCustomSQLDeleteCheckStyle() == null
? ExecuteUpdateResultCheckStyle.determineDefault( customSQLDelete[j], deleteCallable[j] )
: join.getCustomSQLDeleteCheckStyle();
Iterator iter = join.getKey().getColumnIterator();
keyColumnNames[j] = new String[ join.getKey().getColumnSpan() ];
int i = 0;
while ( iter.hasNext() ) {
Column col = (Column) iter.next();
keyColumnNames[j][i++] = col.getQuotedName( factory.getDialect() );
}
j++;
}
constraintOrderedTableNames = new String[qualifiedTableNames.length];
constraintOrderedKeyColumnNames = new String[qualifiedTableNames.length][];
for ( int i = qualifiedTableNames.length - 1, position = 0; i >= 0; i--, position++ ) {
constraintOrderedTableNames[position] = qualifiedTableNames[i];
constraintOrderedKeyColumnNames[position] = keyColumnNames[i];
}
spaces = ArrayHelper.join(
qualifiedTableNames,
ArrayHelper.toStringArray( persistentClass.getSynchronizedTables() )
);
final boolean lazyAvailable = isInstrumented();
boolean hasDeferred = false;
ArrayList subclassTables = new ArrayList();
ArrayList joinKeyColumns = new ArrayList();
ArrayList<Boolean> isConcretes = new ArrayList<Boolean>();
ArrayList<Boolean> isDeferreds = new ArrayList<Boolean>();
ArrayList<Boolean> isInverses = new ArrayList<Boolean>();
ArrayList<Boolean> isNullables = new ArrayList<Boolean>();
ArrayList<Boolean> isLazies = new ArrayList<Boolean>();
subclassTables.add( qualifiedTableNames[0] );
joinKeyColumns.add( getIdentifierColumnNames() );
isConcretes.add(Boolean.TRUE);
isDeferreds.add(Boolean.FALSE);
isInverses.add(Boolean.FALSE);
isNullables.add(Boolean.FALSE);
isLazies.add(Boolean.FALSE);
joinIter = persistentClass.getSubclassJoinClosureIterator();
while ( joinIter.hasNext() ) {
Join join = (Join) joinIter.next();
isConcretes.add( persistentClass.isClassOrSuperclassJoin(join) );
isDeferreds.add( join.isSequentialSelect() );
isInverses.add( join.isInverse() );
isNullables.add( join.isOptional() );
isLazies.add( lazyAvailable && join.isLazy() );
if ( join.isSequentialSelect() && !persistentClass.isClassOrSuperclassJoin(join) ) hasDeferred = true;
subclassTables.add( join.getTable().getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
) );
Iterator iter = join.getKey().getColumnIterator();
String[] keyCols = new String[ join.getKey().getColumnSpan() ];
int i = 0;
while ( iter.hasNext() ) {
Column col = (Column) iter.next();
keyCols[i++] = col.getQuotedName( factory.getDialect() );
}
joinKeyColumns.add(keyCols);
}
subclassTableSequentialSelect = ArrayHelper.toBooleanArray(isDeferreds);
subclassTableNameClosure = ArrayHelper.toStringArray(subclassTables);
subclassTableIsLazyClosure = ArrayHelper.toBooleanArray(isLazies);
subclassTableKeyColumnClosure = ArrayHelper.to2DStringArray( joinKeyColumns );
isClassOrSuperclassTable = ArrayHelper.toBooleanArray(isConcretes);
isInverseSubclassTable = ArrayHelper.toBooleanArray(isInverses);
isNullableSubclassTable = ArrayHelper.toBooleanArray(isNullables);
hasSequentialSelects = hasDeferred;
// DISCRIMINATOR
if ( persistentClass.isPolymorphic() ) {
Value discrimValue = persistentClass.getDiscriminator();
if (discrimValue==null) {
throw new MappingException("discriminator mapping required for single table polymorphic persistence");
}
forceDiscriminator = persistentClass.isForceDiscriminator();
Selectable selectable = (Selectable) discrimValue.getColumnIterator().next();
if ( discrimValue.hasFormula() ) {
Formula formula = (Formula) selectable;
discriminatorFormula = formula.getFormula();
discriminatorFormulaTemplate = formula.getTemplate( factory.getDialect(), factory.getSqlFunctionRegistry() );
discriminatorColumnName = null;
discriminatorColumnReaders = null;
discriminatorColumnReaderTemplate = null;
discriminatorAlias = "clazz_";
}
else {
Column column = (Column) selectable;
discriminatorColumnName = column.getQuotedName( factory.getDialect() );
discriminatorColumnReaders = column.getReadExpr( factory.getDialect() );
discriminatorColumnReaderTemplate = column.getTemplate( factory.getDialect(), factory.getSqlFunctionRegistry() );
discriminatorAlias = column.getAlias( factory.getDialect(), persistentClass.getRootTable() );
discriminatorFormula = null;
discriminatorFormulaTemplate = null;
}
discriminatorType = persistentClass.getDiscriminator().getType();
if ( persistentClass.isDiscriminatorValueNull() ) {
discriminatorValue = NULL_DISCRIMINATOR;
discriminatorSQLValue = InFragment.NULL;
discriminatorInsertable = false;
}
else if ( persistentClass.isDiscriminatorValueNotNull() ) {
discriminatorValue = NOT_NULL_DISCRIMINATOR;
discriminatorSQLValue = InFragment.NOT_NULL;
discriminatorInsertable = false;
}
else {
discriminatorInsertable = persistentClass.isDiscriminatorInsertable() && !discrimValue.hasFormula();
try {
DiscriminatorType dtype = (DiscriminatorType) discriminatorType;
discriminatorValue = dtype.stringToObject( persistentClass.getDiscriminatorValue() );
discriminatorSQLValue = dtype.objectToSQLString( discriminatorValue, factory.getDialect() );
}
catch (ClassCastException cce) {
throw new MappingException("Illegal discriminator type: " + discriminatorType.getName() );
}
catch (Exception e) {
throw new MappingException("Could not format discriminator value to SQL string", e);
}
}
}
else {
forceDiscriminator = false;
discriminatorInsertable = false;
discriminatorColumnName = null;
discriminatorColumnReaders = null;
discriminatorColumnReaderTemplate = null;
discriminatorAlias = null;
discriminatorType = null;
discriminatorValue = null;
discriminatorSQLValue = null;
discriminatorFormula = null;
discriminatorFormulaTemplate = null;
}
// PROPERTIES
propertyTableNumbers = new int[ getPropertySpan() ];
Iterator iter = persistentClass.getPropertyClosureIterator();
int i=0;
while( iter.hasNext() ) {
Property prop = (Property) iter.next();
propertyTableNumbers[i++] = persistentClass.getJoinNumber(prop);
}
//TODO: code duplication with JoinedSubclassEntityPersister
ArrayList columnJoinNumbers = new ArrayList();
ArrayList formulaJoinedNumbers = new ArrayList();
ArrayList propertyJoinNumbers = new ArrayList();
iter = persistentClass.getSubclassPropertyClosureIterator();
while ( iter.hasNext() ) {
Property prop = (Property) iter.next();
Integer join = persistentClass.getJoinNumber(prop);
propertyJoinNumbers.add(join);
//propertyTableNumbersByName.put( prop.getName(), join );
propertyTableNumbersByNameAndSubclass.put(
prop.getPersistentClass().getEntityName() + '.' + prop.getName(),
join
);
Iterator citer = prop.getColumnIterator();
while ( citer.hasNext() ) {
Selectable thing = (Selectable) citer.next();
if ( thing.isFormula() ) {
formulaJoinedNumbers.add(join);
}
else {
columnJoinNumbers.add(join);
}
}
}
subclassColumnTableNumberClosure = ArrayHelper.toIntArray(columnJoinNumbers);
subclassFormulaTableNumberClosure = ArrayHelper.toIntArray(formulaJoinedNumbers);
subclassPropertyTableNumberClosure = ArrayHelper.toIntArray(propertyJoinNumbers);
int subclassSpan = persistentClass.getSubclassSpan() + 1;
subclassClosure = new String[subclassSpan];
subclassClosure[0] = getEntityName();
if ( persistentClass.isPolymorphic() ) {
addSubclassByDiscriminatorValue( discriminatorValue, getEntityName() );
}
// SUBCLASSES
if ( persistentClass.isPolymorphic() ) {
iter = persistentClass.getSubclassIterator();
int k=1;
while ( iter.hasNext() ) {
Subclass sc = (Subclass) iter.next();
subclassClosure[k++] = sc.getEntityName();
if ( sc.isDiscriminatorValueNull() ) {
addSubclassByDiscriminatorValue( NULL_DISCRIMINATOR, sc.getEntityName() );
}
else if ( sc.isDiscriminatorValueNotNull() ) {
addSubclassByDiscriminatorValue( NOT_NULL_DISCRIMINATOR, sc.getEntityName() );
}
else {
try {
DiscriminatorType dtype = (DiscriminatorType) discriminatorType;
addSubclassByDiscriminatorValue(
dtype.stringToObject( sc.getDiscriminatorValue() ),
sc.getEntityName()
);
}
catch (ClassCastException cce) {
throw new MappingException("Illegal discriminator type: " + discriminatorType.getName() );
}
catch (Exception e) {
throw new MappingException("Error parsing discriminator value", e);
}
}
}
}
initLockers();
initSubclassPropertyAliasesMap(persistentClass);
postConstruct(mapping);
}
private void addSubclassByDiscriminatorValue(Object discriminatorValue, String entityName) {
String mappedEntityName = (String) subclassesByDiscriminatorValue.put( discriminatorValue, entityName );
if ( mappedEntityName != null ) {
throw new MappingException(
"Entities [" + entityName + "] and [" + mappedEntityName
+ "] are mapped with the same discriminator value '" + discriminatorValue + "'."
);
}
}
- public SingleTableEntityPersister(
- final EntityBinding entityBinding,
- final EntityRegionAccessStrategy cacheAccessStrategy,
- final NaturalIdRegionAccessStrategy naturalIdRegionAccessStrategy,
- final SessionFactoryImplementor factory,
- final Mapping mapping) throws HibernateException {
-
- super( entityBinding, cacheAccessStrategy, naturalIdRegionAccessStrategy, factory );
-
- // CLASS + TABLE
-
- // TODO: fix when joins are working (HHH-6391)
- //joinSpan = entityBinding.getJoinClosureSpan() + 1;
- joinSpan = 1;
- qualifiedTableNames = new String[joinSpan];
- isInverseTable = new boolean[joinSpan];
- isNullableTable = new boolean[joinSpan];
- keyColumnNames = new String[joinSpan][];
-
- final TableSpecification table = entityBinding.getPrimaryTable();
- qualifiedTableNames[0] = table.getQualifiedName( factory.getDialect() );
- isInverseTable[0] = false;
- isNullableTable[0] = false;
- keyColumnNames[0] = getIdentifierColumnNames();
- cascadeDeleteEnabled = new boolean[joinSpan];
-
- // Custom sql
- customSQLInsert = new String[joinSpan];
- customSQLUpdate = new String[joinSpan];
- customSQLDelete = new String[joinSpan];
- insertCallable = new boolean[joinSpan];
- updateCallable = new boolean[joinSpan];
- deleteCallable = new boolean[joinSpan];
- insertResultCheckStyles = new ExecuteUpdateResultCheckStyle[joinSpan];
- updateResultCheckStyles = new ExecuteUpdateResultCheckStyle[joinSpan];
- deleteResultCheckStyles = new ExecuteUpdateResultCheckStyle[joinSpan];
-
- initializeCustomSql( entityBinding.getCustomInsert(), 0, customSQLInsert, insertCallable, insertResultCheckStyles );
- initializeCustomSql( entityBinding.getCustomUpdate(), 0, customSQLUpdate, updateCallable, updateResultCheckStyles );
- initializeCustomSql( entityBinding.getCustomDelete(), 0, customSQLDelete, deleteCallable, deleteResultCheckStyles );
-
- // JOINS
-
- // TODO: add join stuff when HHH-6391 is working
-
- constraintOrderedTableNames = new String[qualifiedTableNames.length];
- constraintOrderedKeyColumnNames = new String[qualifiedTableNames.length][];
- for ( int i = qualifiedTableNames.length - 1, position = 0; i >= 0; i--, position++ ) {
- constraintOrderedTableNames[position] = qualifiedTableNames[i];
- constraintOrderedKeyColumnNames[position] = keyColumnNames[i];
- }
-
- spaces = ArrayHelper.join(
- qualifiedTableNames,
- ArrayHelper.toStringArray( entityBinding.getSynchronizedTableNames() )
- );
-
- final boolean lazyAvailable = isInstrumented();
-
- boolean hasDeferred = false;
- ArrayList subclassTables = new ArrayList();
- ArrayList joinKeyColumns = new ArrayList();
- ArrayList<Boolean> isConcretes = new ArrayList<Boolean>();
- ArrayList<Boolean> isDeferreds = new ArrayList<Boolean>();
- ArrayList<Boolean> isInverses = new ArrayList<Boolean>();
- ArrayList<Boolean> isNullables = new ArrayList<Boolean>();
- ArrayList<Boolean> isLazies = new ArrayList<Boolean>();
- subclassTables.add( qualifiedTableNames[0] );
- joinKeyColumns.add( getIdentifierColumnNames() );
- isConcretes.add(Boolean.TRUE);
- isDeferreds.add(Boolean.FALSE);
- isInverses.add(Boolean.FALSE);
- isNullables.add(Boolean.FALSE);
- isLazies.add(Boolean.FALSE);
-
- // TODO: add join stuff when HHH-6391 is working
-
-
- subclassTableSequentialSelect = ArrayHelper.toBooleanArray(isDeferreds);
- subclassTableNameClosure = ArrayHelper.toStringArray(subclassTables);
- subclassTableIsLazyClosure = ArrayHelper.toBooleanArray(isLazies);
- subclassTableKeyColumnClosure = ArrayHelper.to2DStringArray( joinKeyColumns );
- isClassOrSuperclassTable = ArrayHelper.toBooleanArray(isConcretes);
- isInverseSubclassTable = ArrayHelper.toBooleanArray(isInverses);
- isNullableSubclassTable = ArrayHelper.toBooleanArray(isNullables);
- hasSequentialSelects = hasDeferred;
-
- // DISCRIMINATOR
-
- if ( entityBinding.isPolymorphic() ) {
- SimpleValue discriminatorRelationalValue = entityBinding.getHierarchyDetails().getEntityDiscriminator().getBoundValue();
- if ( discriminatorRelationalValue == null ) {
- throw new MappingException("discriminator mapping required for single table polymorphic persistence");
- }
- forceDiscriminator = entityBinding.getHierarchyDetails().getEntityDiscriminator().isForced();
- if ( DerivedValue.class.isInstance( discriminatorRelationalValue ) ) {
- DerivedValue formula = ( DerivedValue ) discriminatorRelationalValue;
- discriminatorFormula = formula.getExpression();
- discriminatorFormulaTemplate = getTemplateFromString( formula.getExpression(), factory );
- discriminatorColumnName = null;
- discriminatorColumnReaders = null;
- discriminatorColumnReaderTemplate = null;
- discriminatorAlias = "clazz_";
- }
- else {
- org.hibernate.metamodel.relational.Column column = ( org.hibernate.metamodel.relational.Column ) discriminatorRelationalValue;
- discriminatorColumnName = column.getColumnName().encloseInQuotesIfQuoted( factory.getDialect() );
- discriminatorColumnReaders =
- column.getReadFragment() == null ?
- column.getColumnName().encloseInQuotesIfQuoted( factory.getDialect() ) :
- column.getReadFragment();
- discriminatorColumnReaderTemplate = getTemplateFromColumn( column, factory );
- discriminatorAlias = column.getAlias( factory.getDialect() );
- discriminatorFormula = null;
- discriminatorFormulaTemplate = null;
- }
-
- discriminatorType = entityBinding.getHierarchyDetails()
- .getEntityDiscriminator()
- .getExplicitHibernateTypeDescriptor()
- .getResolvedTypeMapping();
- if ( entityBinding.getDiscriminatorMatchValue() == null ) {
- discriminatorValue = NULL_DISCRIMINATOR;
- discriminatorSQLValue = InFragment.NULL;
- discriminatorInsertable = false;
- }
- else if ( entityBinding.getDiscriminatorMatchValue().equals( NULL_STRING ) ) {
- discriminatorValue = NOT_NULL_DISCRIMINATOR;
- discriminatorSQLValue = InFragment.NOT_NULL;
- discriminatorInsertable = false;
- }
- else if ( entityBinding.getDiscriminatorMatchValue().equals( NOT_NULL_STRING ) ) {
- discriminatorValue = NOT_NULL_DISCRIMINATOR;
- discriminatorSQLValue = InFragment.NOT_NULL;
- discriminatorInsertable = false;
- }
- else {
- discriminatorInsertable = entityBinding.getHierarchyDetails().getEntityDiscriminator().isInserted()
- && ! DerivedValue.class.isInstance( discriminatorRelationalValue );
- try {
- DiscriminatorType dtype = ( DiscriminatorType ) discriminatorType;
- discriminatorValue = dtype.stringToObject( entityBinding.getDiscriminatorMatchValue() );
- discriminatorSQLValue = dtype.objectToSQLString( discriminatorValue, factory.getDialect() );
- }
- catch (ClassCastException cce) {
- throw new MappingException("Illegal discriminator type: " + discriminatorType.getName() );
- }
- catch (Exception e) {
- throw new MappingException("Could not format discriminator value to SQL string", e);
- }
- }
- }
- else {
- forceDiscriminator = false;
- discriminatorInsertable = false;
- discriminatorColumnName = null;
- discriminatorColumnReaders = null;
- discriminatorColumnReaderTemplate = null;
- discriminatorAlias = null;
- discriminatorType = null;
- discriminatorValue = null;
- discriminatorSQLValue = null;
- discriminatorFormula = null;
- discriminatorFormulaTemplate = null;
- }
-
- // PROPERTIES
-
- propertyTableNumbers = new int[ getPropertySpan() ];
- int i=0;
- for( AttributeBinding attributeBinding : entityBinding.getAttributeBindingClosure() ) {
- // TODO: fix when joins are working (HHH-6391)
- //propertyTableNumbers[i++] = entityBinding.getJoinNumber( attributeBinding);
- if ( attributeBinding == entityBinding.getHierarchyDetails().getEntityIdentifier().getValueBinding() ) {
- continue; // skip identifier binding
- }
- if ( ! attributeBinding.getAttribute().isSingular() ) {
- continue;
- }
- propertyTableNumbers[ i++ ] = 0;
- }
-
- //TODO: code duplication with JoinedSubclassEntityPersister
-
- ArrayList columnJoinNumbers = new ArrayList();
- ArrayList formulaJoinedNumbers = new ArrayList();
- ArrayList propertyJoinNumbers = new ArrayList();
-
- for ( AttributeBinding attributeBinding : entityBinding.getSubEntityAttributeBindingClosure() ) {
- if ( ! attributeBinding.getAttribute().isSingular() ) {
- continue;
- }
- SingularAttributeBinding singularAttributeBinding = (SingularAttributeBinding) attributeBinding;
-
- // TODO: fix when joins are working (HHH-6391)
- //int join = entityBinding.getJoinNumber(singularAttributeBinding);
- int join = 0;
- propertyJoinNumbers.add(join);
-
- //propertyTableNumbersByName.put( singularAttributeBinding.getName(), join );
- propertyTableNumbersByNameAndSubclass.put(
- singularAttributeBinding.getContainer().getPathBase() + '.' + singularAttributeBinding.getAttribute().getName(),
- join
- );
-
- for ( SimpleValueBinding simpleValueBinding : singularAttributeBinding.getSimpleValueBindings() ) {
- if ( DerivedValue.class.isInstance( simpleValueBinding.getSimpleValue() ) ) {
- formulaJoinedNumbers.add( join );
- }
- else {
- columnJoinNumbers.add( join );
- }
- }
- }
- subclassColumnTableNumberClosure = ArrayHelper.toIntArray(columnJoinNumbers);
- subclassFormulaTableNumberClosure = ArrayHelper.toIntArray(formulaJoinedNumbers);
- subclassPropertyTableNumberClosure = ArrayHelper.toIntArray(propertyJoinNumbers);
-
- int subclassSpan = entityBinding.getSubEntityBindingClosureSpan() + 1;
- subclassClosure = new String[subclassSpan];
- subclassClosure[0] = getEntityName();
- if ( entityBinding.isPolymorphic() ) {
- addSubclassByDiscriminatorValue( discriminatorValue, getEntityName() );
- }
-
- // SUBCLASSES
- if ( entityBinding.isPolymorphic() ) {
- int k=1;
- for ( EntityBinding subEntityBinding : entityBinding.getPostOrderSubEntityBindingClosure() ) {
- subclassClosure[k++] = subEntityBinding.getEntity().getName();
- if ( subEntityBinding.isDiscriminatorMatchValueNull() ) {
- addSubclassByDiscriminatorValue( NULL_DISCRIMINATOR, subEntityBinding.getEntity().getName() );
- }
- else if ( subEntityBinding.isDiscriminatorMatchValueNotNull() ) {
- addSubclassByDiscriminatorValue( NOT_NULL_DISCRIMINATOR, subEntityBinding.getEntity().getName() );
- }
- else {
- try {
- DiscriminatorType dtype = (DiscriminatorType) discriminatorType;
- addSubclassByDiscriminatorValue(
- dtype.stringToObject( subEntityBinding.getDiscriminatorMatchValue() ),
- subEntityBinding.getEntity().getName()
- );
- }
- catch (ClassCastException cce) {
- throw new MappingException("Illegal discriminator type: " + discriminatorType.getName() );
- }
- catch (Exception e) {
- throw new MappingException("Error parsing discriminator value", e);
- }
- }
- }
- }
-
- initLockers();
-
- initSubclassPropertyAliasesMap( entityBinding );
-
- postConstruct( mapping );
- }
-
- private static void initializeCustomSql(
- CustomSQL customSql,
- int i,
- String[] sqlStrings,
- boolean[] callable,
- ExecuteUpdateResultCheckStyle[] checkStyles) {
- sqlStrings[i] = customSql != null ? customSql.getSql(): null;
- callable[i] = sqlStrings[i] != null && customSql.isCallable();
- checkStyles[i] = customSql != null && customSql.getCheckStyle() != null ?
- customSql.getCheckStyle() :
- ExecuteUpdateResultCheckStyle.determineDefault( sqlStrings[i], callable[i] );
- }
-
protected boolean isInverseTable(int j) {
return isInverseTable[j];
}
protected boolean isInverseSubclassTable(int j) {
return isInverseSubclassTable[j];
}
public String getDiscriminatorColumnName() {
return discriminatorColumnName;
}
public String getDiscriminatorColumnReaders() {
return discriminatorColumnReaders;
}
public String getDiscriminatorColumnReaderTemplate() {
return discriminatorColumnReaderTemplate;
}
protected String getDiscriminatorAlias() {
return discriminatorAlias;
}
protected String getDiscriminatorFormulaTemplate() {
return discriminatorFormulaTemplate;
}
public String getTableName() {
return qualifiedTableNames[0];
}
public Type getDiscriminatorType() {
return discriminatorType;
}
public Object getDiscriminatorValue() {
return discriminatorValue;
}
public String getDiscriminatorSQLValue() {
return discriminatorSQLValue;
}
public String[] getSubclassClosure() {
return subclassClosure;
}
public String getSubclassForDiscriminatorValue(Object value) {
if (value==null) {
return (String) subclassesByDiscriminatorValue.get(NULL_DISCRIMINATOR);
}
else {
String result = (String) subclassesByDiscriminatorValue.get(value);
if (result==null) result = (String) subclassesByDiscriminatorValue.get(NOT_NULL_DISCRIMINATOR);
return result;
}
}
public Serializable[] getPropertySpaces() {
return spaces;
}
//Access cached SQL
protected boolean isDiscriminatorFormula() {
return discriminatorColumnName==null;
}
protected String getDiscriminatorFormula() {
return discriminatorFormula;
}
protected String getTableName(int j) {
return qualifiedTableNames[j];
}
protected String[] getKeyColumns(int j) {
return keyColumnNames[j];
}
protected boolean isTableCascadeDeleteEnabled(int j) {
return cascadeDeleteEnabled[j];
}
protected boolean isPropertyOfTable(int property, int j) {
return propertyTableNumbers[property]==j;
}
protected boolean isSubclassTableSequentialSelect(int j) {
return subclassTableSequentialSelect[j] && !isClassOrSuperclassTable[j];
}
// Execute the SQL:
public String fromTableFragment(String name) {
return getTableName() + ' ' + name;
}
@Override
public String filterFragment(String alias) throws MappingException {
String result = discriminatorFilterFragment(alias);
if ( hasWhere() ) result += " and " + getSQLWhereString(alias);
return result;
}
private String discriminatorFilterFragment(String alias) throws MappingException {
return discriminatorFilterFragment( alias, null );
}
public String oneToManyFilterFragment(String alias) throws MappingException {
return forceDiscriminator
? discriminatorFilterFragment( alias, null )
: "";
}
@Override
public String oneToManyFilterFragment(String alias, Set<String> treatAsDeclarations) {
return needsDiscriminator()
? discriminatorFilterFragment( alias, treatAsDeclarations )
: "";
}
@Override
public String filterFragment(String alias, Set<String> treatAsDeclarations) {
String result = discriminatorFilterFragment( alias, treatAsDeclarations );
if ( hasWhere() ) {
result += " and " + getSQLWhereString( alias );
}
return result;
}
private String discriminatorFilterFragment(String alias, Set<String> treatAsDeclarations) {
final boolean hasTreatAs = treatAsDeclarations != null && !treatAsDeclarations.isEmpty();
if ( !needsDiscriminator() && !hasTreatAs) {
return "";
}
final InFragment frag = new InFragment();
if ( isDiscriminatorFormula() ) {
frag.setFormula( alias, getDiscriminatorFormulaTemplate() );
}
else {
frag.setColumn( alias, getDiscriminatorColumnName() );
}
if ( hasTreatAs ) {
frag.addValues( decodeTreatAsRequests( treatAsDeclarations ) );
}
else {
frag.addValues( fullDiscriminatorValues() );
}
return " and " + frag.toFragmentString();
}
private boolean needsDiscriminator() {
return forceDiscriminator || isInherited();
}
private String[] decodeTreatAsRequests(Set<String> treatAsDeclarations) {
final List<String> values = new ArrayList<String>();
for ( String subclass : treatAsDeclarations ) {
final Queryable queryable = (Queryable) getFactory().getEntityPersister( subclass );
if ( !queryable.isAbstract() ) {
values.add( queryable.getDiscriminatorSQLValue() );
}
}
return values.toArray( new String[ values.size() ] );
}
private String[] fullDiscriminatorValues;
private String[] fullDiscriminatorValues() {
if ( fullDiscriminatorValues == null ) {
// first access; build it
final List<String> values = new ArrayList<String>();
for ( String subclass : getSubclassClosure() ) {
final Queryable queryable = (Queryable) getFactory().getEntityPersister( subclass );
if ( !queryable.isAbstract() ) {
values.add( queryable.getDiscriminatorSQLValue() );
}
}
fullDiscriminatorValues = values.toArray( new String[values.size() ] );
}
return fullDiscriminatorValues;
}
public String getSubclassPropertyTableName(int i) {
return subclassTableNameClosure[ subclassPropertyTableNumberClosure[i] ];
}
protected void addDiscriminatorToSelect(SelectFragment select, String name, String suffix) {
if ( isDiscriminatorFormula() ) {
select.addFormula( name, getDiscriminatorFormulaTemplate(), getDiscriminatorAlias() );
}
else {
select.addColumn( name, getDiscriminatorColumnName(), getDiscriminatorAlias() );
}
}
protected int[] getPropertyTableNumbersInSelect() {
return propertyTableNumbers;
}
protected int getSubclassPropertyTableNumber(int i) {
return subclassPropertyTableNumberClosure[i];
}
public int getTableSpan() {
return joinSpan;
}
protected void addDiscriminatorToInsert(Insert insert) {
if (discriminatorInsertable) {
insert.addColumn( getDiscriminatorColumnName(), discriminatorSQLValue );
}
}
protected int[] getSubclassColumnTableNumberClosure() {
return subclassColumnTableNumberClosure;
}
protected int[] getSubclassFormulaTableNumberClosure() {
return subclassFormulaTableNumberClosure;
}
protected int[] getPropertyTableNumbers() {
return propertyTableNumbers;
}
protected boolean isSubclassPropertyDeferred(String propertyName, String entityName) {
return hasSequentialSelects &&
isSubclassTableSequentialSelect( getSubclassPropertyTableNumber(propertyName, entityName) );
}
public boolean hasSequentialSelect() {
return hasSequentialSelects;
}
private int getSubclassPropertyTableNumber(String propertyName, String entityName) {
Type type = propertyMapping.toType(propertyName);
if ( type.isAssociationType() && ( (AssociationType) type ).useLHSPrimaryKey() ) return 0;
final Integer tabnum = (Integer) propertyTableNumbersByNameAndSubclass.get(entityName + '.' + propertyName);
return tabnum==null ? 0 : tabnum;
}
protected String getSequentialSelect(String entityName) {
return (String) sequentialSelectStringsByEntityName.get(entityName);
}
private String generateSequentialSelect(Loadable persister) {
//if ( this==persister || !hasSequentialSelects ) return null;
//note that this method could easily be moved up to BasicEntityPersister,
//if we ever needed to reuse it from other subclasses
//figure out which tables need to be fetched
AbstractEntityPersister subclassPersister = (AbstractEntityPersister) persister;
HashSet tableNumbers = new HashSet();
String[] props = subclassPersister.getPropertyNames();
String[] classes = subclassPersister.getPropertySubclassNames();
for ( int i=0; i<props.length; i++ ) {
int propTableNumber = getSubclassPropertyTableNumber( props[i], classes[i] );
if ( isSubclassTableSequentialSelect(propTableNumber) && !isSubclassTableLazy(propTableNumber) ) {
tableNumbers.add( propTableNumber);
}
}
if ( tableNumbers.isEmpty() ) return null;
//figure out which columns are needed
ArrayList columnNumbers = new ArrayList();
final int[] columnTableNumbers = getSubclassColumnTableNumberClosure();
for ( int i=0; i<getSubclassColumnClosure().length; i++ ) {
if ( tableNumbers.contains( columnTableNumbers[i] ) ) {
columnNumbers.add( i );
}
}
//figure out which formulas are needed
ArrayList formulaNumbers = new ArrayList();
final int[] formulaTableNumbers = getSubclassColumnTableNumberClosure();
for ( int i=0; i<getSubclassFormulaTemplateClosure().length; i++ ) {
if ( tableNumbers.contains( formulaTableNumbers[i] ) ) {
formulaNumbers.add( i );
}
}
//render the SQL
return renderSelect(
ArrayHelper.toIntArray(tableNumbers),
ArrayHelper.toIntArray(columnNumbers),
ArrayHelper.toIntArray(formulaNumbers)
);
}
protected String[] getSubclassTableKeyColumns(int j) {
return subclassTableKeyColumnClosure[j];
}
public String getSubclassTableName(int j) {
return subclassTableNameClosure[j];
}
public int getSubclassTableSpan() {
return subclassTableNameClosure.length;
}
protected boolean isClassOrSuperclassTable(int j) {
return isClassOrSuperclassTable[j];
}
protected boolean isSubclassTableLazy(int j) {
return subclassTableIsLazyClosure[j];
}
protected boolean isNullableTable(int j) {
return isNullableTable[j];
}
protected boolean isNullableSubclassTable(int j) {
return isNullableSubclassTable[j];
}
public String getPropertyTableName(String propertyName) {
Integer index = getEntityMetamodel().getPropertyIndexOrNull(propertyName);
if (index==null) return null;
return qualifiedTableNames[ propertyTableNumbers[index] ];
}
protected void doPostInstantiate() {
if (hasSequentialSelects) {
String[] entityNames = getSubclassClosure();
for ( int i=1; i<entityNames.length; i++ ) {
Loadable loadable = (Loadable) getFactory().getEntityPersister( entityNames[i] );
if ( !loadable.isAbstract() ) { //perhaps not really necessary...
String sequentialSelect = generateSequentialSelect(loadable);
sequentialSelectStringsByEntityName.put( entityNames[i], sequentialSelect );
}
}
}
}
public boolean isMultiTable() {
return getTableSpan() > 1;
}
public String[] getConstraintOrderedTableNameClosure() {
return constraintOrderedTableNames;
}
public String[][] getContraintOrderedTableKeyColumnClosure() {
return constraintOrderedKeyColumnNames;
}
@Override
public FilterAliasGenerator getFilterAliasGenerator(String rootAlias) {
return new DynamicFilterAliasGenerator(qualifiedTableNames, rootAlias);
}
}
| [
"[email protected]"
] | |
6e8cd68ae31474b88038391088efb414c7180fa3 | 0cdf65294e75e14674a0031a0ce1d64b971fd1c4 | /src/com/zte/ums/an/uni/dsl/conf/cdf/dispatch/CollectPoints.java | b1cd7c38ff599d5841a683e00e270333aaa4f9a4 | [] | no_license | nodder/cdf | 519653d12b32ef71740ff7391dfb1745fee2cb9e | e62d4e7230d6938bbf8acb676158a09af801a197 | refs/heads/master | 2021-07-25T07:46:34.145033 | 2017-11-05T04:00:52 | 2017-11-05T04:00:52 | 109,546,733 | 1 | 1 | null | null | null | null | GB18030 | Java | false | false | 1,637 | java | package com.zte.ums.an.uni.dsl.conf.cdf.dispatch;
import java.util.ArrayList;
import java.util.Vector;
import com.zte.ums.api.common.snmpnode.ppu.entity.SnmpNode;
/**
* <p>文件名称: CollectPoints.java</p>
* <p>文件描述: </p>
* <p>版权所有: 版权所有(C)2007-2010</p>
* <p>公 司: 中兴通讯股份有限公司</p>
* <p>内容摘要: </p>
* <p>其他说明: </p>
* <p>完成日期:2011年9月1日</p>
* <p>修改记录1:</p>
* <pre>
* 修改日期:
* 版 本 号:
* 修 改 人:
* 修改内容:
* </pre>
* <p>修改记录2:</p>
* @version 1.0
* @author lixiaochun
*/
public class CollectPoints
{
/** 待采集网元容器 */
private static Vector snmpNodeList = new Vector();
public synchronized static void AddNes(ArrayList<SnmpNode> nes)
{
snmpNodeList.addAll(nes);
}
/** 获取前N个待采集网元列表 */
public synchronized static Vector getNes(int stepLength)
{
Vector ret = new Vector();
int len = snmpNodeList.size() > stepLength ? stepLength : snmpNodeList.size();
for(int i = 0; i < len; i++)
{
ret.add(snmpNodeList.get(i));
}
for(int i = 0; i < len; i++)
{
snmpNodeList.remove(0);
}
return ret;
}
public synchronized static boolean isEmpty()
{
return snmpNodeList.isEmpty();
}
/** 获取待采集网元个数 */
public synchronized static int getUnprocessedNeCount()
{
return snmpNodeList.size();
}
}
| [
"[email protected]"
] | |
ef2ad276e42e4e6aa2e6c2161eefd120592729e6 | f2ff306022ff235b50b3b990ca57a976c1b81ac7 | /JungchanLee-HW9/src/HearthstoneCard.java | 3792e779fdb78db8ec097b52f7020e5df46b1c4a | [] | no_license | Chanthebigbro/Chan-HW9 | a936552cf1839517a4eba923f0d92b44560380cc | 08edcebc7bd87a7ed73e29980485670f347d85fc | refs/heads/main | 2023-03-12T19:12:14.956652 | 2021-03-01T17:22:20 | 2021-03-01T17:22:20 | 343,498,376 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 775 | java |
public class HearthstoneCard
{
private int cost;
private int attack;
private int defense;
private String name;
public HearthstoneCard(String name, int cost, int attack, int defense)
{
this.cost = cost;
this.attack = attack;
this.defense = defense;
this.name = name;
}
public int getCost()
{
return this.cost;
}
//setters allow us to conditionally change the value of a private member
public void setName(String name)
{
if(name.length() >= 5)
{
this.name = name;
}
}
void display()
{
//System.out.println("Name: " + this.name + "\nCost" + this.cost + "\nAttack: " + this.attack + " Defense: " + this.defense);
System.out.format("Name: %s Cost: %d Attack: %d Defense: %d\n", this.name, this.cost, this.attack,this.defense);
}
} | [
"[email protected]"
] | |
6a87b17c837028c87e4894f66ecc1a70bba8cb69 | 9c059f377181921723fb68081687c649b4e51a6c | /msg-exchange-repository/src/main/java/zw/co/dobadoba/msgexchange/repository/config/DevelopmentDataSourceConfig.java | 9c488d7819f1d4ef0e71449fd12959bc37fe1e12 | [] | no_license | DeeObah/msg-exchange-service | c13e6a2dab89c81652e8c75914a9924d9fb5a458 | e03ddd59b007c80e94a3cbf50e0efd5cd7f63954 | refs/heads/master | 2020-12-02T11:13:52.861175 | 2017-09-27T13:20:22 | 2017-09-27T13:20:22 | 96,618,557 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,079 | java | package zw.co.dobadoba.msgexchange.repository.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import javax.sql.DataSource;
/**
* Created by dobadoba on 7/8/17.
*/
@Configuration
@PropertySource("classpath:jdbc.development.properties")
public class DevelopmentDataSourceConfig {
@Bean
public DataSource dataSource(Environment environment) {
final DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(environment.getProperty("jdbc.driverClassName"));
dataSource.setUrl(environment.getProperty("jdbc.url"));
dataSource.setPassword(environment.getProperty("jdbc.password"));
dataSource.setUsername(environment.getProperty("jdbc.username"));
return dataSource;
}
}
| [
"[email protected]"
] | |
1b91b28cad41339e1c8ec23bb2ddd3cea857f093 | 0e5d2b504cf3b47bb96a44b7ede1ab895fbab2f1 | /src/EmployeeListTest.java | 90091a29c8dfc25585d64e8265e31acf63022b72 | [] | no_license | Kwoconut/SEP-project | 647cbb4c80cee9409347faa18916bd84d596f679 | ddc82a1475e017866b3f9da0d41ca43c80d7e936 | refs/heads/master | 2020-04-10T04:41:31.911077 | 2018-12-10T10:55:39 | 2018-12-10T10:55:39 | 160,806,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 715 | java | import model.Employee;
import model.EmployeeList;
import model.Name;
public class EmployeeListTest
{
public static void main(String[] args)
{
Name name = new Name("Valeriu","Marandici");
Name name2 = new Name("Valeriu","Romanciuc");
Employee employee = new Employee(name,"VM");
Employee employee2 = new Employee(name2,"VMS");
EmployeeList empList = new EmployeeList();
empList.addEmployee(employee2);
empList.addEmployee(employee);
empList.getEmployee(employee).train("Fat");
empList.getEmployee(employee).train("Cereale");
empList.getEmployee(employee).train("Glucoze");
empList.setStatusTraining(0);
System.out.println(empList);
}
}
| [
"[email protected]"
] | |
1b48b5795c7a3e9df4fedac36e20884920b23cf4 | bc7a50e08f43bc7dd155e7b91feef364328ebde9 | /spring-d06-BeanDI/src/frame/study/ui/Client.java | a677177ccfd3e220d588c5aca5302353d32e5181 | [] | no_license | beipiaocanglang/25_spring_code | 7eaff3106780256d122c3ffd7657da098cfaafbc | e5f0e367f6923b70280f20739e400055716cf081 | refs/heads/master | 2021-08-29T17:44:33.802194 | 2017-12-14T14:10:29 | 2017-12-14T14:10:29 | 114,258,053 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 866 | java | package frame.study.ui;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import frame.study.bean.UserBean;
import frame.study.bean.UserBean1;
import frame.study.bean.UserBean2;
import frame.study.bean.UserBean3;
import frame.study.bean.UserBean4;
public class Client {
public static void main(String[] args) {
ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
/*UserBean bean = (UserBean)ac.getBean("userbean");
bean.saveUser();*/
/*UserBean1 bean1 = (UserBean1)ac.getBean("userbean1");
bean1.saveUser();*/
/*UserBean2 bean2 = (UserBean2)ac.getBean("userbean2");
bean2.saveUser();*/
/*UserBean3 bean3 = (UserBean3)ac.getBean("userbean3");
bean3.saveUser();*/
UserBean4 bean4 = (UserBean4)ac.getBean("myArray");
bean4.saveUser();
}
}
| [
"yUhU13552247687"
] | yUhU13552247687 |
66e8ecf6b04cc69e27f67f0276dd4355814aff53 | 7626a5056238e9ba385611ee655ac3b2eec37b8e | /modules/Core/src/main/java/org/terasology/core/world/generator/e/procedural/noise/experimental/VarianceNoise.java | cb9aa635bb0224802e2a61c202d5e64d4352c4bf | [
"CC-BY-4.0",
"Apache-2.0"
] | permissive | esapetri/Terasology | 00bd8a088ed1724971491c5620f6dc0928b5d15b | 2ad4b0708677f8df82b7a7d22fcb0891bfa39762 | refs/heads/master | 2021-01-17T06:59:33.422988 | 2018-12-28T18:31:17 | 2018-12-28T18:31:17 | 26,880,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,094 | java | /*
* Copyright 2013 MovingBlocks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.terasology.core.world.generator.e.procedural.noise.experimental;
import org.terasology.core.emath.BitScrampler;
import org.terasology.core.emath.Statistics;
import org.terasology.math.TeraMath;
import org.terasology.utilities.procedural.Noise2D;
import org.terasology.utilities.procedural.Noise3D;
import org.terasology.utilities.random.FastRandom;
/**
* Deterministic white noise generator
* @author Esereja
*/
public class VarianceNoise implements Noise2D, Noise3D {
final private int RANDOMS_LENGHT=3465;
private int[] randoms;
private int[] offset;
/**
* Initialize permutations with a given seed
*
* @param seed a seed value used for permutation shuffling
*/
public VarianceNoise(long seed) {
FastRandom rand=new FastRandom(seed);
randoms=new int[RANDOMS_LENGHT];
for(int i=0;i<randoms.length;i++){
randoms[i]=rand.nextInt();
}
offset= new int[4];
for(int i=0;i<offset.length;i++){
offset[i]=rand.nextInt();
}
}
/**
* 2D semi white noise
*
* @param xin the x input coordinate
* @param yin the y input coordinate
* @return a noise value in the interval [-1,1]
*/
@Override
public float noise(float xin, float yin) {
int x=TeraMath.floorToInt(xin)+offset[0];
int y=TeraMath.floorToInt(yin)+offset[1];
double xw = xin - TeraMath.fastFloor(xin);
double yw = yin - TeraMath.fastFloor(yin);
double xn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x))^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1),2)
,4)),
xw);
double yn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y))^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1),2)
,4)),
yw);
double[] array=new double[2];
array[0]=xn;
array[1]=yn;
double mean = Statistics.aritmeticMean(array);
double variance = Statistics.variance(array, mean);
double r=0;
if(!(Statistics.sign(xn)^Statistics.sign(yn))){
r+=variance;
}else{
r-=variance;
}
r*=5;
return (float) (Math.sin(
(r)*3.141*2
));
}
/**
* 3D semi white noise
*
* @param xin the x input coordinate
* @param yin the y input coordinate
* @param zin the z input coordinate
* @return a noise value in the interval [-1,1]
*/
@Override
public float noise(float xin, float yin, float zin) {
int x=TeraMath.floorToInt(xin)+offset[0];
int y=TeraMath.floorToInt(yin)+offset[1];
int z=TeraMath.floorToInt(zin)+offset[2];
double xw = xin - TeraMath.fastFloor(xin);
double yw = yin - TeraMath.fastFloor(yin);
double zw = zin - TeraMath.fastFloor(zin);
double xn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x))^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y),2)^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z)%(randoms.length-1) )
]^(z),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z+1)%(randoms.length-1) )
]^(z+1),2)
,4)),
xw);
double yn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y))^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z)%(randoms.length-1) )
]^(z),2)^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z+1)%(randoms.length-1) )
]^(z+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1),2)
,4)),
yw);
double zn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z)%(randoms.length-1) )
]^(z))^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x),2)^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z+1)%(randoms.length-1) )
]^(z+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1),2)
,4)),
zw);
double[] array=new double[3];
array[0]=xn;
array[1]=yn;
array[2]=zn;
double mean = Statistics.aritmeticMean(array);
double variance = Statistics.variance(array, mean);
double r=0;
if(!(Statistics.sign(xn)^Statistics.sign(yn)^Statistics.sign(zn))){
r+=variance;
}else{
r-=variance;
}
r*=5;
return (float) (Math.sin(
(r)*3.141*2
));
}
/**
* 4D semi white noise
*
* @param xin the x input coordinate
* @param yin the y input coordinate
* @param zin the z input coordinate
* @return a noise value in the interval [-1,1]
*/
public float noise(float xin, float yin, float zin, float win) {
int x=TeraMath.floorToInt(xin)+offset[0];
int y=TeraMath.floorToInt(yin)+offset[1];
int z=TeraMath.floorToInt(zin)+offset[2];
int w=TeraMath.floorToInt(win)+offset[3];
double xw = xin - TeraMath.fastFloor(xin);
double yw = yin - TeraMath.fastFloor(yin);
double zw = zin - TeraMath.fastFloor(zin);
double ww = zin - TeraMath.fastFloor(win);
double xn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x))^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y),2)^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z)%(randoms.length-1) )
]^(z),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(w)%(randoms.length-1) )
]^(w),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z+1)%(randoms.length-1) )
]^(z+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(w+1)%(randoms.length-1) )
]^(w+1),2)
,4)),
xw);
double yn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y))^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z)%(randoms.length-1) )
]^(z),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(w+1)%(randoms.length-1) )
]^(w),2) ^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z+1)%(randoms.length-1) )
]^(z+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(w+1)%(randoms.length-1) )
]^(w+1),2) ^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1),2)
,4)),
yw);
double zn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z)%(randoms.length-1) )
]^(z))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(w+1)%(randoms.length-1) )
]^(w),2) ^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x),2)^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z+1)%(randoms.length-1) )
]^(z+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z+1)%(randoms.length-1) )
]^(w+1),2) ^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1),2)
,4)),
zw);
double wn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(w)%(randoms.length-1) )
]^(w))^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x),2)^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y),2)^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z)%(randoms.length-1) )
]^(z),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(w+1)%(randoms.length-1) )
]^(w+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z+1)%(randoms.length-1) )
]^(z+1),2)
,4)),
zw);
double[] array=new double[4];
array[0]=xn;
array[1]=yn;
array[2]=zn;
array[3]=wn;
double mean = Statistics.aritmeticMean(array);
double variance = Statistics.variance(array, mean);
double r=0;
if(!(Statistics.sign(xn)^Statistics.sign(yn)^Statistics.sign(zn))){
r+=variance;
}else{
r-=variance;
}
r*=5;
return (float) (Math.sin(
(r)*3.141*2
));
}
}
| [
"[email protected]"
] | |
904b98a3d10fa9ecc26e26c0732d9d06a47da215 | 074c1ac5890ec4fff064e435486de496219aed19 | /java.src/br/com/fatec/model/factory/FabricaConexao.java | a0a7ecb816525dd109834b4948a88cf375ee54d4 | [] | no_license | fatecanos/Crud-Callcenter | 4de396b26d0a4ec62a385435188506d96a857c69 | f20bc2f7c19d4ea2e67b3d265b9249ce5605e3a0 | refs/heads/master | 2020-05-18T08:15:52.158027 | 2019-05-04T22:13:01 | 2019-05-04T22:13:01 | 184,288,814 | 0 | 0 | null | 2019-05-04T22:13:02 | 2019-04-30T15:39:43 | Java | MacCentralEurope | Java | false | false | 1,933 | 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 br.com.fatec.model.factory;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class FabricaConexao {
private static final String DRIVER = "org.mysql.Driver";
private static final String URL = "jdbc:mysql://localhost:5432/callcenter";
private static final String USER = "";
private static final String PASS = "";
public static Connection getConexao(){
try {
Class.forName(DRIVER);
return DriverManager.getConnection(URL, USER, PASS);
} catch (ClassNotFoundException | SQLException e){
throw new RuntimeException("Erro de conex„o", e);
}
}
public static void fecharConexao(Connection conn){
if(conn != null){
try {
conn.close();
} catch (SQLException ex) {
System.err.println("Erro ao fechar conexao"+ex.getMessage());
}
}
}
public static void fecharConexao(Connection conn, PreparedStatement pstm){
if(pstm!=null){
try {
pstm.close();
} catch (SQLException ex) {
System.err.println("Erro ao fechar conexao"+ex.getMessage());
}
}
fecharConexao(conn);
}
public static void fecharConexao(Connection conn, PreparedStatement pstm, ResultSet rs){
if(rs!=null){
try {
rs.close();
} catch (SQLException ex){
System.err.println("Erro ao fechar conexao"+ex.getMessage());
}
}
fecharConexao(conn, pstm);
}
} | [
"[email protected]"
] | |
be0e5d5702c2605bd8ef19b38a530815b2039589 | 4df4bcb6a849cbd6a72449f3fba7bacf33abdfc9 | /pixate-freestyle/src/com/pixate/freestyle/annotations/PXDocElement.java | ec3510d4adb48e767ce4a8a67ee9634effa5f3d5 | [
"LicenseRef-scancode-other-permissive",
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | Pixate/pixate-freestyle-android | 3f89c45572a9d6909dcf6272075243c0f5707407 | d88f888834583d76658914fd62756854f953ad2c | refs/heads/master | 2022-07-05T08:29:16.111654 | 2015-09-08T20:02:18 | 2015-09-08T20:02:18 | 16,931,569 | 114 | 38 | null | 2015-02-02T17:50:59 | 2014-02-18T00:24:28 | Java | UTF-8 | Java | false | false | 1,175 | java | /*******************************************************************************
* Copyright 2012-present Pixate, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.pixate.freestyle.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface PXDocElement {
String comment() default "";
boolean hide() default false;
PXDocProperty[] properties() default {};
}
| [
"[email protected]"
] | |
78fa1c6e9b49e23a4f9c94ff9c65378f2d4c60dd | 929eed8af7bc6be3b203667954a69321c1f4cf66 | /mobile/build/generated/source/r/debug/com/google/android/gms/analytics/R.java | ab1ab30a0c533bed8a5396cc93bc7e62d3df6ad5 | [] | no_license | vicjar/CalculadoraAndroid | 5f6eb4baae6bebd001b314331605a0320d41fb53 | b52cbd2adb089af347a37954df40bdbe5a256fd5 | refs/heads/master | 2016-09-13T00:15:39.685490 | 2016-05-02T05:15:20 | 2016-05-02T05:15:20 | 57,865,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,946 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.google.android.gms.analytics;
public final class R {
public static final class attr {
public static final int adSize = 0x7f010027;
public static final int adSizes = 0x7f010028;
public static final int adUnitId = 0x7f010029;
public static final int ambientEnabled = 0x7f0100e4;
public static final int appTheme = 0x7f01013e;
public static final int buttonSize = 0x7f010106;
public static final int buyButtonAppearance = 0x7f010145;
public static final int buyButtonHeight = 0x7f010142;
public static final int buyButtonText = 0x7f010144;
public static final int buyButtonWidth = 0x7f010143;
public static final int cameraBearing = 0x7f0100d5;
public static final int cameraTargetLat = 0x7f0100d6;
public static final int cameraTargetLng = 0x7f0100d7;
public static final int cameraTilt = 0x7f0100d8;
public static final int cameraZoom = 0x7f0100d9;
public static final int circleCrop = 0x7f0100d3;
public static final int colorScheme = 0x7f010107;
public static final int environment = 0x7f01013f;
public static final int fragmentMode = 0x7f010141;
public static final int fragmentStyle = 0x7f010140;
public static final int imageAspectRatio = 0x7f0100d2;
public static final int imageAspectRatioAdjust = 0x7f0100d1;
public static final int liteMode = 0x7f0100da;
public static final int mapType = 0x7f0100d4;
public static final int maskedWalletDetailsBackground = 0x7f010148;
public static final int maskedWalletDetailsButtonBackground = 0x7f01014a;
public static final int maskedWalletDetailsButtonTextAppearance = 0x7f010149;
public static final int maskedWalletDetailsHeaderTextAppearance = 0x7f010147;
public static final int maskedWalletDetailsLogoImageType = 0x7f01014c;
public static final int maskedWalletDetailsLogoTextColor = 0x7f01014b;
public static final int maskedWalletDetailsTextAppearance = 0x7f010146;
public static final int scopeUris = 0x7f010108;
public static final int uiCompass = 0x7f0100db;
public static final int uiMapToolbar = 0x7f0100e3;
public static final int uiRotateGestures = 0x7f0100dc;
public static final int uiScrollGestures = 0x7f0100dd;
public static final int uiTiltGestures = 0x7f0100de;
public static final int uiZoomControls = 0x7f0100df;
public static final int uiZoomGestures = 0x7f0100e0;
public static final int useViewLifecycle = 0x7f0100e1;
public static final int windowTransitionStyle = 0x7f0100bc;
public static final int zOrderOnTop = 0x7f0100e2;
}
public static final class color {
public static final int common_action_bar_splitter = 0x7f0c0015;
public static final int common_google_signin_btn_text_dark = 0x7f0c0075;
public static final int common_google_signin_btn_text_dark_default = 0x7f0c0016;
public static final int common_google_signin_btn_text_dark_disabled = 0x7f0c0017;
public static final int common_google_signin_btn_text_dark_focused = 0x7f0c0018;
public static final int common_google_signin_btn_text_dark_pressed = 0x7f0c0019;
public static final int common_google_signin_btn_text_light = 0x7f0c0076;
public static final int common_google_signin_btn_text_light_default = 0x7f0c001a;
public static final int common_google_signin_btn_text_light_disabled = 0x7f0c001b;
public static final int common_google_signin_btn_text_light_focused = 0x7f0c001c;
public static final int common_google_signin_btn_text_light_pressed = 0x7f0c001d;
public static final int common_plus_signin_btn_text_dark = 0x7f0c0077;
public static final int common_plus_signin_btn_text_dark_default = 0x7f0c001e;
public static final int common_plus_signin_btn_text_dark_disabled = 0x7f0c001f;
public static final int common_plus_signin_btn_text_dark_focused = 0x7f0c0020;
public static final int common_plus_signin_btn_text_dark_pressed = 0x7f0c0021;
public static final int common_plus_signin_btn_text_light = 0x7f0c0078;
public static final int common_plus_signin_btn_text_light_default = 0x7f0c0022;
public static final int common_plus_signin_btn_text_light_disabled = 0x7f0c0023;
public static final int common_plus_signin_btn_text_light_focused = 0x7f0c0024;
public static final int common_plus_signin_btn_text_light_pressed = 0x7f0c0025;
public static final int place_autocomplete_prediction_primary_text = 0x7f0c0046;
public static final int place_autocomplete_prediction_primary_text_highlight = 0x7f0c0047;
public static final int place_autocomplete_prediction_secondary_text = 0x7f0c0048;
public static final int place_autocomplete_search_hint = 0x7f0c0049;
public static final int place_autocomplete_search_text = 0x7f0c004a;
public static final int place_autocomplete_separator = 0x7f0c004b;
public static final int wallet_bright_foreground_disabled_holo_light = 0x7f0c005e;
public static final int wallet_bright_foreground_holo_dark = 0x7f0c005f;
public static final int wallet_bright_foreground_holo_light = 0x7f0c0060;
public static final int wallet_dim_foreground_disabled_holo_dark = 0x7f0c0061;
public static final int wallet_dim_foreground_holo_dark = 0x7f0c0062;
public static final int wallet_dim_foreground_inverse_disabled_holo_dark = 0x7f0c0063;
public static final int wallet_dim_foreground_inverse_holo_dark = 0x7f0c0064;
public static final int wallet_highlighted_text_holo_dark = 0x7f0c0065;
public static final int wallet_highlighted_text_holo_light = 0x7f0c0066;
public static final int wallet_hint_foreground_holo_dark = 0x7f0c0067;
public static final int wallet_hint_foreground_holo_light = 0x7f0c0068;
public static final int wallet_holo_blue_light = 0x7f0c0069;
public static final int wallet_link_text_light = 0x7f0c006a;
public static final int wallet_primary_text_holo_light = 0x7f0c007b;
public static final int wallet_secondary_text_holo_dark = 0x7f0c007c;
}
public static final class dimen {
public static final int place_autocomplete_button_padding = 0x7f09006f;
public static final int place_autocomplete_powered_by_google_height = 0x7f090070;
public static final int place_autocomplete_powered_by_google_start = 0x7f090071;
public static final int place_autocomplete_prediction_height = 0x7f090072;
public static final int place_autocomplete_prediction_horizontal_margin = 0x7f090073;
public static final int place_autocomplete_prediction_primary_text = 0x7f090074;
public static final int place_autocomplete_prediction_secondary_text = 0x7f090075;
public static final int place_autocomplete_progress_horizontal_margin = 0x7f090076;
public static final int place_autocomplete_progress_size = 0x7f090077;
public static final int place_autocomplete_separator_start = 0x7f090078;
}
public static final class drawable {
public static final int cast_ic_notification_0 = 0x7f02004b;
public static final int cast_ic_notification_1 = 0x7f02004c;
public static final int cast_ic_notification_2 = 0x7f02004d;
public static final int cast_ic_notification_connecting = 0x7f02004e;
public static final int cast_ic_notification_on = 0x7f02004f;
public static final int common_full_open_on_phone = 0x7f020050;
public static final int common_google_signin_btn_icon_dark = 0x7f020051;
public static final int common_google_signin_btn_icon_dark_disabled = 0x7f020052;
public static final int common_google_signin_btn_icon_dark_focused = 0x7f020053;
public static final int common_google_signin_btn_icon_dark_normal = 0x7f020054;
public static final int common_google_signin_btn_icon_dark_pressed = 0x7f020055;
public static final int common_google_signin_btn_icon_light = 0x7f020056;
public static final int common_google_signin_btn_icon_light_disabled = 0x7f020057;
public static final int common_google_signin_btn_icon_light_focused = 0x7f020058;
public static final int common_google_signin_btn_icon_light_normal = 0x7f020059;
public static final int common_google_signin_btn_icon_light_pressed = 0x7f02005a;
public static final int common_google_signin_btn_text_dark = 0x7f02005b;
public static final int common_google_signin_btn_text_dark_disabled = 0x7f02005c;
public static final int common_google_signin_btn_text_dark_focused = 0x7f02005d;
public static final int common_google_signin_btn_text_dark_normal = 0x7f02005e;
public static final int common_google_signin_btn_text_dark_pressed = 0x7f02005f;
public static final int common_google_signin_btn_text_light = 0x7f020060;
public static final int common_google_signin_btn_text_light_disabled = 0x7f020061;
public static final int common_google_signin_btn_text_light_focused = 0x7f020062;
public static final int common_google_signin_btn_text_light_normal = 0x7f020063;
public static final int common_google_signin_btn_text_light_pressed = 0x7f020064;
public static final int common_ic_googleplayservices = 0x7f020065;
public static final int common_plus_signin_btn_icon_dark = 0x7f020066;
public static final int common_plus_signin_btn_icon_dark_disabled = 0x7f020067;
public static final int common_plus_signin_btn_icon_dark_focused = 0x7f020068;
public static final int common_plus_signin_btn_icon_dark_normal = 0x7f020069;
public static final int common_plus_signin_btn_icon_dark_pressed = 0x7f02006a;
public static final int common_plus_signin_btn_icon_light = 0x7f02006b;
public static final int common_plus_signin_btn_icon_light_disabled = 0x7f02006c;
public static final int common_plus_signin_btn_icon_light_focused = 0x7f02006d;
public static final int common_plus_signin_btn_icon_light_normal = 0x7f02006e;
public static final int common_plus_signin_btn_icon_light_pressed = 0x7f02006f;
public static final int common_plus_signin_btn_text_dark = 0x7f020070;
public static final int common_plus_signin_btn_text_dark_disabled = 0x7f020071;
public static final int common_plus_signin_btn_text_dark_focused = 0x7f020072;
public static final int common_plus_signin_btn_text_dark_normal = 0x7f020073;
public static final int common_plus_signin_btn_text_dark_pressed = 0x7f020074;
public static final int common_plus_signin_btn_text_light = 0x7f020075;
public static final int common_plus_signin_btn_text_light_disabled = 0x7f020076;
public static final int common_plus_signin_btn_text_light_focused = 0x7f020077;
public static final int common_plus_signin_btn_text_light_normal = 0x7f020078;
public static final int common_plus_signin_btn_text_light_pressed = 0x7f020079;
public static final int ic_plusone_medium_off_client = 0x7f020090;
public static final int ic_plusone_small_off_client = 0x7f020091;
public static final int ic_plusone_standard_off_client = 0x7f020092;
public static final int ic_plusone_tall_off_client = 0x7f020093;
public static final int places_ic_clear = 0x7f0200a2;
public static final int places_ic_search = 0x7f0200a3;
public static final int powered_by_google_dark = 0x7f0200a4;
public static final int powered_by_google_light = 0x7f0200a5;
}
public static final class id {
public static final int adjust_height = 0x7f0d0035;
public static final int adjust_width = 0x7f0d0036;
public static final int android_pay = 0x7f0d0060;
public static final int android_pay_dark = 0x7f0d0057;
public static final int android_pay_light = 0x7f0d0058;
public static final int android_pay_light_with_border = 0x7f0d0059;
public static final int auto = 0x7f0d0042;
public static final int book_now = 0x7f0d0050;
public static final int buyButton = 0x7f0d004d;
public static final int buy_now = 0x7f0d0051;
public static final int buy_with = 0x7f0d0052;
public static final int buy_with_google = 0x7f0d0053;
public static final int cast_notification_id = 0x7f0d0004;
public static final int classic = 0x7f0d005a;
public static final int dark = 0x7f0d0043;
public static final int donate_with = 0x7f0d0054;
public static final int donate_with_google = 0x7f0d0055;
public static final int google_wallet_classic = 0x7f0d005b;
public static final int google_wallet_grayscale = 0x7f0d005c;
public static final int google_wallet_monochrome = 0x7f0d005d;
public static final int grayscale = 0x7f0d005e;
public static final int holo_dark = 0x7f0d0047;
public static final int holo_light = 0x7f0d0048;
public static final int hybrid = 0x7f0d0037;
public static final int icon_only = 0x7f0d003f;
public static final int light = 0x7f0d0044;
public static final int logo_only = 0x7f0d0056;
public static final int match_parent = 0x7f0d004f;
public static final int monochrome = 0x7f0d005f;
public static final int none = 0x7f0d0011;
public static final int normal = 0x7f0d000d;
public static final int place_autocomplete_clear_button = 0x7f0d00b9;
public static final int place_autocomplete_powered_by_google = 0x7f0d00bb;
public static final int place_autocomplete_prediction_primary_text = 0x7f0d00bd;
public static final int place_autocomplete_prediction_secondary_text = 0x7f0d00be;
public static final int place_autocomplete_progress = 0x7f0d00bc;
public static final int place_autocomplete_search_button = 0x7f0d00b7;
public static final int place_autocomplete_search_input = 0x7f0d00b8;
public static final int place_autocomplete_separator = 0x7f0d00ba;
public static final int production = 0x7f0d0049;
public static final int sandbox = 0x7f0d004a;
public static final int satellite = 0x7f0d0038;
public static final int selectionDetails = 0x7f0d004e;
public static final int slide = 0x7f0d0031;
public static final int standard = 0x7f0d0040;
public static final int strict_sandbox = 0x7f0d004b;
public static final int terrain = 0x7f0d0039;
public static final int test = 0x7f0d004c;
public static final int wide = 0x7f0d0041;
public static final int wrap_content = 0x7f0d001b;
}
public static final class integer {
public static final int google_play_services_version = 0x7f0b0006;
}
public static final class layout {
public static final int place_autocomplete_fragment = 0x7f040032;
public static final int place_autocomplete_item_powered_by_google = 0x7f040033;
public static final int place_autocomplete_item_prediction = 0x7f040034;
public static final int place_autocomplete_progress = 0x7f040035;
}
public static final class raw {
public static final int gtm_analytics = 0x7f060000;
}
public static final class string {
public static final int accept = 0x7f07003f;
public static final int auth_google_play_services_client_facebook_display_name = 0x7f070043;
public static final int auth_google_play_services_client_google_display_name = 0x7f070044;
public static final int cast_notification_connected_message = 0x7f070046;
public static final int cast_notification_connecting_message = 0x7f070047;
public static final int cast_notification_disconnect = 0x7f070048;
public static final int common_google_play_services_api_unavailable_text = 0x7f070013;
public static final int common_google_play_services_enable_button = 0x7f070014;
public static final int common_google_play_services_enable_text = 0x7f070015;
public static final int common_google_play_services_enable_title = 0x7f070016;
public static final int common_google_play_services_install_button = 0x7f070017;
public static final int common_google_play_services_install_text_phone = 0x7f070018;
public static final int common_google_play_services_install_text_tablet = 0x7f070019;
public static final int common_google_play_services_install_title = 0x7f07001a;
public static final int common_google_play_services_invalid_account_text = 0x7f07001b;
public static final int common_google_play_services_invalid_account_title = 0x7f07001c;
public static final int common_google_play_services_network_error_text = 0x7f07001d;
public static final int common_google_play_services_network_error_title = 0x7f07001e;
public static final int common_google_play_services_notification_ticker = 0x7f07001f;
public static final int common_google_play_services_restricted_profile_text = 0x7f070020;
public static final int common_google_play_services_restricted_profile_title = 0x7f070021;
public static final int common_google_play_services_sign_in_failed_text = 0x7f070022;
public static final int common_google_play_services_sign_in_failed_title = 0x7f070023;
public static final int common_google_play_services_unknown_issue = 0x7f070024;
public static final int common_google_play_services_unsupported_text = 0x7f070025;
public static final int common_google_play_services_unsupported_title = 0x7f070026;
public static final int common_google_play_services_update_button = 0x7f070027;
public static final int common_google_play_services_update_text = 0x7f070028;
public static final int common_google_play_services_update_title = 0x7f070029;
public static final int common_google_play_services_updating_text = 0x7f07002a;
public static final int common_google_play_services_updating_title = 0x7f07002b;
public static final int common_google_play_services_wear_update_text = 0x7f07002c;
public static final int common_open_on_phone = 0x7f07002d;
public static final int common_signin_button_text = 0x7f07002e;
public static final int common_signin_button_text_long = 0x7f07002f;
public static final int create_calendar_message = 0x7f07004a;
public static final int create_calendar_title = 0x7f07004b;
public static final int decline = 0x7f07004c;
public static final int place_autocomplete_clear_button = 0x7f07003b;
public static final int place_autocomplete_search_hint = 0x7f07003c;
public static final int store_picture_message = 0x7f07004d;
public static final int store_picture_title = 0x7f07004e;
public static final int wallet_buy_button_place_holder = 0x7f07003e;
}
public static final class style {
public static final int Theme_AppInvite_Preview = 0x7f0a0102;
public static final int Theme_AppInvite_Preview_Base = 0x7f0a001d;
public static final int Theme_IAPTheme = 0x7f0a0109;
public static final int WalletFragmentDefaultButtonTextAppearance = 0x7f0a0111;
public static final int WalletFragmentDefaultDetailsHeaderTextAppearance = 0x7f0a0112;
public static final int WalletFragmentDefaultDetailsTextAppearance = 0x7f0a0113;
public static final int WalletFragmentDefaultStyle = 0x7f0a0114;
}
public static final class styleable {
public static final int[] AdsAttrs = { 0x7f010027, 0x7f010028, 0x7f010029 };
public static final int AdsAttrs_adSize = 0;
public static final int AdsAttrs_adSizes = 1;
public static final int AdsAttrs_adUnitId = 2;
public static final int[] CustomWalletTheme = { 0x7f0100bc };
public static final int CustomWalletTheme_windowTransitionStyle = 0;
public static final int[] LoadingImageView = { 0x7f0100d1, 0x7f0100d2, 0x7f0100d3 };
public static final int LoadingImageView_circleCrop = 2;
public static final int LoadingImageView_imageAspectRatio = 1;
public static final int LoadingImageView_imageAspectRatioAdjust = 0;
public static final int[] MapAttrs = { 0x7f0100d4, 0x7f0100d5, 0x7f0100d6, 0x7f0100d7, 0x7f0100d8, 0x7f0100d9, 0x7f0100da, 0x7f0100db, 0x7f0100dc, 0x7f0100dd, 0x7f0100de, 0x7f0100df, 0x7f0100e0, 0x7f0100e1, 0x7f0100e2, 0x7f0100e3, 0x7f0100e4 };
public static final int MapAttrs_ambientEnabled = 16;
public static final int MapAttrs_cameraBearing = 1;
public static final int MapAttrs_cameraTargetLat = 2;
public static final int MapAttrs_cameraTargetLng = 3;
public static final int MapAttrs_cameraTilt = 4;
public static final int MapAttrs_cameraZoom = 5;
public static final int MapAttrs_liteMode = 6;
public static final int MapAttrs_mapType = 0;
public static final int MapAttrs_uiCompass = 7;
public static final int MapAttrs_uiMapToolbar = 15;
public static final int MapAttrs_uiRotateGestures = 8;
public static final int MapAttrs_uiScrollGestures = 9;
public static final int MapAttrs_uiTiltGestures = 10;
public static final int MapAttrs_uiZoomControls = 11;
public static final int MapAttrs_uiZoomGestures = 12;
public static final int MapAttrs_useViewLifecycle = 13;
public static final int MapAttrs_zOrderOnTop = 14;
public static final int[] SignInButton = { 0x7f010106, 0x7f010107, 0x7f010108 };
public static final int SignInButton_buttonSize = 0;
public static final int SignInButton_colorScheme = 1;
public static final int SignInButton_scopeUris = 2;
public static final int[] WalletFragmentOptions = { 0x7f01013e, 0x7f01013f, 0x7f010140, 0x7f010141 };
public static final int WalletFragmentOptions_appTheme = 0;
public static final int WalletFragmentOptions_environment = 1;
public static final int WalletFragmentOptions_fragmentMode = 3;
public static final int WalletFragmentOptions_fragmentStyle = 2;
public static final int[] WalletFragmentStyle = { 0x7f010142, 0x7f010143, 0x7f010144, 0x7f010145, 0x7f010146, 0x7f010147, 0x7f010148, 0x7f010149, 0x7f01014a, 0x7f01014b, 0x7f01014c };
public static final int WalletFragmentStyle_buyButtonAppearance = 3;
public static final int WalletFragmentStyle_buyButtonHeight = 0;
public static final int WalletFragmentStyle_buyButtonText = 2;
public static final int WalletFragmentStyle_buyButtonWidth = 1;
public static final int WalletFragmentStyle_maskedWalletDetailsBackground = 6;
public static final int WalletFragmentStyle_maskedWalletDetailsButtonBackground = 8;
public static final int WalletFragmentStyle_maskedWalletDetailsButtonTextAppearance = 7;
public static final int WalletFragmentStyle_maskedWalletDetailsHeaderTextAppearance = 5;
public static final int WalletFragmentStyle_maskedWalletDetailsLogoImageType = 10;
public static final int WalletFragmentStyle_maskedWalletDetailsLogoTextColor = 9;
public static final int WalletFragmentStyle_maskedWalletDetailsTextAppearance = 4;
}
}
| [
"[email protected]"
] | |
30f0160e0d9583855a0e9146d2a508e86effa5f2 | 4a604d471f1c0ca063081c707cf08db5407c237a | /Servlet3/src/SessionAttributeObserver.java | cc633fcc44f643e932133722e2aa42d9447a30cc | [] | no_license | saviobm/1Z0-899 | 74a375e63b203fe4a13784d922378413c42663d1 | e011c7472f028e92117cf7ac566ca95c7aced577 | refs/heads/master | 2021-09-05T10:49:10.166201 | 2018-01-26T15:34:51 | 2018-01-26T15:34:51 | 108,963,082 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 785 | java | import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;
@WebListener
public class SessionAttributeObserver implements HttpSessionAttributeListener {
public void attributeAdded(HttpSessionBindingEvent event) {
System.out.println("Objeto adicionado na sessão: " + event.getName() + " value: " + event.getValue());
}
public void attributeRemoved(HttpSessionBindingEvent event) {
System.out.println("Objeto removido da sessão: " + event.getName() + " value: " + event.getValue());
}
public void attributeReplaced(HttpSessionBindingEvent event) {
System.out.println("Objeto substituído na sessão: " + event.getName() + " value: " + event.getValue());
}
} | [
"[email protected]"
] | |
80b06ca8ece85634ef66e6ed7004089f5dcf9063 | 545f9f2023ad3727fb1a1b993239cd12e32ade5b | /src/main/java/com/leecx/controller/TwoInterceptorController.java | dba5a11e30b2cb3b6af304c203c32593a909bf5a | [] | no_license | yinfengjiujian/projectStart | 841661f93e257fda53d4cc73c896d50df6d083e1 | 8df6954e4bb9140ac90b819b018cfce533c08996 | refs/heads/master | 2020-03-10T10:46:37.432509 | 2018-04-19T08:47:05 | 2018-04-19T08:47:05 | 129,340,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,522 | java | package com.leecx.controller;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.leecx.pojo.User;
@Controller
@RequestMapping("/two")
public class TwoInterceptorController {
@RequestMapping("/index")
public String index(ModelMap map) {
map.addAttribute("name", "itzixi22");
return "thymeleaf/index";
}
@RequestMapping("center")
public String center() {
return "thymeleaf/center/center";
}
@RequestMapping("test")
public String test(ModelMap map) {
User user = new User();
user.setAge(18);
user.setName("manager");
user.setPassword("123456");
user.setBirthday(new Date());
map.addAttribute("user", user);
User u1 = new User();
u1.setAge(19);
u1.setName("itzixi");
u1.setPassword("123456");
u1.setBirthday(new Date());
User u2 = new User();
u2.setAge(17);
u2.setName("LeeCX");
u2.setPassword("123456");
u2.setBirthday(new Date());
List<User> userList = new ArrayList<>();
userList.add(user);
userList.add(u1);
userList.add(u2);
map.addAttribute("userList", userList);
return "thymeleaf/test";
}
@PostMapping("postform")
public String postform(User user) {
System.out.println(user.getName());
return "redirect:/th/test";
}
} | [
"[email protected]"
] | |
088636212627d4f50b09b46dece75a8d00c96353 | 9f9126851cd207694db258ccb4b5fdbbd1c9ae10 | /src/main/java/com/tao/player/hello.java | 0add7bf94d987d805b30341a302cf9c83e66d5a4 | [] | no_license | taoertaoer/player | 5c6e9e1eef7c03451e6960954a4772dea76eaa08 | 2d66f77b10219e28c88b16d42daaaee8f3afedca | refs/heads/master | 2022-12-23T10:07:03.197767 | 2020-09-29T16:50:38 | 2020-09-29T16:50:38 | 283,729,104 | 0 | 0 | null | 2020-09-29T16:17:38 | 2020-07-30T09:33:02 | null | UTF-8 | Java | false | false | 1,363 | java | package com.tao.player;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class hello
*/
@WebServlet("/hello")
public class hello extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public hello() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.getWriter().print(88);
}
}
| [
"[email protected]"
] | |
268d0270f54e396092425024a1aca3ca49ea3a6c | eb63cb2bb6e324f4514db508812aeedbcbb32735 | /spring-cloud-service-consumer-feign/src/main/java/zx/sc/springcloudserviceconsumerfeign/HelloErrorServiceImpl.java | e0ae2891a4af0189282e54b6367ba6f0c92ebd60 | [] | no_license | wm-hao/spring-cloud-sample | 551c80637500f427235a5cc4ddb935d3f465028d | 9121eac2b5d915faa9b8d4c072774ce3b22cb3e3 | refs/heads/master | 2020-03-19T21:20:14.679358 | 2018-06-14T14:02:52 | 2018-06-14T14:02:52 | 134,803,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 301 | java | package zx.sc.springcloudserviceconsumerfeign;
import org.springframework.stereotype.Component;
@Component
public class HelloErrorServiceImpl implements IHelloService{
@Override
public String sayHiFromClientOne(String name) throws Exception {
return "hi " + name + " error";
}
}
| [
"[email protected]"
] | |
9fd4acb95a868154b20398959af1fb5e577acd8d | dc7b45b74b7296df23cb96f1e43dd09583b4f7af | /app/src/androidTest/java/com/example/charles/whowroteit/ExampleInstrumentedTest.java | 2ab8b6581c3e5d9e805898dea731b12f90598b20 | [] | no_license | munenek/WhoWroteIt | 5d6e244b5790ba3ba9ed7771c01f8c28219cfb32 | 9f76eae05fb438b54745f5f9f41724da5dc37072 | refs/heads/master | 2020-04-02T17:48:13.706842 | 2018-10-25T13:07:28 | 2018-10-25T13:07:28 | 154,672,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 764 | java | package com.example.charles.whowroteit;
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.charles.whowroteit", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
593d375fbf9b10775c82dabee6400ffabd17b417 | 65699b1b908eb71186f93ba10dfe483b406538e7 | /app/src/main/java/net/kaisoz/droidstorm/PreferencesActivity.java | 8438af4d4de7b717448fed57f9fa8959ba55badb | [] | no_license | kaisoz/DroidStorm | 002a72a7fda29b8522503c7481882b84169b90c4 | 8c7005b372b71abdb40a5d3fa1d8d68cefdbca94 | refs/heads/master | 2020-12-24T12:32:24.154258 | 2016-11-07T09:45:39 | 2016-11-07T09:45:39 | 72,987,620 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,783 | java | package net.kaisoz.droidstorm;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import net.kaisoz.droidstorm.nxt.handler.NXTHandlerBaseActivity;
import net.kaisoz.droidstorm.util.DroidStormApp;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.PreferenceActivity;
import android.widget.Toast;
/**
* Activity that manages the application preferences. Managed preferences are:
* - Application language
* - Motor ports - wheels associated
* - Operation mode: Synchronized or Follower
* - IR Emitter port (in case of follower mode)
*
* @author Tomás Tormo Franco
*/
public class PreferencesActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener {
private HashMap<CharSequence, CharSequence> mSummaries;
private DroidStormApp mApp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setLocale();
addPreferencesFromResource(R.xml.preferences);
mApp = (DroidStormApp) getApplication();
mSummaries = new HashMap<CharSequence, CharSequence>();
mSummaries.put(this.getText(R.string.prf_motorRight_id), this.getText(R.string.prf_motorRight_summary));
mSummaries.put(this.getText(R.string.prf_motorLeft_id), this.getText(R.string.prf_motorLeft_summary));
mSummaries.put(this.getText(R.string.prf_irPort_id), this.getText(R.string.prf_irPort_summary));
mSummaries.put(this.getText(R.string.prf_synchMode_id), this.getText(R.string.prf_synchMode_summary));
mSummaries.put(this.getText(R.string.prf_locale_id), this.getText(R.string.prf_locale_summary));
ListPreference synch = (ListPreference) findPreference(this.getText(R.string.prf_synchMode_id));
EditTextPreference firstStart = (EditTextPreference) findPreference(this.getText(R.string.prf_firstStart_id));
ListPreference irport = (ListPreference) findPreference(this.getText(R.string.prf_irPort_id));
boolean firstStartVal = Boolean.valueOf(firstStart.getText());
int synchVal = Integer.valueOf(synch.getValue()).intValue();
if (firstStartVal) {
Toast.makeText(this, R.string.toast_selectWheels, Toast.LENGTH_LONG).show();
ListPreference locale = (ListPreference) findPreference(this.getText(R.string.prf_locale_id));
locale.setValue(mApp.getDefaultLocale());
firstStart.setText("false");
}
if (synchVal == NXTHandlerBaseActivity.MODE_FOLLOW) {
Toast.makeText(this, R.string.toast_irEmitterOff, Toast.LENGTH_LONG).show();
irport.setEnabled(true);
irport.setSelectable(true);
} else {
irport.setEnabled(false);
irport.setSelectable(false);
}
updateSummary(null);
}
@Override
protected void onResume() {
super.onResume();
updateSummary(null);
// Set up a listener whenever a key changes
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
if (key.equals(this.getText(R.string.prf_synchMode_id))) {
int synchVal = Integer.valueOf(((ListPreference) findPreference(key)).getValue()).intValue();
ListPreference irport = (ListPreference) findPreference(this.getText(R.string.prf_irPort_id));
if (synchVal == 1) {
irport.setEnabled(true);
irport.setSelectable(true);
} else {
irport.setEnabled(false);
irport.setSelectable(false);
}
mApp.setModeChanged(true);
} else if (key.equals(this.getText(R.string.prf_locale_id))) {
DroidStormApp app = (DroidStormApp) getApplication();
app.setDefaultLocale(((ListPreference) findPreference(key)).getValue());
app.setLocaleChanged(true);
setLocale();
refresh();
} else if (key.equals(this.getText(R.string.prf_motorLeft_id)) || key.equals(this.getText(R.string.prf_motorRight_id))) {
mApp.setWheelChanged(true);
}
updateSummary(key);
}
@Override
protected void onPause() {
super.onPause();
// Unregister the listener whenever a key changes
getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
}
/**
* Sets the language
* Used to change the activity language on runtime
*/
private void setLocale() {
String locale = ((DroidStormApp) getApplication()).getDefaultLocale();
if (locale != null) {
Locale newLocale = new Locale(locale);
Locale.setDefault(newLocale);
Configuration configLocale = new Configuration();
configLocale.locale = newLocale;
getBaseContext().getResources().updateConfiguration(configLocale, null);
setTitle(R.string.activity_label_preferences);
}
}
/**
* Re-launches the activity
*/
private void refresh() {
finish();
Intent myIntent = new Intent(this, this.getClass());
startActivity(myIntent);
}
/**
* Updates configuration entries summary on runtime
*
* @param key key of the configuration entry which summary has to be changed
*/
private void updateSummary(String key) {
String summary = null;
if (key == null) {
Iterator<CharSequence> it = mSummaries.keySet().iterator();
while (it.hasNext()) {
String preferenceKey = (String) it.next();
ListPreference portPreference = (ListPreference) findPreference(preferenceKey);
if (portPreference != null && portPreference.getEntry() != null) {
summary = mSummaries.get(preferenceKey) + ": " + portPreference.getEntry();
portPreference.setSummary(summary);
}
}
} else {
ListPreference portPreference = (ListPreference) findPreference(key);
if (portPreference != null && portPreference.getEntry() != null) {
summary = mSummaries.get(key) + ": " + portPreference.getEntry();
portPreference.setSummary(summary);
}
}
}
}
| [
"[email protected]"
] | |
4350b2adffc316d9e3a55ed6d42b95e57c84d08d | fa297c819471e1eca163a63c7ade699df6c096f0 | /src/main/java/za/co/tman/inventory/web/rest/errors/ExceptionTranslator.java | e1233dbd27f683259c22bbc2af32ec1144e04c08 | [] | no_license | kappaj2/IMN-InventoryModule | ddc1b8fbe992772d44af565b2bc500100a1d965a | 9cf52940e6dda2741191192acd7d0d8b969a7ec2 | refs/heads/master | 2020-03-20T22:38:59.594555 | 2018-07-24T07:45:26 | 2018-07-24T07:45:26 | 137,808,383 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,049 | java | package za.co.tman.inventory.web.rest.errors;
import za.co.tman.inventory.web.rest.util.HeaderUtil;
import org.springframework.dao.ConcurrencyFailureException;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.NativeWebRequest;
import org.zalando.problem.DefaultProblem;
import org.zalando.problem.Problem;
import org.zalando.problem.ProblemBuilder;
import org.zalando.problem.Status;
import org.zalando.problem.spring.web.advice.ProblemHandling;
import org.zalando.problem.spring.web.advice.validation.ConstraintViolationProblem;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.stream.Collectors;
/**
* Controller advice to translate the server side exceptions to client-friendly json structures.
* The error response follows RFC7807 - Problem Details for HTTP APIs (https://tools.ietf.org/html/rfc7807)
*/
@ControllerAdvice
public class ExceptionTranslator implements ProblemHandling {
/**
* Post-process Problem payload to add the message key for front-end if needed
*/
@Override
public ResponseEntity<Problem> process(@Nullable ResponseEntity<Problem> entity, NativeWebRequest request) {
if (entity == null || entity.getBody() == null) {
return entity;
}
Problem problem = entity.getBody();
if (!(problem instanceof ConstraintViolationProblem || problem instanceof DefaultProblem)) {
return entity;
}
ProblemBuilder builder = Problem.builder()
.withType(Problem.DEFAULT_TYPE.equals(problem.getType()) ? ErrorConstants.DEFAULT_TYPE : problem.getType())
.withStatus(problem.getStatus())
.withTitle(problem.getTitle())
.with("path", request.getNativeRequest(HttpServletRequest.class).getRequestURI());
if (problem instanceof ConstraintViolationProblem) {
builder
.with("violations", ((ConstraintViolationProblem) problem).getViolations())
.with("message", ErrorConstants.ERR_VALIDATION);
return new ResponseEntity<>(builder.build(), entity.getHeaders(), entity.getStatusCode());
} else {
builder
.withCause(((DefaultProblem) problem).getCause())
.withDetail(problem.getDetail())
.withInstance(problem.getInstance());
problem.getParameters().forEach(builder::with);
if (!problem.getParameters().containsKey("message") && problem.getStatus() != null) {
builder.with("message", "error.http." + problem.getStatus().getStatusCode());
}
return new ResponseEntity<>(builder.build(), entity.getHeaders(), entity.getStatusCode());
}
}
@Override
public ResponseEntity<Problem> handleMethodArgumentNotValid(MethodArgumentNotValidException ex, @Nonnull NativeWebRequest request) {
BindingResult result = ex.getBindingResult();
List<FieldErrorVM> fieldErrors = result.getFieldErrors().stream()
.map(f -> new FieldErrorVM(f.getObjectName(), f.getField(), f.getCode()))
.collect(Collectors.toList());
Problem problem = Problem.builder()
.withType(ErrorConstants.CONSTRAINT_VIOLATION_TYPE)
.withTitle("Method argument not valid")
.withStatus(defaultConstraintViolationStatus())
.with("message", ErrorConstants.ERR_VALIDATION)
.with("fieldErrors", fieldErrors)
.build();
return create(ex, problem, request);
}
@ExceptionHandler(NoSuchElementException.class)
public ResponseEntity<Problem> handleNoSuchElementException(NoSuchElementException ex, NativeWebRequest request) {
Problem problem = Problem.builder()
.withStatus(Status.NOT_FOUND)
.with("message", ErrorConstants.ENTITY_NOT_FOUND_TYPE)
.build();
return create(ex, problem, request);
}
@ExceptionHandler(BadRequestAlertException.class)
public ResponseEntity<Problem> handleBadRequestAlertException(BadRequestAlertException ex, NativeWebRequest request) {
return create(ex, request, HeaderUtil.createFailureAlert(ex.getEntityName(), ex.getErrorKey(), ex.getMessage()));
}
@ExceptionHandler(ConcurrencyFailureException.class)
public ResponseEntity<Problem> handleConcurrencyFailure(ConcurrencyFailureException ex, NativeWebRequest request) {
Problem problem = Problem.builder()
.withStatus(Status.CONFLICT)
.with("message", ErrorConstants.ERR_CONCURRENCY_FAILURE)
.build();
return create(ex, problem, request);
}
}
| [
"[email protected]"
] | |
e6a44df3fdcfa01b7a6d97abb3e2d8fee8be1464 | b4bd429351eadae80569c5790632fbf310760c82 | /src/com/questvisual/wordlens/messaging/e.java | 12e59e7ab70f7b0ae2bb4275ca23c9543f5a239a | [] | no_license | Kolimar/WorldLensSource | 18b615ef986296e49fde1dca25facba65338e1a2 | d0fd5c2292bcbc8a0f81adf3a18884ff6ad3d3e7 | refs/heads/master | 2020-12-05T15:16:27.560401 | 2016-06-02T05:10:30 | 2016-06-02T05:10:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 877 | 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.questvisual.wordlens.messaging;
import com.questvisual.util.b;
// Referenced classes of package com.questvisual.wordlens.messaging:
// a, g
public class e extends a
{
public double b;
public double c;
public double d;
public double e;
public e(g g, byte abyte0[])
{
super(g, abyte0);
b = -9.2233720368547758E+18D;
c = -9.2233720368547758E+18D;
d = -9.2233720368547758E+18D;
e = -9.2233720368547758E+18D;
b = com.questvisual.util.b.c(abyte0, 0);
c = com.questvisual.util.b.c(abyte0, 8);
d = com.questvisual.util.b.c(abyte0, 16);
e = com.questvisual.util.b.c(abyte0, 24);
}
}
| [
"[email protected]"
] | |
2d10342e0c40fea60ffa432e4548ec2abfb12e42 | 400fa21f2e6c107e8376e17d03af4d744204a715 | /translator-gui/src/main/java/ru/ezhov/translator/gui/OutputResult.java | 932b1e09ba6fce602aa5d099e12c324dd54a4d2d | [] | no_license | ezhov-da/translator | 74ea7ed26e755de9d2ffc1e8f61e097b74d0a730 | 14707e03a8241af206f166b46715aa205cceba3e | refs/heads/master | 2022-05-26T09:27:34.627981 | 2020-06-30T05:43:05 | 2020-06-30T05:43:05 | 139,899,823 | 0 | 0 | null | 2021-08-23T19:53:32 | 2018-07-05T20:57:13 | Java | UTF-8 | Java | false | false | 99 | java | package ru.ezhov.translator.gui;
public interface OutputResult {
void setText(String text);
}
| [
"[email protected]"
] | |
4d43b494df2b0079e0a5ce93474ae17e6f1a78d4 | 8c085f12963e120be684f8a049175f07d0b8c4e5 | /castor/tags/TAG_1_0_1/src/tests/ptf/jdo/rel1toN/State.java | a0fab867d09d03f4dc04990d8f871982e5e8fea1 | [] | no_license | alam93mahboob/castor | 9963d4110126b8f4ef81d82adfe62bab8c5f5bce | 974f853be5680427a195a6b8ae3ce63a65a309b6 | refs/heads/master | 2020-05-17T08:03:26.321249 | 2014-01-01T20:48:45 | 2014-01-01T20:48:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,366 | java | /*
* Copyright 2005 Ralf Joachim
*
* 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 ptf.jdo.rel1toN;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
/**
* @author <a href="mailto:ralf DOT joachim AT syscon-world DOT de">Ralf Joachim</a>
* @version $Revision$ $Date: 2005-06-24 19:41:08 -0600 (Fri, 24 Jun 2005) $
*/
public final class State {
//-------------------------------------------------------------------------
private Integer _id;
private String _name;
private Locked _locked;
private boolean _input = false;
private boolean _output = false;
private boolean _service = false;
private boolean _changeFrom = true;
private boolean _changeTo = true;
private Collection _departments = new ArrayList();
private Collection _equipments = new ArrayList();
private String _note;
private Date _createdAt;
private String _createdBy;
private Date _updatedAt;
private String _updatedBy;
//-------------------------------------------------------------------------
public Integer getId() { return _id; }
public void setId(final Integer id) { _id = id; }
public String getName() { return _name; }
public void setName(final String name) { _name = name; }
public Locked getLocked() { return _locked; }
public void setLocked(final Locked locked) { _locked = locked; }
public boolean getInput() { return _input; }
public void setInput(final boolean input) { _input = input; }
public boolean getOutput() { return _output; }
public void setOutput(final boolean output) { _output = output; }
public boolean getService() { return _service; }
public void setService(final boolean service) { _service = service; }
public boolean getChangeFrom() { return _changeFrom; }
public void setChangeFrom(final boolean changeFrom) { _changeFrom = changeFrom; }
public boolean getChangeTo() { return _changeTo; }
public void setChangeTo(final boolean changeTo) { _changeTo = changeTo; }
public Collection getDepartments() { return _departments; }
public void setDepartments(final Collection departments) {
_departments = departments;
}
public void addDepartment(final Department department) {
if ((department != null) && (!_departments.contains(department))) {
_departments.add(department);
department.setState(this);
}
}
public void removeDepartment(final Department department) {
if ((department != null) && (_departments.contains(department))) {
_departments.remove(department);
department.setState(null);
}
}
public Collection getEquipments() { return _equipments; }
public void setEquipments(final Collection equipments) {
_equipments = equipments;
}
public void addEquipment(final Equipment equipment) {
if ((equipment != null) && (!_equipments.contains(equipment))) {
_equipments.add(equipment);
equipment.setState(this);
}
}
public void removeEquipment(final Equipment equipment) {
if ((equipment != null) && (_equipments.contains(equipment))) {
_equipments.remove(equipment);
equipment.setState(null);
}
}
public String getNote() { return _note; }
public void setNote(final String note) { _note = note; }
public Date getCreatedAt() { return _createdAt; }
public void setCreatedAt(final Date createdAt) { _createdAt = createdAt; }
public String getCreatedBy() { return _createdBy; }
public void setCreatedBy(final String createdBy) { _createdBy = createdBy; }
public void setCreated(final Date createdAt, final String createdBy) {
_createdAt = createdAt;
_createdBy = createdBy;
}
public Date getUpdatedAt() { return _updatedAt; }
public void setUpdatedAt(final Date updatedAt) { _updatedAt = updatedAt; }
public String getUpdatedBy() { return _updatedBy; }
public void setUpdatedBy(final String updatedBy) { _updatedBy = updatedBy; }
public void setUpdated(final Date updatedAt, final String updatedBy) {
_updatedAt = updatedAt;
_updatedBy = updatedBy;
}
//-------------------------------------------------------------------------
public String toString() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
StringBuffer sb = new StringBuffer();
sb.append("<State id='"); sb.append(_id);
sb.append("' name='"); sb.append(_name);
sb.append("' input='"); sb.append(_input);
sb.append("' output='"); sb.append(_output);
sb.append("' service='"); sb.append(_service);
sb.append("' changeFrom='"); sb.append(_changeFrom);
sb.append("' changeTo='"); sb.append(_changeTo);
sb.append("' note='"); sb.append(_note);
sb.append("' createdAt='");
if (_createdAt != null) {
sb.append(df.format(_createdAt));
} else {
sb.append(_createdAt);
}
sb.append("' createdBy='"); sb.append(_createdBy);
sb.append("' updatedAt='");
if (_updatedAt != null) {
sb.append(df.format(_updatedAt));
} else {
sb.append(_updatedAt);
}
sb.append("' updatedBy='"); sb.append(_updatedBy);
sb.append("'>\n");
sb.append(_locked);
sb.append("</State>\n");
return sb.toString();
}
//-------------------------------------------------------------------------
}
| [
"wguttmn@b24b0d9a-6811-0410-802a-946fa971d308"
] | wguttmn@b24b0d9a-6811-0410-802a-946fa971d308 |
5364f7bee8a72e29b0b7384580aa6b2839db3422 | a10a42f3bcee7672b50721c01c7cdd6570e940c9 | /app/src/main/java/com/cpigeon/app/modular/usercenter/model/daoimpl/RegisterDaoImpl.java | 2db18e81739e2c64e86053e18003872e55f50ff0 | [] | no_license | carleewang/CAppPlus | b31360517bd1dbad41a8c721eb8148573be86ec7 | 33086724720da165cc225539857d2ed1728b5c2c | refs/heads/master | 2021-09-28T09:19:22.814732 | 2018-11-16T08:57:56 | 2018-11-16T08:57:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,380 | java | package com.cpigeon.app.modular.usercenter.model.daoimpl;
import com.cpigeon.app.commonstandard.model.daoimpl.SendVerificationCodeImpl;
import com.cpigeon.app.modular.usercenter.model.dao.IRegisterDao;
import com.cpigeon.app.utils.CallAPI;
import java.net.ConnectException;
/**
* Created by chenshuai on 2017/4/8.
*/
public class RegisterDaoImpl extends SendVerificationCodeImpl implements IRegisterDao {
CallAPI.Callback registUserCallback = new CallAPI.Callback() {
@Override
public void onSuccess(Object data) {
if (onCompleteListener != null)
onCompleteListener.onSuccess(data);
}
@Override
public void onError(int errorType, Object data) {
if (onCompleteListener == null) return;
String msg = "注册失败,请稍候再试";
if (errorType == ERROR_TYPE_API_RETURN) {
switch ((int) data) {
case 1000:
msg = "手机号码,验证码,或密码不能为空";
break;
case 1002:
msg = "该手机号已被注册";
break;
case 1003:
msg = "验证码失效";
}
} else if (errorType == ERROR_TYPE_REQUST_EXCEPTION) {
if (data instanceof ConnectException)
msg = "网络无法连接,请检查您的网络";
}
onCompleteListener.onFail(msg);
}
};
CallAPI.Callback resetUserPasswordCallback = new CallAPI.Callback() {
@Override
public void onSuccess(Object data) {
if (onCompleteListener != null)
onCompleteListener.onSuccess(data);
}
@Override
public void onError(int errorType, Object data) {
if (onCompleteListener == null) return;
String msg = "重置失败,请稍候再试";
if (errorType == ERROR_TYPE_API_RETURN) {
switch ((int) data) {
case 1000:
msg = "手机号码,验证码,或密码不能为空";
break;
case 1002:
msg = "没有查到与此手机号码绑定的账户";
break;
case 1003:
msg = "验证码失效";
break;
}
} else if (errorType == ERROR_TYPE_REQUST_EXCEPTION) {
if (data instanceof ConnectException)
msg = "网络无法连接,请检查您的网络";
}
onCompleteListener.onFail(msg);
}
};
IRegisterDao.OnCompleteListener onCompleteListener;
@Override
public void registUser(String phoneNumber, String password, String yzm, OnCompleteListener onCompleteListener) {
this.onCompleteListener = onCompleteListener;
CallAPI.registUser(phoneNumber, password, yzm, registUserCallback);
}
@Override
public void findUserPassword(String phoneNumber, String password, String yzm, OnCompleteListener onCompleteListener) {
this.onCompleteListener = onCompleteListener;
CallAPI.findUserPassword(phoneNumber, password, yzm, resetUserPasswordCallback);
}
}
| [
"[email protected]"
] | |
dbaec45084e3259116d709954343a5290b77dfbd | 7246895c0b8f9e4065b33b1db2833969a31315a2 | /tensquare_user/src/main/java/com/tensquare/user/pojo/User.java | 27367bc47a1463e28fb12bee647fc937fb32517b | [] | no_license | lastLi/tensquare_parent | 84b592e48cbf74e43d40d40a4805d3e0c9e0c536 | 228b4ff859344d4431b54c6262cdcc7065b56c85 | refs/heads/master | 2020-04-23T02:19:35.482669 | 2019-02-21T17:04:51 | 2019-02-21T17:04:51 | 170,842,737 | 0 | 1 | null | 2019-02-21T17:04:52 | 2019-02-15T09:59:58 | Java | UTF-8 | Java | false | false | 1,435 | java | package com.tensquare.user.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
/**
* 实体类
*
* @author Administrator
*/
@Data
@Entity
@Table(name = "tb_user")
@NoArgsConstructor
@AllArgsConstructor
public class User implements Serializable {
@Id
private String id;//ID
/**
* 手机号码
*/
private String mobile;
/**
* 密码
*/
private String password;
/**
* 昵称
*/
private String nickname;
/**
* 性别
*/
private String sex;
/**
* 出生年月日
*/
private java.util.Date birthday;
/**
* 头像
*/
private String avatar;
/**
* 邮箱
*/
private String email;
/**
* 注册日期
*/
private java.util.Date regdate;
/**
* 修改日期
*/
private java.util.Date updatedate;
/**
* 最好登录日期
*/
private java.util.Date lastdate;
/**
* 在线时长(分钟)
*/
private Long online;
/**
* 兴趣
*/
private String interest;
/**
* 个性签名
*/
private String personality;
/**
* 粉丝数
*/
private Integer fanscount;
/**
* 关注数
*/
private Integer followcount;
}
| [
"[email protected]"
] | |
71a4c3b67a8b72d986f94d6f131e040f29bb2362 | 7c469369ac8f36f270e9b6bbe2958211a409e844 | /PS11_codeBlooded/src/sounds/SoundClips.java | b1fef9b3dbc5798463d1dd524c5d5570efe8921c | [] | no_license | kylePerryUT/asteroidsGame | 88107d1f4d4af184e55b4141600a91c52a7dcf46 | 3ba23126df69a8aa5b2248503c4cff68b3e97d86 | refs/heads/master | 2020-04-08T09:47:32.858699 | 2018-12-06T03:46:13 | 2018-12-06T03:46:13 | 159,239,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,747 | java | package sounds;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
import java.io.IOException;
import javax.sound.sampled.*;
import javax.swing.*;
@SuppressWarnings("serial")
public class SoundClips
{
/** A Clip that, when played, sounds like a weapon being fired */
/**
* Creates the sound clips required.
*/
public SoundClips ()
{
// We create the clips in advance so that there will be no delay
// when we need to play them back. Note that the actual wav
// files are stored in the "sounds" project.
}
/**
* Creates an audio clip from a sound file.
*/
public Clip createClip (String soundFile)
{
// Opening the sound file this way will work no matter how the
// project is exported. The only restriction is that the
// sound files must be stored in a package.
try (BufferedInputStream sound = new BufferedInputStream(getClass().getResourceAsStream(soundFile)))
{
// Create and return a Clip that will play a sound file. There are
// various reasons that the creation attempt could fail. If it
// fails, return null.
Clip clip = AudioSystem.getClip();
clip.open(AudioSystem.getAudioInputStream(sound));
return clip;
}
catch (LineUnavailableException e)
{
return null;
}
catch (IOException e)
{
return null;
}
catch (UnsupportedAudioFileException e)
{
return null;
}
}
}
| [
"user@DESKTOP-1JTHIN8"
] | user@DESKTOP-1JTHIN8 |
f7e0bfe9b720df28196a3ce8bb585547bbf77b4c | a0d26315e63decad2044a08d25672570ff9f5818 | /src/Medium/Longest_Substring_Without_Repeating_Characters.java | f003c1f04dcecdf9c029c4c938a317ef77320a7a | [
"Apache-2.0"
] | permissive | GSephrioth/LeetCode | 4bd9d84a5891805a42af47bf43cf0c8b7be41e14 | e5fde610be15a7b2266dcc61d5a4023e5841093a | refs/heads/master | 2021-05-16T18:24:20.333438 | 2020-09-29T08:23:33 | 2020-09-29T08:23:47 | 95,619,130 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,790 | java | package Medium;
import java.util.Arrays;
import java.util.HashSet;
/**
* Given a string, find the length of the longest substring without repeating characters.
* Examples:
* Given "abcabcbb", the answer is "abc", which the length is 3.
* Given "bbbbb", the answer is "b", with the length of 1.
* Given "pwwkew", the answer is "wke", with the length of 3. Note that the answer must be a substring, "pwke" is a subsequence and not a substring.
* Created by Elliott Chen on 6/27/17.
*/
class Longest_Substring_Without_Repeating_Characters {
//单次遍历字符串,将start和end之间的char存储于HS,
// int lengthOfLongestSubstring(String s) {
// int start = 0, end = 0, max = 0;
// HashSet<Character> HS = new HashSet<>();
// while (end < s.length()) {
// char endchar = s.charAt(end);
// if (HS.contains(endchar)) {
// if (max < end - start) {
// max = end - start;
// }
// while (s.charAt(start) != endchar) {
// HS.remove(s.charAt(start));
// start++;
// }
// start++;
// } else {
// HS.add(endchar);
// }
// end++;
// }
// max = Math.max(max, end - start);
// return max;
// }
//单次遍历字符串,记录两个相同char之间下标之差
int lengthOfLongestSubstring(String s) {
int[] map = new int[256];
Arrays.fill(map, -1);
int max = 0;
int last = -1;
for(int i = 0; i < s.length(); i++) {
last = Math.max(map[s.charAt(i)], last);
map[s.charAt(i)] = i;
max = Math.max(max, i - last);
}
return max;
}
}
| [
"[email protected]"
] | |
5d7aa49b0ef70db2e7a7ecaf3ae5f064510dcd10 | 7fa754976ab4ec2b062af52968e785697fd83729 | /005/src/main/java/com/kodcu/main/CModel.java | 83b003072150e13e0a358a9119fc6d66c88d14a4 | [] | no_license | altuga/SpringOrnekleri | 23948274fdb84d6db4f8ee421718e26179acfcf7 | dc2f53c22a117f6192be6a534c7406537260ec27 | refs/heads/master | 2021-01-11T21:57:21.183720 | 2017-01-27T09:21:31 | 2017-01-27T09:21:31 | 78,884,949 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 806 | java | package com.kodcu.main;
/**
* @author : Altug Bilgin Altintas - [email protected]
*/
public class CModel extends Araba {
private double torqueMeasure = 1;
public static CModel getCModel() {
return new CModel();
}
public CModel() {
System.out.println(" C-Model yapilandici");
}
@Override
public void modelBilgisiniAl() {
System.out.println(" C-Model");
icHesaplama();
}
public void vitesKontrol(double vites) {
System.out.println(" vitesKontrol " + vites);
}
public void icHesaplama() {
for (int i = 0; i < 10; i++) {
torqueMeasure += torqueMeasure * (Math.random() * 10);
}
System.out.println(" torqueMeasure " + torqueMeasure);
}
}
| [
"[email protected]"
] | |
dd458b954fbe51f6523e7792557e9003c972749b | d24a9e4c5c75a52a1f7346a8b8f2aeb45c730baa | /src/main/java/org/gaetan/DAO/userDao.java | 88bad85fecdc9ab918277a923f61261f05ab4525 | [] | no_license | ffmc02/APIFilleRouge | f420386a91b1b3d8f1bd916a0da7f0f2abf2ba42 | 9c16c2c33074f3035424451eab44d54e566ff846 | refs/heads/master | 2022-10-17T12:19:00.373431 | 2020-06-08T14:29:07 | 2020-06-08T14:29:07 | 270,699,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,771 | java | package org.gaetan.DAO;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
public class userDao extends connexion {
public userDao() {
}
//methode d'insertion
public void Insertuser(user user) {
//appel a la fonction connexion
this.createConnection();
//requette préparer
PreparedStatement pstm;
try {
pstm = this.con.prepareStatement("INSERT INTO 1402f_user (`pseudo`, `email`, `password`, `cle`)VALUE (?, ? ,?, ?)");
pstm.setString(1, user.getPseudo());
pstm.setString(2, user.getEmail());
pstm.setString(3, user.getPassword());
pstm.setString(4, user.getCle());
pstm.execute();
pstm.close();
} catch (SQLException throwables) {
throwables.printStackTrace();
}
this.closeConnection();
}
//liste Utilisateur
public List<user> List(){
List<user> listUser= new ArrayList();
this.createConnection();
try {
Statement stm= con.createStatement();
ResultSet res =stm.executeQuery("SELECT `id`, `pseudo`, `email` FROM `1402f_user` ");
while(res.next()){
int id =res.getInt("id");
String pseudo =res.getString("pseudo");
String email = res.getString("email");
user n= new user( id, pseudo, email);
}
} catch (SQLException throwables) {
throwables.printStackTrace();
}
this.closeConnection();
return listUser;
}
}
| [
"[email protected]"
] | |
1a16974daa53b8f2d72b5e56efb2b846c223fdce | 38c145c55db02b57fe232ebf1adb580c239bce41 | /src/BasicsOfSoftwareCodeDevelopment/Branching/Task4.java | 1bb09c206ef7fad7ec30713179c7570b4dcaadca | [] | no_license | art-orient/UpSkillLab1 | 45ed3598a9f1bb13dd186cc1ac0947cf1e33e5c7 | 2e15814c30143e2d6d1ec1825406d61832021c2f | refs/heads/main | 2023-02-01T07:15:26.512383 | 2020-12-19T12:34:58 | 2020-12-19T12:34:58 | 302,310,016 | 0 | 0 | null | 2020-10-08T13:49:39 | 2020-10-08T10:50:47 | null | UTF-8 | Java | false | false | 729 | java | package BasicsOfSoftwareCodeDevelopment.Branching;
// 4. Заданы размеры А, В прямоугольного отверстия и размеры х, у, z кирпича.
// Определить, пройдет ли кирпич через отверстие.
public class Task4 {
public static String task4(int a, int b, int x, int y, int z) {
if ((a >= x && b >= y) || (a >= y && b >= x) ||
(a >= y && b >= z) || (a >= z && b >= y) ||
(a >= x && b >= z) || (a >= z && b >= x)) {
return "Кирпич пройдет через отверстие";
} else {
return "Кирпич не пройдет через отверстие";
}
}
} | [
"[email protected]"
] | |
fde52b44242112b6e5c086bf4178350a2d6fe6f1 | 707febcf0a91d9609d20cbbb50fb2cbe171f3cc0 | /src/main/java/ua/edu/sumdu/j2se/Resendiz/CarRentalSystem/domain/Reservation.java | 411da7af277bfdd702ee76aff62ebec7c7fa5b1e | [] | no_license | rresendizlazaro/CarRentalSystem | d2448b1461c1fda0b22371c3e99c778f6c6165b4 | ed8b526eeef9c9b26a7ca07066e78bafbf233e92 | refs/heads/master | 2023-04-22T01:21:09.042480 | 2021-05-12T03:27:30 | 2021-05-12T03:27:30 | 360,348,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 661 | java | package ua.edu.sumdu.j2se.Resendiz.CarRentalSystem.domain;
import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import lombok.Data;
@Data
@Entity
@Table(name = "reservation")
public class Reservation implements Serializable{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idReservation;
@NotNull
private int idUser;
@NotNull
private int idCar;
@NotNull
private int number;
@NotNull
private String start_time;
@NotNull
private String end_time;
private int total;
}
| [
"[email protected]"
] | |
409e387fdb125747a58b8ca505483101de463432 | cd7bac124d1f5bc7eb5b0ef5edab1e4bfd0423e9 | /app/src/main/java/com/example/megha/myapplication/adapter/SearchAdapter.java | 52d4e031fb4906fbc127f5762122f472a0f81c6b | [] | no_license | MeghaVaishy/sampleassigment | ab2456e40dc1636f444e046bc698899bcce09767 | 68ad1d170b3e5517848a03006a22fe72f30347f3 | refs/heads/master | 2020-03-30T06:10:51.515427 | 2018-09-30T14:52:40 | 2018-09-30T14:52:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,349 | java | package com.example.megha.myapplication.adapter;
import android.app.Activity;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.example.megha.myapplication.pojo.SearchPojo;
import com.example.megha.myapplication.R;
import java.util.List;
public class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.ItemHolder> {
private List<SearchPojo> searchlist;
private itemListListner itemListListner;
private Activity activity;
public SearchAdapter(List<SearchPojo> searchlist, itemListListner itemListListner, Activity activity) {
this.searchlist = searchlist;
this.itemListListner = itemListListner;
this.activity = activity;
}
@Override
public ItemHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false);
return new ItemHolder(itemView);
}
@Override
public void onBindViewHolder(ItemHolder holder, int position) {
final SearchPojo item = searchlist.get(position);
holder.title.setText(item.getTitle());
holder.description.setText(item.getDescription());
Glide.with(activity).load(item.getImageURL()).into(holder.imageView);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
itemListListner.navigateToWebPage(item.getTitle());
}
});
}
@Override
public int getItemCount() {
return searchlist != null ? searchlist.size() : 0;
}
public interface itemListListner {
void navigateToWebPage(String title);
}
public class ItemHolder extends RecyclerView.ViewHolder {
public TextView title, description;
public ImageView imageView;
public ItemHolder(View itemView) {
super(itemView);
title = (TextView) itemView.findViewById(R.id.titletext);
description = (TextView) itemView.findViewById(R.id.description);
imageView = (ImageView) itemView.findViewById(R.id.imageView);
}
}
}
| [
"[email protected]"
] | |
65f45249836ccaf91214ed5b278d313788d8892f | 8f725927104fb791d72530356d2288689e632eee | /src/main/java/no/hib/models/MultipleAppointments.java | e950c08cb78819b37db3eea47757e08816ffffac | [
"Apache-2.0"
] | permissive | adrianrutle/msadmin | 56e0e781dcea01a36fe81c8fa64004d71bd6b9fb | 7567484cf72d510ab66fce7acf57fd34e9d74a6d | refs/heads/master | 2021-05-04T00:50:28.876017 | 2018-03-22T20:26:18 | 2018-03-22T20:26:18 | 120,348,825 | 0 | 1 | null | 2018-02-05T19:08:00 | 2018-02-05T19:07:59 | null | UTF-8 | Java | false | false | 1,535 | java | package no.hib.models;
import org.joda.time.DateTime;
import org.springframework.format.annotation.DateTimeFormat;
public class MultipleAppointments {
@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm")
private DateTime startDateTime;
private String patientSsn;
private String doctorSsn;
private int numberOfConsecutiveAppointments;
public MultipleAppointments(DateTime startDateTime, String patientSsn, String doctorSsn, int numberOfConsecutiveAppointments) {
this.startDateTime = startDateTime;
this.patientSsn = patientSsn;
this.doctorSsn = doctorSsn;
this.numberOfConsecutiveAppointments = numberOfConsecutiveAppointments;
}
public MultipleAppointments() {
}
public int getNumberOfConsecutiveAppointments() {
return numberOfConsecutiveAppointments;
}
public void setNumberOfConsecutiveAppointments(int numberOfConsecutiveAppointments) {
this.numberOfConsecutiveAppointments = numberOfConsecutiveAppointments;
}
public DateTime getStartDateTime() {
return startDateTime;
}
public void setStartDateTime(DateTime startDateTime) {
this.startDateTime = startDateTime;
}
public String getPatientSsn() {
return patientSsn;
}
public void setPatientSsn(String patientSsn) {
this.patientSsn = patientSsn;
}
public String getDoctorSsn() {
return doctorSsn;
}
public void setDoctorSsn(String doctorSsn) {
this.doctorSsn = doctorSsn;
}
}
| [
"Karina Haugen"
] | Karina Haugen |
924ddbfe47f0193e4d224838fbf9c292feb3b299 | 32de5995339f5824771fc34ede15b5079985a44a | /src/main/java/com/bugpass/service/DiscussService.java | 5919afc665c74a13d7519984774a0f1fe1affb9a | [
"MIT"
] | permissive | pj-ye/BugPass | 398bb4e0dd624b85958d681e3de613f1d14c9ea3 | f6562ada1adc6ac48306e8d7fdc2f7c2573f1c16 | refs/heads/master | 2023-03-19T18:55:55.551200 | 2018-07-13T08:06:24 | 2018-07-13T08:06:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 881 | java | package com.bugpass.service;
import java.util.List;
import com.bugpass.entity.Discuss;
/**
* 讨论相关业务接口
* @author QiuWenYi
* @date 2018年7月4日 下午12:38:47
*/
public interface DiscussService {
/**
* 新增评论
* @param discuss
* @return 若成功返回true
*/
boolean addDiscuss(Discuss discuss);
/**
* 根据问题ID查找相应问题的评论
*
* @param problemId 问题ID
* @return 查找到的list
*/
List<Discuss> findByProblemId(long problemId);
/**
* 根据discussId删除
*
* @param discussId 讨论的id
* @return 是否成功删除
*/
boolean delDiscussById(long discussId);
/**
* 查询所有讨论
*
* @param discussId 讨论的id
* @return 是否成功删除
*/
List<Discuss> findAllDisscuss();
}
| [
"[email protected]"
] | |
2c2c7874513bd8c4a0112cb27b60b20fa3d79a51 | f014f7baff1eebe6702f25786a1bb6c08f83d9e6 | /Xibonacci.java | 9b9a48d2adfbe846862a3aca2146a9e5ccf23d08 | [] | no_license | angelgamo/Xibonacci | adac5f49a5f9e3ac9144284ca7d726093a76ec49 | 09011bbb10b02b29b151c6690d35edc19b5b8568 | refs/heads/main | 2023-03-21T06:51:17.717897 | 2021-03-12T18:26:34 | 2021-03-12T18:26:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,549 | java | import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
//https://dev.to/jamesrweb/kata-fibonacci-tribonacci-and-friends-3331
public class Xibonacci {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int rep = sc.nextInt();
for (int i = 0; i < rep; i++) {
sc.nextLine();
String Strserie = sc.nextLine();
String[] Strlist = Strserie.split(", ");
ArrayList<Integer> serie = new ArrayList<Integer>();
for (int j = 0; j < Strlist.length; j++) {
serie.add(Integer.parseInt(Strlist[j]));
}
int fin = sc.nextInt();
int indiceActual = 0;
Xibonacci(serie, fin, indiceActual);
System.out.println(serie.toString());
}
}
public static void Xibonacci(ArrayList<Integer> serie, int fin, int indiceActual) {
ArrayList<Integer> siguiente = cortarLista(serie, indiceActual, serie.size());
int suma = sumalista(siguiente);
serie.add(suma);
indiceActual++;
if (serie.size() != fin) {
Xibonacci(serie, fin, indiceActual);
}
}
public static ArrayList<Integer> cortarLista(ArrayList<Integer> lista, int ini, int fin) {
ArrayList<Integer> nuevaLista = new ArrayList<>();
for (int i = 0; i < lista.size(); i++) {
if (i >= ini && i < fin) {
nuevaLista.add(lista.get(i));
}
}
return nuevaLista;
}
public static int sumalista(ArrayList<Integer> siguiente) {
int suma = 0;
for (Integer valor : siguiente) {
suma += valor;
}
return suma;
}
}
| [
"[email protected]"
] | |
6b520c2d859af040613b9f984cb15e13ac922cc8 | 49665d55373cff6fc7235ceadaaffa9374be1f63 | /src/main/java/com/luv2code/springdemoannotations/SwimCoach.java | af6fcfe0bdec5bd3e6c5999a8f85abb955aae4ab | [] | no_license | HrechanayaIV/UdemyPracticeSpring | a24abf97912ca377e454fff3e850e43a04a01fab | bbbfabb579f3564251749d2d1ff94919979552ed | refs/heads/master | 2021-09-02T09:37:46.606772 | 2018-01-01T14:19:54 | 2018-01-01T14:19:54 | 115,347,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 827 | java | package com.luv2code.springdemoannotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class SwimCoach implements Coach {
@Autowired
@Qualifier("sadFortuneService")
private FortuneService fortuneService;
@Value("${foo.email}")
private String email;
@Value("${foo.team}")
private String team;
public String getDailyWorkout() {
return "Practice your swimming";
}
public String getDailyFortune() {
return fortuneService.getFortune();
}
public String getEmail() {
return email;
}
public String getTeam() {
return team;
}
}
| [
"[email protected]"
] | |
0310e6f4fb0bc0e6c523e8bdca889c29ffd1aa0b | 015dcfdf9b560ed76cc0f33e5d95cafc27224f68 | /Carssier/Carssier_Staffs/src/ru/sibek/plugin/staff/worktime/StaffWorktimeUUIPlugin.java | 630e0b0ab73314437e149dfb0f9e6c4474843dd2 | [] | no_license | ermachkov/ERP | 4b070bb78ebb3f733a895fbe2bacbcbf5c31532e | 8017c20ea230e29031e3dd24ef58cb33ac987766 | refs/heads/master | 2020-06-07T12:32:31.019153 | 2012-10-12T10:02:17 | 2012-10-12T10:02:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,440 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ru.sibek.plugin.staff.worktime;
import java.util.ArrayList;
import java.util.List;
import org.uui.component.RightPanel;
import org.uui.component.WorkPanel;
import org.uui.plugin.Plugin;
import org.uui.plugin.RightPanelPlugin;
import org.uui.plugin.WorkPanelPlugin;
/**
*
* @author Pechenko Anton aka parilo, forpost78 aaaaaat gmail doooooot com (C)
* Copyright by Pechenko Anton, created 16.12.2010
*/
public class StaffWorktimeUUIPlugin implements Plugin, WorkPanelPlugin, RightPanelPlugin {
private String session;
@Override
public void setSession(String session) {
this.session = session;
}
private ArrayList<RightPanel> panels;
private StaffWorkTimePanel staffWorkTimePanel;
public StaffWorktimeUUIPlugin() {
}
@Override
public boolean isSingle() {
return true;
}
@Override
public String getWorkPanelName() {
return "Рабочее время";
}
@Override
public String getSelectorGroupName() {
return "Персонал";
}
@Override
public String getSelectorGroupImagePath() {
return "icons/selector_worktime.png";
}
@Override
public String getWorkPanelClassName() {
return StaffWorkTimePanel.class.getName();
}
@Override
public WorkPanel getWorkPanel() {
if (staffWorkTimePanel == null) {
staffWorkTimePanel = new StaffWorkTimePanel(session);
}
return staffWorkTimePanel;
}
@Override
public int getSelectorGroupPosition() {
return 300;
}
@Override
public int getSelectorLabelPosition() {
return 300;
}
@Override
public List getRightPanels() {
if (panels == null) {
panels = new ArrayList<>();
panels.add(new StaffWorktimeRightPanel(session));
}
return panels;
}
public String getRightPanelWorkPanelClassName() {
return StaffWorkTimePanel.class.getName();
}
@Override
public String getGroupDescription() {
return "";
}
@Override
public String getPluginName() {
return "Рабочее время";
}
@Override
public String getPluginDescription() {
return "Оформление прихода на работу работников.";
}
}
| [
"[email protected]"
] | |
2d9737900d976a9a7ae3f3ce9275157d1fda91cc | 1ca86d5d065372093c5f2eae3b1a146dc0ba4725 | /dozer/src/main/java/com/surya/dozer/MyCustomConvertor.java | 30e38bb359c985a0e76d4244256db69854b74efa | [] | no_license | Suryakanta97/DemoExample | 1e05d7f13a9bc30f581a69ce811fc4c6c97f2a6e | 5c6b831948e612bdc2d9d578a581df964ef89bfb | refs/heads/main | 2023-08-10T17:30:32.397265 | 2021-09-22T16:18:42 | 2021-09-22T16:18:42 | 391,087,435 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,524 | java | package com.surya.dozer;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.dozer.CustomConverter;
import org.dozer.MappingException;
public class MyCustomConvertor implements CustomConverter {
@Override
public Object convert(Object dest, Object source, Class<?> arg2, Class<?> arg3) {
if (source == null) {
return null;
}
if (source instanceof Personne3) {
Personne3 person = (Personne3) source;
Date date = new Date(person.getDtob());
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
String isoDate = format.format(date);
return new Person3(person.getName(), isoDate);
} else if (source instanceof Person3) {
Person3 person = (Person3) source;
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
Date date = null;
try {
date = format.parse(person.getDtob());
} catch (ParseException e) {
throw new MappingException("Converter MyCustomConvertor " + "used incorrectly:" + e.getMessage());
}
long timestamp = date.getTime();
return new Personne3(person.getName(), timestamp);
} else {
throw new MappingException("Converter MyCustomConvertor " + "used incorrectly. Arguments passed in were:" + dest + " and " + source);
}
}
}
| [
"[email protected]"
] | |
ceb6bfd505cbfdebaab4d925f75c3759a2732e91 | bab291f97f803f3cc4bc560f87a3dfb392322d96 | /jenetics.ext/src/test/java/org/jenetics/ext/util/NodeTest.java | a0121a22665d55a9b5386cabc0570d00c849da79 | [
"Apache-2.0"
] | permissive | wilsonsf/jenetics | 0192df8491f6e10667481962e36f0cddb8f48feb | 911c4a34554eb41f1ecfa0c6eb26d650822a98b7 | refs/heads/master | 2021-08-11T12:36:26.679785 | 2017-11-13T17:34:03 | 2017-11-13T17:34:03 | 110,006,269 | 0 | 0 | null | 2017-11-08T17:13:07 | 2017-11-08T17:12:59 | Java | UTF-8 | Java | false | false | 2,474 | java | /*
* Java Genetic Algorithm Library (@__identifier__@).
* Copyright (c) @__year__@ Franz Wilhelmstötter
*
* 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.
*
* Author:
* Franz Wilhelmstötter ([email protected])
*/
package org.jenetics.ext.util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import org.testng.Assert;
import org.testng.annotations.Test;
/**
* @author <a href="mailto:[email protected]">Franz Wilhelmstötter</a>
*/
public class NodeTest {
@Test
public void treeToString() {
final TreeNode<Integer> tree = TreeNode.of(0)
.attach(TreeNode.of(1)
.attach(4, 5))
.attach(TreeNode.of(2)
.attach(6))
.attach(TreeNode.of(3)
.attach(TreeNode.of(7)
.attach(10, 11))
.attach(8)
.attach(9));
System.out.println(tree);
//final FlatTreeNode<Integer> flat = FlatTreeNode.of(tree);
//System.out.println(flat);
//System.out.println(Tree.toString(flat));
System.out.println(Trees.toCompactString(tree));
System.out.println(Trees.toDottyString("number_tree", tree));
System.out.println(tree.depth());
}
@Test
public void serialize() throws Exception {
final TreeNode<Integer> tree = TreeNode.of(0)
.attach(TreeNode.of(1)
.attach(4, 5))
.attach(TreeNode.of(2)
.attach(6))
.attach(TreeNode.of(3)
.attach(TreeNode.of(7)
.attach(10, 11))
.attach(TreeNode.of(8))
.attach(TreeNode.of(9)));
final ByteArrayOutputStream out = new ByteArrayOutputStream();
try (ObjectOutputStream oout = new ObjectOutputStream(out)) {
oout.writeObject(tree);
}
final ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
try (ObjectInputStream oin = new ObjectInputStream(in)) {
@SuppressWarnings("unchecked")
final TreeNode<Integer> object = (TreeNode<Integer>)oin.readObject();
Assert.assertEquals(object, tree);
}
}
}
| [
"[email protected]"
] | |
f9bcceeeaabd92f0e70651a919b284adaa52cbce | 0f2ee5cab08234c0c26690feb0e5572a34b1b8a6 | /JavaApplication/src/TDemo/Demo2.java | 67a03a518d485e158fd2302d5871222145335753 | [] | no_license | StephenImp/JavaBasisAndPromote | dc16504c5ec54ff6826b2d1583fe52b65966a391 | bd4991965b3add27fc22b4daf8d68c0d8da9dc03 | refs/heads/master | 2022-12-26T15:47:27.762180 | 2021-03-04T14:11:54 | 2021-03-04T14:11:54 | 150,877,893 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,113 | java | package TDemo;
import java.util.ArrayList;
import java.util.List;
/**
* Created by MOZi on 2018/12/22.
*/
public class Demo2<T> {
private T demoT;
public static void main(String[] args) {
//限制T 为String 类型
Demo2<String> demo = new Demo2<String>();
//获取string类型
List<String> array = new ArrayList<String>();
array.add("test");
array.add("doub");
String str = demo.getListFisrt(array);
System.out.println(str);
//获取Integer类型 T 为Integer类型
Demo2<Integer> demo2 = new Demo2<Integer>();
List<Integer> nums = new ArrayList<Integer>();
nums.add(12);
nums.add(13);
Integer num = demo2.getListFisrt(nums);
System.out.println(num);
}
/**
* 这个只能传递T类型的数据
* 返回值 就是Demo<T> 实例化传递的对象类型
* @param data
* @return
*/
private T getListFisrt(List<T> data) {
if (data == null || data.size() == 0) {
return null;
}
return data.get(0);
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.