blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
620504c77d64717b9681a9992dcdf093de0e1d57 | da8f8a78810748e007cc04ab508a0b6918f8e958 | /app/src/main/java/com/game/helper/net/task/CgametypelistTask.java | e8626ce366f914e945cf609f4ed49f06f0188f88 | []
| no_license | 252319634/boluogamespay | a803c0d3e81e840c0e3c9c44ad18167dd6e9ea62 | 4c7e4b60703ca3bafd7062fed6e8b3e59732ff28 | refs/heads/master | 2021-07-11T04:54:15.311564 | 2017-10-12T18:15:40 | 2017-10-12T18:19:51 | 104,739,840 | 1 | 0 | null | 2017-09-25T11:08:46 | 2017-09-25T11:08:46 | null | UTF-8 | Java | false | false | 1,161 | java | package com.game.helper.net.task;
import com.game.helper.net.base.BaseBBXTask;
import com.game.helper.sdk.model.comm.CgametypelistBuild;
import com.game.helper.sdk.net.comm.CgametypelistNet;
import android.content.Context;
/**
* @Description
* @Path com.game.helper.net.task.CgametypelistTask.java
* @Author lbb
* @Date 2016年10月8日 上午10:49:29
* @Company
*/
public class CgametypelistTask extends BaseBBXTask{
CgametypelistBuild build;
public CgametypelistTask(Context context,Back back) {
super(context,false);
this.back=back;
build=new CgametypelistBuild(context, API_cgametypelist_Url);
}
@Override
public void onSuccess(Object object, String msg) {
// TODO Auto-generated method stub
if(back!=null){
back.success(object,msg);
}
}
@Override
public void onFailed(String status, String msg, Object result) {
// TODO Auto-generated method stub
super.onFailed(status, msg, result);
if(back!=null){
back.fail(status, msg, result);
}
}
@Override
protected Object doInBackground(Object... params) {
// TODO Auto-generated method stub
return new CgametypelistNet(context, build.toJson1());
}
} | [
"[email protected]"
]
| |
19b374cd264561b5368ba75d9c4b75e824e375a8 | 37cfbabe7fdd72c5ad5e44b70b07394e70effdb7 | /src/main/java/cz/novros/cp/web/view/DefaultController.java | 7f5e8970af9137a4f2cb7d3e975150b1c312aadc | [
"Apache-2.0"
]
| permissive | OrdinaryNick/CzechPost-notifier | 8a54e48060b576f7800d0f00837126753a5b2d45 | 90acffd49a21ba1386e20e74baf86a6fbc89f454 | refs/heads/master | 2021-09-04T22:36:14.378309 | 2018-01-22T19:22:49 | 2018-01-22T19:22:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,111 | java | package cz.novros.cp.web.view;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.experimental.FieldDefaults;
import cz.novros.cp.common.CommonConstants;
import cz.novros.cp.entity.Parcel;
import cz.novros.cp.service.ApplicationService;
import cz.novros.cp.service.parcel.ParcelService;
import cz.novros.cp.service.user.UserSecurityService;
import cz.novros.cp.service.user.UserService;
import cz.novros.cp.web.view.entity.RegisterUser;
import cz.novros.cp.web.view.entity.TrackingNumbersForm;
@Controller
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true)
@AllArgsConstructor(onConstructor = @__(@Autowired))
public class DefaultController {
UserSecurityService securityService;
UserService userService;
ParcelService parcelService;
ApplicationService applicationService;
@RequestMapping(value = {"/", "/home"}, method = RequestMethod.GET)
public ModelAndView home() {
return displayHome(null);
}
@RequestMapping(value = "/register", method = RequestMethod.GET)
public ModelAndView register() {
final ModelAndView modelAndView = new ModelAndView("register");
modelAndView.addObject("registerUser", new RegisterUser());
return modelAndView;
}
@RequestMapping(value = "/register", method = RequestMethod.POST)
public ModelAndView registerUser(@ModelAttribute @Nonnull final RegisterUser user) {
String error = null;
boolean result;
if (user.getPassword().equals(user.getCheckPassword())) {
result = securityService.registerUser(new cz.novros.cp.entity.User(user.getUsername(), user.getPassword(), new HashSet<>()));
if (!result) {
error = "Could not create user with email " + user.getUsername() + ".";
}
} else {
result = false;
error = "Password and confirm password is not same.";
}
if (result) {
return new ModelAndView("redirect:login?signup=" + user.getUsername());
} else {
final ModelAndView modelAndView = new ModelAndView("register");
if (error != null) {
modelAndView.addObject("error", error);
}
return modelAndView;
}
}
@RequestMapping(value = "/add-tracking", method = RequestMethod.POST)
public ModelAndView addTrackingNumbers(@ModelAttribute @Nullable final TrackingNumbersForm trackingNumbers) {
if (trackingNumbers != null && !trackingNumbers.getTrackingNumbersCollection().isEmpty()) {
applicationService.refreshParcels(trackingNumbers.getTrackingNumbersCollection());
return displayParcelByTrackingNumbers(userService.addTrackingNumbers(getLoggedUsername(), trackingNumbers.getTrackingNumbersCollection()));
} else {
return home();
}
}
@RequestMapping(value = "/remove-tracking", method = RequestMethod.GET) // FIXME - Maybe POST?
public ModelAndView removeTrackingNumbers(@RequestParam @Nullable final String trackingNumbers) {
if (trackingNumbers != null && !trackingNumbers.isEmpty()) {
final Collection<String> numbers = Arrays.asList(trackingNumbers.split(CommonConstants.TRACKING_NUMBER_DELIMITER));
parcelService.removeParcels(numbers);
return displayParcelByTrackingNumbers(userService.removeTrackingNumbers(getLoggedUsername(), numbers));
} else {
return home();
}
}
@RequestMapping(value = "/refresh-parcels", method = RequestMethod.GET)
public ModelAndView refresh() {
return displayHome(applicationService.refreshParcels(getTrackingNumbersOfCurrentUser()));
}
private ModelAndView displayParcelByTrackingNumbers(@Nullable final Collection<String> parcels) {
return displayHome(getParcels(parcels));
}
private ModelAndView displayHome(@Nullable final Collection<Parcel> parcels) {
final ModelAndView model = new ModelAndView("home");
model.addObject("formTrackingNumbers", new TrackingNumbersForm());
model.addObject("parcels", parcels == null ? getParcels(getTrackingNumbersOfCurrentUser()) : parcels);
return model;
}
private Collection<String> getTrackingNumbersOfCurrentUser() {
return userService.readTrackingNumbers(getLoggedUsername());
}
private Collection<Parcel> getParcels(@Nullable final Collection<String> trackingNumbers) {
return trackingNumbers == null ? null : parcelService.readParcels(trackingNumbers);
}
private String getLoggedUsername() {
final Authentication auth = SecurityContextHolder.getContext().getAuthentication();
final User user = (User) auth.getPrincipal();
return user.getUsername();
}
}
| [
"[email protected]"
]
| |
ee9575231332de5b1e69c4776ce11e3ee63c26fd | 08ba9223323660c36913696d32f15497e50f06de | /src/core-metadata/src/test/java/org/apache/kylin/metadata/cube/cuboid/CuboidSchedulerTest.java | 23c32c1abe63a216fbc7a5e7099b085d63fcaa30 | [
"Apache-2.0"
]
| permissive | hit-lacus/kylin | 9d50478e38829dd99dcc7d5c4fb54c05b6ec1385 | ceea0e04320f933bbc391e29a6c5f0c7a3449abb | refs/heads/kylin5 | 2023-08-07T17:17:20.722924 | 2022-09-06T08:27:33 | 2022-09-06T08:27:33 | 149,539,687 | 2 | 2 | Apache-2.0 | 2023-04-21T20:47:29 | 2018-09-20T02:28:18 | Java | UTF-8 | Java | false | false | 6,358 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.apache.kylin.metadata.cube.cuboid;
import java.io.IOException;
import org.apache.kylin.common.util.JsonUtil;
import org.apache.kylin.common.util.NLocalFileMetadataTestCase;
import org.apache.kylin.metadata.cube.model.IndexEntity;
import org.apache.kylin.metadata.cube.model.IndexPlan;
import org.apache.kylin.metadata.cube.model.NIndexPlanManager;
import org.apache.kylin.metadata.cube.model.RuleBasedIndex;
import org.apache.kylin.metadata.model.NDataModelManager;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import com.google.common.collect.Lists;
import lombok.val;
public class CuboidSchedulerTest extends NLocalFileMetadataTestCase {
public static final String DEFAULT_PROJECT = "default";
@Before
public void setUp() throws Exception {
this.createTestMetadata();
}
@After
public void after() throws Exception {
this.cleanupTestMetadata();
}
@Test
public void test2403_dimCap3() throws IOException {
IndexPlan cube = utCube("2.1.0.20403", 3);
{
NAggregationGroup agg = cube.getRuleBasedIndex().getAggregationGroups().get(0);
val set = cube.getRuleBasedIndex().getCuboidScheduler().calculateCuboidsForAggGroup(agg);
//KapCuboidScheduler2403.debugPrint(set, "agg1 result");
Assert.assertEquals(19, set.size());
}
{
NAggregationGroup agg = cube.getRuleBasedIndex().getAggregationGroups().get(1);
val set = cube.getRuleBasedIndex().getCuboidScheduler().calculateCuboidsForAggGroup(agg);
//KapCuboidScheduler2403.debugPrint(set, "agg2 result");
Assert.assertEquals(15, set.size());
}
{
val set = cube.getRuleBasedIndex().getCuboidScheduler().getAllColOrders();
//KapCuboidScheduler2403.debugPrint(set, "all result");
Assert.assertEquals(31, set.size());
}
}
@Test
public void test2403_dimCap2() throws IOException {
IndexPlan cube = utCube("2.1.0.20403", 2);
{
NAggregationGroup agg = cube.getRuleBasedIndex().getAggregationGroups().get(0);
val set = cube.getRuleBasedIndex().getCuboidScheduler().calculateCuboidsForAggGroup(agg);
//KapCuboidScheduler2403.debugPrint(set, "agg1 result");
Assert.assertEquals(15, set.size());
}
{
NAggregationGroup agg = cube.getRuleBasedIndex().getAggregationGroups().get(1);
val set = cube.getRuleBasedIndex().getCuboidScheduler().calculateCuboidsForAggGroup(agg);
//KapCuboidScheduler2403.debugPrint(set, "agg2 result");
Assert.assertEquals(11, set.size());
}
{
val set = cube.getRuleBasedIndex().getCuboidScheduler().getAllColOrders();
//KapCuboidScheduler2403.debugPrint(set, "all result");
Assert.assertEquals(24, set.size());
}
}
@Test
public void test2403_dimCap1() throws IOException {
IndexPlan cube = utCube("2.1.0.20403", 1);
{
NAggregationGroup agg = cube.getRuleBasedIndex().getAggregationGroups().get(0);
val set = cube.getRuleBasedIndex().getCuboidScheduler().calculateCuboidsForAggGroup(agg);
//KapCuboidScheduler2403.debugPrint(set, "agg1 result");
Assert.assertEquals(6, set.size());
}
{
NAggregationGroup agg = cube.getRuleBasedIndex().getAggregationGroups().get(1);
val set = cube.getRuleBasedIndex().getCuboidScheduler().calculateCuboidsForAggGroup(agg);
//KapCuboidScheduler2403.debugPrint(set, "agg2 result");
Assert.assertEquals(5, set.size());
}
{
val set = cube.getRuleBasedIndex().getCuboidScheduler().getAllColOrders();
//KapCuboidScheduler2403.debugPrint(set, "all result");
Assert.assertEquals(11, set.size());
}
}
@Test
public void testMaskIsZero() throws IOException {
val mgr = NIndexPlanManager.getInstance(getTestConfig(), DEFAULT_PROJECT);
val modelMgr = NDataModelManager.getInstance(getTestConfig(), DEFAULT_PROJECT);
IndexPlan cube = mgr.getIndexPlan("82fa7671-a935-45f5-8779-85703601f49a");
cube = JsonUtil.deepCopy(cube, IndexPlan.class);
cube.setIndexes(Lists.<IndexEntity> newArrayList());
cube.initAfterReload(getTestConfig(), DEFAULT_PROJECT);
val rule = new RuleBasedIndex();
rule.setDimensions(Lists.<Integer> newArrayList());
rule.setMeasures(Lists.<Integer> newArrayList());
rule.setIndexPlan(cube);
cube.setRuleBasedIndex(rule);
val scheduler = (KECuboidSchedulerV1) cube.getRuleBasedIndex().getCuboidScheduler();
Assert.assertEquals(0, scheduler.getAllColOrders().size());
}
private IndexPlan utCube(String resetVer, Integer resetDimCap) throws IOException {
NIndexPlanManager mgr = NIndexPlanManager.getInstance(getTestConfig(), DEFAULT_PROJECT);
IndexPlan cube = mgr.getIndexPlan("82fa7671-a935-45f5-8779-85703601f49a");
cube = JsonUtil.deepCopy(cube, IndexPlan.class);
cube.setVersion(resetVer);
if (resetDimCap != null) {
for (NAggregationGroup g : cube.getRuleBasedIndex().getAggregationGroups())
g.getSelectRule().dimCap = resetDimCap;
}
cube.initAfterReload(getTestConfig(), DEFAULT_PROJECT);
return cube;
}
}
| [
"[email protected]"
]
| |
fb348d077d2f8489b6ae5a32d1b05d4fa26daf75 | c8688db388a2c5ac494447bac90d44b34fa4132c | /sources/com/google/android/gms/measurement/internal/C3170z7.java | f38778a205b6d18a697e0e910261436d775ce648 | []
| no_license | mred312/apk-source | 98dacfda41848e508a0c9db2c395fec1ae33afa1 | d3ca7c46cb8bf701703468ddc88f25ba4fb9d975 | refs/heads/master | 2023-03-06T05:53:50.863721 | 2021-02-23T13:34:20 | 2021-02-23T13:34:20 | 341,481,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,006 | java | package com.google.android.gms.measurement.internal;
import com.google.android.gms.internal.measurement.zzw;
/* renamed from: com.google.android.gms.measurement.internal.z7 */
/* compiled from: com.google.android.gms:play-services-measurement-sdk@@17.6.0 */
final class C3170z7 implements Runnable {
/* renamed from: a */
private final /* synthetic */ zzw f18484a;
/* renamed from: b */
private final /* synthetic */ String f18485b;
/* renamed from: c */
private final /* synthetic */ String f18486c;
/* renamed from: d */
private final /* synthetic */ AppMeasurementDynamiteService f18487d;
C3170z7(AppMeasurementDynamiteService appMeasurementDynamiteService, zzw zzw, String str, String str2) {
this.f18487d = appMeasurementDynamiteService;
this.f18484a = zzw;
this.f18485b = str;
this.f18486c = str2;
}
public final void run() {
this.f18487d.f17925a.zzv().zza(this.f18484a, this.f18485b, this.f18486c);
}
}
| [
"[email protected]"
]
| |
76c33b7c1982c12557acd64e6974f2394dd32de7 | 32c394f75f29d2097ce81341ba3781cb7cd46de2 | /src/main/java/com/sicmatr1x/SpringBootDemoApplication.java | 8b4977d36eb275fc6ee7349ca085ba19fb340a9e | [
"MIT"
]
| permissive | Sicmatr1x/SpringBoot-Learn | 84d0390b3e2ac8c042c37dc14e8b04314ac0a64c | 931c23cf9d59e1d5b5cd2590f9a27c2f51fbcca9 | refs/heads/master | 2021-05-20T01:34:30.898648 | 2020-04-01T09:41:20 | 2020-04-01T09:41:20 | 252,130,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package com.sicmatr1x;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
// 本身就是spring的一个组件
@SpringBootApplication // 标志该类为springboot启动类
public class SpringBootDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootDemoApplication.class, args);
}
}
| [
"[email protected]"
]
| |
279c0bbdd8711ff7f9aba46c5a64a36fa537c116 | a4c9a0c0dcc19849867bfbd02b4b032a3c46e5a1 | /fcmq-web/src/main/java/com/danlu/web/controller/AIInfoController.java | 9a0652e2db6781292606cf742334ffb2828b7968 | []
| no_license | cz1986511/fcmq | b91d10073172b1d7e9fb1e351c2fa1ed683d7679 | aa984178710d2b864670b6aa30974eb84ccddafc | refs/heads/master | 2020-03-21T19:49:02.379226 | 2018-06-28T05:57:37 | 2018-06-28T05:57:37 | 138,971,411 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,492 | java | package com.danlu.web.controller;
import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.danlu.dleye.core.ArticleInfoManager;
import com.danlu.dleye.core.UserInfoManager;
import com.danlu.dleye.core.util.DleyeSwith;
import com.danlu.dleye.core.util.RedisClient;
import com.danlu.dleye.core.util.UserBaseInfo;
import com.danlu.dleye.persist.base.ArticleInfo;
@SuppressWarnings("deprecation")
@Controller
public class AIInfoController implements Serializable
{
private static final long serialVersionUID = -90859094251L;
private static Logger logger = LoggerFactory.getLogger(AIInfoController.class);
@Autowired
private UserInfoManager userManager;
@Autowired
private ArticleInfoManager articleInfoManager;
@Autowired
private DleyeSwith dleyeSwith;
@Autowired
private RedisClient redisClient;
@RequestMapping(value = "art_list", produces = "text/html;charset=UTF-8")
@ResponseBody
public String getArticleList(HttpServletRequest request)
{
Map<String, Object> result = new HashMap<String, Object>();
JSONObject json = new JSONObject(result);
String source = request.getParameter("source");
String tag = request.getParameter("tag");
String defaultKey = "dKey";
try
{
Map<String, Object> map = new HashMap<String, Object>();
if (!StringUtils.isBlank(source))
{
map.put("source", source);
defaultKey += source;
}
if (!StringUtils.isBlank(tag))
{
map.put("tag", tag);
defaultKey += tag;
}
map.put("offset", 0);
map.put("limit", dleyeSwith.getRequestSize());
List<ArticleInfo> resultList = (List<ArticleInfo>) redisClient.get(defaultKey,
new TypeReference<List<ArticleInfo>>()
{
});
if (!CollectionUtils.isEmpty(resultList))
{
result.put("data", resultList);
}
else
{
List<ArticleInfo> articleInfoList = articleInfoManager.getArticleInfosByParams(map);
if (!CollectionUtils.isEmpty(articleInfoList))
{
result.put("data", articleInfoList);
redisClient.set(defaultKey, articleInfoList, dleyeSwith.getEffectiveTime());
}
}
result.put("status", 0);
}
catch (Exception e)
{
logger.error("getArticleList is exception:" + e.toString());
result.put("status", 1);
result.put("msg", "程序小哥跟老板娘跑了");
}
return json.toJSONString();
}
@RequestMapping(value = "weather", produces = "text/html;charset=UTF-8")
@ResponseBody
public String getWeather(HttpServletRequest request)
{
Map<String, Object> result = new HashMap<String, Object>();
JSONObject json = new JSONObject(result);
String weather = "weather";
List<JSONObject> list = null;
try
{
list = (List<JSONObject>) redisClient.get(weather,
new TypeReference<List<JSONObject>>()
{
});
if (!CollectionUtils.isEmpty(list))
{
result.put("data", list);
}
else
{
list = new ArrayList<JSONObject>();
String citys = dleyeSwith.getCitys();
String[] cityStrings = citys.split(",");
for (int i = 0; i < cityStrings.length; i++)
{
JSONObject jsonObject = getWeatherNext(cityStrings[i]);
jsonObject.put("now", getWeatherNow(cityStrings[i]));
jsonObject.put("suggestion", getSuggestion(cityStrings[i]));
list.add(jsonObject);
}
result.put("data", list);
redisClient.set(weather, list, 3600);
}
result.put("status", 0);
}
catch (Exception e)
{
result.put("status", 1);
result.put("msg", "程序小哥跟老板娘跑了");
logger.error("getWeather is exception:" + e.toString());
}
return json.toJSONString();
}
@RequestMapping(value = "oilinfo", produces = "text/html;charset=UTF-8")
@ResponseBody
public String getOilInfo(HttpServletRequest request)
{
Map<String, Object> result = new HashMap<String, Object>();
JSONObject json = new JSONObject(result);
String oilKey = "oilKey";
JSONObject oilJson = null;
try
{
oilJson = (JSONObject) redisClient.get(oilKey, new TypeReference<JSONObject>()
{
});
if (!CollectionUtils.isEmpty(oilJson))
{
result.put("data", oilJson);
}
else
{
result.put("status", 1);
result.put("msg", "程序小哥跟老板娘跑了");
}
result.put("status", 0);
}
catch (Exception e)
{
result.put("status", 1);
result.put("msg", "程序小哥跟老板娘跑了");
logger.error("getOilInfo is exception:" + e.toString());
}
return json.toJSONString();
}
@RequestMapping(value = "user_address_list", produces = "text/html;charset=UTF-8")
@ResponseBody
public String getUserAddressList(HttpServletRequest request, HttpServletResponse response)
{
Map<String, Object> result = new HashMap<String, Object>();
JSONObject json = new JSONObject(result);
String token = request.getParameter("token");
String key = "user_address_list";
if (!StringUtils.isBlank(token) && dleyeSwith.getToken().equals(token))
{
List<UserBaseInfo> list = (List<UserBaseInfo>) redisClient.get(key,
new TypeReference<List<UserBaseInfo>>()
{
});
if (!CollectionUtils.isEmpty(list))
{
result.put("data", list);
result.put("status", 0);
}
else
{
result.put("status", 1);
result.put("msg", "缓存获取数据失败");
}
}
else
{
result.put("status", 1);
result.put("msg", "程序猿小哥跟老板娘跑了");
}
return json.toJSONString();
}
@SuppressWarnings({ "resource" })
private JSONObject getSuggestion(String city)
{
HttpClient httpClient = new DefaultHttpClient();
try
{
String restUrl = "https://api.seniverse.com/v3/life/suggestion.json?key=tl9ml0o784jsrc4h&language=zh-Hans&location=";
HttpGet getMethod = new HttpGet(restUrl + city);
HttpResponse response = httpClient.execute(getMethod);
if (null != response)
{
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode < 300)
{
String responseBody = EntityUtils.toString(response.getEntity(), "UTF-8");
JSONArray array = (JSONArray) JSON.parseObject(responseBody).get("results");
return array.getJSONObject(0).getJSONObject("suggestion");
}
}
}
catch (Exception e)
{
logger.error("getSuggestion is exception:" + e.toString());
}
finally
{
httpClient.getConnectionManager().shutdown();
}
logger.error("getSuggestion is null");
return null;
}
@SuppressWarnings({ "resource" })
private JSONObject getWeatherNow(String city)
{
HttpClient httpClient = new DefaultHttpClient();
try
{
String restUrl = "https://api.seniverse.com/v3/weather/now.json?key=tl9ml0o784jsrc4h&language=zh-Hans&unit=c&location=";
HttpGet getMethod = new HttpGet(restUrl + city);
HttpResponse response = httpClient.execute(getMethod);
if (null != response)
{
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode < 300)
{
String responseBody = EntityUtils.toString(response.getEntity(), "UTF-8");
JSONArray array = (JSONArray) JSON.parseObject(responseBody).get("results");
return array.getJSONObject(0).getJSONObject("now");
}
}
}
catch (Exception e)
{
logger.error("getSuggestion is exception:" + e.toString());
}
finally
{
httpClient.getConnectionManager().shutdown();
}
logger.error("getSuggestion is null");
return null;
}
@SuppressWarnings({ "resource" })
private JSONObject getWeatherNext(String city)
{
HttpClient httpClient = new DefaultHttpClient();
try
{
String restUrl = "https://api.seniverse.com/v3/weather/daily.json?key=tl9ml0o784jsrc4h&language=zh-Hans&unit=c&start=0&days=5&location=";
HttpGet getMethod = new HttpGet(restUrl + city);
HttpResponse response = httpClient.execute(getMethod);
if (null != response)
{
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode < 300)
{
String responseBody = EntityUtils.toString(response.getEntity(), "UTF-8");
JSONArray array = (JSONArray) JSON.parseObject(responseBody).get("results");
return array.getJSONObject(0);
}
}
}
catch (Exception e)
{
logger.error("getSuggestion is exception:" + e.toString());
}
finally
{
httpClient.getConnectionManager().shutdown();
}
logger.error("getSuggestion is null");
return null;
}
public static void main(String[] args)
{
SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String test = ft.format(new Date());
System.out.println(test);
}
}
| [
"[email protected]"
]
| |
83b38ae3b4f812327d66f75d62292562e9875c14 | f792e262c17885b6645c8ff9c53d9e85c85db745 | /src/com/mrheer/designpattern/strategypattern/OperationMultiply.java | bc5efbd4ccd6ec97b76dda708eec70f7739a3b19 | []
| no_license | MrHeer/DesignPattern | 6f33c8a3918cfaae80fd0a9f426b08688c038759 | 51cfbaf3b40a143ba87caa42d47685e45b347897 | refs/heads/master | 2021-08-27T16:33:42.280798 | 2021-08-23T04:00:02 | 2021-08-23T04:00:02 | 135,095,280 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 203 | java | package com.mrheer.designpattern.strategypattern;
public class OperationMultiply implements Strategy {
@Override
public int doOperation(int num1, int num2) {
return num1 * num2;
}
}
| [
"[email protected]"
]
| |
c7ab8dad4fbabc0ae879781ab8149fb8b3ee908e | b27fa64f1f74211ef626d580137fc859ed0537a9 | /src/main/java/xivvic/command/CommandExecutor.java | 101fcb8b5dc7d70c51884972f712343dc3a8f3aa | []
| no_license | crttcr/Messaging | b32b6e6a247721ef9fa8b8cf8c08a2493b0738bb | dcdacaba63feb54ed707861cb3eba7a8901cf8ec | refs/heads/master | 2016-08-11T15:05:09.614929 | 2016-04-12T19:49:33 | 2016-04-12T19:49:33 | 43,620,529 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 367 | java | package xivvic.command;
/**
* This interface is for the object that actually tries to execute a command.
* The {@link CommandProcessor} is responsible for all the ancillary housekeeping
* details around commands, but this interface represents the actual doer.
*
* @author Reid
*/
public interface CommandExecutor
{
CommandResult execute(Command command);
}
| [
"[email protected]"
]
| |
ec7558c60626dd25ceadfb8d4c92a4cd1e1c7916 | 77d2c1867716ce59a258435838462caacd64e517 | /app/src/main/java/com/google/fpl/liquidfun/World.java | 6ad0ceb6c55073696b44e1509ece919ae086c678 | []
| no_license | RiccardoGrieco/outta-my-circle | 8faed228797655c46be8a0762c9936a3f2508379 | a4791ab9100e985053babdc07f1db281e21faa0b | refs/heads/master | 2022-10-06T14:10:16.826673 | 2020-05-16T10:16:00 | 2020-05-16T10:16:00 | 204,888,252 | 2 | 0 | null | 2019-08-28T10:49:59 | 2019-08-28T08:49:59 | null | UTF-8 | Java | false | false | 3,267 | java | /* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.8
*
* Do not make changes to this file unless you know what you are doing--modify
* the SWIG interface file instead.
* ----------------------------------------------------------------------------- */
package com.google.fpl.liquidfun;
public class World {
private transient long swigCPtr;
protected transient boolean swigCMemOwn;
protected World(long cPtr, boolean cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = cPtr;
}
protected static long getCPtr(World obj) {
return (obj == null) ? 0 : obj.swigCPtr;
}
protected void finalize() {
delete();
}
public synchronized void delete() {
if (swigCPtr != 0) {
if (swigCMemOwn) {
swigCMemOwn = false;
liquidfunJNI.delete_World(swigCPtr);
}
swigCPtr = 0;
}
}
public World(float gravityX, float gravityY) {
this(liquidfunJNI.new_World(gravityX, gravityY), true);
}
public void setDebugDraw(Draw debugDraw) {
liquidfunJNI.World_setDebugDraw(swigCPtr, this, Draw.getCPtr(debugDraw), debugDraw);
}
public Body createBody(BodyDef def) {
long cPtr = liquidfunJNI.World_createBody(swigCPtr, this, BodyDef.getCPtr(def), def);
return (cPtr == 0) ? null : new Body(cPtr, false);
}
public void destroyBody(Body body) {
liquidfunJNI.World_destroyBody(swigCPtr, this, Body.getCPtr(body), body);
}
public void step(float timeStep, int velocityIterations, int positionIterations, int particleIterations) {
liquidfunJNI.World_step(swigCPtr, this, timeStep, velocityIterations, positionIterations, particleIterations);
}
public void drawDebugData() {
liquidfunJNI.World_drawDebugData(swigCPtr, this);
}
public int getBodyCount() {
return liquidfunJNI.World_getBodyCount(swigCPtr, this);
}
public ParticleSystem createParticleSystem(ParticleSystemDef def) {
long cPtr = liquidfunJNI.World_createParticleSystem(swigCPtr, this, ParticleSystemDef.getCPtr(def), def);
return (cPtr == 0) ? null : new ParticleSystem(cPtr, false);
}
public void setGravity(float gravityX, float gravityY) {
liquidfunJNI.World_setGravity(swigCPtr, this, gravityX, gravityY);
}
public void setContactListener(ContactListener listener) {
liquidfunJNI.World_setContactListener(swigCPtr, this, ContactListener.getCPtr(listener), listener);
}
public void queryAABB(QueryCallback callback, float xmin, float ymin, float xmax, float ymax) {
liquidfunJNI.World_queryAABB(swigCPtr, this, QueryCallback.getCPtr(callback), callback, xmin, ymin, xmax, ymax);
}
public Joint createJoint(JointDef def) {
long cPtr = liquidfunJNI.World_createJoint(swigCPtr, this, JointDef.getCPtr(def), def);
return (cPtr == 0) ? null : new Joint(cPtr, false);
}
public MouseJoint createMouseJoint(MouseJointDef def) {
long cPtr = liquidfunJNI.World_createMouseJoint(swigCPtr, this, MouseJointDef.getCPtr(def), def);
return (cPtr == 0) ? null : new MouseJoint(cPtr, false);
}
public void destroyJoint(Joint joint) {
liquidfunJNI.World_destroyJoint(swigCPtr, this, Joint.getCPtr(joint), joint);
}
}
| [
"[email protected]"
]
| |
c16f8ed7171b23bda88cb2540c280f3240b8540b | c8147ab634a1d0e318349e9bc882bac76822ec38 | /discovery-server/src/main/java/tk/thuy/discoveryserver/DiscoveryServerApplication.java | 98aa1234604421679cf4a2420657817f72ecf73c | []
| no_license | thuydx98/java_microservices | 1016c2f7a86e986e14a0a82fdacff3e5909f70b1 | 7231ab9396864c85bfd31f1977018140b8f858e1 | refs/heads/master | 2020-09-16T21:48:38.705652 | 2019-11-27T04:20:51 | 2019-11-27T04:20:51 | 223,896,654 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 441 | java | package tk.thuy.discoveryserver;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@EnableEurekaServer
@SpringBootApplication
public class DiscoveryServerApplication {
public static void main(String[] args) {
SpringApplication.run(DiscoveryServerApplication.class, args);
}
}
| [
"[email protected]"
]
| |
79b024c2bb7d09abb5a918ec290936379f2f4de8 | cd802154bdb20c898ca28e8e3545d5719c97672a | /src/com/ven/leetcode/june2021/challenge/MinimumNumberofRefuelingStops.java | 6150c1df487d6125fc3014900117e30bfcdab05f | []
| no_license | VenkateshManohar27/Leetcode | 8aee4476dca5b41dbfc075ba6632d5771a72da26 | 83f1cf8d2949187c6ffc9eb16d56e9446451ceec | refs/heads/master | 2022-02-19T15:21:38.798127 | 2022-02-12T09:36:01 | 2022-02-12T09:36:01 | 200,264,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,638 | java | package com.ven.leetcode.june2021.challenge;
import java.util.Comparator;
import java.util.PriorityQueue;
/**
* A car travels from a starting position to a destination which is target miles
* east of the starting position.
*
* Along the way, there are gas stations. Each station[i] represents a gas
* station that is station[i][0] miles east of the starting position, and has
* station[i][1] liters of gas.
*
* The car starts with an infinite tank of gas, which initially has startFuel
* liters of fuel in it. It uses 1 liter of gas per 1 mile that it drives.
*
* When the car reaches a gas station, it may stop and refuel, transferring all
* the gas from the station into the car.
*
* What is the least number of refueling stops the car must make in order to
* reach its destination? If it cannot reach the destination, return -1.
*
* Note that if the car reaches a gas station with 0 fuel left, the car can
* still refuel there. If the car reaches the destination with 0 fuel left, it
* is still considered to have arrived.
*
* Example 1:
*
* Input: target = 1, startFuel = 1, stations = [] Output: 0 Explanation: We can
* reach the target without refueling. Example 2:
*
* Input: target = 100, startFuel = 1, stations = [[10,100]] Output: -1
* Explanation: We can't reach the target (or even the first gas station).
* Example 3:
*
* Input: target = 100, startFuel = 10, stations =
* [[10,60],[20,30],[30,30],[60,40]] Output: 2 Explanation: We start with 10
* liters of fuel. We drive to position 10, expending 10 liters of fuel. We
* refuel from 0 liters to 60 liters of gas. Then, we drive from position 10 to
* position 60 (expending 50 liters of fuel), and refuel from 10 liters to 50
* liters of gas. We then drive to and reach the target. We made 2 refueling
* stops along the way, so we return 2.
*
*
* Note:
*
* 1 <= target, startFuel, stations[i][1] <= 10^9 0 <= stations.length <= 500 0
* < stations[0][0] < stations[1][0] < ... < stations[stations.length-1][0] <
* target
*
* @author Venkatesh Manohar
*
*/
public class MinimumNumberofRefuelingStops {
public int minRefuelStops(int target, int startFuel, int[][] stations) {
PriorityQueue<Integer> pq = new PriorityQueue<>(Comparator.reverseOrder());
int dist = startFuel;
int res = 0;
int i = 0;
while (true) {
while (i < stations.length && stations[i][0] <= dist) {
pq.add(stations[i][1]);
i++;
}
if (dist >= target)
return res;
if (pq.isEmpty())
return -1;
dist += pq.poll();
res++;
}
}
}
| [
"[email protected]"
]
| |
d766393ef003f6d37a5ae8cb90fe7cf1ea4e88aa | 56c5b0bf107ee58953fd7775770c67d65db3f366 | /root/src/bd/Specialty.java | 648283c4901bc6f34f20b4cc8c29036e91430189 | []
| no_license | Ricardo-Pinho/MPES | 218fed20c2368b79774b2c39617d4d9ed1a0b5e2 | 753b9795f6682d4c8b41a3696fed4b0516b36d1e | refs/heads/master | 2021-05-27T11:18:55.518492 | 2014-08-23T04:15:45 | 2014-08-23T04:15:45 | 23,247,596 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,275 | java | package bd;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Vector;
import java.util.concurrent.Semaphore;
import sun.org.mozilla.javascript.internal.ast.ForInLoop;
import tabusearch.MySolution;
import bd.Nurse;
public class Specialty implements Serializable, Cloneable {
/**
*
*/
private static final long serialVersionUID = 6874558605325900330L;
private String name;
private Vector<Vector<Integer>> daysAssign;
private Schedule schedule;
private Vector<Nurse> nurses;
private ArrayList<Constraint> constraints;
private Constraint[] cbd;
private Semaphore s;
public Specialty(String name){
this.setName(name) ;
constraints = new ArrayList<Constraint>();
initDaysAssigns();
setSchedule(new Schedule());
setNurses(new Vector<Nurse>());
s = new Semaphore(200, true);
}
/*public Specialty(Specialty spec){
this.setName(spec.name) ;
this.constraints = spec.constraints;
this.constraints=spec.constraints;
this.daysAssign=spec.daysAssign;
setSchedule(spec.schedule);
setNurses(spec.nurses);
s = spec.s;
}*/
public void save() {
// TODO Auto-generated method stub
cbd = constraints.toArray(new Constraint[constraints.size()]);
schedule.save();
}
public void load(){
constraints = new ArrayList(Arrays.asList(cbd));
schedule.load();
}
public Specialty() {
// TODO Auto-generated constructor stub
}
public Object clone() {
try
{
return super.clone();
}
catch(Exception e){ return null; }
}
private void initDaysAssigns(){
setDaysAssign(new Vector<Vector<Integer>>());
for(int i = 0 ; i < 7; i++){
Vector<Integer> t1 = new Vector<Integer>();
for(int j = 0 ; j < 3; j++){
t1.add(0);
}
getDaysAssign().add(t1);
}
}
public int getTotalConstraintNum()
{
int total = constraints.size();
for (int i = 0; i < nurses.size(); i++) {
total=total+nurses.get(i).getConstraints().size();
}
return total;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAssign(int day, int sift){
int result = -1;
if( day >= 0 && day <= 6 && sift >= 0 && sift <= 2){
result = getDaysAssign().get(day).get(sift);
}
return result;
}
public void setAssign(int day, int sift, int value){
if( day >= 0 && day <= 6 && sift >= 0 && sift <= 2){
Vector<Integer> t1 = getDaysAssign().get(day);
t1.set(sift, value);
//System.out.println("foi chamado com day " + day + " e sift " + sift + " e valor " + value);
getDaysAssign().set(day, t1);
}
}
public Vector<Vector<Integer>> getAssigns() {
// TODO Auto-generated method stub
return getDaysAssign();
}
public Schedule getSchedule() {
return schedule;
}
public void setSchedule(Schedule schedule) {
this.schedule = schedule;
}
public Vector<Vector<Integer>> getDaysAssign() {
return daysAssign;
}
public void setDaysAssign(Vector<Vector<Integer>> daysAssign) {
this.daysAssign = daysAssign;
}
public Vector<Nurse> getNurses() {
return nurses;
}
public void setNurses(Vector<Nurse> nurses) {
this.nurses = nurses;
}
public void addNurses(Nurse nurse) {
this.nurses.add(nurse);
}
public void removeNurse(Nurse nurse) {
// TODO Auto-generated method stub
for(int i = 0 ; i < nurses.size(); i++){
if(nurses.get(i).getName().equals(nurse.getName())){
nurses.remove(i);
return;
}
}
}
public double getTotalConstraintValue()
{
double score=0;
for (int i = 0; i < getConstraints().size(); i++) {
score=score+getConstraintValue(getConstraints().get(i));
}
for (int i = 0; i < getNurses().size(); i++) {
for (int k = 0; k < getNurses().get(i).getConstraints().size(); k++) {
score=score+getConstraintValue(getNurses().get(i).getConstraints().get(k));
}
}
return score;
}
public int getConstraint(int type){
for(int i = 0 ; i < constraints.size();i++){
if(constraints.get(i).getType() == type){
return constraints.get(i).getValue();
}
}
return 0;
}
public int setConstraint(int type, int value){
try {
s.acquire();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for(int i = 0 ; i < constraints.size();i++){
if(constraints.get(i).getType() == type){
if(value > 0){
constraints.get(i).setValue(value);
s.release();
return value;
}else{
constraints.remove(i);
s.release();
return 0;
}
}
}
if(value > 0){
constraints.add(new Constraint(type,value));
s.release();
return value;
}else{
s.release();
return 0;
}
}
public ArrayList<Nurse> getAssignedNurses(int day, int shift) {
// TODO Auto-generated method stub
return schedule.getAssigment(day, shift);
}
public ArrayList<Constraint> getConstraints() {
return constraints;
}
public void setConstraints(ArrayList<Constraint> constraints) {
this.constraints = constraints;
}
public boolean isConstraintSatisfied(Constraint i) {
switch(i.getType())
{
case 0: {
return true; //0 - Max Assigns (Specialty)
}
case 1: {
for (int j = 0; j < 7; j++) {
ArrayList<Nurse> nightnurses = getSchedule().getAssigment(j, 2);
for (int k = 0; k < nightnurses.size(); k++) {
if(j==6)
{
if(getSchedule().isAssigned(0,0,nightnurses.get(k)) ||
getSchedule().isAssigned(0,1,nightnurses.get(k)) ||
getSchedule().isAssigned(0,2,nightnurses.get(k)))
return false;
}
else{
if(getSchedule().isAssigned(j+1,0,nightnurses.get(k)) ||
getSchedule().isAssigned(j+1,1,nightnurses.get(k)) ||
getSchedule().isAssigned(j+1,2,nightnurses.get(k)))
return false;
}
}
}
return true; //All day break start with assigned shift at night
}
default: return false;
}
}
public boolean isConstraintSatisfied(Constraint i, Nurse nurse) {
switch(i.getType())
{
case 1: {
for (int j = 0; j < 7; j++) {
if(getSchedule().isAssigned(j,2,nurse))
{
if(j==6)
{}
else{
if(getSchedule().isAssigned(j+1,0,nurse) ||
getSchedule().isAssigned(j+1,1,nurse) ||
getSchedule().isAssigned(j+1,2,nurse))
return false;
}
}
}
return true; //All day break start with assigned shift at night
}
case 2: {
return true; //Time service (Nurse)
}
case 3: {
int assigns= 0;
for (int j = 0; j < 7; j++) {
for (int j2 = 0; j2 < 3; j2++) {
if(getSchedule().isAssigned(j,j2,nurse))
assigns++;
}
}
if(assigns>i.getValue())
return false;
else
return true; //Max Assigns (Nurse)
}
case 4: {
int mindays=0;
boolean assignedday=false;
for (int j = 0; j < 7; j++) {
for (int j2 = 0; j2 < 3; j2++) {
if(getSchedule().isAssigned(j,j2,nurse))
assignedday=true;
}
if(assignedday==true)
{
mindays++;
if(mindays>=i.getValue())
return true;
}
else
{
mindays=0;
}
}
return false; //Min Consecutive Days (Nurse) - ta a funcionar
}
case 5: {
int maxdays=0;
boolean assignedday=false;
for (int j = 0; j < 7; j++) {
assignedday=false;
for (int j2 = 0; j2 < 3; j2++) {
if(getSchedule().isAssigned(j,j2,nurse))
assignedday=true;
}
if(assignedday==true)
{
maxdays++;
if(maxdays>i.getValue())
return false;
}
else
{
maxdays=0;
}
}
return true; //Max Consecutive Days (Nurse) - ta a funcionar
}
case 6: {
int assignsday=0;
for (int j = 0; j < 7; j++) {
assignsday=0;
for (int j2 = 0; j2 < 3; j2++) {
if(getSchedule().isAssigned(j,j2,nurse))
assignsday++;
if(assignsday>i.getValue())
return false;
}
}
return true; //Max Assigns per Day (Nurse)
}
case 7: {
int leavedays=0;
boolean assignedday=false;
for (int j = 0; j < 7; j++) {
for (int j2 = 0; j2 < 3; j2++) {
if(getSchedule().isAssigned(j,j2,nurse))
assignedday=true;
}
if(assignedday==false)
{
leavedays++;
if(leavedays>i.getValue())
return false;
}
}
//if(leavedays==i.getValue())
return true; //Number of Break Days (Nurse)
//else
//return false;
}
default: return false;
}
}
public double evaluateSchedule() {
double score=0;
//System.out.println("Spec Constraints - "+solution.spec.getconstraints().length);
for (int i = 0; i < getConstraints().size(); i++) {
if(isConstraintSatisfied(getConstraints().get(i)))
{
//solution.constraints+="Constraint type "+solution.spec.getconstraints()[i].getType()+" for Specialty\n";
score=score+getConstraintValue(getConstraints().get(i));
}
}
for (int i = 0; i < getNurses().size(); i++) {
//System.out.println("Nurse Constraints - "+solution.spec.getNurses().get(i).getconstraints().length);
for (int k = 0; k < getNurses().get(i).getConstraints().size(); k++) {
if(isConstraintSatisfied(getNurses().get(i).getConstraints().get(k),getNurses().get(i)))
{
//solution.constraints+="Constraint type "+solution.spec.getNurses().get(i).getconstraints()[k].getType()+" for Nurse "+solution.spec.getNurses().get(i).getName()+"\n";
score=score+getConstraintValue(getNurses().get(i).getConstraints().get(k));
}
}
}
return score;
}
private double getConstraintValue(Constraint cont)
{
switch(cont.getType())
{
case 0: return 0; //0 - Max Assigns (Specialty)
case 1: return 3; //All day break start with assigned shift at night
case 2: return 0; //Time service (Nurse)
case 3: return 10; //Max Assigns (Nurse)
case 4: return 1; //Min Consecutive Days (Nurse)
case 5: return 5; //Max Consecutive Days (Nurse)
case 6: return 5; //Max Assigns per Day (Nurse)
case 7: return 5; //Number of Break Days (Nurse)
default: return 0;
}
}
public void switchShifts(Nurse nurse1, Nurse nurse2, int[] shift1,
int[] shift2) {
getSchedule().getAssigment(shift1[0], shift1[1]).remove(nurse1);
getSchedule().getAssigment(shift1[0], shift1[1]).add(nurse2);
getSchedule().getAssigment(shift2[0], shift2[1]).remove(nurse2);
getSchedule().getAssigment(shift2[0], shift2[1]).add(nurse1);
}
public int getNumberofAssigns() {
int total=0;
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 3; j++) {
total=total+daysAssign.get(i).get(j);
}
}
return total;
}
public void switchNurses(Nurse nurse1, Nurse nurse2, int[] shift1) {
getSchedule().getAssigment(shift1[0], shift1[1]).remove(nurse1);
getSchedule().getAssigment(shift1[0], shift1[1]).add(nurse2);
}
public void updateNurses(ArrayList<Nurse> nurses2) {
// TODO Auto-generated method stub
for(int i = 0 ; i < nurses.size(); i++){
for(int j = 0 ; j < nurses2.size(); j++){
if(nurses.get(i).getName().equals(nurses2.get(j).getName())){
nurses.set(i, nurses2.get(j));
break;
}
}
}
}
}
| [
"[email protected]"
]
| |
0760acfb7dd2491362d6e895825cd7afc9418c52 | ab1ea2f2da6d6d4c09067800cd578d10819da904 | /src/main/java/com/screenshot/screenshotdemo/demo/MyApplicationRunner.java | 9dd340088142010e863011e7cea6b8c5e4d7e0af | []
| no_license | xupeng7/screenShot | 77036300cd2e9bba790f6fef897159dd8df886bf | 8642dd8bbe3be8b2b34600840a9ca914858483d6 | refs/heads/master | 2021-06-16T04:12:36.789789 | 2019-07-04T10:41:24 | 2019-07-04T10:41:24 | 195,002,921 | 0 | 0 | null | 2021-04-26T19:18:21 | 2019-07-03T07:32:54 | Java | UTF-8 | Java | false | false | 439 | java | package com.screenshot.screenshotdemo.demo;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
@Component
public class MyApplicationRunner implements ApplicationRunner{
//项目启动后马上启动监听
@Override
public void run(ApplicationArguments args) throws Exception {
ImageListener.listenStart();
}
}
| [
"[email protected]"
]
| |
87f1ccec6bf7e6910356f3362aaf60e1c3c6ba80 | 5759a9920e8257f53ccab7f9a0daa39e8c3d1eb1 | /src/main/java/org/tommy/userservice/model/UserRepo.java | 6d84f8566744d50e478e9db78a52587450c42807 | []
| no_license | tomiok/simple-user-service | 6391c94ed8418f8c6b543ac3f550ab0a783134d1 | 394cbc2023ae473b02f3449a70e75c18c5a4a123 | refs/heads/master | 2020-04-11T20:34:36.840577 | 2018-12-17T18:56:31 | 2018-12-17T18:56:31 | 162,076,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 284 | java | package org.tommy.userservice.model;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
public interface UserRepo extends JpaRepository<User, Long> {
Optional<User> findByUsername(String username);
int deleteByUsername(String username);
} | [
"[email protected]"
]
| |
4b81656fdcdce1113a711e6ec9fbd785deca0389 | eec24d9778265679acbed7c4782d29b73381d729 | /src/com/selenium/practies/Stringss.java | aa26a45543dca2cd93cccc08a744f8c6efc2f258 | []
| no_license | narapareddyjannavarapu/amitkrgupta | 9cb24b4c462fdd62c738f1c2c02f1e87e7c52709 | 07133eabf7c37ad7ab719cb7d676f3dfc4b4ec22 | refs/heads/master | 2020-07-12T15:46:44.932176 | 2019-08-28T05:48:09 | 2019-08-28T05:48:09 | 204,856,035 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 32 | java | FirefoxDriver
FirefoxDriver
| [
"[email protected]"
]
| |
1280067d56a1811712eb6ec7bb67e420c1211699 | c9cf73543d7c81f8e87a58e051380e98e92f978a | /baseline/happy_trader/platform/client/clientHT/clientUI2/src/main/java/com/fin/httrader/webserver/HtHistoryProviders.java | a20ad8ebe09c929930f61759137a2b0e5e369c3c | []
| no_license | vit2000005/happy_trader | 0802d38b49d5313c09f79ee88407806778cb4623 | 471e9ca4a89db1b094e477d383c12edfff91d9d8 | refs/heads/master | 2021-01-01T19:46:10.038753 | 2015-08-23T10:29:57 | 2015-08-23T10:29:57 | 41,203,190 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,467 | java | /*
* HtHistoryProviders.java
*
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package com.fin.httrader.webserver;
import com.fin.httrader.configprops.HtHistoryProviderProp;
import com.fin.httrader.model.HtCommandProcessor;
import com.fin.httrader.utils.HtException;
import com.fin.httrader.utils.hlpstruct.HtPair;
import com.fin.httrader.utils.HtTimeCalculator;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Vector;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author Victor_Zoubok
*/
public class HtHistoryProviders extends HtServletsBase {
public String getContext() {
return this.getClass().getSimpleName();
}
/** Creates a new instance of HtHistoryProviders */
public HtHistoryProviders() {
}
public boolean initialize_Get(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
res.setContentType("text/html; charset=windows-1251");
forceNoCache(res);
try {
// generate new UID
this.generateUniquePageId();
readProviderProperty(req, null, false);
} catch (Throwable e) {
writeHtmlErrorToOutput(res, e);
return false;
}
return true;
}
public boolean initialize_Post(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
res.setContentType("text/html; charset=windows-1251");
forceNoCache(res);
try {
this.setUniquePageId(getStringParameter(req, "page_uid", false));
setStringSessionValue(getUniquePageId(), req, "provider_list", "");
setStringSessionValue(getUniquePageId(), req, "provider_classes", "");
setStringSessionValue(getUniquePageId(), req, "provider_parameters", "");
setStringSessionValue(getUniquePageId(), req, "export_hours", "");
setStringSessionValue(getUniquePageId(), req, "import_hours", "");
String operation = getStringParameter(req, "operation", false);
if (operation.equalsIgnoreCase("refresh_page")) {
// no-op
readProviderProperty(req, null, true);
} else if (operation.equalsIgnoreCase("apply_changes")) {
applyChanges(req);
readProviderProperty(req, null, true);
} else if (operation.equalsIgnoreCase("add_new_provider")) {
String new_provider = addNewProvider(req);
readProviderProperty(req, new_provider, false);
} else if (operation.equalsIgnoreCase("delete_provider")) {
deleteProvider(req);
readProviderProperty(req, null, false);
} else {
throw new HtException(getContext(), "initialize", "Invalid operation: " + operation);
}
} catch (Throwable e) {
writeHtmlErrorToOutput(res, e);
return false;
}
return true;
}
; //
private String addNewProvider(HttpServletRequest req) throws Exception {
// new provider name
String new_provider = getStringParameter(req, "new_provider", false);
Set<String> providers = HtCommandProcessor.instance().get_HtConfigurationProxy().remote_getRegisteredHistoryProvidersList();
if (providers.contains(new_provider)) {
throw new HtException(getContext(), "addNewProvider", "History Provider already exists: \"" + new_provider + "\"");
}
HtHistoryProviderProp prop = new HtHistoryProviderProp();
HtCommandProcessor.instance().get_HtConfigurationProxy().remote_setHistoryProviderProperty(new_provider, prop);
return new_provider;
}
private void deleteProvider(HttpServletRequest req) throws Exception {
String cur_provider = getStringParameter(req, "cur_provider", false);
Set<String> providers = HtCommandProcessor.instance().get_HtConfigurationProxy().remote_getRegisteredHistoryProvidersList();
if (!providers.contains(cur_provider)) {
throw new HtException(getContext(), "deleteProvider", "History Provider does not exist: \"" + cur_provider + "\"");
}
HtCommandProcessor.instance().get_HtConfigurationProxy().remote_removeHistoryProviderProperty(cur_provider);
// reset current provider
}
private void applyChanges(HttpServletRequest req) throws Exception {
// current provider - raise an exception if not found
String cur_provider = getStringParameter(req, "cur_provider", false);
// properies to update
//List<HtPair<String, String>> properties = getStringPairListParameter(req, "properties", true);
List<HtPair<String, String>> properties = ExportImportXGridUtils.getAsPropertiesList(getStringParameter(req, "properties", true));
// other parameters
HtHistoryProviderProp prop = HtCommandProcessor.instance().get_HtConfigurationProxy().remote_getHistoryProviderProperty(cur_provider);
String provider_class = getStringParameter(req, "provider_class", false);
Map< String, File > classes = HtCommandProcessor.instance().get_HtHistoryDsourceProxy().remote_queryAvailableProviders();
if (!classes.containsKey(provider_class)) {
throw new HtException(getContext(), "applyChanges", "Class: \"" + provider_class + "\" is not valid History Provider class");
}
prop.setProviderClass(provider_class);
//
prop.setExportHourShift( (int)getIntParameter(req, "export_hour_shift", false));
prop.setImportHourShift((int)getIntParameter(req, "import_hour_shift", false));
prop.getParameters().clear();
for (int i = 0; i < properties.size(); i++) {
HtPair<String, String> entry = properties.get(i);
if (entry.first != null && entry.first.length() > 0) {
prop.getParameters().put(entry.first, entry.second);
} else {
throw new HtException(getContext(), "applyChanges", "Invalid parameter entry");
}
}
// save
HtCommandProcessor.instance().get_HtConfigurationProxy().remote_setHistoryProviderProperty(cur_provider, prop);
}
private void readProviderProperty(HttpServletRequest req, String cur_provider_passed, boolean read_param) throws Exception {
// list of providers
Set<String> providers = HtCommandProcessor.instance().get_HtConfigurationProxy().remote_getRegisteredHistoryProvidersList();
// list is empty
if (providers.size() <= 0) {
return;
}
// current provider:
String cur_provider = null;
if (cur_provider_passed == null) {
if (read_param) {
cur_provider = getStringParameter(req, "cur_provider", true);
}
} else {
cur_provider = cur_provider_passed;
}
// fisr parameter if no current
if (cur_provider == null || cur_provider.length() <= 0) {
cur_provider = (String) providers.toArray()[0];
}
// provider property
HtHistoryProviderProp prop = HtCommandProcessor.instance().get_HtConfigurationProxy().remote_getHistoryProviderProperty(cur_provider);
setStringSessionValue(getUniquePageId(), req, "provider_list", HtWebUtils.createOptionList(cur_provider, providers, false));
StringBuilder out = new StringBuilder();
Map< String, File > classes = HtCommandProcessor.instance().get_HtHistoryDsourceProxy().remote_queryAvailableProviders();
String resolvedProviderClass = null;
for (Iterator<String> it =classes.keySet().iterator(); it.hasNext();) {
String value = it.next();
boolean is_internal = (classes.get(value)==null);
String style_str = (is_internal ? "background-color:khaki" : "");
if (value.equals(prop.getProviderClass())) {
out.append("<option selected invalid=false style='").append(style_str).append("'>").append(value).append("</option>");
resolvedProviderClass = prop.getProviderClass();
} else {
out.append("<option invalid=false style='").append(style_str).append("'>").append(value).append("</option>");
}
}
// if the class not found
if (resolvedProviderClass == null) {
// only if we have initialized one
if (prop.getProviderClass().length() > 0) {
out.append("<option selected style='background-color:orange' invalid=true>").append(prop.getProviderClass()).append(" - ???</option>");
}
}
setStringSessionValue(getUniquePageId(), req, "provider_classes", out.toString());
setStringSessionValue(getUniquePageId(), req, "provider_parameters", HtWebUtils.createHtmlParametersTable(prop.getParameters()));
// export import hours
setStringSessionValue(getUniquePageId(), req, "export_hours", HtWebUtils.createOptionListFromRange(-12,12,prop.getExportHourShift()));
setStringSessionValue(getUniquePageId(), req, "import_hours", HtWebUtils.createOptionListFromRange(-12,12,prop.getImportHourShift()));
}
}
| [
"[email protected]"
]
| |
94475afe539a8bf3a7d72eac50ff2529e16595d1 | d92a84e690532743553d358271e49ec9a2f58b40 | /internet-core/src/main/java/com/internet/cms/model/search/DocRecord.java | 982b184da6481d84b9f619f9f3fcfb2a3e5dabab | []
| no_license | zengzebin/radar | cc49ec01c273ad388d9d964afe1c8cbb77823a8e | f8787061619cff65e4a73dbec749fefff8baba4c | refs/heads/master | 2020-03-17T16:25:36.214902 | 2018-05-17T02:47:26 | 2018-05-17T02:47:26 | 133,748,183 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 700 | java | package com.internet.cms.model.search;
/**
* 文档实体类
*
* @author Administrator
*
*/
public class DocRecord {
private int id;
private String fileName;
private String docType;
private long lastModify;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getDocType() {
return docType;
}
public void setDocType(String docType) {
this.docType = docType;
}
public long getLastModify() {
return lastModify;
}
public void setLastModify(long lastModify) {
this.lastModify = lastModify;
}
}
| [
"[email protected]"
]
| |
b04e199abd9e2bc1119471dc701b875f42a780cf | cbdac3f52087bcf810ac5169c65bcaeca08af232 | /contactsapp/src/main/java/com/contacts/resources/AuthorizationResource.java | c31b54790039e5519c215268361920ec9d638222 | []
| no_license | VaishnaviParthasarathy/jax-rs | 0be97c39737bf44fd924ad3d9bb3e3256d04e17b | d2b30bef7bccaac4df4c05566d32ec2b46f8778c | refs/heads/master | 2020-03-15T14:25:47.294501 | 2018-05-04T21:24:12 | 2018-05-04T21:24:12 | 132,189,833 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,105 | java | package com.contacts.resources;
import java.net.URI;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
import org.glassfish.jersey.client.oauth2.OAuth2CodeGrantFlow;
import org.glassfish.jersey.client.oauth2.TokenResult;
import com.contacts.service.SimpleOAuthService;
@Path("oauth2")
public class AuthorizationResource {
@Context
private UriInfo uriInfo;
@GET
@Path("authorize")
public Response authorize(@QueryParam("code") String code, @QueryParam("state") String state) {
final OAuth2CodeGrantFlow flow = SimpleOAuthService.getFlow();
final TokenResult tokenResult = flow.finish(code, state);
SimpleOAuthService.setAccessToken(tokenResult.getAccessToken());
// authorization is finished -> now redirect back to the task resource
final URI uri = UriBuilder.fromUri(uriInfo.getBaseUri()).path("contact").build();
return Response.seeOther(uri).build();
}
}
| [
"[email protected]"
]
| |
9fbde1d050a481c82c5423c20b1304d1d14a9eeb | 59c7b8aa3a6a50691b4aebb94e6cbd50dd5fed4b | /app/src/main/java/koiapp/pr/com/koiapp/fcm/MyFirebaseMessagingService.java | 373b2f96a9df8b98de30d43235b6248f6fb17027 | []
| no_license | trantuananh1996/forYourKids | 59edba92581b8bba22dca3e355523d53d5619d84 | a92eb82f585db13017348aed53bcbf9342a5d2f7 | refs/heads/master | 2021-08-31T14:32:50.663108 | 2017-12-21T17:26:23 | 2017-12-21T17:26:23 | 109,353,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,553 | java | package koiapp.pr.com.koiapp.fcm;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.Vibrator;
import android.support.v4.app.NotificationCompat;
import android.text.TextUtils;
import android.view.View;
import android.widget.RemoteViews;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.Map;
import java.util.Random;
import koiapp.pr.com.koiapp.R;
import koiapp.pr.com.koiapp.activity.ActivityStart;
import koiapp.pr.com.koiapp.model.ItemNotification;
import koiapp.pr.com.koiapp.moduleAdmin.activity.ActivityDashboardAdmin;
import koiapp.pr.com.koiapp.moduleManager.activity.ActivityDashboardManager;
import koiapp.pr.com.koiapp.utils.DateTimeUtils;
import koiapp.pr.com.koiapp.utils.debug.Debug;
import static koiapp.pr.com.koiapp.model.ItemNotification.TYPE_HAS_NEW_MESSAGE;
import static koiapp.pr.com.koiapp.model.ItemNotification.TYPE_NEW_REGISTER_LEARN;
import static koiapp.pr.com.koiapp.model.ItemNotification.TYPE_NEW_REGISTER_MANAGER;
import static koiapp.pr.com.koiapp.model.ItemNotification.TYPE_NEW_REQUEST_CHANGE_ROLE;
import static koiapp.pr.com.koiapp.model.ItemNotification.TYPE_REGISTER_LEARN_ACCEPTED;
import static koiapp.pr.com.koiapp.model.ItemNotification.TYPE_REGISTER_MANAGER_ACCEPTED;
import static koiapp.pr.com.koiapp.model.ItemNotification.TYPE_REQUEST_CHANGE_ROLE_ACCEPTED;
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG = MyFirebaseMessagingService.class.getName();
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Debug.prLog(TAG, "From: " + remoteMessage.getFrom());
Debug.prLog(TAG, "Notification Message Body: " + remoteMessage.getData());
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null) {//User hiện đang đăng nhập
ItemNotification itemNotification = createItemNotification(remoteMessage.getData());
if (itemNotification != null) {//Lấy được notification về
if (itemNotification.getUserId().equals(user.getUid())) {//Notification này là của user này
prepareNotification(itemNotification);
}
}
}
}
private void prepareNotification(ItemNotification remoteMessage) {
Intent launchIntent = new Intent(this, ActivityStart.class);
switch (remoteMessage.getType()) {
case TYPE_NEW_REGISTER_LEARN:
launchIntent = new Intent(this, ActivityDashboardManager.class);
break;
case TYPE_NEW_REGISTER_MANAGER:
launchIntent = new Intent(this, ActivityDashboardAdmin.class);
break;
case TYPE_NEW_REQUEST_CHANGE_ROLE:
launchIntent = new Intent(this, ActivityDashboardAdmin.class);
break;
case TYPE_REGISTER_LEARN_ACCEPTED:
break;
case TYPE_REGISTER_MANAGER_ACCEPTED:
break;
case TYPE_REQUEST_CHANGE_ROLE_ACCEPTED:
break;
case TYPE_HAS_NEW_MESSAGE:
break;
default:
break;
}
sendNotification(launchIntent, remoteMessage);
}
private RemoteViews createRemoteView(ItemNotification itemNotification) {
RemoteViews remoteViews = new RemoteViews(getPackageName(),
R.layout.item_notification_builder);
remoteViews.setTextViewText(R.id.tv_title, itemNotification.getTitle());
if (TextUtils.isEmpty(itemNotification.getSubtitle()))
remoteViews.setViewVisibility(R.id.tv_content, View.GONE);
else {
remoteViews.setViewVisibility(R.id.tv_content, View.VISIBLE);
remoteViews.setTextViewText(R.id.tv_content, itemNotification.getSubtitle());
}
String time = DateTimeUtils.getFormatedDateTime(DateTimeUtils.HH_mm, itemNotification.getTime());
remoteViews.setTextViewText(R.id.tv_time, time);
remoteViews.setImageViewResource(R.id.iv_icon, R.mipmap.ic_launcher);
return remoteViews;
}
private void sendNotification(Intent launchIntent, final ItemNotification remoteMessage) {
PendingIntent pendingIntent;
pendingIntent = PendingIntent.getActivity(getApplicationContext(), new Random().nextInt(), launchIntent, Intent.FILL_IN_ACTION);
RemoteViews remoteViews = createRemoteView(remoteMessage);
final int notificationId;
notificationId = new Random().nextInt();
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_launcher)
.setContent(remoteViews)
.setCustomBigContentView(remoteViews)
.setAutoCancel(true)
.setLights(0xff82c3e3, 1000, 500)
.setContentIntent(pendingIntent);
notificationBuilder.setSound(defaultSoundUri);
final NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
final Notification notification = notificationBuilder.build();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
notificationBuilder.setPriority(Notification.PRIORITY_HIGH);
}
notificationManager.notify(notificationId, notification);
Vibrator vibrator = (Vibrator) getApplicationContext().getSystemService(Context.VIBRATOR_SERVICE);
vibrator.vibrate(new long[]{0, 300, 100, 300}, -1);
}
private ItemNotification createItemNotification(Map<String, String> remoteMessage) {
ItemNotification item;
Type item_type = new TypeToken<Map<String, Object>>() {
}.getType();
String json = new Gson().toJson(remoteMessage, item_type);
item = new Gson().fromJson(json, ItemNotification.class);
return item;
}
} | [
"[email protected]"
]
| |
e73bf4311e5d643c154a0f915823b8bfd874f81d | 307a0efebf2d29c137e2a8e9908c3c78d0bd2339 | /src/com/goodhouse/house_track/model/HouseTrackDAO_interface.java | c1b6b4589801ec939321ec7cf6694e877675fa77 | []
| no_license | CA106no2/GoodHouse | f1dd9cbbe81ad75518a68c6ac25d3bd219450046 | b0e4161b6bf3e4d0b9c902f7489ed6d6307f1738 | refs/heads/master | 2020-04-22T03:23:33.913107 | 2019-02-12T14:01:46 | 2019-02-12T14:01:46 | 170,085,048 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package com.goodhouse.house_track.model;
import java.util.*;
public interface HouseTrackDAO_interface {
public void insert(HouseTrackVO houTraVO);
public void update(HouseTrackVO houTraVO);
public void delete(HouseTrackVO houTraVO);
public HouseTrackVO findByPrimaryKey(String houTraId);
public List<HouseTrackVO> getAll();
}
| [
"Lily@LAPTOP-3R354TV7"
]
| Lily@LAPTOP-3R354TV7 |
515f3543f5a08efded3e2e60c68efe4b8ca0c3b4 | 756a071626c715a9f9a7381fddf7d28d17105d15 | /core/src/main/java/hudson/util/io/ReopenableFileOutputStream.java | 27d53bcfa691278ef614e6d69ba0db84bcd01e2c | [
"MIT"
]
| permissive | aeris/jenkins | 11fa1eaabaa580adb4e6fae17b5f1faea58cfb1c | c9e3f4fa528c805aa35604e70684a2b8ccfd41f8 | refs/heads/master | 2021-01-17T06:57:46.033448 | 2011-03-26T23:02:31 | 2011-03-26T23:03:35 | 1,531,045 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,015 | java | /*
* The MIT License
*
* Copyright (c) 2010, CloudBees, Inc.
*
* 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 hudson.util.io;
import hudson.util.IOException2;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* {@link OutputStream} that writes to a file.
*
* <p>
* Unlike regular {@link FileOutputStream}, this implementation allows the caller to close,
* and then keep writing.
*
* @author Kohsuke Kawaguchi
*/
public class ReopenableFileOutputStream extends OutputStream {
private final File out;
private OutputStream current;
private boolean appendOnNextOpen = false;
public ReopenableFileOutputStream(File out) {
this.out = out;
}
private synchronized OutputStream current() throws IOException {
if (current==null)
try {
current = new FileOutputStream(out,appendOnNextOpen);
} catch (FileNotFoundException e) {
throw new IOException2("Failed to open "+out,e);
}
return current;
}
@Override
public void write(int b) throws IOException {
current().write(b);
}
@Override
public void write(byte[] b) throws IOException {
current().write(b);
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
current().write(b, off, len);
}
@Override
public void flush() throws IOException {
current().flush();
}
@Override
public synchronized void close() throws IOException {
if (current!=null) {
current.close();
appendOnNextOpen = true;
current = null;
}
}
/**
* In addition to close, ensure that the next "open" would truncate the file.
*/
public synchronized void rewind() throws IOException {
close();
appendOnNextOpen = false;
}
}
| [
"[email protected]"
]
| |
d35df9e7446853f00f93b5b064608b2f09574814 | 40053db73fbd734f6cdd602b0a0375f3d7be107b | /Loop/src/ShowPrimes.java | f74d58c6086e07a4267a0a449c765df895fd5803 | []
| no_license | nguyennhi19/Module-2 | 781b43845cbcbd24352d4696dee2f9a4c82cb347 | e87f62681dd616d8b8b94fddeab4ca6b20f06ad3 | refs/heads/master | 2023-06-10T14:46:52.828570 | 2021-07-08T17:48:29 | 2021-07-08T17:48:29 | 361,957,900 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 422 | java | package src;
public class ShowPrimes {
public static void main(String[] args) {
int num =2;
int count =0;
while (num<100){
int check =0;
for(int i=2;i<num;i++){
if(num%i==0){
check++;
}
}if(check==0){
System.out.println(num);
count++;
}num++;
}
}
}
| [
"[email protected]"
]
| |
41ceeae79fc26356f7e2b4113fffa653b9e2601e | 290db97fb31d790f234c23cd8baaa5073fca47ca | /src/main/java/com/caoyucheng/community/enums/CommentTypeEnum.java | fe948c40269c0673b66227e21529b1d4092cb164 | []
| no_license | caoyucheng/community | be62dd35bbf21d262e7771fc538d0c50f032c5fe | 4249cbbc5df5c88959f56b0adab1d4dbc76eb1e5 | refs/heads/master | 2022-12-01T06:25:53.975096 | 2020-08-12T14:14:13 | 2020-08-12T14:14:13 | 281,356,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 573 | java | package com.caoyucheng.community.enums;
/**
* @author caoyucheng on 2020/8/6
*/
public enum CommentTypeEnum {
QUESTION(1),
COMMENT(2);
private final Integer type;
public Integer getType() {
return type;
}
CommentTypeEnum(Integer type) {
this.type = type;
}
public static boolean isExist(Integer type) {
for (CommentTypeEnum commentTypeEnum : CommentTypeEnum.values()) {
if (commentTypeEnum.getType().equals(type)) {
return true;
}
}
return false;
}
}
| [
"[email protected]"
]
| |
a9a011f4b22bff2bda5e4ccaf893b0660a84e8f2 | a48414ebcb1e3f9021bbc4e00bd9dc832429ca50 | /src/com/emrc_triagetag/PhotoViewActivity.java | c8976cc868a944b2200aa6750baee730ec349ed9 | []
| no_license | xinooo/EMRC_TRIAGETAG | 131a392d34ede704e9caa2b5a341ba2d39643e03 | a1f28a9d18483c1bbbf660892be4f58cb2d08365 | refs/heads/master | 2022-04-18T05:30:20.522319 | 2020-04-18T13:27:00 | 2020-04-18T13:27:00 | 256,754,250 | 0 | 0 | null | null | null | null | BIG5 | Java | false | false | 3,926 | java | package com.emrc_triagetag;
import java.util.ArrayList;
import java.util.List;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView.ScaleType;
public class PhotoViewActivity extends Activity {
private ViewPager pager;
private List<View> view_list;
private ArrayList<ZoomImage> zoom_list = new ArrayList<ZoomImage>();
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.item_4_viewpager);
findViewById();
addTab();
}
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
finish();
}
return false;
}
private void findViewById() {
pager = (ViewPager) findViewById(R.id.photo_pager);
}
@SuppressLint("InflateParams")
@SuppressWarnings("static-access")
private void addTab() {
// 設置頁面
view_list = new ArrayList<View>();
LayoutInflater mInflater = getLayoutInflater().from(this);
View v = mInflater.inflate(R.layout.item_0_info_img_view, null);
View v2 = mInflater.inflate(R.layout.item_0_info_img_view, null);
View v4 = mInflater.inflate(R.layout.item_0_info_img_view, null);
View v8 = mInflater.inflate(R.layout.item_0_info_img_view, null);
View v16 = mInflater.inflate(R.layout.item_0_info_img_view, null);
View v32 = mInflater.inflate(R.layout.item_0_info_img_view, null);
view_list.add(v);
view_list.add(v2);
view_list.add(v4);
view_list.add(v8);
view_list.add(v16);
view_list.add(v32);
if (PhotoActivity.i00) {
BitmapDrawable drawable = (BitmapDrawable) PhotoActivity.item_0_img_0.getDrawable();
Bitmap bitmap = drawable.getBitmap();
ZoomImage iv = (ZoomImage) view_list.get(0).findViewById(R.id.imgview);
iv.setImageBitmap(bitmap);
iv.setScaleType(ScaleType.FIT_CENTER);
zoom_list.add(iv);
}
if (PhotoActivity.i01) {
BitmapDrawable drawable = (BitmapDrawable) PhotoActivity.item_0_img_1.getDrawable();
Bitmap bitmap = drawable.getBitmap();
ZoomImage iv = (ZoomImage) view_list.get(1).findViewById(R.id.imgview);
iv.setImageBitmap(bitmap);
iv.setScaleType(ScaleType.FIT_CENTER);
zoom_list.add(iv);
}
if (PhotoActivity.i10) {
BitmapDrawable drawable = (BitmapDrawable) PhotoActivity.item_1_img_0.getDrawable();
Bitmap bitmap = drawable.getBitmap();
ZoomImage iv = (ZoomImage) view_list.get(2).findViewById(R.id.imgview);
iv.setImageBitmap(bitmap);
iv.setScaleType(ScaleType.FIT_CENTER);
zoom_list.add(iv);
}
if (PhotoActivity.i11) {
BitmapDrawable drawable = (BitmapDrawable) PhotoActivity.item_1_img_1.getDrawable();
Bitmap bitmap = drawable.getBitmap();
ZoomImage iv = (ZoomImage) view_list.get(3).findViewById(R.id.imgview);
iv.setImageBitmap(bitmap);
iv.setScaleType(ScaleType.FIT_CENTER);
zoom_list.add(iv);
}
if (PhotoActivity.i20) {
BitmapDrawable drawable = (BitmapDrawable) PhotoActivity.item_2_img_0.getDrawable();
Bitmap bitmap = drawable.getBitmap();
ZoomImage iv = (ZoomImage) view_list.get(4).findViewById(R.id.imgview);
iv.setImageBitmap(bitmap);
iv.setScaleType(ScaleType.FIT_CENTER);
zoom_list.add(iv);
}
if (PhotoActivity.i21) {
BitmapDrawable drawable = (BitmapDrawable) PhotoActivity.item_2_img_1.getDrawable();
Bitmap bitmap = drawable.getBitmap();
ZoomImage iv = (ZoomImage) view_list.get(5).findViewById(R.id.imgview);
iv.setImageBitmap(bitmap);
iv.setScaleType(ScaleType.FIT_CENTER);
zoom_list.add(iv);
}
// 建立配適器
MyPagerAdapter myPagerAdapter = new MyPagerAdapter(view_list);
pager.setAdapter(myPagerAdapter);
pager.setCurrentItem(PhotoActivity.getSelect()); // 設置起始頁
}
} | [
"[email protected]"
]
| |
4aa7a61a48a80d97c71babfdae6b5902b8e554b3 | fe44962fa5f266610c704f61a74fa62cbad7628c | /src/main/java/com/tianling/springsecurity/validate/sms/SmsCodeAuthenticationProvider.java | 919a354bd1416fd51c28544c425d03198a34fcc0 | []
| no_license | lhq2573361854/springseurity | d01ecc39555119a42cb8d97c535f9864aecbff6c | 8dbef97fb784994a4177d20cfac81791ff220de4 | refs/heads/master | 2022-12-25T07:31:54.265047 | 2020-07-15T00:22:41 | 2020-07-15T00:22:41 | 279,721,311 | 0 | 0 | null | 2020-10-13T23:34:57 | 2020-07-15T00:19:55 | Java | UTF-8 | Java | false | false | 1,809 | java | package com.tianling.springsecurity.validate.sms;
import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.authentication.InternalAuthenticationServiceException;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
/**
* @author: TianLing
* @Year: 2020
* @DateTime: 2020/6/26 14:12
*/
public class SmsCodeAuthenticationProvider implements AuthenticationProvider {
private UserDetailsService userDetailsService;
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
SmsCodeAuthenticationToken authenticationToken = (SmsCodeAuthenticationToken) authentication;
UserDetails userDetails = userDetailsService.loadUserByUsername((String) authentication.getPrincipal());
if (userDetails == null) {
throw new InternalAuthenticationServiceException("无法获取用户信息");
}
SmsCodeAuthenticationToken authenticationTokenResult = new SmsCodeAuthenticationToken(userDetails,authenticationToken.getAuthorities());
authenticationTokenResult.setDetails(authenticationToken.getDetails());
return authenticationTokenResult;
}
@Override
public boolean supports(Class<?> aClass) {
return SmsCodeAuthenticationToken.class.isAssignableFrom(aClass);
}
public UserDetailsService getUserDetailsService() {
return userDetailsService;
}
public void setUserDetailsService(UserDetailsService userDetailsService) {
this.userDetailsService = userDetailsService;
}
}
| [
"[email protected]"
]
| |
65656b62911e9aa031d75c397fa60d2334814d83 | 0cfb9b7a1e0241be4935e9a90e2c1023c2d340de | /src/main/java/com/carvendy/test/TestInteger.java | 0c316aa99cfaa13681185945419842b01957ef5a | []
| no_license | carvendy/carvendy-demo | 597f76797200a99bb7959d3bd82a1589f14c4ab7 | 4a376c8ee9efd2a0344742e97a8428232cbf8df2 | refs/heads/master | 2020-05-30T08:00:41.961418 | 2017-12-08T03:51:28 | 2017-12-08T03:51:28 | 46,779,282 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 224 | java | package com.carvendy.test;
public class TestInteger {
public static void main(String[] args) {
System.out.println(Integer.MAX_VALUE);
System.out.println(Integer.MIN_VALUE);
System.out.println(Integer.TYPE);
}
}
| [
"[email protected]"
]
| |
081e595ba9977dd64488bf6ff7560df18e4fd0af | f86b2e5aec4235de0b1e619c71ed542a2f306483 | /zuzhili/src/com/zuzhili/model/Item.java | 05bf74e4d091872e1d869ca8866e60beb95021e1 | []
| no_license | goo4it/zuzhili_android | 1ba381eb82ab8f7c4c35fdc6e4c48ce565da8812 | c8e2f0538bc960f1634598a8da01041d3e381420 | refs/heads/master | 2020-12-28T23:16:00.196341 | 2015-03-02T23:28:08 | 2015-03-02T23:28:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 206 | java | package com.zuzhili.model;
public class Item {
public String mTitle;
public int mIconRes;
public Item(String title, int iconRes) {
mTitle = title;
mIconRes = iconRes;
}
}
| [
"[email protected]"
]
| |
5abbe17921b1945cefaa37d493f43ac2335c7507 | dca8479e7af38ecd742ee2b3328a896702edfd3a | /victorvalley/src/com/bcits/bfm/model/Requisition.java | fc0489ddd4054c49f62601f650117e4ba5225c91 | []
| no_license | praveenkumar11nov/GitHub_VV | a0c1950333f163e08679af4e74cc0aeaca8e528d | f35199213ca10bbf5f0119d031f40374afd35650 | refs/heads/master | 2020-03-19T09:57:25.591863 | 2018-06-06T13:11:03 | 2018-06-06T13:11:03 | 136,330,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,113 | java | package com.bcits.bfm.model;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
/**
* Requisition entity. @author MyEclipse Persistence Tools
*/
@SuppressWarnings("serial")
@Entity
@Table(name = "REQUISITIONS")
@NamedQueries
({
@NamedQuery(name="Requisition.findAll",query="SELECT r FROM Requisition r WHERE r.reqId!=1 AND r.reqId!=2 ORDER BY r.reqId DESC"),
@NamedQuery(name="ReadVendors.findAll",query="SELECT p.personId,p.firstName, p.lastName FROM Vendors v INNER JOIN v.person p"),
@NamedQuery(name = "Requisition.UpdateStatus",query="UPDATE Requisition r SET r.status = :status WHERE r.reqId = :reqId"),
@NamedQuery(name = "Requisition.getRequisitionName", query = "SELECT r.reqName FROM Requisition r"),
@NamedQuery(name="Req.getDepartmentDeatils",query="SELECT d.dept_Id,p.personId,p.firstName,p.lastName,u.urLoginName,d.dept_Name FROM Department d,Users u,Person p WHERE u.deptId=d.dept_Id AND u.personId=p.personId AND p.personId!=1"),
@NamedQuery(name="Req.getDepartmentDeatilsEqualToOne",query="SELECT d.dept_Id,p.personId,p.firstName,p.lastName,u.urLoginName,d.dept_Name FROM Department d,Users u,Person p WHERE u.deptId=d.dept_Id AND u.personId=p.personId AND p.personId=1"),
//for reading requisitionDetails if reqId found in child also
@NamedQuery(name="Requisition.readReqDetailsIfReqIdExists",query="SELECT r FROM Requisition r,RequisitionDetails rd WHERE r.reqId = rd.requisitionId"),
@NamedQuery(name="RequisitionDetails.getReqTypeBasedOnReqId",query="SELECT r.reqType,r.reqDate FROM Requisition r where r.reqId=:reqid"),
@NamedQuery(name="Requisition.getAllRequiredRequisitionFields",
query="select p.firstName,p.lastName,p.personId,v.vendorId,d.dept_Id,d.dept_Name, r.reqId, r.reqName,r.reqDescription, r.reqType, r.reqDate, r.reqByDate,r.drGroupId,r.reqVendorQuoteRequisition,r.status,r.createdBy,r.lastUpdatedBy,r.lastUpdatedDt,vp.firstName,vp.lastName,st.storeId,st.storeName From Requisition r INNER JOIN r.department d INNER JOIN r.person p INNER JOIN r.vendors v INNER JOIN v.person vp INNER JOIN r.storeMaster st ORDER BY r.reqId DESC"),
@NamedQuery(name="Requisition.findParentIdExistenceinChild",query="SELECT rd.requisitionId FROM Requisition r,RequisitionDetails rd WHERE rd.requisitionId=:idVal"),
@NamedQuery(name="Requisition.getManpowerCount",query = "select rd from RequisitionDetails rd, Requisition r where rd.requisitionId = r.reqId and r.reqType = 'Manpower' and r.reqByDate>=SYSDATE and rd.rdQuantity > rd.reqFulfilled"),
@NamedQuery(name="Requisition.getManpowerReqVC",query = "select vc from VendorContracts vc where vc.requisition.reqType = 'Manpower' and vc.requisition.status='PO Placed' and vc.requisition.reqByDate >= SYSDATE and vc.status='Approved'"),
@NamedQuery(name="Requisition.getManpowerReq",query = "select r from Requisition r where r.reqType = 'Manpower' and r.status='Approved' and r.reqByDate >= SYSDATE-1"),
@NamedQuery(name="Requisition.getReqDetails",query = "select rd from RequisitionDetails rd where rd.rdQuantity > rd.reqFulfilled and rd.requisitionId=:reqId"),
@NamedQuery(name="Req.getDummyDepartmentDeatils",query="SELECT d.dept_Id,p.personId,p.firstName,p.lastName,u.urLoginName,d.dept_Name FROM Department d,Users u,Person p WHERE u.deptId=d.dept_Id AND u.personId=p.personId AND p.personId=1"),
@NamedQuery(name="Req.getCountRecords",query="SELECT COUNT(*) FROM Users u"),
@NamedQuery(name="REQUISTAION.AllDaTa",query="select s.storeId,s.storeName,r.reqId,r.reqName,r.reqDescription,p.personId,p.firstName,p.lastName,d.dept_Id,d.dept_Name,r.reqDate,r.reqByDate,r.reqType,r.reqVendorQuoteRequisition,v.vendorId,v.person.firstName,v.person.lastName,r.status,r.createdBy,r.lastUpdatedBy,r.lastUpdatedDt from Requisition r inner join r.storeMaster s inner join r.person p inner join r.department d inner join r.vendors v WHERE r.reqId!=1 AND r.reqId!=2 "),
})
public class Requisition implements java.io.Serializable {
// Fields
@Id
@SequenceGenerator(name = "requisitionseq", sequenceName = "REQUISITION_SEQ")
@GeneratedValue(generator = "requisitionseq")
@Column(name = "REQ_ID", unique = true, nullable = false, precision = 11, scale = 0)
private int reqId;
//@Min(value=1, message = "Property Cannot Be Empty")
@Column(name="PERSON_ID", unique=true, nullable=false, precision=11, scale=0)
private int personId;
@OneToOne
@JoinColumn(name = "PERSON_ID", insertable = false, updatable = false, nullable = false)
private Person person;
@Column(name="DEPT_ID", unique=true, nullable=false, precision=11, scale=0)
private int dept_Id;
@OneToOne
@JoinColumn(name = "DEPT_ID", insertable = false, updatable = false, nullable = false)
private Department department;
@Column(name = "REQ_DATE", length = 7)
private Date reqDate;
@Column(name = "REQ_TYPE", nullable = false, length = 45)
private String reqType;
@Column(name = "REQ_BY_DATE", length = 7)
private Date reqByDate;
@Column(name = "DR_GROUP_ID", precision = 11, scale = 0)
private int drGroupId;
@Column(name = "REQ_VENDOR_QUOTE_REQUISITION", length = 5)
private String reqVendorQuoteRequisition;
/*@Column(name = "RECOMMENDED_VENDOR_ID", length = 50)
private String recommendedVendorId;*/
@Column(name="VENDOR_ID", unique=true, nullable=false, precision=11, scale=0)
private int vendorId;
@OneToOne
@JoinColumn(name = "VENDOR_ID", insertable = false, updatable = false, nullable = false)
private Vendors vendors;
@Column(name = "STATUS", nullable = false, length = 45)
private String status;
@Column(name = "CREATED_BY", length = 45)
private String createdBy;
@Column(name = "LAST_UPDATED_BY", length = 45)
private String lastUpdatedBy;
@Column(name = "LAST_UPDATED_DT", length = 11)
private Timestamp lastUpdatedDt;
@Column(name = "REQ_NAME", nullable = false, length = 45)
private String reqName;
@Column(name = "REQ_DESCRIPTION", nullable = false, length = 45)
private String reqDescription;
@Column(name="STORE_ID", unique=true, nullable=false, precision=11, scale=0)
private int storeId;
@OneToOne
@JoinColumn(name = "STORE_ID", insertable = false, updatable = false, nullable = false)
private StoreMaster storeMaster;
// Constructors
/** default constructor */
public Requisition() {
}
/** full constructor */
public Requisition(int reqId, int personId, int dept_Id,Date reqDate,String reqType,Date reqByDate,
int drGroupId,String reqVendorQuoteRequisition,int vendorId,int camCategoryId,
String status, String createdBy,String lastUpdatedBy,Timestamp lastUpdatedDt)
{
this.reqId = reqId;
this.personId = personId;
this.dept_Id = dept_Id;
this.reqDate = reqDate;
//this.reqType = reqType;
this.reqByDate = reqByDate;
this.drGroupId = drGroupId;
this.reqVendorQuoteRequisition = reqVendorQuoteRequisition;
this.vendorId = vendorId;
this.status = status;
this.createdBy = createdBy;
this.lastUpdatedBy = lastUpdatedBy;
this.lastUpdatedDt = lastUpdatedDt;
}
public int getReqId() {
return this.reqId;
}
public void setReqId(int reqId) {
this.reqId = reqId;
}
public int getPersonId() {
return personId;
}
public void setPersonId(int personId) {
this.personId = personId;
}
public Person getPerson() {
return person;
}
public void setPerson(Person person) {
this.person = person;
}
public int getDept_Id() {
return dept_Id;
}
public void setDept_Id(int dept_Id) {
this.dept_Id = dept_Id;
}
public Department getDepartment() {
return department;
}
public void setDepartment(Department department) {
this.department = department;
}
public Date getReqDate() {
return this.reqDate;
}
public void setReqDate(Date reqDate) {
this.reqDate = reqDate;
}
public String getReqType() {
return this.reqType;
}
public void setReqType(String reqType) {
this.reqType = reqType;
}
public Date getReqByDate() {
return this.reqByDate;
}
public void setReqByDate(Date reqByDate) {
this.reqByDate = reqByDate;
}
public int getDrGroupId() {
return this.drGroupId;
}
public void setDrGroupId(int drGroupId) {
this.drGroupId = drGroupId;
}
public String getReqVendorQuoteRequisition() {
return this.reqVendorQuoteRequisition;
}
public void setReqVendorQuoteRequisition(String reqVendorQuoteRequisition) {
this.reqVendorQuoteRequisition = reqVendorQuoteRequisition;
}
/*public String getRecommendedVendorId() {
return this.recommendedVendorId;
}
public void setRecommendedVendorId(String recommendedVendorId) {
this.recommendedVendorId = recommendedVendorId;
}*/
public int getVendorId() {
return vendorId;
}
public void setVendorId(int ids) {
this.vendorId = ids;
}
public Vendors getVendors() {
return vendors;
}
public void setVendors(Vendors vendors) {
this.vendors = vendors;
}
public String getStatus() {
return this.status;
}
public void setStatus(String status) {
this.status = status;
}
public String getCreatedBy() {
return this.createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public String getLastUpdatedBy() {
return this.lastUpdatedBy;
}
public void setLastUpdatedBy(String lastUpdatedBy) {
this.lastUpdatedBy = lastUpdatedBy;
}
public Timestamp getLastUpdatedDt() {
return lastUpdatedDt;
}
public void setLastUpdatedDt(Timestamp lastUpdatedDt) {
this.lastUpdatedDt = lastUpdatedDt;
}
public String getReqName() {
return reqName;
}
public void setReqName(String reqName) {
this.reqName = reqName;
}
public String getReqDescription() {
return reqDescription;
}
public void setReqDescription(String reqDescription) {
this.reqDescription = reqDescription;
}
public int getStoreId() {
return storeId;
}
public void setStoreId(int storeId) {
this.storeId = storeId;
}
public StoreMaster getStoreMaster() {
return storeMaster;
}
public void setStoreMaster(StoreMaster storeMaster) {
this.storeMaster = storeMaster;
}
@PrePersist
protected void onCreate()
{
lastUpdatedDt = new Timestamp(new Date().getTime());
}
@PreUpdate
protected void onUpdate() {
lastUpdatedDt = new Timestamp(new Date().getTime());
}
/*@PrePersist
protected void onCreate() {
createdBy = (String) SessionData.getUserDetails().get("userID");
lastUpdatedBy = (String) SessionData.getUserDetails().get("userID");
lastUpdatedDt = new Timestamp(new Date().getTime());
}
@PreUpdate
protected void onUpdate() {
createdBy = (String) SessionData.getUserDetails().get("userID");
lastUpdatedBy = (String) SessionData.getUserDetails().get("userID");
lastUpdatedDt = new Timestamp(new Date().getTime());
}*/
} | [
"[email protected]"
]
| |
003a569534014588e925d4ddc525ccd18cb2dc36 | 6886c4527c4d8a231df79a3a9dee0f10fc27790a | /MobileEstimate/app/src/main/java/com/mobileprojectestimator/mobileprojectestimator/Fragments/Statistic/ProcessMethologyStatisticFragment.java | 6d1401f0aa7104754e874f4595b5cfebdd91c418 | [
"MIT",
"Apache-2.0"
]
| permissive | Freezor/MobileEstimate | e4e65cbf43ea1dc9f934511be7dbe729bedb4dc8 | 0efa2d6b5baf65b8afade400ce84518d1602bd6f | refs/heads/master | 2022-02-20T23:14:14.494023 | 2016-04-20T13:59:45 | 2016-04-20T13:59:45 | 34,784,448 | 0 | 0 | NOASSERTION | 2019-09-27T06:29:33 | 2015-04-29T09:18:27 | Java | UTF-8 | Java | false | false | 5,895 | java | package com.mobileprojectestimator.mobileprojectestimator.Fragments.Statistic;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.github.mikephil.charting.charts.PieChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.PieData;
import com.github.mikephil.charting.data.PieDataSet;
import com.github.mikephil.charting.formatter.PercentFormatter;
import com.github.mikephil.charting.highlight.Highlight;
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.mobileprojectestimator.mobileprojectestimator.DataObjects.Items.Statistic.PropertyProjects;
import com.mobileprojectestimator.mobileprojectestimator.R;
import java.util.ArrayList;
/**
* Created by Oliver Fries on 21.01.2016, 09:54.
* Project: MobileProjectEstimator
*/
public class ProcessMethologyStatisticFragment extends StatisticFragment
{
private View rootView;
private TextView tvTitle;
private PieChart mChart;
public StatisticFragment reloadStatistic()
{
final ProjectStatisticFragment fragment = new ProjectStatisticFragment();
initDatabase();
return fragment;
}
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
initDatabase();
rootView = inflater.inflate(R.layout.fragment_statistic_estimation_projects, container, false);
final View myLayout = rootView.findViewById(R.id.buttonPanel);
final ImageView dot6 = (ImageView) myLayout.findViewById(R.id.dot6);
dot6.setBackgroundResource(R.drawable.circle_blue);
tvTitle = (TextView) rootView.findViewById(R.id.tvTitle);
tvTitle.setText(R.string.fragment_statistic_process_methology_title);
mChart = (PieChart) rootView.findViewById(R.id.estimationMethodProjectsChart);
// configure pie chart
mChart.setUsePercentValues(true);
mChart.setDescription("Process Methology Share");
// enable hole and configure
mChart.setDrawHoleEnabled(true);
mChart.setHoleColorTransparent(true);
mChart.setHoleRadius(7);
mChart.setTransparentCircleRadius(10);
// enable rotation of the chart by touch
mChart.setRotationAngle(0);
mChart.setRotationEnabled(false);
// set a chart value selected listener
mChart.setOnChartValueSelectedListener(new OnChartValueSelectedListener()
{
@Override
public void onValueSelected(Entry e, int dataSetIndex, Highlight h)
{
// display msg when value selected
if (e == null)
{
//noinspection UnnecessaryReturnStatement
return;
}
}
@Override
public void onNothingSelected()
{
}
});
// add data
addData();
// customize legends
final Legend l = mChart.getLegend();
l.setPosition(Legend.LegendPosition.RIGHT_OF_CHART);
l.setXEntrySpace(7);
l.setYEntrySpace(5);
return rootView;
}
/**
* Loads the data that is displayed in the fragment
*/
private void addData()
{
initDatabase();
final ArrayList<Entry> yVals1 = new ArrayList<Entry>();
final ArrayList<String> xVals = new ArrayList<String>();
final ArrayList<PropertyProjects> values = databaseHelper.loadPropertyStatistic("ProcessMethologies", "ProcessMethology_id");
boolean zeroValues = false;
final int values_size = values.size();// Moved values.size() call out of the loop to local variable values_size
for (int i = 0; i < values_size; i++)
{
if (values.get(i).getNumberOfProjects() > 0)
{
yVals1.add(new Entry(values.get(i).getNumberOfProjects(), i));
xVals.add(values.get(i).getPropertyName());
} else
{
zeroValues = true;
}
}
if (zeroValues)
{
yVals1.add(new Entry(0, yVals1.size() + 1));
xVals.add("Other");
}
// create pie data set
final PieDataSet dataSet = new PieDataSet(yVals1, "Process Methology Share");
dataSet.setSliceSpace(3);
dataSet.setSelectionShift(5);
// add many colors
final ArrayList<Integer> colors = new ArrayList<Integer>();
for (final int c : ColorTemplate.VORDIPLOM_COLORS)
colors.add(c);
for (final int c : ColorTemplate.JOYFUL_COLORS)
colors.add(c);
for (final int c : ColorTemplate.COLORFUL_COLORS)
colors.add(c);
for (final int c : ColorTemplate.LIBERTY_COLORS)
colors.add(c);
for (final int c : ColorTemplate.PASTEL_COLORS)
colors.add(c);
colors.add(ColorTemplate.getHoloBlue());
dataSet.setColors(colors);
// instantiate pie data object now
final PieData data = new PieData(xVals, dataSet);
data.setValueFormatter(new PercentFormatter());
data.setValueTextSize(11f);
data.setValueTextColor(Color.GRAY);
mChart.setData(data);
// undo all highlights
mChart.highlightValues(null);
// update pie chart
mChart.invalidate();
}
}
| [
"[email protected]"
]
| |
658e3242c2ad3a97c8d494433188fb62f85fcf75 | 8c56f8b1e6dd08cb9b75cf25d817c1b43a1bfd59 | /src/main/java/edu/FGCU/InventoryClasses/DrinkCSVParser.java | 6003fa860a883b2078d85135c356657c974ee528 | []
| no_license | Kevingomez1024/Restaurant_Inventory | 8266a3202ab20114503c9ba69dfabdc76c84f3ca | 94e74aa34e1f7ace6cb9bd16dc156d477987bf14 | refs/heads/master | 2023-03-07T13:42:44.332168 | 2021-02-19T01:57:39 | 2021-02-19T01:57:39 | 340,230,107 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,394 | java | package edu.FGCU.InventoryClasses;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
public class DrinkCSVParser implements ResourceCSVParser {
public String drinkFilePath = "./data/drinkInventory.csv";
public List<Drink> drinkInventory = new ArrayList<>();
@Override
public void loadCSV() throws FileNotFoundException {
FileReader reader = new FileReader(drinkFilePath);
try(BufferedReader bEquipmentReader = new BufferedReader(reader)){
String line;
int lineNumber = 0;
while((line = bEquipmentReader.readLine()) != null){
if(lineNumber == 0){
lineNumber++;
}
else{
drinkInventory.add(new Drink(line.split(delimiter)));
}
}
} catch (IOException e) {
System.out.println("Could not load file <" + drinkFilePath + ">\n" + e);
}
}
@Override
public List getInventory() {
return drinkInventory;
}
@Override
public void writeCSV() throws IOException {
File outFile = new File(drinkFilePath);
if(!outFile.exists()){
outFile.createNewFile();
}
BufferedWriter writer = new BufferedWriter(new FileWriter(outFile));
FileReader reader = new FileReader(drinkFilePath);
try(BufferedReader bEquipmentReader = new BufferedReader(reader)){
String line;
if((line = bEquipmentReader.readLine()) != getHeaders()){
writer.write(getHeaders());
}
} catch (IOException e) {
System.out.println("Could not load file <" + drinkFilePath + ">\n" + e);
}
for(Drink inventory : drinkInventory){
writer.newLine();
writer.write(inventory.toString());
}
writer.close();
}
@Override
public void printCSV() {
if (drinkInventory.size() <= 0) {
System.out.println("No drink items found\n");
}
else {
for (Drink inventory : drinkInventory) {
System.out.println(inventory.toString());
}
}
System.out.println();
}
@Override
public String getHeaders() {
return "inventoryType"+delimiter+"itemNumber"+delimiter+"itemName"+delimiter+"supplierName"+delimiter+"price"+
delimiter+"quantity"+delimiter+"houseType"+delimiter+ "expirationDate";
}
@Override
public void appendCSV() throws IOException {
File outFile = new File(drinkFilePath);
if(!outFile.exists()){
outFile.createNewFile();
}
BufferedWriter writer = new BufferedWriter(new FileWriter(outFile,true));
if(drinkInventory.size() != 0){
writer.newLine();
writer.write(drinkInventory.get((drinkInventory.size())-1).toString());
}
writer.flush();
writer.close();
}
@Override
public void appendCSV(String line) throws IOException {
File outFile = new File(drinkFilePath);
if(!outFile.exists()){
outFile.createNewFile();
}
BufferedWriter writer = new BufferedWriter(new FileWriter(outFile,true));
writer.newLine();
writer.write(line);
writer.flush();
writer.close();
}
}
| [
"[email protected]"
]
| |
673a13faa2cbb91d049a902d8aba48efe0655b77 | a93c5cd8015e76df920899f9ae6491b5d41a8627 | /src/main/java/p/tomaszewski/FastRace/model/projection/RaceWriteModel.java | 94744c37fbeadbf39deca8b7a833c4aff853e166 | []
| no_license | P-Tomaszewski/FastRaceSA | b204f9e668f4d109d653050561f580ef9cbf962e | 71c6913d88914539138aa67a610e21ee0eed2faa | refs/heads/master | 2023-02-26T15:35:54.456683 | 2021-02-05T21:34:32 | 2021-02-05T21:34:32 | 331,702,048 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,864 | java | package p.tomaszewski.FastRace.model.projection;
import org.springframework.format.annotation.DateTimeFormat;
import p.tomaszewski.FastRace.enums.Surface;
import p.tomaszewski.FastRace.model.Race;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
public class RaceWriteModel {
@NotEmpty
private String name;
private Surface surface;
@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm")
@NotNull
private LocalDateTime data;
private List<DriverRaceResultWriteModel> driverRaceResults = new ArrayList<>();
public RaceWriteModel() {
driverRaceResults.add(new DriverRaceResultWriteModel());
}
public List<DriverRaceResultWriteModel> getDriverRaceResults() {
return driverRaceResults;
}
public void setDriverRaceResults(List<DriverRaceResultWriteModel> driverRaceResults) {
this.driverRaceResults = driverRaceResults;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSurface() {
return surface.getDisplayValue();
}
public void setSurface(Surface surface) {
this.surface = surface;
}
public LocalDateTime getData() {
return data;
}
public void setData(LocalDateTime data) {
this.data = data;
}
public Race toRace(){
Race result = new Race();
result.setName(name);
result.setSurface(surface);
result.setData(data);
// result.setDriverRaceResults(
// driverRaceResults.stream()
// .map(DriverRaceResultWriteModel::toDriverRaceResult)
// .collect(Collectors.toSet()));
return result;
}
}
| [
"[email protected]"
]
| |
ad10a521761021d96b5e8563f09e38cd3e0267b5 | 8f28a385a4f3a041e57e74ae34fc17feaa4da408 | /src/main/java/com/jali/d3_factory/a_quickstart/b1_simple_factory/mode_2/SenderFactory.java | fd65e4ad386585a7f9ebbbc77041592da5945964 | []
| no_license | xmlijiang/design-pattern | 588c3d1a14a87292a7789d389488adcaa80f04fb | 737f65e8c75fac4cd138e5f79518dbc087988e3a | refs/heads/master | 2022-08-03T08:33:26.969588 | 2020-05-28T15:59:58 | 2020-05-28T15:59:58 | 258,811,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 306 | java | package com.jali.d3_factory.a_quickstart.b1_simple_factory.mode_2;
/**
* @author lijiang
* @create 2020-04-27 21:43
*/
public class SenderFactory {
public Sender produceMail(){
return new MailSender();
}
public Sender produceMessage(){
return new MessageSender();
}
}
| [
"[email protected]"
]
| |
25c6f07d5b54c8aefa5fba3f835e547c5523af2e | 326319bd9d74f1625e5203bfe207b44d0b7e9bd8 | /teamcat_controller/src/main/java/com/pwrd/doreamon/controller/tools/SessionFactoryUtil.java | 39bcc2989a24aad039e31b0c1df5d3ae2d11635f | [
"Apache-2.0"
]
| permissive | dfsqjzzz/Teamcat | 35130c98c28997ce3a1337a2f85d6d65b8eb27ab | 149ec61246a23b2913f32b4c8b2fb4dab129e9d1 | refs/heads/master | 2020-04-01T00:15:04.031730 | 2018-10-12T03:21:06 | 2018-10-12T03:21:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 925 | java | package com.pwrd.doreamon.controller.tools;
import java.io.IOException;
import java.io.InputStream;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionManager;
public class SessionFactoryUtil {
static public SqlSessionManager sessionManager=null;
static {
initSessionFactory();
}
public static void initSessionFactory()
{
String resource = "mybatis-config.xml";
InputStream inputStream;
try {
inputStream = Resources.getResourceAsStream(resource);
sessionManager=SqlSessionManager.newInstance(inputStream);
} catch (IOException e) {
e.printStackTrace();
}
}
static public SqlSession newSession()
{
return sessionManager.openSession(true);
}
static public SqlSession getSession()
{
if(!sessionManager.isManagedSessionStarted())
sessionManager.startManagedSession(true);
return sessionManager;
}
}
| [
"[email protected]"
]
| |
385578c7bb893289b4469bdddeaab1a26ea1d187 | 8961907438822dd5c2c3ccfc8e47e4594b6f4d77 | /src/ua/pp/darknsoft/SumEvenOdd.java | 1a020e52b4d82e25c51ac6f33a8721641b3f0f97 | []
| no_license | darknsoft/home-work-4 | 8b35ea48908088fe43c543a35118dd31a1f5972a | 54cb9eb725fcebc6dc6fb17871b9f51d13f51f59 | refs/heads/master | 2021-07-25T00:52:32.784091 | 2017-11-05T20:00:00 | 2017-11-05T20:00:00 | 109,525,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 884 | java | package ua.pp.darknsoft;
import java.util.concurrent.ThreadLocalRandom;
public class SumEvenOdd{
public static void main(String[] args){
int masLng = 10;
int sumEven = 0;
int sumOdd = 0;
if(args.length == 1){
masLng = Integer.parseInt(args[0]);
}
int[] someArray = new int[masLng];
for(int i=0;i < someArray.length;i++){
someArray[i] = ThreadLocalRandom.current().nextInt(1, 9 + 1); //I took it from
// https://stackoverflow.com/questions/363681/how-do-i-generate-random-integers-within-a-specific-range-in-java
}
for(int tmp:someArray){
System.out.print(tmp + " ");
}
for(int i=0;i < someArray.length;i++){
if(someArray[i]%2==0) sumEven += someArray[i];
else sumOdd += someArray[i];
}
System.out.println();
System.out.println("sumEven = " + sumEven);
System.out.println("sumOdd = " + sumOdd);
}
}
| [
"[email protected]"
]
| |
7fecd24878c7382bb442ccc07b892c8bded97d62 | 7d9e5224f1f30588a3657e1d6a90f30fcafc9f96 | /customnews/src/main/java/com/frontpagenews/models/ArticleModel.java | d86f7ae08e072d24631627e6aa60edd93bf9fde6 | []
| no_license | alecsandru29/FPCNews | 27162e90d4c6eb11c9d55a55ca895651e937efaf | 3a717554540bcad37231ba6925985dcc828071ad | refs/heads/master | 2021-01-20T18:07:09.215678 | 2017-05-07T14:55:40 | 2017-05-07T14:55:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,728 | java | package com.frontpagenews.models;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.List;
@Document(collection="articles")
public class ArticleModel {
@Id
private String id;
private String titlu;
private String continut;
private byte[] imagine;
private List<String> tags;
private SourceModel sursa;
private byte[] audio;
public ArticleModel() {}
public ArticleModel(String id, String titlu, String continut, byte[] imagine, List<String> tags, SourceModel sursa, byte[] audio) {
this.id = id;
this.titlu = titlu;
this.continut = continut;
this.imagine = imagine;
this.tags = tags;
this.sursa = sursa;
this.audio = audio;
}
public String getId() {
return id;
}
public String getTitlu() {
return titlu;
}
public String getContinut() {
return continut;
}
public byte[] getImagine() {
return imagine;
}
public List<String> getTags() {
return tags;
}
public SourceModel getSursa() {
return sursa;
}
public byte[] getAudio() {
return audio;
}
public void setTitlu(String titlu) {
this.titlu = titlu;
}
public void setContinut(String continut) {
this.continut = continut;
}
public void setImagine(byte[] imagine) {
this.imagine = imagine;
}
public void setTags(List<String> tags) {
this.tags = tags;
}
public void setSursa(SourceModel sursa) {
this.sursa = sursa;
}
public void setAudio(byte[] audio) {
this.audio = audio;
}
}
| [
"[email protected]"
]
| |
d417941054c38572467a67523538a0783c8979ca | ec2b811cf4c24f8412eb0b65e43bc44e315015ef | /core/src/main/java/com/dtolabs/rundeck/plugins/jobs/JobChangeListener.java | 1ff0c7cf3e0bdd2edafe071dd7b69ef70b4f7447 | [
"Apache-2.0"
]
| permissive | cjpetrus/rundeck | e6cd2e3f374bcc6af871a9a071b96c5b632494af | 4df51911cdde6f8393b82073eddb183dde768f1b | refs/heads/master | 2020-05-26T00:38:17.217612 | 2016-07-10T04:41:32 | 2016-07-10T04:41:32 | 62,974,110 | 1 | 0 | null | 2016-07-10T04:41:34 | 2016-07-10T00:04:04 | Groovy | UTF-8 | Java | false | false | 341 | java | package com.dtolabs.rundeck.plugins.jobs;
import com.dtolabs.rundeck.plugins.scm.JobChangeEvent;
import com.dtolabs.rundeck.plugins.scm.JobSerializer;
/**
* Created by greg on 4/28/15.
*/
public interface JobChangeListener {
public void jobChangeEvent(
JobChangeEvent event,
JobSerializer serializer
);
}
| [
"[email protected]"
]
| |
f5b1bcfaaad64b3c312cf9c95543bcf75e6503a2 | e47676232101255a92f579ec69d5b838b23e9334 | /springtools phase 1 java/Practice_Constructors/src/Constructors.java | 7da7aaf5a9f51588fb93b393d7741278879c45da | []
| no_license | MathumathiArul/httpsRemote | e4a62c40eaa9d460ad1af184f7951c65a9b1ec77 | 49d27b4d46f72bc076edb87943e597083bdbffaa | refs/heads/master | 2022-12-27T07:15:29.794330 | 2020-10-11T09:55:25 | 2020-10-11T09:55:25 | 303,087,002 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java |
public class Constructors {
private int id;
private String name;
private String location;
private char sex;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public char getSex() {
return sex;
}
public void setSex(char sex) {
this.sex = sex;
}
public Constructors(String name, String location, char sex) {
this.name = name;
this.location = location;
this.sex = sex;
}
@Override
public String toString() {
return "Constructors [id=" + id + ", name=" + name + ", location=" + location + ", sex=" + sex + "]";
}
} | [
"[email protected]"
]
| |
728520ddfdfd3c7c4270a04ce5c28406a0c23ca2 | 5e6eaef2f9962858b345caa7173aea4165de3ab3 | /app/src/test/java/com/shanlinjinrong/drean/test/ExampleUnitTest.java | b8316477da4f0ecc711c943c031882d464326fd5 | []
| no_license | 76547447/Test | 079c195c6b8a79059b244dcc3bc7ed0296c20527 | 8630fd90552feaa68db29c430a3cb8635d783408 | refs/heads/master | 2020-03-10T17:33:41.446423 | 2018-04-14T10:34:51 | 2018-04-14T10:34:51 | 129,503,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package com.shanlinjinrong.drean.test;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
bd54a65619e947b2299cf5caa68dd75986a944b6 | b988f15847edba510e90239ca6c241a926360af4 | /src/main/java/com/rock/jpetstore/controller/LiveController.java | 9b412e5e3a84d6343112f94dce29654adf61512e | []
| no_license | wspark/jpetstore-msa-wspark | 8a53eedb0b92c5625ce9502f6012de41ade0ca5f | bc315c227319ef225a096dbb9e418ebb36fe8da1 | refs/heads/master | 2022-11-20T06:08:00.407082 | 2020-07-01T08:00:07 | 2020-07-01T08:00:07 | 276,302,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,648 | java | package com.rock.jpetstore.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
import com.rock.jpetstore.domain.HealthCheck;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
public class LiveController {
@Value("${spring.application.name}")
private String appName;
@Autowired
private JdbcTemplate jdbcTemplate;
//@ResponseStatus(HttpStatus.OK)
@RequestMapping(method = RequestMethod.GET, path = "/live")
public @ResponseBody ResponseEntity<Object> live() {
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
headers.add("Retry-After", "3600");
Map<String, List<HealthCheck>> map = new HashMap<String, List<HealthCheck>>();
List<HealthCheck> healthChecks = new ArrayList<HealthCheck>();
Date dateNow = Calendar.getInstance().getTime();
HealthCheck app = new HealthCheck(appName, "OK", dateNow);
HealthCheck database = new HealthCheck(appName + "-db", "OK", dateNow);
try {
jdbcTemplate.execute("SELECT 1");
} catch (Exception e) {
database.setStatus("err");
}
healthChecks.add(app);
healthChecks.add(database);
map.put("health", healthChecks);
return new ResponseEntity<>(map, headers, HttpStatus.OK);
}
} | [
"[email protected]"
]
| |
0a1131761a7183ca8f1c1657b60719053f245b74 | c173832fd576d45c875063a1a480672fbd59ca04 | /seguridad/tags/release-1.0/modulos/tags/apps20120808/apps/LOCALGIS-Model/src/main/java/com/geopista/feature/AutoFieldDomain.java | 1cc4a2fe5b0c446d41a9dc6181a125993f291bf0 | []
| no_license | jormaral/allocalgis | 1308616b0f3ac8aa68fb0820a7dfa89d5a64d0e6 | bd5b454b9c2e8ee24f70017ae597a32301364a54 | refs/heads/master | 2021-01-16T18:08:36.542315 | 2016-04-12T11:43:18 | 2016-04-12T11:43:18 | 50,914,723 | 0 | 0 | null | 2016-02-02T11:04:27 | 2016-02-02T11:04:27 | null | ISO-8859-1 | Java | false | false | 9,638 | java | /*
* * The GEOPISTA project is a set of tools and applications to manage
* geographical data for local administrations.
*
* Copyright (C) 2004 INZAMAC-SATEC UTE
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* For more information, contact:
*
*
* www.geopista.com
*
* Created on 07-jun-2004 by juacas
*
*
*/
package com.geopista.feature;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.text.DecimalFormat;
import com.geopista.app.AppContext;
import com.geopista.server.administradorCartografia.Const;
import com.geopista.util.expression.FeatureExpresionParser;
import com.vividsolutions.jump.I18N;
import com.vividsolutions.jump.feature.AttributeType;
import com.vividsolutions.jump.feature.Feature;
/**
* @author juacas
*
* Un atributo que recibe el valor de otras propiedades de las capas o tablas
* Se define para los siguientes tipos:
* -FORMULA: con el patrón (<code>FORMULA:expresion </code>
* Expresión general con los atributos de la Feature.
* Soporta las funciones:
* sin
* cos
* tan
* asin
* acos
* atan
* sinh
* cosh
* tanh
* asinh
* acosh
* atanh
* log
* ln
* sqrt
* angle
* abs
* mod
* sum
* rand
* double
* str
* substr
* pow
* area
* length
*
* (deprecated) -AREA: con el patrón AREA:format
* (deprecated) -LONGITUD: con el patrón LENGHT:format
* -ID: Identificador del sistema. Si está vacío se interpreta como que está pendiente de establecerse.
* -ENV_VAR: Consulta las variables de entorno del sistema local ENV_VAR:nombrevalor
* @see DecimalFormat
*/
public class AutoFieldDomain extends Domain {
/**
* Logger for this class
*/
private static final Log logger = LogFactory.getLog(AutoFieldDomain.class);
private String type;
private static final String AUTOAREA= "AREA";
private static final String AUTOLENGTH = "LENGTH";
private static final String AUTOFORMULA = "FORMULA";
private static final String AUTOENV_VAR = "ENV_VAR";
private static final String AUTOID = "ID";
private static final String NUMBER_FORMAT_ERROR_MSG = "AutoFieldDomain.NumberFormatError";
private static final String FORMULA_MISMATCH_ERROR_MSG = "AutoFieldDomain.FormulaMismatchError";
private static final String FEATURE_HAVE_NO_GEOMETRY = "AutoFieldDomain.HaveNoGeometry";
private FeatureExpresionParser expParser = null;
/**
*
*/
public AutoFieldDomain() {
super();
// TODO Auto-generated constructor stub
}
/**
* @param pattern
* @param Description
*/
public AutoFieldDomain(String pattern, String Description) {
super(pattern, Description);
setPattern(pattern);
}
public boolean validate(Feature feature, String Name, Object Value)
{
return validateLocal(feature,Name,Value);
}
/* (non-Javadoc)
* @see com.geopista.feature.Domain#validateLocal(com.vividsolutions.jump.feature.Feature, java.lang.String, java.lang.String)
*/
protected boolean validateLocal(Feature feature, String Name, Object valueObj) {
if (type.equals(AutoFieldDomain.AUTOID)) return true;
double dValue;
if (valueObj==null)
valueObj=feature.getAttribute(Name);
if (valueObj==null)return false;
try {
dValue = ( (valueObj instanceof Double)?
((Double)valueObj).doubleValue()
: Double.parseDouble(valueObj.toString()));
} catch (NumberFormatException ex) {
ex.getLocalizedMessage();
setLastErrorMessage(I18N.get(AutoFieldDomain.NUMBER_FORMAT_ERROR_MSG));// asigna el error por defecto.
return false;
}
if (type.equals(AutoFieldDomain.AUTOAREA))
if(feature.getSchema().getGeometryIndex()==-1)
{
setLastErrorMessage(I18N.get(FEATURE_HAVE_NO_GEOMETRY));
return false;
}
else
return dValue==feature.getGeometry().getArea();
else
if (type.equals(AutoFieldDomain.AUTOLENGTH))
if(feature.getSchema().getGeometryIndex()==-1)
{
setLastErrorMessage(I18N.get(FEATURE_HAVE_NO_GEOMETRY));
return false;
}
else
return dValue==feature.getGeometry().getLength();
else
if (type.equals(AutoFieldDomain.AUTOFORMULA))
{
return valueObj.equals(getRightValue(feature));
}
else if (type.equals(AutoFieldDomain.AUTOENV_VAR))
{
//No hago validación porque supongo que este caso sólo va a aplicar al municipio y en el desplegable
//ya tengo determinados los valores válidos
//return valueObj.toString().equals(getRightValue(feature));
return true;
}
setLastErrorMessage(I18N.getMessage(AutoFieldDomain.FORMULA_MISMATCH_ERROR_MSG,new Object[]{expression}));// asigna el error por defecto.
return false;
}
/* (non-Javadoc)
* @see com.geopista.feature.Domain#getType()
*/
public int getType() {
return Domain.AUTO;
}
/* (non-Javadoc)
* @see com.geopista.feature.Domain#getRepresentation()
*/
public String getRepresentation() {
return getName();
}
/* El patrón de definición reconoce varias Cadenas clave:
* <pre>
* AREA:format
* LENGHT:format
* FORMULA:expresión matemática
* </pre>
**/
private String expression;
public void setPattern(String pattern) {
super.setPattern(pattern);
pattern=this.pattern;
int posParam = pattern.indexOf(':');
int posPattern= pattern.indexOf(':',posParam+1)+1;
if (posParam==-1) posParam=pattern.length();
if (posPattern == 0) posPattern=pattern.length();
String command=pattern.substring(0,posParam);
type=command;
if (type.equals(AutoFieldDomain.AUTOFORMULA))
{
this.expParser=new FeatureExpresionParser(null);
expression=pattern.substring(posParam+1,posPattern);
setFormat(pattern.substring(posPattern));
}
else
if (type.equals(AutoFieldDomain.AUTOID))
{
return;
}
else
if (type.equals(AutoFieldDomain.AUTOENV_VAR))
{
expression=pattern.substring(posParam+1,posPattern);
setFormat(pattern.substring(posPattern));
}
else
{
posPattern=posParam;
setFormat(pattern.substring(posPattern));
}
if (getFormat().length()<5)
setAproxLenght(8);
else
setAproxLenght(getFormat().length());
}
public Object getRightValue(Feature feature)
{
return getRightValue(feature,null);
}
public Object getRightValue(Feature feature, int attIndex)
{
return getRightValue(feature,feature.getSchema().getAttributeName(attIndex));
}
/**
* Obtiene el valor correcto según este dominio para la feature
*
* @param feature
*
* @return Object con el valor adecuado. null si no hay que cambiar el valor existente
*/
public Object getRightValue(Feature feature, String attName)
{
if (type.equals(AutoFieldDomain.AUTOFORMULA) && expParser!=null)
{
if (expParser.getLastFeature()!=feature) // reevalua solo si no se ha definido ya. Evita bucles infinitos
expParser.setFeature(feature);
expParser.parseExpression(expression);
return expParser.getValueAsObject();
}
else
if (type.equals(AutoFieldDomain.AUTOAREA))
{
try
{
double area = feature.getGeometry().getArea();
return new Double(area);
} catch (ArrayIndexOutOfBoundsException e)// Ocurre cuando una feature no tiene geometria (generalmente en codigo de pruebas.)
{
logger.debug("getRightValue("+feature+"): Feature sin GEOMETRY.");
}
}
else
if (type.equals(AutoFieldDomain.AUTOLENGTH))
{
return new Double(feature.getGeometry().getLength());
}
else
if (type.equals(AutoFieldDomain.AUTOENV_VAR))
{
if (attName == null)
return AppContext.getApplicationContext().getUserPreference(expression,null,true);
String cadena = type+":"+expression;
if (cadena.equals(Const.KEY_ID_MUNI)){
Object sMunicipio = (Object)((GeopistaFeature)feature).getAttributesDirectly()[feature.getSchema().getAttributeIndex(attName)];
if (sMunicipio != null)
return sMunicipio;
}
return AppContext.getApplicationContext().getUserPreference(expression,null,true);
}
else
if (feature instanceof GeopistaFeature && type.equals(AutoFieldDomain.AUTOID))
{
if(((GeopistaFeature)feature).isTempID() && attName!=null)
return ((GeopistaFeature)feature).getAttributesDirectly()[feature.getSchema().getAttributeIndex(attName)];
else if (((GeopistaFeature)feature).getSystemId().trim().equals(""))
return "";
else
return new Long(((GeopistaFeature)feature).getSystemId());
}
return null;// indica que no hay que cambiar el valor
}
/* (non-Javadoc)
* @see com.geopista.feature.Domain#getAttributeType()
*/
public AttributeType getAttributeType()
{
return AttributeType.STRING;
}
}
| [
"[email protected]"
]
| |
8ddbd6d92e8698e0b6cb828e47d1740798787686 | 97e44f253b40cd244f5046a9b8603e48db1259c7 | /app/src/main/java/com/flipsoft/flipreader/app/PagerEnabledSlidingPanelLayout.java | 163f98e548d0eee705c2bd9b50cc8da73697b32e | []
| no_license | flipelunico/FlipsReader | 421fea36d1a3cd750f6aaa8d434657fb5c9ec6b7 | f6e62bb23b8f575db9ffe1ca5f4cdfbf6a905b5d | refs/heads/master | 2020-02-26T15:40:13.801494 | 2016-12-29T04:29:31 | 2016-12-29T04:29:31 | 70,664,256 | 0 | 0 | null | 2016-10-13T04:51:25 | 2016-10-12T04:57:29 | Java | UTF-8 | Java | false | false | 2,674 | java | package com.flipsoft.flipreader.app;
import android.content.Context;
import android.support.v4.view.MotionEventCompat;
import android.support.v4.widget.SlidingPaneLayout;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.ViewConfiguration;
/**
* SlidingPaneLayout that, if closed, checks if children can scroll before it intercepts
* touch events. This allows it to contain horizontally scrollable children without
* intercepting all of their touches.
*
* To handle cases where the user is scrolled very far to the right, but should still be
* able to open the pane without the need to scroll all the way back to the start, this
* view also adds edge touch detection, so it will intercept edge swipes to open the pane.
*/
public class PagerEnabledSlidingPanelLayout extends SlidingPaneLayout {
private float mInitialMotionX;
private float mInitialMotionY;
private float mEdgeSlop;
public PagerEnabledSlidingPanelLayout(Context context) {
this(context, null);
}
public PagerEnabledSlidingPanelLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public PagerEnabledSlidingPanelLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
ViewConfiguration config = ViewConfiguration.get(context);
mEdgeSlop = config.getScaledEdgeSlop();
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
switch (MotionEventCompat.getActionMasked(ev)) {
case MotionEvent.ACTION_DOWN: {
mInitialMotionX = ev.getX();
mInitialMotionY = ev.getY();
break;
}
case MotionEvent.ACTION_MOVE: {
final float x = ev.getX();
final float y = ev.getY();
// The user should always be able to "close" the pane, so we only check
// for child scrollability if the pane is currently closed.
if (mInitialMotionX > mEdgeSlop && !isOpen() && canScroll(this, false,
Math.round(x - mInitialMotionX), Math.round(x), Math.round(y))) {
// How do we set super.mIsUnableToDrag = true?
// send the parent a cancel event
MotionEvent cancelEvent = MotionEvent.obtain(ev);
cancelEvent.setAction(MotionEvent.ACTION_CANCEL);
return super.onInterceptTouchEvent(cancelEvent);
}
}
}
return super.onInterceptTouchEvent(ev);
}
} | [
"[email protected]"
]
| |
d5f033c888077da0c4104e91ae43eeae3cafc468 | 6843778e7e72d568c9496974f0d6fbd4841e021d | /wechat/wechat-pay-spring-boot-starter/src/main/java/com/github/aqiu202/wechat/wxpay/sdk/WXPayXmlUtil.java | 93d4eca54464750c616453188a6bded2f3491289 | [
"Apache-2.0"
]
| permissive | 1415749952/aqiu-spring-boot-starter-projects | 929d3fc806357f439c4743a4b3c8b54997abc4fc | d8e9fddcc535707827fd8f75e3b9c4f49c3c1790 | refs/heads/master | 2023-08-15T05:02:36.443550 | 2021-09-18T03:26:25 | 2021-09-18T03:26:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,440 | java | package com.github.aqiu202.wechat.wxpay.sdk;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
/**
* 2018/7/3
*/
public final class WXPayXmlUtil {
public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory
.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
documentBuilderFactory
.setFeature("http://xml.org/sax/features/external-general-entities", false);
documentBuilderFactory
.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
documentBuilderFactory
.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",
false);
documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
documentBuilderFactory.setXIncludeAware(false);
documentBuilderFactory.setExpandEntityReferences(false);
return documentBuilderFactory.newDocumentBuilder();
}
public static Document newDocument() throws ParserConfigurationException {
return newDocumentBuilder().newDocument();
}
}
| [
"[email protected]"
]
| |
b094e31e8111dee2c7bb0142f232919bf998161a | 725327abcba851aa7f13f8466f1b026fd1d93b50 | /StudyTest/src/깊이너비/여행경로.java | 792465c93d787ac466ca2ba208cadbf8e825e2bb | []
| no_license | jaeho0613/Programmers_CT | 2be383d01ef5e7c4282978f55131f002f0aa4476 | 526e7c2d25a6e7dce7cf3f8b24b5b8793614e3ed | refs/heads/master | 2023-04-19T13:10:12.631790 | 2021-05-11T16:36:37 | 2021-05-11T16:36:37 | 363,337,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,963 | java | package 깊이너비;
import java.util.*;
public class 여행경로 {
public static void main(String[] args) {
Solution_04 st = new Solution_04();
String[][] tickets = { { "ICN", "SFO" }, { "ICN", "ATL" }, { "SFO", "ATL" }, { "ATL", "ICN" },
{ "ATL", "SFO" } };
// String[][] tickets2 = { { "ICN", "JFK" }, { "HND", "IAD" }, { "JFK", "HND" } };
String[] result = st.solution(tickets);
for (String string : result) {
System.out.println(string);
}
}
}
class Solution_04 {
List<String> answers;
boolean[] visited;
public String[] solution(String[][] tickets) {
answers = new ArrayList<>();
visited = new boolean[tickets.length];
dfs(0, "ICN", "ICN", tickets);
Collections.sort(answers);
String[] answer = answers.get(0).split(" ");
return answer;
}
private void dfs(int count, String currentPath, String answer, String[][] tickets) {
if(count == tickets.length) {
answers.add(answer);
return;
}
for (int i = 0; i < tickets.length; i++) {
if(tickets[i][0].equals(currentPath) && !visited[i]) {
visited[i] = true;
dfs(count + 1, tickets[i][1], answer + " " + tickets[i][1], tickets);
visited[i] = false;
}
}
}
}
//class Solution_04 {
//
// List<String> answers;
// boolean[] visited;
//
// public String[] solution(String[][] tickets) {
//
// answers = new ArrayList<>();
// visited = new boolean[tickets.length];
//
// dfs(0, "ICN", "ICN", tickets);
// Collections.sort(answers);
// String[] answer = answers.get(0).split(" ");
//
// return answer;
// }
//
// private void dfs(int count, String current, String answer, String[][] tickets) {
// if(count == tickets.length) {
// answers.add(answer);
// return;
// }
//
// for (int i = 0; i < tickets.length; i++) {
// if (!visited[i] && tickets[i][0].equals(current)) {
// visited[i] = true;
// dfs(count + 1, tickets[i][1], answer + " " + tickets[i][1], tickets);
// visited[i] = false;
// }
// }
// } | [
"[email protected]"
]
| |
eec699980d37eeb5c4735ef5ab4aa435f945aea5 | 3bbf4f85142c6df43dfc774b8bc3c54f86c37b68 | /src/com/scottyab/dimsum/Utils.java | b0e73061915ef94749268ee910b2212c124eecf6 | [
"Apache-2.0"
]
| permissive | scottyab/dimsum | 31fa280fbe01cc6fdaec5c36b2f46b1c2608e998 | 6d9268b8c45333556055a50d699f466ba9ca084a | refs/heads/master | 2020-05-30T16:04:40.151038 | 2013-10-18T16:40:00 | 2013-10-18T16:40:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,290 | java | package com.scottyab.dimsum;
import android.content.Context;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
public class Utils {
public static float getCurrentScreenBrightness(Context context) {
try {
float curBrightnessValue = android.provider.Settings.System.getInt(
context.getContentResolver(),
android.provider.Settings.System.SCREEN_BRIGHTNESS);
return curBrightnessValue;
} catch (SettingNotFoundException e) {
e.printStackTrace();
}
return -1;
}
// SCREEN_BRIGHTNESS 0-255
public static void setScreenBrightness(float newBrightnessLevel,
Context context) {
// This is important. In the next line 'brightness'
// should be a float number between 0.0 and 1.0
int brightnessInt = (int) (newBrightnessLevel * 255);
// Check that the brightness is not 0, which would effectively
// switch off the screen, and we don't want that:
if (brightnessInt < 1) {
brightnessInt = 1;
}
// Set systemwide brightness setting.
Settings.System.putInt(context.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
Settings.System.putInt(context.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS, brightnessInt);
}
}
| [
"[email protected]"
]
| |
7336e49dd8c6a71bed3d235d9d2eab43c42b966a | 7f49d5e8ee8bd74355cdc901b03b2a55efc70215 | /app/src/androidTest/java/com/hxh/commonthirdparty/ExampleInstrumentedTest.java | 1629742a6009dd8567fc6c5a67a553aa9bcae8d0 | []
| no_license | Hxh188/CommonThirdParty | 7d6031194dc601a12b0a620e635d1006e71e7505 | df961069dbf2b2871eec35a4fc1dc8c63a453e29 | refs/heads/master | 2020-09-22T21:58:21.381945 | 2019-12-02T09:02:35 | 2019-12-02T09:02:35 | 225,329,783 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 764 | java | package com.hxh.commonthirdparty;
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 ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.hxh.commonthirdparty", appContext.getPackageName());
}
}
| [
"[email protected]"
]
| |
6664650fda4ec9ada878b4dc22576c204b8224f6 | f0349ce9bc4b14ec3f21251163b4c2a404959ddf | /game2048/src/main/java/leavesc/hello/game2048/activity/MainActivity.java | a29f32424099e303cea966667426e87b0b075811 | []
| no_license | lgq2015/SmallApp | 6103bd653c5b31f555bb216889f6292f4afa2fc7 | 9b0264ef76d4f5d4649f50c42b4286c927228752 | refs/heads/master | 2021-01-15T06:16:27.345124 | 2019-04-04T06:09:18 | 2019-04-04T06:09:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,160 | java | package leavesc.hello.game2048.activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;
import leavesc.hello.game2048.R;
public class MainActivity extends AppCompatActivity {
// 游戏记录
private SharedPreferences gameRecord;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
gameRecord = getSharedPreferences("GameRecord", Context.MODE_PRIVATE);
}
//软件说明
public void explain(View view) {
Intent intent = new Intent(MainActivity.this, ExplainActivity.class);
startActivity(intent);
}
// 4乘4
public void fourRow(View view) {
startActivity(4);
}
// 5乘5
public void fiveRow(View view) {
startActivity(5);
}
// 6乘6
public void sixRow(View view) {
startActivity(6);
}
private void startActivity(int row) {
Intent intent = new Intent(MainActivity.this, GameActivity.class);
intent.putExtra("Row", row);
startActivity(intent);
}
//恢复游戏
public void recoverGame(View view) {
if (gameRecord.contains("Row")) {
Intent intent = new Intent(MainActivity.this, GameActivity.class);
int row = gameRecord.getInt("Row", 4);
if (row == 4) {
intent.putExtra("Row", 4);
} else if (row == 5) {
intent.putExtra("Row", 5);
} else {
intent.putExtra("Row", 6);
}
intent.putExtra("RecoverGame", true);
startActivity(intent);
} else {
Toast.makeText(MainActivity.this, "没有保存记录,来一局新游戏吧", Toast.LENGTH_SHORT).show();
}
}
//设置
public void settings(View view) {
Intent intent = new Intent(MainActivity.this, SettingsActivity.class);
startActivity(intent);
}
}
| [
"[email protected]"
]
| |
4dce99565fc109e51c73535b69811c8de0de8a4d | 9339cb45bdbd9f1c5b7769bf29e58a39893a811d | /view-web/src/main/java/com/zx5435/pcmoto/web/controllers/UserController.java | 18984c639f1133c192e2d142ff10d79aa4ea4c7f | [
"MIT"
]
| permissive | wolanx/springcloud-demo | 0022a3fa3bd6698e31844af104d6be4209f38de9 | af729dde67910e51491df5ddfc749fe93b06e82c | refs/heads/master | 2022-02-02T09:37:36.968732 | 2019-08-02T13:27:21 | 2019-08-02T13:27:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,634 | java | package com.zx5435.pcmoto.web.controllers;
import com.zx5435.pcmoto.common.base.User;
import com.zx5435.pcmoto.web.config.LogConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
@Slf4j
@Controller
public class UserController {
@Autowired
HttpServletRequest request;
@RequestMapping("/user")
public String index(Model m) {
m.addAttribute("username", request.getSession().getAttribute("uid"));
return "user/index";
}
@RequestMapping("/user/login")
public String login(Model m) {
String method = request.getMethod();
User user = new User();
LogConfig.log.info("method = " + method);
log.info("name = {},user = [{}]", "qwe", user);
if ("POST".equals(method)) {
String username = request.getParameter("username");
System.out.println("username = " + username);
request.getSession().setAttribute("uid", username);
return "redirect:/user?" + username;
}
return "user/login";
}
@RequestMapping("/user/logout")
public String logout(Model m) {
String id = request.getSession().getId();
String s = request.changeSessionId();
System.out.println("id = " + id);
System.out.println("s = " + s);
request.getSession().removeAttribute("uid");
return "redirect:/user/login";
}
}
| [
"[email protected]"
]
| |
ebb2c3bc6c9dd899bd8d625f209b73381b567ed7 | 071b248dd6282fdb497e5ce89e86284b842b0d28 | /HelloFX/src/hellofx/Controller.java | e7fb5b55dde87f6e298d1800131f35a8f7b6d73c | []
| no_license | andre91998/JavaBasics | cbf0e61b578638ed8ecacdfaba626026f33eeb47 | b66c7d09e213a13e6633854b11d22f12e776f248 | refs/heads/master | 2020-07-04T20:52:36.319677 | 2019-08-14T22:31:40 | 2019-08-14T22:31:40 | 202,412,885 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 553 | java | /* Author: Andre Barros de Medeiros
* Date: 27/07/19
* Description: HelloFX controller
* Copyright: Free to use, copy, and modify
* */
package hellofx;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
public class Controller {
@FXML
private Label label;
public void initialize() {
String javaVersion = System.getProperty("java.version");
String javafxVersion = System.getProperty("javafx.version");
label.setText("Hello, JavaFX " + javafxVersion + "\nRunning on Java " + javaVersion + ".");
}
} | [
"[email protected]"
]
| |
4444383c24c3e7f71e1ee40c5c5f45b0519a8310 | cb40c248634814eca147384976e5e91c20c60892 | /Reset/CursoEmVideoPOOAula11B/Bolsista.java | a6e7257d9af2ba9d2dde7f80d99034b11471d941 | []
| no_license | Yasmin29/CWI-Reset-Java | c5630b3ef19a765b0aa510609a9f4429bd032206 | 2ffa8346b5e433dc49c73a109e4978b741f504f2 | refs/heads/master | 2023-08-15T10:44:46.476501 | 2021-09-21T02:02:44 | 2021-09-21T02:02:44 | 401,561,596 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 505 | java | package CursoEmVideoPOOAula11B;
public class Bolsista extends Aluno {
//Atributos:
private double bolsa;
//Métodos:
public void renovarBolsa(){
System.out.println("Renovando Bolsa de: " + getNome());
}
@Override
public void pagarMensalidade() {
System.out.println(getNome() + " é bolsista! Pagamento Facilitado");
}
public double getBolsa() {
return bolsa;
}
public void setBolsa(int bolsa) {
this.bolsa = bolsa;
}
}
| [
"[email protected]"
]
| |
99031e9317e0df038b5a2b8503c7ada9694975d8 | ce351b5a04d66d370cb4beefcb433e1874d39b38 | /tools-abf-service/src/main/java/org/tis/tools/abf/module/om/service/IOmEmpGroupService.java | bfe7630dbfe95eb876ea44424932c7bc5c43c5bd | []
| no_license | WengFangLei/TTT | 2e66004fd16ed426b7330ed4ca28fd0a565094ee | 1beda6bb5fc0debc6a6bd7de45618b40fa257b7e | refs/heads/master | 2020-03-13T15:00:23.273410 | 2018-05-27T10:18:55 | 2018-05-27T10:18:55 | 131,169,142 | 0 | 0 | null | 2018-05-27T10:18:56 | 2018-04-26T14:38:39 | Java | UTF-8 | Java | false | false | 319 | java | package org.tis.tools.abf.module.om.service;
import com.baomidou.mybatisplus.service.IService;
import org.tis.tools.abf.module.om.entity.OmEmpGroup;
/**
* omEmpGroup的Service接口类
*
* @author Auto Generate Tools
* @date 2018/04/23
*/
public interface IOmEmpGroupService extends IService<OmEmpGroup> {
}
| [
"[email protected]"
]
| |
4f66b0e43b9b8ba0d9fdf70b4d50e17bd0de941e | d81829789fcdca5d930cab48aa024a0720e43c88 | /GameDemo/src/com/atet/tvmarket/entity/GameInfoResp.java | 8e5b27c724ed2eca43b1c255d267e5b7dba6d94e | []
| no_license | clouse/gamedemo | e420cd2fc3138628ba31af779893e6f852a8ba21 | e54a32a6441e9d8b973e40b1b262bf7c6b333468 | refs/heads/master | 2021-01-10T13:10:26.880391 | 2015-12-17T06:33:52 | 2015-12-17T06:33:52 | 48,152,894 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 685 | java | package com.atet.tvmarket.entity;
import java.util.List;
import com.atet.tvmarket.entity.dao.GameInfo;
public class GameInfoResp implements AutoType {
private int code;
private int total;
private List<GameInfo> data;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public List<GameInfo> getData() {
return data;
}
public void setData(List<GameInfo> data) {
this.data = data;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
@Override
public String toString() {
return "GameInfoResp [code=" + code + ", total=" + total + ", data="
+ data + "]";
}
} | [
"[email protected]"
]
| |
714151376f4296d4ae2b3805926501851cffb8f5 | 5c44d11d8ece972b578227677bd475091b5f787a | /tasks/comparable/src/test/java/ru/comparable/skype/product/ProductComparatorByNameTest.java | 8d11955fe28fb97b64f604d59bf725e841e3f56a | []
| no_license | Kostegan/SkypeTeach | 69aaa96db0216b5cd7dac775dd0d0446e2264577 | 6fee2ddff01ce3d4817d4bfb62357a68bddaf9b6 | refs/heads/master | 2021-01-21T04:31:46.286100 | 2016-07-03T09:24:49 | 2016-07-03T09:24:49 | 46,164,579 | 0 | 0 | null | 2016-01-23T21:27:02 | 2015-11-14T06:37:39 | Java | UTF-8 | Java | false | false | 630 | java | package ru.comparable.skype.product;
import org.junit.Test;
import ru.comparable.skype.product.Product;
import ru.comparable.skype.product.ProductComparatorByName;
import ru.comparable.skype.product.Store;
import static org.junit.Assert.*;
/**
*
*/
public class ProductComparatorByNameTest {
@Test
public void CompareByName(){
Store store = new Store();
Product product1 = store.getProduct(0);
Product product2 = store.getProduct(4);
ProductComparatorByName compareByName = new ProductComparatorByName();
assertEquals("1",1,compareByName.compare(product1,product2));
}
}
| [
"[email protected]"
]
| |
f904f597483c324c3336ad152476a2e3ddaf1d47 | 8eb65bf5709db5ff089af6c3262561331f696a81 | /src/main/java/cn/com/tsjx/common/constants/enums/AuditRecordEnum.java | 8687fe27292df260d04ef7f54048fffc9267c6ae | []
| no_license | liaoxianghua/tsjx | ba67822294e144d424673fe576d1cad3ab75060c | e0643eb11188ffbb7716b5041ec1b48413f1f0a3 | refs/heads/master | 2021-01-21T04:46:55.616309 | 2016-06-28T03:42:37 | 2016-06-28T03:42:37 | 53,193,393 | 1 | 2 | null | 2016-03-05T11:48:40 | 2016-03-05T09:19:21 | Java | UTF-8 | Java | false | false | 1,474 | java | /*
* Copyright (C), 2014-2015, 杭州小卡科技有限公司
* FileName: AuditRecordEnum.java
* Author: muxing
* Date: 2016/3/26 13:30
* Description:
*/
package cn.com.tsjx.common.constants.enums;
/**
* AuditRecordEnum
*
* @author muxing
* @date 2016/3/26
*/
public enum AuditRecordEnum {
audit_type_information("1", "信息发布", "audit_type"),
audit_type_company("2", "企业审核", "audit_type"),
audit_status_success("1", "成功", "audit_status"),
audit_status_failure("2", "失败", "audit_status"),
deleted_t("T", "删除", "deleted"),
delete_f("F", "未删除", "deleted");
private final String code;
private final String description;
private final String type;
private AuditRecordEnum(String code, String description, String type) {
this.code = code;
this.description = description;
this.type = type;
}
public String code() {
return this.code;
}
public String description() {
return this.description;
}
public static String getDiscribeByCode(String code) {
String description = null;
for (AuditRecordEnum ie : AuditRecordEnum.values()) {
if (ie.code.equals(code)) {
description = ie.description;
}
}
return description;
}
public static AuditRecordEnum[] getEnumsByType(String type) {
AuditRecordEnum[] enums = new AuditRecordEnum[] {};
int i = 0;
for (AuditRecordEnum ie : AuditRecordEnum.values()) {
if (ie.type.equals(type)) {
enums[i++] = ie;
}
}
return enums;
}
}
| [
"[email protected]"
]
| |
86269464c53e6a53f26faa26b7caa5b2bd37810c | ec49f8de5235ab7c53baba8832d85e3f4a25aa40 | /seckill/src/main/java/com/liyuhua/seckill/vo/OrderDetailVo.java | a78ddc7da06ec4f8a4d96caa1a5d00b02ee89bd4 | []
| no_license | NJGamerLee/second-kill-mall | 3c111297cb058c68737214f4947c3ddbad217c79 | 5134dca893bc4cf89fdc94e62f1df8ae8cfafee2 | refs/heads/main | 2023-07-08T17:27:24.175674 | 2021-08-01T03:05:05 | 2021-08-01T03:05:05 | 391,493,384 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 290 | java | package com.liyuhua.seckill.vo;
import com.liyuhua.seckill.pojo.Order;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderDetailVo {
private Order order;
private GoodsVo goodsVo;
}
| [
"[email protected]"
]
| |
1ae4f7e786879a59864e4e5ca62b928d0cc38c77 | 1958844ba59c512b2bb4178290256a3cf0aaca1c | /core/common/src/main/java/com/xiaomi/example/core/common/utils/BeanFactoryHelper.java | 9e5309c79edb6e8421b04a9de9e37239d4f6f512 | []
| no_license | qtechjin/BookManage | 8896115d0a5e22a2a4f4401917878f382becd809 | 5ff86c69d210170f9569fc4e50df6c1baa97bbde | refs/heads/master | 2021-01-23T02:11:15.109702 | 2017-11-06T16:41:32 | 2017-11-06T16:41:32 | 85,973,045 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 705 | java | package com.xiaomi.example.core.common.utils;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
/**
* Created by liujin on 2017/10/10.
*/
public class BeanFactoryHelper implements BeanFactoryAware {
private BeanFactory beanFactory;
@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
this.beanFactory = beanFactory;
}
public Object getBean(String beanName) {
if(beanFactory == null) {
throw new NullPointerException("beanFactory is null");
}
return beanFactory.getBean(beanName);
}
}
| [
"[email protected]"
]
| |
6460b36c498f47a7684d522b03f7ddbc97db3db3 | 97abe0dd3c2a70abf5a715d32f54d8d6a1f1c7b3 | /src/edu/fudan/gaowei/wechat/db/dao/pojo/Dialog.java | 3246c10c77587bd4006c6ca1253731fbc3f2cd0c | []
| no_license | gaoliuliu/WeChatTest | 575acfb5f90d6ba8e28448097461875cebf458d2 | 6cd0ed00c434c13a3593b1d9f7aa6896a8eeb24e | refs/heads/master | 2021-01-20T11:04:30.879097 | 2014-11-02T12:46:38 | 2014-11-02T12:46:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 411 | java | package edu.fudan.gaowei.wechat.db.dao.pojo;
import java.sql.Timestamp;
/**
* Dialog entity. @author MyEclipse Persistence Tools
*/
public class Dialog extends AbstractDialog implements java.io.Serializable {
// Constructors
/** default constructor */
public Dialog() {
}
/** full constructor */
public Dialog(String openid, String content, Timestamp time) {
super(openid, content, time);
}
}
| [
"[email protected]"
]
| |
ba922e998b9aac07c319cb7df93d7c73df2682d4 | ee332bf9acd5681aefda9b5f090956291e98f892 | /j2ee assigments(JSP+Servl)/2.login using cookie/src(java servlet files)/LoginServlet.java | d0b4bfb353981ecf6ee2c1692f975e768bf84517 | []
| no_license | Coderode/J2EE-Applications | 4e527c333f7b293761a5ee4a0348b99d73477e3f | b14a7b3b86ace01feb56129218cac0b4df7633b3 | refs/heads/master | 2021-04-16T23:07:28.607912 | 2020-05-24T10:22:03 | 2020-05-24T10:22:03 | 249,390,732 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,444 | java | import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class LoginServlet extends HttpServlet{
public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException{
//actual username and password to be varified (hardcoded to verify)
String username="Sandeep";
String password="password";
//for writing on a web server
res.setContentType("text/html");
PrintWriter out=res.getWriter();
//creating username for temperary use
String tempUsername=null;
//checking if cookie exist
Cookie c[]=req.getCookies();
if(c!=null){
for(int i=0; i<c.length; i++){
if(c[i].getName().equals("dcsusername")){
tempUsername=c[i].getValue();
break;
}
}
}
if(tempUsername != null){
//if exist then redirect to profile page
req.getRequestDispatcher("profile.html").include(req, res);
out.println("<h1 style='text-align:center; color:darkgreen;'>Welcome "+tempUsername+" to the Our Website!</h1>");
out.println("<h2 style='text-align:center; color:green;'>Thanks for coming again!.</h2>");
}else{
//redirect to login form
req.getRequestDispatcher("login.html").include(req, res);
}
out.close();
}
} | [
"[email protected]"
]
| |
650448e962ec25ecb870efa342a57dd554467a2c | 82eba08b9a7ee1bd1a5f83c3176bf3c0826a3a32 | /ZmailServer/src/java/org/zmail/cs/index/query/InQuery.java | c850f9ae5cdbce7c6eae0dafeb4499c8eae1e034 | [
"MIT"
]
| permissive | keramist/zmailserver | d01187fb6086bf3784fe180bea2e1c0854c83f3f | 762642b77c8f559a57e93c9f89b1473d6858c159 | refs/heads/master | 2021-01-21T05:56:25.642425 | 2013-10-21T11:27:05 | 2013-10-22T12:48:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,653 | java | /*
* ***** BEGIN LICENSE BLOCK *****
* Zimbra Collaboration Suite Server
* Copyright (C) 2010, 2011, 2012 VMware, Inc.
*
* The contents of this file are subject to the Zimbra Public License
* Version 1.3 ("License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.zimbra.com/license.
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
* ***** END LICENSE BLOCK *****
*/
package org.zmail.cs.index.query;
import java.util.List;
import com.google.common.base.Strings;
import org.zmail.common.service.ServiceException;
import org.zmail.common.util.Pair;
import org.zmail.cs.index.DBQueryOperation;
import org.zmail.cs.index.IntersectionQueryOperation;
import org.zmail.cs.index.NoResultsQueryOperation;
import org.zmail.cs.index.QueryOperation;
import org.zmail.cs.index.UnionQueryOperation;
import org.zmail.cs.mailbox.Folder;
import org.zmail.cs.mailbox.MailServiceException;
import org.zmail.cs.mailbox.Mailbox;
import org.zmail.cs.mailbox.Mountpoint;
import org.zmail.cs.service.util.ItemId;
/**
* Query IN or UNDER a folder.
*
* @author tim
* @author ysasaki
*/
public final class InQuery extends Query {
public enum In {
ANY, LOCAL, REMOTE, NONE
}
private Folder folder;
private ItemId remoteId;
private String subfolderPath;
private In specialTarget;
private boolean includeSubfolders = false;
/**
* Creates a new {@link InQuery} by a folder ID.
*
* @param mbox mailbox
* @param fid folder ID
* @param under true to include sub folders, otherwise false
* @return query
* @throws ServiceException if an error occurred during mailbox access
*/
public static InQuery create(Mailbox mbox, int fid, boolean under)
throws ServiceException {
if (under && fid == Mailbox.ID_FOLDER_USER_ROOT) {
return new InQuery(null, null, null, In.ANY, under);
} else {
Folder folder = mbox.getFolderById(null, fid);
return new InQuery(folder, null, null, null, under);
}
}
/**
* Creates a new {@link InQuery} by a folder name.
*
* @param mailbox mailbox
* @param folder folder name
* @param under true to include sub folders, otherwise false
* @return query
* @throws ServiceException if an error occurred during mailbox access
*/
public static InQuery create(Mailbox mailbox, String folder, boolean under)
throws ServiceException {
Pair<Folder, String> result = mailbox.getFolderByPathLongestMatch(
null, Mailbox.ID_FOLDER_USER_ROOT, folder);
return recursiveResolve(mailbox, result.getFirst(),
result.getSecond(), under);
}
/**
* Creates a new {@link InQuery} with a special folder.
*
* @param in special folder
* @param under true to include sub folders, otherwise false
* @return query
*/
public static InQuery create(In in, boolean under) {
return new InQuery(null, null, null, in, under);
}
/**
* Creates a new {@link InQuery} with item ID.
*
* @param mailbox mailbox
* @param iid item ID
* @param path sub folder path
* @param under true to include sub folders, otherwise false
* @return query
* @throws ServiceException if an error occurred during mailbox access
*/
public static InQuery create(Mailbox mailbox, ItemId iid,
String path, boolean under) throws ServiceException {
if (iid.belongsTo(mailbox)) { // local
if (under && iid.getId() == Mailbox.ID_FOLDER_USER_ROOT) {
return new InQuery(null, iid, path, In.ANY, under);
}
// find the base folder
Pair<Folder, String> result;
if (!Strings.isNullOrEmpty(path)) {
result = mailbox.getFolderByPathLongestMatch(null, iid.getId(), path);
} else {
Folder folder = mailbox.getFolderById(null, iid.getId());
result = new Pair<Folder, String>(folder, null);
}
return recursiveResolve(mailbox, result.getFirst(),
result.getSecond(), under);
} else { // remote
return new InQuery(null, iid, path, null, under);
}
}
/**
* Resolve through local mountpoints until we get to the actual folder,
* or until we get to a remote folder.
*/
private static InQuery recursiveResolve(Mailbox mailbox, Folder folder,
String path, boolean under) throws ServiceException {
if (!(folder instanceof Mountpoint)) {
if (path != null) {
throw MailServiceException.NO_SUCH_FOLDER(
folder.getPath() + "/" + path);
}
return new InQuery(folder, null, null, null, under);
} else {
Mountpoint mpt = (Mountpoint) folder;
if (mpt.isLocal()) { // local
if (Strings.isNullOrEmpty(path)) {
return new InQuery(folder, null, null, null, under);
} else {
return recursiveResolve(mailbox,
mailbox.getFolderById(null, mpt.getRemoteId()),
path, under);
}
} else { // remote
return new InQuery(null, mpt.getTarget(), path, null, under);
}
}
}
private InQuery(Folder folder, ItemId remoteId, String path, In special, boolean under) {
this.folder = folder;
this.remoteId = remoteId;
this.subfolderPath = path;
this.specialTarget = special;
this.includeSubfolders = under;
}
@Override
public boolean hasTextOperation() {
return false;
}
@Override
public QueryOperation compile(Mailbox mbox, boolean bool) {
if (specialTarget != null) {
if (specialTarget == In.NONE) {
return new NoResultsQueryOperation();
} else if (specialTarget == In.ANY) {
DBQueryOperation op = new DBQueryOperation();
op.addAnyFolder(evalBool(bool));
return op;
} else {
if (evalBool(bool)) {
if (specialTarget == In.REMOTE) {
DBQueryOperation dbop = new DBQueryOperation();
dbop.addIsRemoteClause();
return dbop;
} else {
assert(specialTarget == In.LOCAL);
DBQueryOperation dbop = new DBQueryOperation();
dbop.addIsLocalClause();
return dbop;
}
} else {
if (specialTarget == In.REMOTE) {
DBQueryOperation dbop = new DBQueryOperation();
dbop.addIsLocalClause();
return dbop;
} else {
assert(specialTarget == In.LOCAL);
DBQueryOperation dbop = new DBQueryOperation();
dbop.addIsRemoteClause();
return dbop;
}
}
}
}
DBQueryOperation dbOp = new DBQueryOperation();
if (folder != null) {
if (includeSubfolders) {
List<Folder> subFolders = folder.getSubfolderHierarchy();
if (evalBool(bool)) {
// (A or B or C)
UnionQueryOperation union = new UnionQueryOperation();
for (Folder sub : subFolders) {
DBQueryOperation dbop = new DBQueryOperation();
union.add(dbop);
if (sub instanceof Mountpoint) {
Mountpoint mpt = (Mountpoint) sub;
if (!mpt.isLocal()) {
dbop.addInRemoteFolder(mpt.getTarget(), "", includeSubfolders, evalBool(bool));
} else {
// TODO FIXME handle local mountpoints. Don't forget to check for infinite recursion!
}
} else {
dbop.addInFolder(sub, evalBool(bool));
}
}
return union;
} else {
// -(A or B or C) ==> -A and -B and -C
IntersectionQueryOperation iop = new IntersectionQueryOperation();
for (Folder f : subFolders) {
DBQueryOperation dbop = new DBQueryOperation();
iop.addQueryOp(dbop);
if (f instanceof Mountpoint) {
Mountpoint mpt = (Mountpoint)f;
if (!mpt.isLocal()) {
dbop.addInRemoteFolder(mpt.getTarget(), "", includeSubfolders, evalBool(bool));
} else {
// TODO FIXME handle local mountpoints. Don't forget to check for infinite recursion!
}
} else {
dbop.addInFolder(f, evalBool(bool));
}
}
return iop;
}
} else {
dbOp.addInFolder(folder, evalBool(bool));
}
} else if (remoteId != null) {
dbOp.addInRemoteFolder(remoteId, subfolderPath, includeSubfolders, evalBool(bool));
} else {
assert(false);
}
return dbOp;
}
@Override
public void dump(StringBuilder out) {
out.append(includeSubfolders ? "UNDER:" : "IN:");
if (specialTarget != null) {
switch (specialTarget) {
case ANY:
out.append("ANY_FOLDER");
break;
case LOCAL:
out.append("LOCAL");
break;
case REMOTE:
out.append("REMOTE");
break;
case NONE:
out.append("NONE");
break;
}
} else {
out.append(remoteId != null ? remoteId.toString() : (folder != null ? folder.getName() : "ANY_FOLDER"));
if (subfolderPath != null) {
out.append('/');
out.append(subfolderPath);
}
}
}
@Override
public void sanitizedDump(StringBuilder out) {
out.append(includeSubfolders ? "UNDER:" : "IN:");
if (specialTarget != null) {
switch (specialTarget) {
case ANY:
out.append("ANY_FOLDER");
break;
case LOCAL:
out.append("LOCAL");
break;
case REMOTE:
out.append("REMOTE");
break;
case NONE:
out.append("NONE");
break;
}
} else {
out.append(remoteId != null ? "$REMOTEFOLDER" : (folder != null ? "$FOLDER" : "ANY_FOLDER"));
if (subfolderPath != null) {
out.append('/');
out.append("$SUBFOLDER");
}
}
}
}
| [
"[email protected]"
]
| |
6599bbe999a27f4ab7f0bc8734ea7522eb7c0e6e | 58d7ff7c645c26771faae523e4ccb1e8f932b3e8 | /MUD/model/creatures/abomdungeon/QuicksilverGolem.java | 83decf5041f629734b754ee975b7a006cc95b130 | []
| no_license | djeisenberg/Academic | c0ac2de7462498db0edbce91a0265e6460506637 | c5d0c0c9b57b74d11472b79986f7c16e06e60771 | refs/heads/master | 2021-01-18T18:31:58.782391 | 2015-04-23T18:59:03 | 2015-04-23T18:59:03 | 24,281,041 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,415 | java | package model.creatures.abomdungeon;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Random;
import model.creatures.Monster;
import model.items.Item;
import model.items.heavyfeet.UnseelieGreaves;
import model.items.heavylegs.UnseelieLeggings;
import model.items.useables.GreaterPotion;
import model.world.Room;
public class QuicksilverGolem extends Monster{
/**
*
*/
private static final long serialVersionUID = 1L;
public QuicksilverGolem(ArrayList<Room> movablerooms)
{
this.name = "Quicksilver Golem";
this.strength = 100;
this.agility = 75;
this.stamina = 50;
this.magic = 20;
this.attack = 100;
this.defense = 50;
this.evasion = 20;
this.magicDefense = 30;
this.hp = 250;
this.mp = 50;
this.level = 9;
this.currenthp = this.hp;
this.currentmp = this.mp;
this.mID = 23;
movable = movablerooms;
this.delay = this.delay - (10*this.agility);
this.img = "Abomination/Quicksilver Golem.png";
}
@Override
public void act() {
}
@Override
public Item stealList(int sroll) {
return null;
}
@Override
public LinkedList<Item> Treasure() {
Random x = new Random();
int y = x.nextInt((100) + 1);
if(y <= 5)
this.treasure.add(new UnseelieLeggings());
else if(y <= 10)
this.treasure.add(new UnseelieGreaves());
else if(y <= 30)
this.treasure.add(new GreaterPotion());
return treasure;
}
}
| [
"[email protected]"
]
| |
c174280184a960b96506b041c52584541e7de7c7 | 4aa57634faf42552f8b87bb501a15ce493b4bb3c | /classes/src/com/netcracker/alexey_makarov/contract/Going.java | 7621c36518ecc15fa1b3a53841f57fb63d0e12f0 | []
| no_license | amakaroff/netcracker | f97b6a48a2c972ad10df6132f89e0511f6009424 | eae4abc0e9a8b5d450566f53c7367f6aae2655ab | refs/heads/master | 2021-01-11T02:14:08.570619 | 2016-11-10T12:59:37 | 2016-11-10T12:59:37 | 71,006,273 | 0 | 0 | null | null | null | null | WINDOWS-1251 | Java | false | false | 144 | java | package com.netcracker.alexey_makarov.contract;
/**
* Created by Алексей on 15.10.2016.
*/
public interface Going {
void go();
}
| [
"[email protected]"
]
| |
54e06e5f7fc5d037263f0a04671e91aef03a9cb9 | d1ffdb28eb8ae4681ffcdd25e263eac73c03b044 | /LeetCode/559. Maximum Depth of N-ary Tree/Solution.java | b4ef11c076038910aa808dd8dcb132ab8b3eacba | []
| no_license | DamianBhatia/Interview-and-Competitive-Problem-Solutions | 8c0a38b0c19fa32eb6469e99798c5acc999a6db7 | 03d76c916cc9844768a36269412e7e86b52cb353 | refs/heads/master | 2023-04-23T11:52:07.364528 | 2021-05-01T17:38:46 | 2021-05-01T17:38:46 | 282,354,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,052 | java | /* PROBLEM DESCRIPTION
Given a n-ary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
Example 1:
Input: root = [1,null,3,2,4,null,5,6]
Output: 3
Example 2:
Input: root = [1,null,2,3,4,5,null,null,6,7,null,9,10,null,null,11,null,12,null,13,null,null,14]
Output: 5
Constraints:
- The depth of the n-ary tree is less than or equal to 1000
- The total number of nodes is between [0, 10^4]
*/
/*
// Definition for a Node.
class Node {
public int val;
public List<Node> children;
public Node() {}
public Node(int _val) {
val = _val;
}
public Node(int _val, List<Node> _children) {
val = _val;
children = _children;
}
};
*/
class Solution {
public int maxDepth(Node root) {
if(root == NULL) {
return 0;
}
int depth = 0;
for(Node child : root.children) {
depth = Math.max(depth, maxDepth(child));
}
return depth + 1;
}
} | [
"[email protected]"
]
| |
fa0fcecaa5ae61216a61e57704fb2e1b126101d6 | dfbb751d988265cf026c969ca0f767b4a53aed16 | /src/com/colt/settings/fragments/statusbartabs/NetworkTraffic.java | 3c2bb0547b8bda87ec3c30679f69e41474389c91 | []
| no_license | Colt-AOSP/platform_packages_apps_ColtCenter | 17387798302846bceff032bfde74952afad451d4 | 9ad2f01ff59499c5be07eda45cbc07f9ed9f4d9b | refs/heads/cos8.x | 2021-05-12T11:47:40.492405 | 2018-06-24T10:35:07 | 2018-06-24T19:31:03 | 117,396,802 | 1 | 5 | null | 2018-05-30T10:01:38 | 2018-01-14T02:55:49 | Java | UTF-8 | Java | false | false | 3,764 | java | /*
* Copyright (C) 2016 Ground Zero Roms
*
* 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.colt.settings.fragments.statusbartabs;
import android.content.Context;
import android.content.ContentResolver;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.UserHandle;
import android.support.v7.preference.PreferenceCategory;
import android.support.v7.preference.PreferenceScreen;
import android.support.v7.preference.ListPreference;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
import android.provider.Settings;
import com.android.settings.R;
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
import com.colt.settings.preferences.CustomSeekBarPreference;
import com.colt.settings.preferences.SystemSettingSwitchPreference;
public class NetworkTraffic extends SettingsPreferenceFragment implements
OnPreferenceChangeListener {
private CustomSeekBarPreference mThreshold;
private SystemSettingSwitchPreference mNetMonitor;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.network_traffic);
final ContentResolver resolver = getActivity().getContentResolver();
boolean isNetMonitorEnabled = Settings.System.getIntForUser(resolver,
Settings.System.NETWORK_TRAFFIC_STATE, 1, UserHandle.USER_CURRENT) == 1;
mNetMonitor = (SystemSettingSwitchPreference) findPreference("network_traffic_state");
mNetMonitor.setChecked(isNetMonitorEnabled);
mNetMonitor.setOnPreferenceChangeListener(this);
int value = Settings.System.getIntForUser(resolver,
Settings.System.NETWORK_TRAFFIC_AUTOHIDE_THRESHOLD, 1, UserHandle.USER_CURRENT);
mThreshold = (CustomSeekBarPreference) findPreference("network_traffic_autohide_threshold");
mThreshold.setValue(value);
mThreshold.setOnPreferenceChangeListener(this);
mThreshold.setEnabled(isNetMonitorEnabled);
}
@Override
public int getMetricsCategory() {
return MetricsProto.MetricsEvent.COLT;
}
@Override
public void onResume() {
super.onResume();
}
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (preference == mNetMonitor) {
boolean value = (Boolean) newValue;
Settings.System.putIntForUser(getActivity().getContentResolver(),
Settings.System.NETWORK_TRAFFIC_STATE, value ? 1 : 0,
UserHandle.USER_CURRENT);
mNetMonitor.setChecked(value);
mThreshold.setEnabled(value);
return true;
} else if (preference == mThreshold) {
int val = (Integer) newValue;
Settings.System.putIntForUser(getContentResolver(),
Settings.System.NETWORK_TRAFFIC_AUTOHIDE_THRESHOLD, val,
UserHandle.USER_CURRENT);
return true;
}
return false;
}
}
| [
"[email protected]"
]
| |
977971adb6f42d1d80b5815f4a25e67dbe67cd57 | 6ba4f434aaf1c921db8a88742e74ad17788eebac | /ContactManager/src/com/example/contactmanager/ModifyContactAdapter.java | b36daa11dad7a35e84a4f2bdf7e19f829b36da62 | []
| no_license | mukeshsingh26/Automotive | c8ec650c69892717d7418a3dccda4561e58aff1e | a3be6d5c388390a790829bfee1548e15078b1d0c | refs/heads/master | 2021-01-23T12:05:30.277078 | 2015-09-16T07:52:06 | 2015-09-16T07:52:06 | 42,572,804 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,434 | java | package com.example.contactmanager;
import java.util.List;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;
public class ModifyContactAdapter extends BaseAdapter {
private Context mContext;
private List<AppInfo> mListAppInfo;
ViewHolder holder;
public ModifyContactAdapter(Context context, List<AppInfo> list) {
mContext = context;
mListAppInfo = list;
}
@Override
public int getCount() {
return mListAppInfo.size();
}
@Override
public Object getItem(int position) {
return mListAppInfo.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
AppInfo entry = mListAppInfo.get(position);
holder = null;
// if(convertView == null) {
LayoutInflater inflater = LayoutInflater.from(mContext);
convertView = inflater.inflate(R.layout.modify_list_item, null);
holder = new ViewHolder();
holder.contact_name_label = (TextView)convertView.findViewById(R.id.list_name_label);
holder.contact_name_text = (TextView)convertView.findViewById(R.id.list_name_text);
holder.contact_phone_label = (TextView)convertView.findViewById(R.id.list_phone_label);
holder.contact_phone_text = (TextView)convertView.findViewById(R.id.list_phone_text);
holder.contact_email_label = (TextView)convertView.findViewById(R.id.list_email_label);
holder.contact_email_text = (TextView)convertView.findViewById(R.id.list_email_text);
holder.contact_emailtype_label = (TextView)convertView.findViewById(R.id.list_emailtype_label);
holder.contact_emailtype_text = (TextView)convertView.findViewById(R.id.list_emailtype_text);
holder.contact_phonetype_label = (TextView)convertView.findViewById(R.id.list_phonetype_label);
holder.contact_phonetype_text = (TextView)convertView.findViewById(R.id.list_phonetype_text);
holder.editContact = (Button)convertView.findViewById(R.id.btn_edit_list);
holder.editContact.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
AppInfo entry = mListAppInfo.get(position);
String name = entry.getName().toString();
String phone = entry.getphone().toString();
String email = entry.getemail().toString();
String phonetype = entry.getphoneType().toString();
String emailtype = entry.getemailType().toString();
createFragmentAndCommit(new EditContactsFragment(), name ,phone, email, phonetype, emailtype);
}
});
convertView.setTag(holder);
// }
// else {
// holder = (ViewHolder)convertView.getTag();
// }
holder.contact_name_text.setText(entry.getName());
holder.contact_phone_text.setText(entry.getphone());
holder.contact_email_text.setText(entry.getemail());
holder.contact_emailtype_text.setText(entry.getemailType());
holder.contact_phonetype_text.setText(entry.getphoneType());
return convertView;
}
static class ViewHolder {
TextView contact_name_label,contact_name_text,contact_phone_label,contact_phone_text,
contact_email_label,contact_email_text,contact_phonetype_label,contact_phonetype_text,contact_emailtype_label,contact_emailtype_text;
Button editContact;
}
private String fragmentTag;
private void createFragmentAndCommit(Fragment newFragment, String name, String phone, String email, String phonetype, String emailtype) {
// Create new fragment and transaction
Bundle bundle = new Bundle();
bundle.putString("ITEM_NAME", name);
bundle.putString("ITEM_PHONE", phone);
bundle.putString("ITEM_EMAIL", email);
bundle.putString("ITEM_PHONE_TYPE", phonetype);
bundle.putString("ITEM_EMAIL_TYPE", emailtype);
newFragment.setArguments(bundle);
fragmentTag = newFragment.getClass().getName();
Activity activity = (Activity) mContext;
FragmentManager manager = activity.getFragmentManager();
// fragment not in back stack, create it.)
FragmentTransaction transaction = manager.beginTransaction();
//transaction.setCustomAnimations(R.anim.slide_in_left1, R.anim.slide_out_left1);
// Replace whatever is in the fragment_container view with this
// fragment,
// and add the transaction to the back stack
transaction.replace(R.id.fragment_container, newFragment, fragmentTag);
// transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
//transaction.addToBackStack(null);
// Commit the transaction
transaction.commit();
}
}
| [
"[email protected]"
]
| |
addce741474cccb2d28941b994d2a9b84095f149 | 638684378d281aa23d3262f0eb6ead5527fb544c | /java/510.java | 0d224d4cf297ea36b1cc57c49334b679e64e6e56 | []
| no_license | PatriotJ/chenyun-leetcode | 3bd52525f75b91786bfa11ead754e19d7765ef4f | e1b43d5e1819916cd48598a1a6a547f749ffff3c | refs/heads/master | 2020-05-30T18:59:23.818287 | 2019-07-11T23:20:37 | 2019-07-11T23:20:37 | 189,913,801 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java | /*
// Definition for a Node.
class Node {
public int val;
public Node left;
public Node right;
public Node parent;
};
*/
class Solution {
public Node inorderSuccessor(Node x) {
if(x == null){
return null;
}
if(x.right != null){
Node cur = x.right;
while(cur.left != null){
cur = cur.left;
}
return cur;
}
while(x.parent != null && x.parent.right == x){
x = x.parent;
}
return x.parent;
}
} | [
"[email protected]"
]
| |
1bce07dc0b0c3cf4b1924c10471951b84775b3a0 | c9a3c83121fcaffbfe4f8ecc389a7a525b8a9107 | /P-III/aula10/ex1/Quadrado.java | 1577410fd1886c86fbcff297156d9daf223bfe28 | []
| no_license | RodrigoRosmaninho/miect_stuff | 150c9ecc91d64b67e135112456ebdb5206cbe8e6 | 6c8a7ecf75278bf34d575e47095b9738b373391f | refs/heads/master | 2022-05-30T22:59:27.912901 | 2022-05-17T19:48:23 | 2022-05-17T19:48:23 | 168,650,793 | 0 | 5 | null | null | null | null | UTF-8 | Java | false | false | 729 | java | package aula10.ex1;
public class Quadrado extends Retangulo {
public Quadrado(double abcissa, double ordenada, double lado) {
super(abcissa, ordenada, lado, lado);
}
public Quadrado(double lado) {
super(lado, lado);
}
public Quadrado(Quadrado q) {
super(q);
}
@Override
public double getArea(){
double lado = getComprimento();
return Math.abs(lado) * Math.abs(lado);
}
@Override
public double getPerimetro(){
double lado = getComprimento();
return 4 * Math.abs(lado);
}
@Override
public String toString(){
return "Quadrado de Centro " + getCentro() + " e de lado " + getComprimento();
}
}
| [
"[email protected]"
]
| |
51a16c34a05c89d5145998c600772abd145a2d52 | e977c424543422f49a25695665eb85bfc0700784 | /benchmark/icse15/956763/buggy-version/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/Changes10_7.java | 552c3af53ea5535720b5bfa1aaadd4925c21e7a4 | []
| no_license | amir9979/pattern-detector-experiment | 17fcb8934cef379fb96002450d11fac62e002dd3 | db67691e536e1550245e76d7d1c8dced181df496 | refs/heads/master | 2022-02-18T10:24:32.235975 | 2019-09-13T15:42:55 | 2019-09-13T15:42:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,077 | java | /*
Derby - Class org.apache.derbyTesting.functionTests.tests.upgradeTests.Changes10_7
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.apache.derbyTesting.functionTests.tests.upgradeTests;
import org.apache.derbyTesting.junit.SupportFilesSetup;
import org.apache.derbyTesting.junit.JDBCDataSource;
import java.lang.reflect.Method;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.sql.DataSource;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.derby.catalog.types.RoutineAliasInfo;
import org.apache.derby.catalog.TypeDescriptor;
import org.apache.derbyTesting.junit.JDBC;
/**
* Upgrade test cases for 10.7.
* If the old version is 10.7 or later then these tests
* will not be run.
* <BR>
10.7 Upgrade issues
<UL>
<LI>BOOLEAN data type support expanded.</LI>
</UL>
*/
public class Changes10_7 extends UpgradeChange
{
///////////////////////////////////////////////////////////////////////////////////
//
// CONSTANTS
//
///////////////////////////////////////////////////////////////////////////////////
private static final String SYNTAX_ERROR = "42X01";
private static final String UPGRADE_REQUIRED = "XCL47";
private static final String GRANT_REVOKE_WITH_LEGACY_ACCESS = "42Z60";
///////////////////////////////////////////////////////////////////////////////////
//
// STATE
//
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
//
// CONSTRUCTOR
//
///////////////////////////////////////////////////////////////////////////////////
public Changes10_7(String name)
{
super(name);
}
///////////////////////////////////////////////////////////////////////////////////
//
// JUnit BEHAVIOR
//
///////////////////////////////////////////////////////////////////////////////////
/**
* Return the suite of tests to test the changes made in 10.7.
* @param phase an integer that indicates the current phase in
* the upgrade test.
* @return the test suite created.
*/
public static Test suite(int phase) {
TestSuite suite = new TestSuite("Upgrade test for 10.7");
suite.addTestSuite(Changes10_7.class);
return new SupportFilesSetup((Test) suite);
}
///////////////////////////////////////////////////////////////////////////////////
//
// TESTS
//
///////////////////////////////////////////////////////////////////////////////////
/**
* Make sure that that database is at level 10.7 in order to enjoy
* extended support for the BOOLEAN datatype.
*/
public void testBoolean() throws SQLException
{
String booleanValuedFunction =
"create function f_4655( a varchar( 100 ) ) returns boolean\n" +
"language java parameter style java no sql deterministic\n" +
"external name 'Z.getBooleanValue'\n";
Statement s = createStatement();
switch ( getPhase() )
{
case PH_CREATE: // create with old version
case PH_POST_SOFT_UPGRADE: // soft-downgrade: boot with old version after soft-upgrade
assertStatementError( SYNTAX_ERROR, s, booleanValuedFunction );
break;
case PH_SOFT_UPGRADE: // boot with new version and soft-upgrade
assertStatementError( UPGRADE_REQUIRED, s, booleanValuedFunction );
break;
case PH_HARD_UPGRADE: // boot with new version and hard-upgrade
s.execute( booleanValuedFunction );
break;
}
s.close();
}
/**
* Make sure that that database is at level 10.7 in order to enjoy
* routines with specified EXTERNAL SECURITY INVOKER or DEFINER.
*/
public void testExternalSecuritySpecification() throws SQLException
{
String functionWithDefinersRights =
"create function f_4551( a varchar( 100 ) ) returns int\n" +
"language java parameter style java reads sql data\n" +
"external security definer\n" +
"external name 'Z.getIntValue'\n";
Statement s = createStatement();
switch ( getPhase() )
{
case PH_CREATE: // create with old version
case PH_POST_SOFT_UPGRADE:
// soft-downgrade: boot with old version after soft-upgrade
assertStatementError(
SYNTAX_ERROR, s, functionWithDefinersRights );
break;
case PH_SOFT_UPGRADE: // boot with new version and soft-upgrade
assertStatementError(
UPGRADE_REQUIRED, s, functionWithDefinersRights );
break;
case PH_HARD_UPGRADE: // boot with new version and hard-upgrade.
// Syntax now accepted and dictionary level ok, but
// sqlAuthorization not enabled (a priori) - expected.
assertStatementError(GRANT_REVOKE_WITH_LEGACY_ACCESS,
s, functionWithDefinersRights );
break;
}
s.close();
}
}
| [
"[email protected]"
]
| |
9a36a3af240ec449dc966611cf6e6b19de3a3209 | 21490055641f5c93f6d88e60c00f35157b8b9707 | /jeonghaejwo/src/main/java/com/jeong/haejwo/Exam.java | 7f68a9ea34b13e2fc9148809ed0ac64fe6c82049 | []
| no_license | thingki/thegoodteamproject | 2106b41d3d02cb775d79a560693dc885e7538425 | 8f04b7b5a60340ec903321715dbf00ddf7ab9dcf | refs/heads/master | 2020-03-13T20:20:42.773636 | 2018-04-27T09:02:23 | 2018-04-27T09:02:23 | 131,272,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,586 | java | package com.jeong.haejwo;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import com.google.gson.Gson;
public class Exam {
Gson gson=new Gson();
static String u= "http://api.visitkorea.or.kr/openapi/service/rest/KorService/locationBasedList?serviceKey=peWkmeOBUcoT4b1Oqd7%2FotBYLzAO%2BWBymO82ftCMolY%2Bs9AI1ppnNVO4U9a%2Blhohtj1X38Iy4ENC1ReL1aHKWg%3D%3D&numOfRoews=10&pageNo=1&startPage=1&MobileOS=ETC&MobileApp=AppTest&arrange=A&contenttypeId=15&mapX=127.028900&mapY=37.496243&radius=500&listYN=Y";
public static void main(String[] args) {
URL url = null;
HttpURLConnection conn = null;
String jsonData = "";
BufferedReader br = null;
StringBuffer sb = null;
String returnText = "";
try {
url = new URL(u);
conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("Accept", "application/json");
conn.setRequestMethod("GET");
conn.connect();
br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
sb = new StringBuffer();
while ((jsonData = br.readLine()) != null) {
sb.append(jsonData);
}
returnText = sb.toString();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (br != null) br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println(returnText);
}
}
| [
"DJA@DJA-PC"
]
| DJA@DJA-PC |
f7583fbe1698ec78bb04976cd909e2d688a6c860 | 70a751ad54a44bf3b2a3b566468d93d8f3fcbfe7 | /AppsToInstall/src/main/java/com/flexera/model/Inventory.java | 544036b5123faaae6ecc23fbc5549a89a80a9a88 | []
| no_license | ravienu/AppsOnComputers | 9c708e9618a225cbfc8e9a57376f49ef752e97e8 | 73827b6a9cc532c12fd600b5c79ad9095da24e6c | refs/heads/master | 2021-07-05T15:03:18.625408 | 2019-12-15T12:52:41 | 2019-12-15T12:52:41 | 191,541,251 | 0 | 0 | null | 2020-10-13T14:03:21 | 2019-06-12T09:33:25 | Java | UTF-8 | Java | false | false | 313 | java | package com.flexera.model;
import lombok.*;
/**
* To hold data from CSV
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ToString
public class Inventory {
private int computerId;
private int userID;
private int applicationId;
private String computerType;
private String comment;
} | [
"[email protected]"
]
| |
2823da34ee37b07ad9667532d508aba90d7fb706 | 76699b4cdaf7ee20bfa7bed558981a6af956209f | /server/src/com/qeweb/demo/load/fc/bop/DemoImageBOP_1.java | f2e74284addad65a31b64d4d15d5a8a3e46d5460 | []
| no_license | jdepend/ILF | dcc64d01f0d196074b8474ce765c919e292f4c3e | 20fe443863aadaf5bec958355ca101ef893496a2 | refs/heads/master | 2021-01-10T09:02:12.849266 | 2016-04-25T09:02:22 | 2016-04-25T09:02:22 | 51,197,659 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package com.qeweb.demo.load.fc.bop;
import com.qeweb.framework.bc.sysbop.ImageBOP;
public class DemoImageBOP_1 extends ImageBOP {
/**
*
*/
private static final long serialVersionUID = -2443126191152488652L;
@Override
public void init() {
super.init();
setWidth("80");
setHeight("80");
setValue("http://www.baidu.com/img/baidu_sylogo1.gif");
}
}
| [
"[email protected]"
]
| |
59abdb92cb03be2380254ccd98d7c4f6b62deda0 | 18244671bfb24d217ffe7e3fdd581a26036cabcb | /src/main/MyStack.java | bca9035b82d4ef3e2aaf8c8510beb2ca2e186d65 | []
| no_license | MaxKochanov/StackCalculator | ab49428a49e13d8b8add92ff59cfa3e974f53987 | a37a06c79083256724804f60932888728b21054c | refs/heads/master | 2020-04-02T01:09:50.430850 | 2019-01-27T16:54:49 | 2019-01-27T16:54:49 | 153,841,344 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 121 | java | package main;
import java.util.Stack;
public class MyStack {
public static Stack<Double> stack = new Stack<>();
}
| [
"[email protected]"
]
| |
e6c9dd24d9f5b2bb3517c3d6bea0e6862926b772 | 2bdba202a47c5fb60edb63382a175bcd45af01c1 | /src/main/java/com/pricecatalog/common/RetModel.java | c2d7ce5f8a05f3b3d2ad70bcfdcc4d0a5f39ca25 | []
| no_license | sukeyYang/price-catalog | bba806046c02cc5a5d904c29bff63778babce9ff | f999787c0f01ea5c941488f490e191ef74d58868 | refs/heads/master | 2021-01-20T08:16:41.046093 | 2017-05-12T13:05:13 | 2017-05-12T13:05:13 | 90,125,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 830 | java | package com.pricecatalog.common;
import java.util.List;
import java.util.Map;
/**
* Created by sukey on 2016/12/13.
*/
public class RetModel {
private int page;
private int total;
private int records;
private List<Map<String, Object>> rows;
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getRecords() {
return records;
}
public void setRecords(int records) {
this.records = records;
}
public List<Map<String, Object>> getRows() {
return rows;
}
public void setRows(List<Map<String, Object>> rows) {
this.rows = rows;
}
}
| [
"[email protected]"
]
| |
da7b5b1fef212aa24ffd6408c6dceffd9409afa8 | 89fc865c4c5dc1e7deb7bdb0c46c0c7d62d19434 | /security-filter/src/main/java/pro/javatar/security/oidc/exceptions/ObtainRefreshTokenException.java | 7f76894000379e14a97023d714ae482f6b711539 | [
"Apache-2.0"
]
| permissive | JavatarPro/javatar-security | 34faac97f39735f5a384850334c8277e987de0f5 | 0ffafb8bf0d4c1d3c381eda3abfdbed20652f654 | refs/heads/develop | 2021-06-07T00:32:16.775454 | 2020-11-16T08:40:45 | 2020-11-16T08:40:45 | 145,104,488 | 8 | 1 | Apache-2.0 | 2021-06-03T23:53:20 | 2018-08-17T10:00:32 | Java | UTF-8 | Java | false | false | 616 | java | package pro.javatar.security.oidc.exceptions;
import org.springframework.http.HttpStatus;
public class ObtainRefreshTokenException extends AuthenticationException {
public ObtainRefreshTokenException() {
code = "401RefreshTokenError";
status = HttpStatus.UNAUTHORIZED;
message = "Please check parameters for token refresh";
devMessage = "Refresh token error.";
}
public ObtainRefreshTokenException(String message) {
super(message);
}
public ObtainRefreshTokenException(String message, String devMessage) {
super(message, devMessage);
}
}
| [
"[email protected]"
]
| |
ce280b525cb8296a087b34d510b7c9f1e8eb6e2f | 7ef08ef00060418f54e78ec57dda9d0a5efdeb1f | /Exercise3/src/Search/Nil.java | b776d670e62b7128c996d8eea9e291775609c212 | []
| no_license | shmink/Robotics | 2e768533cb8a88e0e93d1ca0587568f10b2d5e1a | 39ed29efa4d39c867ee2198ad8d657715f10c58c | refs/heads/master | 2021-03-27T18:14:40.895086 | 2015-03-27T21:19:56 | 2015-03-27T21:19:56 | 30,325,044 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,439 | java | package Search;
/**
* Implementation of the empty list
* (using the "composite pattern").
*/
public class Nil<A> implements IList<A> {
public Nil() { // Nothing to do in the constructor!
} // Could simply remove it.
public boolean isEmpty() {
return true;
}
public int size() {
return 0;
}
public String toString() {
return "Nil";
}
public IList<A> append(IList<A> l) {
return l;
}
public IList<A> append(A a) {
return new Cons<A>(a , this);
}
public IList<A> reverse() {
return this;
}
public boolean has(A a) {
return false;
}
// Higher-order functions:
public IList<A> filter(Predicate<A> p) {
return this; // new Nil<A>() also works.
}
public <B> IList<B> map(Function<A,B> f) {
return new Nil<B>();
}
public <B> B fold(Function2<A,B,B> f, B b) {
return b;
}
public boolean all(Predicate<A> p) {
return true;
}
public boolean some(Predicate<A> p) {
return false;
}
public void forEach(Action<A> f) {
// Nothing to do, but we have to include the method. (Why?)
}
// Unsafe operations:
public A head() {
throw new RuntimeException("tried to get the head of an empty list");
}
public IList<A> tail() {
throw new RuntimeException("tried to get the tail of an empty list");
}
// Safe:
public <B> B cases(B b, Function2<A,IList<A>,B> f) {
return b;
}
}
| [
"[email protected]"
]
| |
2e4482aeb0b0c365350765196710deebce0242e5 | 8d8364832a7ba10745c9ffc899e8d6bbd3326670 | /src/main/java/org/seimicrawler/xpath/core/axis/DescendantOrSelfSelector.java | e95f86fc3170c692bbab1432d67cf3086870cd07 | [
"Apache-2.0"
]
| permissive | zhegexiaohuozi/JsoupXpath | f903264c7b4c7cd84bc44c5fafaa42ad341c20d5 | 590c6c2829af3b0ed04f18762c94ac53b4647e7b | refs/heads/master | 2023-03-31T07:00:58.560012 | 2023-03-27T02:37:42 | 2023-03-27T02:37:42 | 17,937,492 | 464 | 184 | Apache-2.0 | 2023-02-06T11:27:56 | 2014-03-20T09:46:17 | Java | UTF-8 | Java | false | false | 945 | java | package org.seimicrawler.xpath.core.axis;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.seimicrawler.xpath.core.AxisSelector;
import org.seimicrawler.xpath.core.XValue;
import java.util.HashSet;
import java.util.Set;
/**
* the descendant-or-self axis contains the context node and the descendants of the context node
*
* @author github.com/zhegexiaohuozi [email protected]
* @since 2018/3/26.
*/
public class DescendantOrSelfSelector implements AxisSelector {
@Override
public String name() {
return "descendant-or-self";
}
@Override
public XValue apply(Elements context) {
Set<Element> total = new HashSet<>();
Elements descendant = new Elements();
for (Element el:context){
Elements tmp = el.getAllElements();
total.addAll(tmp);
}
descendant.addAll(total);
return XValue.create(descendant);
}
}
| [
"[email protected]"
]
| |
abcb66b5ae4e601b1105b680fd9e7fdc9e5c84e6 | d3e4fc8de4b09164826837d5cfaf16443fcbe62d | /try/src/com/demo/example/ReadCSVSplit.java | 2d0cbfd304d20ae795bda7deef8ecaa52728e88e | []
| no_license | vishnu1646-hub/trytry | 2c3c46f7ea6dbee10cdf1169d6f244e76a0627dd | 30aaef774f91efe5c0ecb2dc4a85745befc676a4 | refs/heads/master | 2023-07-19T02:40:54.027904 | 2021-09-22T13:06:57 | 2021-09-22T13:06:57 | 409,209,716 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 542 | java | package com.demo.example;
import java.io.BufferedReader;
import java.io.FileReader;
public class ReadCSVSplit {
public static void main(String[] args) throws Exception {
String line = "";
String splitBy = ",";
BufferedReader bufferedReader = new BufferedReader(new FileReader("D://csvfiles/csvdemo.csv"));
while ((line = bufferedReader.readLine()) != null) {
String[] values = line.split(splitBy);
System.out.println(values[0] + " : " + values[1] + " : " + values[2]);
}
bufferedReader.close();
}
}
| [
"[email protected]"
]
| |
0fe70337a3dbd2c8ac821c9b23e58ea59fd0ebc3 | 424084598bb9981271f13bd34ecff441b1a993ae | /desafio-crud/src/main/java/br/com/bootcamp/desafiocrud/DesafioCrudApplication.java | 1e87fb735e4f4c724a2dd141dae7c4317e069e36 | []
| no_license | tobiasb14/desafio-crud | 4c96616b5354901df0ce5526492b87eaaeac8f61 | 6f9320cb237f1ea0e9e9c2a7c499ce3849a45b7d | refs/heads/main | 2023-07-19T06:31:33.785353 | 2021-09-28T00:33:20 | 2021-09-28T00:33:20 | 410,443,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 330 | java | package br.com.bootcamp.desafiocrud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DesafioCrudApplication {
public static void main(String[] args) {
SpringApplication.run(DesafioCrudApplication.class, args);
}
}
| [
"[email protected]"
]
| |
e56a5cc258e2e7f3bca61f5b86c373bc4b250a9b | 66482af4c6f184770daa61e8588595141f7bd006 | /src/main/java/com/ebuer/hbase/PhoenixClient.java | b584cf41ef9bbb603af54241b29431c5b1aab9d2 | []
| no_license | xuyang0902/hutils | 6925cddfff083e84b4ef4f392aff1a6a1ad5be34 | 8d517b923506930a11085ab4aae52988a035314d | refs/heads/master | 2021-01-11T22:57:24.978898 | 2017-01-10T11:51:27 | 2017-01-10T11:51:27 | 78,200,777 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,360 | java | package com.ebuer.hbase;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ebuer.exception.PhoenixException;
import org.apache.phoenix.jdbc.PhoenixResultSet;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.*;
/**
* 利用Phoenix访问Hbase
*
* @author xu.qiang
* @date 2016/12/30.
*/
public class PhoenixClient {
/**
* zookeeper的master-host
*/
private String host;
/**
* zookeeper的master-port
*/
private int port;
// Phoenix DB不支持直接设置连接超时 所以这里使用线程池的方式来控制数据库连接超时
private static ThreadPoolExecutor threadPool = null;
/**
* 利用静态块的方式初始化Driver 以及线程池
*/
static {
try {
Class.forName("org.apache.phoenix.jdbc.PhoenixDriver");
threadPool = new ThreadPoolExecutor(4,
Runtime.getRuntime().availableProcessors(),
10L,
TimeUnit.SECONDS,
new LinkedBlockingDeque<Runnable>(10),
new RejectedExecutionHandler() {
public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
try {
executor.getQueue().put(r);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
threadPool.allowCoreThreadTimeOut(true);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
/**
* 获取一个Hbase-Phoenix的连接
*
* @param host zookeeper的master-host
* @param port zookeeper的master-port
* @return
*/
private Connection getConnection(String host, int port) {
Connection cc = null;
final String url = "jdbc:phoenix:" + host + ":" + port;
if (cc == null) {
try {
Callable<Connection> call = new Callable<Connection>() {
public Connection call() throws Exception {
return DriverManager.getConnection(url);
}
};
Future<Connection> future = threadPool.submit(call);
// 如果在30s钟之内,还没得到 Connection 对象,则认为连接超时,不继续阻塞,防止服务夯死
cc = future.get(30, TimeUnit.SECONDS);
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
} catch (TimeoutException e) {
e.printStackTrace();
}
}
return cc;
}
/**
* 根据sql查询hbase中的内容;根据phoenix支持的SQL格式,查询Hbase的数据,并返回json格式的数据
*
* @param phoenixSQL sql语句
* @return
*/
public String execQuerySql(String phoenixSQL) {
Connection conn = null;
Statement stmt = null;
try {
// 获取一个Phoenix DB连接
conn = this.getConnection(host, port);
if (conn == null) {
throw new PhoenixException("phoenix execSql connect time out");
}
// 准备查询
stmt = conn.createStatement();
PhoenixResultSet set = (PhoenixResultSet) stmt.executeQuery(phoenixSQL);
// 查询出来的列是不固定的,所以这里通过遍历的方式获取列名
ResultSetMetaData meta = set.getMetaData();
ArrayList<String> cols = new ArrayList<String>();
// 把最终数据都转成JSON返回
JSONArray jsonArr = new JSONArray();
while (set.next()) {
if (cols.size() == 0) {
for (int i = 1, count = meta.getColumnCount(); i <= count; i++) {
cols.add(meta.getColumnName(i));
}
}
JSONObject json = new JSONObject();
for (int i = 0, len = cols.size(); i < len; i++) {
json.put(cols.get(i), set.getString(cols.get(i)));
}
jsonArr.add(json);
}
// 结果封装
JSONObject data = new JSONObject();
data.put("data", jsonArr);
return data.toString();
} catch (SQLException e) {
throw new PhoenixException("phoenix querySQl error:{}", e);
} finally {
release(conn, stmt);
}
}
/**
* 批量执行 内部每1024个sql提交一个批次 最后一次全部提交
*
* @param sqlList
*/
public void execBatchSql(List<String> sqlList) {
Connection conn = null;
Statement stmt = null;
try {
// 获取一个Phoenix DB连接
conn = this.getConnection(host, port);
if (conn == null) {
throw new PhoenixException("phoenix execSql connect time out");
}
Statement statement = conn.createStatement();
int size = sqlList.size();
for (int index = 0; index < size; index++) {
statement.addBatch(sqlList.get(index));
if (index == 1024) {
statement.executeBatch();
}
}
statement.executeBatch();
conn.commit();
} catch (SQLException e) {
throw new PhoenixException("phoenix querySQl error:{}", e);
} finally {
release(conn, stmt);
}
}
/**
* 执行其他sql
*
* @param sqls
*/
public void execSql(String... sqls) {
Connection conn = null;
Statement stmt = null;
try {
// 获取一个Phoenix DB连接
conn = this.getConnection(host, port);
if (conn == null) {
throw new PhoenixException("phoenix execSql connect time out");
}
for (String sql : sqls) {
PreparedStatement preparedStatement = conn.prepareStatement(sql);
preparedStatement.execute();
}
conn.commit();
} catch (SQLException e) {
throw new PhoenixException("phoenix querySQl error:{}", e);
} finally {
release(conn, stmt);
}
}
/**
* 释放资源
*
* @param conn
* @param stmt
*/
private void release(Connection conn, Statement stmt) {
if (stmt != null) {
try {
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
} | [
"[email protected]"
]
| |
0096913cdb124e8f40b9a6d893171d4eabc4ffca | 533d630c142ef5016f49cbbc70205be4a2a710de | /src/main/java/com/zianedu/api/vo/TDeviceLimitLogVO.java | b3615f8ec8436858cdd6c27b5c8c44efaedb95d1 | []
| no_license | anjiho/zianedu-api | 44cee7a6c24f9fe3efdb81c9ce31b4084b48f1ad | 9827f19704402e4fcbcc461e6f9b4bb6a2999720 | refs/heads/master | 2021-07-03T15:00:13.983523 | 2020-06-06T07:19:23 | 2020-06-06T07:19:23 | 185,929,121 | 0 | 0 | null | 2020-10-13T13:11:58 | 2019-05-10T06:12:39 | Java | UTF-8 | Java | false | false | 1,180 | java | package com.zianedu.api.vo;
import com.zianedu.api.utils.Util;
import lombok.Data;
@Data
public class TDeviceLimitLogVO {
private int deviceLogKey;
private int deviceLimitKey;
private int cKey;
private int userKey;
private String indate;
private String deleteDate;
private int type;
private int dataKey;
private String deviceId;
private String deviceModel;
private String osVersion;
private String appVersion;
public TDeviceLimitLogVO(){}
public TDeviceLimitLogVO(int deviceLimitKey, int cKey, int userKey, String indate, int type, int dataKey,
String deviceId, String deviceModel, String osVersion, String appVersion) {
this.deviceLimitKey = deviceLimitKey;
this.cKey = cKey;
this.userKey = userKey;
this.indate = indate;
this.deleteDate = Util.returnNow();
this.type = type;
this.dataKey = dataKey;
this.deviceId = deviceId;
this.deviceModel = Util.isNullValue(deviceModel, "");
this.osVersion = Util.isNullValue(osVersion, "");
this.appVersion = Util.isNullValue(appVersion, "");
}
}
| [
"[email protected]"
]
| |
47db539f04efc4fb153a002b2acfdcb7779150cc | 92fa5ac2e3fc8c1b0a20132e2702dd31d5db935b | /src/main/java/org/apache/commons/graph/model/BaseGraph.java | 16e99a3bc83a13290aaad3d25e9684ea292fa52f | []
| no_license | adericbourg/shortest-path-sandbox | 427c7f2cb684f4614144ad744bed8607476f3ef0 | 7b9cf9672cfc4d66bdf71baec7ed73d300022fe2 | refs/heads/master | 2022-10-16T15:32:43.876745 | 2017-10-28T10:18:26 | 2017-10-28T10:18:26 | 74,981,596 | 1 | 0 | null | 2022-09-26T02:28:10 | 2016-11-28T14:35:40 | Java | UTF-8 | Java | false | false | 6,612 | java | package org.apache.commons.graph.model;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
import org.apache.commons.graph.Graph;
import org.apache.commons.graph.GraphException;
import org.apache.commons.graph.VertexPair;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import static java.lang.String.format;
import static java.util.Collections.unmodifiableCollection;
import static java.util.Collections.unmodifiableSet;
import static org.apache.commons.graph.utils.Objects.eq;
import static org.apache.commons.graph.utils.Objects.hash;
/**
* Basic abstract in-memory based of a simple read-only {@link Graph} implementation. Subclasses may load adjacency
* list/edges set in the constructor, or expose {@link org.apache.commons.graph.MutableGraph} APIs.
*
* This class is NOT thread safe!
*
* @param <V> the Graph vertices type
* @param <E> the Graph edges type
*/
public abstract class BaseGraph<V, E>
implements Graph<V, E>
{
private static final long serialVersionUID = -8066786787634472712L;
private final Map<V, Set<V>> adjacencyList = new HashMap<V, Set<V>>();
private final Set<E> allEdges = new HashSet<E>();
private final Map<VertexPair<V>, E> indexedEdges = new HashMap<VertexPair<V>, E>();
private final Map<E, VertexPair<V>> indexedVertices = new HashMap<E, VertexPair<V>>();
/**
* {@inheritDoc}
*/
public final Iterable<V> getVertices()
{
return unmodifiableSet( adjacencyList.keySet() );
}
/**
* {@inheritDoc}
*/
public final int getOrder()
{
return adjacencyList.size();
}
/**
* {@inheritDoc}
*/
public final Iterable<E> getEdges()
{
return unmodifiableCollection( allEdges );
}
/**
* {@inheritDoc}
*/
public int getSize()
{
return allEdges.size();
}
/**
* {@inheritDoc}
*/
public final Iterable<V> getConnectedVertices( V v )
{
checkGraphCondition( containsVertex( v ), "Vertex %s does not exist in the Graph", v );
final Set<V> adj = adjacencyList.get( v );
return unmodifiableSet( adj );
}
/**
* {@inheritDoc}
*/
public final E getEdge( V source, V target )
{
checkGraphCondition( containsVertex( source ), "Vertex %s does not exist in the Graph", source );
checkGraphCondition( containsVertex( target ), "Vertex %s does not exist in the Graph", target );
return indexedEdges.get( new VertexPair<V>( source, target ) );
}
/**
* {@inheritDoc}
*/
public final VertexPair<V> getVertices( E e )
{
return indexedVertices.get( e );
}
/**
* {@inheritDoc}
*/
public boolean containsVertex( V v )
{
return adjacencyList.containsKey( v );
}
/**
* {@inheritDoc}
*/
public boolean containsEdge( E e )
{
return indexedVertices.containsKey( e );
}
/**
* Returns the adjacency list where stored vertex/edges.
*
* @return the adjacency list where stored vertex/edges.
*/
protected final Map<V, Set<V>> getAdjacencyList()
{
return adjacencyList;
}
/**
* {@inheritDoc}
*/
@Override
public int hashCode()
{
final int prime = 31;
return hash( 1, prime, adjacencyList, allEdges, indexedEdges, indexedVertices );
}
/**
* {@inheritDoc}
*/
@Override
public boolean equals( Object obj )
{
if ( this == obj )
{
return true;
}
if ( obj == null || getClass() != obj.getClass() )
{
return false;
}
@SuppressWarnings( "unchecked" )
// test against any Graph typed instance
BaseGraph<Object, Object> other = (BaseGraph<Object, Object>) obj;
return eq( adjacencyList, other.getAdjacencyList() );
}
/**
* {@inheritDoc}
*/
@Override
public String toString()
{
return String.valueOf( adjacencyList );
}
/**
* Return the edge {@link Set}
* @return the edge {@link Set}
*/
protected Set<E> getAllEdges()
{
return allEdges;
}
/**
* Returns the {@code Map} of indexed edges.
*
* @return the {@link Map} of indexed edges
*/
protected Map<VertexPair<V>, E> getIndexedEdges()
{
return indexedEdges;
}
/**
* Returns the {@code Map} of indexed vertices.
*
* @return the indexed vertices {@link Map}
*/
protected Map<E, VertexPair<V>> getIndexedVertices()
{
return indexedVertices;
}
/**
* Ensures the truth of an expression involving one or more parameters to the
* calling method.
*
* @param expression a boolean expression
* @param errorMessageTemplate a template for the exception message should the
* check fail. The message is formed by replacing each {@code %s}
* placeholder in the template with an argument. These are matched by
* position - the first {@code %s} gets {@code errorMessageArgs[0]}, etc.
* Unmatched arguments will be appended to the formatted message in square
* braces. Unmatched placeholders will be left as-is.
* @param errorMessageArgs the arguments to be substituted into the message
* template. Arguments are converted to strings using
* {@link String#valueOf(Object)}.
* @throws GraphException if {@code expression} is false
*/
protected static void checkGraphCondition( boolean expression, String errorMessageTemplate, Object...errorMessageArgs )
{
if ( !expression )
{
throw new GraphException( format( errorMessageTemplate, errorMessageArgs ) );
}
}
}
| [
"[email protected]"
]
| |
9048f570661704d4b77f362fdafa19d494ba4502 | fac5245a40db71566a162c1201d4fcdc37829ade | /Threads/Thread_1b.java | 6e0d8806d04dc1be086cd17178d57ff8e18d62f0 | []
| no_license | SamoiliukIvan/FRep | 1bc786a73a8a61bd58a495331d23a63c28e30b64 | dbb6e19dd709ce52f4d979e07bd1c2756cd5c956 | refs/heads/master | 2020-03-27T01:40:39.586845 | 2018-09-12T16:37:56 | 2018-09-12T16:37:56 | 145,732,402 | 0 | 0 | null | 2018-09-12T16:37:57 | 2018-08-22T16:04:10 | Java | UTF-8 | Java | false | false | 372 | java | package Threads;
public class Thread_1b extends Thread {
public void run() {
for (int i = 0; i < 10; i++) {
System.out.println(Thread.currentThread().getName());
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
Thread_1b t2 = new Thread_1b();
t2.start();
}
}
| [
"[email protected]"
]
| |
26df04328d8f688ebd7463e12817dda4cf86acff | 8c9fc3d86eb3cd49af7c308afb40182fce56c72b | /src/main/java/com/rtn/dcgs/af/coalescence/persistence/api/impl/AbstractDao.java | 6caf396de236094ceb88315bd5229ffe5d8cf717 | []
| no_license | jminthorne/mission | b9a34152718d39055a90c584a3b884fd64d958cd | a162a4842c778de4ca0346122ed9789e4e8ecbb0 | refs/heads/master | 2016-09-05T20:46:35.051350 | 2014-10-09T12:19:50 | 2014-10-09T12:19:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,917 | java | package com.rtn.dcgs.af.coalescence.persistence.api.impl;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.jboss.errai.jpa.sync.client.shared.DataSyncService;
import org.jboss.errai.jpa.sync.client.shared.JpaAttributeAccessor;
import org.jboss.errai.jpa.sync.client.shared.SyncRequestOperation;
import org.jboss.errai.jpa.sync.client.shared.SyncResponse;
import org.jboss.errai.jpa.sync.client.shared.SyncableDataSet;
import org.jboss.errai.jpa.sync.server.JavaReflectionAttributeAccessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.rtn.dcgs.af.coalescence.persistence.api.Dao;
@Stateless
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public class AbstractDao<T> implements Dao<T> {
private static final Logger LOG = LoggerFactory.getLogger(AbstractDao.class);
@PersistenceContext(unitName = "coalescence")
protected EntityManager entityManager;
public Session getSession() {
return entityManager.unwrap(org.hibernate.Session.class);
}
public T create(T t) {
entityManager.persist(t);
entityManager.flush();
entityManager.refresh(t);
return t;
}
public T update(T t) {
entityManager.merge(t);
return t;
}
public T findById(Long id, Class<T> clazz) {
return entityManager.find(clazz, id);
}
public void delete(Long id, Class<T> clazz) {
T found = entityManager.find(clazz, id);
entityManager.remove(found);
entityManager.flush();
}
public List<T> findAll(Class<T> clazz) {
return entityManager.createQuery("FROM " + clazz.getName()).getResultList();
}
@Override
public List<T> findAll(Class<T> clazz, int start, int quantity) {
Query query = entityManager.createQuery("FROM " + clazz.getName());
setItemsReturned(query, start, quantity);
List<T> toReturn = query.getResultList();
Collections.sort(toReturn, new EntityComparator());
return toReturn;
}
// @Override
// public List<T> findByName(Class<T> clazz, String namePattern) {
// // return entityManager.createQuery("FROM " + clazz.getName() +
// " WHERE name = '" + name + "'").getResultList();
// return entityManager.createNamedQuery("findByName").setParameter("name",
// namePattern).getResultList();
// }
@Override
public List<T> findBy(Criteria criteria) {
// if (LOG.isDebugEnabled()) {
// LOG.debug("clazz: " + clazz.toString() + "; queryName: " + queryName
// + "; itemToSearchBy: "
// + itemToSearchBy.toString());
// }
// return entityManager.createNamedQuery("findBy").setParameter("field",
// queryName)
// .setParameter("value", "%" + itemToSearchBy + "%").getResultList();
return criteria.list();
// return entityManager.createQuery(
// "FROM " + clazz.getName() + " WHERE " + propertyName + " = '" +
// itemToSearchBy + "'").getResultList();
}
/**
* Passes a data sync operation on the given data set to the server-side of the Errai DataSync system.
* <p>
* This method is not invoked directly by the application code; it is called via Errai RPC by Errai's
* ClientSyncManager.
*
* @param dataSet
* The data set to synchronize.
* @param remoteResults
* The remote results produced by ClientSyncManager, which the server-side needs to perform to
* synchronize the server data with the client data.
* @return A list of sync response operations that ClientSyncManager needs to perform to synchronize the client data
* with the server data.
*/
public <X> List<SyncResponse<X>> sync(SyncableDataSet<X> dataSet, List<SyncRequestOperation<X>> remoteResults) {
JpaAttributeAccessor attributeAccessor = new JavaReflectionAttributeAccessor();
DataSyncService dss = new org.jboss.errai.jpa.sync.server.DataSyncServiceImpl(entityManager, attributeAccessor);
return dss.coldSync(dataSet, remoteResults);
}
public class EntityComparator implements Comparator<Object> {
@Override
public int compare(Object arg0, Object arg1) {
// If both classes are strings, returns the comparison of the
// strings
if (arg0.getClass().equals(String.class) && arg1.getClass().equals(String.class)) {
return ((String) arg0).compareToIgnoreCase((String) arg1);
}
try {
// if the classes have a method "getName" that returns a String,
// returns comparison of the names
Method nameGetter = arg0.getClass().getMethod("getName", (Class<?>[]) null);
String name0 = (String) nameGetter.invoke(arg0, (Object[]) null);
String name1 = (String) nameGetter.invoke(arg1, (Object[]) null);
return name0.compareToIgnoreCase(name1);
} catch (Exception e1) {
try {
// if the classes have a method "getType", returns the
// comparison of the types
Method typeGetter = arg0.getClass().getMethod("getType", (Class<?>[]) null);
Object type0 = typeGetter.invoke(arg0, (Object[]) null);
Object type1 = typeGetter.invoke(arg1, (Object[]) null);
return (new EntityComparator()).compare(type0, type1);
} catch (Exception e2) {
// otherwise, calls toString and compares the results.
return (arg0.toString()).compareToIgnoreCase(arg1.toString());
}
}
}
}
/**
* Used internally to set the number of items to return, using Query.setFirstResult and Query.setMaxResults.
*
* @param query
* @param start
* @param quantity
*/
protected void setItemsReturned(Query query, int start, int quantity) {
query.setFirstResult(start);
if (quantity != 0) {
query.setMaxResults(quantity);
}
}
public void setEntityManager(EntityManager entityManager) {
this.entityManager = entityManager;
}
} | [
"[email protected]"
]
| |
81525e5e5de9e6c3106519f83d254eb96cc86350 | 0e7f072853656d47d52b50d6b744b7103e8c18fc | /system-service/src/main/java/com/crm/dao/mapper/OrderDao.java | cc795b6467730f5ee5177ed2301817997854a8c9 | []
| no_license | jason-moo/system | 9e3ede1a74599ea7ad00fe89910675d13e9065a7 | 452042258356b4b5eb34c73e43172cfd471b69d3 | refs/heads/master | 2020-12-01T23:44:40.605778 | 2018-06-28T06:34:09 | 2018-06-28T06:34:09 | 66,707,946 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 170 | java | package com.crm.dao.mapper;
import me.gacl.domain.COrder;
/**
* Created by jason_moo on 2018/3/22.
*/
public interface OrderDao {
Long insert(COrder cOrder);
}
| [
"[email protected]"
]
| |
466cef8d75ae9c6a67afffc1cffa489324d9b9ca | 17c8dd12afcab769fb665b6ada37ac756f3a6f52 | /MockitoDemo/src/test/java/com/example/demo4/repositories/UserRepositoryTest.java | 60dd0da18ecfcbe71460a11355a1bcffeab547d8 | []
| no_license | jaspreetjhass/in28minutes_repo | fc441ca74cc10d39ab1da5d735cbb448e1c91d27 | 18c52a5bce3fa01338b3011278f19f4001a88c69 | refs/heads/master | 2020-12-01T08:52:51.982203 | 2020-03-01T21:06:08 | 2020-03-01T21:06:08 | 230,595,865 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,225 | java | package com.example.demo4.repositories;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.annotation.Transactional;
import com.example.demo.models.User;
import com.example.demo.repositories.UserRepository;
import com.example.demo3.SpringBootTestApp;
@SpringBootTest(classes = {SpringBootTestApp.class})
@Transactional
public class UserRepositoryTest {
@Autowired
private UserRepository repo;
@Test
public void findByUserIdTest() {
assertEquals("jaspreetjhass", repo.findById(123).get().getUserName());
}
@Test
public void findAllUserTest() {
List<User> expectedList = new ArrayList<User>();
repo.findAll().forEach(expectedList::add);
assertEquals(2, expectedList.size());
}
@Test
public void saveUserTest() {
assertNotNull(repo.save(new User()));
}
@Test
public void deleteUserTest() {
repo.deleteById(1);
}
@Test
public void updateUserTest() {
assertNotNull(repo.save(new User()));
}
}
| [
"[email protected]"
]
| |
db541f91d8fef6ab26c79b259a6fb8ce33f9ac69 | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/3/org/apache/commons/math3/stat/descriptive/moment/VectorialCovariance_getResult_83.java | b21dbf9d418fff16f3ced60531f54168e5dbea67 | []
| no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 575 | java |
org apach common math3 stat descript moment
return covari matrix vector
version
vectori covari vectorialcovari serializ
covari matrix
covari matrix
real matrix realmatrix result getresult
dimens sum length
real matrix realmatrix result matrix util matrixutil creat real matrix createrealmatrix dimens dimens
bia correct isbiascorrect
dimens
product sum productssum sum sum
result set entri setentri
result set entri setentri
result
| [
"[email protected]"
]
| |
a75231e634447b2b44b198d2457d533b43734529 | cfd60dd9cf3c18ea77b95560f8d9aa1f48e8c935 | /app/src/main/java/edu/nntu/gerforecast/fragments/ResultsFragment.java | 96752a1a5693c575ece44cf0830a5cb9aae1c7de | []
| no_license | GromHoll/GerForecast-Android | 0910e2873b2d22cc859da2fa5ec4e648feec4111 | a4baf581e9b6c704aa7d34af9ea1ece60dd59dbd | refs/heads/master | 2021-01-23T16:37:46.238127 | 2015-06-03T22:40:03 | 2015-06-03T22:40:03 | 35,975,989 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,862 | java | package edu.nntu.gerforecast.fragments;
import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TableLayout;
import android.widget.TextView;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import java.util.ArrayList;
import java.util.Collections;
import edu.nntu.gerforecast.MainActivity;
import edu.nntu.gerforecast.R;
import edu.nntu.gerforecast.math.data.OutputValues;
public class ResultsFragment extends MainActivity.PlaceholderFragment implements MainActivity.OutputValuesChangeListener {
private MainActivity mainActivity = null;
public static ResultsFragment newInstance(int sectionNumber) {
ResultsFragment fragment = new ResultsFragment();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
fragment.setArguments(args);
return fragment;
}
public ResultsFragment() { /* 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_results, container, false);
LineChart financeDynamic = (LineChart) view.findViewById(R.id.chartFinanceDynamic);
setUpChart(financeDynamic);
LineChart financeProfile = (LineChart) view.findViewById(R.id.chartFinanceProfile);
setUpChart(financeProfile);
updateCharts(financeDynamic, financeProfile, mainActivity.getOutputValues());
TableLayout table = (TableLayout) view.findViewById(R.id.resultTable);
updateTable(table, mainActivity.getOutputValues());
return view;
}
private void setUpChart(LineChart chart) {
chart.setDescription("");
chart.setDrawGridBackground(false);
chart.setNoDataText("Введите данные и нажмите \"рассчитать\"");
chart.setHighlightEnabled(true);
chart.setTouchEnabled(true);
chart.setDragEnabled(true);
chart.setScaleEnabled(true);
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
mainActivity = (MainActivity) activity;
mainActivity.addOutputValuesChangeListener(this);
}
@Override
public void onOutputValuesChanges(OutputValues outputValues) {
LineChart financeDynamic = (LineChart) mainActivity.findViewById(R.id.chartFinanceDynamic);
LineChart financeProfile = (LineChart) mainActivity.findViewById(R.id.chartFinanceProfile);
updateCharts(financeDynamic, financeProfile, outputValues);
TableLayout table = (TableLayout) mainActivity.findViewById(R.id.resultTable);
updateTable(table, outputValues);
}
private void updateCharts(LineChart financeDynamic, LineChart financeProfile, OutputValues outputValues) {
if (outputValues == null) { return; }
updateChart(financeDynamic, outputValues.cashBalance, "Финансовый профиль");
updateChart(financeProfile, outputValues.currentOperationsAndInvestments, "Динамика остатка денежных средств");
}
private void updateChart(LineChart chart, double[] values, String name) {
if (chart != null) {
LineData data = createDataSet(values, name);
chart.setData(data);
chart.invalidate();
}
}
private LineData createDataSet(double[] values, String name) {
ArrayList<String> xVals = new ArrayList<>();
for (int i = 0; i < values.length; i++) {
xVals.add((i) + "");
}
ArrayList<Entry> yVals = new ArrayList<>();
for (int i = 0; i < values.length; i++) {
yVals.add(new Entry((float) values[i], i));
}
LineDataSet set = new LineDataSet(yVals, name);
set.setLineWidth(3f);
set.setCircleSize(5f);
set.setDrawCircleHole(true);
set.setValueTextSize(10);
return new LineData(xVals, Collections.singletonList(set));
}
private void updateTable(TableLayout table, OutputValues outputValues) {
if (outputValues == null) { return; }
for (int i = 1; i <= outputValues.yearsNumber; i++) {
TextView npv = getCell(table, 0, i);
npv.setText(getTextForTable(i, outputValues.currentOperationsAndInvestments));
TextView ros = getCell(table, 1, i);
ros.setText(getTextForTable(i, outputValues.ros));
TextView o = getCell(table, 2, i);
o.setText(getTextForTable(i, outputValues.cashBalance));
TextView cr = getCell(table, 3, i);
cr.setText(getTextForTable(i, outputValues.currentRatio));
}
}
private TextView getCell(TableLayout table, int row, int column) {
String name = "result_" + (row + 1) + (column);
Resources res = getResources();
int id = res.getIdentifier(name, "id", mainActivity.getPackageName());
return (TextView) table.findViewById(id);
}
private String getTextForTable(int index, double[] values) {
return (index < values.length) ?
String.format(Math.abs(values[index]) < 100 ? "%.3f" : "%.0f", values[index]) : "";
}
@Override
public void onDetach() {
super.onDetach();
if (mainActivity != null) {
mainActivity.removeOutputValuesChangeListener(this);
}
}
}
| [
"[email protected]"
]
| |
ca5093f79fcc54663ed93fe65f8526506fecf42a | cf60cc3b7081a0609b4cfd83e23843e8c4aae704 | /test/wcbc/SimulateNfaTest.java | a7a2df6c6eff7c9ca12d3ed414775497ab1af6b8 | [
"CC-BY-4.0"
]
| permissive | johnmaccormick/wcbc-java | 7fbb01b425be762028ab99703ec14fdfffd8f9f6 | bdf3c1db2d8d2ee247b2425848082f55ca6d44d9 | refs/heads/master | 2021-06-04T16:32:08.656951 | 2020-07-11T11:29:54 | 2020-07-11T11:29:54 | 124,528,390 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 896 | java | package wcbc;
import static org.junit.jupiter.api.Assertions.*;
import java.io.IOException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
class SimulateNfaTest {
@BeforeEach
void setUp() throws Exception {
}
@Test
void testSiso() throws IOException, WcbcException {
String[][] testVals = { { "simple3.nfa", "AA", "yes" }, { "simple3.nfa", "AGA", "yes" },
{ "simple3.nfa", "AC", "yes" }, { "simple3.nfa", "AG", "yes" }, { "simple3.nfa", "ACCGCG", "yes" },
{ "simple3.nfa", "", "no" }, { "simple3.nfa", "A", "no" }, { "simple3.nfa", "G", "no" },
{ "simple3.nfa", "AAA", "no" }, };
for (String[] v : testVals) {
String nfaString = utils.readFile(utils.prependWcbcPath(v[0]));
String tapeStr = v[1];
String solution = v[2];
Nfa tm = new Nfa(nfaString, tapeStr);
String val = tm.run();
assertEquals(val, solution);
}
}
}
| [
"[email protected]"
]
| |
0c7cdbeb249aae6bc15e4b3f6d6ca21882b26909 | 10efb0cf17fa0fd3d378d62ed8dad46e912e8b44 | /模拟鼠标点击器/src/ryan/MainFrame.java | 1359eeab1a3827f0b9c9f35dfb5632f1085bf95b | []
| no_license | ShervenLee/JavaDome | 7ded72f1b44a268565b6ea649c45b7292c24260f | 21a0634d907a0d4ca25fbd716f4beb519d39c4c2 | refs/heads/master | 2021-07-05T05:27:53.902665 | 2017-09-30T01:11:59 | 2017-09-30T01:11:59 | 103,494,587 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,925 | java | package ryan;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
public class MainFrame
{
private JFrame mainFrame = null;
private JLabel timeLabel = null;
private JLabel countLabel = null;
private JTextField timeText = null;
private JTextField countText = null;
private JButton start = null;
private JButton exit = null;
public JTextField getTimeText()
{
return timeText;
}
public void setTimeText(JTextField timeText)
{
this.timeText = timeText;
}
public JTextField getCountText()
{
return countText;
}
public void setCountText(JTextField countText)
{
this.countText = countText;
}
public JButton getStart()
{
return start;
}
public void setStart(JButton start)
{
this.start = start;
}
public JButton getExit()
{
return exit;
}
public void setExit(JButton exit)
{
this.exit = exit;
}
public MainFrame()
{
mainFrame = new JFrame("MouseClick");
mainFrame.setBounds(400, 200, 400, 200);
mainFrame.setDefaultCloseOperation(3);
mainFrame.setLayout(null);
Init();
mainFrame.setVisible(true);
}
private void Init()
{
Integer labelX = 30;
Integer labelY = 30;
Integer textX = 100;
Integer textY = 30;
timeLabel = new JLabel("Time /ms");
timeLabel.setBounds(labelX, labelY + 60, 60, 30);
countLabel = new JLabel("Count");
countLabel.setBounds(labelX, labelY, 160, 30);
timeText = new JTextField();
timeText.setBounds(textX, textY + 60, 100, 30);
timeText.setText("0");
countText = new JTextField();
countText.setBounds(textX, textY, 100, 30);
countText.setText("0");
start = new JButton("Start");
start.setBounds(250, 20, 80, 50);
exit = new JButton("Exit");
exit.setBounds(250, 90, 80, 50);
mainFrame.add(timeLabel);
mainFrame.add(countLabel);
mainFrame.add(timeText);
mainFrame.add(countText);
mainFrame.add(start);
mainFrame.add(exit);
}
}
| [
"[email protected]"
]
| |
22664dc3c3d7656be41c65622272e533f1a3974d | baee3ef7cc98badf8a87e9f74ddd1a6d70b096b0 | /.urionlinejudge/src/BEGINNER/Salary.java | be102a332c94fe5e4f389afe2e1f7aba67a666fa | []
| no_license | groverinho/Java | eb4863737888d552ac313e23f0e7e2fd2dc45aa7 | 0b0c612eb03cf27b8310448bcf72da4565be0af6 | refs/heads/master | 2021-12-25T11:32:46.222179 | 2021-09-10T22:48:14 | 2021-09-10T22:48:14 | 47,481,887 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 461 | java | package BEGINNER;
import java.util.Scanner;
public class Salary
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int num = in.nextInt();
int horas = in.nextInt();
double money = in.nextDouble();
double total = horas*money;
/*System.out.println("NUMBER = "+num);
System.out.printf ("SALARY = R$ %.2f", total);*/
System.out.printf("NUMBER = "+num);
System.out.printf("\nSALARY = U$ %.2f\n",total);
}
}
| [
"[email protected]"
]
| |
cf31021b8341ea9cd3a0babb250b9d0229e3543e | eb813093e31f9b2669f34f3eb4a7b35deb47b279 | /Unidad4/4.4. Animación - XML/app/src/main/java/animation/monroy/com/animation/MainActivity.java | 3019b45496e63c595bfc6a2d18b542e198c72c74 | []
| no_license | jjesusmonroy/Monroy_Salcedo_Jose_14400968 | 3002c9f0f27d520c18fa6cea59601434f8b3edb9 | 286e5eb71ca517dfa46d93c3afb608a65b5f51ba | refs/heads/master | 2020-03-18T22:01:51.645366 | 2018-05-29T15:53:49 | 2018-05-29T15:53:49 | 135,319,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,328 | java | package animation.monroy.com.animation;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity {
ImageView imagen;
Button botonGrow,botonFade,botonBlink,botonMove;
Animation animFadein;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imagen=findViewById(R.id.image);
botonGrow=findViewById(R.id.button1);
botonFade=findViewById(R.id.button2);
botonBlink=findViewById(R.id.button3);
botonMove=findViewById(R.id.button4);
botonGrow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// load the animation
animFadein = AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.grow);
imagen.startAnimation(animFadein);
}
});
botonFade.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// load the animation
animFadein = AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.fade);
imagen.startAnimation(animFadein);
}
});
botonBlink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// load the animation
animFadein = AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.blink);
imagen.startAnimation(animFadein);
}
});
botonMove.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// load the animation
animFadein = AnimationUtils.loadAnimation(getApplicationContext(),
R.anim.move);
imagen.startAnimation(animFadein);
}
});
}
}
| [
"[email protected]"
]
| |
0af8711548a67b46e57cd4f3714541e3a64e7dd2 | 9b9c3236cc1d970ba92e4a2a49f77efcea3a7ea5 | /L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/impl/MultisellData.java | e1d0abe074ef1868278ea0617dd06fa158010acf | []
| no_license | BETAJIb/ikol | 73018f8b7c3e1262266b6f7d0a7f6bbdf284621d | f3709ea10be2d155b0bf1dee487f53c723f570cf | refs/heads/master | 2021-01-05T10:37:17.831153 | 2019-12-24T22:23:02 | 2019-12-24T22:23:02 | 240,993,482 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,513 | java | /*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.data.xml.impl;
import java.io.File;
import java.io.FileFilter;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.commons.util.file.filter.NumericNameFilter;
import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.multisell.Entry;
import org.l2jmobius.gameserver.model.multisell.Ingredient;
import org.l2jmobius.gameserver.model.multisell.ListContainer;
import org.l2jmobius.gameserver.model.multisell.PreparedListContainer;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ExBrExtraUserInfo;
import org.l2jmobius.gameserver.network.serverpackets.MultiSellList;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.network.serverpackets.UserInfo;
public class MultisellData implements IXmlReader
{
private final Map<Integer, ListContainer> _entries = new ConcurrentHashMap<>();
public static final int PAGE_SIZE = 40;
// Special IDs.
public static final int PC_BANG_POINTS = -100;
public static final int CLAN_REPUTATION = -200;
public static final int FAME = -300;
// Misc
private static final FileFilter NUMERIC_FILTER = new NumericNameFilter();
protected MultisellData()
{
load();
}
@Override
public void load()
{
_entries.clear();
parseDatapackDirectory("data/multisell", false);
if (Config.CUSTOM_MULTISELL_LOAD)
{
parseDatapackDirectory("data/multisell/custom", false);
}
verify();
LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Loaded " + _entries.size() + " multisell lists.");
}
@Override
public void parseDocument(Document doc, File f)
{
try
{
final int id = Integer.parseInt(f.getName().replaceAll(".xml", ""));
int entryId = 1;
Node att;
final ListContainer list = new ListContainer(id);
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
{
att = n.getAttributes().getNamedItem("applyTaxes");
list.setApplyTaxes((att != null) && Boolean.parseBoolean(att.getNodeValue()));
att = n.getAttributes().getNamedItem("useRate");
if (att != null)
{
try
{
list.setUseRate(Double.valueOf(att.getNodeValue()));
if (list.getUseRate() <= 1e-6)
{
throw new NumberFormatException("The value cannot be 0"); // threat 0 as invalid value
}
}
catch (NumberFormatException e)
{
try
{
list.setUseRate(Config.class.getField(att.getNodeValue()).getDouble(Config.class));
}
catch (Exception e1)
{
LOGGER.warning(e1.getMessage() + doc.getLocalName());
list.setUseRate(1.0);
}
}
catch (DOMException e)
{
LOGGER.warning(e.getMessage() + doc.getLocalName());
}
}
att = n.getAttributes().getNamedItem("maintainEnchantment");
list.setMaintainEnchantment((att != null) && Boolean.parseBoolean(att.getNodeValue()));
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
{
if ("item".equalsIgnoreCase(d.getNodeName()))
{
final Entry e = parseEntry(d, entryId++, list);
list.getEntries().add(e);
}
else if ("npcs".equalsIgnoreCase(d.getNodeName()))
{
for (Node b = d.getFirstChild(); b != null; b = b.getNextSibling())
{
if ("npc".equalsIgnoreCase(b.getNodeName()))
{
list.allowNpc(Integer.parseInt(b.getTextContent()));
}
}
}
}
}
}
_entries.put(id, list);
}
catch (Exception e)
{
LOGGER.log(Level.SEVERE, getClass().getSimpleName() + ": Error in file " + f, e);
}
}
@Override
public FileFilter getCurrentFileFilter()
{
return NUMERIC_FILTER;
}
private final Entry parseEntry(Node n, int entryId, ListContainer list)
{
final Node first = n.getFirstChild();
final Entry entry = new Entry(entryId);
NamedNodeMap attrs;
Node att;
StatsSet set;
for (n = first; n != null; n = n.getNextSibling())
{
if ("ingredient".equalsIgnoreCase(n.getNodeName()))
{
attrs = n.getAttributes();
set = new StatsSet();
for (int i = 0; i < attrs.getLength(); i++)
{
att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
entry.addIngredient(new Ingredient(set));
}
else if ("production".equalsIgnoreCase(n.getNodeName()))
{
attrs = n.getAttributes();
set = new StatsSet();
for (int i = 0; i < attrs.getLength(); i++)
{
att = attrs.item(i);
set.set(att.getNodeName(), att.getNodeValue());
}
entry.addProduct(new Ingredient(set));
}
}
return entry;
}
/**
* This will generate the multisell list for the items.<br>
* There exist various parameters in multisells that affect the way they will appear:
* <ol>
* <li>Inventory only:
* <ul>
* <li>If true, only show items of the multisell for which the "primary" ingredients are already in the player's inventory. By "primary" ingredients we mean weapon and armor.</li>
* <li>If false, show the entire list.</li>
* </ul>
* </li>
* <li>Maintain enchantment: presumably, only lists with "inventory only" set to true should sometimes have this as true. This makes no sense otherwise...
* <ul>
* <li>If true, then the product will match the enchantment level of the ingredient.<br>
* If the player has multiple items that match the ingredient list but the enchantment levels differ, then the entries need to be duplicated to show the products and ingredients for each enchantment level.<br>
* For example: If the player has a crystal staff +1 and a crystal staff +3 and goes to exchange it at the mammon, the list should have all exchange possibilities for the +1 staff, followed by all possibilities for the +3 staff.</li>
* <li>If false, then any level ingredient will be considered equal and product will always be at +0</li>
* </ul>
* </li>
* <li>Apply taxes: Uses the "taxIngredient" entry in order to add a certain amount of adena to the ingredients.
* <li>
* <li>Additional product and ingredient multipliers.</li>
* </ol>
* @param listId
* @param player
* @param npc
* @param inventoryOnly
* @param productMultiplier
* @param ingredientMultiplier
*/
public void separateAndSend(int listId, PlayerInstance player, Npc npc, boolean inventoryOnly, double productMultiplier, double ingredientMultiplier)
{
final ListContainer template = _entries.get(listId);
if (template == null)
{
LOGGER.warning(getClass().getSimpleName() + ": can't find list id: " + listId + " requested by player: " + player.getName() + ", npcId:" + (npc != null ? npc.getId() : 0));
return;
}
if (!template.isNpcAllowed(-1))
{
if ((npc == null) || !template.isNpcAllowed(npc.getId()))
{
if (player.isGM())
{
player.sendMessage("Multisell " + listId + " is restricted. Under current conditions cannot be used. Only GMs are allowed to use it.");
}
else
{
LOGGER.warning(getClass().getSimpleName() + ": Player " + player + " attempted to open multisell " + listId + " from npc " + npc + " which is not allowed!");
return;
}
}
}
final PreparedListContainer list = new PreparedListContainer(template, inventoryOnly, player, npc);
// Pass through this only when multipliers are different from 1
if ((productMultiplier != 1) || (ingredientMultiplier != 1))
{
list.getEntries().forEach(entry ->
{
// Math.max used here to avoid dropping count to 0
entry.getProducts().forEach(product -> product.setItemCount((long) Math.max(product.getItemCount() * productMultiplier, 1)));
// Math.max used here to avoid dropping count to 0
entry.getIngredients().forEach(ingredient -> ingredient.setItemCount((long) Math.max(ingredient.getItemCount() * ingredientMultiplier, 1)));
});
}
int index = 0;
do
{
// send list at least once even if size = 0
player.sendPacket(new MultiSellList(list, index));
index += PAGE_SIZE;
}
while (index < list.getEntries().size());
player.setMultiSell(list);
}
public void separateAndSend(int listId, PlayerInstance player, Npc npc, boolean inventoryOnly)
{
separateAndSend(listId, player, npc, inventoryOnly, 1, 1);
}
public static boolean hasSpecialIngredient(int id, long amount, PlayerInstance player)
{
switch (id)
{
case CLAN_REPUTATION:
{
if (player.getClan() == null)
{
player.sendPacket(SystemMessageId.YOU_ARE_NOT_A_CLAN_MEMBER_AND_CANNOT_PERFORM_THIS_ACTION);
break;
}
if (!player.isClanLeader())
{
player.sendPacket(SystemMessageId.ONLY_THE_CLAN_LEADER_IS_ENABLED);
break;
}
if (player.getClan().getReputationScore() < amount)
{
player.sendPacket(SystemMessageId.THE_CLAN_REPUTATION_SCORE_IS_TOO_LOW);
break;
}
return true;
}
case FAME:
{
if (player.getFame() < amount)
{
player.sendPacket(SystemMessageId.YOU_DON_T_HAVE_ENOUGH_REPUTATION_TO_DO_THAT);
break;
}
return true;
}
}
return false;
}
public static boolean takeSpecialIngredient(int id, long amount, PlayerInstance player)
{
switch (id)
{
case CLAN_REPUTATION:
{
player.getClan().takeReputationScore((int) amount, true);
final SystemMessage smsg = new SystemMessage(SystemMessageId.S1_POINTS_HAVE_BEEN_DEDUCTED_FROM_THE_CLAN_S_REPUTATION_SCORE);
smsg.addLong(amount);
player.sendPacket(smsg);
return true;
}
case FAME:
{
player.setFame(player.getFame() - (int) amount);
player.sendPacket(new UserInfo(player));
player.sendPacket(new ExBrExtraUserInfo(player));
return true;
}
}
return false;
}
public static void giveSpecialProduct(int id, long amount, PlayerInstance player)
{
switch (id)
{
case CLAN_REPUTATION:
{
player.getClan().addReputationScore((int) amount, true);
break;
}
case FAME:
{
player.setFame((int) (player.getFame() + amount));
player.sendPacket(new UserInfo(player));
player.sendPacket(new ExBrExtraUserInfo(player));
break;
}
}
}
private final void verify()
{
ListContainer list;
final Iterator<ListContainer> iter = _entries.values().iterator();
while (iter.hasNext())
{
list = iter.next();
for (Entry ent : list.getEntries())
{
for (Ingredient ing : ent.getIngredients())
{
if (!verifyIngredient(ing))
{
LOGGER.warning(getClass().getSimpleName() + ": can't find ingredient with itemId: " + ing.getItemId() + " in list: " + list.getListId());
}
}
for (Ingredient ing : ent.getProducts())
{
if (!verifyIngredient(ing))
{
LOGGER.warning(getClass().getSimpleName() + ": can't find product with itemId: " + ing.getItemId() + " in list: " + list.getListId());
}
}
}
}
}
private final boolean verifyIngredient(Ingredient ing)
{
switch (ing.getItemId())
{
case CLAN_REPUTATION:
case FAME:
{
return true;
}
default:
{
return ing.getTemplate() != null;
}
}
}
public static MultisellData getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final MultisellData INSTANCE = new MultisellData();
}
}
| [
"[email protected]"
]
| |
5fd6deb13316efd1ca27ac14a8a4cf5467e41db1 | f99f09a093d9a5fb002d67392473101262de573e | /engine/runtime/src/main/java/org/enso/interpreter/node/expression/builtin/interop/syntax/ConstructorDispatchNode.java | 773c31314a36980bdd2b489cd382c5e9243ac414 | [
"Apache-2.0",
"AGPL-3.0-or-later"
]
| permissive | SCV/enso | 03adc5e324bb82018d91788ef5973cdabf77a76e | 2801f58ba9bc70b7b82e5a57f4e8b1796b509477 | refs/heads/master | 2021-04-19T04:46:25.923188 | 2020-07-17T09:25:09 | 2020-07-17T09:25:09 | 249,581,771 | 0 | 0 | Apache-2.0 | 2020-03-24T01:16:39 | 2020-03-24T01:16:39 | null | UTF-8 | Java | false | false | 2,971 | java | package org.enso.interpreter.node.expression.builtin.interop.syntax;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.interop.ArityException;
import com.oracle.truffle.api.interop.InteropLibrary;
import com.oracle.truffle.api.interop.UnsupportedMessageException;
import com.oracle.truffle.api.interop.UnsupportedTypeException;
import com.oracle.truffle.api.nodes.NodeInfo;
import com.oracle.truffle.api.nodes.UnexpectedResultException;
import com.oracle.truffle.api.profiles.BranchProfile;
import org.enso.interpreter.Constants;
import org.enso.interpreter.Language;
import org.enso.interpreter.node.expression.builtin.BuiltinRootNode;
import org.enso.interpreter.runtime.callable.argument.ArgumentDefinition;
import org.enso.interpreter.runtime.callable.function.Function;
import org.enso.interpreter.runtime.callable.function.FunctionSchema.CallStrategy;
import org.enso.interpreter.runtime.error.PanicException;
import org.enso.interpreter.runtime.state.Stateful;
import org.enso.interpreter.runtime.type.TypesGen;
@NodeInfo(shortName = "<new>", description = "Instantiates a polyglot constructor.")
public class ConstructorDispatchNode extends BuiltinRootNode {
private ConstructorDispatchNode(Language language) {
super(language);
}
private @Child InteropLibrary library =
InteropLibrary.getFactory().createDispatched(Constants.CacheSizes.BUILTIN_INTEROP_DISPATCH);
private final BranchProfile err = BranchProfile.create();
/**
* Creates a function wrapping this node.
*
* @param language the current language instance
* @return a function wrapping this node
*/
public static Function makeFunction(Language language) {
return Function.fromBuiltinRootNode(
new ConstructorDispatchNode(language),
CallStrategy.ALWAYS_DIRECT,
new ArgumentDefinition(0, "this", ArgumentDefinition.ExecutionMode.EXECUTE),
new ArgumentDefinition(1, "arguments", ArgumentDefinition.ExecutionMode.EXECUTE));
}
/**
* Executes the node.
*
* @param frame current execution frame.
* @return the result of converting input into a string.
*/
@Override
public Stateful execute(VirtualFrame frame) {
Object[] args = Function.ArgumentsHelper.getPositionalArguments(frame.getArguments());
Object cons = args[0];
Object state = Function.ArgumentsHelper.getState(frame.getArguments());
try {
Object[] arguments = TypesGen.expectVector(args[1]).getItems();
Object res = library.instantiate(cons, arguments);
return new Stateful(state, res);
} catch (UnsupportedMessageException
| ArityException
| UnsupportedTypeException
| UnexpectedResultException e) {
err.enter();
throw new PanicException(e.getMessage(), this);
}
}
/**
* Returns a language-specific name for this node.
*
* @return the name of this node
*/
@Override
public String getName() {
return "<new>";
}
}
| [
"[email protected]"
]
| |
e3676c362f13656185cf1dbbb9745318c8704c0d | 22ca777d5fb55d7270f5b7b12af409e42721d4fa | /src/main/java/com/basic/leetcode/Solution344.java | c5c5babcc92fbdb584aa28d923298dbdd4001edd | []
| no_license | Yommmm/Java-Basic | 73d1f8ef59ba6186f7169f0dd885cbe7a21d2094 | fec3793a1284ac53676daf71547f53469b33e042 | refs/heads/master | 2021-05-26T05:14:27.590319 | 2020-05-15T15:43:04 | 2020-05-15T15:43:04 | 127,542,927 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,388 | java | package com.basic.leetcode;
import java.util.Arrays;
/**
* 编写一个函数,其作用是将输入的字符串反转过来。输入字符串以字符数组 char[] 的形式给出。
* <p>
* 不要给另外的数组分配额外的空间,你必须原地修改输入数组、使用 O(1) 的额外空间解决这一问题。
* <p>
* 你可以假设数组中的所有字符都是 ASCII 码表中的可打印字符。
* <p>
*
* <p>
* 示例 1:
* <p>
* 输入:["h","e","l","l","o"]
* 输出:["o","l","l","e","h"]
* 示例 2:
* <p>
* 输入:["H","a","n","n","a","h"]
* 输出:["h","a","n","n","a","H"]
* <p>
* 来源:力扣(LeetCode)
* 链接:https://leetcode-cn.com/problems/reverse-string
* 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
public class Solution344 {
public static void main(String[] args) {
Solution344 solution = new Solution344();
solution.reverseString(new char[]{'a', 'b', 'c', 'd', 'e'});
}
public void reverseString(char[] s) {
int start = 0;
int end = s.length - 1;
while (start < end) {
this.swap(s, start, end);
start++;
end--;
}
}
private void swap(char[] s, int i, int j) {
char temp = s[i];
s[i] = s[j];
s[j] = temp;
}
}
| [
"[email protected]"
]
| |
3ea7ab4ead42cd2bb2f4ff805952a69ee0d5b496 | 4584907a279f9b54485dda8653d2394d175f9140 | /src/login/Login.java | 1662e7ad5f354939d10e78c03654277915b6f5a4 | []
| no_license | felipeferraz93/login-java-swing | f05306ae30169fea0038048113e2b526a5bd3315 | aaa7960024dc7f188384fe051c6a582e2c55fa42 | refs/heads/master | 2022-12-11T05:27:26.339243 | 2020-08-28T01:58:03 | 2020-08-28T01:58:03 | 290,925,481 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 491 | 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 login;
/**
*
* @author Felipe
*/
public class Login {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
UISplash Splash = new UISplash();
Splash.setVisible(true);
}
}
| [
"[email protected]"
]
| |
caf8cbd5cc9e9e9dafc90253c2e9fa4903030492 | 7a5b587696528e3cc6d839534ac1b7e5ab2ef41f | /src/com/huxiqing/controller/UserController.java | dbaa97e5f28ee01c6d91eafa177103598c0a0d46 | []
| no_license | h2440222798/booksys | d5d07375de823cf0630b435f4a27783215fed1b5 | 7c67c1cca7c7d720286d001907ae986955d6cb52 | refs/heads/master | 2020-03-24T17:05:36.048656 | 2018-07-30T10:41:02 | 2018-07-30T10:41:02 | 142,848,742 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,481 | java | package com.huxiqing.controller;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.huxiqing.entity.Book;
import com.huxiqing.entity.Page;
import com.huxiqing.entity.User;
import com.huxiqing.service.IBookService;
import com.huxiqing.service.IUserService;
import com.huxiqing.service.impl.BookService;
import com.huxiqing.vo.BookBean;
import com.huxiqing.vo.JsonBean;
import com.huxiqing.vo.UserBean;
@Controller
public class UserController {
@Autowired
private IUserService userService;
@RequestMapping(value="/userlist",method=RequestMethod.POST)
public @ResponseBody List<User> allbook() {
List<User> users = userService.findAlluser();
return users;
}
@RequestMapping(value="/lockdelete",method=RequestMethod.POST)
public @ResponseBody JsonBean deletelock(int userid) {
userService.updatelock2(userid);
JsonBean bean = new JsonBean();
bean.setCode(1);
return bean;
}
@RequestMapping(value="/userdelete",method=RequestMethod.POST)
public @ResponseBody JsonBean deleteuser(int userid) {
System.out.println(userid+"-----------------------------------------------");
userService.deleteuser(userid);
JsonBean bean = new JsonBean();
bean.setCode(1);
return bean;
}
@RequestMapping(value="/userchange",method=RequestMethod.POST)
public @ResponseBody UserBean changeuser(int userid) {
UserBean userBean = new UserBean();
try {
User user = userService.findById(userid);
userBean.setUser(user);
userBean.setCode(1);
} catch (Exception e) {
// TODO: handle exception
userBean.setCode(0);
userBean.setMsg(e);
}
return userBean;
}
@RequestMapping(value="/rootchange",method=RequestMethod.POST)
public @ResponseBody JsonBean changeroot(int userId,String userName,String passWord,String email) {
JsonBean bean = new JsonBean();
try {
userService.updateById(userId, userName, passWord, email);
bean.setCode(1);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
bean.setCode(0);
bean.setMsg(e);
}
return bean;
}
}
| [
"[email protected]"
]
| |
18abfb349e57c21af9e6c653297c984d62eda247 | b1779937e2fefcd5635aa2f084845f7f3b5672df | /11.10.4 - Klassen Dato/DatoBGS.java | 36a4094c9861615aa7e16fe557cc06d1df958ce2 | []
| no_license | janmarius/TDAT1001-Introduction-to-Programming | 5891e93ef2ac9c2fb036a86d6cd9a084e0132e9f | 87e2b888f5b0d252b5161ef8412c6e650759f3eb | refs/heads/main | 2021-07-06T03:53:50.159215 | 2019-09-14T15:08:56 | 2019-09-14T15:08:56 | 194,910,759 | 0 | 0 | null | null | null | null | ISO-8859-15 | Java | false | false | 3,279 | java | /**
* DatoBGS.java
*
* Oppgave 11.10.4
*
* Klassen DatoBGS.
*/
import java.text.ParseException;
import static javax.swing.JOptionPane.*;
public class DatoBGS {
private final String REGEX_DATOFORMAT = "(0[1-9]|[12][0-9]|3[01]).(0[1-9]|1[0-2]).[12][0-9]{3}"; // dd.MM.yyyy
private final String[] ALTERNATIVER = {"Lag ny dato", "Sammenlign to datoer",
"Finn differanse i dager", "Avslutt"};
private final int LAG_NY_DATO = 0;
private final int SAMMENLIGN_DATO = 1;
private final int FINN_DIFFERANSE_DAGER = 2;
private final int AVSLUTT = 3;
private Dato dato;
public DatoBGS(Dato dato) {
this.dato = dato;
}
public int lesValg() {
int valg = showOptionDialog(null, dato.toString(), "Dato", DEFAULT_OPTION,
PLAIN_MESSAGE, null, ALTERNATIVER, ALTERNATIVER[0]);
if (valg == AVSLUTT) {
valg = -1;
}
return valg;
}
public void utforValgtOppgave(int valg) {
switch (valg) {
case LAG_NY_DATO:
lagNyDato();
break;
case SAMMENLIGN_DATO:
sammenlignDato();
break;
case FINN_DIFFERANSE_DAGER:
finnDifferanseDager();
break;
default:
break;
}
}
public void lagNyDato() {
String dagerLest = showInputDialog("Hvor mange dager frem eller tilbake vil du endre?");
long dager = Long.parseLong(dagerLest);
dato = dato.nyDato(dager);
}
public void sammenlignDato() {
String datoSammenlignLest = showInputDialog("Skriv inn datoen du vil sammenligne (dd.MM.yyyy)");
try {
if (datoSammenlignLest.matches(REGEX_DATOFORMAT)) {
Dato datoTemp = new Dato(datoSammenlignLest);
int sammenlignResultat = dato.compareTo(datoTemp);
if (sammenlignResultat == 0) {
showMessageDialog(null, "Datoene er lik.");
} else if (sammenlignResultat == 1) {
showMessageDialog(null, "Datoen er etter " + datoSammenlignLest);
} else {
showMessageDialog(null, "Datoen er før " + datoSammenlignLest);
}
} else {
showMessageDialog(null, "Noe gikk galt, vennligst prøv igjen!");
}
} catch (ParseException e) {
showMessageDialog(null, "Noe gikk galt, vennligst prøv igjen!");
}
}
public void finnDifferanseDager() {
String datoSammenlignLest = showInputDialog("Skriv inn datoen du vil sammenligne (dd.MM.yyyy)");
try {
if (datoSammenlignLest.matches(REGEX_DATOFORMAT)) {
Dato datoTemp = new Dato(datoSammenlignLest);
showMessageDialog(null, "Antall dager differanse er: " +
dato.antallDagerMellomDato(datoTemp));
} else {
showMessageDialog(null, "Noe gikk galt, vennligst prøv igjen!");
}
} catch (ParseException e) {
showMessageDialog(null, "Noe gikk galt, vennligst prøv igjen!");
}
}
}
| [
"[email protected]"
]
| |
597451880c6376197a9d007de5b1fb58c4fab64a | a270850713ece02e08dbc5e956508ec451b34bc6 | /src/main/java/com/helloworld/hwblog/blog/entity/Comment.java | 7a3107aed97cf40c64700ce20d6ed08377da40bf | []
| no_license | superhelloworld/HelloWorldBlog | 6fa1926e445f10d958dab18cb0ebd9479f480eba | eed6781b100f5432c6369ac3518e889ac2ce580b | refs/heads/master | 2021-01-20T16:55:48.575228 | 2017-05-31T05:27:32 | 2017-05-31T05:27:32 | 90,858,972 | 0 | 0 | null | 2017-05-10T11:56:03 | 2017-05-10T11:56:03 | null | UTF-8 | Java | false | false | 1,674 | java | package com.helloworld.hwblog.blog.entity;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.Date;
/**
* Created by xdzy on 17-5-19.
*/
@Entity
public class Comment {
@Id
@GeneratedValue(generator = "cid")
@GenericGenerator(name="cid",strategy = "native")
private int id;
private String commenter;
private String content;
private Date date;
private int aid;
public Comment() {
}
public Comment(String commenter, String content,int aid) {
this.commenter = commenter;
this.content = content;
this.aid = aid;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCommenter() {
return commenter;
}
public void setCommenter(String commenter) {
this.commenter = commenter;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public int getAid() {
return aid;
}
public void setAid(int aid) {
this.aid = aid;
}
@Override
public String toString() {
return "Comment{" +
"id=" + id +
", commenter='" + commenter + '\'' +
", content='" + content + '\'' +
", date=" + date +
", aid=" + aid +
'}';
}
}
| [
"[email protected]"
]
| |
34027e3dd0758f04b852fdb710e95c979d5021f2 | 768fb478680993bb952c94d3672e6c0562c5e0dc | /src/test/java/programadorwho/api/ApiSpringApplicationTests.java | bf7f737d9523783ca9fed51bd36a8c055a7d0cb3 | []
| no_license | thiagoandrecardoso/api-spring | 1ca062aec3df09313b38ccb94e9ff9364aac5789 | ab108ad84540fdbc814939cc956e7feb6321429a | refs/heads/master | 2020-07-16T21:48:10.702276 | 2019-11-15T12:19:58 | 2019-11-15T12:20:07 | 205,875,252 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,537 | java | package programadorwho.api;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import programadorwho.api.entities.Empresa;
import programadorwho.api.repositories.EmpresaRepository;
@SpringBootTest
@ActiveProfiles("test")
class ApiSpringApplicationTests {
@Autowired
private EmpresaRepository empresaRepository;
Empresa empresa;
public Empresa instanceEmpresa() {
return new Empresa();
}
// @Disabled
@Test
public void entityTest() {
Empresa empresa1 = instanceEmpresa();
Empresa empresa2 = instanceEmpresa();
empresa1.setCnpj("019.123.345-00");
empresa1.setRazaoSocial("casa do churrasco");
empresa2.setCnpj("019.123.345-11");
empresa2.setRazaoSocial("casa do queijo");
empresaRepository.save(empresa1);
empresaRepository.save(empresa2);
List<Empresa> empresaList = empresaRepository.findAll();
System.out.println("\n\n\n\n\n");
empresaList.forEach(System.out::println);
System.out.println("\n\n\n\n\n");
if (empresaList.size() > 0) {
assertEquals(2, empresaList.size());
assertEquals((Long) 1L, empresaList.get(0).getId());
assertEquals((Long) 2L, empresaList.get(1).getId());
}
}
// @Value("${valor_maximo}")
// private int valor_maximo;
//
// @Test
// void contextLoads() {
// assertEquals(50, this.valor_maximo);
// }
}
| [
"[email protected]"
]
| |
e85493a12a796dbfe45a69200c6d72f95d856f78 | bc341da6f556a18d8fc880ec94926f77e5b598f1 | /innodb-java-reader-cli/src/main/java/com/alibaba/innodb/java/reader/cli/CsvPrinter.java | af4b8be55654e8dc72c70e9846e5cb4ec39601b3 | [
"Apache-2.0"
]
| permissive | ajurcik/innodb-java-reader | 29969a043ef957501ed0fdd41cd86cf73186c65f | f5614a9e84829462bfa01821408e65134133b48d | refs/heads/master | 2022-10-23T15:59:43.235343 | 2020-05-29T20:00:17 | 2020-05-31T22:12:03 | 267,922,088 | 0 | 0 | Apache-2.0 | 2020-05-29T17:57:02 | 2020-05-29T17:57:02 | null | UTF-8 | Java | false | false | 2,323 | java | /*
* Copyright 2020 Alibaba Group Holding Limited.
*
* 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.alibaba.innodb.java.reader.cli;
import java.io.IOException;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.QuoteMode;
/**
* CSV printer.
*
* @author xu.zx
* @author Adam Jurcik
*/
public class CsvPrinter {
public static final CSVFormat FIELD_FORMAT_QUOTED;
static {
// delimiter is not used
FIELD_FORMAT_QUOTED = CSVFormat.newFormat(',')
.withNullString("null")
.withQuote('"')
.withQuoteMode(QuoteMode.ALL_NON_NULL);
}
/**
* Use {@link StringBuilder} to build string out of an array.
* <p>
* Sometimes by reusing StringBuilder, we can avoid creating many StringBuilder and good to garbage collection.
*
* @param a array
* @param b reusable StringBuilder
* @param delimiter delimiter
* @param quote whether to quote value
* @param newLine if this is a new line, if true, write slash n at the end
* @return array string
*/
public static String arrayToString(Object[] a, StringBuilder b, String delimiter, boolean quote, boolean newLine) {
if (a == null) {
return "null";
}
// clean StringBuilder
b.delete(0, b.length());
for (int i = 0; i < a.length; i++) {
if (quote) {
try {
FIELD_FORMAT_QUOTED.print(a[i], b, true);
} catch (IOException e) {
// should not happen as StringBuilder does not throw IOException
throw new IllegalStateException(e);
}
} else {
b.append(a[i]);
}
b.append(delimiter);
}
if (b.length() > 0) {
b.deleteCharAt(b.length() - 1);
}
if (newLine) {
b.append("\n");
}
return b.toString();
}
}
| [
"[email protected]"
]
| |
2fdafab67381d78295aee2972e2045e7ee63afcb | 38359f18277f31704c57c6c305922e9981d0a31c | /Android/Naima Doctor/app/src/main/java/nalanda/com/doctor/widgets/ComboboxView.java | 9559afcdc484c4116d995a45730eac32299e9b0e | []
| no_license | alincc/naima | ee5c4d7503fcdcbf886cf3d79379a24572181686 | 890a9ce877f5b9040241c0be5e48c9f49cef5b8e | refs/heads/master | 2021-01-22T09:33:06.741787 | 2017-01-08T07:18:54 | 2017-01-08T07:18:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,982 | java | package nalanda.com.doctor.widgets;
import android.app.Activity;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import java.util.ArrayList;
import java.util.List;
import nalanda.com.doctor.R;
import nalanda.com.doctor.models.BaseModel;
import nalanda.com.doctor.models.ComboboxModel;
import nalanda.com.doctor.viewmodel.BaseViewModel;
import nalanda.com.doctor.viewmodel.SymptomItemModel;
/**
* Created by ps1 on 9/10/16.
*/
public class ComboboxView implements BaseView{
private ComboboxModel comboboxModel;
private SymptomItemModel dataViewItemModel[];
private View view;
public ComboboxView(BaseViewModel dataViewModel[]) {
comboboxModel = new ComboboxModel();
this.dataViewItemModel = dataViewItemModel;
}
@Override
public View getView(Activity activity) {
view = activity.getLayoutInflater().inflate(R.layout.combo_input_layout, null, false);
List<String> items = new ArrayList<String>();
for(int i = 0; i < dataViewItemModel.length; i++) {
items.add(dataViewItemModel[i].getInfo().getName());
}
// Creating adapter for spinner
ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(activity, android.R.layout.simple_spinner_item, items);
// Drop down layout style - list view with radio button
dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// attaching data adapter to spinner
Spinner spinner = (Spinner) view.findViewById(R.id.spinner);
spinner.setAdapter(dataAdapter);
return view;
}
@Override
public BaseModel getClinicalData() {
return null;
}
public int getSelectedIndex() {
Spinner spinner = (Spinner) view.findViewById(R.id.spinner);
return spinner.getSelectedItemPosition();
}
@Override
public BaseViewModel getViewModel() {
return null;
}
}
| [
"[email protected]"
]
| |
b295069529e88d7ec940f73216f0ba86a0969136 | 9b20ed806231e557702b60678390208a127b41b8 | /SmartGuardM/src/com/dft/smartguardm/SoftDescription.java | a9cacbd442d44d3e562854f7a96964cb9073d1b6 | []
| no_license | loveLynch/SmartGuard | 453f430aebbe2cd0d0e42e0de07a1f184db3f464 | ce67d00d1769a943357f94a189774df00d13df5d | refs/heads/master | 2021-01-10T08:17:08.304623 | 2016-03-14T15:42:11 | 2016-03-14T15:42:11 | 53,869,579 | 4 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 331 | java | package com.dft.smartguardm;
import android.app.Activity;
import android.os.Bundle;
/**
* ÉèÖÃ
*
* @author dft
*
*/
public class SoftDescription extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act_softdescription);
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.