blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
fb120a3e87b28dc81dd67e27564e2525ea753d36 | d5cb8620d2d115db6bb2e11431610e193cf9aed1 | /app/src/main/java/kr/ac/jejunu/ticket/data/TokenData.java | f0759168c0cdf97a1728855c13df4cc0872d4987 | [] | no_license | mrfourfour/ticket-android | 2d2257c74ce70b1f26b2153399e67fb27838c677 | 0ed747d66afe4d718bd8d96c6d606a6e73fcd2c2 | refs/heads/master | 2020-07-30T14:19:06.785877 | 2019-11-03T09:35:09 | 2019-11-03T09:35:09 | 210,121,330 | 0 | 0 | null | 2019-09-22T09:55:51 | 2019-09-22T09:25:51 | Java | UTF-8 | Java | false | false | 1,392 | java | package kr.ac.jejunu.ticket.data;
import android.media.session.MediaSession;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
public class TokenData implements Serializable {
@SerializedName("id_token")
private String id_token;
@SerializedName("access_token")
private String access_token;
@SerializedName("refresh_token")
private String refresh_token;
@SerializedName("expires_in")
private String expires_in;
public String getId_token() {
return id_token;
}
public void setId_token(String id_token) {
this.id_token = id_token;
}
public String getAccess_token() {
return access_token;
}
public void setAccess_token(String access_token) {
this.access_token = access_token;
}
public String getRefresh_token() {
return refresh_token;
}
public void setRefresh_token(String refresh_token) {
this.refresh_token = refresh_token;
}
public String getExpires_in() {
return expires_in;
}
public void setExpires_in(String expires_in) {
this.expires_in = expires_in;
}
public String getToken_type() {
return token_type;
}
public void setToken_type(String token_type) {
this.token_type = token_type;
}
@SerializedName("token_type")
private String token_type;
}
| [
"rlatngus6663@gmail.com"
] | rlatngus6663@gmail.com |
c9f888a1422d86ef13e894e139c20e2a0735d275 | fefa2f7638b4bcc4d91917bb5065531a7a5414e6 | /app/src/main/java/com/example/demo/Dao/MyWindowManager.java | c11f9860227c38655d9ceb2f3e692c2a3a376267 | [] | no_license | missingbobo/Demo | a4579e9cb1d02a0ee4ebc8d8e6ab96ecf8f30474 | aeee6e7a43c67ef7d19b6c9da44a0cc8914c53e0 | refs/heads/master | 2020-07-01T12:38:08.187118 | 2019-09-22T05:10:48 | 2019-09-22T05:10:48 | 201,177,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,865 | java | package com.example.demo.Dao;
import android.content.Context;
import android.graphics.PixelFormat;
import android.view.Gravity;
import android.view.WindowManager;
import com.example.demo.View.FloatSmallWindow;
public class MyWindowManager {
private static WindowManager mWindowManager;
private static FloatSmallWindow smallWindow;
private static WindowManager.LayoutParams layoutParams;
public static void createWindow(Context context) {
WindowManager windowManager = getWindowManager(context);
int screenWidth = windowManager.getDefaultDisplay().getWidth();
int screenHeight = windowManager.getDefaultDisplay().getHeight();
if (smallWindow == null) {
smallWindow = new FloatSmallWindow(context);
if (layoutParams == null) {
layoutParams = new WindowManager.LayoutParams();
layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
layoutParams.format = PixelFormat.RGBA_8888;
layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
layoutParams.gravity = Gravity.LEFT | Gravity.TOP;
layoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
layoutParams.x = screenWidth;
layoutParams.y = screenHeight / 2;
}
smallWindow.setParams(layoutParams);
windowManager.addView(smallWindow, layoutParams);
}
}
private static WindowManager getWindowManager(Context context) {
if (mWindowManager == null) {
mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
}
return mWindowManager;
}
}
| [
"yuzhenbo@octinn.com"
] | yuzhenbo@octinn.com |
e3a814ce3fad5ef022df22946c3496339edc8398 | bcfbfb16d714cd0fc58d34e66e0b2054d8ced0e5 | /guns-base-support/guns-base/src/main/java/cn/stylefeng/guns/base/pojo/node/ZTreeNode.java | 449626096e8a05ed07997f16bb4873ac36f62804 | [] | no_license | kongxiang1234/guns | 55f7889ba71eec67c571492b1db582f5456d88aa | 3dd3ba7de50492fa664c72234f1157d7b1f8646b | refs/heads/master | 2022-12-18T14:22:07.482471 | 2020-09-19T02:28:59 | 2020-09-19T02:28:59 | 293,557,315 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,960 | java | /**
* Copyright 2018-2020 stylefeng & fengshuonan (https://gitee.com/stylefeng)
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 cn.stylefeng.guns.base.pojo.node;
import lombok.Data;
/**
* jquery ztree 插件的节点
*
* @author fengshuonan
* @date 2017年2月17日 下午8:25:14
*/
@Data
public class ZTreeNode {
/**
* 节点id
*/
private Long id;
/**
* 父节点id
*/
private Long pId;
/**
* 节点名称
*/
private String name;
/**
* 是否打开节点
*/
private Boolean open;
/**
* 是否被选中
*/
private Boolean checked;
/**
* 节点图标 single or group
*/
private String iconSkin;
/**
* 创建ztree的父级节点
*
* @author fengshuonan
* @Date 2018/12/23 4:51 PM
*/
public static ZTreeNode createParent() {
ZTreeNode zTreeNode = new ZTreeNode();
zTreeNode.setChecked(false);
zTreeNode.setId(0L);
zTreeNode.setName("组织机构");
zTreeNode.setOpen(true);
zTreeNode.setPId(0L);
return zTreeNode;
}
public static ZTreeNode createParents() {
ZTreeNode zTreeNode = new ZTreeNode();
zTreeNode.setChecked(false);
zTreeNode.setId(0L);
zTreeNode.setName("组织机构");
zTreeNode.setOpen(true);
zTreeNode.setPId(0L);
return zTreeNode;
}
}
| [
"1124498879@qq.com"
] | 1124498879@qq.com |
6036240493a832e7d547559dcde00c934985e31f | e9cef51fe584af60bd5419f9792a9a40bbb6d88b | /src/main/java/com/example/demo/repository/InquiryDaoImpl.java | 0fef43014b5251298f1a742e192ce05401e2a4ed | [] | no_license | TakaOhara/springBeginnerAnswer | 254eb025e705093c06b482c67a77967a3e02bbd7 | 9376f331988cc29efbcd3a0448344942cf59c1a9 | refs/heads/master | 2020-06-03T20:34:32.235099 | 2019-06-13T06:13:00 | 2019-06-13T06:13:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,787 | java | package com.example.demo.repository;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import com.example.demo.entity.Inquiry;
@Repository
public class InquiryDaoImpl implements InquiryDao{
private final JdbcTemplate jdbcTemplate;
@Autowired
public InquiryDaoImpl(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
@Override
public int insertInquiry(Inquiry inquiry) {
return jdbcTemplate.update("INSERT INTO inquiry(name, email, contents, created) VALUES(?, ?, ?, ?)",
inquiry.getName(), inquiry.getEmail(), inquiry.getContents(), inquiry.getCreated() );
}
@Override
public int updateInquiry(Inquiry inquiry) {
return jdbcTemplate.update("UPDATE inquiry SET name = ?, email = ?,contents = ? WHERE id = ?",
inquiry.getName(), inquiry.getEmail(), inquiry.getContents(), inquiry.getId() );
}
@Override
public List<Inquiry> getAll() {
String sql = "SELECT id, name, email, contents, created FROM inquiry";
List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql);
List<Inquiry> list = new ArrayList<Inquiry>();
for(Map<String, Object> result : resultList) {
Inquiry inquiry = new Inquiry();
inquiry.setId((int)result.get("id"));
inquiry.setName((String)result.get("name"));
inquiry.setEmail((String)result.get("email"));
inquiry.setContents((String)result.get("contents"));
inquiry.setCreated(((Timestamp) result.get("created")).toLocalDateTime());
list.add(inquiry);
}
return list;
}
} | [
"elproj@trainocate.co.jp"
] | elproj@trainocate.co.jp |
c237aa8fcdbd54bc2f6c637f1c3c8ac365656b46 | 27dcf5888b23647ddd4fdc6105e025a5d1fe691c | /taotao-manager/taotao-manager-service/src/main/java/com/taotao/service/impl/ContentServiceImpl.java | a6b6b319a9354672b850d1b9730bf46a6ffdf6a8 | [] | no_license | jarvisxiong/taotao | 5be67f883a13f3ce989eb84a44dfa38d175847fc | 5acb3868f99f043aeb9abba191de4012560d1e81 | refs/heads/master | 2021-01-21T12:35:40.487626 | 2016-06-11T09:58:58 | 2016-06-11T09:58:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,929 | java | package com.taotao.service.impl;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.taotao.common.entity.EUDataGridResult;
import com.taotao.common.entity.TaotaoResult;
import com.taotao.common.util.HttpClientUtil;
import com.taotao.entity.TbContent;
import com.taotao.entity.TbContentExample;
import com.taotao.entity.TbContentExample.Criteria;
import com.taotao.mapper.TbContentMapper;
import com.taotao.service.ContentService;
/**
*内容管理
*/
@Service
public class ContentServiceImpl implements ContentService {
@Autowired
private TbContentMapper contentMapper;
@Value("${REST_BASE_URL}")
private String REST_BASE_URL;
@Value("${REST_CONTENT_SYNC_URL}")
private String REST_CONTENT_SYNC_URL;
@Override
public EUDataGridResult getContentList(long categoryId, Integer page, Integer rows) {
TbContentExample example = new TbContentExample();
Criteria criteria = example.createCriteria();
criteria.andCategoryIdEqualTo(categoryId);
PageHelper.startPage(page, rows);
List<TbContent> list = contentMapper.selectByExample(example);
EUDataGridResult result = new EUDataGridResult();
result.setRows(list);
PageInfo<TbContent> pageInfo = new PageInfo<TbContent>(list);
result.setTotal(pageInfo.getTotal());
return result;
}
@Override
public TaotaoResult insertContent(TbContent content) {
//补全entity内容
content.setCreated(new Date());
content.setUpdated(new Date());
contentMapper.insert(content);
//添加缓存同步逻辑
try {
HttpClientUtil.doGet(REST_BASE_URL + REST_CONTENT_SYNC_URL + content.getCategoryId());
} catch (Exception e) {
e.printStackTrace();
}
return TaotaoResult.ok();
}
}
| [
"15201105502@163.com"
] | 15201105502@163.com |
8ed2203ec7ecca12bad5095756dc2552d129b6b7 | 0e5121033cba22d6fefd8bacd88d7130b49a8719 | /WebAppAdministracionEscolar/src/java/com/lusadi/utils/converter/TipoSangreConverterJSF.java | b33daea9d0dd565b4d8156ad57ff1bd160661198 | [] | no_license | juansebasv/Admin-School-test | a90fde26ec1545ed41739761fa5a388c008c88dd | 175a9ca15b4a405e956297bb46fbbf6ad9ba62c6 | refs/heads/master | 2023-09-05T17:26:46.654314 | 2021-11-16T01:17:57 | 2021-11-16T01:17:57 | 428,474,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,476 | 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 com.lusadi.utils.converter;
import com.lusadi.entities.Cargo;
import com.lusadi.entities.TipoSangre;
import java.util.Iterator;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
import javax.faces.model.SelectItem;
/**
*
* @author andresfelipegarciaduran
*/
@FacesConverter("tipoSangreConverterJSF")
public class TipoSangreConverterJSF implements Converter {
@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
if (value == null || value.isEmpty() || value.trim().equals("")) {
return null;
} else {
// Iterator<SelectItem> items = AbstractConvertJsf.getUtilConvertJsf().createSelectItems(component).iterator();
// return AbstractConvertJsf.getUtilConvertJsf().findValueByStringConversion(context, component, items, value, this);
return value;
}
}
@Override
public String getAsString(FacesContext context, UIComponent component, Object value) {
if (value == null || value.equals("")) {
return "";
} else {
return String.valueOf(((TipoSangre) value).getTipoSangre());
}
}
}
| [
"jzebas94@gmail.com"
] | jzebas94@gmail.com |
2f3e58c856e71e6ff710daddffd69f52187b9efb | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/9/9_fbe6b9c730f415f37869abe61aea117a1ea8084a/PerfTestRunnable/9_fbe6b9c730f415f37869abe61aea117a1ea8084a_PerfTestRunnable_s.java | f3b04f3930bfc57b4dcfbec5be1fd9d03af7a869 | [] | 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 | 20,535 | java | /*
* 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.ngrinder.perftest.service;
import net.grinder.SingleConsole;
import net.grinder.SingleConsole.ConsoleShutdownListener;
import net.grinder.StopReason;
import net.grinder.common.GrinderProperties;
import net.grinder.console.model.ConsoleProperties;
import net.grinder.util.ListenerHelper;
import net.grinder.util.ListenerSupport;
import net.grinder.util.UnitUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.time.DateUtils;
import org.ngrinder.common.constant.ControllerConstants;
import org.ngrinder.extension.OnTestLifeCycleRunnable;
import org.ngrinder.extension.OnTestSamplingRunnable;
import org.ngrinder.infra.config.Config;
import org.ngrinder.infra.plugin.PluginManager;
import org.ngrinder.infra.schedule.ScheduledTaskService;
import org.ngrinder.model.PerfTest;
import org.ngrinder.model.Status;
import org.ngrinder.perftest.model.NullSingleConsole;
import org.ngrinder.perftest.service.samplinglistener.*;
import org.ngrinder.script.handler.ScriptHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.io.File;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import static org.apache.commons.lang.ObjectUtils.defaultIfNull;
import static org.ngrinder.common.constant.ClusterConstants.PROP_CLUSTER_SAFE_DIST;
import static org.ngrinder.common.util.AccessUtils.getSafe;
import static org.ngrinder.model.Status.*;
/**
* {@link PerfTest} run scheduler.
* <p/>
* This class is responsible to execute/finish the performance test. The job is
* started from {@link #doStart()} and {@link #doFinish()} method. These
* methods are scheduled by Spring Task.
*
* @author JunHo Yoon
* @since 3.0
*/
@Profile("production")
@Component
public class PerfTestRunnable implements ControllerConstants {
private static final Logger LOG = LoggerFactory.getLogger(PerfTestRunnable.class);
@SuppressWarnings("SpringJavaAutowiringInspection")
@Autowired
private PerfTestService perfTestService;
@Autowired
private ConsoleManager consoleManager;
@Autowired
private AgentManager agentManager;
@Autowired
private PluginManager pluginManager;
@Autowired
private Config config;
@Autowired
private ScheduledTaskService scheduledTaskService;
private Runnable startRunnable;
private Runnable finishRunnable;
@PostConstruct
public void init() {
// Clean up db first.
doFinish(true);
this.startRunnable = new Runnable() {
@Override
public void run() {
startPeriodically();
}
};
scheduledTaskService.addFixedDelayedScheduledTask(startRunnable, PERFTEST_RUN_FREQUENCY_MILLISECONDS);
this.finishRunnable = new Runnable() {
@Override
public void run() {
finishPeriodically();
}
};
scheduledTaskService.addFixedDelayedScheduledTask(finishRunnable, PERFTEST_RUN_FREQUENCY_MILLISECONDS);
}
@PreDestroy
public void destroy() {
scheduledTaskService.removeScheduledJob(this.startRunnable);
scheduledTaskService.removeScheduledJob(this.finishRunnable);
}
/**
* Scheduled method for test execution. This method dispatches the test
* candidates and run one of them. This method is responsible until a test
* is executed.
*/
public void startPeriodically() {
doStart();
}
void doStart() {
if (config.hasNoMoreTestLock()) {
return;
}
// Block if the count of testing exceed the limit
if (canExecuteMore()) {
// LOG MORE
List<PerfTest> currentlyRunningTests = perfTestService.getCurrentlyRunningTest();
LOG.debug("Currently running test is {}. No more tests can not run.", currentlyRunningTests.size());
return;
}
// Find out next ready perftest
PerfTest runCandidate = getRunnablePerfTest();
if (runCandidate == null) {
return;
}
if (!isScheduledNow(runCandidate)) {
// this test project is reserved,but it isn't yet going to run test
// right now.
return;
}
if (!hasEnoughFreeAgents(runCandidate)) {
return;
}
doTest(runCandidate);
}
private PerfTest getRunnablePerfTest() {
return perfTestService.getNextRunnablePerfTestPerfTestCandidate();
}
private boolean canExecuteMore() {
return consoleManager.getConsoleInUse().size() >= perfTestService.getMaximumConcurrentTestCount();
}
private boolean isScheduledNow(PerfTest test) {
Date current = new Date();
Date scheduledDate = DateUtils
.truncate((Date) defaultIfNull(test.getScheduledTime(), current), Calendar.MINUTE);
return current.after(scheduledDate);
}
/**
* Check the free agent availability for the given {@link PerfTest}.
*
* @param test {@link PerfTest}
* @return true if enough agents
*/
protected boolean hasEnoughFreeAgents(PerfTest test) {
int size = agentManager.getAllFreeApprovedAgentsForUser(test.getCreatedUser()).size();
if (test.getAgentCount() != null && test.getAgentCount() > size) {
perfTestService.markProgress(test, "The test is tried to execute but there is not enough free agents."
+ "\n- Current free agent count : " + size + " / Requested : " + test.getAgentCount() + "\n");
return false;
}
return true;
}
/**
* Run the given test.
* <p/>
* If fails, it marks STOP_BY_ERROR in the given {@link PerfTest} status
*
* @param perfTest perftest instance;
*/
public void doTest(final PerfTest perfTest) {
SingleConsole singleConsole = null;
try {
singleConsole = startConsole(perfTest);
ScriptHandler prepareDistribution = perfTestService.prepareDistribution(perfTest);
GrinderProperties grinderProperties = perfTestService.getGrinderProperties(perfTest, prepareDistribution);
startAgentsOn(perfTest, grinderProperties, checkCancellation(singleConsole));
distributeFileOn(perfTest, checkCancellation(singleConsole));
singleConsole.setReportPath(perfTestService.getReportFileDirectory(perfTest));
runTestOn(perfTest, grinderProperties, checkCancellation(singleConsole));
} catch (SingleConsoleCancellationException ex) {
// In case of error, mark the occurs error on perftest.
doCancel(perfTest, singleConsole);
notifyFinish(perfTest, StopReason.CANCEL_BY_USER);
} catch (Exception e) {
// In case of error, mark the occurs error on perftest.
LOG.error("Error while executing test: {} - {} ", perfTest.getTestIdentifier(), e.getMessage());
LOG.debug("Stack Trace is : ", e);
doTerminate(perfTest, singleConsole);
notifyFinish(perfTest, StopReason.ERROR_WHILE_PREPARE);
}
}
/**
* Check the cancellation status on console.
*
* @param singleConsole console
* @return true if cancellation is requested.
*/
SingleConsole checkCancellation(SingleConsole singleConsole) {
if (singleConsole.isCanceled()) {
throw new SingleConsoleCancellationException("Single Console " + singleConsole.getConsolePort()
+ " is canceled");
}
return singleConsole;
}
/**
* Start a console for given {@link PerfTest}.
*
* @param perfTest perftest
* @return started console
*/
SingleConsole startConsole(PerfTest perfTest) {
perfTestService.markStatusAndProgress(perfTest, START_CONSOLE, "Console is being prepared.");
// get available consoles.
ConsoleProperties consoleProperty = perfTestService.createConsoleProperties(perfTest);
SingleConsole singleConsole = consoleManager.getAvailableConsole(consoleProperty);
singleConsole.start();
perfTestService.markPerfTestConsoleStart(perfTest, singleConsole.getConsolePort());
return singleConsole;
}
/**
* Distribute files to agents.
*
* @param perfTest perftest
* @param singleConsole console to be used.
*/
void distributeFileOn(final PerfTest perfTest, SingleConsole singleConsole) {
// Distribute files
perfTestService.markStatusAndProgress(perfTest, DISTRIBUTE_FILES, "All necessary files are being distributed.");
ListenerSupport<SingleConsole.FileDistributionListener> listener = ListenerHelper.create();
final int safeThreadHold = getSafeTransmissionThreshold();
listener.add(new SingleConsole.FileDistributionListener() {
@Override
public void distributed(String fileName) {
perfTestService.markProgress(perfTest, " - " + fileName);
}
@Override
public boolean start(File dir, boolean safe) {
if (safe) {
perfTestService.markProgress(perfTest, "Safe file distribution mode is enabled.");
return safe;
}
long sizeOfDirectory = FileUtils.sizeOfDirectory(dir);
if (sizeOfDirectory > safeThreadHold) {
perfTestService.markProgress(perfTest, "The total size of distributed files is over "
+ UnitUtils.byteCountToDisplaySize(safeThreadHold) + "B.\n- Safe file distribution mode is enabled by force.");
return true;
}
return safe;
}
});
// the files have prepared before
singleConsole.distributeFiles(perfTestService.getDistributionPath(perfTest), listener,
isSafeDistPerfTest(perfTest));
perfTestService.markStatusAndProgress(perfTest, DISTRIBUTE_FILES_FINISHED,
"All necessary files are distributed.");
}
protected int getSafeTransmissionThreshold() {
// For backward compatibility
return config.getControllerProperties().getPropertyInt(PROP_CONTROLLER_SAFE_DIST_THRESHOLD);
}
private boolean isSafeDistPerfTest(final PerfTest perfTest) {
boolean safeDist = getSafe(perfTest.getSafeDistribution());
if (config.isClustered()) {
safeDist = config.getClusterProperties().getPropertyBoolean(PROP_CLUSTER_SAFE_DIST);
}
return safeDist;
}
/**
* Start agents for the given {@link PerfTest}.
*
* @param perfTest perftest
* @param grinderProperties grinder properties
* @param singleConsole console to be used.
*/
void startAgentsOn(PerfTest perfTest, GrinderProperties grinderProperties, SingleConsole singleConsole) {
perfTestService.markStatusAndProgress(perfTest, START_AGENTS, getSafe(perfTest.getAgentCount())
+ " agents are starting.");
agentManager.runAgent(perfTest.getCreatedUser(), singleConsole, grinderProperties,
getSafe(perfTest.getAgentCount()));
singleConsole.waitUntilAgentConnected(perfTest.getAgentCount());
perfTestService.markStatusAndProgress(perfTest, START_AGENTS_FINISHED, getSafe(perfTest.getAgentCount())
+ " agents are ready.");
}
/**
* Run a given {@link PerfTest} with the given {@link GrinderProperties} and
* the {@link SingleConsole} .
*
* @param perfTest perftest
* @param grinderProperties grinder properties
* @param singleConsole console to be used.
*/
void runTestOn(final PerfTest perfTest, GrinderProperties grinderProperties, final SingleConsole singleConsole) {
// start target monitor
for (OnTestLifeCycleRunnable run : pluginManager.getEnabledModulesByClass(OnTestLifeCycleRunnable.class)) {
run.start(perfTest, perfTestService, config.getVersion());
}
// Run test
perfTestService.markStatusAndProgress(perfTest, START_TESTING, "The test is ready to start.");
// Add listener to detect abnormal condition and mark the perfTest
singleConsole.addListener(new ConsoleShutdownListener() {
@Override
public void readyToStop(StopReason stopReason) {
perfTestService.markAbnormalTermination(perfTest, stopReason);
LOG.error("Abnormal test {} due to {}", perfTest.getId(), stopReason.name());
}
});
long startTime = singleConsole.startTest(grinderProperties);
perfTest.setStartTime(new Date(startTime));
addSamplingListeners(perfTest, singleConsole);
perfTestService.markStatusAndProgress(perfTest, TESTING, "The test is started.");
singleConsole.startSampling();
}
protected void addSamplingListeners(final PerfTest perfTest, final SingleConsole singleConsole) {
// Add SamplingLifeCycleListener
singleConsole.addSamplingLifeCyleListener(new PerfTestSamplingCollectorListener(singleConsole,
perfTest.getId(), perfTestService, scheduledTaskService));
singleConsole.addSamplingLifeCyleListener(new AgentLostDetectionListener(singleConsole, perfTest,
perfTestService, scheduledTaskService));
List<OnTestSamplingRunnable> testSamplingPlugins = pluginManager.getEnabledModulesByClass
(OnTestSamplingRunnable.class, new MonitorCollectorPlugin(config, scheduledTaskService,
perfTestService, perfTest.getId()));
singleConsole.addSamplingLifeCyleListener(new PluginRunListener(testSamplingPlugins, singleConsole,
perfTest, perfTestService));
singleConsole.addSamplingLifeCyleListener(new AgentDieHardListener(singleConsole, perfTest, perfTestService,
agentManager, scheduledTaskService));
}
/**
* Notify test finish to plugins.
*
* @param perfTest PerfTest
* @param reason the reason of test finish..
* @see OnTestLifeCycleRunnable
*/
public void notifyFinish(PerfTest perfTest, StopReason reason) {
for (OnTestLifeCycleRunnable run : pluginManager.getEnabledModulesByClass(OnTestLifeCycleRunnable.class)) {
run.finish(perfTest, reason.name(), perfTestService, config.getVersion());
}
}
/**
* Finish the tests.(Scheduled by SpringTask)
* <p/>
* There are three types of test finish.
* <p/>
* <ul>
* <li>Abnormal test finish : when TPS is too low or too many errors occur</li>
* <li>User requested test finish : when user requested to finish the test</li>
* <li>Normal test finish : when the test reaches the planned duration and run
* count.</li>
* </ul>
*/
public void finishPeriodically() {
doFinish(false);
}
protected void doFinish(boolean initial) {
if (!initial && consoleManager.getConsoleInUse().isEmpty()) {
return;
}
doFinish();
}
void doFinish() {
for (PerfTest each : perfTestService.getAllAbnormalTesting()) {
LOG.info("Terminate {}", each.getId());
SingleConsole consoleUsingPort = consoleManager.getConsoleUsingPort(each.getPort());
doTerminate(each, consoleUsingPort);
cleanUp(each);
notifyFinish(each, StopReason.TOO_MANY_ERRORS);
}
for (PerfTest each : perfTestService.getAllStopRequested()) {
LOG.info("Stop test {}", each.getId());
SingleConsole consoleUsingPort = consoleManager.getConsoleUsingPort(each.getPort());
doCancel(each, consoleUsingPort);
cleanUp(each);
notifyFinish(each, StopReason.CANCEL_BY_USER);
}
for (PerfTest each : perfTestService.getAllTesting()) {
SingleConsole consoleUsingPort = consoleManager.getConsoleUsingPort(each.getPort());
if (isTestFinishCandidate(each, consoleUsingPort)) {
doNormalFinish(each, consoleUsingPort);
cleanUp(each);
notifyFinish(each, StopReason.NORMAL);
}
}
}
/**
* Clean up distribution directory for the given perfTest.
*
* @param perfTest perfTest
*/
private void cleanUp(PerfTest perfTest) {
perfTestService.cleanUpDistFolder(perfTest);
perfTestService.cleanUpRuntimeOnlyData(perfTest);
}
/**
* Check if the given {@link PerfTest} is ready to finish.
*
* @param perfTest perf test
* @param singleConsoleInUse singleConsole
* @return true if it's a finish candidate.
*/
private boolean isTestFinishCandidate(PerfTest perfTest, SingleConsole singleConsoleInUse) {
// Give 5 seconds to be finished
if (perfTest.isThresholdDuration()
&& singleConsoleInUse.isCurrentRunningTimeOverDuration(perfTest.getDuration())) {
LOG.debug(
"Test {} is ready to finish. Current : {}, Planned : {}",
new Object[]{perfTest.getTestIdentifier(), singleConsoleInUse.getCurrentRunningTime(),
perfTest.getDuration()});
return true;
} else if (perfTest.isThresholdRunCount()
&& singleConsoleInUse.getCurrentExecutionCount() >= perfTest.getTotalRunCount()) {
LOG.debug("Test {} is ready to finish. Current : {}, Planned : {}",
new Object[]{perfTest.getTestIdentifier(), singleConsoleInUse.getCurrentExecutionCount(),
perfTest.getTotalRunCount()});
return true;
} else if (singleConsoleInUse instanceof NullSingleConsole) {
LOG.debug("Test {} is ready to finish. Current : {}, Planned : {}",
new Object[]{perfTest.getTestIdentifier(), singleConsoleInUse.getCurrentExecutionCount(),
perfTest.getTotalRunCount()});
return true;
}
return false;
}
/**
* Cancel the given {@link PerfTest}.
*
* @param perfTest {@link PerfTest} to be canceled.
* @param singleConsoleInUse {@link SingleConsole} which is being used for the given
* {@link PerfTest}
*/
public void doCancel(PerfTest perfTest, SingleConsole singleConsoleInUse) {
LOG.info("Cancel test {} by user request.", perfTest.getId());
singleConsoleInUse.unregisterSampling();
try {
perfTestService.markProgressAndStatusAndFinishTimeAndStatistics(perfTest, CANCELED,
"Stop requested by user");
} catch (Exception e) {
LOG.error("Error while canceling test {} : {}", perfTest.getId(), e.getMessage());
LOG.debug("Details : ", e);
}
consoleManager.returnBackConsole(perfTest.getTestIdentifier(), singleConsoleInUse);
}
/**
* Terminate the given {@link PerfTest}.
*
* @param perfTest {@link PerfTest} to be finished
* @param singleConsoleInUse {@link SingleConsole} which is being used for the given
* {@link PerfTest}
*/
public void doTerminate(PerfTest perfTest, SingleConsole singleConsoleInUse) {
singleConsoleInUse.unregisterSampling();
try {
perfTestService.markProgressAndStatusAndFinishTimeAndStatistics(perfTest, Status.STOP_BY_ERROR,
"Stopped by error");
} catch (Exception e) {
LOG.error("Error while terminating {} : {}", perfTest.getTestIdentifier(), e.getMessage());
LOG.debug("Details : ", e);
}
consoleManager.returnBackConsole(perfTest.getTestIdentifier(), singleConsoleInUse);
}
/**
* Finish the given {@link PerfTest}.
*
* @param perfTest {@link PerfTest} to be finished
* @param singleConsoleInUse {@link SingleConsole} which is being used for the given
* {@link PerfTest}
*/
public void doNormalFinish(PerfTest perfTest, SingleConsole singleConsoleInUse) {
LOG.debug("PerfTest {} status - currentRunningTime {} ", perfTest.getId(),
singleConsoleInUse.getCurrentRunningTime());
singleConsoleInUse.unregisterSampling();
try {
// stop target host monitor
if (perfTestService.hasTooManError(perfTest)) {
perfTestService.markProgressAndStatusAndFinishTimeAndStatistics(perfTest, Status.STOP_BY_ERROR,
"[WARNING] The test is finished but contains too much errors(over 30% of total runs).");
} else if (singleConsoleInUse.hasNoPerformedTest()) {
perfTestService.markProgressAndStatusAndFinishTimeAndStatistics(perfTest, Status.STOP_BY_ERROR,
"[WARNING] The test is finished but has no TPS.");
} else {
perfTestService.markProgressAndStatusAndFinishTimeAndStatistics(perfTest, Status.FINISHED,
"The test is successfully finished.");
}
} catch (Exception e) {
perfTestService.markStatusAndProgress(perfTest, Status.STOP_BY_ERROR, e.getMessage());
LOG.error("Error while finishing {} : {}", perfTest.getTestIdentifier(), e.getMessage());
LOG.debug("Details : ", e);
}
consoleManager.returnBackConsole(perfTest.getTestIdentifier(), singleConsoleInUse);
}
public PerfTestService getPerfTestService() {
return perfTestService;
}
public AgentManager getAgentManager() {
return agentManager;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
040222828260f559b6925df41640e5b2084ea0c1 | b4aa4ca1f394b88d4bb61c40fc618f2915ac07e8 | /src/test/java/com/gargoylesoftware/htmlunit/html/HtmlPasswordInputTest.java | cd6279c1e964df3fd504ae55d0f141944a502783 | [
"Apache-2.0"
] | permissive | antkozak/htmlunit | 2cb75e72e1563c4aee7a9a550aaba621c06c1707 | 25b03c6a52ec407fe2e9e967d5f9678d0b15e4a4 | refs/heads/master | 2021-01-19T11:16:15.632127 | 2011-09-12T12:37:21 | 2011-09-12T12:37:21 | 2,354,883 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,482 | java | /*
* Copyright (c) 2002-2011 Gargoyle Software 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.gargoylesoftware.htmlunit.html;
import java.util.Collections;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.openqa.selenium.By;
import org.openqa.selenium.InvalidElementStateException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import com.gargoylesoftware.htmlunit.BrowserRunner;
import com.gargoylesoftware.htmlunit.WebDriverTestCase;
/**
* Tests for {@link HtmlPasswordInput}.
*
* @version $Revision: 6479 $
* @author Ahmed Ashour
*/
@RunWith(BrowserRunner.class)
public class HtmlPasswordInputTest extends WebDriverTestCase {
/**
* @throws Exception if the test fails
*/
@Test
public void type() throws Exception {
final String html = "<html><head></head><body><input type='password' id='p'/></body></html>";
final WebDriver driver = loadPage2(html);
final WebElement p = driver.findElement(By.id("p"));
p.sendKeys("abc");
assertEquals("abc", p.getAttribute("value"));
p.sendKeys("\b");
assertEquals("ab", p.getAttribute("value"));
p.sendKeys("\b");
assertEquals("a", p.getAttribute("value"));
p.sendKeys("\b");
assertEquals("", p.getAttribute("value"));
p.sendKeys("\b");
assertEquals("", p.getAttribute("value"));
}
/**
* @throws Exception if the test fails
*/
@Test
public void typeWhileDisabled() throws Exception {
final String html = "<html><body><input type='password' id='p' disabled='disabled'/></body></html>";
final WebDriver driver = loadPage2(html);
final WebElement p = driver.findElement(By.id("p"));
try {
p.sendKeys("abc");
Assert.fail();
}
catch (final InvalidElementStateException e) {
// as expected
}
assertEquals("", p.getAttribute("value"));
}
/**
* How could this test be migrated to WebDriver? How to select the field's content?
* @throws Exception if an error occurs
*/
@Test
public void typeWhileSelected() throws Exception {
final String html =
"<html><head></head><body>\n"
+ "<input type='password' id='myInput' value='Hello world'><br>\n"
+ "</body></html>";
final HtmlPage page = loadPage(getBrowserVersion(), html, null);
final HtmlPasswordInput input = page.getHtmlElementById("myInput");
input.select();
input.type("Bye World");
assertEquals("Bye World", input.getValueAttribute());
}
/**
* @throws Exception if an error occurs
*/
@Test
public void preventDefault_OnKeyDown() throws Exception {
final String html =
"<html><head><script>\n"
+ " function handler(e) {\n"
+ " if (e && e.target.value.length > 2)\n"
+ " e.preventDefault();\n"
+ " else if (!e && window.event.srcElement.value.length > 2)\n"
+ " return false;\n"
+ " }\n"
+ " function init() {\n"
+ " document.getElementById('p').onkeydown = handler;\n"
+ " }\n"
+ "</script></head>\n"
+ "<body onload='init()'>\n"
+ "<input type='password' id='p'></input>\n"
+ "</body></html>";
final WebDriver driver = loadPage2(html);
final WebElement p = driver.findElement(By.id("p"));
p.sendKeys("abcd");
assertEquals("abc", p.getAttribute("value"));
}
/**
* @throws Exception if an error occurs
*/
@Test
public void preventDefault_OnKeyPress() throws Exception {
final String html =
"<html><head><script>\n"
+ " function handler(e) {\n"
+ " if (e && e.target.value.length > 2)\n"
+ " e.preventDefault();\n"
+ " else if (!e && window.event.srcElement.value.length > 2)\n"
+ " return false;\n"
+ " }\n"
+ " function init() {\n"
+ " document.getElementById('p').onkeypress = handler;\n"
+ " }\n"
+ "</script></head>\n"
+ "<body onload='init()'>\n"
+ "<input type='password' id='p'></input>\n"
+ "</body></html>";
final WebDriver driver = loadPage2(html);
final WebElement p = driver.findElement(By.id("p"));
p.sendKeys("abcd");
assertEquals("abc", p.getAttribute("value"));
}
/**
* @throws Exception if an error occurs
*/
@Test
public void typeOnChange() throws Exception {
final String html =
"<html><head></head><body>\n"
+ "<input type='password' id='p' value='Hello world'"
+ " onChange='alert(\"foo\");alert(event.type);'"
+ " onBlur='alert(\"boo\");alert(event.type);'"
+ "><br>\n"
+ "<button id='b'>some button</button>\n"
+ "</body></html>";
final WebDriver driver = loadPage2(html);
final WebElement p = driver.findElement(By.id("p"));
p.sendKeys("HtmlUnit");
assertEquals(Collections.emptyList(), getCollectedAlerts(driver));
// trigger lost focus
driver.findElement(By.id("b")).click();
final String[] expectedAlerts1 = {"foo", "change", "boo", "blur"};
assertEquals(expectedAlerts1, getCollectedAlerts(driver));
// set only the focus but change nothing
p.click();
assertEquals(expectedAlerts1, getCollectedAlerts(driver));
// trigger lost focus
driver.findElement(By.id("b")).click();
final String[] expectedAlerts2 = {"foo", "change", "boo", "blur", "boo", "blur"};
assertEquals(expectedAlerts2, getCollectedAlerts(driver));
}
}
| [
"antkozak@gmail.com"
] | antkozak@gmail.com |
a711c01eed8cea80dee8b088c18437503e85f1dd | 4315fa2cdfbba261aec5d23794b65a36b6f8059a | /app/src/main/java/com/bjxapp/worker/http/keyboard/commonutils/CommonUtilsEnv.java | 6c77238e30f8091fe77eb5e678d1f9cf4319ab25 | [] | no_license | diaodiao088/bjx | 9f805c4c28af894dad3b89a63581c9d021a516e1 | c9ff1d4e1112e40faaf23f0ff8e6b23d313e64f5 | refs/heads/master | 2020-03-31T07:29:10.754426 | 2018-11-28T11:19:02 | 2018-11-28T11:19:02 | 152,023,106 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,131 | java | package com.bjxapp.worker.http.keyboard.commonutils;
import android.app.ActivityManager;
import android.content.Context;
import android.os.Build;
import android.os.LocaleList;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import com.bjxapp.worker.http.keyboard.CommonUtils;
import java.io.File;
public final class CommonUtilsEnv {
private static CommonUtilsEnv sCommonUtilsEnv;
private final Context mContext;
private final String mProcessName;
private int mProcessType;
public static boolean sDEBUG = false;
private String mCountryCode = "";
public static CommonUtilsEnv getInstance() {
return sCommonUtilsEnv;
}
public static synchronized CommonUtilsEnv createInstance(Context application) {
if (sCommonUtilsEnv == null || sCommonUtilsEnv.mContext == null) {
int processType = ProcessType.MAIN;
String process = CommonUtils.getProcessName();
if (application != null) {
processType = ProcessType.getProcessType(process, application.getPackageName());
}
sCommonUtilsEnv = new CommonUtilsEnv(application, processType, process);
}
return sCommonUtilsEnv;
}
private CommonUtilsEnv(Context application, int processType, String processName) {
mContext = application;
mProcessType = processType;
mProcessName = processName;
KSystemUtils.init(mContext);
KSystemUtils.initSysSettings(mContext);
// DimenUtils.init(mContext.getResources());
ThreadManager.startup();
}
public Context getApplicationContext() {
return mContext;
}
public int getProcessType() {
return mProcessType;
}
public String getProcessName() {
return mProcessName;
}
public boolean isLowRamDevice() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
return ((ActivityManager) getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE)).isLowRamDevice();
}
return true;
}
public String getCountryCode() {
if (mContext == null) {
return null;
}
if (!TextUtils.isEmpty(mCountryCode)) {
return mCountryCode;
}
String countryCode = null;
try {
if (Build.VERSION.SDK_INT >= 24) {
LocaleList locales = mContext.getResources().getConfiguration().getLocales();
if (locales != null && locales.size() > 0) {
countryCode = locales.get(0).getCountry();
}
} else {
countryCode = mContext.getResources().getConfiguration().locale.getCountry();
}
} catch (Throwable t) {
t.printStackTrace();
try {
if (TextUtils.isEmpty(countryCode)) {
TelephonyManager telephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
countryCode = telephonyManager.getSimCountryIso();
}
} catch (Throwable t1) {
t1.printStackTrace();
}
} finally {
if (!TextUtils.isEmpty(countryCode)) {
mCountryCode = countryCode;
}
}
return countryCode;
}
private static final String KEY_GDPR_AGREED = "gdpr_agreed";
private static boolean sIsGDPRAgreed = true;
public static boolean updateGDPRAgreed(boolean defaultValue) {
String s = FileUtils.stringFromFile(new File(CommonUtilsEnv.getInstance().getApplicationContext().getFilesDir(), KEY_GDPR_AGREED));
sIsGDPRAgreed = TextUtils.isEmpty(s) ? defaultValue : s.equals("1");
return sIsGDPRAgreed;
}
public static void setGDPRAgreed(boolean agreed) {
FileUtils.stringToFile(agreed ? "1" : "0", new File(CommonUtilsEnv.getInstance().getApplicationContext().getFilesDir(), KEY_GDPR_AGREED));
sIsGDPRAgreed = agreed;
}
public static boolean canReportGDPR() {
return sIsGDPRAgreed;
}
}
| [
"zhangdan@cmcm.com"
] | zhangdan@cmcm.com |
e7db50b6f7eccf2824949ecc5288bd5dd9eed8ac | 99d7acac28c99725f1570ed38781b8e19d41e608 | /app/src/main/java/com/wl/atomsparenting/activity/SearchActivity.java | 9226a1fd203a9595ebc8a5be2a1126d1752370e1 | [] | no_license | lixin318089/Atomsparenting | 793ef415a4d4e32eada104c648fd86c9ebe560d5 | c6a85dca269dad56b71bc06f5d8bd0c26ffc1dc7 | refs/heads/master | 2021-01-19T23:19:41.066050 | 2017-04-21T08:32:47 | 2017-04-21T08:32:47 | 88,955,389 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,452 | java | package com.wl.atomsparenting.activity;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
import com.wl.atomsparenting.R;
import java.util.Timer;
import java.util.TimerTask;
/**
* Created by le on 2017/4/12.
*/
public class SearchActivity extends Activity {
private EditText edittext;
private TextView textview;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.searchactivity);
edittext = (EditText) findViewById(R.id.search_edittext);
textview = (TextView) findViewById(R.id.search_cancle);
textview.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
//调用软键盘
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
}
}, 100);
}
}
| [
"wangle1109@outlook.com"
] | wangle1109@outlook.com |
cdfa8a74a33ff7067bb61a1587be5880297357cc | e31a143203c82d4dcaa74a7d585a4d706328ce4e | /src/main/java/org/genfork/integration/service/monitoring/MonitoringService.java | d0b897903ad95a78499a3f09126434e1d775b374 | [] | no_license | GenCloud/sample-integration | c50992fe810cdc0e84ac5f7d578841c7d542eeb2 | 9104a9c15515095e1f01dc7ed6bc3b44ad9797cd | refs/heads/master | 2022-11-12T20:25:33.753065 | 2020-07-05T16:29:24 | 2020-07-05T16:29:24 | 277,333,152 | 2 | 4 | null | null | null | null | UTF-8 | Java | false | false | 2,843 | java | package org.genfork.integration.service.monitoring;
import org.genfork.integration.model.response.metrics.ChannelStats;
import org.springframework.integration.channel.AbstractMessageChannel;
import org.springframework.integration.support.management.Statistics;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.stream.Collectors;
/**
* @author: GenCloud
* @date: 2020/07
*/
@Component
public class MonitoringService {
private final ConcurrentMap<String, List<AbstractMessageChannel>> metrics = new ConcurrentHashMap<>();
public Map<String, List<ChannelStats>> getAllMetricsData() {
final Map<String, List<ChannelStats>> stats = new HashMap<>();
metrics.forEach((streamId, list) -> stats.put(streamId, list
.stream()
.map(this::map)
.peek(ch -> ch.setStreamId(streamId))
.collect(Collectors.toList())));
return stats;
}
public List<ChannelStats> getMetrcisData(String streamId) {
final List<AbstractMessageChannel> channels = metrics.get(streamId);
if (channels != null) {
return channels
.stream()
.map(this::map)
.peek(ch -> ch.setStreamId(streamId))
.collect(Collectors.toList());
}
return Collections.emptyList();
}
private ChannelStats map(AbstractMessageChannel ch) {
final Statistics sendDuration = ch.getSendDuration();
final double maxSendDuration = ch.getMaxSendDuration();
final double minSendDuration = ch.getMinSendDuration();
final double meanSendDuration = ch.getMeanSendDuration();
final double meanSendRate = ch.getMeanSendRate();
final long sendCount = ch.getSendCountLong();
final Statistics errorRate = ch.getErrorRate();
final long sendErrorCount = ch.getSendErrorCountLong();
final double meanErrorRate = ch.getMeanErrorRate();
final double meanErrorRatio = ch.getMeanErrorRatio();
final String fullChannelName = ch.getFullChannelName();
final ChannelStats stats = new ChannelStats();
stats.setChannelName(fullChannelName);
stats.setSendDuration(sendDuration);
stats.setMaxSendDuration(maxSendDuration);
stats.setMinSendDuration(minSendDuration);
stats.setMeanSendDuration(meanSendDuration);
stats.setMeanSendRate(meanSendRate);
stats.setSendCount(sendCount);
stats.setErrorRate(errorRate);
stats.setSendErrorCount(sendErrorCount);
stats.setMeanErrorRate(meanErrorRate);
stats.setMeanErrorRatio(meanErrorRatio);
return stats;
}
public void add(String streamId, List<AbstractMessageChannel> channelDefinitions) {
if (!metrics.containsKey(streamId)) {
metrics.put(streamId, channelDefinitions);
}
}
public void remove(String streamId) {
metrics.remove(streamId);
}
}
| [
"5874251863Ab"
] | 5874251863Ab |
6cfdf45336e16851bf08451eefb7264771460def | 681d8aca436d62ef13eff314b17471d92ba8ad09 | /data-plane-api/src/main/java/io/envoyproxy/envoy/config/listener/v3/UdpDefaultWriterOptionsOrBuilder.java | 3e2d4b11e2dd6767164733fc3f0cb017bac9ee95 | [] | no_license | ayeminoosc/java-grpc-ratelimiter | 48a34e2f4ef1f74a3eb10715e77e738fd0e7f047 | e84c8b3062dbb58cd40b67f5f52cc3f031b16593 | refs/heads/master | 2023-06-14T23:11:18.337256 | 2021-07-11T19:34:01 | 2021-07-11T19:34:01 | 380,716,276 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | true | 381 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: envoy/config/listener/v3/udp_default_writer_config.proto
package io.envoyproxy.envoy.config.listener.v3;
public interface UdpDefaultWriterOptionsOrBuilder extends
// @@protoc_insertion_point(interface_extends:envoy.config.listener.v3.UdpDefaultWriterOptions)
com.google.protobuf.MessageOrBuilder {
}
| [
"ayeminoosc@gmail.com"
] | ayeminoosc@gmail.com |
9997856b00e1548f627882178e24e215cea96118 | 3fa9127925676b305dc5eb4cffe4fd4783bda6bc | /src/main/java/com/jywoo/payment/domain/validation/annotation/CardExpireDateConstraint.java | 07d223aba8d3a0d42f11e7d3d7bf2a63d669a5d1 | [] | no_license | jywoo87/payment-rest-api | f5547bba9a6cd604a9b919c8795c86880b1bdf96 | cd5d655a4f7bbbd55cebc9318710286bbf1e17e0 | refs/heads/master | 2022-12-13T02:58:18.096511 | 2020-09-11T02:49:29 | 2020-09-11T02:49:29 | 294,481,454 | 0 | 0 | null | 2020-09-11T02:49:30 | 2020-09-10T17:47:08 | Java | UTF-8 | Java | false | false | 667 | java | package com.jywoo.payment.domain.validation.annotation;
import com.jywoo.payment.domain.validation.CardExpireDateValidator;
import com.jywoo.payment.except.message.ValidationExceptionMessage;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;
@Documented
@Constraint(validatedBy = CardExpireDateValidator.class)
@Target( { ElementType.METHOD, ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
public @interface CardExpireDateConstraint {
String message() default ValidationExceptionMessage.INVALID_CARD_EXP_DATE;
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}
| [
"jywoo@sk.com"
] | jywoo@sk.com |
dbfceacbe8d9508843be6f47355b3c4051925a30 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/7/7_5f5af02fa762c3c3e29662ccbf829d949978d7e9/EdemandeService/7_5f5af02fa762c3c3e29662ccbf829d949978d7e9_EdemandeService_t.java | 4cc56b2ee7f151181a413283c717cb40c82aec8d | [] | 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 | 48,844 | java | package fr.capwebct.capdemat.plugins.externalservices.edemande.service;
import java.io.IOException;
import java.io.StringReader;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.Normalizer;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.collections.keyvalue.UnmodifiableMapEntry;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.WordUtils;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.log4j.Logger;
import org.apache.xmlbeans.XmlObject;
import org.jaxen.JaxenException;
import org.jaxen.dom.DOMXPath;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.SftpException;
import com.unilog.gda.edem.service.EnregistrerValiderFormulaireResponseDocument;
import com.unilog.gda.glob.service.GestionCompteResponseDocument;
import fr.capwebct.capdemat.plugins.externalservices.edemande.adapters.BafaGrantEdemandeRequest;
import fr.capwebct.capdemat.plugins.externalservices.edemande.adapters.EdemandeRequest;
import fr.capwebct.capdemat.plugins.externalservices.edemande.adapters.StudyGrantEdemandeRequest;
import fr.capwebct.capdemat.plugins.externalservices.edemande.webservice.client.IEdemandeClient;
import fr.cg95.cvq.business.document.Document;
import fr.cg95.cvq.business.document.DocumentBinary;
import fr.cg95.cvq.business.payment.ExternalAccountItem;
import fr.cg95.cvq.business.payment.ExternalDepositAccountItem;
import fr.cg95.cvq.business.payment.ExternalInvoiceItem;
import fr.cg95.cvq.business.payment.PurchaseItem;
import fr.cg95.cvq.business.request.Request;
import fr.cg95.cvq.business.request.RequestDocument;
import fr.cg95.cvq.business.request.RequestState;
import fr.cg95.cvq.business.request.external.RequestExternalAction;
import fr.cg95.cvq.business.request.school.StudyGrantRequest;
import fr.cg95.cvq.business.request.social.BafaGrantRequest;
import fr.cg95.cvq.business.users.FrenchRIB;
import fr.cg95.cvq.dao.IGenericDAO;
import fr.cg95.cvq.exception.CvqConfigurationException;
import fr.cg95.cvq.exception.CvqException;
import fr.cg95.cvq.exception.CvqInvalidTransitionException;
import fr.cg95.cvq.exception.CvqObjectNotFoundException;
import fr.cg95.cvq.external.ExternalServiceBean;
import fr.cg95.cvq.external.IExternalProviderService;
import fr.cg95.cvq.service.document.IDocumentService;
import fr.cg95.cvq.service.request.IRequestDocumentService;
import fr.cg95.cvq.service.request.IRequestSearchService;
import fr.cg95.cvq.service.request.IRequestWorkflowService;
import fr.cg95.cvq.service.request.external.IRequestExternalActionService;
import fr.cg95.cvq.service.users.IUserSearchService;
import fr.cg95.cvq.service.users.external.IExternalHomeFolderService;
import fr.cg95.cvq.util.Critere;
import fr.cg95.cvq.util.translation.ITranslationService;
import fr.cg95.cvq.xml.common.AddressType;
import fr.cg95.cvq.xml.common.FrenchRIBType;
import fr.cg95.cvq.xml.request.school.StudyGrantRequestDocument;
import fr.cg95.cvq.xml.request.school.impl.StudyGrantRequestDocumentImpl.StudyGrantRequestImpl;
import fr.cg95.cvq.xml.request.social.BafaGrantRequestDocument;
import fr.cg95.cvq.xml.request.social.impl.BafaGrantRequestDocumentImpl.BafaGrantRequestImpl;
public class EdemandeService implements IExternalProviderService {
private static Logger logger = Logger.getLogger(EdemandeService.class);
private String label;
private IEdemandeClient edemandeClient;
private IUserSearchService userSearchService;
private IRequestExternalActionService requestExternalActionService;
private IRequestSearchService requestSearchService;
private IRequestDocumentService requestDocumentService;
private IDocumentService documentService;
private IRequestWorkflowService requestWorkflowService;
private ITranslationService translationService;
private IExternalHomeFolderService externalHomeFolderService;
private IGenericDAO genericDAO;
private EdemandeUploader uploader;
private static final String SUBJECT_TRACE_SUBKEY = "subject";
private static final String ACCOUNT_HOLDER_TRACE_SUBKEY = "accountHolder";
private DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
private List<String> documentTypesToSend = Collections.emptyList();
private int fileMaxSize = 4*1024*1024;
@Override
public String sendRequest(XmlObject requestXml) {
EdemandeRequest request = adapt(requestXml);
if (request == null) return null;
String psCodeTiersAH = null;
if (!request.isSubjectAccountHolder()) {
psCodeTiersAH = request.getAccountHolderEdemandeId();
if (psCodeTiersAH == null || psCodeTiersAH.trim().isEmpty()) {
psCodeTiersAH = searchAccountHolder(request);
if (psCodeTiersAH == null || psCodeTiersAH.trim().isEmpty()) {
if (mustCreateAccountHolder(request)) {
createAccountHolder(request);
} else if (psCodeTiersAH != null) {
addTrace(request.getId(), ACCOUNT_HOLDER_TRACE_SUBKEY,
RequestExternalAction.Status.IN_PROGRESS,
"Le tiers viré n'est pas encore créé");
}
return null;
} else {
request.setAccountHolderEdemandeId(psCodeTiersAH);
try {
setAccountHolderEdemandeId(request, psCodeTiersAH);
} catch (CvqObjectNotFoundException e) {
// TODO
}
}
}
}
String psCodeTiersS = request.getSubjectEdemandeId();
if (psCodeTiersS == null || psCodeTiersS.trim().isEmpty()) {
// external id (code tiers) not known locally :
// either check if tiers has been created in eDemande
// either ask for its creation in eDemande
psCodeTiersS = searchSubject(request);
// add a "hack" condition when psCodeTiersS == psCodeTiersAH
// to handle homonyms until individual search accepts birth date etc.
if (psCodeTiersS == null || psCodeTiersS.trim().isEmpty() || psCodeTiersS.trim().equals(psCodeTiersAH)) {
// tiers has not been created in eDemande ...
if (mustCreateSubject(request)) {
// ... and no request in progress so ask for its creation
createSubject(request);
} else if (psCodeTiersS != null) {
// eDemande answered since psCodeTiers is not null,
// and that means psCodeTiers is empty, so tiers
// has not been created yet.
// If psCodeTiers was null, that would mean searchIndividual
// caught an exception while contacting eDemande, and
// has already added a NOT_SENT trace.
// FIXME BOR : is this trace really needed ?
addTrace(request.getId(), SUBJECT_TRACE_SUBKEY,
RequestExternalAction.Status.IN_PROGRESS,
"Le tiers sujet n'est pas encore créé");
}
return null;
} else {
// tiers has been created in eDemande, store its code locally
request.setSubjectEdemandeId(psCodeTiersS);
externalHomeFolderService.setExternalId(label, request.getHomeFolderId(),
request.getSubjectId(), psCodeTiersS);
}
}
// reaching this code means we have valid psCodeTiers (either because
// they were already set since it is not the subject and account holder's first request, or because
// searchIndividual returned the newly created tiers' psCodeTiers)
// Try to get the external ID if we don't already know it
String psCodeDemande = request.getEdemandeId();
if (psCodeDemande == null || psCodeDemande.trim().isEmpty()) {
psCodeDemande = searchRequest(request, psCodeTiersS);
if (psCodeDemande != null && !psCodeDemande.trim().isEmpty() && !"-1".equals(psCodeDemande)) {
request.setEdemandeId(psCodeDemande);
try {
setEdemandeId(request, psCodeDemande);
} catch (CvqObjectNotFoundException e) {
// TODO
}
}
}
// (Re)send request if needed
if (mustSendNewRequest(request)) {
submitRequest(request, psCodeTiersS, true);
} else if (mustResendRequest(request)) {
submitRequest(request, psCodeTiersS, false);
}
// check request status
String msStatut = getRequestStatus(request, psCodeTiersS);
if (msStatut == null) {
// got an exception while contacting Edemande
return null;
}
if (msStatut.trim().isEmpty()) {
addTrace(request.getId(), null, RequestExternalAction.Status.NOT_SENT,
"La demande n'a pas encore été reçue");
return null;
}
if ("En attente de réception par la collectivité".equals(msStatut)) {
return null;
} else if ("A compléter ou corriger".equals(msStatut) ||
"A compléter".equals(msStatut) ||
"En erreur".equals(msStatut)) {
addTrace(request.getId(), null, RequestExternalAction.Status.ERROR, msStatut);
} else if ("En cours d'analyse".equals(msStatut) ||
"En attente d'avis externe".equals(msStatut) ||
"En cours d'instruction".equals(msStatut)) {
addTrace(request.getId(), null, RequestExternalAction.Status.ACKNOWLEDGED, msStatut);
} else if ("Accepté".equals(msStatut) ||
"En cours de paiement".equals(msStatut) ||
"Payé partiellement".equals(msStatut) ||
"Terminé".equals(msStatut)) {
addTrace(request.getId(), null, RequestExternalAction.Status.ACCEPTED, msStatut);
if ("Accepté".equals(msStatut))
try {
requestWorkflowService.updateRequestState(request.getId(), RequestState.VALIDATED, null);
} catch (CvqInvalidTransitionException e) {
logger.error("sendRequest() could not validate request " + request.getId()
+ " (" + e.getMessage() + ")");
} catch (CvqObjectNotFoundException e) {
// unlikely to happen
} catch (CvqException e) {
logger.error("sendRequest() unexpected error while validating request " + request.getId()
+ " (" + e.getMessage() + ")");
}
} else if ("Refusé".equals(msStatut)) {
addTrace(request.getId(), null, RequestExternalAction.Status.REJECTED, msStatut);
try {
requestWorkflowService.updateRequestState(request.getId(), RequestState.REJECTED, null);
} catch (CvqInvalidTransitionException e) {
logger.error("sendRequest() could not reject request " + request.getId()
+ " (" + e.getMessage() + ")");
} catch (CvqObjectNotFoundException e) {
// unlikely to happen
} catch (CvqException e) {
logger.error("sendRequest() unexpected error while rejecting request " + request.getId()
+ " (" + e.getMessage() + ")");
}
}
return null;
}
private void addTrace(Long requestId, String subkey, RequestExternalAction.Status status,
String message) {
Set<Critere> criteriaSet = new HashSet<Critere>(4);
criteriaSet.add(new Critere(RequestExternalAction.SEARCH_BY_KEY,
String.valueOf(requestId), Critere.EQUALS));
criteriaSet.add(new Critere(RequestExternalAction.SEARCH_BY_NAME,
label, Critere.EQUALS));
List<RequestExternalAction> actions = requestExternalActionService.getTraces(
criteriaSet, RequestExternalAction.SEARCH_BY_DATE, "desc", 1, 0);
RequestExternalAction est = actions.size() > 0 ? actions.get(0) : null;
if (est != null && est.getStatus().equals(status)
&& StringUtils.equals(subkey, (String)est.getComplementaryData().get("individual"))) {
est.setDate(new Date());
est.setMessage(message);
Integer count = (Integer)est.getComplementaryData().get("count");
if (count == null) count = 2; else count++;
est.getComplementaryData().put("count", count);
genericDAO.update(est);
} else {
est = new RequestExternalAction();
est.setDate(new Date());
est.setKey(requestId);
est.setKeyOwner("capdemat");
est.setMessage(message);
est.setName(label);
est.setStatus(status);
est.getComplementaryData().put("individual", subkey);
requestExternalActionService.addTrace(est);
}
if (RequestExternalAction.Status.ERROR.equals(status)) {
try {
requestWorkflowService.updateRequestState(requestId, RequestState.UNCOMPLETE,
message);
} catch (CvqObjectNotFoundException e) {
// TODO
} catch (CvqInvalidTransitionException e) {
// TODO
} catch (CvqException e) {
// TODO
}
}
}
/**
* Search for this request's individual in eDemande.
*
* @return the individual's code in eDemande, an empty string if the individual is not found,
* or null if there is an error while contacting eDemande.
*/
private String searchIndividual(EdemandeRequest request, String firstName, String lastName,
Calendar birthDate, String subkey) {
Map<String, Object> model = new HashMap<String, Object>();
model.put("lastName", escapeLastName(lastName));
FrenchRIBType frenchRIBType = request.getFrenchRIB();
if (frenchRIBType == null) {
addTrace(request.getId(), subkey, RequestExternalAction.Status.NOT_SENT, "Coordonnées bancaires non renseignées");
return null;
}
model.put("frenchRIB", FrenchRIB.xmlToModel(request.getFrenchRIB()).format(" "));
String searchResults;
int resultsNumber;
try {
searchResults =
edemandeClient.rechercherTiers(escapeStrings(model))
.getRechercherTiersResponse().getReturn();
resultsNumber = parseDatas(searchResults,
"//resultatRechTiers/listeTiers/tiers/codeTiers").size();
} catch (CvqException e) {
addTrace(request.getId(), subkey, RequestExternalAction.Status.NOT_SENT, e.getMessage());
return null;
}
if (resultsNumber == 0) {
return "";
}
if (resultsNumber == 1) {
try {
return parseData(searchResults,
"//resultatRechTiers/listeTiers/tiers/codeTiers");
} catch (CvqException e) {
addTrace(request.getId(), subkey, RequestExternalAction.Status.NOT_SENT,
e.getMessage());
return null;
}
}
for (int i = 1; i <= resultsNumber; i++) {
try {
String code =
parseData(searchResults,
"//resultatRechTiers/listeTiers/tiers[" + i
+ "]/codeTiers");
String informations =
edemandeClient.initialiserFormulaire(request.getConfig().name, code)
.getInitialiserFormulaireResponse().getReturn();
if (parseData(informations,
"/CBdosInitFormulaireBean/moTierInit/msPrenom")
.equalsIgnoreCase(escapeFirstName(firstName))
&& parseData(informations,
"/CBdosInitFormulaireBean/moTierInit/mdtDateNaissance")
.equals(new SimpleDateFormat("yyyy-MM-dd")
.format(birthDate.getTime()))) {
return code;
}
} catch (CvqException e) {
continue;
}
}
return "";
}
private String searchSubject(EdemandeRequest request) {
return searchIndividual(request, request.getSubjectFirstName(),
request.getSubjectLastName(), request.getSubjectBirthDate(), SUBJECT_TRACE_SUBKEY);
}
private String searchAccountHolder(EdemandeRequest request) {
return searchIndividual(request, request.getAccountHolderFirstName(),
request.getAccountHolderLastName(), request.getAccountHolderBirthDate(),
ACCOUNT_HOLDER_TRACE_SUBKEY);
}
private void createSubject(EdemandeRequest request) {
Map<String, Object> model = new HashMap<String, Object>();
model.put("lastName", escapeLastName(request.getSubjectLastName()));
model.put("address", request.getSubjectAddress());
if (!StringUtils.isBlank(request.getSubjectPhone())) {
model.put("phone", request.getSubjectPhone());
}
model.put("title",
translationService.translate("homeFolder.adult.title."
+ request.getSubjectTitle().toString().toLowerCase(), Locale.FRANCE));
model.put("firstName", escapeFirstName(request.getSubjectFirstName()));
model.put("birthPlace", StringUtils.defaultString(request.getSubjectBirthCity()));
model.put("birthDate", formatDate(request.getSubjectBirthDate()));
model.put("frenchRIB", FrenchRIB.xmlToModel(request.getFrenchRIB()).format(" "));
try {
model.put("email", StringUtils.defaultIfEmpty(request.getSubjectEmail(),
userSearchService.getHomeFolderResponsible(request.getHomeFolderId()).getEmail()));
GestionCompteResponseDocument response =
edemandeClient.creerTiers(escapeStrings(model));
if (!"0".equals(parseData(response.getGestionCompteResponse().getReturn(), "//Retour/codeRetour"))) {
addTrace(request.getId(), SUBJECT_TRACE_SUBKEY, RequestExternalAction.Status.ERROR,
parseData(response.getGestionCompteResponse().getReturn(),
"//Retour/messageRetour"));
} else {
addTrace(request.getId(), SUBJECT_TRACE_SUBKEY,
RequestExternalAction.Status.IN_PROGRESS, "Demande de création du tiers sujet");
}
} catch (CvqException e) {
e.printStackTrace();
addTrace(request.getId(), SUBJECT_TRACE_SUBKEY, RequestExternalAction.Status.NOT_SENT,
e.getMessage());
}
}
private void createAccountHolder(EdemandeRequest request) {
Map<String, Object> model = new HashMap<String, Object>();
model.put("title", translationService.translate("homeFolder.adult.title."
+ request.getAccountHolderTitle().toString().toLowerCase(), Locale.FRANCE));
model.put("lastName", escapeLastName(request.getAccountHolderLastName()));
//FIXME placeholders; are these really needed ?
model.put("address", request.getSubjectAddress());
model.put("phone", "");
model.put("birthPlace", "");
//ENDFIXME
model.put("firstName", escapeFirstName(request.getAccountHolderFirstName()));
model.put("birthDate", formatDate(request.getAccountHolderBirthDate()));
model.put("frenchRIB", FrenchRIB.xmlToModel(request.getFrenchRIB()).format(" "));
try {
//FIXME placeholder
model.put("email",
userSearchService.getHomeFolderResponsible(request.getHomeFolderId()).getEmail());
GestionCompteResponseDocument response =
edemandeClient.creerTiers(escapeStrings(model));
if (!"0".equals(parseData(response.getGestionCompteResponse().getReturn(), "//Retour/codeRetour"))) {
addTrace(request.getId(), ACCOUNT_HOLDER_TRACE_SUBKEY,
RequestExternalAction.Status.ERROR,
parseData(response.getGestionCompteResponse().getReturn(),
"//Retour/messageRetour"));
} else {
addTrace(request.getId(), ACCOUNT_HOLDER_TRACE_SUBKEY,
RequestExternalAction.Status.IN_PROGRESS, "Demande de création du tiers viré");
}
} catch (CvqException e) {
e.printStackTrace();
addTrace(request.getId(), ACCOUNT_HOLDER_TRACE_SUBKEY,
RequestExternalAction.Status.NOT_SENT, e.getMessage());
}
}
private void submitRequest(EdemandeRequest request, String psCodeTiers, boolean firstSending) {
Map<String, Object> model = new HashMap<String, Object>();
String requestData = null;
if (!firstSending) {
try {
requestData = edemandeClient.chargerDemande(psCodeTiers, request.getEdemandeId()).getChargerDemandeResponse().getReturn();
} catch (CvqException e) {
e.printStackTrace();
addTrace(request.getId(), null, RequestExternalAction.Status.NOT_SENT,
e.getMessage());
}
}
model.put("externalRequestId", buildExternalRequestId(request));
model.put("psCodeTiers", psCodeTiers);
model.put("psCodeDemande",
StringUtils.defaultIfEmpty(request.getEdemandeId(), "-1"));
model.put("etatCourant", firstSending ? 2 : 1);
model.put("firstName", escapeFirstName(request.getSubjectFirstName()));
model.put("lastName", escapeLastName(request.getSubjectLastName()));
model.put("address", request.getSubjectAddress());
if (!StringUtils.isBlank(request.getSubjectPhone())) {
model.put("phone", request.getSubjectPhone());
}
model.put("frenchRIB", FrenchRIB.xmlToModel(request.getFrenchRIB()).format(" "));
model.put("creationDate", formatDate(request.getCreationDate()));
List<Map<String, String>> documents = new ArrayList<Map<String, String>>();
model.put("documents", documents);
try {
for (RequestDocument requestDoc : requestDocumentService.getAssociatedDocuments(request.getId())) {
Document document = documentService.getById(requestDoc.getDocumentId());
for (String documentTypeToSend : documentTypesToSend) {
if (documentTypeToSend.equals(document.getDocumentType().getType().toString())) {
int i = 1;
for (DocumentBinary documentBinary : document.getDatas()) {
if (documentBinary.getData().length > fileMaxSize) {
continue;
}
Map<String, String> doc = new HashMap<String, String>();
documents.add(doc);
String filename = org.springframework.util.StringUtils.arrayToDelimitedString(
new String[] {
"CapDemat", document.getDocumentType().getName(),
String.valueOf(request.getId()), String.valueOf(i++)
}, "-");
doc.put("filename", filename);
doc.put("label", "documentType." +
document.getDocumentType().getName().replaceAll(" ", "")
.toLowerCase());
try {
doc.put("remotePath", uploader.upload(filename, documentBinary.getData()));
} catch (JSchException e) {
addTrace(request.getId(), null, RequestExternalAction.Status.ERROR,
"Erreur à l'envoi d'une pièce jointe");
} catch (SftpException e) {
addTrace(request.getId(), null, RequestExternalAction.Status.ERROR,
"Erreur à l'envoi d'une pièce jointe");
}
}
break;
}
}
}
model.put("email", StringUtils.defaultIfEmpty(request.getSubjectEmail(),
userSearchService.getHomeFolderResponsible(request.getHomeFolderId()).getEmail()));
model.put("msStatut", firstSending ? "" :
getRequestStatus(request, psCodeTiers));
model.put("millesime", firstSending ? "" :
parseData(requestData, "//donneesDemande/Demande/miMillesime"));
model.put("msCodext", firstSending ? "" :
parseData(requestData, "//donneesDemande/Demande/msCodext"));
model.put("requestTypeCode",
parseData(edemandeClient.chargerTypeDemande(request.getConfig().name).getChargerTypeDemandeResponse().getReturn(), "//typeDemande/code"));
model.put("config", request.getConfig());
model.putAll(request.getSpecificFields(this));
EnregistrerValiderFormulaireResponseDocument
enregistrerValiderFormulaireResponseDocument =
edemandeClient.enregistrerValiderFormulaire(escapeStrings(model));
if (!"0".equals(parseData(enregistrerValiderFormulaireResponseDocument.getEnregistrerValiderFormulaireResponse().getReturn(), "//Retour/codeRetour"))) {
addTrace(request.getId(), null, RequestExternalAction.Status.ERROR, parseData(
enregistrerValiderFormulaireResponseDocument
.getEnregistrerValiderFormulaireResponse().getReturn(),
"//Retour/messageRetour"));
} else {
addTrace(request.getId(), null, RequestExternalAction.Status.SENT,
"Demande transmise");
}
} catch (CvqException e) {
e.printStackTrace();
addTrace(request.getId(), null, RequestExternalAction.Status.NOT_SENT, e.getMessage());
}
}
private String searchRequest(EdemandeRequest request, String psCodeTiers) {
try {
return parseData(edemandeClient.rechercheDemandesTiers(psCodeTiers)
.getRechercheDemandesTiersResponse().getReturn(),
"//resultatRechDemandes/listeDemandes/Demande/moOrigineApsect[msIdentifiant ='"
+ buildExternalRequestId(request) + "']/../miCode");
} catch (CvqException e) {
addTrace(request.getId(), null, RequestExternalAction.Status.NOT_SENT, e.getMessage());
return null;
}
}
private String getRequestStatus(EdemandeRequest request, String psCodeTiers) {
try {
if (request.getEdemandeId() == null || request.getEdemandeId().trim().isEmpty()) {
return parseData(edemandeClient.rechercheDemandesTiers(psCodeTiers)
.getRechercheDemandesTiersResponse().getReturn(),
"//resultatRechDemandes/listeDemandes/Demande/moOrigineApsect[msIdentifiant ='"
+ buildExternalRequestId(request) + "']/../msStatut");
} else {
return parseData(edemandeClient.chargerDemande(psCodeTiers, request.getEdemandeId())
.getChargerDemandeResponse().getReturn(),
"//donneesDemande/Demande/msStatut");
}
} catch (CvqException e) {
addTrace(request.getId(), null, RequestExternalAction.Status.NOT_SENT, e.getMessage());
return null;
}
}
@Override
public List<String> checkExternalReferential(final XmlObject requestXml) {
EdemandeRequest request = adapt(requestXml);
List<String> result = new ArrayList<String>();
try {
String postalCodeAndCityCheck = edemandeClient.existenceCommunePostale(request.getSubjectAddress().getPostalCode(), request.getSubjectAddress().getCity()).getExistenceCommunePostaleResponse().getReturn();
if (!"0".equals(parseData(postalCodeAndCityCheck, "//FluxWebService/msCodeRet"))) {
result.add(parseData(postalCodeAndCityCheck, "//FluxWebService/erreur/message"));
}
String bankInformationsCheck = edemandeClient.verifierRIB(request.getFrenchRIB()).getVerifierRIBResponse().getReturn();
if (!"0".equals(parseData(bankInformationsCheck, "//FluxWebService/msCodeRet"))) {
result.add(parseData(bankInformationsCheck, "//FluxWebService/erreur/message"));
}
} catch (CvqException e) {
result.add("Impossible de contacter Edemande");
}
return result;
}
@Override
public Map<String, Object> loadExternalInformations(XmlObject requestXml)
throws CvqException {
EdemandeRequest rqt = adapt(requestXml);
if (StringUtils.isBlank(rqt.getSubjectEdemandeId())
|| StringUtils.isBlank(rqt.getEdemandeId())) {
return Collections.emptyMap();
}
Map<String, Object> informations = new TreeMap<String, Object>();
String request =
edemandeClient.chargerDemande(rqt.getSubjectEdemandeId(), rqt.getEdemandeId())
.getChargerDemandeResponse().getReturn();
String status = getRequestStatus(rqt, rqt.getSubjectEdemandeId());
if (status != null && !status.trim().isEmpty()) {
informations.put("sgr.property.externalStatus", status);
}
String grantedAmount = parseData(request, "//donneesDemande/Demande/mdMtAccorde");
if (grantedAmount != null && !grantedAmount.trim().isEmpty()) {
informations.put("sgr.property.grantedAmount",
new DecimalFormat(translationService.translate("format.currency"))
.format(new BigDecimal(grantedAmount)));
}
String paidAmount = parseData(request, "//donneesDemande/Demande/mdMtRealise");
if (paidAmount != null && !paidAmount.trim().isEmpty()) {
informations.put("sgr.property.paidAmount",
new DecimalFormat(translationService.translate("format.currency"))
.format(new BigDecimal(paidAmount)));
}
return informations;
}
public void setLabel(String label) {
this.label = label;
}
public void setEdemandeClient(IEdemandeClient edemandeClient) {
this.edemandeClient = edemandeClient;
}
@Override
public boolean supportsConsumptions() {
return false;
}
@Override
public boolean handlesTraces() {
return true;
}
private String parseData(String returnElement, String path)
throws CvqException {
try {
return new DOMXPath(path)
.stringValueOf(
DocumentBuilderFactory.newInstance().newDocumentBuilder()
.parse(new InputSource(new StringReader(returnElement)))
.getDocumentElement());
} catch (JaxenException e) {
e.printStackTrace();
throw new CvqException("Erreur lors de la lecture de la réponse du service externe");
} catch (SAXException e) {
e.printStackTrace();
throw new CvqException("Erreur lors de la lecture de la réponse du service externe");
} catch (IOException e) {
e.printStackTrace();
throw new CvqException("Erreur lors de la lecture de la réponse du service externe");
} catch (ParserConfigurationException e) {
e.printStackTrace();
throw new CvqException("Erreur lors de la lecture de la réponse du service externe");
}
}
/**
* Same as {@link #parseData(String, String)}
* but selects all matching elements
*/
private List<?> parseDatas(String returnElement, String path)
throws CvqException {
try {
return new DOMXPath(path)
.selectNodes(
DocumentBuilderFactory.newInstance().newDocumentBuilder()
.parse(new InputSource(new StringReader(returnElement)))
.getDocumentElement());
} catch (JaxenException e) {
e.printStackTrace();
throw new CvqException("Erreur lors de la lecture de la réponse du service externe");
} catch (SAXException e) {
e.printStackTrace();
throw new CvqException("Erreur lors de la lecture de la réponse du service externe");
} catch (IOException e) {
e.printStackTrace();
throw new CvqException("Erreur lors de la lecture de la réponse du service externe");
} catch (ParserConfigurationException e) {
e.printStackTrace();
throw new CvqException("Erreur lors de la lecture de la réponse du service externe");
}
}
private String buildExternalRequestId(EdemandeRequest request) {
return org.springframework.util.StringUtils.arrayToDelimitedString(
new String[] {
"CapDemat",
new SimpleDateFormat("yyyyMMdd").format(new Date(request.getCreationDate().getTimeInMillis())),
String.valueOf(request.getId())
},
"-");
}
/**
* Whether or not we have to send the request.
*
* @return true if the request has no SENT trace (it has never been successfully sent)
* or it has an error trace and no Edemande ID (it was sent and received, but rejected and must be sent as new)
*/
private boolean mustSendNewRequest(EdemandeRequest request) {
Set<Critere> criteriaSet = new HashSet<Critere>(3);
criteriaSet.add(new Critere(RequestExternalAction.SEARCH_BY_KEY,
String.valueOf(request.getId()), Critere.EQUALS));
criteriaSet.add(new Critere(RequestExternalAction.SEARCH_BY_NAME,
label, Critere.EQUALS));
criteriaSet.add(new Critere(
RequestExternalAction.SEARCH_BY_STATUS, RequestExternalAction.Status.SENT,
Critere.EQUALS));
if (requestExternalActionService.getTracesCount(criteriaSet) == 0)
return true;
criteriaSet.clear();
criteriaSet.add(new Critere(RequestExternalAction.SEARCH_BY_KEY,
String.valueOf(request.getId()), Critere.EQUALS));
criteriaSet.add(new Critere(RequestExternalAction.SEARCH_BY_NAME,
label, Critere.EQUALS));
criteriaSet.add(new Critere(
RequestExternalAction.SEARCH_BY_STATUS, RequestExternalAction.Status.ERROR,
Critere.EQUALS));
return (requestExternalActionService.getTracesCount(criteriaSet) != 0
&& (request.getEdemandeId() == null || request.getEdemandeId().trim().isEmpty()));
}
/**
* Whether or not we have to resend the request.
*
* @return true if the request has an Edemande ID (so it was already sent),
* and an ERROR trace not followed by a SENT trace
*/
private boolean mustResendRequest(EdemandeRequest request) {
Set<Critere> criteriaSet = new HashSet<Critere>(3);
criteriaSet.add(new Critere(RequestExternalAction.SEARCH_BY_KEY,
String.valueOf(request.getId()), Critere.EQUALS));
criteriaSet.add(new Critere(RequestExternalAction.SEARCH_BY_NAME,
label, Critere.EQUALS));
criteriaSet.add(new Critere(
RequestExternalAction.SEARCH_BY_STATUS, RequestExternalAction.Status.ERROR,
Critere.EQUALS));
if (requestExternalActionService.getTracesCount(criteriaSet) == 0
|| request.getEdemandeId() == null || request.getEdemandeId().trim().isEmpty()) {
return false;
}
Set<Critere> criteres = new HashSet<Critere>();
criteres.add(new Critere(RequestExternalAction.SEARCH_BY_KEY,
String.valueOf(request.getId()), Critere.EQUALS));
criteres.add(new Critere(RequestExternalAction.SEARCH_BY_NAME, label,
Critere.EQUALS));
for (RequestExternalAction est : requestExternalActionService.getTraces(criteres,
RequestExternalAction.SEARCH_BY_DATE, "desc", 0, 0)) {
if (RequestExternalAction.Status.SENT.equals(est.getStatus())) {
return false;
} else if (RequestExternalAction.Status.ERROR.equals(est.getStatus())) {
return true;
}
}
// we should never execute the next line :
// the above loop should have found a SENT trace and returned false,
// or found the ERROR trace that IS in the list
// (otherwise the first test would have succeded)
// however, for compilation issues (and an hypothetic concurrent traces deletion)
// we return false, to do nothing rather than doing something wrong
return false;
}
/**
* Determines if we must send an individual creation request for the request's subject
* or account holder when this individual has no psCodeTiers yet.
*/
private boolean mustCreateIndividual(EdemandeRequest request, String subkey) {
Set<Critere> criteriaSet = new HashSet<Critere>(4);
criteriaSet.add(new Critere(RequestExternalAction.SEARCH_BY_KEY,
String.valueOf(request.getId()), Critere.EQUALS));
criteriaSet.add(new Critere(RequestExternalAction.SEARCH_BY_COMPLEMENTARY_DATA,
new UnmodifiableMapEntry("individual", subkey), Critere.EQUALS));
criteriaSet.add(new Critere(RequestExternalAction.SEARCH_BY_NAME,
label, Critere.EQUALS));
criteriaSet.add(new Critere(
RequestExternalAction.SEARCH_BY_STATUS, RequestExternalAction.Status.IN_PROGRESS,
Critere.EQUALS));
if (requestExternalActionService.getTracesCount(criteriaSet) == 0) {
return true;
}
Set<Critere> criteres = new HashSet<Critere>();
criteres.add(new Critere(RequestExternalAction.SEARCH_BY_KEY,
String.valueOf(request.getId()), Critere.EQUALS));
criteriaSet.add(new Critere(RequestExternalAction.SEARCH_BY_COMPLEMENTARY_DATA,
new UnmodifiableMapEntry("individual", subkey), Critere.EQUALS));
criteres.add(new Critere(RequestExternalAction.SEARCH_BY_NAME, label,
Critere.EQUALS));
for (RequestExternalAction est : requestExternalActionService.getTraces(criteres,
RequestExternalAction.SEARCH_BY_DATE, "desc", 0, 0)) {
if (RequestExternalAction.Status.IN_PROGRESS.equals(est.getStatus())) {
return false;
} else if (RequestExternalAction.Status.ERROR.equals(est.getStatus())) {
return true;
}
}
return false;
}
public String formatDate(Calendar calendar) {
if (calendar == null) return "";
return formatter.format(new Date(calendar.getTimeInMillis()));
}
public String translate(String code) {
return translationService.translate(code, Locale.FRANCE);
}
private boolean mustCreateAccountHolder(EdemandeRequest request) {
return mustCreateIndividual(request, ACCOUNT_HOLDER_TRACE_SUBKEY);
}
private boolean mustCreateSubject(EdemandeRequest request) {
return mustCreateIndividual(request, SUBJECT_TRACE_SUBKEY);
}
private Map<String, Object> escapeStrings(Map<String, Object> model) {
for (Map.Entry<String, Object> entry : model.entrySet()) {
if (entry.getValue() instanceof String) {
entry.setValue(
StringEscapeUtils.escapeXml((String)entry.getValue()));
} else if (entry.getValue() instanceof AddressType) {
AddressType addressType = (AddressType)entry.getValue();
Map<String, String> address = new HashMap<String, String>();
address.put("additionalDeliveryInformation", StringUtils.defaultString(
StringEscapeUtils.escapeXml(addressType.getAdditionalDeliveryInformation())));
address.put("additionalGeographicalInformation", StringUtils.defaultString(
StringEscapeUtils.escapeXml(
addressType.getAdditionalGeographicalInformation())));
address.put("city", StringUtils.defaultString(
StringEscapeUtils.escapeXml(addressType.getCity())));
address.put("countryName", StringUtils.defaultString(
StringEscapeUtils.escapeXml(addressType.getCountryName())));
address.put("placeNameOrService", StringUtils.defaultString(
StringEscapeUtils.escapeXml(addressType.getPlaceNameOrService())));
address.put("postalCode", StringUtils.defaultString(
StringEscapeUtils.escapeXml(addressType.getPostalCode())));
address.put("streetName", StringUtils.defaultString(
StringEscapeUtils.escapeXml(addressType.getStreetName())));
address.put("streetNumber", StringUtils.defaultString(
StringEscapeUtils.escapeXml(addressType.getStreetNumber())));
entry.setValue(address);
}
}
return model;
}
private String escapeName(String name) {
return Normalizer.normalize(name.replaceAll("-", " ").replaceAll("'", ""),
Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]","");
}
private String escapeFirstName(String firstName) {
return escapeName(WordUtils.capitalizeFully(firstName, new char[]{' ', '-'}));
}
private String escapeLastName(String lastName) {
return StringUtils.upperCase(escapeName(lastName));
}
private EdemandeRequest adapt(XmlObject requestXml) {
if (requestXml instanceof StudyGrantRequestDocument) {
return new StudyGrantEdemandeRequest((StudyGrantRequestImpl)((StudyGrantRequestDocument)requestXml).getStudyGrantRequest());
} else if (requestXml instanceof StudyGrantRequestImpl) {
return new StudyGrantEdemandeRequest((StudyGrantRequestImpl) requestXml);
} else if (requestXml instanceof BafaGrantRequestDocument) {
return new BafaGrantEdemandeRequest((BafaGrantRequestImpl)((BafaGrantRequestDocument)requestXml).getBafaGrantRequest());
} else if (requestXml instanceof BafaGrantRequestImpl) {
return new BafaGrantEdemandeRequest((BafaGrantRequestImpl) requestXml);
} else {
return null;
}
}
private void setEdemandeId(EdemandeRequest request, String psCodeDemande)
throws CvqObjectNotFoundException {
Request rqt = requestSearchService.getById(request.getId(), true);
if (request instanceof StudyGrantEdemandeRequest) {
((StudyGrantRequest)rqt).setEdemandeId(psCodeDemande);
} else if (request instanceof BafaGrantEdemandeRequest) {
((BafaGrantRequest)rqt).setEdemandeId(psCodeDemande);
} else {
throw new IllegalArgumentException();
}
}
private void setAccountHolderEdemandeId(EdemandeRequest request, String psCodeTiersAH)
throws CvqObjectNotFoundException {
Request rqt = requestSearchService.getById(request.getId(), true);
if (request instanceof StudyGrantEdemandeRequest) {
((StudyGrantRequest)rqt).setAccountHolderEdemandeId(psCodeTiersAH);
} else if (request instanceof BafaGrantEdemandeRequest) {
((BafaGrantRequest)rqt).setAccountHolderEdemandeId(psCodeTiersAH);
} else {
throw new IllegalArgumentException();
}
}
@Override
public void checkConfiguration(ExternalServiceBean externalServiceBean, String localAuthorityName)
throws CvqConfigurationException {
List<String> documentTypesToSend =
(List<String>)externalServiceBean.getProperty("documentTypesToSend");
if (documentTypesToSend != null) {
this.documentTypesToSend = documentTypesToSend;
}
try {
fileMaxSize = Integer.parseInt((String)externalServiceBean.getProperty("fileMaxSize"));
} catch (NumberFormatException e) {
// nothing to do
}
}
@Override
public void creditHomeFolderAccounts(Collection<PurchaseItem> purchaseItems,
String cvqReference, String bankReference, Long homeFolderId,
String externalHomeFolderId, String externalId, Date validationDate)
throws CvqException {
}
@Override
public Map<String, List<ExternalAccountItem>> getAccountsByHomeFolder(Long homeFolderId,
String externalHomeFolderId, String externalId) throws CvqException {
return null;
}
@Override
public Map<Date, String> getConsumptions(Long key, Date dateFrom, Date dateTo)
throws CvqException {
return null;
}
@Override
public String getLabel() {
return label;
}
@Override
public String helloWorld() throws CvqException {
return null;
}
@Override
public void loadDepositAccountDetails(ExternalDepositAccountItem edai) throws CvqException {
}
@Override
public void loadInvoiceDetails(ExternalInvoiceItem eii) throws CvqException {
}
public void setRequestSearchService(IRequestSearchService requestSearchService) {
this.requestSearchService = requestSearchService;
}
public void setDocumentService(IDocumentService documentService) {
this.documentService = documentService;
}
public void setUserSearchService(IUserSearchService userSearchService) {
this.userSearchService = userSearchService;
}
public void setRequestExternalActionService(IRequestExternalActionService requestExternalActionService) {
this.requestExternalActionService = requestExternalActionService;
}
public void setExternalHomeFolderService(IExternalHomeFolderService externalHomeFolderService) {
this.externalHomeFolderService = externalHomeFolderService;
}
public void setRequestWorkflowService(IRequestWorkflowService requestWorkflowService) {
this.requestWorkflowService = requestWorkflowService;
}
public void setRequestDocumentService(IRequestDocumentService requestDocumentService) {
this.requestDocumentService = requestDocumentService;
}
public void setTranslationService(ITranslationService translationService) {
this.translationService = translationService;
}
public void setUploader(EdemandeUploader uploader) {
this.uploader = uploader;
}
public void setGenericDAO(IGenericDAO genericDAO) {
this.genericDAO = genericDAO;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
fd55ea62270fc47b11d4ace07c3c266b21b2ec47 | 2b2fcb1902206ad0f207305b9268838504c3749b | /WakfuClientSources/srcx/class_5942_cCY.java | 19f6efe5dde01fc035fb7e28d1f9c28d17a8c392 | [] | no_license | shelsonjava/Synx | 4fbcee964631f747efc9296477dee5a22826791a | 0cb26d5473ba1f36a3ea1d7163a5b9e6ebcb0b1d | refs/heads/master | 2021-01-15T13:51:41.816571 | 2013-11-17T10:46:22 | 2013-11-17T10:46:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 471 | java | import java.util.HashMap;
import java.util.Map;
public enum cCY
{
private static final Map cFX;
private final int bQS;
public static cCY xs(int paramInt)
{
return (cCY)cFX.get(Integer.valueOf(paramInt));
}
private cCY(int arg3)
{
int j;
this.bQS = j;
}
public int intValue() {
return this.bQS;
}
static
{
cFX = new HashMap();
for (cCY localcCY : values())
cFX.put(Integer.valueOf(localcCY.bQS), localcCY);
}
} | [
"music_inme@hotmail.fr"
] | music_inme@hotmail.fr |
a68b7b1bfc175446fbf70be7af6c902392a70def | 385bfc0868812f26e48ed266beeefd100e2698fe | /app/src/main/java/com/example/jiangtianci20171221/api/APIService.java | ab9724ec86712971d38a62618f1f21221a11aaae | [] | no_license | jiangtianci/ykss | 4c38f4fa79061eddf77dc78982da4c02788800c1 | b0926e4b056f5b38de68af54a54d943e75f8a807 | refs/heads/master | 2021-08-31T12:23:33.063632 | 2017-12-21T08:37:44 | 2017-12-21T08:37:44 | 114,982,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package com.example.jiangtianci20171221.api;
import com.example.jiangtianci20171221.bean.Bean;
import retrofit2.http.GET;
import rx.Observable;
/**
* Created by 姜天赐 on 2017/12/21.
*/
public interface APIService {
@GET("product/getProducts?pscid=39&page=1")
Observable<Bean> getdata();
}
| [
"email@example.com"
] | email@example.com |
996014dadef10d0d9987ae71b41c28f599d831e1 | e60feb3aa6ecdf157f0d93601353fd63c2d3d691 | /app/src/main/java/com/doa/freemusicdownload/MainActivity.java | cb9b7ca0500a4f404badc824aff20a13dba8f372 | [] | no_license | lism/FreeMusicDownload2 | e8a9c72bf6f0f03be464c1dd0a0f60847445245b | bdbe9691323a8b3c5c4fc2ff8a9c0a16cd069fd1 | refs/heads/master | 2020-04-08T14:46:42.594874 | 2018-05-17T15:39:58 | 2018-05-17T15:39:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,214 | java | package com.doa.freemusicdownload;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.startapp.android.publish.adsCommon.StartAppAd;
import com.startapp.android.publish.adsCommon.StartAppSDK;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
StartAppSDK.init(this, "208574408", true);
StartAppAd.showSplash(this, savedInstanceState);
setContentView(com.doa.freemusicdownload.R.layout.activity_main);
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).build();
ImageLoader.getInstance().init(config);
}
@Override
public void onBackPressed() {
StartAppAd.onBackPressed(this);
super.onBackPressed();
}
public void openSearchActivity(View v) {
Intent i = new Intent(this, com.doa.freemusicdownload.SearchActivity.class);
startActivity(i);
}
}
| [
"38009153+DogiBoy@users.noreply.github.com"
] | 38009153+DogiBoy@users.noreply.github.com |
c6ad5afa23185cf7c576d8bf1089cf7d15dadaff | f1510c65e8c95f56e597e67c94706dfa552173e0 | /poetsio/gen-java/dk/diku/poets/gen/thrift/contracts/ExternalChoiceClause.java | 8ba371ded6171246d9500263b69a969b1e4da69d | [] | no_license | rlindsgaard/nuERP | 3ea868bbc3379c463fe892f14d9816f991f47eca | 708d41a771c1da54bbfabd5ef1fa9cb4d20e57a2 | refs/heads/master | 2021-01-23T22:43:10.291679 | 2011-12-22T16:31:01 | 2011-12-22T16:31:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 34,988 | java | /**
* Autogenerated by Thrift Compiler (0.8.0-dev)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package dk.diku.poets.gen.thrift.contracts;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ExternalChoiceClause implements org.apache.thrift.TBase<ExternalChoiceClause, ExternalChoiceClause._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ExternalChoiceClause");
private static final org.apache.thrift.protocol.TField TRANSACTION_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("transactionType", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField BINDERS_FIELD_DESC = new org.apache.thrift.protocol.TField("binders", org.apache.thrift.protocol.TType.LIST, (short)2);
private static final org.apache.thrift.protocol.TField REMAINDER_VAR_FIELD_DESC = new org.apache.thrift.protocol.TField("remainderVar", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField PREDICATE_FIELD_DESC = new org.apache.thrift.protocol.TField("predicate", org.apache.thrift.protocol.TType.STRUCT, (short)4);
private static final org.apache.thrift.protocol.TField DEADLINE_FIELD_DESC = new org.apache.thrift.protocol.TField("deadline", org.apache.thrift.protocol.TType.STRUCT, (short)5);
private static final org.apache.thrift.protocol.TField CONTINUATION_FIELD_DESC = new org.apache.thrift.protocol.TField("continuation", org.apache.thrift.protocol.TType.I32, (short)6);
private static final org.apache.thrift.protocol.TField ALTERNATIVE_CONTINUATION_FIELD_DESC = new org.apache.thrift.protocol.TField("alternativeContinuation", org.apache.thrift.protocol.TType.I32, (short)7);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new ExternalChoiceClauseStandardSchemeFactory());
schemes.put(TupleScheme.class, new ExternalChoiceClauseTupleSchemeFactory());
}
public String transactionType; // required
public List<Binder> binders; // required
public String remainderVar; // required
public Expression predicate; // required
public DeadlineExp deadline; // required
public int continuation; // required
public int alternativeContinuation; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
TRANSACTION_TYPE((short)1, "transactionType"),
BINDERS((short)2, "binders"),
REMAINDER_VAR((short)3, "remainderVar"),
PREDICATE((short)4, "predicate"),
DEADLINE((short)5, "deadline"),
CONTINUATION((short)6, "continuation"),
ALTERNATIVE_CONTINUATION((short)7, "alternativeContinuation");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // TRANSACTION_TYPE
return TRANSACTION_TYPE;
case 2: // BINDERS
return BINDERS;
case 3: // REMAINDER_VAR
return REMAINDER_VAR;
case 4: // PREDICATE
return PREDICATE;
case 5: // DEADLINE
return DEADLINE;
case 6: // CONTINUATION
return CONTINUATION;
case 7: // ALTERNATIVE_CONTINUATION
return ALTERNATIVE_CONTINUATION;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __CONTINUATION_ISSET_ID = 0;
private static final int __ALTERNATIVECONTINUATION_ISSET_ID = 1;
private BitSet __isset_bit_vector = new BitSet(2);
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.TRANSACTION_TYPE, new org.apache.thrift.meta_data.FieldMetaData("transactionType", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "RecordName")));
tmpMap.put(_Fields.BINDERS, new org.apache.thrift.meta_data.FieldMetaData("binders", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Binder.class))));
tmpMap.put(_Fields.REMAINDER_VAR, new org.apache.thrift.meta_data.FieldMetaData("remainderVar", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , "Var")));
tmpMap.put(_Fields.PREDICATE, new org.apache.thrift.meta_data.FieldMetaData("predicate", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Expression.class)));
tmpMap.put(_Fields.DEADLINE, new org.apache.thrift.meta_data.FieldMetaData("deadline", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DeadlineExp.class)));
tmpMap.put(_Fields.CONTINUATION, new org.apache.thrift.meta_data.FieldMetaData("continuation", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32 , "Index")));
tmpMap.put(_Fields.ALTERNATIVE_CONTINUATION, new org.apache.thrift.meta_data.FieldMetaData("alternativeContinuation", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32 , "Index")));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ExternalChoiceClause.class, metaDataMap);
}
public ExternalChoiceClause() {
}
public ExternalChoiceClause(
String transactionType,
List<Binder> binders,
String remainderVar,
Expression predicate,
DeadlineExp deadline,
int continuation,
int alternativeContinuation)
{
this();
this.transactionType = transactionType;
this.binders = binders;
this.remainderVar = remainderVar;
this.predicate = predicate;
this.deadline = deadline;
this.continuation = continuation;
setContinuationIsSet(true);
this.alternativeContinuation = alternativeContinuation;
setAlternativeContinuationIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public ExternalChoiceClause(ExternalChoiceClause other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.isSetTransactionType()) {
this.transactionType = other.transactionType;
}
if (other.isSetBinders()) {
List<Binder> __this__binders = new ArrayList<Binder>();
for (Binder other_element : other.binders) {
__this__binders.add(new Binder(other_element));
}
this.binders = __this__binders;
}
if (other.isSetRemainderVar()) {
this.remainderVar = other.remainderVar;
}
if (other.isSetPredicate()) {
this.predicate = new Expression(other.predicate);
}
if (other.isSetDeadline()) {
this.deadline = new DeadlineExp(other.deadline);
}
this.continuation = other.continuation;
this.alternativeContinuation = other.alternativeContinuation;
}
public ExternalChoiceClause deepCopy() {
return new ExternalChoiceClause(this);
}
@Override
public void clear() {
this.transactionType = null;
this.binders = null;
this.remainderVar = null;
this.predicate = null;
this.deadline = null;
setContinuationIsSet(false);
this.continuation = 0;
setAlternativeContinuationIsSet(false);
this.alternativeContinuation = 0;
}
public String getTransactionType() {
return this.transactionType;
}
public ExternalChoiceClause setTransactionType(String transactionType) {
this.transactionType = transactionType;
return this;
}
public void unsetTransactionType() {
this.transactionType = null;
}
/** Returns true if field transactionType is set (has been assigned a value) and false otherwise */
public boolean isSetTransactionType() {
return this.transactionType != null;
}
public void setTransactionTypeIsSet(boolean value) {
if (!value) {
this.transactionType = null;
}
}
public int getBindersSize() {
return (this.binders == null) ? 0 : this.binders.size();
}
public java.util.Iterator<Binder> getBindersIterator() {
return (this.binders == null) ? null : this.binders.iterator();
}
public void addToBinders(Binder elem) {
if (this.binders == null) {
this.binders = new ArrayList<Binder>();
}
this.binders.add(elem);
}
public List<Binder> getBinders() {
return this.binders;
}
public ExternalChoiceClause setBinders(List<Binder> binders) {
this.binders = binders;
return this;
}
public void unsetBinders() {
this.binders = null;
}
/** Returns true if field binders is set (has been assigned a value) and false otherwise */
public boolean isSetBinders() {
return this.binders != null;
}
public void setBindersIsSet(boolean value) {
if (!value) {
this.binders = null;
}
}
public String getRemainderVar() {
return this.remainderVar;
}
public ExternalChoiceClause setRemainderVar(String remainderVar) {
this.remainderVar = remainderVar;
return this;
}
public void unsetRemainderVar() {
this.remainderVar = null;
}
/** Returns true if field remainderVar is set (has been assigned a value) and false otherwise */
public boolean isSetRemainderVar() {
return this.remainderVar != null;
}
public void setRemainderVarIsSet(boolean value) {
if (!value) {
this.remainderVar = null;
}
}
public Expression getPredicate() {
return this.predicate;
}
public ExternalChoiceClause setPredicate(Expression predicate) {
this.predicate = predicate;
return this;
}
public void unsetPredicate() {
this.predicate = null;
}
/** Returns true if field predicate is set (has been assigned a value) and false otherwise */
public boolean isSetPredicate() {
return this.predicate != null;
}
public void setPredicateIsSet(boolean value) {
if (!value) {
this.predicate = null;
}
}
public DeadlineExp getDeadline() {
return this.deadline;
}
public ExternalChoiceClause setDeadline(DeadlineExp deadline) {
this.deadline = deadline;
return this;
}
public void unsetDeadline() {
this.deadline = null;
}
/** Returns true if field deadline is set (has been assigned a value) and false otherwise */
public boolean isSetDeadline() {
return this.deadline != null;
}
public void setDeadlineIsSet(boolean value) {
if (!value) {
this.deadline = null;
}
}
public int getContinuation() {
return this.continuation;
}
public ExternalChoiceClause setContinuation(int continuation) {
this.continuation = continuation;
setContinuationIsSet(true);
return this;
}
public void unsetContinuation() {
__isset_bit_vector.clear(__CONTINUATION_ISSET_ID);
}
/** Returns true if field continuation is set (has been assigned a value) and false otherwise */
public boolean isSetContinuation() {
return __isset_bit_vector.get(__CONTINUATION_ISSET_ID);
}
public void setContinuationIsSet(boolean value) {
__isset_bit_vector.set(__CONTINUATION_ISSET_ID, value);
}
public int getAlternativeContinuation() {
return this.alternativeContinuation;
}
public ExternalChoiceClause setAlternativeContinuation(int alternativeContinuation) {
this.alternativeContinuation = alternativeContinuation;
setAlternativeContinuationIsSet(true);
return this;
}
public void unsetAlternativeContinuation() {
__isset_bit_vector.clear(__ALTERNATIVECONTINUATION_ISSET_ID);
}
/** Returns true if field alternativeContinuation is set (has been assigned a value) and false otherwise */
public boolean isSetAlternativeContinuation() {
return __isset_bit_vector.get(__ALTERNATIVECONTINUATION_ISSET_ID);
}
public void setAlternativeContinuationIsSet(boolean value) {
__isset_bit_vector.set(__ALTERNATIVECONTINUATION_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case TRANSACTION_TYPE:
if (value == null) {
unsetTransactionType();
} else {
setTransactionType((String)value);
}
break;
case BINDERS:
if (value == null) {
unsetBinders();
} else {
setBinders((List<Binder>)value);
}
break;
case REMAINDER_VAR:
if (value == null) {
unsetRemainderVar();
} else {
setRemainderVar((String)value);
}
break;
case PREDICATE:
if (value == null) {
unsetPredicate();
} else {
setPredicate((Expression)value);
}
break;
case DEADLINE:
if (value == null) {
unsetDeadline();
} else {
setDeadline((DeadlineExp)value);
}
break;
case CONTINUATION:
if (value == null) {
unsetContinuation();
} else {
setContinuation((Integer)value);
}
break;
case ALTERNATIVE_CONTINUATION:
if (value == null) {
unsetAlternativeContinuation();
} else {
setAlternativeContinuation((Integer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case TRANSACTION_TYPE:
return getTransactionType();
case BINDERS:
return getBinders();
case REMAINDER_VAR:
return getRemainderVar();
case PREDICATE:
return getPredicate();
case DEADLINE:
return getDeadline();
case CONTINUATION:
return Integer.valueOf(getContinuation());
case ALTERNATIVE_CONTINUATION:
return Integer.valueOf(getAlternativeContinuation());
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case TRANSACTION_TYPE:
return isSetTransactionType();
case BINDERS:
return isSetBinders();
case REMAINDER_VAR:
return isSetRemainderVar();
case PREDICATE:
return isSetPredicate();
case DEADLINE:
return isSetDeadline();
case CONTINUATION:
return isSetContinuation();
case ALTERNATIVE_CONTINUATION:
return isSetAlternativeContinuation();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ExternalChoiceClause)
return this.equals((ExternalChoiceClause)that);
return false;
}
public boolean equals(ExternalChoiceClause that) {
if (that == null)
return false;
boolean this_present_transactionType = true && this.isSetTransactionType();
boolean that_present_transactionType = true && that.isSetTransactionType();
if (this_present_transactionType || that_present_transactionType) {
if (!(this_present_transactionType && that_present_transactionType))
return false;
if (!this.transactionType.equals(that.transactionType))
return false;
}
boolean this_present_binders = true && this.isSetBinders();
boolean that_present_binders = true && that.isSetBinders();
if (this_present_binders || that_present_binders) {
if (!(this_present_binders && that_present_binders))
return false;
if (!this.binders.equals(that.binders))
return false;
}
boolean this_present_remainderVar = true && this.isSetRemainderVar();
boolean that_present_remainderVar = true && that.isSetRemainderVar();
if (this_present_remainderVar || that_present_remainderVar) {
if (!(this_present_remainderVar && that_present_remainderVar))
return false;
if (!this.remainderVar.equals(that.remainderVar))
return false;
}
boolean this_present_predicate = true && this.isSetPredicate();
boolean that_present_predicate = true && that.isSetPredicate();
if (this_present_predicate || that_present_predicate) {
if (!(this_present_predicate && that_present_predicate))
return false;
if (!this.predicate.equals(that.predicate))
return false;
}
boolean this_present_deadline = true && this.isSetDeadline();
boolean that_present_deadline = true && that.isSetDeadline();
if (this_present_deadline || that_present_deadline) {
if (!(this_present_deadline && that_present_deadline))
return false;
if (!this.deadline.equals(that.deadline))
return false;
}
boolean this_present_continuation = true;
boolean that_present_continuation = true;
if (this_present_continuation || that_present_continuation) {
if (!(this_present_continuation && that_present_continuation))
return false;
if (this.continuation != that.continuation)
return false;
}
boolean this_present_alternativeContinuation = true;
boolean that_present_alternativeContinuation = true;
if (this_present_alternativeContinuation || that_present_alternativeContinuation) {
if (!(this_present_alternativeContinuation && that_present_alternativeContinuation))
return false;
if (this.alternativeContinuation != that.alternativeContinuation)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(ExternalChoiceClause other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
ExternalChoiceClause typedOther = (ExternalChoiceClause)other;
lastComparison = Boolean.valueOf(isSetTransactionType()).compareTo(typedOther.isSetTransactionType());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTransactionType()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.transactionType, typedOther.transactionType);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetBinders()).compareTo(typedOther.isSetBinders());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetBinders()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.binders, typedOther.binders);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetRemainderVar()).compareTo(typedOther.isSetRemainderVar());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRemainderVar()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.remainderVar, typedOther.remainderVar);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetPredicate()).compareTo(typedOther.isSetPredicate());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPredicate()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.predicate, typedOther.predicate);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetDeadline()).compareTo(typedOther.isSetDeadline());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetDeadline()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.deadline, typedOther.deadline);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetContinuation()).compareTo(typedOther.isSetContinuation());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetContinuation()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.continuation, typedOther.continuation);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetAlternativeContinuation()).compareTo(typedOther.isSetAlternativeContinuation());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetAlternativeContinuation()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.alternativeContinuation, typedOther.alternativeContinuation);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("ExternalChoiceClause(");
boolean first = true;
sb.append("transactionType:");
if (this.transactionType == null) {
sb.append("null");
} else {
sb.append(this.transactionType);
}
first = false;
if (!first) sb.append(", ");
sb.append("binders:");
if (this.binders == null) {
sb.append("null");
} else {
sb.append(this.binders);
}
first = false;
if (!first) sb.append(", ");
sb.append("remainderVar:");
if (this.remainderVar == null) {
sb.append("null");
} else {
sb.append(this.remainderVar);
}
first = false;
if (!first) sb.append(", ");
sb.append("predicate:");
if (this.predicate == null) {
sb.append("null");
} else {
sb.append(this.predicate);
}
first = false;
if (!first) sb.append(", ");
sb.append("deadline:");
if (this.deadline == null) {
sb.append("null");
} else {
sb.append(this.deadline);
}
first = false;
if (!first) sb.append(", ");
sb.append("continuation:");
sb.append(this.continuation);
first = false;
if (!first) sb.append(", ");
sb.append("alternativeContinuation:");
sb.append(this.alternativeContinuation);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bit_vector = new BitSet(1);
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class ExternalChoiceClauseStandardSchemeFactory implements SchemeFactory {
public ExternalChoiceClauseStandardScheme getScheme() {
return new ExternalChoiceClauseStandardScheme();
}
}
private static class ExternalChoiceClauseStandardScheme extends StandardScheme<ExternalChoiceClause> {
public void read(org.apache.thrift.protocol.TProtocol iprot, ExternalChoiceClause struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // TRANSACTION_TYPE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.transactionType = iprot.readString();
struct.setTransactionTypeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // BINDERS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list34 = iprot.readListBegin();
struct.binders = new ArrayList<Binder>(_list34.size);
for (int _i35 = 0; _i35 < _list34.size; ++_i35)
{
Binder _elem36; // required
_elem36 = new Binder();
_elem36.read(iprot);
struct.binders.add(_elem36);
}
iprot.readListEnd();
}
struct.setBindersIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // REMAINDER_VAR
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.remainderVar = iprot.readString();
struct.setRemainderVarIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // PREDICATE
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.predicate = new Expression();
struct.predicate.read(iprot);
struct.setPredicateIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // DEADLINE
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.deadline = new DeadlineExp();
struct.deadline.read(iprot);
struct.setDeadlineIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 6: // CONTINUATION
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.continuation = iprot.readI32();
struct.setContinuationIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 7: // ALTERNATIVE_CONTINUATION
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.alternativeContinuation = iprot.readI32();
struct.setAlternativeContinuationIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, ExternalChoiceClause struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.transactionType != null) {
oprot.writeFieldBegin(TRANSACTION_TYPE_FIELD_DESC);
oprot.writeString(struct.transactionType);
oprot.writeFieldEnd();
}
if (struct.binders != null) {
oprot.writeFieldBegin(BINDERS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.binders.size()));
for (Binder _iter37 : struct.binders)
{
_iter37.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
if (struct.remainderVar != null) {
oprot.writeFieldBegin(REMAINDER_VAR_FIELD_DESC);
oprot.writeString(struct.remainderVar);
oprot.writeFieldEnd();
}
if (struct.predicate != null) {
oprot.writeFieldBegin(PREDICATE_FIELD_DESC);
struct.predicate.write(oprot);
oprot.writeFieldEnd();
}
if (struct.deadline != null) {
oprot.writeFieldBegin(DEADLINE_FIELD_DESC);
struct.deadline.write(oprot);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(CONTINUATION_FIELD_DESC);
oprot.writeI32(struct.continuation);
oprot.writeFieldEnd();
oprot.writeFieldBegin(ALTERNATIVE_CONTINUATION_FIELD_DESC);
oprot.writeI32(struct.alternativeContinuation);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class ExternalChoiceClauseTupleSchemeFactory implements SchemeFactory {
public ExternalChoiceClauseTupleScheme getScheme() {
return new ExternalChoiceClauseTupleScheme();
}
}
private static class ExternalChoiceClauseTupleScheme extends TupleScheme<ExternalChoiceClause> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, ExternalChoiceClause struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetTransactionType()) {
optionals.set(0);
}
if (struct.isSetBinders()) {
optionals.set(1);
}
if (struct.isSetRemainderVar()) {
optionals.set(2);
}
if (struct.isSetPredicate()) {
optionals.set(3);
}
if (struct.isSetDeadline()) {
optionals.set(4);
}
if (struct.isSetContinuation()) {
optionals.set(5);
}
if (struct.isSetAlternativeContinuation()) {
optionals.set(6);
}
oprot.writeBitSet(optionals, 7);
if (struct.isSetTransactionType()) {
oprot.writeString(struct.transactionType);
}
if (struct.isSetBinders()) {
{
oprot.writeI32(struct.binders.size());
for (Binder _iter38 : struct.binders)
{
_iter38.write(oprot);
}
}
}
if (struct.isSetRemainderVar()) {
oprot.writeString(struct.remainderVar);
}
if (struct.isSetPredicate()) {
struct.predicate.write(oprot);
}
if (struct.isSetDeadline()) {
struct.deadline.write(oprot);
}
if (struct.isSetContinuation()) {
oprot.writeI32(struct.continuation);
}
if (struct.isSetAlternativeContinuation()) {
oprot.writeI32(struct.alternativeContinuation);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, ExternalChoiceClause struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(7);
if (incoming.get(0)) {
struct.transactionType = iprot.readString();
struct.setTransactionTypeIsSet(true);
}
if (incoming.get(1)) {
{
org.apache.thrift.protocol.TList _list39 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.binders = new ArrayList<Binder>(_list39.size);
for (int _i40 = 0; _i40 < _list39.size; ++_i40)
{
Binder _elem41; // required
_elem41 = new Binder();
_elem41.read(iprot);
struct.binders.add(_elem41);
}
}
struct.setBindersIsSet(true);
}
if (incoming.get(2)) {
struct.remainderVar = iprot.readString();
struct.setRemainderVarIsSet(true);
}
if (incoming.get(3)) {
struct.predicate = new Expression();
struct.predicate.read(iprot);
struct.setPredicateIsSet(true);
}
if (incoming.get(4)) {
struct.deadline = new DeadlineExp();
struct.deadline.read(iprot);
struct.setDeadlineIsSet(true);
}
if (incoming.get(5)) {
struct.continuation = iprot.readI32();
struct.setContinuationIsSet(true);
}
if (incoming.get(6)) {
struct.alternativeContinuation = iprot.readI32();
struct.setAlternativeContinuationIsSet(true);
}
}
}
}
| [
"ronni.lindsgaard@gmail.com"
] | ronni.lindsgaard@gmail.com |
0e209eacca9fb716ff8580e56d604f11b79f9504 | 593dd311725a6f2bcd587b833d28411bf49a340b | /android/src/main/java/com/vatsal/lavpn/lavpn/openvpn/core/StatusListener.java | 2a0a3685dedf189cc07a4b28cae55c2853c844db | [] | no_license | VatsalLahagora/lavpn | 66ab016067aa58a4067358cecb42dfa4916da989 | b750b1e09760ee3e39347bfe0abc3f0b8cca204b | refs/heads/master | 2023-09-03T04:04:05.855387 | 2021-11-17T13:15:37 | 2021-11-17T13:15:37 | 429,051,798 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,737 | java | /*
* Copyright (c) 2012-2016 Arne Schwabe
* Distributed under the GNU GPL v2 with additional terms. For full terms see the file doc/LICENSE.txt
*/
package com.vatsal.lavpn.lavpn.openvpn.core;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.util.Log;
import com.vatsal.lavpn.lavpn.aidl.core.IStatusCallbacks;
import com.vatsal.lavpn.lavpn.openvpn.core.VpnStatus.LogLevel;
import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
import io.flutter.BuildConfig;
/**
* Created by arne on 09.11.16.
*/
public class StatusListener implements VpnStatus.LogListener{
private File mCacheDir;
private Context mContext;
private IStatusCallbacks mCallback = new IStatusCallbacks.Stub() {
@Override
public void newLogItem(LogItem item) throws RemoteException {
VpnStatus.newLogItem(item);
}
@Override
public void updateStateString(String state, String msg, int resid, ConnectionStatus
level, Intent intent) throws RemoteException {
VpnStatus.updateStateString(state, msg, resid, level, intent);
}
@Override
public void updateByteCount(long inBytes, long outBytes) throws RemoteException {
VpnStatus.updateByteCount(inBytes, outBytes);
}
@Override
public void connectedVPN(String uuid) throws RemoteException {
VpnStatus.setConnectedVPNProfile(uuid);
}
};
private ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName className,
IBinder service) {
// We've bound to LocalService, cast the IBinder and get LocalService instance
IServiceStatus serviceStatus = IServiceStatus.Stub.asInterface(service);
try {
/* Check if this a local service ... */
if (service.queryLocalInterface("de.blinkt.openvpn.core.IServiceStatus") == null) {
// Not a local service
VpnStatus.setConnectedVPNProfile(serviceStatus.getLastConnectedVPN());
VpnStatus.setTrafficHistory(serviceStatus.getTrafficHistory());
ParcelFileDescriptor pfd = serviceStatus.registerStatusCallback(mCallback);
DataInputStream fd = new DataInputStream(new ParcelFileDescriptor.AutoCloseInputStream(pfd));
short len = fd.readShort();
byte[] buf = new byte[65336];
while (len != 0x7fff) {
fd.readFully(buf, 0, len);
LogItem logitem = new LogItem(buf, len);
VpnStatus.newLogItem(logitem, false);
len = fd.readShort();
}
fd.close();
} else {
VpnStatus.initLogCache(mCacheDir);
/* Set up logging to Logcat with a context) */
if (BuildConfig.DEBUG) {
VpnStatus.addLogListener(StatusListener.this);
}
}
} catch (RemoteException | IOException e) {
e.printStackTrace();
VpnStatus.logException(e);
}
}
@Override
public void onServiceDisconnected(ComponentName arg0) {
VpnStatus.removeLogListener(StatusListener.this);
}
};
public void init(Context c) {
Intent intent = new Intent(c, OpenVPNStatusService.class);
intent.setAction(OpenVPNService.START_SERVICE);
mCacheDir = c.getCacheDir();
c.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
this.mContext = c;
}
@Override
public void newLog(LogItem logItem) {
switch (logItem.getLogLevel()) {
case INFO:
Log.i("OpenVPN", logItem.getString(mContext));
break;
case DEBUG:
Log.d("OpenVPN", logItem.getString(mContext));
break;
case ERROR:
Log.e("OpenVPN", logItem.getString(mContext));
break;
case VERBOSE:
Log.v("OpenVPN", logItem.getString(mContext));
break;
case WARNING:
default:
Log.w("OpenVPN", logItem.getString(mContext));
break;
}
}
}
| [
"vatsal@lahagora.in"
] | vatsal@lahagora.in |
91ec4485d1a9f5c2699c70ff1d9ac6ac3fce912d | e7315407d1c469f03e4e4e53743e90e8446ccff1 | /src/main/java/algorithm/binary_tree/IterateBinaryTreeWithoutRecursion.java | 7375bd2def09650cd6bba324620804aa662882db | [] | no_license | prettysoldier/mycode | 69535bc74260ba08bb36019c0f9e4d773b73a2ac | 78c26e89c21b8c6074e419568cbbdc2cec56b940 | refs/heads/master | 2022-12-08T03:37:35.483956 | 2020-03-11T08:26:14 | 2020-03-11T08:26:14 | 131,407,216 | 4 | 0 | null | 2022-11-16T05:00:42 | 2018-04-28T12:22:38 | Java | UTF-8 | Java | false | false | 3,722 | java | package algorithm.binary_tree;
import java.util.Stack;
/**
* 用非递归实现遍历二叉树:前序、中序、后序。
* @author hsj
* @create 2019/11/19
*/
public class IterateBinaryTreeWithoutRecursion {
public static void main(String[] args) {
BinaryTree tree = BinaryTree.initial(1, 2, 3, 4, 5, 6, 7, 8);
IterateBinaryTreeWithoutRecursion.preOrderRecur(tree);
System.out.println();
IterateBinaryTreeWithoutRecursion.inOrderRecur(tree);
System.out.println();
IterateBinaryTreeWithoutRecursion.posOrderRecur(tree);
System.out.println();
IterateBinaryTreeWithoutRecursion.posOrderRecur2(tree);
}
/**
* 先序遍历:先根后左右
*
* @param tree
*/
private static void preOrderRecur(BinaryTree tree){
if(tree == null){
return;
}
Stack<BinaryTree> stack = new Stack<>();
stack.push(tree);
while(!stack.isEmpty()){
BinaryTree curr = stack.pop();
System.out.print(curr.getValue() + " ");
if(curr.getRight() != null){
stack.push(curr.getRight());
}
if(curr.getLeft() != null){
stack.push(curr.getLeft());
}
}
}
/**
* 中序遍历:左根右
* @param root
*/
public static void inOrderRecur(BinaryTree root){
if(root == null){
return;
}
Stack<BinaryTree> stack = new Stack<>();
BinaryTree curr = root;
while(!stack.isEmpty() || curr != null){
if(curr != null){
// 把所有左边界压栈
stack.push(curr);
curr = curr.getLeft();
} else{
// 当左节点为null时,弹出并输出,然后指向有节点。
curr = stack.pop();
System.out.print(curr.getValue() + " ");
curr = curr.getRight();
}
}
}
/**
* 后序遍历:左右根
* 先压入root, 进入循环:弹出,并依次压入左右,直到栈为空。
* 每个弹出的元素 进入 第二个栈,最后遍历栈。
* @param root
*/
public static void posOrderRecur(BinaryTree root){
if(root == null){
return;
}
// 定义两个栈
Stack<BinaryTree> stack1 = new Stack<>();
Stack<BinaryTree> stack2 = new Stack<>();
stack1.push(root);
BinaryTree curr;
while(!stack1.isEmpty()){
curr = stack1.pop();
stack2.push(curr);
if(curr.getLeft() != null){
stack1.push(curr.getLeft());
}
if(curr.getRight() != null){
stack1.push(curr.getRight());
}
}
while(!stack2.isEmpty()){
System.out.print(stack2.pop().getValue() + " ");
}
}
public static void posOrderRecur2(BinaryTree root){
if(root == null){
return;
}
Stack<BinaryTree> stack = new Stack<>();
stack.push(root);
BinaryTree lastPrint = root;
BinaryTree top;
while(!stack.isEmpty()){
top = stack.peek();
if(top.getLeft() != null && lastPrint != top.getLeft() && lastPrint != top.getRight()){
stack.push(top.getLeft());
}else if(top.getRight() != null && lastPrint != top.getRight()){
stack.push(top.getRight());
}else{
top = stack.pop();
System.out.print(top.getValue() + " ");
lastPrint = top;
}
}
}
}
| [
"louye666@qq.com"
] | louye666@qq.com |
bea0a04cde888f437439aeb33b902dccf179e403 | 27ed61f6bcbc31d4ccde20b6951baf82b322155e | /candpapp/src/main/java/com/ganga/cnp/model/Product.java | 21feb2488568f057ad075a3b15f6ff86f1a14738 | [] | no_license | DiGanga19/Product_-_Coupon_App | 67a640ea8a162224a7b1a63eebcfa43a30b5a678 | f728c1410c4dca01a36647c44ebe189561457138 | refs/heads/main | 2023-08-28T08:40:44.556836 | 2021-11-10T19:09:14 | 2021-11-10T19:09:14 | 426,743,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,036 | java | package com.ganga.cnp.model;
import java.math.BigDecimal;
public class Product {
private int id;
private String name;
private String description;
private BigDecimal price;
private String couponCode;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public String getCouponCode() {
return couponCode;
}
public void setCouponCode(String couponCode) {
this.couponCode = couponCode;
}
@Override
public String toString() {
return "Product [id=" + id + ", name=" + name + ", description=" + description + ", price=" + price
+ ", couponCode=" + couponCode + "]";
}
}
| [
"noreply@github.com"
] | noreply@github.com |
549d7ebf481b2a4655a50f4b44e3e11abd598a7b | 5ee6c8cae0972060638a55dab6dd5b2f40970f56 | /src/main/java/ma/enset/Test.java | 7240f6641dfa1271d4e227109ec61b4468de41aa | [] | no_license | ELFAHIM96/WT1 | f7705df9e060088ec196a8b6a7a988d345fab3e5 | 6c3999a25fca378a3d72fa8d040530777775d6d6 | refs/heads/main | 2023-07-31T23:58:39.107455 | 2021-09-16T20:56:11 | 2021-09-16T20:56:11 | 407,331,169 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 175 | java | /**
comment
*/
package ma.enset;
public class Test{
public static void main(String[]args){
//------------------------
System.out.println("hello");
}
} | [
"elfahimomar95@gmail.com"
] | elfahimomar95@gmail.com |
a169d58756c4dab2964b920c6501bdb92a4905dc | 1043e08e6e47b9bdbd2eb8015eefe90e5402ffc3 | /Oceania/src/Parser/Parser.java | b9c574a408199488c180ef9a9ba2ab2b53fe07da | [] | no_license | Andreas2200/semesterProjekt | 5691d5cf2a86008849e0413f5642725afcafa266 | db7eb78bebd399974618ee0d1b317630615e418c | refs/heads/master | 2023-02-02T09:22:15.430904 | 2020-12-11T22:32:52 | 2020-12-11T22:32:52 | 297,556,462 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,118 | java | package Parser;
import Commands.Command;
import Commands.CommandWords;
import java.util.Scanner;
import java.util.StringTokenizer;
public class Parser
{
private CommandWords commands;
private Scanner reader;
public Parser()
{
commands = new CommandWords();
reader = new Scanner(System.in);
}
public Command getCommand() //Denne metode tager input, i form af tekst og deler det op i 2 ord.
{
String inputLine;
String word1 = null;
String word2 = null;
String word3 = null;
System.out.print("> ");
inputLine = reader.nextLine();
Scanner tokenizer = new Scanner(inputLine);
if(tokenizer.hasNext()) {
word1 = tokenizer.next();
if(tokenizer.hasNext()) {
word2 = tokenizer.next();
if(tokenizer.hasNext()){
word3 = tokenizer.next();
}
}
}
return new Command(commands.getCommandWord(word1), word2, word3);
}
public void showCommands()
{
commands.showAll();
}
}
| [
"31403296+Andreas2200@users.noreply.github.com"
] | 31403296+Andreas2200@users.noreply.github.com |
e6b506acefe4e0191a10365860a43b582fbb50b8 | 1b7b67368e30932a0068f203d2cd0053098bec24 | /src/com/coder/简单/删除排序链表中的重复元素.java | 46828b3ee63bf2d6ebebbc08b1991d75200b4a8d | [] | no_license | wjlonger/LeetCode | e7f08fd65071e1780eca90aff49bf663d7122226 | 4747df1d1af8c77178614213028132eea1c534bf | refs/heads/master | 2020-03-23T09:01:22.096710 | 2019-10-31T06:52:35 | 2019-10-31T06:52:35 | 141,362,317 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | package com.coder.简单;
import com.coder.初级算法.链表.ListNode;
public class 删除排序链表中的重复元素 {
/**
*
* 给定一个排序链表,删除所有重复的元素,使得每个元素只出现一次。
*
* 示例 1:
*
* 输入: 1->1->2
* 输出: 1->2
* 示例 2:
*
* 输入: 1->1->2->3->3
* 输出: 1->2->3
*/
public ListNode deleteDuplicates(ListNode head) {
ListNode p = head;
while (null != p && null != p.next){
if(p.val == p.next.val){
p.next = p.next.next;
}else{
p = p.next;
}
}
return head;
}
}
| [
"wujunlong@mankebao.com"
] | wujunlong@mankebao.com |
6cafeb1537551e17b28ec3bc4550d1e5bbfb64c7 | cd81256f9b10fea3a983b2cbf36bc17fd325f6dd | /src/com/karolmajta/tapper/model/ITapBoard.java | 2ff477b28df4750d54fedb43dad428c131fb2f31 | [
"JSON"
] | permissive | karolmajta/tapper | 3ba0343b060d7fe152df6395adaf0c690a69ce57 | 9d55f640bc02fa9374e8c81da15b16c8f7b0d92e | refs/heads/master | 2021-01-21T13:56:30.191269 | 2013-01-01T11:39:02 | 2013-01-01T11:39:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package com.karolmajta.tapper.model;
public interface ITapBoard {
public boolean tap(float x, float y);
public int [] getScores();
public boolean isActive();
public int[] getDimensions();
}
| [
"karolmajta@gmail.com"
] | karolmajta@gmail.com |
7564a5e960fc240b1ca0ed09cf84d66298841691 | 83d4d6767d367c373c516156cf304ee8b422fae7 | /src/com/gyf/bos/model/User.java | 2dcff87926adaa8caf3bd72d4bb1d609ce65fe3b | [] | no_license | CNLebel/gzbos | bf3b25ed0c8f8ad78c3fc66122b9d6ad444cc5b7 | 3485c7d40241ebce653a14c14aa86bd976f64b6a | refs/heads/master | 2020-09-01T05:01:45.693668 | 2019-11-01T00:52:33 | 2019-11-01T00:52:33 | 218,886,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,880 | java | package com.gyf.bos.model;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
public class User implements Serializable{
private String id;
private String username;
private String password;
private Double salary;
private Date birthday;
private String gender;
private String station;
private String telephone;
private String remark;
public String getBirthdayStr(){
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
return sdf.format(birthday);
} catch (Exception e){
return "";
}
}
public String getRolesStr(){
String str = "";
for (Role role : roles){
str += role.getName() + "、";
}
return str;
}
private Set<Role> roles = new HashSet<Role>();
public Set<Role> getRoles() {
return roles;
}
public void setRoles(Set<Role> roles) {
this.roles = roles;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Double getSalary() {
return salary;
}
public void setSalary(Double salary) {
this.salary = salary;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getStation() {
return station;
}
public void setStation(String station) {
this.station = station;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
@Override
public String toString() {
return "User{" +
"id='" + id + '\'' +
", username='" + username + '\'' +
", password='" + password + '\'' +
", salary=" + salary +
", birthday=" + birthday +
", gender='" + gender + '\'' +
", station='" + station + '\'' +
", telephone='" + telephone + '\'' +
", remark='" + remark + '\'' +
'}';
}
}
| [
"tong981028@outlook.com"
] | tong981028@outlook.com |
f2d4b6af7254397f7ce646a4c36e564ec2da2aec | 5facb8ccdf80a46d7f19828dc98448fdd9d5f882 | /src/midterm1/Stdin.java | 60c606c59add61665606fa12fb461c20d905ad1d | [] | no_license | Spr21CSC210/Public-Code-Examples | 6944a485ee77b935cc89b1d17114761ca123f598 | 1193b6a52ff5abea1b6c928653d6adeeff8360bf | refs/heads/main | 2023-04-21T03:34:03.806084 | 2021-04-28T23:21:53 | 2021-04-28T23:21:53 | 329,386,984 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,688 | java | package midterm1;
import java.util.Scanner;
public class Stdin {
public static void main(String[] args) {
/*
* Command Line Arguments
*
* These come from the command-line arguments. To change these,
* in your top menu bar, click 'Run'->'Run Configurations...'
* Then a new box will pop up. Click on the 'arguments' tab.
* Then in the first box, under 'Program Arguments:' type in
* whichever arguments you would like.
*
* Note that if you haven't given command line arguments, the below
* lines will cause this program to crash since args will not have
* any elements.
*/
System.out.println(args[0]);
System.out.println(args[1]);
/*
* The below scanner object allows us to read in from the user since
* we created a new Scanner and passed in 'System.in'
*/
Scanner userInput = new Scanner(System.in);
// Prints to the console asking the user for a file name.
System.out.println("File name? ");
// Reads in whatever the user types next.
String fileName = userInput.next();
// Prints what fileName the user typed in.
System.out.println("filename = " + fileName);
// Prints to the console to ask for another file name.
System.out.println("Second file name? ");
// Reads in whatever the user types in next
fileName = userInput.next();
// Prints out the second file name read in
System.out.println("filename2 = " + fileName);
// Don't forget to close all Scanners!
userInput.close();
}
}
| [
"tconklin@alumni.stanford.edu"
] | tconklin@alumni.stanford.edu |
66e6e3ad7b42eb380869278672491e30261e3caf | 363ce1a4bd3475b2b5781754f6cfb44e95371d28 | /src/main/java/Processing.java | 68ffcf5656acb48494c2d51f9597d02c6d84668d | [] | no_license | KirillZaatravkin/ali | 8f8819624d41e28547f4fbf22154b00acb8946ff | f2d00ec9f679ef1aa6d68fa6d8fab92d48c9d025 | refs/heads/master | 2022-11-23T16:34:54.523670 | 2019-08-07T14:32:54 | 2019-08-07T14:32:54 | 201,065,322 | 0 | 0 | null | 2022-11-16T07:00:30 | 2019-08-07T14:19:54 | Java | UTF-8 | Java | false | false | 756 | java | import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Processing {
// execute script
public String getInformationFromURL(String URL, CloseableHttpClient client) throws IOException {
HttpGet request = new HttpGet(URL);
CloseableHttpResponse response = client.execute(request);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
String result = rd.readLine();
System.out.println(result);
response.close();
return result;
}
}
| [
"zatravkin.kir@gmail.com"
] | zatravkin.kir@gmail.com |
2a07f381e57b7e6d1638cfe4ced152c1e048eaf8 | 78c23c3fd15e270d91d50e69f62f361d00dbc9e6 | /src/main/java/de/alpharogroup/swing/document/RangeDocument.java | 17894ec2f0016c9053f79d644a3f79a5f8df4ec5 | [
"MIT"
] | permissive | vpidaparthi/swing-components | 0a1c5f8bc671597a930a38b61ac50c2d3d0d2114 | eba738a1443cb16da8d167afa606529937a9987f | refs/heads/master | 2022-04-17T06:56:50.527996 | 2019-02-09T13:42:41 | 2019-02-09T13:42:41 | 254,877,966 | 0 | 0 | null | 2020-04-11T13:50:58 | 2020-04-11T13:50:57 | null | UTF-8 | Java | false | false | 3,846 | java | /**
* The MIT License
*
* Copyright (C) 2015 Asterios Raptis
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package de.alpharogroup.swing.document;
import java.awt.Toolkit;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import de.alpharogroup.math.MathExtensions;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.experimental.FieldDefaults;
/**
* The class {@link RangeDocument} can take any character in the range of the given minimum and
* maximum
*/
@Getter
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
public class RangeDocument extends PlainDocument
{
private static final long serialVersionUID = 1L;
int maximum;
int minimum;
/**
* Instantiates a new {@link RangeDocument} object
*
* @param minimum
* the minimum
* @param maximum
* the maximum
*/
public RangeDocument(int minimum, int maximum)
{
this.minimum = minimum;
this.maximum = maximum;
}
/**
* {@inheritDoc}
*/
@Override
public void insertString(int offset, String string, AttributeSet attributes)
throws BadLocationException
{
if (string == null)
{
return;
}
else
{
String newValue;
int length = getLength();
if (length == 0)
{
newValue = string;
}
else
{
String currentContent = getText(0, length);
StringBuffer currentBuffer = new StringBuffer(currentContent);
currentBuffer.insert(offset, string);
newValue = currentBuffer.toString();
}
try
{
validate(newValue);
super.insertString(offset, string, attributes);
}
catch (Exception exception)
{
Toolkit.getDefaultToolkit().beep();
}
}
}
/**
* {@inheritDoc}
*/
@Override
public void remove(int offset, int length) throws BadLocationException
{
int currentLength = getLength();
String currentContent = getText(0, currentLength);
String before = currentContent.substring(0, offset);
String after = currentContent.substring(length + offset, currentLength);
String newValue = before + after;
try
{
validate(newValue);
super.remove(offset, length);
}
catch (Exception exception)
{
Toolkit.getDefaultToolkit().beep();
}
}
/**
* Validate the given value by this {@link RangeDocument} object
*
* @param proposedValue
* the proposed value
* @return the proposed value or throws an IllegalArgumentException if the validation fails
* @throws IllegalArgumentException
* if the validation fails
*/
public String validate(String proposedValue) throws IllegalArgumentException
{
if (MathExtensions.isBetween(minimum, maximum, proposedValue.length(), true, true))
{
return proposedValue;
}
else
{
throw new IllegalArgumentException();
}
}
} | [
"asterios.raptis@gmx.net"
] | asterios.raptis@gmx.net |
7d3eedcff73a21f13fd98a0aca9f72a8e2a0dd16 | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-ws/results/MATH-38b-4-17-Single_Objective_GGA-WeightedSum/org/apache/commons/math/optimization/direct/BOBYQAOptimizer_ESTest.java | f0d00ca56752ee6ba7d5296113a1e4cae22a41fb | [
"MIT",
"CC-BY-4.0"
] | permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,126 | java | /*
* This file was automatically generated by EvoSuite
* Fri Jan 17 22:31:41 UTC 2020
*/
package org.apache.commons.math.optimization.direct;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import org.apache.commons.math.analysis.SumSincFunction;
import org.apache.commons.math.optimization.GoalType;
import org.apache.commons.math.optimization.direct.BOBYQAOptimizer;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true)
public class BOBYQAOptimizer_ESTest extends BOBYQAOptimizer_ESTest_scaffolding {
@Test(timeout = 4000)
public void test0() throws Throwable {
BOBYQAOptimizer bOBYQAOptimizer0 = new BOBYQAOptimizer(13);
SumSincFunction sumSincFunction0 = new SumSincFunction(720);
GoalType goalType0 = GoalType.MAXIMIZE;
double[] doubleArray0 = new double[5];
// Undeclared exception!
bOBYQAOptimizer0.optimize(720, sumSincFunction0, goalType0, doubleArray0);
}
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
442cf34bad380f07f9a6ba3abdc05e89c14d165b | 8a7ede5aec466326c092437b691d3575db151ff4 | /app/src/main/java/com/example/homework7/MainActivity.java | 35ced56e880724faf452ebb67cf5e2c99259215f | [] | no_license | avinashkumar95/Android-Relative-Layout-Example | f201975249a8b3e9ddfbaf61495660643688a84f | e45ddd1e5756349e80e349e987b19ce004757f13 | refs/heads/master | 2022-04-23T23:06:25.816657 | 2020-04-23T20:33:03 | 2020-04-23T20:33:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 335 | java | package com.example.homework7;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
| [
"avinash.cse10@gmail.com"
] | avinash.cse10@gmail.com |
4c928be27276fc863cddd496272f267d9404ef04 | a42f70eb4c33b644141c7c593c16371005fae99b | /src/main/java/icbm/classic/api/reg/events/MissileTargetRegistryEvent.java | 80379c46f79188a735001e9ff0421d15b309d61b | [
"MIT"
] | permissive | BuiltBrokenModding/ICBM-Classic | 107f5eed162b9de4eb431f7e5505e06c38b9b04b | 3e6e0f4fa7db5a656ea6537516dc51c030b38dc5 | refs/heads/prod/1.12 | 2023-08-30T10:54:27.051837 | 2023-08-25T18:01:38 | 2023-08-25T18:01:38 | 78,190,318 | 49 | 85 | MIT | 2023-08-25T18:01:40 | 2017-01-06T08:49:03 | Java | UTF-8 | Java | false | false | 425 | java | package icbm.classic.api.reg.events;
import icbm.classic.api.reg.obj.IMissileTargetReg;
import net.minecraftforge.fml.common.eventhandler.Event;
/**
* Fired to allow registering missile target builders
*/
public class MissileTargetRegistryEvent extends Event
{
public final IMissileTargetReg registry;
public MissileTargetRegistryEvent(IMissileTargetReg registry)
{
this.registry = registry;
}
}
| [
"rseifert.phone@gmail.com"
] | rseifert.phone@gmail.com |
5c749f7d43a0d9be517756413ab681603ed41ae9 | 1081e090fc5107cbdb1bebdef8dacba2d249ec86 | /sos/.svn/pristine/cd/cdc05639bab37d9cc6c477eaffdbcc6fb96a00b5.svn-base | ffce458414e2f323892f884f98926d56d895bf9e | [] | no_license | ysylmqq/segWorkspace | ec9c992ef74897a4078ebd456a605e94d93ac3a1 | 3f621fb57dd285e3a6549f34aa45f4ff1df7098a | refs/heads/master | 2021-05-10T08:27:59.458352 | 2018-01-26T00:39:31 | 2018-01-26T00:39:31 | 118,879,439 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,485 | package com.gboss.dao.impl;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.hibernate.Query;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.gboss.comm.SystemException;
import com.gboss.dao.ObdFaultDao;
import com.gboss.util.DateUtil;
import com.gboss.util.StringUtils;
import com.gboss.util.page.PageUtil;
/**
* @Package:com.gboss.dao.impl
* @ClassName:ObdFaultDaoImpl
* @Description:TODO
* @author:bzhang
* @date:2014-12-25 上午11:15:47
*/
@Repository("obdFaultDao")
@Transactional
public class ObdFaultDaoImpl extends BaseDaoImpl implements ObdFaultDao {
@Override
public List<HashMap<String, Object>> findobdFaultList(Long companyId,
Map<String, Object> conditionMap, String order, boolean isDesc,
int pn, int pageSize) throws SystemException {
StringBuffer sb=new StringBuffer();
sb.append(" select b.file_id as id,b.subco_no,b.file_name,b.url,date_format(b.st_date,'%Y-%m-%d') as st_date,b.stamp ");
sb=getConditionHql(companyId, sb,conditionMap);
sb.append(" order by b.file_id desc");
Query query = sessionFactory.getCurrentSession().createSQLQuery(sb.toString());
query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
if (pn>0 && pageSize>0) {
query.setFirstResult(PageUtil.getPageStart(pn, pageSize));
query.setMaxResults(pageSize);
}
return query.list();
}
private StringBuffer getConditionHql(Long id, StringBuffer sb,Map conditionMap){
sb.append(" from t_ba_obd_fault b where 1=1 ");
sb.append(" and b.subco_no=").append(id);
if (StringUtils.isNotNullOrEmpty(conditionMap.get("startDate"))) {
sb.append(" and b.st_date >='").append(DateUtil.dateforSearch(conditionMap, "startDate")).append("'");
}
if (StringUtils.isNotNullOrEmpty(conditionMap.get("endDate"))) {
sb.append(" and b.st_date <='").append(DateUtil.dateforSearch(conditionMap, "endDate")).append("'");
}
return sb;
}
@Override
public int countObdFault(Long companyId, Map<String, Object> conditionMap)
throws SystemException {
StringBuffer sb=new StringBuffer();
sb.append(" select count(b.file_id) ");
sb=getConditionHql(companyId, sb,conditionMap);
Query query = sessionFactory.getCurrentSession().createSQLQuery(sb.toString());
return ((BigInteger)query.uniqueResult()).intValue();
}
}
| [
"2268617174@qq.com"
] | 2268617174@qq.com | |
03a1759c2b3852d0f2be00fbd6e67a09a924a447 | 05073514bae74f3c76fba181d8b29a9228592500 | /src/com/example/parallaxxlistview/MainActivity.java | aba59c0739bf3eadb878c05eaeb9a71ea5e0617c | [] | no_license | hoangjian123/ParallaxXListView | 895922f254b97503eddd39543319e44834ebc7de | e88b917a0cdfcfdcac0d9c0e03e7f958743d6265 | refs/heads/master | 2021-01-22T04:36:31.791954 | 2015-03-21T18:13:53 | 2015-03-21T18:13:53 | 32,643,099 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,263 | java | package com.example.parallaxxlistview;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.SimpleAdapter;
public class MainActivity extends ActionBarActivity {
private ParallaxXListview listview;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listview = (ParallaxXListview) findViewById(R.id.listview);
listview.setPullLoadEnable(true);
listview.setPullRefreshEnable(true);
String[] from = { "Text", "Button" };
int[] to = { R.id.text, R.id.button };
List<Map<String, ?>> list = new ArrayList<Map<String, ?>>();
for (int i = 0; i < 10; i++) {
Map<String, String> m = new HashMap<String, String>();
m.put("Text", "Text" + i);
m.put("Button", "Button" + i);
list.add(m);
}
SimpleAdapter adapter = new SimpleAdapter(this, list,
R.layout.parallaxlistview_test_item, from, to);
listview.setAdapter(adapter);
listview.setXListViewListener(new IXListViewListener() {
@Override
public void onRefresh() {
// TODO Auto-generated method stub
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
listview.stopRefresh();
}
}, 2000);
}
@Override
public void onLoadMore() {
// TODO Auto-generated method stub
listview.stopLoadMore();
}
});
// listview.setNoMoreData();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, 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();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"yangzhi12341@hotmail.com"
] | yangzhi12341@hotmail.com |
599b73004d1a03d26173d9bb91b2f6f1f65c1054 | 656dde0985ee880c02aa4d39c286e61f78c872e2 | /server/src/test/java/lb/census/record/metrics/SubHourMetricsCollectorTest.java | 60193911df29be570999db61d6fa97cc2da1d1e8 | [
"MIT"
] | permissive | schophil/census | 8fc0cc3deb77a439abffb53b87738c5219eb18bf | 5d334eb12900cddc16c666a7d3f8eb9f6bc473b1 | refs/heads/master | 2021-09-15T05:49:50.942483 | 2018-03-25T12:53:16 | 2018-03-25T12:53:16 | 106,168,635 | 0 | 0 | MIT | 2018-03-13T21:44:01 | 2017-10-08T10:45:12 | Java | UTF-8 | Java | false | false | 1,879 | java | package lb.census.record.metrics;
import lb.census.record.log.LogRecord;
import org.junit.Assert;
import org.junit.Test;
import java.util.Calendar;
public class SubHourMetricsCollectorTest {
private Calendar calendar = Calendar.getInstance();
@Test
public void testSomeHours() {
SubHourMetricsCollector<CounterMetrics> collector = new SubHourMetricsCollector<>(
() -> new CounterMetrics()
);
LogRecord[] records = {
makeLogRecord(3),
makeLogRecord(5),
makeLogRecord(6),
makeLogRecord(3),
makeLogRecord(4),
makeLogRecord(6)
};
for (LogRecord logRecord : records) {
collector.add(logRecord);
}
CounterMetrics[] metrics = collector.getMetricsCollectors(new CounterMetrics[24]);
Assert.assertNotNull(metrics[3]);
Assert.assertNotNull(metrics[5]);
Assert.assertNotNull(metrics[6]);
Assert.assertNotNull(metrics[4]);
for (int i = 0; i < metrics.length; i++) {
switch (i) {
case 3:
case 5:
case 6:
case 4:
Assert.assertNotNull(metrics[i]);
break;
default:
Assert.assertNull(metrics[i]);
}
}
Assert.assertEquals(metrics[3].getCounter(), 2);
Assert.assertEquals(metrics[5].getCounter(), 1);
Assert.assertEquals(metrics[6].getCounter(), 2);
Assert.assertEquals(metrics[4].getCounter(), 1);
}
public LogRecord makeLogRecord(int hourOfTheDay) {
calendar.set(Calendar.HOUR_OF_DAY, hourOfTheDay);
LogRecord logRecord = new LogRecord();
logRecord.setTimestamp(calendar.getTime());
return logRecord;
}
}
| [
"schophil@icloud.com"
] | schophil@icloud.com |
44fc221a6352d9ce82a2bfeb43df1180a8ce3d26 | 34b0fd8a26c8b40b5f94135981d4adfe4330c8e4 | /src/main/java/br/com/zupacademy/gabriel/casadocodigo/cliente/ClienteController.java | 1abfd42626ab447fe06e92012fdfad44b1020956 | [
"Apache-2.0"
] | permissive | bentoco/orange-talents-03-template-casa-do-codigo | 8e5c439ec1b1b954245fbcca0a43cb2e20215774 | 7b72d7eae2d3e05296f0cd704bfa1de5a4f798ba | refs/heads/main | 2023-04-08T16:39:36.788100 | 2021-04-17T19:17:15 | 2021-04-17T19:17:15 | 349,047,538 | 0 | 0 | Apache-2.0 | 2021-03-18T11:28:25 | 2021-03-18T11:28:24 | null | UTF-8 | Java | false | false | 858 | java | package br.com.zupacademy.gabriel.casadocodigo.cliente;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.transaction.Transactional;
import javax.validation.Valid;
@RestController
@RequestMapping("/api/clientes")
public class ClienteController {
@PersistenceContext
private EntityManager manager;
@PostMapping
@Transactional
public String create( @RequestBody @Valid ClienteNovoRequest request ){
Cliente novoCliente = request.toModel(manager);
manager.persist(novoCliente);
return novoCliente.toString();
}
}
| [
"hi.bentoco@gmail.com"
] | hi.bentoco@gmail.com |
f6c45d194ba1182bd648c53c565862692a0bde05 | 84afe7dc6d250c8828f655f1632c751217e7aa4a | /src/com/pattern/abstractfactory/FactoryProducer.java | 43307bceeb3fff3d38d268a9acf65db74d7ee6a1 | [] | no_license | quanchaozhao/IDEA-WEB | eda772509f7172d10194335108b5e683bbe08f3e | 3a0560910e9a3a3a6a79c75a510874e829d52423 | refs/heads/master | 2020-03-22T23:32:07.576763 | 2018-07-13T07:37:06 | 2018-07-13T07:37:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 525 | java | package com.pattern.abstractfactory;
/**
* Created by Interllij IDEA
* User:Zqc
* Data:2018/6/13
* Time:12:55
* Email:quanchaozhao@yeah.net
* To change this template use File | Settings | File Templates.
*/
public class FactoryProducer {
public static AbstractFactory getFactory(String choice){
if (choice.equalsIgnoreCase("SHAPE")){
return new ShapeFactory();
} else if (choice.equalsIgnoreCase("COLOR")){
return new ColorFactory();
}
return null;
}
}
| [
"quanchaozhao@yeah.net"
] | quanchaozhao@yeah.net |
92544c0cd7e0198a807bdd75a49d2134e59fdb81 | 7caf71329884a304218a189e8c426823775616a1 | /src/objecttype/behavioral/Strategy/Example1/Charging.java | 825d80bed3086c3e62c076d22585f4cddef2e9aa | [] | no_license | LAILAIWA/design-pattern-personal | 1b35c524ea92f23c25dbb796b995460d00fbf3e4 | 12cde496f2c1883e163993ea92c67597cfe23181 | refs/heads/master | 2021-02-09T17:39:22.989538 | 2020-03-02T07:32:51 | 2020-03-02T07:32:51 | 244,308,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package objecttype.behavioral.Strategy.Example1;
public abstract class Charging {
public abstract double charge(double money);
}
| [
"linyishui168@outlook.com"
] | linyishui168@outlook.com |
2df41005ae58c6f25d631092805f6a12204ab0fd | 976e37b743a3a254f8eea5df784508903efb0355 | /hateoas/src/main/java/ru/itis/hateoas/repository/ReviewRepository.java | 76e6c53e6ca140857642b7cfb88f6ec27f719595 | [] | no_license | Apsadikov/JavaLab5 | a1fe04b48a0fc9ad291cc67e6af1bd23afdffdeb | f6d9b701fe596c3d4ed69def78bc30388a78883f | refs/heads/master | 2023-02-04T23:45:18.587824 | 2020-12-29T20:05:50 | 2020-12-29T20:05:50 | 296,423,974 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 211 | java | package ru.itis.hateoas.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import ru.itis.hateoas.model.Review;
public interface ReviewRepository extends JpaRepository<Review, Long> {
}
| [
"DonPonchik18@gmail.com"
] | DonPonchik18@gmail.com |
99caebe0139661ba052055ce6ecbafc9f383e6e2 | d07900bf792ca7cf83048db1605384ef12f46122 | /app/src/main/java/com/company/jeecounselling_choosethebest/fragments/DiscussionFragment.java | a1cb309c47921ed81909058d7a7bade0260b8265 | [] | no_license | HASH-002/JEE_Counselling_APP | 9d54116ff893fb3ec4ee9181186bfcbaa79407b1 | be0dbcb976fbdbda9a0c5aa1f1bd6bb635652e9e | refs/heads/master | 2023-08-07T08:18:42.657393 | 2021-09-26T08:06:48 | 2021-09-26T08:06:48 | 363,676,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,243 | java | package com.company.jeecounselling_choosethebest.fragments;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.bumptech.glide.Glide;
import com.company.jeecounselling_choosethebest.MessageActivity;
import com.company.jeecounselling_choosethebest.PostActivity;
import com.company.jeecounselling_choosethebest.ProfileActivity;
import com.company.jeecounselling_choosethebest.R;
import com.company.jeecounselling_choosethebest.adapters.BlogPostAdapter;
import com.company.jeecounselling_choosethebest.model.BlogPost;
import com.company.jeecounselling_choosethebest.model.Counsellors;
import com.company.jeecounselling_choosethebest.model.Users;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.firestore.DocumentChange;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.EventListener;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.FirebaseFirestoreException;
import com.google.firebase.firestore.Query;
import com.google.firebase.firestore.QuerySnapshot;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class DiscussionFragment extends Fragment {
// Users type
private Counsellors counsellor;
private Users user;
// Firebase
private FirebaseUser firebaseUser;
private DatabaseReference myRef;
private FirebaseFirestore firebaseFirestore;
// Declaration of Floating Action Button
private FloatingActionButton addPostBtn;
// Flag for user type verification
private Boolean isCounsellor;
private RecyclerView blogListView;
private ArrayList<BlogPost> blog_list;
private BlogPostAdapter blogPostAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_discussion, container, false);
isCounsellor = true;
addPostBtn = view.findViewById(R.id.add_post_btn);
// Setting Posts
blog_list = new ArrayList<>();
blogListView = view.findViewById(R.id.blog_list_view);
blogPostAdapter = new BlogPostAdapter(getContext(),blog_list);
blogListView.setLayoutManager(new LinearLayoutManager(getActivity()));
blogListView.setHasFixedSize(true);
blogListView.setAdapter(blogPostAdapter);
firebaseFirestore = FirebaseFirestore.getInstance();
firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
myRef = FirebaseDatabase.getInstance().getReference("Counsellors").child(firebaseUser.getUid());
myRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
counsellor = dataSnapshot.getValue(Counsellors.class);
} else {
isCounsellor = false;
myRef = FirebaseDatabase.getInstance().getReference("Users").child(firebaseUser.getUid());
myRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
user = dataSnapshot.getValue(Users.class);
}
@Override
public void onCancelled(DatabaseError error) {
}
});
}
}
@Override
public void onCancelled(DatabaseError error) {
}
});
//When we click on post button (Floating Action Button) then it will send an Explicit Intent to PostActivity
addPostBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(getContext(), PostActivity.class);
String name, imgUrl;
if(isCounsellor){
name = counsellor.getFirstname() + " "+ counsellor.getLastname();
imgUrl = counsellor.getImageUrl();
}else{
name = user.getFirstname() + " "+ user.getLastname();
imgUrl = user.getImageUrl();
}
i.putExtra("username",name);
i.putExtra("imageUrl",imgUrl);
startActivity(i);
}
});
Query firstQuery = firebaseFirestore.collection("Posts").orderBy("timestamp",Query.Direction.DESCENDING);
firstQuery.addSnapshotListener(new EventListener<QuerySnapshot>() {
@Override
public void onEvent(QuerySnapshot documentSnapshots, FirebaseFirestoreException e) {
if (documentSnapshots != null) {
for (DocumentChange doc : documentSnapshots.getDocumentChanges()) {
if (doc.getType() == DocumentChange.Type.ADDED) {
String blogPostId = doc.getDocument().getId();
BlogPost blogPost = doc.getDocument().toObject(BlogPost.class).withId(blogPostId);
blog_list.add(blogPost);
blogPostAdapter.notifyDataSetChanged();
}
}
}
}
});
return view;
}
} | [
"koserhasan002@gmail.com"
] | koserhasan002@gmail.com |
1d8ea754fe29f614a245ad3e19767bb118891f42 | c7c8021ead0a05a06d307037e3a120e12443a29f | /New/app/src/androidTest/java/com/zx/anew/ExampleInstrumentedTest.java | f793e45b04f3a7b945255758bb99dca4aafdec5b | [] | no_license | hyhyhykw/AndroidProject | fe60d5082f28c0ce6e13f76bb35ce05fbc103b64 | e9538b50a2b5472a841043d2daef55634ec159b6 | refs/heads/master | 2021-01-20T12:28:15.339077 | 2017-05-05T11:06:21 | 2017-05-05T11:06:21 | 90,319,473 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 726 | java | package com.zx.anew;
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.zx.anew", appContext.getPackageName());
}
}
| [
"2388186879@qq.com"
] | 2388186879@qq.com |
f9d6e013a335b9ce242b3c355b7274b68a220ed6 | 49aea2b0a6a3572a0f5acba6bb401dfbcdd81f8a | /LMSRealTime/app/src/main/java/lk/iot/lmsrealtime1/data/Category1HomeApplianceDAO.java | 5c20f899ae0ee87214738a7d3098fcfddaa32202 | [] | no_license | shukry-m/LoadManagementSystem | 9110286a3da3de12ca56a6225f71222f8decfc84 | 71c87f25c4519d13ecd1c51ad3295063d8353bef | refs/heads/main | 2023-01-07T21:03:39.151214 | 2020-10-28T22:49:27 | 2020-10-28T22:49:27 | 307,488,563 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,369 | java | package lk.iot.lmsrealtime1.data;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import com.google.firebase.auth.FirebaseAuth;
import java.util.ArrayList;
import lk.iot.lmsrealtime1.db.DatabaseHelper;
import lk.iot.lmsrealtime1.model.Category1HomeAppliance;
public class Category1HomeApplianceDAO {
private SQLiteDatabase dB;
private DatabaseHelper dbHelper;
Context context;
FirebaseAuth fAuth;
// FirebaseFirestore fStore;
String userID;
public static final String TAG = "TAG";
public Category1HomeApplianceDAO(Context context){
this.context = context;
dbHelper = new DatabaseHelper(context);
fAuth = FirebaseAuth.getInstance();
// fStore = FirebaseFirestore.getInstance();
}
public void open() throws SQLException{
dB = dbHelper.getWritableDatabase();
}
//##################################### INSERT ###################################
public int insert(ArrayList<Category1HomeAppliance> list) {
int count =0;
if(list.size() >0){
for(Category1HomeAppliance category : list){
count = count+ insert(category);
}
}
return count;
}
public int insert(Category1HomeAppliance homeAppliance) {
int count =0;
if(dB == null){
open();
}else if(!dB.isOpen()){
open();
}
System.out.println(homeAppliance);
try {
String select = "SELECT * FROM " + dbHelper.TABLE_CATEGORY1_HOME_APPLIANCE + " WHERE " + dbHelper.C_ID + " = '" + homeAppliance.getC_ID() +"'";
Log.v("Query", select);
Cursor cur_s = dB.rawQuery(select, null);
if (cur_s.getCount() == 0) {
//insertCategory1
ContentValues values = new ContentValues();
values.put(dbHelper.C_ID, homeAppliance.getC_ID());
values.put(dbHelper.C_LABEL, homeAppliance.getC_LABEL());
values.put(dbHelper.C_USER_ID, homeAppliance.getC_USER_ID());
values.put(dbHelper.C_Count, homeAppliance.getC_Count());
count = (int) dB.insert(dbHelper.TABLE_CATEGORY1_HOME_APPLIANCE, null, values);
if(count>0){
System.out.println("* inserted "+count);
}
}else{
//update
ContentValues values = new ContentValues();
values.put(dbHelper.C_LABEL, homeAppliance.getC_LABEL());
values.put(dbHelper.C_USER_ID, homeAppliance.getC_USER_ID());
values.put(dbHelper.C_Count, homeAppliance.getC_Count());
count = (int) dB.update(dbHelper.TABLE_CATEGORY1_HOME_APPLIANCE, values, dbHelper.C_ID + " =?", new String[]{homeAppliance.getC_ID()+""});
if(count>0){
System.out.println("* updated "+count);
}
}
}catch (Exception e) {
e.printStackTrace();
}finally {
dB.close();
}
return count;
}
//##################### GET ####################
public ArrayList<Category1HomeAppliance> getAll(String userID){
ArrayList<Category1HomeAppliance> list = new ArrayList<>();
if(dB == null){
open();
}else if(!dB.isOpen()){
open();
}
try{
String select = "SELECT * FROM " + dbHelper.TABLE_CATEGORY1_HOME_APPLIANCE +" WHERE "+dbHelper.C_USER_ID+" = '"+userID+"'";
Log.v("Query",select);
Cursor cur = dB.rawQuery(select, null);
while (cur.moveToNext()) {
Category1HomeAppliance c = new Category1HomeAppliance();
c.setC_ID(cur.getString(cur.getColumnIndex(dbHelper.C_ID)));
c.setC_LABEL(cur.getString(cur.getColumnIndex(dbHelper.C_LABEL)));
c.setC_USER_ID(cur.getString(cur.getColumnIndex(dbHelper.C_USER_ID)));
c.setC_Count(cur.getInt(cur.getColumnIndex(dbHelper.C_Count)));
list.add(c);
}
}catch (Exception e) {
e.printStackTrace();
}finally {
dB.close();
}
return list;
}
public Category1HomeAppliance get(String c_id,String userID){
Category1HomeAppliance c = new Category1HomeAppliance();
if(dB == null){
open();
}else if(!dB.isOpen()){
open();
}
try{
String select = "SELECT * FROM " + dbHelper.TABLE_CATEGORY1_HOME_APPLIANCE+
" WHERE "+dbHelper.C_USER_ID+" = '"+userID+"' AND "+dbHelper.C_ID+" = '"+c_id+"'";
Log.v("Query",select);
Cursor cur = dB.rawQuery(select, null);
while (cur.moveToNext()) {
c.setC_ID(cur.getString(cur.getColumnIndex(dbHelper.C_ID)));
c.setC_LABEL(cur.getString(cur.getColumnIndex(dbHelper.C_LABEL)));
c.setC_USER_ID(cur.getString(cur.getColumnIndex(dbHelper.C_USER_ID)));
c.setC_Count(cur.getInt(cur.getColumnIndex(dbHelper.C_Count)));
}
}catch (Exception e) {
e.printStackTrace();
}finally {
dB.close();
}
return c;
}
//################################## DELETE ########################
public int deleteAll(String userID){
int count = 0;
if(dB == null){
open();
}else if(!dB.isOpen()){
open();
}
Cursor cursor = null;
try{
String deleteQuery = "DELETE FROM "+dbHelper.TABLE_CATEGORY1_HOME_APPLIANCE
+" WHERE "+dbHelper.C_USER_ID+" = '"+userID+"'";
System.out.println("* delete query "+deleteQuery);
Cursor cur = dB.rawQuery(deleteQuery, null);
count = cur.getCount();
if(count>0){
System.out.println("Deleted ");
}
} catch (Exception e) {
Log.v(" Exception", e.toString());
} finally {
if (cursor !=null) {
cursor.close();
}
dB.close();
}
return count;
}
public int delete(String c_id,String userID) {
int count =0;
if(dB == null){
open();
}else if(!dB.isOpen()){
open();
}
Cursor cursor = null;
try{
String deleteQuery = "DELETE FROM "+dbHelper.TABLE_CATEGORY1_HOME_APPLIANCE
+" WHERE "+dbHelper.C_ID+" = '"+c_id+"' AND "+dbHelper.C_USER_ID+" = '"+userID+"'";
System.out.println("* delete query "+deleteQuery);
Cursor cur = dB.rawQuery(deleteQuery, null);
count = cur.getCount();
if(count>0){
System.out.println("* deleted tbl "+count);
}
} catch (Exception e) {
Log.v(" Exception", e.toString());
} finally {
if (cursor !=null) {
cursor.close();
}
dB.close();
}
return count;
}
}
| [
"myproject2586@gmail.com"
] | myproject2586@gmail.com |
6cb86c8e9545ac69c05cd91a50d2c73546feb634 | 7b80e5f5535b29c967e0a16f20f01fdb03c78c41 | /Card.java | 60274769d1369f83492652d2b9dd3e62ee02f790 | [] | no_license | erc91087/Black-Jack | 81c21d5c4ef1746beb0dbfe3a8e96d543d463555 | 5747d795c8c349a09c9934283d1fd2e678f648b1 | refs/heads/master | 2020-03-26T09:34:38.272654 | 2018-08-14T17:51:58 | 2018-08-14T17:51:58 | 144,753,674 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,383 | java |
public class Card {
// one of the four suits
private Suit mySuit;
// number of hits card, Ace = 1, Jack-King 11-13
private int myNumber;
// Constructor
public Card(Suit aSuit, int aNumber) {
this.mySuit = aSuit;
if (aNumber >= 1 && aNumber <= 13) {
this.myNumber = aNumber;
} else {
System.err.println(aNumber + " is not a valid card number");
System.exit(1);
}
}
// to return number of the card bc its private
public int getNumber() {
return myNumber;
}
// overloading toString() which is inherited from Object class
public String toString() {
String numStr = "Error";
switch(this.myNumber) {
case 2:
numStr = "Two";
break;
case 3:
numStr = "Three";
break;
case 4:
numStr = "Four";
break;
case 5:
numStr = "Five";
break;
case 6:
numStr = "Six";
break;
case 7:
numStr = "Seven";
break;
case 8:
numStr = "Eight";
break;
case 9:
numStr = "Nine";
break;
case 10:
numStr = "Ten";
break;
case 11:
numStr = "Jack";
break;
case 12:
numStr = "Queen";
break;
case 13:
numStr = "King";
break;
case 1:
numStr = "Ace";
break;
}
return numStr + " of " + mySuit.toString();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
790a49296832af01d3a196af7e2e044a57b5141c | 4c280aa56a7e9b2ed9b571c7821240ebe48bb4ad | /app/src/main/java/com/example/implementtest/UI/MainAdapter.java | 2330f24a3c77bab6bebcbd37e171fdd6183188ab | [] | no_license | armyant0920/ImplementTest2 | 36694e85ca9627c6006b178102f1887d93020850 | 6ba5e30669bf3e07d62223c502074e0db0182bee | refs/heads/master | 2022-04-13T08:18:04.845654 | 2020-04-13T10:11:57 | 2020-04-13T10:11:57 | 255,292,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,752 | java | package com.example.implementtest.UI;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.example.implementtest.R;
import java.util.List;
public class MainAdapter extends RecyclerView.Adapter<MainAdapter.MyViewHolder> {
private Context mContext;
private List<String> mDatas;
public MainAdapter(Context context, List<String> mDatas) {
this.mContext = context;
this.mDatas = mDatas;
}
/**
* 增加数据
*/
public void addData(int position) {
mDatas.add(position, "add");
notifyItemInserted(position);//注意这里
}
/**
* 移除数据
*/
public void removeData(int position) {
String s=mDatas.get(position);
char c=s.charAt(0);
int i=c;
System.out.println("remove"+mDatas.get(position)+"整数值:"+c+i);
mDatas.remove(position);
notifyItemRemoved(position);//注意这里
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new MyViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_layout, parent, false));
}
@Override
public void onBindViewHolder(MyViewHolder holder, final int position) {
holder.tv.setText(mDatas.get(position));
}
@Override
public int getItemCount() {
return mDatas.size();
}
class MyViewHolder extends RecyclerView.ViewHolder {
TextView tv;
public MyViewHolder(View view) {
super(view);
tv = (TextView)itemView.findViewById(R.id.tv);
}
}
} | [
"armyant0920@gmail.com"
] | armyant0920@gmail.com |
e10706f64f6a33730c0a0bf2d3ffdfa3d7b85995 | 3b938ee99e739ef1399cc486fb9920fa02eaf606 | /spring-boot/springboot_jdbc/src/main/java/com/seven/SpringbootJdbcApplication.java | 64dfdb33082b3edbfb0792cb3e81214bd6a50115 | [] | no_license | Seven1011/learning_process | 63844be542b11adb6f969c539cb6b6d62418e20d | 2f03650c87a0228dbe08526d4d6a70c29aef384e | refs/heads/master | 2020-08-27T16:19:42.158757 | 2019-11-12T06:32:24 | 2019-11-12T06:32:24 | 217,431,198 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package com.seven;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringbootJdbcApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootJdbcApplication.class, args);
}
}
| [
"seven1011@yeah.net"
] | seven1011@yeah.net |
eb9d4e82410ce5d46cdeb246bb9a5aac15bf6c3c | 5e251583951385fad2bd73d33b6b05ce8166028e | /The Super RTS/G8/src/ai/humanAI/basicHumanAI/BasicHumanAI3.java | 269e372412e461dca1941fbda70520ee6c1faac0 | [] | no_license | emuspawn/r2dst | bf8f04fc6433dd9274420ed4ee6562de28a087e9 | dcc2493ca7f43876e58724d904a72982c420a8b6 | refs/heads/master | 2020-04-28T02:10:08.624862 | 2009-10-18T22:51:02 | 2009-10-18T22:51:02 | 38,788,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,230 | java | package ai.humanAI.basicHumanAI;
import graphics.GLCamera;
import java.awt.Font;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
import com.sun.opengl.util.j2d.TextRenderer;
import sgEngine.EngineConstants;
import sgEngine.SGEngine;
import sgEngine.userAction.*;
import utilities.Location;
import utilities.Prism;
import world.World;
import world.owner.Owner;
import world.unit.Unit;
import ai.AI;
/**
* a basic human ai, performs low level calls such as selecting units
* by mouse click automatically
*
* orders are not initiated if the UI has been clicked nor are units selected
*
* clicking a unit selects it, if no units are clicked then selected units
* are given an order to move
*
* dragging the left mouse button selects all units under the mouse drag
*
* right clicking deselects all units
*
* @author Jack
*
*/
public abstract class BasicHumanAI3 extends AI
{
private static final double selectorSize = 2; //the width of the selector (used for when things are clicked)
GLCamera c;
boolean unSelect = false; //true if the ai should unselect all units next iteration
Prism press; //where the selector key was pressed (not dragged), where the units are sent to move to
ArrayList<Prism> pselections = new ArrayList<Prism>();
Location initialPress; //where the mouse was first pressed (when dragging)
boolean dragging = false;
TextRenderer tr;
SGEngine sge;
BuilderDisplay bd;
boolean uiClicked = false;
public BasicHumanAI3(Owner o, World w, SGEngine sge, GLCamera c)
{
super(o, w, sge);
this.c = c;
this.sge = sge;
Font font = new Font("SansSerif", Font.BOLD, 12);
tr = new TextRenderer(font, true, true);
bd = new BuilderDisplay(c, sge);
}
public void drawUI(GLAutoDrawable d)
{
GL gl = d.getGL();
try
{
gl.glColor4d(1, .5, 0, .4);
Location ml = sge.getUserActionListener().getMouseDragLocation();
if(dragging && ml != null)
{
Location l = c.getMapLocation(ml, 1);
//System.out.println(ml);
getPrismSelectionRegion(initialPress, l).drawPrism(gl);
new Prism(new Location(l.x, l.y+3, l.z), 6, 6, 6).drawPrism(gl);
}
}
catch(Exception e)
{
e.printStackTrace();
System.out.println("exception caught, continuing normally...");
}
drawResources();
bd.drawBuilderDisplay(gl);
drawBuildingLocations(gl);
}
/**
* draws small reminders over top of the locations at which buildings
* are to be built based off the building location hash map
* @param gl
*/
private void drawBuildingLocations(GL gl)
{
try
{
HashMap<String, LinkedList<Location>> m = new HashMap<String, LinkedList<Location>>(bd.getBuildingLocations());
Iterator<String> i = m.keySet().iterator();
gl.glColor4d(0, .6, .2, .3);
//gl.glColor3d(1, 1, 1);
while(i.hasNext())
{
String key = i.next();
Iterator<Location> lli = m.get(key).iterator();
while(lli.hasNext())
{
//System.out.println("here");
new Prism(lli.next(), 10, 10, 10).drawPrism(gl);
}
}
}
catch(Exception e){}
}
private void drawResources()
{
tr.beginRendering((int)c.getWidth(), (int)c.getHeight());
tr.setColor(255, 0, 0, 255);
tr.draw("Energy: "+o.getEnergy(), (int)(c.getWidth()-110), (int)(c.getHeight()-20));
tr.draw("Metal: "+o.getMetal(), (int)(c.getWidth()-110), (int)(c.getHeight()-40));
tr.endRendering();
}
public void interpretKeyPress(KeyPress kp)
{
if(kp.getCharacter() == 'c')
{
EngineConstants.cameraMode = !EngineConstants.cameraMode;
}
else if(kp.getCharacter() == 'b')
{
bd.setDisplay(!bd.isDisplayed());
}
}
public void interpretMousePress(MouseAction ma)
{
uiClicked = bd.interpretMousePress(ma);
if(!uiClicked)
{
initialPress = ma.getLocation();
dragging = true;
}
}
public void interpretMouseRelease(MouseAction ma)
{
if(!uiClicked)
{
Location start = initialPress;
Location end = ma.getLocation();
sge.getUserActionListener().nullMouseDragLocation();
if(start.compareTo(end) != 0)
{
pselections.add(getPrismSelectionRegion(start, end));
}
}
dragging = false;
}
public void interpretKeyRelease(KeyRelease kr){}
/**
* gets the region created by dragging the cursor from the starting
* location to the ending location, used in determining which units where
* selected
* @param start
* @param end
* @return
*/
private Prism getPrismSelectionRegion(Location start, Location end)
{
double width = Math.abs(start.x-end.x);
double height = 10;
double depth = Math.abs(start.z-end.z);
Location middle = new Location(start.x+(end.x-start.x)/2, start.y+(end.y-start.y)/2+height/2, start.z+(end.z-start.z)/2);
return new Prism(middle, width, height, depth);
}
public void interpretMouseClick(MouseAction ma)
{
if(!uiClicked)
{
if(ma.isRightClick())
{
unSelect = true;
}
else
{
press = new Prism(ma.getLocation(), selectorSize, selectorSize, selectorSize);
}
}
}
public void performAIFunctions()
{
/*
* units that can build things, these units ar stored so the AI is able
* to quickly cycle through them to carry out the user's build commands
*/
LinkedList<Unit> builders = new LinkedList<Unit>();
LinkedList<Unit> units = getUnits();
Iterator<Unit> i = units.iterator();
/*
* the unit was selected by the location stored
* in press, means it was not drag selected, if
* true then the press location is not included
* when commanding units because it was not an
* order (it was a selection), if false then it
* was an order to be interpreted
*/
boolean unitPressSelected = false;
//selects or delsects units
while(i.hasNext())
{
Unit u = i.next();
if(u.getBuildTree().size() > 0)
{
builders.add(u);
}
if(!unSelect)
{
if(!u.isSelected())
{
//selects units based off mouse drags
Iterator<Prism> pi = pselections.iterator();
while(pi.hasNext())
{
Prism p = pi.next();
if(u.intersects(p))
{
u.setSelected(true);
break;
}
}
//selects units based off the mouse click
if(press != null && u.intersects(press) && !unitPressSelected)
{
//unit selected by the key press (not drag), press selecting only selects one unit
unitPressSelected = true;
u.setSelected(true);
}
}
}
else
{
u.setSelected(false);
}
}
i = units.iterator();
//orders units
while(i.hasNext())
{
Unit u = i.next();
if(!unSelect)
{
if(!unitPressSelected)
{
//press is an order
Location l = null;
if(press != null)
{
l = press.getLocation();
}
orderUnit(u, l);
}
}
}
contructBuildings(builders);
constructUnits(builders);
pselections = new ArrayList<Prism>();
unSelect = false;
press = null;
}
/**
* automatically constructs all the queued units for the user
* @param all units that can build other units
*/
private void constructUnits(LinkedList<Unit> builders)
{
HashMap<String, Integer> counts = bd.getUnitConstructionCounts();
Iterator<String> si = counts.keySet().iterator();
while(si.hasNext())
{
String name = si.next();
boolean built = false;
Iterator<Unit> i = builders.iterator();
while(i.hasNext() && !built)
{
Unit u = i.next();
if(u.canBuild(name) && counts.get(name) > 0)
{
built = buildAt(name, u, u.getLocation());
if(built)
{
counts.put(name, counts.get(name)-1);
}
}
}
}
}
/**
* constructs the queued buildings for the user, automatically assigns
* a worker to build each building
* @param all units that can build other units
*/
private void contructBuildings(LinkedList<Unit> builders)
{
HashMap<String, LinkedList<Location>> buildLocations = bd.getBuildingLocations();
Iterator<String> si = buildLocations.keySet().iterator();
while(si.hasNext())
{
/*
* cycles through the units to be built, finds the first builder that
* is able to build each unit and orders it to do so regardless of the
* distance of that unit to its build order, if no builder is capable
* of building the unit then the build order simply remains in the hash
* map
*/
String name = si.next(); //the name of the building to be built
if(buildLocations.get(name).size() > 0)
{
Iterator<Location> lli = buildLocations.get(name).iterator(); //the buildings to be built
while(lli.hasNext())
{
Location l = lli.next(); //where the building is to be built
boolean built = false;
Iterator<Unit> i = builders.iterator();
while(i.hasNext() && !built)
{
Unit u = i.next();
if(u.canBuild(name))
{
built = buildAt(name, u, l);
if(built)
{
lli.remove();
}
}
}
}
}
}
}
/**
* called once per unit, units commands should be performed here
* @param u
* @param l the location of the first mouse click that did not
* select a unit, mouseClicks.get(0)
*/
protected abstract void orderUnit(Unit u, Location l);
}
| [
"americaneseia@621c9c31-3b52-0410-9324-6feef30e6307"
] | americaneseia@621c9c31-3b52-0410-9324-6feef30e6307 |
8b6d7dea528b14b66940bef4832d627604447993 | 5287546059c37c2fa6d3c453829e820c23a5687f | /POS-HibernateMavonSpring/src/main/java/lk/ijse/pos/business/custom/impl/OrderBOImpl.java | 3d77104cc1863876053e0463959b8611074bac3e | [] | no_license | DulminiMadumalika/POS-Hibernate-Maven-Spring | 1fa1debfc6e962031848df28266d69690029e4e3 | 08818d835f4ccabbd5d2921daefc1ce98df35042 | refs/heads/master | 2022-06-23T08:16:25.866229 | 2019-05-31T11:17:50 | 2019-05-31T11:17:50 | 189,581,071 | 0 | 0 | null | 2022-06-21T01:12:13 | 2019-05-31T11:12:04 | Java | UTF-8 | Java | false | false | 2,749 | java | package lk.ijse.pos.business.custom.impl;
import lk.ijse.pos.business.custom.OrderBO;
import lk.ijse.pos.dao.custom.CustomerDAO;
import lk.ijse.pos.dao.custom.ItemDAO;
import lk.ijse.pos.dao.custom.OrderDAO;
import lk.ijse.pos.dao.custom.OrderDetailDAO;
import lk.ijse.pos.db.HibernateUtil;
import lk.ijse.pos.dto.OrderDTO;
import lk.ijse.pos.dto.OrderDetailDTO;
import lk.ijse.pos.entity.Customer;
import lk.ijse.pos.entity.Item;
import lk.ijse.pos.entity.Order;
import lk.ijse.pos.entity.OrderDetail;
import org.hibernate.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class OrderBOImpl implements OrderBO {
@Autowired
private OrderDAO orderDAO;
@Autowired
private OrderDetailDAO orderDetailDAO;
@Autowired
private ItemDAO itemDAO;
@Autowired
private CustomerDAO customerDAO;
public boolean placeOrder(OrderDTO order) throws Exception {
Session session = HibernateUtil.getSessionFactory().openSession();
boolean result = false;
try{
// Begin Transaction
session.beginTransaction();
orderDAO.setSession(session);
customerDAO.setSession(session);
Customer customer = customerDAO.find(order.getCustomerId());
orderDAO.save(new Order(order.getOrderId(), order.getOrderDate(),customer));
// if (!result) {
// connection.rollback();
// return false;
// }
orderDetailDAO.setSession(session);
for (OrderDetailDTO dto : order.getOrderDetails()) {
orderDetailDAO.save(new OrderDetail(dto.getOrderId(), dto.getItemCode(), dto.getQty(), dto.getUnitPrice()));
// if (!result) {
// connection.rollback();
// return false;
// }
itemDAO.setSession(session);
Item item = itemDAO.find(dto.getItemCode());
int qty = item.getQtyOnHand() - dto.getQty();
item.setQtyOnHand(qty);
itemDAO.update(item);
// if (!result) {
// connection.rollback();
// return false;
// }
}
session.getTransaction().commit();
return true;
} catch (Throwable ex){
session.getTransaction().rollback();
throw ex;
} finally {
session.close();
}
}
public int generateOrderId() throws Exception {
try {
return orderDAO.getLastOrderId() + 1;
} catch (NullPointerException e) {
return 1;
}
}
}
| [
"dulminiwijekoon@gmail.com"
] | dulminiwijekoon@gmail.com |
b559946fc2e9015da8cb1f3a0d332c9bf06f3d56 | 4be23cead2fee0075b326156676567bd8aae66af | /src/test/java/com/lss/WaitTest.java | 5394f575557bf7be813f245f97051117251f7528 | [] | no_license | Lss044/Fint | 84b8ca68e77f95e4ace9ffd96e785f98081cf8f8 | 4a116712598064cbf56a8fcb3ba4f2d27989949e | refs/heads/master | 2020-04-05T00:21:44.611887 | 2018-11-07T13:31:37 | 2018-11-07T13:31:37 | 156,394,259 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,498 | java | package com.lss;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import java.util.concurrent.TimeUnit;
public class WaitTest {
WebDriver driver;
@BeforeMethod
public void OpenBrowser(){
System.setProperty("webdriver.chrome.driver","D:\\chromedriver.exe");
driver=new ChromeDriver();
//全局等待==隐形等待,没有显性等待智能
// driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
/**
* 打开网址
* 点击wait按钮
* 获取文本,判断是否为“期望值”
*/
@Test
public void waitTest() throws InterruptedException {
driver.get("");
driver.findElement(By.xpath("")).click();
//显性等待,更智能
WebDriverWait wait=new WebDriverWait(driver,10);
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("")));
//定位点击按钮出现的文字
String text=driver.findElement(By.xpath("")).getText();
Assert.assertEquals(text,"");
}
@AfterMethod
public void Closed() throws InterruptedException {
Thread.sleep(3000);
driver.quit();
}
}
| [
"3115290540@qq.com"
] | 3115290540@qq.com |
c64d524a89a6d422922f79eae1cd339b8fef5004 | 5b15da71eafce538fb1431847fc3fc5f6031893c | /src/Abstraction/Apartment.java | a143f196fa5a83c36ffafa5b747d850367e0bfa8 | [] | no_license | cardissuer/Cybertek- | 92a434c8e655eb91858641079220368f25d6a78c | f91138e4322b02b1baece4eb3e8832e7b077419f | refs/heads/master | 2021-07-11T17:58:31.791438 | 2020-11-24T00:36:42 | 2020-11-24T00:36:42 | 220,678,671 | 0 | 0 | null | 2019-11-09T20:50:12 | 2019-11-09T17:33:15 | null | UTF-8 | Java | false | false | 484 | java | package Abstraction;
public abstract class Apartment extends Home {
@Override
public void throwParty() {
System.out.println("Throw a party in apartment ");
}
@Override
public void lock() {
System.out.println("Locking an apartment ");
}
@Override
public void unlock() {
System.out.println("Unloicking the apartment ");
}
@Override
public void cook() {
System.out.println("Cooking in apartment ");
}
} | [
"cardissuer@gmail.com"
] | cardissuer@gmail.com |
e3e1d0db971eb875ce1c341d5ab82f29dc4b2d60 | 67482c7bc615cb8e8af7ab3c41f15aa7b63a8082 | /project/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/com.spaneos.online_shoping-cart/org/apache/jsp/userhomeInter_jsp.java | 50b57a0a376ffe9d6dfe7d7ee2307fb7fbaf4e46 | [] | no_license | pushpankar108/workspace | c28f3f56a6ecb09a10168cc89d0a7a8504fd81c1 | 8d9d485369a00078dcb13ad9d22248d48d378649 | refs/heads/master | 2021-05-02T03:58:02.767415 | 2018-02-09T13:09:47 | 2018-02-09T13:09:47 | 120,906,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,520 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/8.0.33
* Generated at: 2018-02-05 10:20:27 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class userhomeInter_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent,
org.apache.jasper.runtime.JspSourceImports {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private static final java.util.Set<java.lang.String> _jspx_imports_packages;
private static final java.util.Set<java.lang.String> _jspx_imports_classes;
static {
_jspx_imports_packages = new java.util.HashSet<>();
_jspx_imports_packages.add("javax.servlet");
_jspx_imports_packages.add("javax.servlet.http");
_jspx_imports_packages.add("javax.servlet.jsp");
_jspx_imports_classes = null;
}
private volatile javax.el.ExpressionFactory _el_expressionfactory;
private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public java.util.Set<java.lang.String> getPackageImports() {
return _jspx_imports_packages;
}
public java.util.Set<java.lang.String> getClassImports() {
return _jspx_imports_classes;
}
public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
if (_el_expressionfactory == null) {
synchronized (this) {
if (_el_expressionfactory == null) {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
}
}
}
return _el_expressionfactory;
}
public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
if (_jsp_instancemanager == null) {
synchronized (this) {
if (_jsp_instancemanager == null) {
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
}
}
return _jsp_instancemanager;
}
public void _jspInit() {
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final java.lang.String _jspx_method = request.getMethod();
if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET POST or HEAD");
return;
}
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write('\n');
String uid = request.getParameter("uid");
String ps = request.getParameter("psw");
out.write("\n");
out.write("out.println(\"here\");\n");
onlineshopping.user.UserBean log = null;
log = (onlineshopping.user.UserBean) _jspx_page_context.getAttribute("log", javax.servlet.jsp.PageContext.REQUEST_SCOPE);
if (log == null){
log = new onlineshopping.user.UserBean();
_jspx_page_context.setAttribute("log", log, javax.servlet.jsp.PageContext.REQUEST_SCOPE);
out.write('\n');
out.write(' ');
org.apache.jasper.runtime.JspRuntimeLibrary.handleSetProperty(_jspx_page_context.findAttribute("log"), "name",
uid);
out.write('\n');
out.write(' ');
org.apache.jasper.runtime.JspRuntimeLibrary.handleSetProperty(_jspx_page_context.findAttribute("log"), "pass_word",
ps);
out.write('\n');
}
out.write('\n');
if (true) {
_jspx_page_context.forward("loginUser.Udo");
return;
}
out.write('\n');
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try {
if (response.isCommitted()) {
out.flush();
} else {
out.clearBuffer();
}
} catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"pushpankar.k@spaneos.com"
] | pushpankar.k@spaneos.com |
b2c089816a2987f1af7d5c961d69ecf170de0517 | da4310dd10bbc0794c9ccc7f2d6ab653aa31b48f | /src/main/java/br/com/iga/cadastro/service/exception/ObjectNotFoundException.java | a4fd287fd9c211efb3a2ddcd8f6edc2959f04643 | [] | no_license | raelAndrade/Projeto-SpringBoot | 87dc76896621106f0d97cff2658c62bb5af1e184 | b70cc27d492b540ae0885ef1c4d1c4d8ebf56f97 | refs/heads/master | 2020-04-09T03:43:10.079880 | 2018-12-01T22:56:44 | 2018-12-01T22:56:44 | 159,994,200 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | package br.com.iga.cadastro.service.exception;
public class ObjectNotFoundException extends RuntimeException {
private static final long serialVersionUID = 1L;
public ObjectNotFoundException(String msg) {
super(msg);
}
public ObjectNotFoundException(String msg, Throwable cause) {
super(msg, cause);
}
}
| [
"israelg.andrade@bol.com.br"
] | israelg.andrade@bol.com.br |
90694cf13d31cf786a0cf5205da979b6dc0adbfd | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/training/com/squareup/wire/java/JavaGeneratorTest.java | 109a1daecedf6f9bc165271c3e5d050a23e42d31 | [] | no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 16,221 | java | /**
* Copyright (C) 2015 Square, 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.squareup.wire.java;
import com.squareup.javapoet.JavaFile;
import com.squareup.javapoet.TypeSpec;
import com.squareup.wire.schema.IdentifierSet;
import com.squareup.wire.schema.MessageType;
import com.squareup.wire.schema.RepoBuilder;
import com.squareup.wire.schema.Schema;
import java.io.IOException;
import org.junit.Assert;
import org.junit.Test;
public final class JavaGeneratorTest {
@Test
public void sanitizeJavadocStripsTrailingWhitespace() {
String input = "The quick brown fox \nJumps over \n\t \t\nThe lazy dog ";
String expected = "The quick brown fox\nJumps over\n\nThe lazy dog";
assertThat(JavaGenerator.sanitizeJavadoc(input)).isEqualTo(expected);
}
@Test
public void sanitizeJavadocWrapsSeeLinks() {
String input = "Google query.\n\n@see http://google.com";
String expected = "Google query.\n\n@see <a href=\"http://google.com\">http://google.com</a>";
assertThat(JavaGenerator.sanitizeJavadoc(input)).isEqualTo(expected);
}
@Test
public void sanitizeJavadocStarSlash() {
String input = "/* comment inside comment. */";
String expected = "/* comment inside comment. */";
assertThat(JavaGenerator.sanitizeJavadoc(input)).isEqualTo(expected);
}
@Test
public void generateTypeUsesNameAllocatorInMessageBuilderBuild() throws Exception {
RepoBuilder repoBuilder = new RepoBuilder().add("message.proto", ("" + (("message Message {\n" + " required float long = 1;\n") + "}\n")));
assertThat(repoBuilder.generateCode("Message")).contains(("" + ((((((" @Override\n" + " public Message build() {\n") + " if (long_ == null) {\n") + " throw Internal.missingRequiredFields(long_, \"long\");\n") + " }\n") + " return new Message(long_, super.buildUnknownFields());\n") + " }\n")));
}
@Test
public void tooManyFieldsTest() throws Exception {
StringBuilder s = new StringBuilder();
for (int i = 1; i < 257; i++) {
s.append(((((" repeated int32 field_" + i) + " = ") + i) + ";\n"));
}
RepoBuilder repoBuilder = new RepoBuilder().add("message.proto", ((((((("" + "message Message {\n") + (s.toString())) + " oneof oneof_name {\n") + " int32 foo = 257;\n") + " int32 bar = 258;\n") + " }\n") + "}\n"));
assertThat(repoBuilder.generateCode("Message")).contains(("" + "public Message(Builder builder, ByteString unknownFields)"));
}
@Test
public void map() throws Exception {
Schema schema = new RepoBuilder().add("message.proto", ("" + (((("message Message {\n" + " map<string, CdnResource> templates = 1;\n") + " message CdnResource {\n") + " }\n") + "}\n"))).schema();
MessageType message = ((MessageType) (schema.getType("Message")));
JavaGenerator javaGenerator = JavaGenerator.get(schema);
TypeSpec typeSpec = javaGenerator.generateType(message);
assertThat(JavaFile.builder("", typeSpec).build().toString()).contains(("" + (((((" @WireField(\n" + " tag = 1,\n") + " keyAdapter = \"com.squareup.wire.ProtoAdapter#STRING\",\n") + " adapter = \"Message$CdnResource#ADAPTER\"\n") + " )\n") + " public final Map<String, CdnResource> templates;\n")));
}
@Test
public void generateAbstractAdapter() throws Exception {
RepoBuilder repoBuilder = new RepoBuilder().add("message.proto", ("" + (((((((("package original.proto;\n" + "option java_package = \"original.java\";\n") + "import \"foo.proto\";\n") + "message ProtoMessage {\n") + " optional foo.proto.Foo field = 1;\n") + " repeated int32 numbers = 3;\n") + " optional foo.proto.CoinFlip coin_flip = 4;\n") + " map<string, foo.proto.Bar> bars = 2;\n") + "}\n"))).add("foo.proto", ("" + ((((((((("package foo.proto;\n" + "option java_package = \"foo.java\";\n") + "message Foo {\n") + "}\n") + "message Bar {\n") + "}\n") + "enum CoinFlip {\n") + " HEADS = 1;\n") + " TAILS = 2;\n") + "}\n"))).add("android.wire", ("" + ((((("syntax = \"wire2\";\n" + "import \"message.proto\";\n") + "package original.proto;\n") + "type original.proto.ProtoMessage {\n") + " target target.java.JavaMessage using target.java.JavaMessage#ADAPTER;\n") + "}\n")));
assertThat(repoBuilder.generateCode("original.proto.ProtoMessage", "android")).isEqualTo(("" + (((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((("package original.java;\n" + "\n") + "import com.squareup.wire.FieldEncoding;\n") + "import com.squareup.wire.ProtoAdapter;\n") + "import com.squareup.wire.ProtoReader;\n") + "import com.squareup.wire.ProtoWriter;\n") + "import com.squareup.wire.internal.Internal;\n") + "import foo.java.Bar;\n") + "import foo.java.CoinFlip;\n") + "import foo.java.Foo;\n") + "import java.io.IOException;\n") + "import java.lang.Integer;\n") + "import java.lang.Override;\n") + "import java.lang.String;\n") + "import java.util.List;\n") + "import java.util.Map;\n") + "import target.java.JavaMessage;\n") + "\n") + "public abstract class AbstractProtoMessageAdapter extends ProtoAdapter<JavaMessage> {\n") + " private final ProtoAdapter<Map<String, Bar>> bars = ProtoAdapter.newMapAdapter(ProtoAdapter.STRING, Bar.ADAPTER);\n") + "\n") + " public AbstractProtoMessageAdapter() {\n") + " super(FieldEncoding.LENGTH_DELIMITED, JavaMessage.class);\n") + " }\n") + "\n") + " public abstract Foo field(JavaMessage value);\n") + "\n") + " public abstract List<Integer> numbers(JavaMessage value);\n") + "\n") + " public abstract CoinFlip coin_flip(JavaMessage value);\n") + "\n") + " public abstract Map<String, Bar> bars(JavaMessage value);\n") + "\n") + " public abstract JavaMessage fromProto(Foo field, List<Integer> numbers, CoinFlip coin_flip,\n") + " Map<String, Bar> bars);\n") + "\n") + " @Override\n") + " public int encodedSize(JavaMessage value) {\n") + " return Foo.ADAPTER.encodedSizeWithTag(1, field(value))\n") + " + ProtoAdapter.INT32.asRepeated().encodedSizeWithTag(3, numbers(value))\n") + " + CoinFlip.ADAPTER.encodedSizeWithTag(4, coin_flip(value))\n") + " + bars.encodedSizeWithTag(2, bars(value));\n") + " }\n") + "\n") + " @Override\n") + " public void encode(ProtoWriter writer, JavaMessage value) throws IOException {\n") + " Foo.ADAPTER.encodeWithTag(writer, 1, field(value));\n") + " ProtoAdapter.INT32.asRepeated().encodeWithTag(writer, 3, numbers(value));\n") + " CoinFlip.ADAPTER.encodeWithTag(writer, 4, coin_flip(value));\n") + " bars.encodeWithTag(writer, 2, bars(value));\n") + " }\n") + "\n") + " @Override\n") + " public JavaMessage decode(ProtoReader reader) throws IOException {\n") + " Foo field = null;\n") + " Map<String, Bar> bars = Internal.newMutableMap();\n") + " List<Integer> numbers = Internal.newMutableList();\n") + " CoinFlip coin_flip = null;\n") + " long token = reader.beginMessage();\n") + " for (int tag; (tag = reader.nextTag()) != -1;) {\n") + " switch (tag) {\n") + " case 1: field = Foo.ADAPTER.decode(reader); break;\n") + " case 2: bars.putAll(bars.decode(reader)); break;\n") + " case 3: numbers.add(ProtoAdapter.INT32.decode(reader)); break;\n") + " case 4: {\n") + " try {\n") + " coin_flip = CoinFlip.ADAPTER.decode(reader);\n") + " } catch (ProtoAdapter.EnumConstantNotFoundException ignored) {\n") + " }\n") + " break;\n") + " }\n") + " default: {\n") + " reader.skip();\n") + " }\n") + " }\n") + " }\n") + " reader.endMessage(token);\n") + " return fromProto(field, numbers, coin_flip, bars);\n") + " }\n") + "\n") + " @Override\n") + " public JavaMessage redact(JavaMessage value) {\n") + " return value;\n") + " }\n") + "}\n")));
}
@Test
public void generateAbstractAdapterForEnum() throws Exception {
RepoBuilder repoBuilder = new RepoBuilder().add("message.proto", ("" + (((((((("package original.proto;\n" + "message ProtoMessage {\n") + " optional CoinFlip coin_flip = 1;\n") + "}\n") + "enum CoinFlip {\n") + " // In Canada this is the Queen!\n") + " HEADS = 1;\n") + " TAILS = 2;\n") + "}\n"))).add("android.wire", ("" + ((((("syntax = \"wire2\";\n" + "import \"message.proto\";\n") + "package original.proto;\n") + "type original.proto.CoinFlip {\n") + " target target.java.JavaCoinFlip using target.java.JavaCoinFlip#ADAPTER;\n") + "}\n")));
assertThat(repoBuilder.generateCode("original.proto.CoinFlip", "android")).isEqualTo(("" + (((((((((((((((((((((((((((((((((((((((((((((((((((((((("package original.proto;\n" + "\n") + "import com.squareup.wire.FieldEncoding;\n") + "import com.squareup.wire.ProtoAdapter;\n") + "import com.squareup.wire.ProtoReader;\n") + "import com.squareup.wire.ProtoWriter;\n") + "import java.io.IOException;\n") + "import java.lang.Override;\n") + "import java.net.ProtocolException;\n") + "import target.java.JavaCoinFlip;\n") + "\n") + "public class CoinFlipAdapter extends ProtoAdapter<JavaCoinFlip> {\n") + " /**\n") + " * In Canada this is the Queen!\n") + " */\n") + " protected final JavaCoinFlip HEADS;\n") + "\n") + " protected final JavaCoinFlip TAILS;\n") + "\n") + " public CoinFlipAdapter(JavaCoinFlip HEADS, JavaCoinFlip TAILS) {\n") + " super(FieldEncoding.VARINT, JavaCoinFlip.class);\n") + " this.HEADS = HEADS;\n") + " this.TAILS = TAILS;\n") + " }\n") + "\n") + " protected int toValue(JavaCoinFlip value) {\n") + " if (value.equals(HEADS)) return 1;\n") + " if (value.equals(TAILS)) return 2;\n") + " return -1;\n") + " }\n") + "\n") + " protected JavaCoinFlip fromValue(int value) {\n") + " switch (value) {\n") + " case 1: return HEADS;\n") + " case 2: return TAILS;\n") + " default: throw new ProtoAdapter.EnumConstantNotFoundException(value, JavaCoinFlip.class);\n") + " }\n") + " }\n") + "\n") + " @Override\n") + " public int encodedSize(JavaCoinFlip value) {\n") + " return ProtoAdapter.UINT32.encodedSize(toValue(value));\n") + " }\n") + "\n") + " @Override\n") + " public void encode(ProtoWriter writer, JavaCoinFlip value) throws IOException {\n") + " int i = toValue(value);\n") + " if (i == -1) throw new ProtocolException(\"Unexpected enum constant: \" + value);\n") + " writer.writeVarint32(i);\n") + " }\n") + "\n") + " @Override\n") + " public JavaCoinFlip decode(ProtoReader reader) throws IOException {\n") + " int value = reader.readVarint32();\n") + " return fromValue(value);\n") + " }\n") + "}\n")));
}
@Test
public void generateAbstractAdapterWithRedactedField() throws IOException {
RepoBuilder repoBuilder = new RepoBuilder().add("message.proto", ("" + ((("import \"option_redacted.proto\";\n" + "message ProtoMessage {\n") + " optional string secret = 1 [(squareup.protos.redacted_option.redacted) = true];\n") + "}\n"))).add("option_redacted.proto").add("android.wire", ("" + (((("syntax = \"wire2\";\n" + "import \"message.proto\";\n") + "type ProtoMessage {\n") + " target JavaMessage using JavaMessage#ADAPTER;\n") + "}\n")));
assertThat(repoBuilder.generateCode("ProtoMessage", "android")).contains(("" + (((" @Override\n" + " public JavaMessage redact(JavaMessage value) {\n") + " return null;\n") + " }\n")));
}
@Test
public void nestedAbstractAdapterIsStatic() throws IOException {
RepoBuilder repoBuilder = new RepoBuilder().add("message.proto", ("" + (((("message A {\n" + " message B {\n") + " optional string c = 1;\n") + " }\n") + "}\n"))).add("android.wire", ("" + (((("syntax = \"wire2\";\n" + "import \"message.proto\";\n") + "type A.B {\n") + " target java.lang.String using AbAdapter#INSTANCE;\n") + "}\n")));
assertThat(repoBuilder.generateCode("A", "android")).contains(("" + " public abstract static class AbstractBAdapter extends ProtoAdapter<String> {\n"));
}
/**
* https://github.com/square/wire/issues/655
*/
@Test
public void defaultValues() throws IOException {
RepoBuilder repoBuilder = new RepoBuilder().add("message.proto", ("" + ((((("message Message {\n" + " optional int32 a = 1 [default = 10 ];\n") + " optional int32 b = 2 [default = 0x20 ];\n") + " optional int64 c = 3 [default = 11 ];\n") + " optional int64 d = 4 [default = 0x21 ];\n") + "}\n")));
String code = repoBuilder.generateCode("Message");
assertThat(code).contains(" public static final Integer DEFAULT_A = 10;");
assertThat(code).contains(" public static final Integer DEFAULT_B = 32;");
assertThat(code).contains(" public static final Long DEFAULT_C = 11L;");
assertThat(code).contains(" public static final Long DEFAULT_D = 33L;");
}
@Test
public void defaultValuesMustNotBeOctal() throws IOException {
RepoBuilder repoBuilder = new RepoBuilder().add("message.proto", ("" + ((("message Message {\n" + " optional int32 a = 1 [default = 020 ];\n") + " optional int64 b = 2 [default = 021 ];\n") + "}\n")));
try {
repoBuilder.generateCode("Message");
Assert.fail();
} catch (IllegalStateException expected) {
assertThat(expected).hasMessage("Octal literal unsupported: 020");
}
}
@Test
public void nullableFieldsWithoutParcelable() {
Schema schema = new RepoBuilder().add("message.proto", ("" + (((("message A {\n" + " message B {\n") + " optional string c = 1;\n") + " }\n") + "}\n"))).schema();
MessageType message = ((MessageType) (schema.getType("A")));
JavaGenerator javaGenerator = JavaGenerator.get(schema).withAndroidAnnotations(true);
TypeSpec typeSpec = javaGenerator.generateType(message);
assertThat(JavaFile.builder("", typeSpec).build().toString()).contains(("" + (((((" @WireField(\n" + " tag = 1,\n") + " adapter = \"com.squareup.wire.ProtoAdapter#STRING\"\n") + " )\n") + " @Nullable\n") + " public final String c;")));
}
@Test
public void androidSupport() {
Schema schema = new RepoBuilder().add("message.proto", ("" + (((("message A {\n" + " message B {\n") + " optional string c = 1;\n") + " }\n") + "}\n"))).schema();
MessageType message = ((MessageType) (schema.getType("A")));
JavaGenerator javaGenerator = JavaGenerator.get(schema).withAndroid(true);
TypeSpec typeSpec = javaGenerator.generateType(message);
assertThat(JavaFile.builder("", typeSpec).build().toString()).contains(("" + (((((" @WireField(\n" + " tag = 1,\n") + " adapter = \"com.squareup.wire.ProtoAdapter#STRING\"\n") + " )\n") + " @Nullable\n") + " public final String c;"))).contains(("" + "public static final Parcelable.Creator<B> CREATOR = AndroidMessage.newCreator(ADAPTER)"));
}
@Test
public void enclosingTypeIsNotMessage() {
Schema schema = new RepoBuilder().add("message.proto", ("" + (((("message A {\n" + " message B {\n") + " }\n") + " optional B b = 1;\n") + "}\n"))).schema();
Schema pruned = schema.prune(new IdentifierSet.Builder().include("A.B").build());
JavaGenerator javaGenerator = JavaGenerator.get(schema);
TypeSpec typeSpec = javaGenerator.generateType(pruned.getType("A"));
assertThat(JavaFile.builder("", typeSpec).build().toString()).contains(("" + ((("public final class A {\n" + " private A() {\n") + " throw new AssertionError();\n") + " }"))).contains("public static final class B extends Message<B, B.Builder> {");
}
}
| [
"benjamin.danglot@inria.fr"
] | benjamin.danglot@inria.fr |
1d69871ddb964c9783dd57ff7585cc54f9ed001f | 17b364800dc5318c3b445762e12d1ccb01f73b47 | /src/test/java/com/sallyf/sallyf/AccessDecisionManager/AccessDecisionManagerTest.java | 36e8e5b8c54a9955603f9adc7a550e9f0a153578 | [
"MIT"
] | permissive | sallyf/sallyf | b47041c1c9282ccbf91ef6c34421c980907f1572 | d3d3694d8eabd1eb4c48afac334c09c8ebef1f88 | refs/heads/master | 2021-09-10T08:19:58.919823 | 2018-03-22T19:28:18 | 2018-03-22T19:28:18 | 115,960,401 | 3 | 1 | MIT | 2018-03-10T14:31:22 | 2018-01-02T01:11:07 | Java | UTF-8 | Java | false | false | 2,556 | java | package com.sallyf.sallyf.AccessDecisionManager;
import com.sallyf.sallyf.BaseFrameworkTest;
import com.sallyf.sallyf.Container.Container;
import com.sallyf.sallyf.Container.ServiceDefinition;
import com.sallyf.sallyf.EventDispatcher.EventDispatcher;
import com.sallyf.sallyf.ExpressionLanguage.ExpressionLanguage;
import com.sallyf.sallyf.Router.Router;
import org.junit.Test;
import java.util.HashMap;
import static org.junit.Assert.assertEquals;
public class AccessDecisionManagerTest extends BaseFrameworkTest
{
private static final String ACCESS = "access";
public AccessDecisionManager newInstance()
{
Container c = new Container();
c.add(new ServiceDefinition<>(NameVoter.class)).addTag(AccessDecisionManager.TAG_VOTER);
c.add(new ServiceDefinition<>(CapitalLettersVoter.class)).addTag(AccessDecisionManager.TAG_VOTER);
c.add(new ServiceDefinition<>(ContainsAVoter.class)).addTag(AccessDecisionManager.TAG_VOTER);
c.add(new ServiceDefinition<>(UncalledVoter.class)).addTag(AccessDecisionManager.TAG_VOTER);
c.add(new ServiceDefinition<>(EventDispatcher.class));
c.add(new ServiceDefinition<>(Router.class));
c.add(new ServiceDefinition<>(AccessDecisionManager.class));
c.add(new ServiceDefinition<>(ExpressionLanguage.class));
c.instantiate();
return c.get(AccessDecisionManager.class);
}
private void run(Object subject, boolean eda, boolean edc, boolean edu)
{
AccessDecisionManager authenticationManager = newInstance();
boolean dd = authenticationManager.vote(ACCESS, subject);
boolean da = authenticationManager.vote(ACCESS, subject, DecisionStrategy.AFFIRMATIVE);
boolean dc = authenticationManager.vote(ACCESS, subject, DecisionStrategy.CONSENSUS);
boolean du = authenticationManager.vote(ACCESS, subject, DecisionStrategy.UNANIMOUS);
assertEquals("Default", eda, dd);
assertEquals("Affirmative", eda, da);
assertEquals("Consensus", edc, dc);
assertEquals("Unanimous", edu, du);
}
@Test
public void test1()
{
run("admin", true, true, false);
}
@Test
public void test2()
{
run("foo", true, false, false);
}
@Test
public void test3()
{
run("FOO", true, true, false);
}
@Test
public void test4()
{
run("x", false, false, false);
}
@Test
public void testUnsupportedSubject()
{
run(new HashMap<>(), true, true, true);
}
}
| [
"contact@raphaelvigee.com"
] | contact@raphaelvigee.com |
6b868279d7ef8637dff13b97b0d0ae54e860cfe3 | e5aa5e735d53967862f3cac9ae71640dc85fa498 | /cosmic-core/server/src/main/java/com/cloud/network/nicira/LogicalSwitch.java | f7d415c74b6b8861d00722f0dd086071c3d0a4b4 | [
"Apache-2.0"
] | permissive | MissionCriticalCloud/cosmic | 93eb8e0fa4d7db63f0fd20d8181ed56ecfaab20b | 094bdd3b9f23cc80824e194854c489ce782b6090 | refs/heads/master | 2023-06-22T16:20:25.140568 | 2022-12-08T15:19:54 | 2022-12-08T15:19:54 | 61,372,044 | 58 | 21 | Apache-2.0 | 2023-09-05T22:00:45 | 2016-06-17T12:28:44 | Java | UTF-8 | Java | false | false | 1,174 | java | package com.cloud.network.nicira;
import java.util.List;
public class LogicalSwitch extends BaseNiciraNamedEntity {
public static final String REPLICATION_MODE_SERVICE = "service";
public static final String REPLICATION_MODE_SOURCE = "source";
private final String type = "LogicalSwitchConfig";
private boolean portIsolationEnabled;
private List<TransportZoneBinding> transportZones;
private String replicationMode;
public boolean isPortIsolationEnabled() {
return portIsolationEnabled;
}
public void setPortIsolationEnabled(final boolean portIsolationEnabled) {
this.portIsolationEnabled = portIsolationEnabled;
}
public String getType() {
return type;
}
public List<TransportZoneBinding> getTransportZones() {
return transportZones;
}
public void setTransportZones(final List<TransportZoneBinding> transportZones) {
this.transportZones = transportZones;
}
public String getReplicationMode() {
return replicationMode;
}
public void setReplicationMode(final String replicationMode) {
this.replicationMode = replicationMode;
}
}
| [
"miguelferreira@me.com"
] | miguelferreira@me.com |
76f0d2edacc893d16276fb1d951e59057aeb143e | 313b31fa153a604bf709e1ce107b324a4747d74f | /Enthuware/src/com/krahman/oca/practice/DefaultValues.java | 51d6b4cbfe218fca65989526bdc12ba92cf2e08e | [] | no_license | rush2rehman/oca | b8c6e5ec43d25c8559f4055267503e4e9dd0c81f | a9faebc759d658df66fe3d01b2752dc193a1774f | refs/heads/master | 2020-03-31T02:33:39.999681 | 2018-10-06T10:39:30 | 2018-10-06T10:39:30 | 151,829,514 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | package com.krahman.oca.practice;
public class DefaultValues{
static boolean b;
static int[] ia = new int[1];
static char ch;
static boolean[] ba = new boolean[1];
public static void main(String args[]) throws Exception{
System.out.println(ch == 0);//char default value is 0
boolean x = false;
if( b ){
x = ( ch == ia[ch]);
}
else x = ( ba[ch] = b );
System.out.println(x+" "+ba[ch]);
}
} | [
"rush2rehman@gmail.com"
] | rush2rehman@gmail.com |
4aa053917f10c8974ce920cf469c6aa52847a57d | 76d050963e60293e9ab5669c08c8329c215bbce5 | /android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java | 16caae8d5febe8ed1457a4652e1e3196dbff743a | [] | no_license | dagmawibabi/Astrophile | fac328f555fbba586a6c6b9dcb7fb0bfc12fa8c7 | 2524fdbcdbc0ec75c2d4b3cf531d5d351409cfab | refs/heads/main | 2023-08-22T16:29:48.201906 | 2021-10-21T12:45:49 | 2021-10-21T12:45:49 | 333,611,594 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,007 | java | package io.flutter.plugins;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry;
/**
* Generated file. Do not edit.
* This file is generated by the Flutter tool based on the
* plugins that support the Android platform.
*/
@Keep
public final class GeneratedPluginRegistrant {
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
ShimPluginRegistry shimPluginRegistry = new ShimPluginRegistry(flutterEngine);
com.ko2ic.imagedownloader.ImageDownloaderPlugin.registerWith(shimPluginRegistry.registrarFor("com.ko2ic.imagedownloader.ImageDownloaderPlugin"));
flutterEngine.getPlugins().add(new io.flutter.plugins.pathprovider.PathProviderPlugin());
flutterEngine.getPlugins().add(new io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin());
flutterEngine.getPlugins().add(new com.tekartik.sqflite.SqflitePlugin());
}
}
| [
"noreply@github.com"
] | noreply@github.com |
6e95cabd86018ebdb70590daeac203de19197012 | c8a4c2f4eaa28d542ce1bf9a79cbc95899a150d1 | /code/ifogsim/src/cloudsim/CloudSim.java | 11f11b472e5069dbb4b7c617739fabd7c4768f03 | [] | no_license | ManikandanRJSM/ifogsim_loadbalance | 3ff42605fafede67ed6556cd691ca880991ccac0 | 4fe8aed8ee520e858034f30a75facd8b85e3c17b | refs/heads/master | 2020-04-05T11:53:02.144907 | 2018-11-10T01:22:35 | 2018-11-10T01:22:35 | 156,848,639 | 9 | 2 | null | null | null | null | UTF-8 | Java | false | false | 5,692 | java | /*
* Title: CloudSim Toolkit
* Description: CloudSim (Cloud Simulation) Toolkit for Modeling and Simulation
* of Clouds
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
*
* Copyright (c) 2009, The University of Melbourne, Australia
*/
package cloudsim;
import eduni.simjava.Sim_port;
import gridsim.GridSim;
import gridsim.GridSimCore;
import gridsim.IO_data;
/**
* This class extends the GridSimCore to enable network simulation in
* CloudSim. Also, it disables all the network models from GridSim, to
* provide a simpler simulation of networking. In the network model
* used by CloudSim, a topology file written in BRITE format is used to
* describe the network. Later, nodes in such file are mapped to CloudSim
* entities. Delay calculated from the BRITE model are added to the messages
* send through CloudSim. Messages using the old model are converted to the
* apropriate methods with the correct parameters.
*
* @author Rodrigo N. Calheiros
* @since CloudSim Toolkit 1.0
* @invariant $none
*/
public class CloudSim extends GridSimCore {
/**
* Allocates a new CloudSim object
* @param name the name to be associated with this entity (as
* required by Sim_entity class from simjava package)
* @throws Exception This happens when creating this entity before
* initializing GridSim package or this entity name is
* <tt>null</tt> or empty
*/
public CloudSim(String name) throws Exception {
super(name);
}
/**
* Sends a message without data to a given entity. If network simulation is enabled,
* the delay for message transfer is considered before message delivery.
* @param destID ID of the entity receiving the message
* @param delay time, from the current simulation time, to deliver the message
* Delay due to the latency is added to this time.
* @param gridSimTag tag of the message
* @pre destID >= 0
* @post $none
*/
protected void send(int destID, double delay, int gridSimTag) {
if (destID < 0) return;
// if delay is -ve, then it doesn't make sense. So resets to 0.0
if (delay < 0.0) delay = 0.0;
int srcID = this.get_id();
if(destID!=srcID){//does not delay self messages
delay+=getNetworkDelay(srcID,destID);
}
super.sim_schedule(destID, delay, gridSimTag);
}
/**
* Sends a message to a given entity. If network simulation is enabled,
* the delay for message transfer is considered before message delivery.
* @param destID ID of the entity receiving the message
* @param delay time, from the current simulation time, to deliver the message
* Delay due to the latency is added to this time.
* @param gridSimTag tag of the message
* @param data message data
* @pre destID >= 0
* @post $none
*/
protected void send(int destID, double delay, int gridSimTag, Object data) {
if (destID < 0) return;
// if delay is -ve, then it doesn't make sense. So resets to 0.0
if (delay < 0.0) delay = 0.0;
int srcID = this.get_id();
if(destID!=srcID){//does not delay self messages
delay+=getNetworkDelay(srcID,destID);
}
super.sim_schedule(destID, delay, gridSimTag, data);
}
/**
* Gets the network delay associated to the sent of a message from
* a given source to a given destination.
* @param src source of the message
* @param dst destination of the message
* @return delay to send a message from src to dst
* @pre src >= 0
* @pre dst >= 0
*/
private double getNetworkDelay(int src,int dst){
if(NetworkTopology.isNetworkEnabled()) return NetworkTopology.getDelay(src,dst);
return 0.0;
}
///////////////////////////////////////////////////////////////////////////////
//deprecated methods, fixes here to increase compatibility with GridSim
///////////////////////////////////////////////////////////////////////////////
/*
* @deprecated As in CloudSim entity ID should be used instead of entity name
*/
protected void send(String entityName, double delay, int gridSimTag) {
if (entityName == null) return;
int destID = GridSim.getEntityId(entityName);
if (destID < 0) {
System.out.println(super.get_name() + ".send(): Error - invalid entity name \"" + entityName + "\".");
return;
}
this.send(destID, delay, gridSimTag);
}
/*
* @deprecated As in CloudSim entity ID should be used instead of entity name
*/
protected void send(String entityName, double delay, int gridSimTag, Object data) {
if (entityName == null) return;
int destID = GridSim.getEntityId(entityName);
if (destID < 0) {
System.out.println(super.get_name() + ".send(): Error - invalid entity name \"" + entityName + "\".");
return;
}
this.send(destID, delay, gridSimTag, data);
}
/*
* @deprecated As in CloudSim Sim_ports are not used by CloudSim entities
*/
protected void send(Sim_port destPort, double delay, int gridSimTag) {
this.send(this.get_id(),delay,gridSimTag);
}
/*
* @deprecated As in CloudSim Sim_ports are not used by CloudSim entities
*/
protected void send(Sim_port destPort, double delay, int gridSimTag, Object data) {
int destID = ((IO_data) data).getDestID();
Object message = ((IO_data)data).getData();
this.send(destID,delay,gridSimTag,message);
}
}
| [
"rmanikandanrjsm@outlook.com"
] | rmanikandanrjsm@outlook.com |
b6877da4daa49b9dfb6661b88eff6fb0a7135937 | 1c7f303881807b9b9d83f05e597029c770e614a3 | /spring-jdbc/src/main/java/org/springframework/jdbc/datasource/UserCredentialsDataSourceAdapter.java | ebf5f5e77a3f66b5b300d14e0cb9f39f11d2e65c | [
"Apache-2.0"
] | permissive | JianLaiZzz/spring-framework-5.2.6.RELEASE | 9f61d98fb789723439a9910880225076b29f010d | 23629452d093d622402e4c8a5c8f497b7ae4b2d5 | refs/heads/master | 2022-12-31T11:18:23.758121 | 2020-10-22T12:24:40 | 2020-10-22T12:24:40 | 304,803,029 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,692 | java | /*
* Copyright 2002-2018 the original author or authors.
*
* 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 org.springframework.jdbc.datasource;
import org.springframework.core.NamedThreadLocal;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import java.sql.Connection;
import java.sql.SQLException;
/**
* An adapter for a target JDBC {@link javax.sql.DataSource}, applying the specified
* user credentials to every standard {@code getConnection()} call, implicitly
* invoking {@code getConnection(username, password)} on the target.
* All other methods simply delegate to the corresponding methods of the
* target DataSource.
*
* <p>Can be used to proxy a target JNDI DataSource that does not have user
* credentials configured. Client code can work with this DataSource as usual,
* using the standard {@code getConnection()} call.
*
* <p>In the following example, client code can simply transparently work with
* the preconfigured "myDataSource", implicitly accessing "myTargetDataSource"
* with the specified user credentials.
*
* <pre class="code">
* <bean id="myTargetDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
* <property name="jndiName" value="java:comp/env/jdbc/myds"/>
* </bean>
*
* <bean id="myDataSource" class="org.springframework.jdbc.datasource.UserCredentialsDataSourceAdapter">
* <property name="targetDataSource" ref="myTargetDataSource"/>
* <property name="username" value="myusername"/>
* <property name="password" value="mypassword"/>
* </bean></pre>
*
* <p>If the "username" is empty, this proxy will simply delegate to the
* standard {@code getConnection()} method of the target DataSource.
* This can be used to keep a UserCredentialsDataSourceAdapter bean definition
* just for the <i>option</i> of implicitly passing in user credentials if
* the particular target DataSource requires it.
*
* @author Juergen Hoeller
* @see #getConnection
* @since 1.0.2
*/
public class UserCredentialsDataSourceAdapter extends DelegatingDataSource {
@Nullable
private String username;
@Nullable
private String password;
@Nullable
private String catalog;
@Nullable
private String schema;
private final ThreadLocal<JdbcUserCredentials> threadBoundCredentials =
new NamedThreadLocal<>("Current JDBC user credentials");
/**
* Set the default username that this adapter should use for retrieving Connections.
* <p>Default is no specific user. Note that an explicitly specified username
* will always override any username/password specified at the DataSource level.
*
* @see #setPassword
* @see #setCredentialsForCurrentThread(String, String)
* @see #getConnection(String, String)
*/
public void setUsername(String username) {
this.username = username;
}
/**
* Set the default user's password that this adapter should use for retrieving Connections.
* <p>Default is no specific password. Note that an explicitly specified username
* will always override any username/password specified at the DataSource level.
*
* @see #setUsername
* @see #setCredentialsForCurrentThread(String, String)
* @see #getConnection(String, String)
*/
public void setPassword(String password) {
this.password = password;
}
/**
* Specify a database catalog to be applied to each retrieved Connection.
*
* @see Connection#setCatalog
* @since 4.3.2
*/
public void setCatalog(String catalog) {
this.catalog = catalog;
}
/**
* Specify a database schema to be applied to each retrieved Connection.
*
* @see Connection#setSchema
* @since 4.3.2
*/
public void setSchema(String schema) {
this.schema = schema;
}
/**
* Set user credententials for this proxy and the current thread.
* The given username and password will be applied to all subsequent
* {@code getConnection()} calls on this DataSource proxy.
* <p>This will override any statically specified user credentials,
* that is, values of the "username" and "password" bean properties.
*
* @param username the username to apply
* @param password the password to apply
* @see #removeCredentialsFromCurrentThread
*/
public void setCredentialsForCurrentThread(String username, String password) {
this.threadBoundCredentials.set(new JdbcUserCredentials(username, password));
}
/**
* Remove any user credentials for this proxy from the current thread.
* Statically specified user credentials apply again afterwards.
*
* @see #setCredentialsForCurrentThread
*/
public void removeCredentialsFromCurrentThread() {
this.threadBoundCredentials.remove();
}
/**
* Determine whether there are currently thread-bound credentials,
* using them if available, falling back to the statically specified
* username and password (i.e. values of the bean properties) otherwise.
* <p>Delegates to {@link #doGetConnection(String, String)} with the
* determined credentials as parameters.
*
* @see #doGetConnection
*/
@Override
public Connection getConnection() throws SQLException {
JdbcUserCredentials threadCredentials = this.threadBoundCredentials.get();
Connection con = (threadCredentials != null ?
doGetConnection(threadCredentials.username, threadCredentials.password) :
doGetConnection(this.username, this.password));
if (this.catalog != null) {
con.setCatalog(this.catalog);
}
if (this.schema != null) {
con.setSchema(this.schema);
}
return con;
}
/**
* Simply delegates to {@link #doGetConnection(String, String)},
* keeping the given user credentials as-is.
*/
@Override
public Connection getConnection(String username, String password) throws SQLException {
return doGetConnection(username, password);
}
/**
* This implementation delegates to the {@code getConnection(username, password)}
* method of the target DataSource, passing in the specified user credentials.
* If the specified username is empty, it will simply delegate to the standard
* {@code getConnection()} method of the target DataSource.
*
* @param username the username to use
* @param password the password to use
* @return the Connection
* @see javax.sql.DataSource#getConnection(String, String)
* @see javax.sql.DataSource#getConnection()
*/
protected Connection doGetConnection(@Nullable String username, @Nullable String password) throws SQLException {
Assert.state(getTargetDataSource() != null, "'targetDataSource' is required");
if (StringUtils.hasLength(username)) {
return getTargetDataSource().getConnection(username, password);
} else {
return getTargetDataSource().getConnection();
}
}
/**
* Inner class used as ThreadLocal value.
*/
private static final class JdbcUserCredentials {
public final String username;
public final String password;
public JdbcUserCredentials(String username, String password) {
this.username = username;
this.password = password;
}
@Override
public String toString() {
return "JdbcUserCredentials[username='" + this.username + "',password='" + this.password + "']";
}
}
}
| [
"1914624121@qq.com"
] | 1914624121@qq.com |
3e2094f9cf3b21f1ea0772bcbf1c39b3717f159a | de4635255ac786ad423b076ef43b55c775a1ee6f | /app/src/main/java/tarot/helper/entity/boundary/datatransferobjects/info/MajorCardInfo.java | 8b919ed43580f8359fdd0c417d1ace19f815638d | [] | no_license | robby35us/TarotHelperTDD | ccb0012f0e607b3e8d0d31c0e1e72bd84422ea4b | 43e939a00a079405525217a9aa92fd56aad948fd | refs/heads/master | 2020-06-03T18:50:51.838300 | 2019-06-13T10:58:30 | 2019-06-13T10:58:30 | 191,689,488 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 669 | java | package tarot.helper.entity.boundary.datatransferobjects.info;
import android.support.annotation.NonNull;
import tarot.helper.entity.definitions.Arcana;
import tarot.helper.entity.definitions.Number;
public class MajorCardInfo extends CardInfo {
private Number number;
public MajorCardInfo(@NonNull Number number){
super(Arcana.MAJOR);
this.number = number;
}
public Number getNumber() {
return number;
}
@Override
public int compareTo(CardInfo cardInfo) {
if(cardInfo.getClass() == MajorCardInfo.class)
return number.compareTo(((MajorCardInfo)cardInfo).number);
return -1;
}
}
| [
"callmeelasinthe@gmail.com"
] | callmeelasinthe@gmail.com |
2cecb6ccc3a722b78d5f6b4336e4e04f4a538d89 | 6151cb4b299bf638983d12a55e7c88eda6aa6ab5 | /src/main/java/com/toab/app/signup/exceptions/UserFetchException.java | f00fea1654150e1b23fde899d47651c391b61090 | [] | no_license | anirbandas18/amtica-assignment | 23006aeb06473229adfa77cc2351e162087ef2fc | 6c08f2ee57b12a6b3ccc6a3a7d90ad89dd5838ca | refs/heads/master | 2020-03-28T13:05:02.724891 | 2018-09-11T18:54:03 | 2018-09-11T18:54:03 | 148,362,928 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package com.toab.app.signup.exceptions;
import com.toab.app.signup.errors.UserError;
public class UserFetchException extends UserException {
/**
*
*/
private static final long serialVersionUID = 3169493239735417888L;
public UserFetchException(UserError error, String message) {
super(error, "retrieval error: " + message);
}
}
| [
"anirbandas18@live.com"
] | anirbandas18@live.com |
031ccc9405280432be0e740a36bbb14c97dc9c20 | 89406cc44e5b52ad19a0d6633b144a613b73a46e | /app/src/main/java/com/edtech/math/RPN.java | c7ae12720861449a20160367ba0c10df27f71100 | [
"Apache-2.0"
] | permissive | gautamkarnik/EdTech | 6890cf31e8dcf2c4aafd7a0c30f91746c91d8148 | 99137697d42a70b282a76d7d4e66fe740d0d430e | refs/heads/master | 2021-03-30T18:27:28.400536 | 2018-03-22T01:47:44 | 2018-03-22T01:47:44 | 49,315,774 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,444 | java | package com.edtech.math;
// Source: http://rosettacode.org/wiki/Parsing/RPN_calculator_algorithm#Java_2
// Note: does not support negative numbers
import android.util.Log;
import java.util.LinkedList;
import java.lang.*;
public class RPN {
public static final String CLASS_NAME = RPN.class.getSimpleName();;
public static double evalRPN(String expr){
String cleanExpr = cleanExpr(expr);
LinkedList<Double> stack = new LinkedList<Double>();
Log.d(CLASS_NAME, "evaluating expression: "+ expr);
Log.d(CLASS_NAME, "cleaned expression: "+ cleanExpr);
try {
for(String token:cleanExpr.split("\\s")){
Double tokenNum = null;
try{
tokenNum = Double.parseDouble(token);
}catch(NumberFormatException e){}
if(tokenNum != null){
stack.push(Double.parseDouble(token+""));
}else if(token.equals("×")){
double secondOperand = stack.pop();
double firstOperand = stack.pop();
stack.push(firstOperand * secondOperand);
}else if(token.equals("÷")){
double secondOperand = stack.pop();
double firstOperand = stack.pop();
stack.push(firstOperand / secondOperand);
}else if(token.equals("-")){
double secondOperand = stack.pop();
double firstOperand = stack.pop();
stack.push(firstOperand - secondOperand);
}else if(token.equals("+")){
double secondOperand = stack.pop();
double firstOperand = stack.pop();
stack.push(firstOperand + secondOperand);
}else if(token.equals("^")){
double secondOperand = stack.pop();
double firstOperand = stack.pop();
stack.push(Math.pow(firstOperand, secondOperand));
}else{//just in case
return 0;
}
}
return(stack.pop());
} catch(Exception e) {
Log.d(CLASS_NAME,"Invalid expression.");
return 0;
}
}
private static String cleanExpr(String expr){
//remove all non-operators, non-whitespace, and non digit chars
return expr.replaceAll("[^\\×\\÷\\+\\-\\d/\\s]", "");
}
} | [
"gkarnik@shaw.ca"
] | gkarnik@shaw.ca |
325045209f5e89d5fd23a468a352265da9dcd207 | 1bcbebca01832f42e629126cab448ade409cbfa9 | /app/src/main/java/com/grapefruit/alarm/AlarmReceiver.java | ace3f51016ea87c318680730ba2ff47cc0b9e990 | [] | no_license | bje0716/android-calendar-alarmmanager-example | eee37490693a20819f5066e8c90dc571b98f2834 | 01eae6cd3c8870efc6ce2bb25b075fbd3d287e83 | refs/heads/master | 2023-07-19T08:39:57.113253 | 2021-09-09T16:28:18 | 2021-09-09T16:28:18 | 404,793,004 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,536 | java | package com.grapefruit.alarm;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import androidx.core.app.NotificationCompat;
public class AlarmReceiver extends BroadcastReceiver {
private NotificationManager manager;
private NotificationCompat.Builder builder;
@Override
public void onReceive(Context context, Intent intent) {
manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
manager.createNotificationChannel(new NotificationChannel("channel1", "channel1", NotificationManager.IMPORTANCE_DEFAULT));
builder = new NotificationCompat.Builder(context, "channel1");
} else {
builder = new NotificationCompat.Builder(context);
}
Intent intent1 = new Intent(context, MainActivity.class);
PendingIntent pIntent = PendingIntent.getActivity(context, 101, intent1, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentTitle("alarm");
builder.setSmallIcon(R.mipmap.ic_launcher);
builder.setAutoCancel(true);
builder.setContentIntent(pIntent);
Notification notification = builder.build();
manager.notify(1, notification);
}
}
| [
"byon0716@gmail.com"
] | byon0716@gmail.com |
2eb7eb3ebe61a133e8b646a6259c17783bc50f5b | efb560dacdc7b16d434624a18f9ab4140d4db255 | /src/main/java/com/berkay22demirel/couriertracking/aop/pointcuts/SystemPointCuts.java | e853f5e947c075a1aa5d8dee1219c5a7616d52d7 | [] | no_license | berkay22demirel/courier-tracking | 81a37d0213ce6db638c0ef3ca13f0254df547524 | 6f0c6990a00f687ee7ee358f99d4070453ca89b4 | refs/heads/master | 2023-03-02T04:23:44.571240 | 2021-02-08T07:52:04 | 2021-02-08T07:52:04 | 333,774,000 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 317 | java | package com.berkay22demirel.couriertracking.aop.pointcuts;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
@Aspect
public class SystemPointCuts {
@Pointcut("@annotation(com.berkay22demirel.couriertracking.aop.annotation.Loggable)")
public void loggable() {
}
}
| [
"berkay_demirel22@hotmail.com"
] | berkay_demirel22@hotmail.com |
7fb8d300d8eb2e750e42b2de7e372f5e15c9be41 | 689ce06aefc029bb2c2bd505aa96dc10529493b3 | /SpringBootSSS/src/main/java/com/gao/dao/UserDao.java | 980e08522a96bea276ab025c05ed3e3d882b4d78 | [] | no_license | hihauser/sshtest | a1aa672f06ebb6f7dd8e09ac2aa0f005e1231d2a | 802785f55efb9193acab797897283138f072d017 | refs/heads/master | 2022-06-28T16:08:53.545582 | 2019-12-11T07:03:41 | 2019-12-11T07:03:41 | 227,316,565 | 0 | 0 | null | 2022-06-21T02:25:33 | 2019-12-11T08:41:35 | Java | UTF-8 | Java | false | false | 285 | java | package com.gao.dao;
import com.gao.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface UserDao extends JpaRepository<User,Integer>, JpaSpecificationExecutor<User> {
}
| [
"aaa@qq.com"
] | aaa@qq.com |
165acb580fb73aff952fca0ffa8cf46b33ec18cd | 91a5ae13bd5e5b9f4b26021ebc398665ff5021b0 | /src/main/java/com/kh/nullcompany/schedule/model/vo/DetailSchedule.java | 667da183d205066b516ed582721ebb249427b235 | [] | no_license | nullcompany2/nullCompany | 5e04d5f50e809d552355a3d614de9b4301f59b20 | 54fb9683cc77e304f15e735be3ec39c419382dd6 | refs/heads/master | 2023-01-29T00:15:56.667104 | 2020-12-14T11:37:45 | 2020-12-14T11:37:45 | 308,565,534 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,634 | java | package com.kh.nullcompany.schedule.model.vo;
public class DetailSchedule {
private String Cal_name;
private String Sche_name;
private String startdate;
private String starttime;
private String enddate;
private String endtime;
private String Sche_content;
private String color;
private int cal_mem_type;
private String name;
public DetailSchedule(String cal_name, String sche_name, String startdate, String starttime, String enddate,
String endtime, String sche_content, String color, int cal_mem_type, String name) {
super();
Cal_name = cal_name;
Sche_name = sche_name;
this.startdate = startdate;
this.starttime = starttime;
this.enddate = enddate;
this.endtime = endtime;
Sche_content = sche_content;
this.color = color;
this.cal_mem_type = cal_mem_type;
this.name = name;
}
public DetailSchedule() {
super();
// TODO Auto-generated constructor stub
}
public String getCal_name() {
return Cal_name;
}
public void setCal_name(String cal_name) {
Cal_name = cal_name;
}
public String getSche_name() {
return Sche_name;
}
public void setSche_name(String sche_name) {
Sche_name = sche_name;
}
public String getStartdate() {
return startdate;
}
public void setStartdate(String startdate) {
this.startdate = startdate;
}
public String getStarttime() {
return starttime;
}
public void setStarttime(String starttime) {
this.starttime = starttime;
}
public String getEnddate() {
return enddate;
}
public void setEnddate(String enddate) {
this.enddate = enddate;
}
public String getEndtime() {
return endtime;
}
public void setEndtime(String endtime) {
this.endtime = endtime;
}
public String getSche_content() {
return Sche_content;
}
public void setSche_content(String sche_content) {
Sche_content = sche_content;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public int getCal_mem_type() {
return cal_mem_type;
}
public void setCal_mem_type(int cal_mem_type) {
this.cal_mem_type = cal_mem_type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "DetailSchedule [Cal_name=" + Cal_name + ", Sche_name=" + Sche_name + ", startdate=" + startdate
+ ", starttime=" + starttime + ", enddate=" + enddate + ", endtime=" + endtime + ", Sche_content="
+ Sche_content + ", color=" + color + ", cal_mem_type=" + cal_mem_type + ", name=" + name + "]";
}
}
| [
"dg3790@nate.com"
] | dg3790@nate.com |
e55cf7661f211efe54e01ff685fb2dfb8f1811cc | 05ba07453ff56cb1e4329972ddfd1220c74c58f8 | /src/main/java/GoFDesignPatterns/StructuralDesignPatterns/Adapter/AdapterExample1/Socket.java | 2644930060e26d3575cff9ffb8cdddc93f769db7 | [] | no_license | MrDexII/DesignPatterns | dcdefed960ba95df2328d2a237af9b3579baa67e | b24498b7c8a691549461c8f7c927e4f41fd65586 | refs/heads/master | 2022-12-28T18:56:49.926888 | 2020-07-21T15:09:25 | 2020-07-21T15:09:25 | 281,421,973 | 0 | 0 | null | 2020-10-13T23:46:52 | 2020-07-21T14:35:02 | Java | UTF-8 | Java | false | false | 165 | java | package GoFDesignPatterns.StructuralDesignPatterns.Adapter.AdapterExample1;
public class Socket {
public Volt getVolt(){
return new Volt(120);
}
}
| [
"free.andrew.a@gmail.com"
] | free.andrew.a@gmail.com |
b3e775f172c7aff56197565174ff0f5a53bdb456 | acbf609b11ae2e9438ae8c5552375b3c83eb38fd | /homework/java2/lesson7/serverside/service/MyServer.java | 72e2ca990b3da74269f4cc34bd4da3ed4f614bb5 | [] | no_license | Seakytin/Java2 | 8d0e7c62ba7c443e48903ac9031bd8b0875a700b | 61649c42b347bb82a635f9ab4b09790cb655f782 | refs/heads/master | 2023-03-11T06:52:50.859340 | 2021-02-27T19:18:06 | 2021-02-27T19:18:06 | 333,821,496 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,206 | java | package homework.java2.lesson7.serverside.service;
import homework.java2.lesson7.serverside.interfaces.AuthService;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
public class MyServer {
private final int PORT = 8081;
private List<ClientHandler> clients;
private AuthService authService;
public AuthService getAuthService() {
return this.authService;
}
public MyServer() {
try (ServerSocket server = new ServerSocket(PORT)){
authService = new BaseAuthService();
authService.start();
clients = new ArrayList<>();
while (true) {
System.out.println("Сервер ожидает подключения");
Socket socket = server.accept();
System.out.println(socket.getInetAddress().getCanonicalHostName());
System.out.println("Клиент подклчился");
new ClientHandler(this, socket);
}
} catch (IOException e){
System.out.println("Сервер не пережил землятрясение");
} finally {
if (authService != null) {
authService.stop();
}
}
}
public synchronized void broadcastMessage(String message) {
for (ClientHandler c : clients) {
c.sendMessage(message);
}
}
public synchronized void privateMessage(ClientHandler from, String toName, String message) {
for (ClientHandler c : clients) {
if (c.getName().equals(toName)){
c.sendMessage(message);
from.sendMessage(message);
}
}
}
public synchronized void subscribe(ClientHandler client) {
clients.add(client);
}
public synchronized void unsubscribe(ClientHandler client) {
clients.remove(client);
}
public boolean isNickBusy(String nick) {
for (ClientHandler c : clients) {
if (c.getName().equals(nick)) {
return true;
}
}
return false;
}
}
| [
"Seakytin@yandex.ru"
] | Seakytin@yandex.ru |
c595754067341e4f806d28bb7bcef7da4c2353a6 | 9ccd54b36350eab8318d92ef2e09731bc6c03626 | /hapi-fhir-jpaserver-hfql/src/test/java/ca/uhn/fhir/jpa/fql/jdbc/ArchitectureTest.java | 240617568a46337293c581966b4e5a1a9099b116 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | hapifhir/hapi-fhir | 87b47c32472cea589ae32b5eaa89d49c8cc6b66f | ed616f7a6dff2ee891b39f7ed2a301d1efbbfec4 | refs/heads/master | 2023-08-23T23:06:01.503700 | 2023-08-23T14:27:02 | 2023-08-23T14:27:02 | 21,180,741 | 692 | 406 | Apache-2.0 | 2023-09-14T21:14:30 | 2014-06-24T21:00:46 | Java | UTF-8 | Java | false | false | 846 | java | package ca.uhn.fhir.jpa.fql.jdbc;
import com.tngtech.archunit.core.domain.JavaClasses;
import com.tngtech.archunit.core.importer.ImportOption;
import com.tngtech.archunit.junit.AnalyzeClasses;
import com.tngtech.archunit.junit.ArchTest;
import com.tngtech.archunit.lang.syntax.ArchRuleDefinition;
@AnalyzeClasses(
packages = "ca.uhn.fhir.jpa.fql..",
importOptions = {
ImportOption.DoNotIncludeTests.class
}
)
public class ArchitectureTest {
/**
* This project has a "provided" dependency on javax.servlet, but the packaged jdbc driver doesn't bundle it.
*/
@ArchTest
void verifyNoDepsOnProvidedServlet(JavaClasses theJavaClasses) {
ArchRuleDefinition.noClasses().that().resideInAPackage("ca.uhn.fhir.jpa.fql.jdbc")
.should().transitivelyDependOnClassesThat().resideInAPackage("javax.servlet")
.check(theJavaClasses);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
a091ba55d4532f47a65931805257d22301035481 | 8ec45fa679e0789878cbc9a69f8fbb821694e7a5 | /src/main/java/com/ngames/nclient/mixin/MixinNetworkManager.java | b7c9a834a10410531ef80eeb41ea600468d63edc | [] | no_license | sn115426/nclient | e93d257e7a6503d8e8fe3e06c810dda2f7ce6c8c | f923d74c55756bef0bf3df85e02f73ba5a7f0bea | refs/heads/main | 2023-06-25T05:48:42.527855 | 2021-07-29T06:36:30 | 2021-07-29T06:36:30 | 365,970,096 | 6 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,379 | java | package com.ngames.nclient.mixin;
import io.netty.channel.ChannelHandlerContext;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.ngames.nclient.module.Modules;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.CPacketEntityAction;
import net.minecraft.network.play.client.CPacketInput;
import net.minecraft.network.play.client.CPacketPlayer.Position;
import net.minecraft.network.play.client.CPacketPlayer.PositionRotation;
import net.minecraft.network.play.client.CPacketPlayer.Rotation;
import net.minecraft.network.play.client.CPacketPlayerAbilities;
import net.minecraft.network.play.client.CPacketPlayerDigging;
import net.minecraft.network.play.client.CPacketPlayerTryUseItem;
import net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock;
import net.minecraft.network.play.client.CPacketUseEntity;
import net.minecraft.network.play.client.CPacketVehicleMove;
@Mixin(NetworkManager.class)
public class MixinNetworkManager
{
@Inject(method = "sendPacket(Lnet/minecraft/network/Packet;Lio/netty/util/concurrent/GenericFutureListener;[Lio/netty/util/concurrent/GenericFutureListener;)V", at = @At("HEAD"), cancellable = true)
private void sendPacket(Packet<?> packet, GenericFutureListener<? extends Future<? super Void>> p_sendPacket_2_, GenericFutureListener<? extends Future<? super Void>>[] p_sendPacket_3_, CallbackInfo info)
{
if (Modules.packetCanceller.isEnabled())
{
if (packet instanceof CPacketInput && Modules.packetCanceller.CPacketInput.getValue())
info.cancel();
if (packet instanceof Position && Modules.packetCanceller.CPacketPosition.getValue())
info.cancel();
if (packet instanceof PositionRotation && Modules.packetCanceller.CPacketPositionRotation.getValue())
info.cancel();
if (packet instanceof Rotation && Modules.packetCanceller.CPacketRotation.getValue())
info.cancel();
if (packet instanceof CPacketPlayerAbilities && Modules.packetCanceller.CPacketPlayerAbilities.getValue())
info.cancel();
if (packet instanceof CPacketPlayerDigging && Modules.packetCanceller.CPacketPlayerDigging.getValue())
info.cancel();
if (packet instanceof CPacketPlayerTryUseItem && Modules.packetCanceller.CPacketPlayerTryUseItem.getValue())
info.cancel();
if (packet instanceof CPacketPlayerTryUseItemOnBlock && Modules.packetCanceller.CPacketPlayerTryUseItemOnBlock.getValue())
info.cancel();
if (packet instanceof CPacketEntityAction && Modules.packetCanceller.CPacketEntityAction.getValue())
info.cancel();
if (packet instanceof CPacketUseEntity && Modules.packetCanceller.CPacketUseEntity.getValue())
info.cancel();
if (packet instanceof CPacketVehicleMove && Modules.packetCanceller.CPacketVehicleMove.getValue())
info.cancel();
if (info.isCancelled())
Modules.packetCanceller.inHud.set(((int) Modules.packetCanceller.inHud.get())+1);
}
}
@Inject(method = "channelRead0", at = @At("HEAD"))
private void receivePacket(ChannelHandlerContext p_channelRead0_1_, Packet<?> p_channelRead0_2_, CallbackInfo ci) {
}
}
| [
"69734357+sn0wy01@users.noreply.github.com"
] | 69734357+sn0wy01@users.noreply.github.com |
1794268565956848121fbdcb707195f6d15f9beb | 10f0c54e74890d804454d6755dd158e266fb7d29 | /algorithm-algospot/src/chap19/brackets2/Main.java | f881263ae27742dd3a6eee52d5e3ac0acebe2fc0 | [] | no_license | sivachandranice/algorithm | 776520542b18de11c4ed419af938b24ca833d248 | 6115dbee25ec50683c0c27058e1de5edf3c3f61b | refs/heads/master | 2023-07-19T16:08:26.077250 | 2021-09-24T13:20:14 | 2021-09-24T13:20:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,016 | java | package chap19.brackets2;
import java.io.FileInputStream;
import java.util.Scanner;
import java.util.Stack;
/*
https://algospot.com/judge/problem/read/BRACKETS2
*/
public class Main {
public static void main(String[] args) throws Exception{
Scanner sc=new Scanner(new FileInputStream("input.txt"));
//Scanner sc = new Scanner(System.in);
int cases = sc.nextInt();
while(cases-- > 0) {
/** input */
String fomular = sc.next();
/** output */
if(wellMatched(fomular))
System.out.println("YES");
else
System.out.println("NO");
}
}
public static boolean wellMatched(String fomular) {
Stack<String> stack = new Stack<>();
for(int i=0;i<fomular.length();i++) {
char ch = fomular.charAt(i);
if(ch=='{' || ch=='[' || ch=='(') {
stack.push(String.valueOf(ch));
} else {
//스택이 비어있는 경우
if(stack.isEmpty()){
return false;
}
String head = stack.pop();
if(!isMatch(ch,head)) {
return false;
}
}
}
return stack.isEmpty(); //닫히지 않는 괄호가 없어야 성공
}
public static boolean isMatch(char ch,String head) {
switch(ch) {
case '}' :
return head.equals("{");
case ']' :
return head.equals("[");
case ')' :
return head.equals("(");
}
return false;
}
public static boolean wellMatched2(String input) {
Stack<Character> stack = new Stack<>();
for(int i=0;i<input.length();i++) {
char ch = input.charAt(i);
switch(ch) {
case '(':
case '{':
case '[':
stack.push(ch);
break;
case ']':
if(stack.isEmpty() || stack.pop() != '[')
return false;
break;
case '}':
if(stack.isEmpty() || stack.pop() != '{')
return false;
break;
case ')':
if(stack.isEmpty() || stack.pop() != '(')
return false;
break;
}
}
return stack.isEmpty();
}
}
/*
3
()()
({[}])
({}[(){}])
*/ | [
"zaccoding725@gmail.com"
] | zaccoding725@gmail.com |
e4be78405f418e7d13cf1de80dd5bac91a162645 | 5cb1626d69536b79f66ce9e90cbbd18c29955e52 | /android/src/com/mapswithme/maps/purchase/AdsRemovalValidationCallback.java | 0035e49dd15e592455605d12cf89c0879540cb28 | [
"Apache-2.0"
] | permissive | mnameghi/omim | 5979e43909933fff7e9e295abe777e62c9bb5f68 | 6364317bd9aec7288a37b39dbaa27398bcd24a82 | refs/heads/master | 2020-03-30T06:18:55.371168 | 2018-10-03T11:22:20 | 2018-10-03T11:22:20 | 150,851,835 | 0 | 1 | Apache-2.0 | 2018-09-29T10:07:55 | 2018-09-29T10:07:55 | null | UTF-8 | Java | false | false | 196 | java | package com.mapswithme.maps.purchase;
import android.support.annotation.NonNull;
public interface AdsRemovalValidationCallback
{
void onValidate(@NonNull AdsRemovalValidationStatus status);
}
| [
"donskdmitry@mail.ru"
] | donskdmitry@mail.ru |
777a48b8ae3c423affbba6a1cba9b219485a5f62 | 68506ef8bf135b7739f2cb0d01531aedd02f632c | /src/main/java/model/Database.java | 2f71c45c01899dce487689a23b18dfa8e88e88c3 | [] | no_license | mertkolgu/SirketCalisanlariProjesi | e60e483d9b1f7200e0cdf325a5f4e4b564e137ba | 332e60fea654e0edc6a47f2b00af68e594fc6539 | refs/heads/master | 2020-07-24T22:05:33.250185 | 2019-09-12T14:14:21 | 2019-09-12T14:14:21 | 208,063,401 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,455 | 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 model;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
/**
*
* @author Mert
*/
public class Database {
public Connection con;
private final String USER_NAME = "root";
private final String PASSWORD = "";
private final String DB_NAME = "sirket";
private final String HOST = "localhost";
private final int PORT = 3306;
// jdbc:mysql://localhost:3306/sirket?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
private final String URL = "jdbc:mysql://" + HOST + ":" + PORT + "/" + DB_NAME
+ "?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";
private final String DRIVER = "com.mysql.cj.jdbc.Driver";
public void baglan() {
try {
Class.forName(DRIVER);
con = DriverManager.getConnection(URL, USER_NAME, PASSWORD);
System.out.println("Veritabanı bağlantısı başarılı.");
} catch (SQLException e) {
System.out.println("Veritabanına bağlanılamadı! Bağlantıda hata var!\n" + e);
} catch (ClassNotFoundException e) {
System.out.println("Driver bulunamadı.");
}
}
}
| [
"mertkolgu@outlook.com"
] | mertkolgu@outlook.com |
145b82212731d16d87448f0874f9450de86b25c2 | 898778d569700fd95585e867df6687f97e25f3c1 | /summer-mis/src/main/java/cn/cerc/ui/fields/OptionField.java | dbc4799bdd2cbbdc69bed07153dd2dbb033e49cc | [] | no_license | wangscript007/summer-framework | 31b4a5e3959057155abc4b61b5458345f6b359c9 | 87e093ded53d8e355a5322d3d97211f32a7988d3 | refs/heads/main | 2023-01-07T04:19:41.238518 | 2020-11-09T03:20:03 | 2020-11-09T03:20:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,920 | java | package cn.cerc.ui.fields;
import cn.cerc.core.Record;
import cn.cerc.ui.core.HtmlWriter;
import cn.cerc.ui.parts.UIComponent;
import java.util.LinkedHashMap;
import java.util.Map;
public class OptionField extends AbstractField {
private String defaultValue;
private int size;// 默认显示行数
private Map<String, String> items = new LinkedHashMap<>();
public OptionField(UIComponent owner, String name, String field) {
super(owner, name, 0);
this.setField(field);
}
public OptionField(UIComponent owner, String name, String field, int width) {
super(owner, name, width);
this.setField(field);
}
public OptionField put(String key, String text) {
if (this.defaultValue == null) {
defaultValue = key;
}
items.put(key, text);
return this;
}
public OptionField copyValues(Map<String, String> items) {
for (String key : items.keySet()) {
this.put(key, items.get(key));
}
return this;
}
@Override
public String getText(Record record) {
if (record == null) {
return null;
}
if (buildText != null) {
HtmlWriter html = new HtmlWriter();
buildText.outputText(record, html);
return html.toString();
}
return record.getString(getField());
}
@Override
public String getString() {
String result = super.getString();
if (result == null || "".equals(result)) {
return this.defaultValue;
}
return result;
}
@Override
public void output(HtmlWriter html) {
Record record = dataSource != null ? dataSource.getDataSet().getCurrent() : null;
String current = this.getText(record);
html.println("<label for=\"%s\">%s</label>", this.getId(), this.getName() + ":");
html.print("<select id=\"%s\" name=\"%s\"", this.getId(), this.getId());
if (this.size > 0) {
html.print(" size=\"%s\"", this.getSize());
}
if (this.isReadonly()) {
html.print(" disabled");
}
if (this.getCssStyle() != null) {
html.print(" style=\"%s\"", this.getCssStyle());
}
html.print(">");
for (String key : items.keySet()) {
String value = items.get(key);
html.print("<option value=\"%s\"", key);
if (key.equals(current)) {
html.print(" selected");
}
html.print(">");
html.println(String.format("%s</option>", value));
}
html.println("</select>");
if (this.isShowStar()) {
html.print("<font>*</font>");
}
html.print("<span></span>");
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
} | [
"l1091462907@gmail.com"
] | l1091462907@gmail.com |
8ccd577df08217863e826c60bd64bd544cedaa5d | 7bf58d9169e21d6dd324f04ca14cb064756898a0 | /GuitarState.java | 9fd21000b357bded6b6a6f11049726246b3546a7 | [] | no_license | dana506/groupqsoftwareengineeringproject | 7a9a9bf36bc3c2357bd63f49c697386fd43dbb01 | 65f25a0a0eaa807c781e509db546e8fb96b05202 | refs/heads/master | 2020-04-22T11:30:18.868899 | 2019-03-22T11:00:28 | 2019-03-22T11:00:28 | 170,342,796 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 4,079 | java | import java.util.Arrays;
/**
* Represents the state of a guitar controller at a given moment in time, i.e. the status of all its components
* @author Callum Browne
*
*/
public class GuitarState {
/**
* An array of six boolean values, corresponding to each fret button
*/
private boolean[] fretButtons;
/**
* An integer value (either -1, 0 or 1) corresponding to the strum bar's state
*/
private int strumBar;
/**
* A boolean value representing whether the Zero Power button is pressed
*/
private boolean zeroPowerButton;
/**
* A float value between 0 and 1 (inclusive) representing the current value of the whammy bar
*/
private float whammyBar;
/**
* A float value between 0 and 1 (going up in 0.125 increments) representing the current value of the bender button
*/
private float benderButton;
/**
* A boolean value representing whether the escape button is pressed
*/
private Boolean escapeButton;
public GuitarState(boolean[] fretButtons, int strumBar, boolean zeroPowerButton, float whammyBar, float benderButton, Boolean escapeButton) {
this.fretButtons = fretButtons;
this.strumBar = strumBar;
this.zeroPowerButton = zeroPowerButton;
this.whammyBar = whammyBar;
this.benderButton = benderButton;
this.escapeButton = escapeButton;
}
/**
* Calling the getComponents() method on a JInput controller, then using getPollData() produces an array of 18 floats
* corresponding to various parts on the controller. This method takes in those floats and interprets them
* @param values - The values obtained via JInput
* @return A GuitarState representing the given values
*/
public static GuitarState fromControllerComponentsValues(float[] values)
{
boolean[] fretButtons = new boolean[]{false, false, false, false, false, false};
int strumBar = 0;
boolean zeroPowerButton = false;
float whammyBar = 0;
float benderButton = 0;
boolean escapeButton = false;
String os = System.getProperty("os.name").toLowerCase();
if(os.contains("windows")) {
fretButtons = new boolean[]{(values[1] != 0), (values[0] != 0), (values[2] != 0), (values[4] != 0), (values[3] != 0), (values[5] != 0)};
strumBar = (int) values[16];
zeroPowerButton = (values[8] != 0);
whammyBar = values[14];
benderButton = values[13];
escapeButton = (values[10] != 0);
}
else if(os.contains("inux")) {
fretButtons = new boolean[]{(values[1] != 0), (values[0] != 0), (values[2] != 0), (values[4] != 0), (values[3] != 0), (values[5] != 0)};
strumBar = (int) values[14];
zeroPowerButton = (values[8] != 0);
whammyBar = values[16];
benderButton = values[17];
escapeButton = (values[10] != 0);
}
else if(os.contains("mac")) {
fretButtons = new boolean[]{(values[1] != 0), (values[0] != 0), (values[2] != 0), (values[4] != 0), (values[3] != 0), (values[5] != 0)};
strumBar = (int) values[15];
zeroPowerButton = (values[8] != 0);
whammyBar = values[17];
benderButton = values[13];
escapeButton = (values[10] != 0);
}
else {
System.out.println("Unsupported machine...");
System.exit(-1);
}
return new GuitarState(fretButtons, strumBar, zeroPowerButton, whammyBar, benderButton, escapeButton);
}
public boolean[] getFretButtons() {
return fretButtons;
}
public int getStrumBar() {
return strumBar;
}
public Boolean getZeroPowerButton() {
return zeroPowerButton;
}
public float getWhammyBar() {
return whammyBar;
}
public float getBenderButton() {
return benderButton;
}
public Boolean getEscapeButton() {
return escapeButton;
}
}
| [
"cb817@exeter.ac.uk"
] | cb817@exeter.ac.uk |
4d58b50d63035fe423d97712e99f10a51e36d806 | d524f2e05eb553448e9c07d4d4f61dd0c2a874be | /PierwszyProjekt/src/pierwszapaczka/TestOperLog.java | 6225742d7c0d2fb8bcc6c64522a79f102333472b | [] | no_license | cooover/java_zajecia | 9a728fb959028d1a736381e95e1b6b3d92bf3b9d | 5b69f4f0776853d86edb1f044b6eecf4ee843128 | refs/heads/master | 2021-01-06T20:45:55.975938 | 2017-08-07T09:11:29 | 2017-08-07T09:11:29 | 99,558,719 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | java | package pierwszapaczka;
public class TestOperLog {
public static void main(String[] args) {
int x = 5;
int y = 10;
System.out.println("X>Y " + (x>y));
System.out.println("X<Y " + (x<y));
System.out.println("X!=Y " + (x!=y));
System.out.println("X==Y " + (x==y));
boolean instance = "Kasia" instanceof String;
System.out.println(instance);
}
}
| [
"h.kowerska@gmail.com"
] | h.kowerska@gmail.com |
41c4cacad3e2027f8096a6a60c561045095c3b10 | 3dc0c245c828adb89fee8d6f5e804771b51d7003 | /src/main/java/com/google/devtools/build/lib/rules/java/JavaInfoBuildHelper.java | 8f02c0ff67a4660402b749a18f23c6f37ef4adbc | [
"Apache-2.0"
] | permissive | gptcod/bazel | 7f4a7fc43d471468ad737595cd85f0c7d8775683 | f04e6767f290102611688e871b1991a5070c0890 | refs/heads/master | 2023-08-18T15:55:05.343279 | 2019-01-27T19:29:08 | 2019-01-27T19:31:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,162 | java | // Copyright 2018 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.devtools.build.lib.rules.java;
import static com.google.common.collect.Iterables.concat;
import static com.google.devtools.build.lib.rules.java.JavaCompilationArgsProvider.ClasspathType.BOTH;
import static com.google.devtools.build.lib.rules.java.JavaCompilationArgsProvider.ClasspathType.COMPILE_ONLY;
import static com.google.devtools.build.lib.rules.java.JavaCompilationArgsProvider.ClasspathType.RUNTIME_ONLY;
import static com.google.devtools.build.lib.rules.java.JavaInfo.streamProviders;
import static java.util.stream.Stream.concat;
import com.google.common.base.Ascii;
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.actions.ActionRegistry;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.FilesToRunProvider;
import com.google.devtools.build.lib.analysis.RuleContext;
import com.google.devtools.build.lib.analysis.Runfiles;
import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
import com.google.devtools.build.lib.analysis.actions.ActionConstructionContext;
import com.google.devtools.build.lib.analysis.actions.CustomCommandLine;
import com.google.devtools.build.lib.analysis.actions.SpawnAction;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration.StrictDepsMode;
import com.google.devtools.build.lib.analysis.skylark.SkylarkActionFactory;
import com.google.devtools.build.lib.analysis.skylark.SkylarkRuleContext;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.collect.nestedset.Order;
import com.google.devtools.build.lib.events.Location;
import com.google.devtools.build.lib.rules.java.JavaCompilationArgsProvider.ClasspathType;
import com.google.devtools.build.lib.syntax.Environment;
import com.google.devtools.build.lib.syntax.EvalException;
import com.google.devtools.build.lib.syntax.SkylarkList;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
import java.util.stream.Stream;
import javax.annotation.Nullable;
/** Implements logic for creating JavaInfo from different set of input parameters. */
final class JavaInfoBuildHelper {
private static final JavaInfoBuildHelper INSTANCE = new JavaInfoBuildHelper();
private JavaInfoBuildHelper() {}
public static JavaInfoBuildHelper getInstance() {
return INSTANCE;
}
/**
* Creates JavaInfo instance from outputJar.
*
* @param outputJar the jar that was created as a result of a compilation (e.g. javac, scalac,
* etc)
* @param sourceFiles the sources that were used to create the output jar
* @param sourceJars the source jars that were used to create the output jar
* @param useIjar if an ijar of the output jar should be created and stored in the provider
* @param neverlink if true only use this library for compilation and not at runtime
* @param compileTimeDeps compile time dependencies that were used to create the output jar
* @param runtimeDeps runtime dependencies that are needed for this library
* @param exports libraries to make available for users of this library. <a
* href="https://docs.bazel.build/versions/master/be/java.html#java_library"
* target="_top">java_library.exports</a>
* @param actions used to create the ijar and single jar actions
* @param javaToolchain the toolchain to be used for retrieving the ijar tool
* @param jdeps optional jdeps information for outputJar
* @return new created JavaInfo instance
* @throws EvalException if some mandatory parameter are missing
*/
@Deprecated
JavaInfo createJavaInfoLegacy(
Artifact outputJar,
SkylarkList<Artifact> sourceFiles,
SkylarkList<Artifact> sourceJars,
Boolean useIjar,
Boolean neverlink,
SkylarkList<JavaInfo> compileTimeDeps,
SkylarkList<JavaInfo> runtimeDeps,
SkylarkList<JavaInfo> exports,
Object actions,
Object javaToolchain,
Object hostJavabase,
@Nullable Artifact jdeps,
Location location)
throws EvalException {
final Artifact sourceJar;
if (sourceFiles.isEmpty() && sourceJars.isEmpty()) {
sourceJar = null;
} else if (sourceFiles.isEmpty() && sourceJars.size() == 1) {
sourceJar = sourceJars.get(0);
} else {
if (!(actions instanceof SkylarkActionFactory)) {
throw new EvalException(location, "Must pass ctx.actions when packing sources.");
}
if (!isValidJavaToolchain(javaToolchain)) {
throw new EvalException(location, "Must pass java_toolchain when packing sources.");
}
if (!isValidJavaRuntime(hostJavabase)) {
throw new EvalException(location, "Must pass host_javabase when packing sources.");
}
sourceJar =
packSourceFiles(
(SkylarkActionFactory) actions,
outputJar,
sourceFiles,
sourceJars,
javaToolchain,
hostJavabase,
location);
}
final Artifact iJar;
if (useIjar) {
if (!(actions instanceof SkylarkActionFactory)) {
throw new EvalException(
location,
"The value of use_ijar is True. Make sure the ctx.actions argument is valid.");
}
if (!isValidJavaToolchain(javaToolchain)) {
throw new EvalException(
location,
"The value of use_ijar is True. Make sure the java_toolchain argument is valid.");
}
iJar =
buildIjar(
(SkylarkActionFactory) actions,
outputJar,
null,
getJavaToolchainProvider(location, javaToolchain),
location);
} else {
iJar = outputJar;
}
return createJavaInfo(
outputJar,
iJar,
sourceJar,
neverlink,
compileTimeDeps,
runtimeDeps,
exports,
jdeps,
location);
}
/**
* Creates JavaInfo instance from outputJar.
*
* @param outputJar the jar that was created as a result of a compilation (e.g. javac, scalac,
* etc)
* @param compileJar Jar added as a compile-time dependency to other rules. Typically produced by
* ijar.
* @param sourceJar the source jar that was used to create the output jar
* @param neverlink if true only use this library for compilation and not at runtime
* @param compileTimeDeps compile time dependencies that were used to create the output jar
* @param runtimeDeps runtime dependencies that are needed for this library
* @param exports libraries to make available for users of this library. <a
* href="https://docs.bazel.build/versions/master/be/java.html#java_library"
* target="_top">java_library.exports</a>
* @param jdeps optional jdeps information for outputJar
* @return new created JavaInfo instance
*/
JavaInfo createJavaInfo(
Artifact outputJar,
Artifact compileJar,
@Nullable Artifact sourceJar,
Boolean neverlink,
SkylarkList<JavaInfo> compileTimeDeps,
SkylarkList<JavaInfo> runtimeDeps,
SkylarkList<JavaInfo> exports,
@Nullable Artifact jdeps,
Location location) {
compileJar = compileJar != null ? compileJar : outputJar;
ImmutableList<Artifact> sourceJars =
sourceJar != null ? ImmutableList.of(sourceJar) : ImmutableList.of();
JavaInfo.Builder javaInfoBuilder = JavaInfo.Builder.create();
javaInfoBuilder.setLocation(location);
JavaCompilationArgsProvider.Builder javaCompilationArgsBuilder =
JavaCompilationArgsProvider.builder();
if (!neverlink) {
javaCompilationArgsBuilder.addRuntimeJar(outputJar);
}
javaCompilationArgsBuilder.addDirectCompileTimeJar(
/* interfaceJar= */ compileJar, /* fullJar= */ outputJar);
JavaRuleOutputJarsProvider javaRuleOutputJarsProvider =
JavaRuleOutputJarsProvider.builder()
.addOutputJar(outputJar, compileJar, null /* manifestProto */, sourceJars)
.setJdeps(jdeps)
.build();
javaInfoBuilder.addProvider(JavaRuleOutputJarsProvider.class, javaRuleOutputJarsProvider);
ClasspathType type = neverlink ? COMPILE_ONLY : BOTH;
streamProviders(exports, JavaCompilationArgsProvider.class)
.forEach(args -> javaCompilationArgsBuilder.addExports(args, type));
streamProviders(compileTimeDeps, JavaCompilationArgsProvider.class)
.forEach(args -> javaCompilationArgsBuilder.addDeps(args, type));
streamProviders(runtimeDeps, JavaCompilationArgsProvider.class)
.forEach(args -> javaCompilationArgsBuilder.addDeps(args, RUNTIME_ONLY));
javaInfoBuilder.addProvider(
JavaCompilationArgsProvider.class, javaCompilationArgsBuilder.build());
javaInfoBuilder.addProvider(JavaExportsProvider.class, createJavaExportsProvider(exports));
javaInfoBuilder.addProvider(JavaPluginInfoProvider.class, createJavaPluginsProvider(exports));
javaInfoBuilder.addProvider(
JavaSourceJarsProvider.class,
createJavaSourceJarsProvider(sourceJars, concat(compileTimeDeps, runtimeDeps, exports)));
javaInfoBuilder.setRuntimeJars(ImmutableList.of(outputJar));
return javaInfoBuilder.build();
}
/**
* Creates action which creates archive with all source files inside. Takes all filer from
* sourceFiles collection and all files from every sourceJars. Name of Artifact generated based on
* outputJar.
*
* @param outputJar name of output Jar artifact.
* @return generated artifact, or null if there's nothing to pack
*/
@Nullable
Artifact packSourceFiles(
SkylarkActionFactory actions,
Artifact outputJar,
SkylarkList<Artifact> sourceFiles,
SkylarkList<Artifact> sourceJars,
Object javaToolchain,
Object hostJavabase,
Location location)
throws EvalException {
// No sources to pack, return None
if (sourceFiles.isEmpty() && sourceJars.isEmpty()) {
return null;
}
// If we only have one source jar, return it directly to avoid action creation
if (sourceFiles.isEmpty() && sourceJars.size() == 1) {
return sourceJars.get(0);
}
ActionRegistry actionRegistry = actions.asActionRegistry(location, actions);
Artifact outputSrcJar = getSourceJar(actions.getActionConstructionContext(), outputJar);
JavaRuntimeInfo javaRuntimeInfo = getJavaRuntimeProvider(location, hostJavabase, null);
JavaToolchainProvider javaToolchainProvider = getJavaToolchainProvider(location, javaToolchain);
JavaSemantics javaSemantics = javaToolchainProvider.getJavaSemantics();
SingleJarActionBuilder.createSourceJarAction(
actionRegistry,
actions.getActionConstructionContext(),
javaSemantics,
ImmutableList.copyOf(sourceFiles),
NestedSetBuilder.<Artifact>stableOrder().addAll(sourceJars).build(),
outputSrcJar,
javaToolchainProvider,
javaRuntimeInfo);
return outputSrcJar;
}
private JavaSourceJarsProvider createJavaSourceJarsProvider(
Iterable<Artifact> sourceJars, Iterable<JavaInfo> transitiveDeps) {
NestedSetBuilder<Artifact> transitiveSourceJars = NestedSetBuilder.stableOrder();
transitiveSourceJars.addAll(sourceJars);
fetchSourceJars(transitiveDeps).forEach(transitiveSourceJars::addTransitive);
return JavaSourceJarsProvider.create(transitiveSourceJars.build(), sourceJars);
}
private Stream<NestedSet<Artifact>> fetchSourceJars(Iterable<JavaInfo> javaInfos) {
// TODO(b/123265803): This step should be only necessary if transitive source jar doesn't
// include sourcejar at this level but they should.
Stream<NestedSet<Artifact>> sourceJars =
streamProviders(javaInfos, JavaSourceJarsProvider.class)
.map(JavaSourceJarsProvider::getSourceJars)
.map(sourceJarsList -> NestedSetBuilder.wrap(Order.STABLE_ORDER, sourceJarsList));
Stream<NestedSet<Artifact>> transitiveSourceJars =
streamProviders(javaInfos, JavaSourceJarsProvider.class)
.map(JavaSourceJarsProvider::getTransitiveSourceJars);
return concat(sourceJars, transitiveSourceJars);
}
private JavaExportsProvider createJavaExportsProvider(Iterable<JavaInfo> javaInfos) {
return JavaExportsProvider.merge(
JavaInfo.fetchProvidersFromList(javaInfos, JavaExportsProvider.class));
}
private JavaPluginInfoProvider createJavaPluginsProvider(Iterable<JavaInfo> javaInfos) {
return JavaPluginInfoProvider.merge(
JavaInfo.fetchProvidersFromList(javaInfos, JavaPluginInfoProvider.class));
}
@Deprecated
public JavaInfo create(
@Nullable Object actions,
NestedSet<Artifact> compileTimeJars,
NestedSet<Artifact> runtimeJars,
Boolean useIjar,
@Nullable Object javaToolchain,
NestedSet<Artifact> transitiveCompileTimeJars,
NestedSet<Artifact> transitiveRuntimeJars,
NestedSet<Artifact> sourceJars,
Location location)
throws EvalException {
JavaCompilationArgsProvider.Builder javaCompilationArgsBuilder =
JavaCompilationArgsProvider.builder();
if (useIjar && !compileTimeJars.isEmpty()) {
if (!(actions instanceof SkylarkActionFactory)) {
throw new EvalException(
location,
"The value of use_ijar is True. Make sure the ctx.actions argument is valid.");
}
if (!isValidJavaToolchain(javaToolchain)) {
throw new EvalException(
location,
"The value of use_ijar is True. Make sure the java_toolchain argument is valid.");
}
NestedSetBuilder<Artifact> builder = NestedSetBuilder.naiveLinkOrder();
for (Artifact compileJar : compileTimeJars) {
builder.add(
buildIjar(
(SkylarkActionFactory) actions,
compileJar,
null,
getJavaToolchainProvider(location, javaToolchain),
location));
}
javaCompilationArgsBuilder.addDirectCompileTimeJars(
/* interfaceJars = */ builder.build(), /* fullJars= */ compileTimeJars);
} else {
javaCompilationArgsBuilder.addDirectCompileTimeJars(
/* interfaceJars = */ compileTimeJars, /* fullJars= */ compileTimeJars);
}
javaCompilationArgsBuilder
.addTransitiveCompileTimeJars(transitiveCompileTimeJars)
.addRuntimeJars(runtimeJars)
.addRuntimeJars(transitiveRuntimeJars);
JavaInfo javaInfo =
JavaInfo.Builder.create()
.addProvider(JavaCompilationArgsProvider.class, javaCompilationArgsBuilder.build())
.addProvider(
JavaSourceJarsProvider.class,
JavaSourceJarsProvider.create(
NestedSetBuilder.emptySet(Order.STABLE_ORDER), sourceJars))
.setRuntimeJars(ImmutableList.copyOf(runtimeJars))
.build();
return javaInfo;
}
public JavaInfo createJavaCompileAction(
SkylarkRuleContext skylarkRuleContext,
SkylarkList<Artifact> sourceJars,
SkylarkList<Artifact> sourceFiles,
Artifact outputJar,
SkylarkList<String> javacOpts,
SkylarkList<JavaInfo> deps,
SkylarkList<JavaInfo> exports,
SkylarkList<JavaInfo> plugins,
SkylarkList<JavaInfo> exportedPlugins,
String strictDepsMode,
Object javaToolchain,
Object hostJavabase,
SkylarkList<Artifact> sourcepathEntries,
SkylarkList<Artifact> resources,
Boolean neverlink,
JavaSemantics javaSemantics,
Location location,
Environment environment)
throws EvalException {
if (sourceJars.isEmpty()
&& sourceFiles.isEmpty()
&& exports.isEmpty()
&& exportedPlugins.isEmpty()) {
throw new EvalException(
location,
"source_jars, sources, exports and exported_plugins cannot be simultaneously empty");
}
JavaRuntimeInfo javaRuntimeInfo =
getJavaRuntimeProvider(location, hostJavabase, skylarkRuleContext.getRuleContext());
if (javaRuntimeInfo == null) {
throw new EvalException(location, "'host_javabase' must point to a Java runtime");
}
JavaToolchainProvider toolchainProvider = getJavaToolchainProvider(location, javaToolchain);
JavaLibraryHelper helper =
new JavaLibraryHelper(skylarkRuleContext.getRuleContext())
.setOutput(outputJar)
.addSourceJars(sourceJars)
.addSourceFiles(sourceFiles)
.addResources(resources)
.setSourcePathEntries(sourcepathEntries)
.setJavacOpts(
ImmutableList.<String>builder()
.addAll(toolchainProvider.getJavacOptions())
.addAll(
javaSemantics.getCompatibleJavacOptions(
skylarkRuleContext.getRuleContext(), toolchainProvider))
.addAll(
JavaCommon.computePerPackageJavacOpts(
skylarkRuleContext.getRuleContext(), toolchainProvider))
.addAll(javacOpts)
.build());
streamProviders(deps, JavaCompilationArgsProvider.class).forEach(helper::addDep);
streamProviders(exports, JavaCompilationArgsProvider.class).forEach(helper::addExport);
helper.setCompilationStrictDepsMode(getStrictDepsMode(Ascii.toUpperCase(strictDepsMode)));
helper.setPlugins(createJavaPluginsProvider(concat(plugins, deps)));
helper.setNeverlink(neverlink);
JavaRuleOutputJarsProvider.Builder outputJarsBuilder = JavaRuleOutputJarsProvider.builder();
boolean createOutputSourceJar;
Artifact outputSourceJar;
if (environment.getSemantics().incompatibleGenerateJavaCommonSourceJar()) {
outputSourceJar = getSourceJar(skylarkRuleContext.getRuleContext(), outputJar);
createOutputSourceJar = true;
} else {
createOutputSourceJar =
(sourceJars.size() > 1 || !sourceFiles.isEmpty())
|| (sourceJars.isEmpty()
&& sourceFiles.isEmpty()
&& (!exports.isEmpty() || !exportedPlugins.isEmpty()));
outputSourceJar =
createOutputSourceJar
? getSourceJar(skylarkRuleContext.getRuleContext(), outputJar)
: sourceJars.get(0);
}
JavaInfo.Builder javaInfoBuilder = JavaInfo.Builder.create();
JavaCompilationArtifacts artifacts =
helper.build(
javaSemantics,
toolchainProvider,
javaRuntimeInfo,
SkylarkList.createImmutable(ImmutableList.of()),
outputJarsBuilder,
/*createOutputSourceJar=*/ createOutputSourceJar,
outputSourceJar,
javaInfoBuilder,
// Include JavaGenJarsProviders from both deps and exports in the JavaGenJarsProvider
// added to javaInfoBuilder for this target.
NestedSetBuilder.wrap(
Order.STABLE_ORDER,
JavaInfo.fetchProvidersFromList(concat(deps, exports), JavaGenJarsProvider.class)));
JavaCompilationArgsProvider javaCompilationArgsProvider =
helper.buildCompilationArgsProvider(artifacts, true, neverlink);
Runfiles runfiles =
new Runfiles.Builder(skylarkRuleContext.getWorkspaceName())
.addTransitiveArtifactsWrappedInStableOrder(
javaCompilationArgsProvider.getRuntimeJars())
.build();
ImmutableList<Artifact> outputSourceJars = ImmutableList.of(outputSourceJar);
// When sources are not provided, the subsequent output Jar will be empty. As such, the output
// Jar is omitted from the set of Runtime Jars.
if (!sourceJars.isEmpty() || !sourceFiles.isEmpty()) {
javaInfoBuilder.setRuntimeJars(ImmutableList.of(outputJar));
}
return javaInfoBuilder
.addProvider(JavaCompilationArgsProvider.class, javaCompilationArgsProvider)
.addProvider(
JavaSourceJarsProvider.class,
createJavaSourceJarsProvider(outputSourceJars, concat(deps, exports)))
.addProvider(JavaRuleOutputJarsProvider.class, outputJarsBuilder.build())
.addProvider(JavaRunfilesProvider.class, new JavaRunfilesProvider(runfiles))
.addProvider(
JavaPluginInfoProvider.class,
createJavaPluginsProvider(concat(exportedPlugins, exports)))
.setNeverlink(neverlink)
.build();
}
public Artifact buildIjar(
SkylarkActionFactory actions,
Artifact inputJar,
@Nullable Label targetLabel,
Object javaToolchain,
Location location)
throws EvalException {
String ijarBasename = FileSystemUtils.removeExtension(inputJar.getFilename()) + "-ijar.jar";
Artifact interfaceJar = actions.declareFile(ijarBasename, inputJar);
FilesToRunProvider ijarTarget = getJavaToolchainProvider(location, javaToolchain).getIjar();
CustomCommandLine.Builder commandLine =
CustomCommandLine.builder().addExecPath(inputJar).addExecPath(interfaceJar);
if (targetLabel != null) {
commandLine.addLabel("--target_label", targetLabel);
}
SpawnAction.Builder actionBuilder =
new SpawnAction.Builder()
.addInput(inputJar)
.addOutput(interfaceJar)
.setExecutable(ijarTarget)
.setProgressMessage("Extracting interface for jar %s", inputJar.getFilename())
.addCommandLine(commandLine.build())
.useDefaultShellEnvironment()
.setMnemonic("JavaIjar");
actions.registerAction(location, actionBuilder.build(actions.getActionConstructionContext()));
return interfaceJar;
}
public Artifact stampJar(
SkylarkActionFactory actions,
Artifact inputJar,
Label targetLabel,
Object javaToolchain,
Location location)
throws EvalException {
String basename = FileSystemUtils.removeExtension(inputJar.getFilename()) + "-stamped.jar";
Artifact outputJar = actions.declareFile(basename, inputJar);
// ijar doubles as a stamping tool
FilesToRunProvider ijarTarget = getJavaToolchainProvider(location, javaToolchain).getIjar();
CustomCommandLine.Builder commandLine =
CustomCommandLine.builder()
.addExecPath(inputJar)
.addExecPath(outputJar)
.add("--nostrip_jar")
.addLabel("--target_label", targetLabel);
SpawnAction.Builder actionBuilder =
new SpawnAction.Builder()
.addInput(inputJar)
.addOutput(outputJar)
.setExecutable(ijarTarget)
.setProgressMessage("Stamping target label into jar %s", inputJar.getFilename())
.addCommandLine(commandLine.build())
.useDefaultShellEnvironment()
.setMnemonic("JavaIjar");
actions.registerAction(location, actionBuilder.build(actions.getActionConstructionContext()));
return outputJar;
}
private static boolean isValidJavaToolchain(Object javaToolchain) {
return javaToolchain instanceof ConfiguredTarget
|| javaToolchain instanceof JavaToolchainProvider;
}
JavaToolchainProvider getJavaToolchainProvider(Location location, Object javaToolchain)
throws EvalException {
if (javaToolchain instanceof ConfiguredTarget) {
// TODO(b/122738702): remove support for passing toolchains as configured targets
ConfiguredTarget target = (ConfiguredTarget) javaToolchain;
JavaToolchainProvider javaToolchainProvider = JavaToolchainProvider.from(target);
if (javaToolchainProvider == null) {
throw new EvalException(
location, target.getLabel() + " does not provide JavaToolchainProvider.");
}
return javaToolchainProvider;
}
if (javaToolchain instanceof JavaToolchainProvider) {
return (JavaToolchainProvider) javaToolchain;
}
throw new EvalException(null, javaToolchain + " is not a JavaToolchainProvider.");
}
private static boolean isValidJavaRuntime(Object javaRuntime) {
return javaRuntime instanceof ConfiguredTarget || javaRuntime instanceof JavaRuntimeInfo;
}
private JavaRuntimeInfo getJavaRuntimeProvider(
Location location, Object javabase, RuleContext ruleContext) throws EvalException {
if (javabase instanceof TransitiveInfoCollection) {
// TODO(b/122738702): remove support for passing toolchains as configured targets
return JavaRuntimeInfo.from((TransitiveInfoCollection) javabase, ruleContext);
}
if (javabase instanceof JavaRuntimeInfo) {
return (JavaRuntimeInfo) javabase;
}
throw new EvalException(location, javabase + " is not a JavaRuntimeInfo.");
}
private static StrictDepsMode getStrictDepsMode(String strictDepsMode) {
switch (strictDepsMode) {
case "OFF":
return StrictDepsMode.OFF;
case "ERROR":
case "DEFAULT":
return StrictDepsMode.ERROR;
case "WARN":
return StrictDepsMode.WARN;
default:
throw new IllegalArgumentException(
"StrictDepsMode "
+ strictDepsMode
+ " not allowed."
+ " Only OFF and ERROR values are accepted.");
}
}
private static Artifact getSourceJar(ActionConstructionContext context, Artifact outputJar) {
return JavaCompilationHelper.derivedArtifact(context, outputJar, "", "-src.jar");
}
}
| [
"copybara-piper@google.com"
] | copybara-piper@google.com |
825ce8da648ec45f4440928af62828c6c5964f0d | 991bc8c098cea6595b5a7017e4d9f2e66e5c44fc | /generator-core-skeletons/src/main/java/org/sklsft/generator/skeletons/core/commands/junit/configuration/TestsPropertiesFileWriteCommand.java | 93958a637cd1b81e32b53f31373ed7781a8a4c2e | [
"Apache-2.0"
] | permissive | skeleton-software-community/skeleton-generator | 4feed5092708e4940524dfe6faff7ed684456b8e | 0d0ff06fcd655deb515a2691dbfc4af80e8a8a88 | refs/heads/master | 2023-08-26T22:03:30.813979 | 2023-07-24T07:43:32 | 2023-07-24T07:43:32 | 13,094,270 | 13 | 4 | Apache-2.0 | 2023-06-20T21:10:17 | 2013-09-25T13:21:06 | Java | UTF-8 | Java | false | false | 640 | java | package org.sklsft.generator.skeletons.core.commands.junit.configuration;
import java.io.File;
import org.sklsft.generator.model.domain.Project;
import org.sklsft.generator.model.metadata.files.FileType;
import org.sklsft.generator.skeletons.commands.impl.templatized.ProjectTemplatizedFileWriteCommand;
public class TestsPropertiesFileWriteCommand extends ProjectTemplatizedFileWriteCommand {
public TestsPropertiesFileWriteCommand(Project project) {
super(project.workspaceFolder + File.separator + project.model.testsArtefactName + File.separator + project.model.resourcesFolder, "application", FileType.PROPERTIES, project);
}
} | [
"nicolas.thibault@sklsft.org"
] | nicolas.thibault@sklsft.org |
bb897d27b56abb830bd5a3a25be03e5e9f955d94 | 63fc1f342e71a57d391663ee0ad0b7ff09bf424d | /app/src/androidTest/java/com/oshrat/numberninja/ExampleInstrumentedTest.java | a6f6f82e64ba5d9da26e524b11cfdae62aafde33 | [] | no_license | Oshratt/AndroidProject | 7d80c8858680b39dd8d8fa36c13a5c59853084b8 | c89030e4ab7dd79e47a8257992983bcc53f437b0 | refs/heads/main | 2023-03-05T21:23:14.226827 | 2021-02-14T14:42:55 | 2021-02-14T14:42:55 | 336,755,881 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 757 | java | package com.oshrat.numberninja;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.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 oshratInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.oshrat.numberninja", appContext.getPackageName());
}
} | [
"oshit92@gmail.com"
] | oshit92@gmail.com |
413fe253259781207cc69c62c64f5fcabecbde70 | 88109f3401620bffa8a6b43746d90f08a16e592b | /src/main/scala/java/StdOut.java | 14eb9bbe216d695680406c24e51aad88cd4a43e2 | [] | no_license | aashmishra/algorithm | 6e6c6c95068a659cfbc9b4c8fbbce41cedf9cfe6 | 5eb7daa0c6e9c088b65f70e6c672d133c4353ce4 | refs/heads/main | 2023-07-17T06:31:22.098764 | 2021-08-14T19:38:43 | 2021-08-14T19:38:43 | 324,188,636 | 0 | 0 | null | 2021-08-14T19:38:44 | 2020-12-24T15:46:52 | Java | UTF-8 | Java | false | false | 8,594 | java | /******************************************************************************
* Compilation: javac StdOut.java
* Execution: java StdOut
* Dependencies: none
*
* Writes data of various types to standard output.
*
******************************************************************************/
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.Locale;
/**
* This class provides methods for printing strings and numbers to standard output.
* <p>
* <b>Getting started.</b>
* To use this class, you must have {@code StdOut.class} in your
* Java classpath. If you used our autoinstaller, you should be all set.
* Otherwise, either download
* <a href = "https://introcs.cs.princeton.edu/java/code/stdlib.jar">stdlib.jar</a>
* and add to your Java classpath or download
* <a href = "https://introcs.cs.princeton.edu/java/stdlib/StdOut.java">StdOut.java</a>
* and put a copy in your working directory.
* <p>
* Here is an example program that uses {@code StdOut}:
* <pre>
* public class TestStdOut {
* public static void main(String[] args) {
* int a = 17;
* int b = 23;
* int sum = a + b;
* StdOut.println("Hello, World");
* StdOut.printf("%d + %d = %d\n", a, b, sum);
* }
* }
* </pre>
* <p>
* <b>Differences with System.out.</b>
* The behavior of {@code StdOut} is similar to that of {@link System#out},
* but there are a few technical differences:
* <ul>
* <li> {@code StdOut} coerces the character-set encoding to UTF-8,
* which is a standard character encoding for Unicode.
* <li> {@code StdOut} coerces the locale to {@link Locale#US},
* for consistency with {@link StdIn}, {@link Double#parseDouble(String)},
* and floating-point literals.
* <li> {@code StdOut} <em>flushes</em> standard output after each call to
* {@code print()} so that text will appear immediately in the terminal.
* </ul>
* <p>
* <b>Reference.</b>
* For additional documentation,
* see <a href="https://introcs.cs.princeton.edu/15inout">Section 1.5</a> of
* <em>Computer Science: An Interdisciplinary Approach</em>
* by Robert Sedgewick and Kevin Wayne.
*
* @author Robert Sedgewick
* @author Kevin Wayne
*/
public final class StdOut {
// force Unicode UTF-8 encoding; otherwise it's system dependent
private static final String CHARSET_NAME = "UTF-8";
// assume language = English, country = US for consistency with StdIn
private static final Locale LOCALE = Locale.US;
// send output here
private static PrintWriter out;
// this is called before invoking any methods
static {
try {
out = new PrintWriter(new OutputStreamWriter(System.out, CHARSET_NAME), true);
}
catch (UnsupportedEncodingException e) {
System.out.println(e);
}
}
// don't instantiate
private StdOut() { }
/**
* Terminates the current line by printing the line-separator string.
*/
public static void println() {
out.println();
}
/**
* Prints an object to this output stream and then terminates the line.
*
* @param x the object to print
*/
public static void println(Object x) {
out.println(x);
}
/**
* Prints a boolean to standard output and then terminates the line.
*
* @param x the boolean to print
*/
public static void println(boolean x) {
out.println(x);
}
/**
* Prints a character to standard output and then terminates the line.
*
* @param x the character to print
*/
public static void println(char x) {
out.println(x);
}
/**
* Prints a double to standard output and then terminates the line.
*
* @param x the double to print
*/
public static void println(double x) {
out.println(x);
}
/**
* Prints an integer to standard output and then terminates the line.
*
* @param x the integer to print
*/
public static void println(float x) {
out.println(x);
}
/**
* Prints an integer to standard output and then terminates the line.
*
* @param x the integer to print
*/
public static void println(int x) {
out.println(x);
}
/**
* Prints a long to standard output and then terminates the line.
*
* @param x the long to print
*/
public static void println(long x) {
out.println(x);
}
/**
* Prints a short integer to standard output and then terminates the line.
*
* @param x the short to print
*/
public static void println(short x) {
out.println(x);
}
/**
* Prints a byte to standard output and then terminates the line.
* <p>
* To write binary data, see {@link BinaryStdOut}.
*
* @param x the byte to print
*/
public static void println(byte x) {
out.println(x);
}
/**
* Flushes standard output.
*/
public static void print() {
out.flush();
}
/**
* Prints an object to standard output and flushes standard output.
*
* @param x the object to print
*/
public static void print(Object x) {
out.print(x);
out.flush();
}
/**
* Prints a boolean to standard output and flushes standard output.
*
* @param x the boolean to print
*/
public static void print(boolean x) {
out.print(x);
out.flush();
}
/**
* Prints a character to standard output and flushes standard output.
*
* @param x the character to print
*/
public static void print(char x) {
out.print(x);
out.flush();
}
/**
* Prints a double to standard output and flushes standard output.
*
* @param x the double to print
*/
public static void print(double x) {
out.print(x);
out.flush();
}
/**
* Prints a float to standard output and flushes standard output.
*
* @param x the float to print
*/
public static void print(float x) {
out.print(x);
out.flush();
}
/**
* Prints an integer to standard output and flushes standard output.
*
* @param x the integer to print
*/
public static void print(int x) {
out.print(x);
out.flush();
}
/**
* Prints a long integer to standard output and flushes standard output.
*
* @param x the long integer to print
*/
public static void print(long x) {
out.print(x);
out.flush();
}
/**
* Prints a short integer to standard output and flushes standard output.
*
* @param x the short integer to print
*/
public static void print(short x) {
out.print(x);
out.flush();
}
/**
* Prints a byte to standard output and flushes standard output.
*
* @param x the byte to print
*/
public static void print(byte x) {
out.print(x);
out.flush();
}
/**
* Prints a formatted string to standard output, using the specified format
* string and arguments, and then flushes standard output.
*
*
* @param format the <a href = "http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">format string</a>
* @param args the arguments accompanying the format string
*/
public static void printf(String format, Object... args) {
out.printf(LOCALE, format, args);
out.flush();
}
/**
* Prints a formatted string to standard output, using the locale and
* the specified format string and arguments; then flushes standard output.
*
* @param locale the locale
* @param format the <a href = "http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax">format string</a>
* @param args the arguments accompanying the format string
*/
public static void printf(Locale locale, String format, Object... args) {
out.printf(locale, format, args);
out.flush();
}
/**
* Unit tests some of the methods in {@code StdOut}.
*
* @param args the command-line arguments
*/
public static void main(String[] args) {
// write to stdout
StdOut.println("Test");
StdOut.println(17);
StdOut.println(true);
StdOut.printf("%.6f\n", 1.0/7.0);
}
}
| [
"ashish.mishra@dunnhumby.com"
] | ashish.mishra@dunnhumby.com |
714037ba33513d7f6464e8c092ccd393e0747569 | d40a9b3adda05d5529773a49cacc0ea17472e1e9 | /framework-system-mybatis/src/main/java/com/centit/framework/system/po/MsgAnnex.java | 59fc0ae2a60eec0a521b46e559e98044eabc8415 | [] | no_license | tbs005/centit-framework | c844a82f21ea5db090fb4feaabb75ac13aaa299d | dd1ea2a5f74cb1d4e81078628ce9eeb3f9e0bf70 | refs/heads/master | 2021-06-22T13:06:37.770149 | 2017-07-28T01:32:12 | 2017-07-28T01:32:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,474 | java | package com.centit.framework.system.po;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import com.alibaba.fastjson.annotation.JSONField;
@Entity
@Table(name="M_MSGANNEX")
public class MsgAnnex implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
@ManyToOne
@JSONField(serialize=false)
@JoinColumn(name = "MsgCode", insertable = false, updatable = false)
private InnerMsg mInnerMsg;//
@Column(name = "INFOCODE")
@Size( max=16,message = "字段长度必须小于{max}")
private String infoCode;//消息代码
@Id
@Column(name="MSGANNEXID")
@GeneratedValue(generator = "assignedGenerator")
//@GenericGenerator(name = "assignedGenerator", strategy = "assigned")
private String msgAnnexId;//附件主键
public String getMsgAnnexId() {
return msgAnnexId;
}
public InnerMsg getmInnerMsg() {
return mInnerMsg;
}
public void setmInnerMsg(InnerMsg mInnerMsg) {
this.mInnerMsg = mInnerMsg;
}
public String getInfoCode() {
return infoCode;
}
public void setInfoCode(String infoCode) {
this.infoCode = infoCode;
}
}
| [
"codefan@centit.com"
] | codefan@centit.com |
b59a232ef83ef1a49e78ae0a685aa808e11b9b06 | a8eb32a9c9b2783f6a8b5187dc5d848659611e2b | /test/apps/FakeApp.java | 907defd987489ccea65637f6d9402280c134481b | [] | no_license | terms0273/Earth-209-yamamoto | 1e37a984e472c4993bc1efc21253225a6ef099f1 | 4d3286775f112d4069e5289814048b9b80156b8f | refs/heads/master | 2020-12-30T14:44:51.016702 | 2017-05-31T04:10:09 | 2017-05-31T04:10:09 | 91,081,507 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,588 | java | package apps;
import com.avaje.ebean.Ebean;
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import org.apache.commons.io.FileUtils;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import play.test.FakeApplication;
import java.io.IOException;
/**
*
* @author a-yamamoto
*/
import static play.test.Helpers.*;
public class FakeApp {
public static FakeApplication app;
public static String createDdl = "";
public static String dropDdl = "";
@BeforeClass
public static void startApp() throws IOException {
app = fakeApplication(inMemoryDatabase());
start(app);
String evolutionContent = FileUtils.readFileToString(app.getWrappedApplication().getFile("conf/evolutions/default/1.sql"));
String[] splitEvolutionContent = evolutionContent.split("# --- !Ups");
String[] upsDowns = splitEvolutionContent[1].split("# --- !Downs");
createDdl = upsDowns[0];
dropDdl = upsDowns[1];
}
@Before
public void createCleanDb() {
initDb();
}
@Before
public void initDb() {
Ebean.execute(Ebean.createCallableSql(dropDdl));
Ebean.execute(Ebean.createCallableSql(createDdl));
//Ehcacheキャッシュのクリア
CacheManager manager = CacheManager.create();
Cache cache = manager.getCache("play");
cache.removeAll();
}
public static void restartApp() {
start(app);
}
@AfterClass
public static void stopApp() {
stop(app);
}
}
| [
"a-yamamoto@ttc-net.co.jp"
] | a-yamamoto@ttc-net.co.jp |
85c8ad9ef688f23bf4bd55bbf8b8a22ae628a8fe | 231a828518021345de448c47c31f3b4c11333d0e | /src/pdf/bouncycastle/asn1/x9/X9ECParametersHolder.java | 321ea8d916f05a36a33992952ce3e4e41afd083c | [] | no_license | Dynamit88/PDFBox-Java | f39b96b25f85271efbb3a9135cf6a15591dec678 | 480a576bc97fc52299e1e869bb80a1aeade67502 | refs/heads/master | 2020-05-24T14:58:29.287880 | 2019-05-18T04:25:21 | 2019-05-18T04:25:21 | 187,312,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 441 | java | package pdf.bouncycastle.asn1.x9;
/**
* A holding class that allows for X9ECParameters to be lazily constructed.
*/
public abstract class X9ECParametersHolder
{
private X9ECParameters params;
public synchronized X9ECParameters getParameters()
{
if (params == null)
{
params = createParameters();
}
return params;
}
protected abstract X9ECParameters createParameters();
}
| [
"vtuse@mail.ru"
] | vtuse@mail.ru |
4ec54e7035c2657963a849bfca62aecd4390cc93 | 0bd14ee11a071cbebc1d22c30ed016534577044a | /src/main/java/geeksforgeeks/StepsProblem.java | 20c65979b4eedc8e0b5e3911770a8625051d7cce | [] | no_license | dhirajnie/praticeProblems | 25ae373d25409bb1d10a52fa6f177d3278ee48a4 | c47d4c77c7f4536fb0572cb0c3fe55a87235c72e | refs/heads/master | 2023-04-27T10:44:33.964104 | 2019-08-02T06:42:11 | 2019-08-02T06:42:11 | 166,617,808 | 0 | 0 | null | 2023-04-14T17:09:09 | 2019-01-20T03:08:44 | Java | UTF-8 | Java | false | false | 1,124 | java | package geeksforgeeks;
import java.util.*;
public class StepsProblem
{
static int ways[] = new int[1000000];
static int counter = 0;
static void recur( int n, List<Integer> steps, int m )
{
if ( ways[n] != 0 ) {
System.out.println( "From table" );
ways[m] = ways[n] + counter;
return;
}
if ( n < 0 )
return;
if ( n == 0 ) {
++counter;
ways[m] = steps.size();
return;
} else {
steps.add( 1 );
recur( n - 1, steps, m );
steps.remove( steps.size() - 1 );
if ( steps.size() > 0 && steps.get( steps.size() - 1 ) < 2 ) {
return;
}
steps.add( 2 );
recur( n - 2, steps, m );
steps.remove( steps.size() - 1 );
}
}
public static void main( String args[] )
{
int n = 10;
if ( ways[n] != 0 ) {
}
recur( n, new ArrayList<>(), n );
System.out.println( "Counter" + counter );
ways[n] = counter;
}
}
| [
"dhiraj@infrrd.ai"
] | dhiraj@infrrd.ai |
98ac0a0b3561949785a7ebf9da1c9236ddfbad8e | 5348cba12385ecad01d1fa698f98268a4b1ae2c0 | /Printer/src/DotMatrixPrinter.java | 5deffe1cd4a561718565d2901a424e3937f6204f | [] | no_license | denghaonan1/Chapter-homework | 91c9158f55ec3b34229911cc9cd9a0979d753532 | 937f0936b65708b7d961d32e63e1d3d332ef9cd3 | refs/heads/master | 2020-07-08T04:33:10.218872 | 2019-08-29T09:58:00 | 2019-08-29T09:58:00 | 203,565,298 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 228 | java | public class DotMatrixPrinter extends Printer {
public void print() {
System.out.println("针式打印机正在打印");
}
public void print2() {
System.out.println("打印机正在打印");
}
}
| [
"3241347354@qq.com"
] | 3241347354@qq.com |
5698cf54fc7782cba2cf319b2d3a88860225c924 | be1c726f422f119da9525d6b3393e54d6f4f58b1 | /app/src/main/java/com/ryatec/syspalma/ApontamentoFitoAtividade.java | 298f402ee3a4fecf95e9b69e707e58cc560ac97a | [] | no_license | cleicastro/SysPalma | f35e8230765a0fedcd34cb4299d168d92ea0c63f | 4be3febfbabbf53540f8e15d67d63c828f431876 | refs/heads/master | 2020-08-28T03:56:59.024028 | 2019-10-25T17:14:33 | 2019-10-25T17:14:33 | 217,580,170 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,546 | java | package com.ryatec.syspalma;
import android.app.AlertDialog;
import android.content.DialogInterface;
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.ArrayAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.Spinner;
import com.github.aakira.expandablelayout.ExpandableRelativeLayout;
import java.util.List;
/**
* A simple {@link Fragment} subclass.
*/
public class ApontamentoFitoAtividade extends Fragment {
private Button btnApontamento;
private Button btnColheita;
private Button btnPatrimonio;
private ExpandableRelativeLayout mExpandApontamento;
private ExpandableRelativeLayout mExpandColheita;
private ExpandableRelativeLayout mExpandPatrimonio;
private Spinner parcela;
private Spinner patrimonio;
private Spinner implemento;
private Spinner atividade;
private Spinner caixa;
static LinearLayout linearApoio;
private Button salvarApontamento;
private GetSetCache getSetCache = new GetSetCache();
public ApontamentoFitoAtividade() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_expandlelayout_fito, container, false);
btnApontamento = (Button) view.findViewById(R.id.btnApontamento);
btnColheita = (Button) view.findViewById(R.id.btnColheita);
btnPatrimonio = (Button) view.findViewById(R.id.btnPatrimonio);
mExpandApontamento = (ExpandableRelativeLayout) view.findViewById(R.id.mExpandApontamento);
mExpandColheita = (ExpandableRelativeLayout) view.findViewById(R.id.mExpandColheita);
mExpandPatrimonio = (ExpandableRelativeLayout) view.findViewById(R.id.mExpandPatrimonio);
parcela = (Spinner) view.findViewById(R.id.placa);
implemento = (Spinner) view.findViewById(R.id.spinner_implemento);
patrimonio = (Spinner) view.findViewById(R.id.spinner_patrimonio);
atividade = (Spinner) view.findViewById(R.id.motorista);
caixa = (Spinner) view.findViewById(R.id.spinnerCaixa);
salvarApontamento = (Button) view.findViewById(R.id.salvar);
btnApontamento.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mExpandApontamento.toggle();
}
});
btnColheita.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mExpandColheita.toggle();
}
});
btnPatrimonio.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mExpandPatrimonio.toggle();
}
});
//Quando selecionar a atividade retorna o a área da parcela realizada
salvarApontamento = (Button) view.findViewById(R.id.salvar);
Button cancelar = (Button) view.findViewById(R.id.cancelar);
cancelar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getActivity().finish();
}
});
return view;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
carregar_valores();
}
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
public void carregar_valores(){
Database_syspalma db = new Database_syspalma(getContext());
List<String> parcelas = db.SelectParcela(GetSetCache.getFazendaGet());
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(getContext(),android.R.layout.simple_spinner_item, parcelas);
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
parcela.setAdapter(dataAdapter);
List<String> patrimonios = db.SelectPatrimonio("'TRATOR'");
ArrayAdapter<String> dataAdapter2 = new ArrayAdapter<String>(getContext(),android.R.layout.simple_spinner_item, patrimonios);
dataAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
patrimonio.setAdapter(dataAdapter2);
List<String> implementos = db.SelectPatrimonio("'IMPLEMENTO'");
ArrayAdapter<String> dataAdapter3 = new ArrayAdapter<String>(getContext(),android.R.layout.simple_spinner_item, implementos);
dataAdapter3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
implemento.setAdapter(dataAdapter3);
List<String> atividades = db.SelectAtividade(getSetCache.getOperacao());
ArrayAdapter<String> dataAdapter4 = new ArrayAdapter<String>(getContext(),android.R.layout.simple_spinner_item, atividades);
dataAdapter3.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
atividade.setAdapter(dataAdapter4);
}
private void exemplo_alerta(String titulo, String msg) {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());//Cria o gerador do AlertDialog
builder.setTitle(titulo);//define o titulo
builder.setMessage(msg);//define a mensagem
//define um botão como positivo
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
getActivity().finish();
}
});
AlertDialog alerta = builder.create();//cria o AlertDialog
alerta.show();//Exibe
}
private void alerta(String titulo, String msg) {
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());//Cria o gerador do AlertDialog
builder.setTitle(titulo);//define o titulo
builder.setMessage(msg);//define a mensagem
//define um botão como positivo
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
}
});
AlertDialog alerta = builder.create();//cria o AlertDialog
alerta.show();//Exibe
}
}
| [
"cleicastro.ti@hotmail.com"
] | cleicastro.ti@hotmail.com |
d982396e6d90152dccf1985106baff2098ce1b45 | d57b5fe6272629a9957419873413a4b76e644877 | /spring-context/src/test/java/kevin/aop/service/UserDao.java | 3f62ae2bc9b5eede220562bd0b34551574be45cb | [
"Apache-2.0"
] | permissive | kevin-wanjun/kevin-spring | 7cfe0d4d0e3810f026da3849ca5f5fe0d6dff3a3 | 49477ced70b66573fd2aab0fdf1524cf8d508e90 | refs/heads/master | 2020-03-21T15:32:17.895663 | 2018-12-29T10:29:09 | 2018-12-29T10:29:09 | 138,718,148 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package kevin.aop.service;
/*******************************************************************************
* @author wj
* @date 2018-12-20
* @description 模拟 userDao
******************************************************************************/
public interface UserDao {
/**
* 增加用户操作
*/
void add();
/**
* 删除用户操作
*/
void delete();
}
| [
"18672995336@163.com"
] | 18672995336@163.com |
b3cf93bdc0fa4dcd6a73e6fef61c284784d47269 | cd1bc6f5b28442bdd0ff7d4a9bfd2064e1c5a4ee | /src/main/java/org/tton/hrm/dao/OvertimeProjectDao.java | 12f9dc01d8a70284efaa3d1e3aa26c31de59587c | [] | no_license | hanyouchuan/hrmPro | d6a9944164b8b74062559cb6838bc2a96e63e838 | dee494ac8e9e53b781b3a8e447f6123e71c8cd32 | refs/heads/master | 2021-04-15T13:41:51.961762 | 2018-03-24T02:03:13 | 2018-03-24T02:03:13 | 126,557,093 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,764 | java | package org.tton.hrm.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.mapping.FetchType;
import org.tton.hrm.dao.provider.OvertimeProjectSqlProvider;
import org.tton.hrm.domain.OvertimeProject;
import org.tton.hrm.util.common.HrmConstants;
/**
* ClassName: OvertimeProjectDao <br/>
* Description: TODO <br/>
* Date: 2018年1月24日 上午10:44:31 <br/>
* <br/>
*
* @author hanyouchuan(邮箱)
*
* 修改记录
* @version 产品版本信息 yyyy-mm-dd 姓名(邮箱) 修改信息<br/>
*
*/
public interface OvertimeProjectDao {
@SelectProvider(type = OvertimeProjectSqlProvider.class, method = "selectWhitParam")
@Results({
@Result(id = true, column = "id", property = "id"),
@Result(column = "title", property = "title"),
@Result(column = "remark", property = "remark"),
@Result(column = "CREATE_DATE", property = "createDate", javaType = java.util.Date.class),
@Result(column = "user_id", property = "user", one = @One(select = "org.tton.hrm.dao.UserDao.selectById", fetchType = FetchType.EAGER)) })
List<OvertimeProject> selectByPage(Map<String, Object> params);
@SelectProvider(type = OvertimeProjectSqlProvider.class, method = "count")
Integer count(Map<String, Object> params);
// @Select("select * from " + HrmConstants.OVERTIMEPROJECTTABLE +
// " order by id desc")
// List<OvertimeProject> selectAllOverTimeProject();
@Select("select * from " + HrmConstants.OVERTIMEPROJECTTABLE + " where ID=#{id} order by id desc ")
@Results({
@Result(id = true, column = "id", property = "id"),
@Result(column = "title", property = "title"),
@Result(column = "remark", property = "remark"),
@Result(column = "CREATE_DATE", property = "createDate", javaType = java.util.Date.class),
@Result(column = "user_id", property = "user", one = @One(select = "org.tton.hrm.dao.UserDao.selectById", fetchType = FetchType.EAGER)) })
OvertimeProject selectById(int id);
@Delete(" delete from " + HrmConstants.OVERTIMEPROJECTTABLE + " where id=#{id} ")
void deleteById(Integer id);
@SelectProvider(type = OvertimeProjectSqlProvider.class, method = "insertOvertimeProject")
void save(OvertimeProject overtimeProject);
@SelectProvider(type = OvertimeProjectSqlProvider.class, method = "updateOvertimeProject")
void update(OvertimeProject overtimeProject);
}
| [
"hanyouchuan@163.com"
] | hanyouchuan@163.com |
7dc1ce0b04ce062f98adcb2abd4307e8f7813491 | 6c15ac743b447c5ff4f9936207278c8e87f6c3b5 | /Exercise/src/blackjack1/Deck.java | feb63eb8c322a4df4dbe5f649f717f304165b23b | [] | no_license | aditidatta/jee-exercise | 8a0278c3ba6d7a2ec379c9d98ff0d3f8128f428d | c90ca762fdcc29a9d1ae70de6d328558f7cebd18 | refs/heads/master | 2021-01-10T14:47:35.153552 | 2016-02-25T06:18:35 | 2016-02-25T06:19:51 | 52,496,629 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,765 | java | package blackjack1;
import java.util.Random;
class Deck {
//Staff s[] = new Staff[2];
private Card pile1[] = new Card[52];
private Card pile2[] = new Card[52]; // 2nd pile of cards that used cards go into
private int size;
private int top = -1; // array starts at -1, makes it null, top represents the position of the last card in pile 2
public Deck(){
int i = 0;
size = 52;
//for (int s = 0; s < 4; s++) old way to do it
for (Suit s: Suit.values()) { // saves you writing a line
for (Rank r: Rank.values()){
//for (int r = 0; r < 13; r++) {
pile1[i] = new Card (r, s); // makes the cards
i++;
}
}
}
void putIntoPile2(Card card){ // data type, object
top++; // stars the array because it moves it from -1 to 0
pile2[top] = card;
}
void mergePiles() { // shuffles two piles back together
for(int i = 0; i <= top; i++ ) {
pile1[size++] = pile2[i];
}
top = -1;
/*while(top > -1) { another way to do it
pile1[size++] = pile2[top--];
}*/
}
public Card getCard(int position){ // sends a card to the draw main method
return pile1[position];
}
public Card draw(int position){ // there has to be a parameter here so you can call it later
Card temp = pile1[position];
for(int i = position; i < 52-1-(top+1); i++){ // has to be 52 - 1 or else it will be array index out of bounds
pile1[i] = pile1[i+1]; // - top to reduce unneccesary loops, top+1 because the array position is one less than the element number
pile1[i+1] = null; // shrinks deck
}
size--;
return temp; // shows card you just drew
}
public Card deal(){
size--; // reduces size of deck
return pile1[size]; // returns array of pile1 with the position of size, which is now one smaller
}
public int getSize(){
return size;
}
// String suit[] = new String[]{"Spades", "Clubs", "Diamonds", "Hearts"};
// Suit suit[] = Suit.values(); could have saved it to array
//String rank[] = new String[]{"Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"};
public void shuffle(){
Random rand = new Random();
for (int i = 0; i < 52; i++) {
int randomPosition = rand.nextInt(52);
Card temp = pile1[i];
pile1[i] = pile1[randomPosition];
pile1[randomPosition] = temp;
}
}
}// shuffle method
// java random method from 0-51. assign number to each card object
// if the number has already been assigned, re loop it
// assign output to a variable
// if card[a] != null (if the position is taken already)
/*
c[0] = new card ( "Ace", "Spades");
c[1] = new card ( "2", "Spades");
c[2] = new card ( "3", "Spades");
c[3] = new card ( "4", "Spades");
c[4] = new card ( "5", "Spades");
c[5] = new card ( "6", "Spades");
c[6] = new card ( "7", "Spades");
c[7] = new card ( "8", "Spades");
c[8] = new card ( "9", "Spades");
c[9] = new card ( "10", "Spades");
c[10] = new card ( "Jack", "Spades");
c[11] = new card ( "Queen", "Spades");
c[12] = new card ( "King", "Spades");
c[13] = new card ( "Ace", "Hearts");
c[14] = new card ( "2", "Hearts");
c[15] = new card ( "3", "Hearts");
c[16] = new card ( "4", "Hearts");
c[17] = new card ( "5", "Hearts");
c[18] = new card ( "6", "Hearts");
c[19] = new card ( "7", "Hearts");
c[20] = new card ( "8", "Hearts");
c[21] = new card ( "9", "Hearts");
c[22] = new card ( "10", "Hearts");
c[23] = new card ( "Jack", "Hearts");
c[24] = new card ( "Queen", "Hearts");
c[25] = new card ( "King", "Clubs");
c[26] = new card ( "Ace", "Clubs");
c[27] = new card ( "2", "Clubs");
c[28] = new card ( "3", "Clubs");
c[29] = new card ( "4", "Clubs");
c[30] = new card ( "5", "Clubs");
c[31] = new card ( "6", "Clubs");
c[32] = new card ( "7", "Clubs");
c[33] = new card ( "8", "Clubs");
c[34] = new card ( "9", "Clubs");
c[35] = new card ( "10", "Clubs");
c[36] = new card ( "Jack", "Clubs");
c[37] = new card ( "Queen", "Clubs");
c[38] = new card ( "King", "Clubs");
c[39] = new card ( "Ace", "Diamonds");
c[40] = new card ( "2", "Diamonds");
c[41] = new card ( "3", "Diamonds");
c[42] = new card ( "4", "Diamonds");
c[43] = new card ( "5", "Diamonds");
c[44] = new card ( "6", "Diamonds");
c[45] = new card ( "7", "Diamonds");
c[46] = new card ( "8", "Diamonds");
c[47] = new card ( "9", "Diamonds");
c[48] = new card ( "10", "Diamonds");
c[49] = new card ( "Jack", "Diamonds");
c[50] = new card ( "Queen", "Diamonds");
c[51] = new card ( "King", "Diamonds");
}
*/ | [
"aditidatta93@gmail.com"
] | aditidatta93@gmail.com |
8b3d1d7a647dc41434c2e73c3e67f433e8c49e42 | 4e4c5f45419305651439a31d843c3ea6c20685b3 | /jfox3/MODULES/petstore/src/org/jfox/petstore/bo/CategoryBO.java | ea66195c2d530ea2d894b29171b9eda641c75f0c | [] | no_license | huihoo/jfox | d34b5fb16ae3a1cbcb53c6462ce89a8bb96e2d51 | a27122ac7db8b27f2fb06d82131dbef202a27bf2 | refs/heads/master | 2021-01-23T07:16:59.558459 | 2015-05-29T05:53:01 | 2015-05-29T05:53:01 | 36,484,592 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 519 | java | /*
* JFox - The most lightweight Java EE Application Server!
* more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn.
*
* JFox is licenced and re-distributable under GNU LGPL.
*/
package org.jfox.petstore.bo;
import java.util.List;
import org.jfox.petstore.entity.Category;
/**
* @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
*/
public interface CategoryBO {
Category getCategory(String categoryId);
List<Category> getCategoryList();
}
| [
"jfox.young@8d592abc-3327-0410-a519-f7f2e55ad719"
] | jfox.young@8d592abc-3327-0410-a519-f7f2e55ad719 |
41ac78c23a6ccb5e15df2e07e33b843c0b9af7b1 | 7a4faf0d53c6c2dcb81cf9ee355495e3dc7dfa47 | /nb-server-auth/src/main/java/com/nb/security/server/auth/OAuth2WebSecurityConfig.java | 6c347d322b08c0426c148b9a977167ce1af72090 | [] | no_license | MrGGGGGG/springcloud-security | 566b84decc909b8e1fa197e77263d36fb3e82145 | 0c33f3ee459fd82bf21147401f40f234dc8d05b8 | refs/heads/master | 2020-09-29T14:39:37.395708 | 2019-12-08T13:05:44 | 2019-12-08T13:05:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,839 | java | package com.nb.security.server.auth;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
/**
* Created by: 李浩洋 on 2019-10-29
**/
@Configuration
@EnableWebSecurity
public class OAuth2WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private UserDetailsService userDetailsService;
@Autowired
private PasswordEncoder passwordEncoder;
/**
* 构建 AuthenticationManager(处理登录操作)
* 需要两个东西:userDetailsService 、passwordEncoder
* @param auth
* @throws Exception
*/
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService) //获取用户信息
.passwordEncoder(passwordEncoder); //比对密码
}
/**
* 把AuthenticationManager暴露为bean
* @return
* @throws Exception
*/
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
}
| [
"13298457669@163.com"
] | 13298457669@163.com |
94fcfd4563d62b71bd0979670131d52a64de2ef7 | b1943d60d2ba6380cac4ead9365b3b4e6a670549 | /TestApp/app/build/generated/source/buildConfig/debug/com/slyfox/testapp/BuildConfig.java | e53ab61c06959e8fb3c8125f32a5ecc339601314 | [] | no_license | elshabee7/tagreba | c0f2ee22d8b39f2cc0de1e716444244d9ebb3bd3 | f22642ad48862fa8bdadc764ceb6e2c737e7794b | refs/heads/master | 2021-01-21T11:27:20.548009 | 2017-05-18T23:04:29 | 2017-05-18T23:04:29 | 91,740,828 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 443 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.slyfox.testapp;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.slyfox.testapp";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}
| [
"eskeletsh@gmail.com"
] | eskeletsh@gmail.com |
d069afa6a16ab77609ac3164f0fd258d623f39a9 | 10af165f4719b1c5d03b5d318709209496194a94 | /src/main/java/com/euler/problem2/Problem25.java | 1057691874f883d47c298bea8c60e5405e77aaae | [] | no_license | LoicB/ProjectEuler | 9cfd1b1aa1ef9aa77afef6a41361d4e8867ce4d3 | 302019b58248fc375cbbf25f09e710b6a2e8740c | refs/heads/master | 2023-09-03T22:38:53.999794 | 2021-09-30T16:36:39 | 2021-09-30T16:36:39 | 282,499,690 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 919 | java | package com.euler.problem2;
import java.math.BigInteger;
public class Problem25 {
public static void main(String[] args) {
Problem25 problem25 = new Problem25();
Long time1 = System.currentTimeMillis();
int index = problem25.indexDigitFibonacci(1000);
Long time2 = System.currentTimeMillis();
System.out.println(" " + (time2 - time1) + "ms");
System.out.println("The solution is " + index);
}
protected int indexDigitFibonacci(int numberOfDigits) {
BigInteger limit = BigInteger.TEN.pow(numberOfDigits - 1);
BigInteger fibA = BigInteger.ONE;
BigInteger fibB = BigInteger.ONE;
BigInteger fibC = fibA.add(fibB);
int index = 3;
while (fibC.compareTo(limit) < 0) {
index++;
fibA = fibB;
fibB = fibC;
fibC = fibA.add(fibB);
}
return index;
}
}
| [
"loic.beylot@gmail.com"
] | loic.beylot@gmail.com |
5783c34c1603bd896c010841b81126fcc693e7e8 | 34fe2ca4de94e19673335cd91502b955bc9afaaf | /AndersonBeau COMP401 Final Project/stringProcessors/removeHouseCommand.java | 6bde82e7ebc489f8b73362a17b861192f7829c03 | [] | no_license | DanielSanchez97/Comp533_assignment1 | 392d16a8740dead94b0a536293b2c3ffacd767d5 | c091a86c4f3acf7f17c3a9cba1041606a697fff8 | refs/heads/master | 2020-04-18T06:01:46.506063 | 2019-03-05T01:55:16 | 2019-03-05T01:55:16 | 167,303,001 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java | package stringProcessors;
import graphics.HalloweenSimulation;
public class removeHouseCommand implements Command
{
HalloweenSimulation simToControl;
public removeHouseCommand (HalloweenSimulation inputSim)
{
simToControl = inputSim;
}
public void execute()
{
if (simToControl.getAnimationOn() == true)
{
simToControl.removehouseThread();
}
else
{
simToControl.RemoveHouse();
}
}
public void undo()
{
if (simToControl.getAnimationOn() == true)
{
simToControl.addhouseThread();
}
else
{
simToControl.AddHouse();
}
}
}
| [
"arturo97@live.unc.edu"
] | arturo97@live.unc.edu |
15eadd4eb420f22792088457d62c7e40fc0f45d1 | 963599f6f1f376ba94cbb504e8b324bcce5de7a3 | /sources/p035ru/unicorn/ujin/data/profile/ProfileViewModel$onSendToMailClick$subscribe$1.java | 684d3a5270fc27156be39e6f01e0e57225309cc8 | [] | no_license | NikiHard/cuddly-pancake | 563718cb73fdc4b7b12c6233d9bf44f381dd6759 | 3a5aa80d25d12da08fd621dc3a15fbd536d0b3d4 | refs/heads/main | 2023-04-09T06:58:04.403056 | 2021-04-20T00:45:08 | 2021-04-20T00:45:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,648 | java | package p035ru.unicorn.ujin.data.profile;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import p035ru.unicorn.ujin.data.realm.Resource;
import p035ru.unicorn.ujin.view.activity.navigation.p058ui.corona.model.QRIn;
import p046io.reactivex.functions.Consumer;
@Metadata(mo51341bv = {1, 0, 3}, mo51342d1 = {"\u0000\u0014\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0000\u001a\u00020\u00012\u001a\u0010\u0002\u001a\u0016\u0012\u0004\u0012\u00020\u0004 \u0005*\n\u0012\u0004\u0012\u00020\u0004\u0018\u00010\u00030\u0003H\n¢\u0006\u0002\b\u0006"}, mo51343d2 = {"<anonymous>", "", "data", "Lru/unicorn/ujin/data/realm/Resource;", "Lru/unicorn/ujin/view/activity/navigation/ui/corona/model/QRIn;", "kotlin.jvm.PlatformType", "accept"}, mo51344k = 3, mo51345mv = {1, 4, 1})
/* renamed from: ru.unicorn.ujin.data.profile.ProfileViewModel$onSendToMailClick$subscribe$1 */
/* compiled from: ProfileViewModel.kt */
final class ProfileViewModel$onSendToMailClick$subscribe$1<T> implements Consumer<Resource<QRIn>> {
final /* synthetic */ ProfileViewModel this$0;
ProfileViewModel$onSendToMailClick$subscribe$1(ProfileViewModel profileViewModel) {
this.this$0 = profileViewModel;
}
public final void accept(Resource<QRIn> resource) {
Intrinsics.checkNotNullExpressionValue(resource, "data");
if (resource.getStatus() == Resource.Status.SUCCESS) {
this.this$0.showError.setValue("Пропуск отправлен на почту");
} else {
this.this$0.showError.setValue(resource.getMessage());
}
}
}
| [
"a.amirovv@mail.ru"
] | a.amirovv@mail.ru |
f6b3653959a78db0e0be5797c3261bda929a2541 | 0d7c3c1c5463b4fd8c95f3e6fc69184cf90cf942 | /src/main/java/orgeteoman/crud/project/Project.java | 4d026e67913ca34edbecc0b9df37782d6d0c3334 | [] | no_license | teo5555/project-management | d1868412eb054c63661ce3f0d5cc57149bd0ef9f | a5234e3456c89a674f2075511fd8e85bf09b3952 | refs/heads/master | 2022-12-28T07:29:37.589414 | 2020-10-13T22:46:04 | 2020-10-13T22:46:04 | 303,842,945 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,186 | java | package orgeteoman.crud.project;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import orgeteoman.crud.admin.User;
@Entity
@Table(name = "Project")
public class Project {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
@Column( columnDefinition = "TEXT")
private String title;
@Column( columnDefinition = "TEXT")
private String description;
private String start_date;
private String end_date;
@ManyToMany(targetEntity = User.class, fetch = FetchType.LAZY,cascade = {
CascadeType.DETACH,
CascadeType.MERGE,
CascadeType.PERSIST,
CascadeType.REFRESH,
})
@JoinTable(
name="project_user",
joinColumns = @JoinColumn(name="project_id"),
inverseJoinColumns = @JoinColumn(name="user_id")
)
private List<User> users;
public List<User> getUsers() {
return users;
}
public void setUsers(List<User> users) {
this.users = users;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getStart_date() {
return start_date;
}
public void setStart_date(String start_date) {
this.start_date = start_date;
}
public String getEnd_date() {
return end_date;
}
public void setEnd_date(String end_date) {
this.end_date = end_date;
}
public Project() {
}
public void addUser(User theUser) {
if(users == null) {
users = new ArrayList<>();
}
users.add(theUser);
}
public void removeUser(User theUser) {
users.remove(theUser);
}
}
| [
"orgeteoman@gmail.com"
] | orgeteoman@gmail.com |
5472cae377b3aee04cc0aa09cf155b1e66563a4b | 085a5fad689f2e239eefc13811a4f142893fbef2 | /src/java/org/unlitrodeluzcolombia/radius/gui/hotspot/HotspotsMapPage.java | fb315d885e26261bbfd619be18433f18f20cd182 | [] | no_license | ambassadoroflight/litrodeluzradius2adminweb | 0e56aa33c1b2f40e4cde7f149ff8628b091aa6c1 | 878811e310ddc911d3bbda7bb3b39a750d0403fa | refs/heads/main | 2023-04-15T18:26:24.451941 | 2021-04-12T23:26:01 | 2021-04-12T23:26:01 | 357,366,088 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 6,397 | java | package org.unlitrodeluzcolombia.radius.gui.hotspot;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.comtor.advanced.ajax.HtmlJavaScript;
import net.comtor.advanced.html.DivForm;
import net.comtor.advanced.html.HtmlCalendarJQuery;
import net.comtor.dao.ComtorDaoException;
import net.comtor.framework.html.administrable.ComtorMessageHelperI18n;
import net.comtor.framework.jsptag.HtmlGuiInterface;
import net.comtor.framework.maps.HtmlGoogleMap;
import net.comtor.framework.maps.MapSideBar;
import net.comtor.framework.util.security.SecurityHelper;
import net.comtor.html.HtmlContainer;
import net.comtor.html.HtmlDiv;
import net.comtor.html.HtmlImg;
import net.comtor.html.form.HtmlButton;
import net.comtor.html.form.HtmlSelect;
import net.comtor.radius.element.Country;
import net.comtor.radius.element.Hotspot;
import net.comtor.radius.element.Sponsor;
import net.comtor.radius.facade.CountryDAOFacade;
import net.comtor.radius.facade.HotspotDAOFacade;
import net.comtor.radius.facade.SponsorDAOFacade;
import org.unlitrodeluzcolombia.radius.gui.FormUtils;
import web.global.GlobalWeb;
import web.global.LitroDeLuzImages;
/**
*
* @author juandiego@comtor.net
* @since
* @version Apr 26, 2019
*/
public class HotspotsMapPage extends HtmlGuiInterface {
private static final Logger LOG = Logger.getLogger(HotspotsMapPage.class.getName());
private static final String TITLE = "Mapa Hotspots";
private static final String WS_URL = "/litrodeluz/radius/webservices/hotspot_services/map/get_hotspots";
private LinkedList<Hotspot> hotspots;
@Override
public String getHtml() {
if (!SecurityHelper.canAll(new HotspotController(), getRequest())) {
return ComtorMessageHelperI18n.getErrorForm(TITLE, "index.jsp",
"Ud. no tiene permisos para ingresar a este módulo", getRequest())
.getHtml();
}
HtmlContainer mainContainer = new HtmlContainer();
HtmlDiv controller_title = new HtmlDiv(null, "controller_title",
new HtmlImg(LitroDeLuzImages.MAP_CONTROLLER));
controller_title.addString(TITLE);
mainContainer.addElement(controller_title);
HtmlDiv map_container = new HtmlDiv("map_container");
mainContainer.addElement(map_container);
try {
double centerX = 0;
double centerY = 0;
hotspots = new HotspotDAOFacade().findAll();
if (hotspots.isEmpty()) {
return ComtorMessageHelperI18n.getErrorForm(TITLE, "index.jsp",
"No se encontraron ubicaciones para mostrar en el mapa.",
request).getHtml();
}
for (Hotspot hotspot : hotspots) {
centerX += hotspot.getLatitude();
centerY += hotspot.getLongitude();
}
centerX /= hotspots.size();
centerY /= hotspots.size();
HtmlGoogleMap map = new HtmlGoogleMap(GlobalWeb.GOOGLE_MAPS_KEY,
centerX, centerY, 3);
map.addAjaxMarkerList(WS_URL, false);
map_container.addElement(map);
MapSideBar mapSideBar = new MapSideBar();
DivForm filter = new DivForm("", "GET");
filter.setFormName("hotspot_map_filter");
filter.setTitle("Buscar");
filter.addField("Patrocinador", FormUtils.getSponsorSelect(), null);
filter.addField("Pais", FormUtils.getCountrySelect(), null);
HtmlSelect zone = new HtmlSelect("zone");
zone.addOption("0", "Todas");
filter.addField("Zona", zone, null);
filter.addField("Fecha Inicio Campaña", new HtmlCalendarJQuery("start_date"), null);
filter.addField("Fecha Final Campaña", new HtmlCalendarJQuery("end_date"), null);
HtmlButton search = new HtmlButton(HtmlButton.SCRIPT_BUTTON,
"hotspot_map_filter_button", "Buscar", "getHotspots();");
HtmlButton clear = new HtmlButton(HtmlButton.SCRIPT_BUTTON,
"hotspot_map_clear_filter_button", "Limpiar", "clearSearch();");
filter.addButtons(search, clear);
mapSideBar.add(filter);
mapSideBar.add(getJS());
map_container.addElement(mapSideBar);
} catch (Exception ex) {
LOG.log(Level.SEVERE, ex.getMessage(), ex);
return ComtorMessageHelperI18n.getErrorForm(TITLE, "index.jsp",
"<b>Se ha generado un error en la generación de esta función. Por favor, "
+ "reporte al administrador del sistema:</b><br><p>" + ex
+ "</p>", request).getHtml();
}
return mainContainer.getHtml();
}
@Override
public boolean requireComtorSession() {
return true;
}
private HtmlJavaScript getJS() {
String js = "\n"
+ " $(document).ready(function() {\n"
+ " var $country = $(\"select#country\"); \n"
+ " var $zone = $(\"select#zone\"); \n\n"
+ ""
+ " $country.change(function() { \n"
+ " var iso = $(this).val(); \n"
+ "\n"
+ " var settings = {\n"
+ " \"url\": \"/litrodeluz/radius/webservices/hotspot_services/map/get_zones?country=\" + iso, \n"
+ " \"method\": \"GET\",\n"
+ " }\n\n"
+ ""
+ " $zone.empty();\n"
+ " $zone.append('<option value=\"\">Todas</option>');\n\n"
+ ""
+ " $.ajax(settings) \n"
+ " .done(function (response) { \n"
+ " $.each(response, function(i, item) {\n"
+ " $zone.append('<option value=\"' + item.id + '\">' + item.name + '</option>');\n"
+ " });\n"
+ " }) \n"
+ " .fail(function(jqXHR, textStatus){ \n"
+ " console.error(textStatus);\n"
+ " });\n"
+ " });\n"
+ " }); \n";
return new HtmlJavaScript(js);
}
}
| [
"juandiego@comtor.net"
] | juandiego@comtor.net |
af521673bad0895cc2024c44111ddfef9c2b6946 | 0b248745c991c299423a1c52552155b880b4831b | /Lab_1/src/main/java/posMain.java | 3f1964f7742375f3e7ee6cbf7ec63cee20a47330 | [] | no_license | camlecuyer/CS5560_CameronLEcuyer_ICPSubmission | e53eb8e79e9aa8792b30fa811c3a6f3476486dc4 | 5b7bdbedcf029e555348e089f6ea29a1be676fb4 | refs/heads/master | 2021-06-24T00:47:57.781895 | 2021-06-18T19:17:00 | 2021-06-18T19:17:00 | 145,897,459 | 0 | 0 | null | 2021-06-18T19:19:51 | 2018-08-23T19:20:56 | Java | UTF-8 | Java | false | false | 3,712 | java | import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.util.CoreMap;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.Properties;
public class posMain {
static final int FILE_ID = 11;
// This code retrieves the abstracts from a file, and breaks them up into their tokens and lemmatizes them, it
// also calculate the part of speech of each word, and saves it to a file
public static void main(String args[]) {
// creates a StanfordCoreNLP object, with POS tagging, lemmatization, NER, parsing, and coreference resolution
Properties props = new Properties();
props.setProperty("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
String text = null;
// reads abstract all at once
try
{
text = new String(Files.readAllBytes(Paths.get("data/abstract_text/" + FILE_ID + ".txt")));
}
catch (IOException e)
{
e.printStackTrace();
} // end try/catch
// if there is a text present, it tries to do NLP
if(text != null) {
// create an empty Annotation just with the given text
Annotation document = new Annotation(text);
// run all Annotators on this text
pipeline.annotate(document);
// these are all the sentences in this document
// a CoreMap is essentially a Map that uses class objects as keys and has values with custom types
List<CoreMap> sentences = document.get(CoreAnnotations.SentencesAnnotation.class);
int count = 0;
PrintWriter writer;
// counts the words in the abstract, and outputs the token, lemma, and PoS to a file
try {
writer = new PrintWriter("data/token_results/" + FILE_ID + "_token.txt");
for (CoreMap sentence : sentences)
{
// traversing the words in the current sentence
// a CoreLabel is a CoreMap with additional token-specific methods
for (CoreLabel token : sentence.get(CoreAnnotations.TokensAnnotation.class))
{
String word = token.get(CoreAnnotations.TextAnnotation.class);
if(word.compareTo(",") != 0 && word.compareTo(".") != 0 && word.compareTo(":") != 0
&& word.compareTo(";") != 0 && word.compareTo("'") != 0 && word.compareTo("%") != 0
&& word.compareTo("=") != 0 && word.compareTo("''") != 0 && word.compareTo("``") != 0)
{
writer.print(word + " ");
String lemma = token.get(CoreAnnotations.LemmaAnnotation.class);
writer.print(lemma + " ");
String pos = token.get(CoreAnnotations.PartOfSpeechAnnotation.class);
writer.println(pos);
count++;
} // end if
} // end loop
} // end loop
writer.close();
System.out.println("Total words: " + count);
} catch (FileNotFoundException e) {
e.printStackTrace();
} // end try/catch
} // end if
} // end main
}
| [
"camlecuyer@yahoo.com"
] | camlecuyer@yahoo.com |
363c18fa4d9d0779b4f727d1b67a885057a7f760 | b8037c526067998a83914d591b3fd998c8284c02 | /SSM_shiro/src/main/java/com/woniuxy/service/impl/UserServiceImpl.java | 217101ffb0b406f074be1ca29d16b79f19dd0b8d | [] | no_license | jackpoit/MySpring | a9d6f330de02e5379e709ba18458ee26281985bb | 03c8290ae3c517b14264012dc1317ae0dfa09331 | refs/heads/master | 2023-08-03T05:20:19.680288 | 2021-09-09T08:48:30 | 2021-09-09T08:48:30 | 394,970,511 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 539 | java | package com.woniuxy.service.impl;
import com.woniuxy.bean.User;
import com.woniuxy.dao.UserMapper;
import com.woniuxy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author: rua
* @Date: 2021/8/21 16:58
* @Description: 实现类
*/
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserMapper userMapper;
@Override
public List<User> findAll() {
return userMapper.findAll();
}
}
| [
"jackpoit_able@outlook.com"
] | jackpoit_able@outlook.com |
5da1309f88dc4f6f6526d8cdf4bcece071c1ec54 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /single-large-project/src/test/java/org/gradle/test/performancenull_144/Testnull_14398.java | d60f61d8c63384ac515af89787ea75fe95267977 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 308 | java | package org.gradle.test.performancenull_144;
import static org.junit.Assert.*;
public class Testnull_14398 {
private final Productionnull_14398 production = new Productionnull_14398("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
} | [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
181ef24dd40e95c486793370cb5070abebad73d3 | 79f90f508635d30469ef954dcbfc0762942e8aff | /app/src/main/java/tw/org/iii/guessnumber/WelcomeActivity.java | 852c5b2d440ec8fa30ddd01d7481ae71300b3ca6 | [] | no_license | AHsien/Android_GuessNumber | 7bb4c082a69b4bf7b2baec427abfb69ac78f330f | fefe08af382a644e01708e144664b092a7bfcf50 | refs/heads/master | 2020-04-10T05:17:02.574985 | 2018-03-11T14:43:08 | 2018-03-11T14:43:08 | 124,265,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,305 | java | package tw.org.iii.guessnumber;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import java.util.Timer;
import java.util.TimerTask;
public class WelcomeActivity extends AppCompatActivity {
private Timer timer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcome);
timer = new Timer();
timer.schedule(new MyTask(), 3*1000);
findViewById(R.id.welcome).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gotoMain();
}
});
}
private class MyTask extends TimerTask {
@Override
public void run() {
gotoMain();
}
}
private void gotoMain(){
Intent intent =
new Intent(
WelcomeActivity.this,
MainActivity.class);
startActivity(intent);
finish();
}
@Override
public void finish() {
if (timer != null){
timer.cancel();
timer.purge();
timer = null;
}
super.finish();
}
} | [
"a0912433730@gmail.com"
] | a0912433730@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.