blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
โ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5b0e07dc5b1ee6eebfdd8a0caa31a3fbb4d3327b | 3351329dd0a7ef00f7c760061cd4dd318b183c44 | /javatests/util/MehDeciderTest.java | 8c956b40e479a10ad11bcd6d64548f7e3511cd0e | [] | no_license | ogiekako/polycover | 0e20ee41e070d51a9b9a66d0b3657ec0177533fd | ef624017b1cf2473f48514784906fc04bd925f70 | refs/heads/master | 2021-01-01T17:43:53.222829 | 2017-02-05T20:49:12 | 2017-02-05T20:49:12 | 31,585,284 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 914 | java | package util;
import org.junit.Test;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class MehDeciderTest {
@Test
public void testIsMeh() throws Exception {
List<String> problems = FileUtil.allFilesUnder(new File("problem"));
List<String> badPaths = new ArrayList<String>();
for (String p : problems) {
MehDecider.Type type = MehDecider.decide(p, "problem");
if (p.endsWith(".meh")) {
if (type != MehDecider.Type.Meh) {
badPaths.add(p);
}
} else if (p.endsWith(".yes")) {
if (type != MehDecider.Type.Yes) {
badPaths.add(p);
}
} else if (p.endsWith(".no")) {
if (type != MehDecider.Type.No) {
badPaths.add(p);
}
} else {
throw new AssertionError();
}
}
if (!badPaths.isEmpty()) {
throw new AssertionError(badPaths);
}
}
}
| [
"[email protected]"
] | |
7219fda06641fbcda90cc0ff5d82c84e7f96ad58 | a1e6c9be76d8f57e1e4dff320999f836717b7080 | /src/main/java/com/dbs/mcare/service/batch/PnuhBatchJobManager.java | 8c637dadad8b82691ab6b5965ac800f827717a12 | [] | no_license | LEESOOMIN911/soominlee | 2ef7c0d8cd5ca6b5151a501efbd5710245fe817f | d9e107a796f8d091d96445daa322457c6fe257ae | refs/heads/master | 2021-01-25T01:07:41.739126 | 2017-06-09T02:18:31 | 2017-06-09T02:18:31 | 94,728,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,018 | java | package com.dbs.mcare.service.batch;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.dbs.mcare.framework.FrameworkConstants;
import com.dbs.mcare.framework.service.batch.BatchJob;
import com.dbs.mcare.framework.service.batch.job.AccessByDateBatchJob;
import com.dbs.mcare.framework.service.batch.job.AccessByHourBatchJob;
import com.dbs.mcare.framework.service.batch.job.AccessByMenuBatchJob;
import com.dbs.mcare.framework.service.batch.job.AccessByPlatformBatchJob;
import com.dbs.mcare.framework.service.batch.job.EventByDateBatchJob;
import com.dbs.mcare.framework.service.batch.job.MsgLogByDateBatchJob;
import com.dbs.mcare.framework.service.batch.job.UserRegisterByDateBatchJob;
import com.dbs.mcare.framework.util.DateUtil;
import com.dbs.mcare.service.PnuhConfigureService;
import com.dbs.mcare.service.batch.job.HelperDeleteByDateBatchJob;
import com.dbs.mcare.service.batch.job.UserInfoBatchJob;
import com.dbs.mcare.service.batch.job.WithdrawalNotifyByDateBatchJob;
@Component
@EnableScheduling
public class PnuhBatchJobManager {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private PnuhConfigureService configureService;
// ํ๋ ์์ํฌ์ ์ ์๋ ์์
------
@Autowired
private AccessByDateBatchJob accessByDateBatchJob; // ์ผ๋ณ์ ๊ทผ
@Autowired
private AccessByHourBatchJob accessByHourBatchJob; // ์๊ฐ๋ณ์ ๊ทผ
@Autowired
private AccessByMenuBatchJob accessByMenuBatchJob; // ๋ฉ๋ด๋ณ์ ๊ทผ
@Autowired
private AccessByPlatformBatchJob accessByPlatformBatchJob; // ํ๋ซํผ๋ณ์ ๊ทผ
@Autowired
private EventByDateBatchJob eventByDateBatchJob; // ๋น์ฝ์ด๋ฒคํธ
@Autowired
private MsgLogByDateBatchJob msgLogByDateBatchJob; // ๋ฉ์์ง์ ์ก๊ฑด์
@Autowired
private UserRegisterByDateBatchJob userRegisterByDateBatchJob; // ์ฌ์ฉ์๋ฑ๋ก
// ์๋น์ค์ ์ ์๋ ์์
------
@Autowired
private HelperDeleteByDateBatchJob helperDeleteByDateBatchJob; // ๋์ฐ๋ฏธ ๋ฉ์์ง ์ญ์
@Autowired
private UserInfoBatchJob userInfoBatchJob; // ์ฌ์ฉ์์ ๋ณดํต๊ณ (์ง์ญ๋ณ, ์ฐ๋ น๋ณ)
@Autowired
private WithdrawalNotifyByDateBatchJob withdrawalNotifyByDateBatchJob; // ์ฌ์ฉ์ํํด
// ์ ๊ทผํต๊ณ ๊ด๋ จ ์์
private List<BatchJob> accessJobList;
// ์ฌ์ฉ์ํต๊ณ๊ด๋ จ
private List<BatchJob> userJobList;
@PostConstruct
public void init() {
// ์ ๊ทผํต๊ณ
this.accessJobList = new ArrayList<BatchJob>();
this.accessJobList.add(this.accessByDateBatchJob);
this.accessJobList.add(this.accessByHourBatchJob);
this.accessJobList.add(this.accessByMenuBatchJob);
this.accessJobList.add(this.accessByPlatformBatchJob);
this.accessJobList.add(this.eventByDateBatchJob); // ์ฑ๊ฒฉ์ด ์กฐ๊ธ ๋ค๋ฅด์ง๋ง ๋ฌถ์ด์ ๊ฐ์ด ์ฒ๋ฆฌ
this.accessJobList.add(this.msgLogByDateBatchJob); // ์ฑ๊ฒฉ์ด ์กฐ๊ธ ๋ค๋ฅด์ง๋ง ๋ฌถ์ด์ ๊ฐ์ด ์ฒ๋ฆฌ
this.accessJobList.add(this.helperDeleteByDateBatchJob); // ์ฑ๊ฒฉ์ด ๋ง์ด ๋ค๋ฅด์ง๋ง ๋ฌถ์ด์ ๊ฐ์ด ์ฒ๋ฆฌ
// ์ฌ์ฉ์ํต๊ณ
this.userJobList = new ArrayList<BatchJob>();
this.userJobList.add(this.userRegisterByDateBatchJob);
this.userJobList.add(this.userInfoBatchJob);
}
@Scheduled(cron="${access.batch.cron}") // ์ ๊ทผํต๊ณ
public void workAggAccess() {
final String batchName = "์ ๊ทผํต๊ณ๋ฐฐ์น";
// ํ์ฑํ ์ฌ๋ถ
if(!this.configureService.isAccessBatchWork()) {
if(logger.isInfoEnabled()) {
logger.info(batchName + " : ๋นํ์ฑํ");
}
return;
}
// ์์ฑํ ํต๊ณ ๋ฐ์ดํฐ๊ฐ ์์ด ๋ง์๊ฒ๋ ์๋๊ณ ๋ณต์ก๋๊ฐ ๋์ ๊ฒ๋ ์๋๊ณ ์๊ธํ๊ฒ๋ ์๋๊ณ , ํ๋์ฉ ์ฐจ๋ก๋๋ก ์ฒ๋ฆฌํ๋ค.
// ์์
์ฉ ์ด์ ๋ ์ง
final Date aggDt = DateUtil.getStartDate(1);
if(logger.isInfoEnabled()) {
logger.info(this.getLogStr(batchName, aggDt, this.accessJobList.toString()));
}
// ์์
์คํ
for(BatchJob job : this.accessJobList) {
this.executeBatchJob(aggDt, job);
}
}
@Scheduled(cron="${agg.user.info.batch.cron}") // ์ฌ์ฉ์ ํต๊ณ
public void workUserInfo() {
final String batchName = "์ฌ์ฉ์๋ฐฐ์น";
// ํ์ฑํ ์ฌ๋ถ
if(!this.configureService.isAggUserInfoWork()) {
if(logger.isInfoEnabled()) {
logger.info(batchName + " : ๋นํ์ฑํ");
}
return;
}
// ๊ธฐ์ค๋ ์ ๊ตฌํ๊ณ
final Date aggDt = DateUtil.getStartDate(1);
if(logger.isInfoEnabled()) {
logger.info(this.getLogStr(batchName, aggDt, this.userJobList.toString()));
}
// ์ฌ์ฉ์์ ๋ณดํต๊ณ ๋๋ฆฌ๊ธฐ
for(BatchJob job : this.userJobList) {
this.executeBatchJob(aggDt, job);
}
}
@Scheduled(cron="${withdrawal.batch.cron}") // ํ์ํํด์๋ด. ๋ฎ์๊ฐ์ ์๋ด๋ฅผ ํด์ค์ผ ํด์ ๋ณ๋ ์๊ฐ์ค์ ์ด ์๋๊ฒ์
public void workWithdrawal() {
final String batchName = "ํํด๋ฐฐ์น";
// ํ์ํํด๋ฐฐ์น ํ์ฑํ ์ฌ๋ถ
if(!this.configureService.isWithdrawalBatchWork()) {
logger.info(batchName + " : ๋นํ์ฑํ");
return;
}
// ์์ฑํ ํต๊ณ ๋ฐ์ดํฐ๊ฐ ์์ด ๋ง์๊ฒ๋ ์๋๊ณ ๋ณต์ก๋๊ฐ ๋์ ๊ฒ๋ ์๋๊ณ ์๊ธํ๊ฒ๋ ์๋๊ณ , ํ๋์ฉ ์ฐจ๋ก๋๋ก ์ฒ๋ฆฌํ๋ค.
// ์์
์ฉ ์ด์ ๋ ์ง
final Date aggDt = DateUtil.getStartDate(1);
if(logger.isInfoEnabled()) {
logger.info(batchName, aggDt, this.withdrawalNotifyByDateBatchJob.toString());
}
// ์์
์คํ
this.executeBatchJob(aggDt, this.withdrawalNotifyByDateBatchJob);
}
/**
* ํ๋์ ๋ฐฐ์น์์
์คํ
* @param aggDt
* @param job
*/
private void executeBatchJob(Date aggDt, BatchJob job) {
// ์คํ
try {
job.execute(aggDt);
if(logger.isInfoEnabled()) {
logger.info(job.getBatchName() + " : ์์
์๋ฃ. (" + aggDt + ")");
}
}
catch(final Exception ex) {
logger.info(job.getBatchName() + " : ์์
์คํจ. (" + aggDt + ")", ex);
// ์์ธ ๋ฐ์ ์ ๋ก๊ทธ๋ง ์ฐ๋๊ฒ์ ์ ์์ ์ธ ํ๋ฆ์. ์๋์ ์ผ๋ก ์ก์ ์์ธ์.
}
}
/**
* ๋ก๊ทธ์ฉ ๋ฌธ์ ๋ง๋ค๊ธฐ
* @param batchName
* @param aggDt
* @param target
* @return
*/
private String getLogStr(String batchName, Date aggDt, String target) {
StringBuilder builder = new StringBuilder(FrameworkConstants.NEW_LINE);
builder.append(batchName).append("์์ ==========").append(FrameworkConstants.NEW_LINE);
builder.append("- ๊ธฐ์ค์๊ฐ : ").append(aggDt).append(FrameworkConstants.NEW_LINE);
builder.append("- ๋์์์
: ").append(target).append(FrameworkConstants.NEW_LINE);
return builder.toString();
}
}
| [
"[email protected]"
] | |
a59e7797f5e7d2da58c0e3a231191687ca8ed1f0 | 2fac9d26f9b3e51bfc110ca3a1a4e5eba10b715a | /JAVA_Homework/homework_7/TestStartStop.java | 3db42927a48d6f29ef7c2dec275e515ab8f73eac | [] | no_license | wl-cp/JAVA | 2207a7b14e99e60ab431a08ab4aa49d182e1b7aa | 2406d0ae6bdadd20dd94f12da28691a385bc55e8 | refs/heads/main | 2023-07-08T00:49:54.781160 | 2021-08-24T14:09:12 | 2021-08-24T14:09:12 | 399,488,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 657 | java | interface StartStop { // ๆฅๅฃ็ๆนๆณๅฃฐๆ
void start();
void stop();
}
class Elevator implements StartStop{
public void start(){
System.out.println("Elevator start");
}
public void stop(){
System.out.println("Elevator stop");
}
}
class Conference implements StartStop{
public void start(){
System.out.println("Conference start");
}
public void stop(){
System.out.println("Conference stop");
}
}
public class TestStartStop {
public static void main(String[] args) {
StartStop[] ss = { new Elevator(), new Conference() };
for (int i = 0; i < ss.length; i++) {
ss[i].start();
ss[i].stop();
}
System.out.println("programe over");
}
}
| [
"[email protected]"
] | |
48c3950f01f7a27196058887baaa8a2f958db103 | aaf9e0840829aa6d310a3c2ca2d6a034d5a92994 | /android/app/src/debug/java/com/tfltubestatusapp/ReactNativeFlipper.java | bd9c20756e948135898b3bcf0a66e71804ec5983 | [] | no_license | timiles/tfl-tube-status-app | 4e013fc0b48de868bb545a88380e3524c13e3fd0 | cb5fd2683e3ccb2cf7d1097ced68ef0d5e912309 | refs/heads/main | 2023-05-03T19:39:42.264511 | 2021-05-23T19:42:30 | 2021-05-23T19:42:30 | 370,114,325 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,267 | java | /**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package com.tfltubestatusapp;
import android.content.Context;
import com.facebook.flipper.android.AndroidFlipperClient;
import com.facebook.flipper.android.utils.FlipperUtils;
import com.facebook.flipper.core.FlipperClient;
import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
import com.facebook.flipper.plugins.inspector.DescriptorMapping;
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.modules.network.NetworkingModule;
import okhttp3.OkHttpClient;
public class ReactNativeFlipper {
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
if (FlipperUtils.shouldEnableFlipper(context)) {
final FlipperClient client = AndroidFlipperClient.getInstance(context);
client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
client.addPlugin(new ReactFlipperPlugin());
client.addPlugin(new DatabasesFlipperPlugin(context));
client.addPlugin(new SharedPreferencesFlipperPlugin(context));
client.addPlugin(CrashReporterPlugin.getInstance());
NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
NetworkingModule.setCustomClientBuilder(
new NetworkingModule.CustomClientBuilder() {
@Override
public void apply(OkHttpClient.Builder builder) {
builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
}
});
client.addPlugin(networkFlipperPlugin);
client.start();
// Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
// Hence we run if after all native modules have been initialized
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
if (reactContext == null) {
reactInstanceManager.addReactInstanceEventListener(
new ReactInstanceManager.ReactInstanceEventListener() {
@Override
public void onReactContextInitialized(ReactContext reactContext) {
reactInstanceManager.removeReactInstanceEventListener(this);
reactContext.runOnNativeModulesQueueThread(
new Runnable() {
@Override
public void run() {
client.addPlugin(new FrescoFlipperPlugin());
}
});
}
});
} else {
client.addPlugin(new FrescoFlipperPlugin());
}
}
}
} | [
"[email protected]"
] | |
e8e07ba6dc1a9d7b0149865f42ee00261cad7a22 | 35029f02d7573415d6fc558cfeeb19c7bfa1e3cc | /gs-accessing-data-jpa-complete/src/main/java/hello/service/CustomerService2528.java | e2bbc4bda3e546deca86170673dfbe9a2b5a7e03 | [] | no_license | MirekSz/spring-boot-slow-startup | e06fe9d4f3831ee1e79cf3735f6ceb8c50340cbe | 3b1e9e4ebd4a95218b142b7eb397d0eaa309e771 | refs/heads/master | 2021-06-25T22:50:21.329236 | 2017-02-19T19:08:24 | 2017-02-19T19:08:24 | 59,591,530 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 119 | java | package hello.service;
import org.springframework.stereotype.Service;
@Service
public class CustomerService2528 {
}
| [
"miro1994"
] | miro1994 |
16b4c51db9d4bfb16b4f9c251a6857ca28d88cc7 | 6a9fe0b2d5e74e6b3724f036f43fd45ee794607e | /src/main/java/com/mmg/LeetCode/CountAndSay.java | 8aa2ec4f66ff76855cdade4ea91814b3da99ad3c | [] | no_license | Moremoregreen/OnlineProgramming | bdf7bd35440579103a5654919d925d0346e95cc6 | ed1b820b0db3196c71e7d774b0ab55a1adf61d00 | refs/heads/master | 2020-05-05T07:47:16.402903 | 2019-04-06T13:41:50 | 2019-04-06T13:41:50 | 179,838,069 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,382 | java | package com.mmg.LeetCode;
/*
้ฃๅบฆ:EASY
n=1ๆ่ผธๅบๅญ็ฌฆไธฒ1๏ผn=2ๆ๏ผๆธไธๆฌกๅญ็ฌฆไธฒไธญ็ๆธๅผๅๆธ๏ผๅ ็บไธๆฌกๅญ็ฌฆไธฒๆ1ๅ1๏ผๆไปฅ่ผธๅบ11๏ผ
n=3ๆ๏ผ็ฑๆผไธๆฌกๅญ็ฌฆๆฏ11๏ผๆ2ๅ1๏ผๆไปฅ่ผธๅบ21๏ผn=4ๆ๏ผ็ฑๆผไธๆฌกๅญ็ฌฆไธฒๆฏ21๏ผๆ1ๅ2ๅ1ๅ1๏ผ
ๆไปฅ่ผธๅบ1211ใไพๆฌก้กๆจ๏ผๅฏซๅcountAndSay(n)ๅฝๆธ่ฟๅๅญ็ฌฆไธฒใ
1. 1
2. 11
3. 21
4. 1211
5. 111221
*/
public class CountAndSay {
public static void main(String[] args) {
System.out.println(countAndSay(4));
}
public static String countAndSay(int n) {
StringBuilder sb = new StringBuilder();
int counter = 0;
if (n == 1) {
return "1";
} else if (n == 2) {
return "11";
} else {
String temp = countAndSay(n - 1); //21
for (int i = 0; i < temp.length(); i++) { // 0 12
// tempๆๅ
ฉๅไธๆจฃ็ๆธๅญ
while (i < temp.length() - 1 && temp.charAt(i) == temp.charAt(i + 1)) {
counter++;
i++;
}
System.out.println(sb);
System.out.println(i+" " + n);
sb = sb.append(++counter).append(temp.charAt(i));
counter = 0;
}
}
return sb.toString();
}
}
| [
"[email protected]"
] | |
3319b65ed971124ca03d93936fa7b39203f24266 | dfd7e70936b123ee98e8a2d34ef41e4260ec3ade | /analysis/reverse-engineering/decompile-fitts-20191031-2200/sources/com/google/android/gms/internal/clearcut/zzaw.java | b796b6ede82816697b8f99576cbaad1c1f44d7a0 | [
"Apache-2.0"
] | permissive | skkuse-adv/2019Fall_team2 | 2d4f75bc793368faac4ca8a2916b081ad49b7283 | 3ea84c6be39855f54634a7f9b1093e80893886eb | refs/heads/master | 2020-08-07T03:41:11.447376 | 2019-12-21T04:06:34 | 2019-12-21T04:06:34 | 213,271,174 | 5 | 5 | Apache-2.0 | 2019-12-12T09:15:32 | 2019-10-07T01:18:59 | Java | UTF-8 | Java | false | false | 557 | java | package com.google.android.gms.internal.clearcut;
final class zzaw {
private static final Class<?> zzfb = zze("libcore.io.Memory");
private static final boolean zzfc = (zze("org.robolectric.Robolectric") != null);
private static <T> Class<T> zze(String str) {
try {
return Class.forName(str);
} catch (Throwable unused) {
return null;
}
}
static boolean zzx() {
return zzfb != null && !zzfc;
}
static Class<?> zzy() {
return zzfb;
}
}
| [
"[email protected]"
] | |
32937e6b0d8da12a19a666ce2de457df9ea4f8b3 | 2b2d2183695e92e4a5fbd6d3edb4fae3678b428c | /tool/src/main/java/com/yph/entity/UserEntity.java | 91d3c8959f7cbdcc1fe6e6879080a22110ebc007 | [] | no_license | 513667225/resourceCenter | 7639e2c1c3fd4f25b7826dd27490d70897d26556 | 7c8a2ad25f953f4653ba28963566e77a55451359 | refs/heads/master | 2023-05-12T04:08:24.853959 | 2021-06-01T08:26:37 | 2021-06-01T08:26:37 | 372,721,263 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,139 | java | package com.yph.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
/**
* <p>
* ็จๆท่กจ
* </p>
*
* @author
* @since 2020-11-12
*/
@TableName("user")
public class UserEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "user_id", type = IdType.AUTO)
private Integer userId;
/**
* ็จๆทๅฏ็
*/
private String userPassword;
/**
* ๆ่ฟไธๆฌก็ปๅฝๆถ้ด
*/
private Date userLastLoginTime;
/**
* V0 - V6
*/
private Integer userLevel;
/**
* ็จๆท่ง่ฒ(0 ๆฎ้็จๆท;1 VIP;2 ็ป็;3 ๆป่ฃ)
*/
private Integer role;
/**
* ็จๆทๆต็งฐ
*/
private String userNickname;
/**
* ็จๆทๆๆบๅท็
*/
private String userMobile;
/**
* ็จๆทๅคดๅๅพ็
*/
private String userAvatar;
/**
* 0 ๅฏ็จ;1 ็ฆ็จ;2 ๆณจ้
*/
private Integer userStatus;
/**
* ็จๆทๆจ่ไบบID
*/
private Integer userReferrer;
/**
* ๅๅปบๆถ้ด
*/
private Date addTime;
/**
* ๆดๆฐๆถ้ด
*/
private Date updateTime;
/**
* ้่ฏทๅข้ไบบๆฐ
*/
private Integer goupSize;
/**
* ็ด้ไบบๆฐ
*/
private Integer underlingSize;
/**
* ๅข้VIPไบบๆฐ
*/
private Integer groupVipSize;
/**
* ็ด้VIPไบบๆฐ
*/
private Integer underlingVipSize;
/**
* ๅข้็ป็ไบบๆฐ
*/
private Integer groupManagerSize;
/**
* ็ด้็ป็ไบบๆฐ
*/
private Integer underlingManagerSize;
/**
* ๅข้ๆป่ฃไบบๆฐ
*/
private Integer groupCeoSize;
/**
* ็ด้ๆป่ฃไบบๆฐ
*/
private Integer underlingCeoSize;
/**
* ้กถๅฑๆจ่ไบบid
*/
private Integer topRefereeId;
/**
* ็ๅฝๆบ
*/
private Long lifeSource;
/**
* ไธๅฏๆ็ฐๆถ่ดน่ฝ้ๆบ
*/
private Long energySource;
/**
* ๅฏๆ็ฐ่ฝ้ๆบ
*/
private Long activateEnergySource;
/**
* ๅฝๆฅ้็ป็ฎ่ฝ้ๆบ
*/
private Long clearingEnergySource;
/**
* ๅธ
*/
private Long bean;
/**
* ๅฏๆ็ฐๅธ
*/
private Long tranBean;
/**
* ๅ
ณ็ณป
*/
private String relation;
/**
* ้ถ่กๅก
*/
private String bankCard;
/**
* ๅป็ป็ๅฝๆบ
*/
private Long freezeLifeSource;
/**
* ๅป็ป่ฝ้ๆบ
*/
private Long freezeEnergySource;
/**
* ๅป็ปๅธ
*/
private Long freezeBean;
/**
* ไธชไบบๆปไธ็ปฉ
*/
private Long sumEnergySource;
/**
*ๅข้ๆปไธ็ปฉ
*/
private Long sumTeamEnergySource;
/**
* ๆฏๅฆๆฏ็ๅธๅบไปฃ็
*/
private Integer isAdmin;
/**
* ็ๅธๅบ ็บงๅซ
*/
@TableField("`rank`")
private Integer rank;
/**
* ๅๅธไธ็บง่ๅจ่กจID
*/
private Integer zoneCode;
/**
* ๅๅธไธ็บง่ๅจ่กจๅ็งฐ
*/
private String zoneName;
/**
* ๆฏๅฆไธบๅป็ปๅฅๅฑ 0๏ผๆชๅป็ป 1๏ผๅทฒๅป็ป
*/
private Integer isFreezeAward;
/**
* ๆฏๅฆๅป็ปๆ็ฐ 0ๆชๅป็ป 1ๅทฒๅป็ป
*/
private Integer isFreezeWithdrawDeposit;
/**
* ๆฏๅฆๅป็ป้ๆพ 0ๆชๅป็ป 1ๅทฒๅป็ป
*/
private Integer isFreezeRelease;
/**
* ๆฏๅฆ้ๅฎ็จๆท 0ๆช้ๅฎ 1ๅทฒ้ๅฎ
*/
private Integer isLockTheUser;
private String address;
private Integer passwordTow;
/**
* ็ๅฝๆบไปทๅผ
*/
private Long lifeSourceAssets;
/**
* ไธญๅฅๆฌกๆฐ
* @return
*/
private int bingoCount;
public Long getTranBean() {
return tranBean;
}
public void setTranBean(Long tranBean) {
this.tranBean = tranBean;
}
public Integer getPasswordTow() {
return passwordTow;
}
public void setPasswordTow(Integer passwordTow) {
this.passwordTow = passwordTow;
}
public Integer getRole() {
return role;
}
public void setRole(Integer role) {
this.role = role;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public Integer getIsFreezeAward() {
return isFreezeAward;
}
public void setIsFreezeAward(Integer isFreezeAward) {
this.isFreezeAward = isFreezeAward;
}
public Integer getIsFreezeWithdrawDeposit() {
return isFreezeWithdrawDeposit;
}
public void setIsFreezeWithdrawDeposit(Integer isFreezeWithdrawDeposit) {
this.isFreezeWithdrawDeposit = isFreezeWithdrawDeposit;
}
public Long getActivateEnergySource() {
return activateEnergySource;
}
public void setActivateEnergySource(Long activateEnergySource) {
this.activateEnergySource = activateEnergySource;
}
public Long getClearingEnergySource() {
return clearingEnergySource;
}
public void setClearingEnergySource(Long clearingEnergySource) {
this.clearingEnergySource = clearingEnergySource;
}
public Integer getUnderlingVipSize() {
return underlingVipSize;
}
public void setUnderlingVipSize(Integer underlingVipSize) {
this.underlingVipSize = underlingVipSize;
}
public Integer getGroupManagerSize() {
return groupManagerSize;
}
public void setGroupManagerSize(Integer groupManagerSize) {
this.groupManagerSize = groupManagerSize;
}
public Integer getUnderlingManagerSize() {
return underlingManagerSize;
}
public void setUnderlingManagerSize(Integer underlingManagerSize) {
this.underlingManagerSize = underlingManagerSize;
}
public Integer getGroupCeoSize() {
return groupCeoSize;
}
public void setGroupCeoSize(Integer groupCeoSize) {
this.groupCeoSize = groupCeoSize;
}
public Integer getUnderlingCeoSize() {
return underlingCeoSize;
}
public void setUnderlingCeoSize(Integer underlingCeoSize) {
this.underlingCeoSize = underlingCeoSize;
}
public Integer getIsFreezeRelease() {
return isFreezeRelease;
}
public void setIsFreezeRelease(Integer isFreezeRelease) {
this.isFreezeRelease = isFreezeRelease;
}
public Integer getIsLockTheUser() {
return isLockTheUser;
}
public void setIsLockTheUser(Integer isLockTheUser) {
this.isLockTheUser = isLockTheUser;
}
public Integer getIsAdmin() {
return isAdmin;
}
public void setIsAdmin(Integer isAdmin) {
this.isAdmin = isAdmin;
}
public Integer getRank() {
return rank;
}
public void setRank(Integer rank) {
this.rank = rank;
}
public Integer getZoneCode() {
return zoneCode;
}
public void setZoneCode(Integer zoneCode) {
this.zoneCode = zoneCode;
}
public String getZoneName() {
return zoneName;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
public UserEntity() {
}
public UserEntity(Integer userId, Integer userLevel,Integer rank) {
this.userId = userId;
this.userLevel = userLevel;
this.rank = rank;
}
public Long getSumEnergySource() {
return sumEnergySource;
}
public void setSumEnergySource(Long sumEnergySource) {
this.sumEnergySource = sumEnergySource;
}
public Long getSumTeamEnergySource() {
return sumTeamEnergySource;
}
public void setSumTeamEnergySource(Long sumTeamEnergySource) {
this.sumTeamEnergySource = sumTeamEnergySource;
}
public Integer getUserId() {
return userId;
}
public UserEntity setUserId(Integer userId) {
this.userId = userId;
return this;
}
public String getUserPassword() {
return userPassword;
}
public UserEntity setUserPassword(String userPassword) {
this.userPassword = userPassword;
return this;
}
public Date getUserLastLoginTime() {
return userLastLoginTime;
}
public UserEntity setUserLastLoginTime(Date userLastLoginTime) {
this.userLastLoginTime = userLastLoginTime;
return this;
}
public Integer getUserLevel() {
return userLevel;
}
public UserEntity setUserLevel(Integer userLevel) {
this.userLevel = userLevel;
return this;
}
public String getUserNickname() {
return userNickname;
}
public UserEntity setUserNickname(String userNickname) {
this.userNickname = userNickname;
return this;
}
public String getUserMobile() {
return userMobile;
}
public UserEntity setUserMobile(String userMobile) {
this.userMobile = userMobile;
return this;
}
public String getUserAvatar() {
return userAvatar;
}
public UserEntity setUserAvatar(String userAvatar) {
this.userAvatar = userAvatar;
return this;
}
public Integer getUserStatus() {
return userStatus;
}
public UserEntity setUserStatus(Integer userStatus) {
this.userStatus = userStatus;
return this;
}
public Integer getUserReferrer() {
return userReferrer;
}
public UserEntity setUserReferrer(Integer userReferrer) {
this.userReferrer = userReferrer;
return this;
}
public Date getAddTime() {
return addTime;
}
public UserEntity setAddTime(Date addTime) {
this.addTime = addTime;
return this;
}
public Date getUpdateTime() {
return updateTime;
}
public UserEntity setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
return this;
}
public Integer getGoupSize() {
return goupSize;
}
public UserEntity setGoupSize(Integer goupSize) {
this.goupSize = goupSize;
return this;
}
public Integer getUnderlingSize() {
return underlingSize;
}
public UserEntity setUnderlingSize(Integer underlingSize) {
this.underlingSize = underlingSize;
return this;
}
public Integer getGroupVipSize() {
return groupVipSize;
}
public UserEntity setGroupVipSize(Integer groupVipSize) {
this.groupVipSize = groupVipSize;
return this;
}
public Integer getTopRefereeId() {
return topRefereeId;
}
public UserEntity setTopRefereeId(Integer topRefereeId) {
this.topRefereeId = topRefereeId;
return this;
}
public Long getLifeSource() {
return lifeSource;
}
public void setLifeSource(Long lifeSource) {
this.lifeSource = lifeSource;
}
public Long getEnergySource() {
return energySource;
}
public void setEnergySource(Long energySource) {
this.energySource = energySource;
}
public Long getBean() {
return bean;
}
public void setBean(Long bean) {
this.bean = bean;
}
public String getRelation() {
return relation;
}
public UserEntity setRelation(String relation) {
this.relation = relation;
return this;
}
public String getBankCard() {
return bankCard;
}
public UserEntity setBankCard(String bankCard) {
this.bankCard = bankCard;
return this;
}
public Long getFreezeLifeSource() {
return freezeLifeSource;
}
public void setFreezeLifeSource(Long freezeLifeSource) {
this.freezeLifeSource = freezeLifeSource;
}
public Long getFreezeEnergySource() {
return freezeEnergySource;
}
public void setFreezeEnergySource(Long freezeEnergySource) {
this.freezeEnergySource = freezeEnergySource;
}
public Long getFreezeBean() {
return freezeBean;
}
public void setFreezeBean(Long freezeBean) {
this.freezeBean = freezeBean;
}
public Long getLifeSourceAssets() {
return lifeSourceAssets;
}
public void setLifeSourceAssets(Long lifeSourceAssets) {
this.lifeSourceAssets = lifeSourceAssets;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UserEntity that = (UserEntity) o;
return userId.equals(that.userId);
}
@Override
public int hashCode() {
return Objects.hash(userId);
}
public int getBingoCount() {
return bingoCount;
}
public void setBingoCount(int bingoCount) {
this.bingoCount = bingoCount;
}
}
| [
"[email protected]"
] | |
9d9de18fc68190317206df5371b218cdcbb8c087 | a2df6764e9f4350e0d9184efadb6c92c40d40212 | /aliyun-java-sdk-aliyuncvc/src/main/java/com/aliyuncs/aliyuncvc/model/v20190919/CheckMeetingCodeResponse.java | 9e3ee8412dc640c299899af4865c77ba154ea12f | [
"Apache-2.0"
] | permissive | warriorsZXX/aliyun-openapi-java-sdk | 567840c4bdd438d43be6bd21edde86585cd6274a | f8fd2b81a5f2cd46b1e31974ff6a7afed111a245 | refs/heads/master | 2022-12-06T15:45:20.418475 | 2020-08-20T08:37:31 | 2020-08-26T06:17:49 | 290,450,773 | 1 | 0 | NOASSERTION | 2020-08-26T09:15:48 | 2020-08-26T09:15:47 | null | UTF-8 | Java | false | false | 4,336 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aliyuncs.aliyuncvc.model.v20190919;
import com.aliyuncs.AcsResponse;
import com.aliyuncs.aliyuncvc.transform.v20190919.CheckMeetingCodeResponseUnmarshaller;
import com.aliyuncs.transform.UnmarshallerContext;
/**
* @author auto create
* @version
*/
public class CheckMeetingCodeResponse extends AcsResponse {
private Integer errorCode;
private Boolean success;
private String requestId;
private String message;
private MeetingInfo meetingInfo;
public Integer getErrorCode() {
return this.errorCode;
}
public void setErrorCode(Integer errorCode) {
this.errorCode = errorCode;
}
public Boolean getSuccess() {
return this.success;
}
public void setSuccess(Boolean success) {
this.success = success;
}
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public String getMessage() {
return this.message;
}
public void setMessage(String message) {
this.message = message;
}
public MeetingInfo getMeetingInfo() {
return this.meetingInfo;
}
public void setMeetingInfo(MeetingInfo meetingInfo) {
this.meetingInfo = meetingInfo;
}
public static class MeetingInfo {
private String meetingDomain;
private String meetingToken;
private String meetingCode;
private String memberUUID;
private String clientAppId;
private String meetingUUID;
private String meetingAppId;
private SlsInfo slsInfo;
public String getMeetingDomain() {
return this.meetingDomain;
}
public void setMeetingDomain(String meetingDomain) {
this.meetingDomain = meetingDomain;
}
public String getMeetingToken() {
return this.meetingToken;
}
public void setMeetingToken(String meetingToken) {
this.meetingToken = meetingToken;
}
public String getMeetingCode() {
return this.meetingCode;
}
public void setMeetingCode(String meetingCode) {
this.meetingCode = meetingCode;
}
public String getMemberUUID() {
return this.memberUUID;
}
public void setMemberUUID(String memberUUID) {
this.memberUUID = memberUUID;
}
public String getClientAppId() {
return this.clientAppId;
}
public void setClientAppId(String clientAppId) {
this.clientAppId = clientAppId;
}
public String getMeetingUUID() {
return this.meetingUUID;
}
public void setMeetingUUID(String meetingUUID) {
this.meetingUUID = meetingUUID;
}
public String getMeetingAppId() {
return this.meetingAppId;
}
public void setMeetingAppId(String meetingAppId) {
this.meetingAppId = meetingAppId;
}
public SlsInfo getSlsInfo() {
return this.slsInfo;
}
public void setSlsInfo(SlsInfo slsInfo) {
this.slsInfo = slsInfo;
}
public static class SlsInfo {
private String logServiceEndpoint;
private String logstore;
private String project;
public String getLogServiceEndpoint() {
return this.logServiceEndpoint;
}
public void setLogServiceEndpoint(String logServiceEndpoint) {
this.logServiceEndpoint = logServiceEndpoint;
}
public String getLogstore() {
return this.logstore;
}
public void setLogstore(String logstore) {
this.logstore = logstore;
}
public String getProject() {
return this.project;
}
public void setProject(String project) {
this.project = project;
}
}
}
@Override
public CheckMeetingCodeResponse getInstance(UnmarshallerContext context) {
return CheckMeetingCodeResponseUnmarshaller.unmarshall(this, context);
}
@Override
public boolean checkShowJsonItemName() {
return false;
}
}
| [
"[email protected]"
] | |
906856ab46414243401530a35da3634afbe30587 | a9903f3ff6b282e2712b887d4ee8fd79866cfade | /src/main/java/org/byron4j/cookbook/netty/message/MessageResponsePacket.java | 5a2e54cd316d1f5f253a5014e2beb87d2296c0d7 | [
"MIT"
] | permissive | Byron4j/CookBook | 2a40fac245b6a61447a26d31db7fd28386e81951 | 1979653ec7eeee95c8422494e5af732e11b30efb | refs/heads/master | 2023-03-04T13:10:27.544573 | 2023-01-30T03:42:27 | 2023-01-30T03:42:27 | 153,215,823 | 799 | 281 | MIT | 2022-12-16T13:43:01 | 2018-10-16T03:16:19 | Java | UTF-8 | Java | false | false | 608 | java | package org.byron4j.cookbook.netty.message;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.byron4j.cookbook.netty.apidemo.command.Command;
import org.byron4j.cookbook.netty.apidemo.packet.Packet;
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class MessageResponsePacket extends Packet {
/**ๆถๆฏๅ
ๅฎน*/
private String message;
/**
* ๆถๆฏ่ฏทๆฑๅฝไปค
* @return
*/
@Override
public Byte getCommand() {
return Command.MESSAGE_RESPONSE;
}
}
| [
"byron@LAPTOP-JFJ7CR82"
] | byron@LAPTOP-JFJ7CR82 |
cfad2757392894373726e50f7f918ec06f756813 | 0d18b69be9b92defaaa97f31c98b965dd91819e4 | /guns-admin/src/main/java/com/guo/guns/modular/system/service/IDictService.java | 471e533d4497ff32e7ba568d3d79ba3273b91771 | [
"Apache-2.0"
] | permissive | tuyugg123/guo-projects | bc9cda10847bed9d1b69479acdb5a533c96e154e | 596acd3f0adda5b23f9e8f693884aa03abc20828 | refs/heads/master | 2020-03-07T04:38:13.505116 | 2018-03-05T17:32:07 | 2018-03-05T17:32:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 613 | java | package com.guo.guns.modular.system.service;
/**
* ๅญๅ
ธๆๅก
*
* @author fengshuonan
* @date 2017-04-27 17:00
*/
public interface IDictService {
/**
* ๆทปๅ ๅญๅ
ธ
*
* @author fengshuonan
* @Date 2017/4/27 17:01
*/
void addDict(String dictName, String dictValues);
/**
* ็ผ่พๅญๅ
ธ
*
* @author fengshuonan
* @Date 2017/4/28 11:01
*/
void editDict(Integer dictId, String dictName, String dicts);
/**
* ๅ ้คๅญๅ
ธ
*
* @author fengshuonan
* @Date 2017/4/28 11:39
*/
void delteDict(Integer dictId);
}
| [
"[email protected]"
] | |
81862c0d4e3ffe168e07e2369403e0914af7e7fb | 026a4b18ed724059b6166e52a7943432c2f8aa4f | /src/main/java/Servlet/CityAllSrv.java | cbdb4071ead48253c29179810a9b1a36a9a26513 | [] | no_license | egalli64/red420 | 4aad22be6b23fa6e74ef50e68d4f7454e120495b | 277ccc384a43bc9fa1bdaae262c27caa8968b272 | refs/heads/master | 2023-06-04T16:20:31.134490 | 2021-06-18T14:03:08 | 2021-06-18T14:03:08 | 376,021,781 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,050 | java | package Servlet;
import java.io.IOException;
import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import Dao.CityDao;
@SuppressWarnings("serial")
@WebServlet("/cities")
public class CityAllSrv extends HttpServlet {
private static final Logger log = LoggerFactory.getLogger(CityAllSrv.class);
@Resource(name = "jdbc/red")
private DataSource ds;
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
log.trace("called");
String param = request.getParameter("cityId");
try (CityDao dao = new CityDao(ds)) {
request.setAttribute("cities", dao.getAll());
request.getRequestDispatcher("page4.jsp").forward(request, response);
}
}
}
| [
"[email protected]"
] | |
a4395f35251fae11c23c4e462ba20bf3b37e816a | 6a3f05af9e1f224ea52b2d912935697714652079 | /app/src/main/java/com/marko/teletrader/model/news/NewsResult.java | 2d8dca77ce7c47cf99d69c36065828025bd22636 | [] | no_license | marko-mihajlovic/InterviewApp-TeleTrader | ca43966c749a5c33cf9ad5938886c206b3b19f10 | 49ffd4c0d5b1ced00ed65446f36a173c37ff0400 | refs/heads/master | 2023-07-10T22:07:25.647021 | 2021-08-23T20:08:39 | 2021-08-23T20:08:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 560 | java | package com.marko.teletrader.model.news;
import androidx.annotation.NonNull;
import com.tickaroo.tikxml.annotation.Element;
import com.tickaroo.tikxml.annotation.Path;
import com.tickaroo.tikxml.annotation.Xml;
import java.util.ArrayList;
import java.util.List;
@Xml(name = "Result")
public class NewsResult{
@Path("NewsList")
@Element
public List<News> newsList;
public NewsResult(){ }
@NonNull
public List<News> getNewsList(){
if(newsList==null)
return new ArrayList<>();
return newsList;
}
}
| [
"[email protected]"
] | |
b719195b2837d9f5a75ce1b1b9124befdf3ebd1f | 4d1db9e6a87fbd5fa8dc70da3d7c2e7e6d681493 | /src/main/java/com/kandagar/rls/model/EducationModel.java | 5730ca1a7ec8e2f0d360074b2bf0e53c5278a0df | [] | no_license | Kopylova/kandagar | d38e41e01ad876e5d9c1e156fe2c694407bd5945 | 1953a83f048099329eb6009a7880b8c11e4b2303 | refs/heads/master | 2016-09-05T09:28:26.145267 | 2015-02-16T23:11:44 | 2015-02-16T23:11:44 | 30,892,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 88 | java | package com.kandagar.rls.model;
public class EducationModel extends BaseTitleModel{
}
| [
"[email protected]"
] | |
ef1752dbc17aac088e5450ab489482a642de5713 | cbb027a5bf11a32665ece3b4fd4e7e5cea436fd6 | /src/main/java/cn/lkxed/dao/IAuthorDAO.java | 0a70fd122abac2c10ce1f861c5b8bf26f0a5b62f | [] | no_license | lkxed/gushiwen | 4c92bca513cd6b3c789cf08c8916a043c6f5e046 | 52f39631e2e1e2fd4c174639d085c0e19b486b3a | refs/heads/master | 2022-02-11T18:05:38.646460 | 2022-01-29T06:42:46 | 2022-01-29T06:42:46 | 164,292,267 | 3 | 1 | null | 2022-02-09T23:25:15 | 2019-01-06T09:18:31 | Java | UTF-8 | Java | false | false | 316 | java | package cn.lkxed.dao;
import cn.lkxed.po.Author;
import java.util.List;
public interface IAuthorDAO {
public List findAll();
public List findPage(int pageNum, int pageSize);
public List findByExample(Author example);
public List findDynastyAuthorPage(Author example, int pageNum, int pageSize);
}
| [
"[email protected]"
] | |
bc149e4380362f6a917f78c5446d99a4e110aa2c | 4ce0078b0375b9e2e594d82cb55d2f35efd2597d | /sdlv/src/main/java/com/yydcdut/sdlv/Callback.java | 852d7403923fd1b3f4305d661e5a747325c9f443 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | wilco375/SlideAndDragListView | 4da4f3674452bab74d1176dd202c44bf17840f82 | 2a5d4e8c06b41b91c6da6465f7c35fe09061fa34 | refs/heads/master | 2020-03-24T10:30:27.291326 | 2018-07-28T10:06:42 | 2018-07-28T10:06:42 | 142,658,267 | 0 | 0 | Apache-2.0 | 2018-07-28T07:51:24 | 2018-07-28T07:51:24 | null | UTF-8 | Java | false | false | 1,517 | java | /*
* Copyright (C) 2015 yydcdut ([email protected])
*
* 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.yydcdut.sdlv;
import android.view.View;
import android.widget.AbsListView;
/**
* Created by yuyidong on 2017/5/16.
*/
interface Callback {
interface OnDragDropListener {
boolean onDragStarted(int x, int y, View view);
void onDragMoving(int x, int y, View view, SlideAndDragListView.OnDragDropListener listener);
void onDragFinished(int x, int y, SlideAndDragListView.OnDragDropListener listener);
}
interface OnScrollListenerWrapper {
void onScrollStateChanged(AbsListView view, int scrollState);
void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount);
}
interface OnItemLongClickListenerWrapper {
void onListItemLongClick(View view, int position);
}
interface OnItemClickListenerWrapper {
void onListItemClick(View v, int position);
}
}
| [
"[email protected]"
] | |
37e36edd4cdd8626d8f0df52aee2d7ed83430bf4 | 6b8254d00699126425f128361ebb515d3c17b68d | /leyou/ly-common/src/main/java/com/leyou/common/contants/MQConstants.java | b2bb96f94a7a3eae75b886cc31fdaff9767c0e9d | [] | no_license | Dengjx-du/CODE | d84403ed976c8db93e51ade4e30878422409eeef | efb68956ed78a07621003b2a7af07428667e539e | refs/heads/master | 2022-11-26T14:37:04.908227 | 2019-12-22T13:13:36 | 2019-12-22T13:13:36 | 229,566,840 | 0 | 0 | null | 2022-11-16T12:15:06 | 2019-12-22T12:48:11 | Java | UTF-8 | Java | false | false | 1,589 | java | package com.leyou.common.contants;
public abstract class MQConstants {
public static final class Exchange {
/**
* ๅๅๆๅกไบคๆขๆบๅ็งฐ
*/
public static final String ITEM_EXCHANGE_NAME = "ly.item.exchange";
/**
* ็ญไฟกๆๅก
*/
public static final String SMS_EXCHANGE_NAME = "ly.sms.exchange";
}
public static final class RoutingKey {
/**
* ๅๅไธๆถ็routing-key
*/
public static final String ITEM_UP_KEY = "item.up";
/**
* ๅๅไธๆถ็routing-key
*/
public static final String ITEM_DOWN_KEY = "item.down";
/**
* ๅ้็ญไฟก้ช่ฏ็
*/
public static final String VERIFY_CODE_KEY = "sms.verify.code";
}
public static final class Queue{
/**
* ๆ็ดขๆๅก๏ผๅๅไธๆถ็้ๅ
*/
public static final String SEARCH_ITEM_UP = "search.item.up.queue";
/**
* ๆ็ดขๆๅก๏ผๅๅไธๆถ็้ๅ
*/
public static final String SEARCH_ITEM_DOWN = "search.item.down.queue";
/**
* ๆ็ดขๆๅก๏ผๅๅไธๆถ็้ๅ
*/
public static final String PAGE_ITEM_UP = "page.item.up.queue";
/**
* ๆ็ดขๆๅก๏ผๅๅไธๆถ็้ๅ
*/
public static final String PAGE_ITEM_DOWN = "page.item.down.queue";
/**
* ๅ้็ญไฟก้ช่ฏ็
*/
public static final String SMS_VERIFY_CODE_QUEUE = "sms.verify.code.queue";
}
}
| [
"[email protected]"
] | |
d8ad08d8e387ffedcc3e49d828b53660bb16da7a | 5450714f807e918bce2da2c4bbcde42b2c877cef | /ReadyNasDownloader/src/com/thekyz/utils/HtmlHelper.java | 4ee2acb6b551dc76bfb27ce98e02777cf7776a0a | [] | no_license | 49magge/kyznas | 77961b0f30899f3c4b04db5042c244ed7e1335cb | 5d821ed3e1ce3bc1076a8102e1ed0b600f0515ea | refs/heads/master | 2016-09-01T15:59:13.401984 | 2010-11-25T12:12:32 | 2010-11-25T12:12:32 | 51,951,035 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,358 | java | package com.thekyz.utils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.params.HttpParams;
import org.apache.http.util.EntityUtils;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
/**
* User: Kyz
* Date: 30 oct. 2010
* Time: 17:38:38
*/
public final class HtmlHelper {
private static HttpClient client = new DefaultHttpClient();
public static String post(String url, List<NameValuePair> pairs) {
String responsePage = "";
// Create the post header
HttpPost post = new HttpPost(url);
try {
// Set the data
post.setEntity(new UrlEncodedFormEntity(pairs));
// Execute POST request
HttpResponse response = client.execute(post);
responsePage = EntityUtils.toString(response.getEntity());
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return responsePage;
}
public static String get(String url) {
String responsePage = "";
// Create the get header
HttpGet get = new HttpGet(url);
try {
// Send the request
HttpResponse response = client.execute(get);
responsePage = EntityUtils.toString(response.getEntity());
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return responsePage;
}
public static void download(String remoteFile, String localFolder) throws IOException {
URL url = new URL(remoteFile);
// Open the connection
System.out.println("Opening connection to " + remoteFile + "...");
URLConnection urlC = url.openConnection();
// Copy resource to local file
InputStream is = url.openStream();
// Print info about resource
System.out.println("Copying resource (type: " + urlC.getContentType() + ")");
// Get remote filename
String localFile = null;
StringTokenizer st = new StringTokenizer(url.getFile(), "/");
while (st.hasMoreTokens()) {
localFile = st.nextToken();
}
localFile = localFolder + File.separator + localFile;
FileOutputStream fos = new FileOutputStream(new File(localFile));
int oneChar, count=0;
while ((oneChar = is.read()) != -1) {
fos.write(oneChar);
count++;
}
// Close the streams
is.close();
fos.close();
System.out.println(count + " byte(s) copied");
}
}
| [
"thekyz@3d89156a-540f-e071-52c1-05105f659ac9"
] | thekyz@3d89156a-540f-e071-52c1-05105f659ac9 |
bd17c516a09e4b02b1e86773a9d6c1816136f013 | 29ea3a1ded09a11de2b9afacbad39796f665613e | /src/listener/src/com/helloweenvsfei/listener/ListenerTest.java | 2370c5a83c21fbae9b94b732991a269718e875e8 | [] | no_license | seuqer/webStudy | af51262edabaed4ee652c718d5b675b30c3236c6 | bb19f582b5ea18ddc0a239b2b451693e8a3dadc1 | refs/heads/master | 2021-07-21T11:55:03.940999 | 2017-10-29T12:53:10 | 2017-10-29T12:53:10 | 108,733,115 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,207 | java | package com.helloweenvsfei.listener;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class ListenerTest implements HttpSessionListener,
ServletContextListener, ServletRequestListener {
Log log = LogFactory.getLog(getClass());
// ๅๅปบ session
public void sessionCreated(HttpSessionEvent se) {
HttpSession session = se.getSession();
log.info("ๆฐๅๅปบไธไธชsession, IDไธบ: " + session.getId());
}
// ้ๆฏ session
public void sessionDestroyed(HttpSessionEvent se) {
HttpSession session = se.getSession();
log.info("้ๆฏไธไธชsession, IDไธบ: " + session.getId());
}
// ๅ ่ฝฝ context
public void contextInitialized(ServletContextEvent sce) {
ServletContext servletContext = sce.getServletContext();
log.info("ๅณๅฐๅฏๅจ" + servletContext.getContextPath());
}
// ๅธ่ฝฝ context
public void contextDestroyed(ServletContextEvent sce) {
ServletContext servletContext = sce.getServletContext();
log.info("ๅณๅฐๅ
ณ้ญ" + servletContext.getContextPath());
}
// ๅๅปบ request
public void requestInitialized(ServletRequestEvent sre) {
HttpServletRequest request = (HttpServletRequest) sre
.getServletRequest();
String uri = request.getRequestURI();
uri = request.getQueryString() == null ? uri : (uri + "?" + request
.getQueryString());
request.setAttribute("dateCreated", System.currentTimeMillis());
log.info("IP " + request.getRemoteAddr() + " ่ฏทๆฑ " + uri);
}
// ้ๆฏ request
public void requestDestroyed(ServletRequestEvent sre) {
HttpServletRequest request = (HttpServletRequest) sre
.getServletRequest();
long time = System.currentTimeMillis()
- (Long) request.getAttribute("dateCreated");
log.info(request.getRemoteAddr() + "่ฏทๆฑๅค็็ปๆ, ็จๆถ" + time + "ๆฏซ็ง. ");
}
}
| [
"[email protected]"
] | |
1cbeeaaee3befc7c9856ffcb9f681743aaee9d8d | c9639a0787130219fc12faa091c7b1c5507d7687 | /src/com/flipchase/android/cache/BitmapMemoryLruCache.java | d079878952c1d8bc201edcd63492ab4581eff2d4 | [] | no_license | mohdfarhanakram/Flipchase | 1b9b66efd8d289f4e3a3d2acda1d18471d93fdd5 | d81635b62fd2f46e17deecca19b6f15223e596e6 | refs/heads/master | 2021-01-15T11:13:42.121511 | 2014-10-11T22:49:40 | 2014-10-11T22:49:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,813 | java | /*******************************************************************************
* Copyright (c) 2013 Chris Banes.
*
* 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.flipchase.android.cache;
import java.lang.ref.SoftReference;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
import android.graphics.Bitmap;
import android.util.LruCache;
final class BitmapMemoryLruCache extends LruCache<String, CacheableBitmapDrawable> {
private final Set<SoftReference<CacheableBitmapDrawable>> mRemovedEntries;
private final BitmapLruCache.RecyclePolicy mRecyclePolicy;
BitmapMemoryLruCache(int maxSize, BitmapLruCache.RecyclePolicy policy) {
super(maxSize);
mRecyclePolicy = policy;
mRemovedEntries = policy.canInBitmap()
? Collections.synchronizedSet(new HashSet<SoftReference<CacheableBitmapDrawable>>())
: null;
}
CacheableBitmapDrawable put(CacheableBitmapDrawable value) {
if (null != value) {
value.setCached(true);
return put(value.getUrl(), value);
}
return null;
}
BitmapLruCache.RecyclePolicy getRecyclePolicy() {
return mRecyclePolicy;
}
@Override
protected int sizeOf(String key, CacheableBitmapDrawable value) {
return value.getMemorySize();
}
@Override
protected void entryRemoved(boolean evicted, String key, CacheableBitmapDrawable oldValue,
CacheableBitmapDrawable newValue) {
// Notify the wrapper that it's no longer being cached
oldValue.setCached(false);
if (mRemovedEntries != null && oldValue.isBitmapValid() && oldValue.isBitmapMutable()) {
synchronized (mRemovedEntries) {
mRemovedEntries.add(new SoftReference<CacheableBitmapDrawable>(oldValue));
}
}
}
Bitmap getBitmapFromRemoved(final int width, final int height) {
if (mRemovedEntries == null) {
return null;
}
Bitmap result = null;
synchronized (mRemovedEntries) {
final Iterator<SoftReference<CacheableBitmapDrawable>> it = mRemovedEntries.iterator();
while (it.hasNext()) {
CacheableBitmapDrawable value = it.next().get();
if (value != null && value.isBitmapValid() && value.isBitmapMutable()) {
if (value.getIntrinsicWidth() == width
&& value.getIntrinsicHeight() == height) {
it.remove();
result = value.getBitmap();
break;
}
} else {
it.remove();
}
}
}
return result;
}
void trimMemory() {
final Set<Entry<String, CacheableBitmapDrawable>> values = snapshot().entrySet();
for (Entry<String, CacheableBitmapDrawable> entry : values) {
CacheableBitmapDrawable value = entry.getValue();
if (null == value || !value.isBeingDisplayed()) {
remove(entry.getKey());
}
}
}
}
| [
"[email protected]"
] | |
4c70fed4654fe71bea66b84f333df7ff3ec1317a | d154e693676ef1971bde5d67b5f91671987c359a | /zhbj/src/main/java/com/wangshun/zhbj/base/impl/SettingPager.java | f62335c873309cd047fb7174ed45ac36f257d02b | [] | no_license | WS1009/ZHBJ | 667089f7cb5d03ca201f99265a88f395331d599a | f1defa4c01eb3673af963276174045bc965833a5 | refs/heads/master | 2021-05-02T13:23:35.656597 | 2018-02-08T13:23:38 | 2018-02-08T13:23:38 | 120,759,111 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package com.wangshun.zhbj.base.impl;
import android.app.Activity;
import android.graphics.Color;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import com.wangshun.zhbj.base.BasePager;
/**
* ่ฎพ็ฝฎ
* @author Kevin
*
*/
public class SettingPager extends BasePager {
public SettingPager(Activity activity) {
super(activity);
}
@Override
public void initData() {
Log.d(TAG, "่ฎพ็ฝฎๅ ่ฝฝๆฐๆฎไบ");
tvTitle.setText("่ฎพ็ฝฎ");
btnMenu.setVisibility(View.GONE);
TextView tvContent = new TextView(mActivity);
tvContent.setText("่ฎพ็ฝฎ");
tvContent.setTextColor(Color.RED);
tvContent.setTextSize(25);
tvContent.setGravity(Gravity.CENTER);
flContent.addView(tvContent);
}
}
| [
"[email protected]"
] | |
6d73e7034af28550015e1f42f12131effb447add | 036220d0bb780bcb077b5d8d111c1e0a928a13c0 | /02-handleInputs/gameEngine/src/main/Main.java | ce7f4d8ce2fede204d2e40358f9fef7a41d09310 | [] | no_license | ovvesley/lwjgl-learn | b6f96fdd9e3eb9662f9770ab0223c6d5c932b0b6 | bea0f6da6003d8435cbc52a7085a60f16b5e295c | refs/heads/master | 2022-07-01T06:32:21.114926 | 2020-05-12T23:44:04 | 2020-05-12T23:44:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,017 | java | package main;
import engine.io.Window;
import org.lwjgl.glfw.GLFW;
public class Main {
public static void main(String[] args) {
Window window = new Window(800, 600, "First Display");
window.create();
// MY GAME LOOP
while(!window.closed()){
window.update();
if(window.isKeyPressed(GLFW.GLFW_KEY_SPACE)){
System.out.println("space key pressed");
}
if(window.isKeyReleased(GLFW.GLFW_KEY_SPACE)){
System.out.println("space key released");
}
if(window.isMousePressed(GLFW.GLFW_MOUSE_BUTTON_LEFT)){
String msg = "mouse button left pressed. Xpos: %f; yPos: %f %n";
System.out.format(msg, window.getMouseX(), window.getMouseY());
}
if(window.isMouseReleased(GLFW.GLFW_MOUSE_BUTTON_LEFT)){
System.out.println("mouse button left released");
}
window.swapBuffers();
}
}
}
| [
"[email protected]"
] | |
fdc7d5826d063001400d9ee5446641594c12367e | 2acdd661211c2ddeb3a51d2ffce8af1d4a39ad26 | /b1ing-service/src/main/java/com/game/b1ingservice/payload/webuser/WebUserDepositList.java | 16896be5cddba1904597cc2867106babefe5bab9 | [] | no_license | chaosnook/b1-backend | 907c8a3d04278ef00770b7d151f65265cce5c78f | 7a84b702ae3842c0e37d930e3d49232584357fdc | refs/heads/main | 2023-07-24T17:46:53.033937 | 2021-04-30T08:18:44 | 2021-04-30T08:18:44 | 328,308,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 659 | java | package com.game.b1ingservice.payload.webuser;
import lombok.Data;
import java.time.Instant;
@Data
public class WebUserDepositList {
private Long id;
private String username;
private String password;
private String tel;
private String bankName;
private String accountNumber;
private String firstName;
private String lastName;
private String fullName;
private String line;
private String recommend;
private String isBonus;
private int version;
private Instant createdDate;
private Instant updatedDate;
private String createdBy;
private String updatedBy;
private Integer deleteFlag;
}
| [
"[email protected]"
] | |
52a85ccf8ece55601048409d1de251e17044d67f | 9e8187c35ef08c67186679f6d472603a8f7b2d6d | /lab4/mujavaHome/result/BackPack/traditional_mutants/int_BackPack_Solution(int,int,int,int)/SDL_9/BackPack.java | d3511d153d5a080b152af2072a502ba97d5d5328 | [] | no_license | cxdzb/software-testing-technology | 8b79f99ec859a896042cdf5bccdadfd11f65b64c | 5fb1305dd2dd028c035667c71e0abf57a489360b | refs/heads/master | 2021-01-09T15:24:42.561680 | 2020-04-16T06:18:58 | 2020-04-16T06:18:58 | 242,354,593 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 847 | java | // This is a mutant program.
// Author : ysma
public class BackPack
{
public int[][] BackPack_Solution( int m, int n, int[] w, int[] p )
{
int[][] c = new int[n + 1][m + 1];
for (int i = 0; i < n + 1; i++) {
c[i][0] = 0;
}
for (int j = 0; j < m + 1;) {
c[0][j] = 0;
}
for (int i = 1; i < n + 1; i++) {
for (int j = 1; j < m + 1; j++) {
if (w[i - 1] <= j) {
if (c[i - 1][j] < c[i - 1][j - w[i - 1]] + p[i - 1]) {
c[i][j] = c[i - 1][j - w[i - 1]] + p[i - 1];
} else {
c[i][j] = c[i - 1][j];
}
} else {
c[i][j] = c[i - 1][j];
}
}
}
return c;
}
}
| [
"[email protected]"
] | |
c6376fb5d437b4183fd19f5ac42ece0374b04024 | 302af4aa0bf08a66dde5fa95bc6e8992e4505c7d | /com.gumtree.android.beta/java/novoda/lib/sqliteprovider/cursor/EmptyCursor.java | 7b29d7b90d97d29da5e784145fe74cccb4367203 | [] | no_license | hakat0m/Chessboxing | 0f5ce696a55a5b40f1d8fa226bbdc5673ef5dbc5 | 0a576dec5aaafa219c340a013726037d852b91a2 | refs/heads/master | 2021-01-19T08:51:23.932830 | 2017-04-09T06:48:44 | 2017-04-09T06:48:44 | 87,688,753 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | package novoda.lib.sqliteprovider.cursor;
import android.database.AbstractCursor;
public class EmptyCursor extends AbstractCursor {
public String[] getColumnNames() {
return new String[]{"_id"};
}
public int getCount() {
return 0;
}
public double getDouble(int i) {
return 0.0d;
}
public float getFloat(int i) {
return 0.0f;
}
public int getInt(int i) {
return 0;
}
public long getLong(int i) {
return 0;
}
public short getShort(int i) {
return (short) 0;
}
public String getString(int i) {
return null;
}
public boolean isNull(int i) {
return true;
}
}
| [
"[email protected]"
] | |
09e285425149f96007a58a7fd34f9706a6fc5d93 | dada3e0360eef047912ee1d770da4c8d41bce003 | /src/main/java/com/example/restaurantapplication/security/WebConfig.java | bc80fa79ef207cba5b25c2e8b32ef61da11a30e3 | [] | no_license | andriigorshunov/restaurant | 01c3259916d5136ecfdc75619cbf7baf2885c8df | 1a87c641e39d6a30c260e75865e5b4931e7984f9 | refs/heads/master | 2022-09-16T06:17:50.167728 | 2019-12-09T20:58:56 | 2019-12-09T20:58:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 630 | java | package com.example.restaurantapplication.security;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class WebConfig implements WebMvcConfigurer {
// @Override
// public void addViewControllers(ViewControllerRegistry registry) {
//// registry.addViewController("/").setViewName("");
// registry.addViewController("/orders_list").setViewName("orders_list");
// registry.addViewController("/login");
// }
} | [
"[email protected]"
] | |
c74987e857ed8e3220a51dca11b234874f940d42 | 00fd618257b40c86e9e62fda1a68fc9a4b4efdd7 | /JavaWeb ็ณปๅ/weixin/src/main/java/com/petrochina/weixin/Dao/testDao.java | b2ec4127a06b7375a751085ad4a41200a139d471 | [] | no_license | fly-bear/mygit | 5aa95398d24e270ed2872846ab8c887ee8a5ea30 | c8aa901f8fbe3efbd094db2cab22d630d6bb47ce | refs/heads/master | 2023-03-29T08:48:24.454980 | 2022-12-09T03:36:03 | 2022-12-09T03:36:03 | 107,864,668 | 35 | 8 | null | 2023-03-23T20:38:27 | 2017-10-22T12:40:29 | HTML | UTF-8 | Java | false | false | 241 | java | package com.petrochina.weixin.Dao;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.Map;
@Mapper
public interface testDao {
@Select("select * from test1")
Map getdata();
}
| [
"[email protected]"
] | |
3c81430b671d2667d3e8905011df292e614bdfa0 | 361a29244b9e78b1d319e614afbcbdfe3c9f3a6c | /src/main/java/com/dhc/fastersoft/entity/system/SysOAInfo.java | 2159ed47cea88853e07550c0700342c01dac47cc | [] | no_license | nangongpushe/zclproc | 452013afba9ad17791864a35b7c072c028a4d50b | 1da3392598238185ffba12c6721daa9356476755 | refs/heads/master | 2022-12-22T21:05:33.216867 | 2019-11-22T16:14:04 | 2019-11-22T16:14:04 | 223,437,339 | 0 | 0 | null | 2022-12-16T05:01:46 | 2019-11-22T15:56:53 | Java | UTF-8 | Java | false | false | 970 | java | package com.dhc.fastersoft.entity.system;
import java.util.Date;
public class SysOAInfo {
private String name;
private String position;
private String operation;
private String advice;
private String time;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPosition() {
return position;
}
public void setPosition(String position) {
this.position = position;
}
public String getOperation() {
return operation;
}
public void setOperation(String operation) {
this.operation = operation;
}
public String getAdvice() {
return advice;
}
public void setAdvice(String advice) {
this.advice = advice;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return this.name+","+this.position+","+this.operation+","+this.advice+","+this.time;
}
} | [
"[email protected]"
] | |
e403bbe2a8cec9920c73d24f95cf489c4e4aae67 | 8b7e75ba8c4b8e2f6e82d40e2eb6432ddfa36ac0 | /myVelib/core/user/PaymentStd.java | 72a0e057f113878b9c6d82d3ab96614524023943 | [] | no_license | diogobodas/myVelib | a7d833ab5d5501f88130cfb3839bdfdb3c75ea98 | 8bb76480277b33901e83ec4ab133351cc771f074 | refs/heads/master | 2022-09-18T09:13:40.724296 | 2020-06-05T17:31:47 | 2020-06-05T17:31:47 | 261,799,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,318 | java | package user;
import java.time.Duration;
import java.time.LocalDateTime;
/**
* Extension of abstract class {@link user.Payment} that represents standard payment regime.
* That means the hourly cost provided (1.0 for the regular bike, 2.0 for the electric bike) is divided by 60 and multiplied by the rental duration in minutes.
*/
public class PaymentStd extends Payment{
private double hour_cost;
/**
* Initializes a standard payment regime
* @param start Start LocalDateTime of rental
* @param cost Hourly cost for the bike. One for regular bikes, two for electric, easily extendible for new bikes that are more expensive per hour
*/
public PaymentStd(LocalDateTime start, double cost) {
super(start);
this.hour_cost = cost;
}
/**
* Gets the price of rental. See the abstract class documentation for further info.
*/
@Override
public double getValue(LocalDateTime end_time) {
// this method will calculate the price in minutes of used bike
// ex: 10h to 14h30 -> 270 min -> cost = 270 * (hour_cost/60)
long num_minutes = Duration.between(this.getStartTime(), end_time).toMinutes();
return (hour_cost/60.0) * (double) num_minutes;
}
public double getHourCost() {
return hour_cost;
}
public void setHourCost(double hour_cost) {
this.hour_cost = hour_cost;
}
}
| [
"[email protected]"
] | |
2cb7cc78a92c7f8886974076cb9241a370f3768d | a35fa143778e8c3835cdbe1f7e2600584296294f | /src/main/java/io/iansoft/blockchain/service/AuditEventService.java | 105f5c21535d06fc902a9f863f4c513bd8109179 | [
"MIT"
] | permissive | casebell/all-blockchain | f4fd33d7d5506e3c6be80ec6f159cf2a5d0b784f | 4f6154d1ce80ae5d2f30697b87d9ac310cdf4597 | refs/heads/master | 2021-04-26T23:01:39.121291 | 2018-02-06T05:04:18 | 2018-02-06T05:04:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,791 | java | package io.iansoft.blockchain.service;
import io.iansoft.blockchain.config.audit.AuditEventConverter;
import io.iansoft.blockchain.repository.PersistenceAuditEventRepository;
import org.springframework.boot.actuate.audit.AuditEvent;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.Instant;
import java.util.Optional;
/**
* Service for managing audit events.
* <p>
* This is the default implementation to support SpringBoot Actuator AuditEventRepository
*/
@Service
@Transactional
public class AuditEventService {
private final PersistenceAuditEventRepository persistenceAuditEventRepository;
private final AuditEventConverter auditEventConverter;
public AuditEventService(
PersistenceAuditEventRepository persistenceAuditEventRepository,
AuditEventConverter auditEventConverter) {
this.persistenceAuditEventRepository = persistenceAuditEventRepository;
this.auditEventConverter = auditEventConverter;
}
public Page<AuditEvent> findAll(Pageable pageable) {
return persistenceAuditEventRepository.findAll(pageable)
.map(auditEventConverter::convertToAuditEvent);
}
public Page<AuditEvent> findByDates(Instant fromDate, Instant toDate, Pageable pageable) {
return persistenceAuditEventRepository.findAllByAuditEventDateBetween(fromDate, toDate, pageable)
.map(auditEventConverter::convertToAuditEvent);
}
public Optional<AuditEvent> find(Long id) {
return Optional.ofNullable(persistenceAuditEventRepository.findOne(id)).map
(auditEventConverter::convertToAuditEvent);
}
}
| [
"[email protected]"
] | |
15f6dffa5a4ee9c879a069d855a4b210162e6781 | 76554a5cc7a3e26df4ae8eb3a48e8e71624b6561 | /src/test/java/SeleniumTest.java | ab79422feb3a0ea02bfd88b1c9226b287b8ec2af | [] | no_license | dariussirvidas/Selenium | 50431fe89902a03082b7c0bea9c88512b140db50 | d221fdffc8ce5585e67f53410cc07fb5dd65fdab | refs/heads/master | 2020-12-04T15:37:00.732611 | 2020-01-05T22:38:34 | 2020-01-05T22:38:34 | 231,819,706 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 953 | java | import org.junit.*;
import org.junit.runners.MethodSorters;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class SeleniumTest {
@Before
public void testSetup() {
Selenium.setup();
}
@Test
public void testLoginToSherdog1() {
Selenium.loginToSherdog("[email protected]", "individual11");
Assert.assertEquals("https://forums.sherdog.com/", Selenium.browser.getCurrentUrl());
WebElement visitorTabs = Selenium.browser.findElement(By.cssSelector("ul.visitorTabs"));
Assert.assertTrue(visitorTabs.isDisplayed());
}
@Test
public void testLoginToSherdog2() {
Selenium.loginToSherdog("civerxgmail.com", "individual11");
Assert.assertEquals("https://forums.sherdog.com/login/login", Selenium.browser.getCurrentUrl());
}
@After
public void testClose() {
Selenium.close();
}
}
| [
"[email protected]"
] | |
e27fb2964d05e69a1a6282c49741ae111e4bb738 | 187015a3619f29d54c880b0c11b2fc1e6a968335 | /symptom2/src/test2.java | a3b85ebb87d3830a8ca0c3dcd2fa9ee1d7981d72 | [] | no_license | parmeshashwath/Cisco-intern-project | 717cd8808e9e89ddd25ff9ef88c957950abb5d6e | 51eb0bb2e425109c17c6bd6cb9ca2babe1e81237 | refs/heads/master | 2020-05-18T04:47:56.867261 | 2015-06-30T04:08:08 | 2015-06-30T04:08:08 | 38,286,931 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,135 | java | import java.sql.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import java.io.*;
class outkey{
String outcome;
int grp;
@Override
public boolean equals(Object obj) {
if (obj instanceof outkey) {
return outcome.equals(((outkey)obj).outcome) && grp==((outkey)obj).grp;
}
return false;
}
@Override
public int hashCode() {
return Integer.valueOf(grp).hashCode()+(outcome).hashCode();
}
}
public class test2{
static String tempstr=" ";
static int pp=0;
static List<String> wordList = new ArrayList();
static void fun(Connection c,BufferedReader br,HashSet days, HashSet months,HashSet dic)
{
int n=0;
pp++;
String sCurrentLine=" ",temp=" ";
// System.out.println(contentInBytes);
String temp1=" ";
try
{
int sym=0;
int flag=0;
while ((sCurrentLine = br.readLine()) != null && flag==0) {
//wordList.clear();
//System.out.println(sCurrentLine);
StringTokenizer tokn = new StringTokenizer(sCurrentLine, " ");
if(tokn.countTokens()>2 && days.contains(tokn.nextToken()) && months.contains(tokn.nextToken()))
{
tempstr=sCurrentLine;
//System.out.println(tempstr);
// continue;
br.mark(1000);
while ((sCurrentLine = br.readLine()) != null) {
StringTokenizer tokn1 = new StringTokenizer(sCurrentLine, " ");
if(tokn1.countTokens()>2 && days.contains(tokn1.nextToken()) && months.contains(tokn1.nextToken()))
{
//System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
br.reset();
flag=1;
break;
}
StringTokenizer tokn2 = new StringTokenizer(sCurrentLine, " ");
while (tokn2.hasMoreTokens()) {
temp=tokn2.nextToken();
//System.out.println(temp);
if(dic.contains(temp)&& !wordList.contains(temp))
wordList.add(temp);
}
br.mark(1000);
}
}
//
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String ar[])
{
String query1 = "SELECT * FROM OUT_SYM WHERE SYM=";
String query2 = "SELECT * FROM OUT_SYM WHERE OUT=";
List<String> wordListA = new ArrayList();
List<String> wordListB= new ArrayList();
List<String> wordListC = new ArrayList();
int ch;
int id;
Connection c = null;
HashSet days = new HashSet();
HashSet months=new HashSet();
HashMap<outkey,outdet> symhash=new HashMap<outkey,outdet>();
String temp=" ";
int n=0;
int A=0x0000;
int B=0x0000;
int C=0x0000;
/* pt.put(t1, ob1);
pt.put(t2, ob2);
pt.put(t3, obk);*/
HashSet dic=new HashSet();
int tempint;
int cnt=0;
String str2=" ";
String str3=" ";
String str4=" ";
// add elements to the hash set
dic.add("s1");
dic.add("s2");
dic.add("s3");
dic.add("s4");
dic.add("s5");
outdet obv1=new outdet();
outdet obv2=new outdet();
outdet obv3=new outdet();
outdet obv4=new outdet();
outdet obv5=new outdet();
outdet obv6=new outdet();
outdet obv7=new outdet();
outdet obv8=new outdet();
outdet testv=new outdet();
outkey obk1=new outkey();
outkey obk2=new outkey();
outkey obk3=new outkey();
outkey obk4=new outkey();
outkey obk5=new outkey();
outkey obk6=new outkey();
outkey obk7=new outkey();
outkey obk8=new outkey();
outkey testk=new outkey();
days.add("Sun");
days.add("Mon");
days.add("Tue");
days.add("Wed");
days.add("Thu");
days.add("Fri");
months.add("Jan");
months.add("Feb");
months.add("Mar");
months.add("Apr");
months.add("May");
months.add("Jun");
months.add("Jul");
months.add("Aug");
months.add("Sep");
months.add("Oct");
months.add("Nov");
months.add("Dec");
BufferedReader br1 = null;
BufferedReader br2 = null;
BufferedReader br3 = null;
String sCurrentLine;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
c = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","system","azadAZAD1");
}
catch(ClassNotFoundException error) {
System.err.println("Unable to load the JDBC/ODBC bridge" + error.getMessage( ));
System.exit(1);
}
catch(SQLException error) {
System.err.println("Unable to connect to database---" + error.getMessage( ));
System.exit(2);
}
catch(Exception e) { }
try
{
br1 = new BufferedReader(new FileReader("C:/log1.txt"));
br2 = new BufferedReader(new FileReader("C:/log2.txt"));
br3 = new BufferedReader(new FileReader("C:/log3.txt"));
br1.mark(1000);
br2.mark(1000);
br3.mark(1000);
while(br1.readLine()!=null || br2.readLine()!=null || br3.readLine()!=null )
{
br1.reset();
br2.reset();
br3.reset();
obv1.cnt=0;
obv1.symptoms=" ";
obv2.cnt=0;
obv2.symptoms=" ";
obv3.cnt=0;
obv3.symptoms=" ";
obv4.cnt=0;
obv4.symptoms=" ";
obv5.cnt=0;
obv5.symptoms=" ";
obv6.cnt=0;
obv6.symptoms=" ";
obv7.cnt=0;
obv7.symptoms=" ";
obv8.cnt=0;
obv8.symptoms=" ";
obk1.grp=1;
obk1.outcome="o1";
obk2.grp=2;
obk2.outcome="o1";
obk3.grp=1;
obk3.outcome="o2";
obk4.grp=1;
obk4.outcome="o3";
obk5.grp=1;
obk5.outcome="o4";
obk6.grp=1;
obk6.outcome="o5";
obk7.grp=1;
obk7.outcome="o6";
obk8.grp=1;
obk8.outcome="o7";
symhash.put(obk1,obv1);
symhash.put(obk2,obv2);
symhash.put(obk3,obv3);
symhash.put(obk4,obv4);
symhash.put(obk5,obv5);
symhash.put(obk6,obv6);
symhash.put(obk7,obv7);
symhash.put(obk8,obv8);
wordList.clear();
fun(c,br1,days,months,dic);
fun(c,br2,days,months,dic);
fun(c,br3,days,months,dic);
testk.grp=1;
testk.outcome="o1";
testv=symhash.get(testk);
ListIterator<String> itr=wordList.listIterator();
while(itr.hasNext())
{
outdet obnv=null;
outkey obnk=new outkey();
temp=itr.next();
//System.out.println("jj"+temp);
try
{
Statement st = c.createStatement();
ResultSet r = st.executeQuery(query1+ "'"+temp+"'");
while(r.next())
{
str2=r.getString(1);
id=r.getInt(3);
obnk.grp=id;
obnk.outcome=str2;
obnv=symhash.get(obnk);
//System.out.println("##############################");
//System.out.println(obnv.symptoms+obnv.cnt);
obnv.cnt++;
obnv.symptoms=obnv.symptoms+temp;
symhash.put(obnk, obnv);
// System.out.println("aaaaaaaaa"+sym);
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
try
{
Set set = symhash.entrySet();
Iterator i = set.iterator();
// Display elements
while(i.hasNext()) {
int v=0;
Map.Entry me = (Map.Entry)i.next();
outdet u=(outdet)me.getValue();
outkey y=(outkey)me.getKey();
Statement st = c.createStatement();
//System.out.println("SELECT * FROM OUT_SYM WHERE OUT="+ "'"+y.outcome+"'"+ "AND"+"ID= "+y.grp);
ResultSet r = st.executeQuery("SELECT * FROM OUT_SYM WHERE OUT="+ "'"+y.outcome+"'"+ " AND "+"ID= "+y.grp);
while(r.next())
{
v++;
// System.out.println("aaaaaaaaa"+sym);
}
if(v!=0)
{
System.out.println("************************************"+tempstr);
System.out.println("Symptoms"+u.symptoms);
System.out.println("error::"+y.outcome);
System.out.println((float)u.cnt/v);
//System.out.println(u.cnt);
}
}
// System.out.println(pp);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
catch (IOException e) {
e.printStackTrace();
} finally {
try {
br1.close();
br2.close();
br3.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
}
| [
"[email protected]"
] | |
b729bcd571761debf840f3a524e875bb6fcde58d | d9456254ace524157a48bea17f1193b037197d74 | /src/main/java/models/interfaces/SkiPassConfiguration.java | 5c7ca660279770b0200d4ffaad9107a58e408f32 | [] | no_license | asterium/SkiPass | 55136fc56307c40590751341557eed3a6a45ed33 | 94740b83bebd6f97396df14a37816dffd529ee10 | refs/heads/master | 2020-07-07T05:57:20.449583 | 2016-09-07T03:59:51 | 2016-09-07T03:59:51 | 67,445,226 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 196 | java | package models.interfaces;
import models.skipasses.SkiPassType;
/**
* Created by Asterium on 07.09.2016.
*/
public interface SkiPassConfiguration {
public SkiPassType getValidityType();
}
| [
"[email protected]"
] | |
397dff93a8758950f89e8d640b0304b19ecddd19 | a1e49f5edd122b211bace752b5fb1bd5c970696b | /projects/org.springframework.beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java | 3a769c85d279fcf2f9f600b818f66c75a05a0d69 | [
"Apache-2.0"
] | permissive | savster97/springframework-3.0.5 | 4f86467e2456e5e0652de9f846f0eaefc3214cfa | 34cffc70e25233ed97e2ddd24265ea20f5f88957 | refs/heads/master | 2020-04-26T08:48:34.978350 | 2019-01-22T14:45:38 | 2019-01-22T14:45:38 | 173,434,995 | 0 | 0 | Apache-2.0 | 2019-03-02T10:37:13 | 2019-03-02T10:37:12 | null | UTF-8 | Java | false | false | 34,702 | java | /*
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.springframework.beans.factory.support;
import java.beans.ConstructorProperties;
import java.lang.reflect.Constructor;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.springframework.beans.BeanMetadataElement;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.BeansException;
import org.springframework.beans.TypeConverter;
import org.springframework.beans.TypeMismatchException;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.UnsatisfiedDependencyException;
import org.springframework.beans.factory.config.ConstructorArgumentValues;
import org.springframework.beans.factory.config.ConstructorArgumentValues.ValueHolder;
import org.springframework.beans.factory.config.DependencyDescriptor;
import org.springframework.core.GenericTypeResolver;
import org.springframework.core.MethodParameter;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.util.ClassUtils;
import org.springframework.util.MethodInvoker;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;
/**
* Helper class for resolving constructors and factory methods.
* Performs constructor resolution through argument matching.
*
* <p>Operates on an {@link AbstractBeanFactory} and an {@link InstantiationStrategy}.
* Used by {@link AbstractAutowireCapableBeanFactory}.
*
* @author Juergen Hoeller
* @author Rob Harrop
* @author Mark Fisher
* @author Costin Leau
* @since 2.0
* @see #autowireConstructor
* @see #instantiateUsingFactoryMethod
* @see AbstractAutowireCapableBeanFactory
*/
class ConstructorResolver {
private static final String CONSTRUCTOR_PROPERTIES_CLASS_NAME = "java.beans.ConstructorProperties";
private static final boolean constructorPropertiesAnnotationAvailable =
ClassUtils.isPresent(CONSTRUCTOR_PROPERTIES_CLASS_NAME, ConstructorResolver.class.getClassLoader());
private final AbstractAutowireCapableBeanFactory beanFactory;
/**
* Create a new ConstructorResolver for the given factory and instantiation strategy.
* @param beanFactory the BeanFactory to work with
*/
public ConstructorResolver(AbstractAutowireCapableBeanFactory beanFactory) {
this.beanFactory = beanFactory;
}
/**
* "autowire constructor" (with constructor arguments by type) behavior.
* Also applied if explicit constructor argument values are specified,
* matching all remaining arguments with beans from the bean factory.
* <p>This corresponds to constructor injection: In this mode, a Spring
* bean factory is able to host components that expect constructor-based
* dependency resolution.
* @param beanName the name of the bean
* @param mbd the merged bean definition for the bean
* @param chosenCtors chosen candidate constructors (or <code>null</code> if none)
* @param explicitArgs argument values passed in programmatically via the getBean method,
* or <code>null</code> if none (-> use constructor argument values from bean definition)
* @return a BeanWrapper for the new instance
*/
public BeanWrapper autowireConstructor(
final String beanName, final RootBeanDefinition mbd, Constructor[] chosenCtors, final Object[] explicitArgs) {
BeanWrapperImpl bw = new BeanWrapperImpl();
this.beanFactory.initBeanWrapper(bw);
Constructor constructorToUse = null;
ArgumentsHolder argsHolderToUse = null;
Object[] argsToUse = null;
if (explicitArgs != null) {
argsToUse = explicitArgs;
}
else {
Object[] argsToResolve = null;
synchronized (mbd.constructorArgumentLock) {
constructorToUse = (Constructor) mbd.resolvedConstructorOrFactoryMethod;
if (constructorToUse != null && mbd.constructorArgumentsResolved) {
// Found a cached constructor...
argsToUse = mbd.resolvedConstructorArguments;
if (argsToUse == null) {
argsToResolve = mbd.preparedConstructorArguments;
}
}
}
if (argsToResolve != null) {
argsToUse = resolvePreparedArguments(beanName, mbd, bw, constructorToUse, argsToResolve);
}
}
if (constructorToUse == null) {
// Need to resolve the constructor.
boolean autowiring = (chosenCtors != null ||
mbd.getResolvedAutowireMode() == RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
ConstructorArgumentValues resolvedValues = null;
int minNrOfArgs;
if (explicitArgs != null) {
minNrOfArgs = explicitArgs.length;
}
else {
ConstructorArgumentValues cargs = mbd.getConstructorArgumentValues();
resolvedValues = new ConstructorArgumentValues();
minNrOfArgs = resolveConstructorArguments(beanName, mbd, bw, cargs, resolvedValues);
}
// Take specified constructors, if any.
Constructor[] candidates = chosenCtors;
if (candidates == null) {
Class beanClass = mbd.getBeanClass();
try {
candidates = (mbd.isNonPublicAccessAllowed() ?
beanClass.getDeclaredConstructors() : beanClass.getConstructors());
}
catch (Throwable ex) {
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
"Resolution of declared constructors on bean Class [" + beanClass.getName() +
"] from ClassLoader [" + beanClass.getClassLoader() + "] failed", ex);
}
}
AutowireUtils.sortConstructors(candidates);
int minTypeDiffWeight = Integer.MAX_VALUE;
Set<Constructor> ambiguousConstructors = null;
List<Exception> causes = null;
for (int i = 0; i < candidates.length; i++) {
Constructor<?> candidate = candidates[i];
Class[] paramTypes = candidate.getParameterTypes();
if (constructorToUse != null && argsToUse.length > paramTypes.length) {
// Already found greedy constructor that can be satisfied ->
// do not look any further, there are only less greedy constructors left.
break;
}
if (paramTypes.length < minNrOfArgs) {
continue;
}
ArgumentsHolder argsHolder;
if (resolvedValues != null) {
try {
String[] paramNames = null;
if (constructorPropertiesAnnotationAvailable) {
paramNames = ConstructorPropertiesChecker.evaluateAnnotation(candidate, paramTypes.length);
}
if (paramNames == null) {
ParameterNameDiscoverer pnd = this.beanFactory.getParameterNameDiscoverer();
if (pnd != null) {
paramNames = pnd.getParameterNames(candidate);
}
}
argsHolder = createArgumentArray(
beanName, mbd, resolvedValues, bw, paramTypes, paramNames, candidate, autowiring);
}
catch (UnsatisfiedDependencyException ex) {
if (this.beanFactory.logger.isTraceEnabled()) {
this.beanFactory.logger.trace(
"Ignoring constructor [" + candidate + "] of bean '" + beanName + "': " + ex);
}
if (i == candidates.length - 1 && constructorToUse == null) {
if (causes != null) {
for (Exception cause : causes) {
this.beanFactory.onSuppressedException(cause);
}
}
throw ex;
}
else {
// Swallow and try next constructor.
if (causes == null) {
causes = new LinkedList<Exception>();
}
causes.add(ex);
continue;
}
}
}
else {
// Explicit arguments given -> arguments length must match exactly.
if (paramTypes.length != explicitArgs.length) {
continue;
}
argsHolder = new ArgumentsHolder(explicitArgs);
}
int typeDiffWeight = (mbd.isLenientConstructorResolution() ?
argsHolder.getTypeDifferenceWeight(paramTypes) : argsHolder.getAssignabilityWeight(paramTypes));
// Choose this constructor if it represents the closest match.
if (typeDiffWeight < minTypeDiffWeight) {
constructorToUse = candidate;
argsHolderToUse = argsHolder;
argsToUse = argsHolder.arguments;
minTypeDiffWeight = typeDiffWeight;
ambiguousConstructors = null;
}
else if (constructorToUse != null && typeDiffWeight == minTypeDiffWeight) {
if (ambiguousConstructors == null) {
ambiguousConstructors = new LinkedHashSet<Constructor>();
ambiguousConstructors.add(constructorToUse);
}
ambiguousConstructors.add(candidate);
}
}
if (constructorToUse == null) {
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
"Could not resolve matching constructor " +
"(hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)");
}
else if (ambiguousConstructors != null && !mbd.isLenientConstructorResolution()) {
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
"Ambiguous constructor matches found in bean '" + beanName + "' " +
"(hint: specify index/type/name arguments for simple parameters to avoid type ambiguities): " +
ambiguousConstructors);
}
if (explicitArgs == null) {
argsHolderToUse.storeCache(mbd, constructorToUse);
}
}
try {
Object beanInstance;
if (System.getSecurityManager() != null) {
final Constructor ctorToUse = constructorToUse;
final Object[] argumentsToUse = argsToUse;
beanInstance = AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
return beanFactory.getInstantiationStrategy().instantiate(
mbd, beanName, beanFactory, ctorToUse, argumentsToUse);
}
}, beanFactory.getAccessControlContext());
}
else {
beanInstance = this.beanFactory.getInstantiationStrategy().instantiate(
mbd, beanName, this.beanFactory, constructorToUse, argsToUse);
}
bw.setWrappedInstance(beanInstance);
return bw;
}
catch (Throwable ex) {
throw new BeanCreationException(mbd.getResourceDescription(), beanName, "Instantiation of bean failed", ex);
}
}
/**
* Resolve the factory method in the specified bean definition, if possible.
* {@link RootBeanDefinition#getResolvedFactoryMethod()} can be checked for the result.
* @param mbd the bean definition to check
*/
public void resolveFactoryMethodIfPossible(RootBeanDefinition mbd) {
Class factoryClass;
if (mbd.getFactoryBeanName() != null) {
factoryClass = this.beanFactory.getType(mbd.getFactoryBeanName());
}
else {
factoryClass = mbd.getBeanClass();
}
factoryClass = ClassUtils.getUserClass(factoryClass);
Method[] candidates = ReflectionUtils.getAllDeclaredMethods(factoryClass);
Method uniqueCandidate = null;
for (Method candidate : candidates) {
if (mbd.isFactoryMethod(candidate)) {
if (uniqueCandidate == null) {
uniqueCandidate = candidate;
}
else if (!Arrays.equals(uniqueCandidate.getParameterTypes(), candidate.getParameterTypes())) {
uniqueCandidate = null;
break;
}
}
}
synchronized (mbd.constructorArgumentLock) {
mbd.resolvedConstructorOrFactoryMethod = uniqueCandidate;
}
}
/**
* Instantiate the bean using a named factory method. The method may be static, if the
* bean definition parameter specifies a class, rather than a "factory-bean", or
* an instance variable on a factory object itself configured using Dependency Injection.
* <p>Implementation requires iterating over the static or instance methods with the
* name specified in the RootBeanDefinition (the method may be overloaded) and trying
* to match with the parameters. We don't have the types attached to constructor args,
* so trial and error is the only way to go here. The explicitArgs array may contain
* argument values passed in programmatically via the corresponding getBean method.
* @param beanName the name of the bean
* @param mbd the merged bean definition for the bean
* @param explicitArgs argument values passed in programmatically via the getBean
* method, or <code>null</code> if none (-> use constructor argument values from bean definition)
* @return a BeanWrapper for the new instance
*/
public BeanWrapper instantiateUsingFactoryMethod(final String beanName, final RootBeanDefinition mbd, final Object[] explicitArgs) {
BeanWrapperImpl bw = new BeanWrapperImpl();
this.beanFactory.initBeanWrapper(bw);
Object factoryBean;
Class factoryClass;
boolean isStatic;
String factoryBeanName = mbd.getFactoryBeanName();
if (factoryBeanName != null) {
if (factoryBeanName.equals(beanName)) {
throw new BeanDefinitionStoreException(mbd.getResourceDescription(), beanName,
"factory-bean reference points back to the same bean definition");
}
factoryBean = this.beanFactory.getBean(factoryBeanName);
if (factoryBean == null) {
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
"factory-bean '" + factoryBeanName + "' returned null");
}
factoryClass = factoryBean.getClass();
isStatic = false;
}
else {
// It's a static factory method on the bean class.
if (!mbd.hasBeanClass()) {
throw new BeanDefinitionStoreException(mbd.getResourceDescription(), beanName,
"bean definition declares neither a bean class nor a factory-bean reference");
}
factoryBean = null;
factoryClass = mbd.getBeanClass();
isStatic = true;
}
Method factoryMethodToUse = null;
ArgumentsHolder argsHolderToUse = null;
Object[] argsToUse = null;
if (explicitArgs != null) {
argsToUse = explicitArgs;
}
else {
Object[] argsToResolve = null;
synchronized (mbd.constructorArgumentLock) {
factoryMethodToUse = (Method) mbd.resolvedConstructorOrFactoryMethod;
if (factoryMethodToUse != null && mbd.constructorArgumentsResolved) {
// Found a cached factory method...
argsToUse = mbd.resolvedConstructorArguments;
if (argsToUse == null) {
argsToResolve = mbd.preparedConstructorArguments;
}
}
}
if (argsToResolve != null) {
argsToUse = resolvePreparedArguments(beanName, mbd, bw, factoryMethodToUse, argsToResolve);
}
}
if (factoryMethodToUse == null || argsToUse == null) {
// Need to determine the factory method...
// Try all methods with this name to see if they match the given arguments.
factoryClass = ClassUtils.getUserClass(factoryClass);
Method[] rawCandidates;
final Class factoryClazz = factoryClass;
if (System.getSecurityManager() != null) {
rawCandidates = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
public Method[] run() {
return (mbd.isNonPublicAccessAllowed() ?
ReflectionUtils.getAllDeclaredMethods(factoryClazz) : factoryClazz.getMethods());
}
});
}
else {
rawCandidates = (mbd.isNonPublicAccessAllowed() ?
ReflectionUtils.getAllDeclaredMethods(factoryClazz) : factoryClazz.getMethods());
}
List<Method> candidateSet = new ArrayList<Method>();
for (Method candidate : rawCandidates) {
if (Modifier.isStatic(candidate.getModifiers()) == isStatic &&
candidate.getName().equals(mbd.getFactoryMethodName()) &&
mbd.isFactoryMethod(candidate)) {
candidateSet.add(candidate);
}
}
Method[] candidates = candidateSet.toArray(new Method[candidateSet.size()]);
AutowireUtils.sortFactoryMethods(candidates);
ConstructorArgumentValues resolvedValues = null;
boolean autowiring = (mbd.getResolvedAutowireMode() == RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
int minTypeDiffWeight = Integer.MAX_VALUE;
Set<Method> ambiguousFactoryMethods = null;
int minNrOfArgs;
if (explicitArgs != null) {
minNrOfArgs = explicitArgs.length;
}
else {
// We don't have arguments passed in programmatically, so we need to resolve the
// arguments specified in the constructor arguments held in the bean definition.
ConstructorArgumentValues cargs = mbd.getConstructorArgumentValues();
resolvedValues = new ConstructorArgumentValues();
minNrOfArgs = resolveConstructorArguments(beanName, mbd, bw, cargs, resolvedValues);
}
List<Exception> causes = null;
for (int i = 0; i < candidates.length; i++) {
Method candidate = candidates[i];
Class[] paramTypes = candidate.getParameterTypes();
if (paramTypes.length >= minNrOfArgs) {
ArgumentsHolder argsHolder;
if (resolvedValues != null) {
// Resolved constructor arguments: type conversion and/or autowiring necessary.
try {
String[] paramNames = null;
ParameterNameDiscoverer pnd = this.beanFactory.getParameterNameDiscoverer();
if (pnd != null) {
paramNames = pnd.getParameterNames(candidate);
}
argsHolder = createArgumentArray(
beanName, mbd, resolvedValues, bw, paramTypes, paramNames, candidate, autowiring);
}
catch (UnsatisfiedDependencyException ex) {
if (this.beanFactory.logger.isTraceEnabled()) {
this.beanFactory.logger.trace("Ignoring factory method [" + candidate +
"] of bean '" + beanName + "': " + ex);
}
if (i == candidates.length - 1 && argsHolderToUse == null) {
if (causes != null) {
for (Exception cause : causes) {
this.beanFactory.onSuppressedException(cause);
}
}
throw ex;
}
else {
// Swallow and try next overloaded factory method.
if (causes == null) {
causes = new LinkedList<Exception>();
}
causes.add(ex);
continue;
}
}
}
else {
// Explicit arguments given -> arguments length must match exactly.
if (paramTypes.length != explicitArgs.length) {
continue;
}
argsHolder = new ArgumentsHolder(explicitArgs);
}
int typeDiffWeight = (mbd.isLenientConstructorResolution() ?
argsHolder.getTypeDifferenceWeight(paramTypes) : argsHolder.getAssignabilityWeight(paramTypes));
// Choose this factory method if it represents the closest match.
if (typeDiffWeight < minTypeDiffWeight) {
factoryMethodToUse = candidate;
argsHolderToUse = argsHolder;
argsToUse = argsHolder.arguments;
minTypeDiffWeight = typeDiffWeight;
ambiguousFactoryMethods = null;
}
else if (factoryMethodToUse != null && typeDiffWeight == minTypeDiffWeight) {
if (ambiguousFactoryMethods == null) {
ambiguousFactoryMethods = new LinkedHashSet<Method>();
ambiguousFactoryMethods.add(factoryMethodToUse);
}
ambiguousFactoryMethods.add(candidate);
}
}
}
if (factoryMethodToUse == null) {
boolean hasArgs = (resolvedValues.getArgumentCount() > 0);
String argDesc = "";
if (hasArgs) {
List<String> argTypes = new ArrayList<String>();
for (ValueHolder value : resolvedValues.getIndexedArgumentValues().values()) {
String argType = (value.getType() != null ?
ClassUtils.getShortName(value.getType()) : value.getValue().getClass().getSimpleName());
argTypes.add(argType);
}
argDesc = StringUtils.collectionToCommaDelimitedString(argTypes);
}
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
"No matching factory method found: " +
(mbd.getFactoryBeanName() != null ?
"factory bean '" + mbd.getFactoryBeanName() + "'; " : "") +
"factory method '" + mbd.getFactoryMethodName() + "(" + argDesc + ")'. " +
"Check that a method with the specified name " +
(hasArgs ? "and arguments " : "") +
"exists and that it is " +
(isStatic ? "static" : "non-static") + ".");
}
else if (void.class.equals(factoryMethodToUse.getReturnType())) {
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
"Invalid factory method '" + mbd.getFactoryMethodName() +
"': needs to have a non-void return type!");
}
else if (ambiguousFactoryMethods != null && !mbd.isLenientConstructorResolution()) {
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
"Ambiguous factory method matches found in bean '" + beanName + "' " +
"(hint: specify index/type/name arguments for simple parameters to avoid type ambiguities): " +
ambiguousFactoryMethods);
}
if (explicitArgs == null && argsHolderToUse != null) {
argsHolderToUse.storeCache(mbd, factoryMethodToUse);
}
}
try {
Object beanInstance;
if (System.getSecurityManager() != null) {
final Object fb = factoryBean;
final Method factoryMethod = factoryMethodToUse;
final Object[] args = argsToUse;
beanInstance = AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
return beanFactory.getInstantiationStrategy().instantiate(
mbd, beanName, beanFactory, fb, factoryMethod, args);
}
}, beanFactory.getAccessControlContext());
}
else {
beanInstance = beanFactory.getInstantiationStrategy().instantiate(
mbd, beanName, beanFactory, factoryBean, factoryMethodToUse, argsToUse);
}
if (beanInstance == null) {
return null;
}
bw.setWrappedInstance(beanInstance);
return bw;
}
catch (Throwable ex) {
throw new BeanCreationException(mbd.getResourceDescription(), beanName, "Instantiation of bean failed", ex);
}
}
/**
* Resolve the constructor arguments for this bean into the resolvedValues object.
* This may involve looking up other beans.
* This method is also used for handling invocations of static factory methods.
*/
private int resolveConstructorArguments(
String beanName, RootBeanDefinition mbd, BeanWrapper bw,
ConstructorArgumentValues cargs, ConstructorArgumentValues resolvedValues) {
TypeConverter converter = (this.beanFactory.getCustomTypeConverter() != null ?
this.beanFactory.getCustomTypeConverter() : bw);
BeanDefinitionValueResolver valueResolver =
new BeanDefinitionValueResolver(this.beanFactory, beanName, mbd, converter);
int minNrOfArgs = cargs.getArgumentCount();
for (Map.Entry<Integer, ConstructorArgumentValues.ValueHolder> entry : cargs.getIndexedArgumentValues().entrySet()) {
int index = entry.getKey();
if (index < 0) {
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
"Invalid constructor argument index: " + index);
}
if (index > minNrOfArgs) {
minNrOfArgs = index + 1;
}
ConstructorArgumentValues.ValueHolder valueHolder = entry.getValue();
if (valueHolder.isConverted()) {
resolvedValues.addIndexedArgumentValue(index, valueHolder);
}
else {
Object resolvedValue =
valueResolver.resolveValueIfNecessary("constructor argument", valueHolder.getValue());
ConstructorArgumentValues.ValueHolder resolvedValueHolder =
new ConstructorArgumentValues.ValueHolder(resolvedValue, valueHolder.getType(), valueHolder.getName());
resolvedValueHolder.setSource(valueHolder);
resolvedValues.addIndexedArgumentValue(index, resolvedValueHolder);
}
}
for (ConstructorArgumentValues.ValueHolder valueHolder : cargs.getGenericArgumentValues()) {
if (valueHolder.isConverted()) {
resolvedValues.addGenericArgumentValue(valueHolder);
}
else {
Object resolvedValue =
valueResolver.resolveValueIfNecessary("constructor argument", valueHolder.getValue());
ConstructorArgumentValues.ValueHolder resolvedValueHolder =
new ConstructorArgumentValues.ValueHolder(resolvedValue, valueHolder.getType(), valueHolder.getName());
resolvedValueHolder.setSource(valueHolder);
resolvedValues.addGenericArgumentValue(resolvedValueHolder);
}
}
return minNrOfArgs;
}
/**
* Create an array of arguments to invoke a constructor or factory method,
* given the resolved constructor argument values.
*/
private ArgumentsHolder createArgumentArray(
String beanName, RootBeanDefinition mbd, ConstructorArgumentValues resolvedValues,
BeanWrapper bw, Class[] paramTypes, String[] paramNames, Object methodOrCtor,
boolean autowiring) throws UnsatisfiedDependencyException {
String methodType = (methodOrCtor instanceof Constructor ? "constructor" : "factory method");
TypeConverter converter = (this.beanFactory.getCustomTypeConverter() != null ?
this.beanFactory.getCustomTypeConverter() : bw);
ArgumentsHolder args = new ArgumentsHolder(paramTypes.length);
Set<ConstructorArgumentValues.ValueHolder> usedValueHolders =
new HashSet<ConstructorArgumentValues.ValueHolder>(paramTypes.length);
Set<String> autowiredBeanNames = new LinkedHashSet<String>(4);
for (int paramIndex = 0; paramIndex < paramTypes.length; paramIndex++) {
Class<?> paramType = paramTypes[paramIndex];
String paramName = (paramNames != null ? paramNames[paramIndex] : null);
// Try to find matching constructor argument value, either indexed or generic.
ConstructorArgumentValues.ValueHolder valueHolder =
resolvedValues.getArgumentValue(paramIndex, paramType, paramName, usedValueHolders);
// If we couldn't find a direct match and are not supposed to autowire,
// let's try the next generic, untyped argument value as fallback:
// it could match after type conversion (for example, String -> int).
if (valueHolder == null && !autowiring) {
valueHolder = resolvedValues.getGenericArgumentValue(null, null, usedValueHolders);
}
if (valueHolder != null) {
// We found a potential match - let's give it a try.
// Do not consider the same value definition multiple times!
usedValueHolders.add(valueHolder);
Object originalValue = valueHolder.getValue();
Object convertedValue;
if (valueHolder.isConverted()) {
convertedValue = valueHolder.getConvertedValue();
args.preparedArguments[paramIndex] = convertedValue;
}
else {
ConstructorArgumentValues.ValueHolder sourceHolder =
(ConstructorArgumentValues.ValueHolder) valueHolder.getSource();
Object sourceValue = sourceHolder.getValue();
try {
convertedValue = converter.convertIfNecessary(originalValue, paramType,
MethodParameter.forMethodOrConstructor(methodOrCtor, paramIndex));
// TODO re-enable once race condition has been found (SPR-7423)
/*
if (originalValue == sourceValue || sourceValue instanceof TypedStringValue) {
// Either a converted value or still the original one: store converted value.
sourceHolder.setConvertedValue(convertedValue);
args.preparedArguments[paramIndex] = convertedValue;
}
else {
*/
args.resolveNecessary = true;
args.preparedArguments[paramIndex] = sourceValue;
// }
}
catch (TypeMismatchException ex) {
throw new UnsatisfiedDependencyException(
mbd.getResourceDescription(), beanName, paramIndex, paramType,
"Could not convert " + methodType + " argument value of type [" +
ObjectUtils.nullSafeClassName(valueHolder.getValue()) +
"] to required type [" + paramType.getName() + "]: " + ex.getMessage());
}
}
args.arguments[paramIndex] = convertedValue;
args.rawArguments[paramIndex] = originalValue;
}
else {
// No explicit match found: we're either supposed to autowire or
// have to fail creating an argument array for the given constructor.
if (!autowiring) {
throw new UnsatisfiedDependencyException(
mbd.getResourceDescription(), beanName, paramIndex, paramType,
"Ambiguous " + methodType + " argument types - " +
"did you specify the correct bean references as " + methodType + " arguments?");
}
try {
MethodParameter param = MethodParameter.forMethodOrConstructor(methodOrCtor, paramIndex);
Object autowiredArgument = resolveAutowiredArgument(param, beanName, autowiredBeanNames, converter);
args.rawArguments[paramIndex] = autowiredArgument;
args.arguments[paramIndex] = autowiredArgument;
args.preparedArguments[paramIndex] = new AutowiredArgumentMarker();
args.resolveNecessary = true;
}
catch (BeansException ex) {
throw new UnsatisfiedDependencyException(
mbd.getResourceDescription(), beanName, paramIndex, paramType, ex);
}
}
}
for (String autowiredBeanName : autowiredBeanNames) {
this.beanFactory.registerDependentBean(autowiredBeanName, beanName);
if (this.beanFactory.logger.isDebugEnabled()) {
this.beanFactory.logger.debug("Autowiring by type from bean name '" + beanName +
"' via " + methodType + " to bean named '" + autowiredBeanName + "'");
}
}
return args;
}
/**
* Resolve the prepared arguments stored in the given bean definition.
*/
private Object[] resolvePreparedArguments(
String beanName, RootBeanDefinition mbd, BeanWrapper bw, Member methodOrCtor, Object[] argsToResolve) {
Class[] paramTypes = (methodOrCtor instanceof Method ?
((Method) methodOrCtor).getParameterTypes() : ((Constructor) methodOrCtor).getParameterTypes());
TypeConverter converter = (this.beanFactory.getCustomTypeConverter() != null ?
this.beanFactory.getCustomTypeConverter() : bw);
BeanDefinitionValueResolver valueResolver =
new BeanDefinitionValueResolver(this.beanFactory, beanName, mbd, converter);
Object[] resolvedArgs = new Object[argsToResolve.length];
for (int argIndex = 0; argIndex < argsToResolve.length; argIndex++) {
Object argValue = argsToResolve[argIndex];
MethodParameter methodParam = MethodParameter.forMethodOrConstructor(methodOrCtor, argIndex);
GenericTypeResolver.resolveParameterType(methodParam, methodOrCtor.getDeclaringClass());
if (argValue instanceof AutowiredArgumentMarker) {
argValue = resolveAutowiredArgument(methodParam, beanName, null, converter);
}
else if (argValue instanceof BeanMetadataElement) {
argValue = valueResolver.resolveValueIfNecessary("constructor argument", argValue);
}
else if (argValue instanceof String) {
argValue = this.beanFactory.evaluateBeanDefinitionString((String) argValue, mbd);
}
Class<?> paramType = paramTypes[argIndex];
try {
resolvedArgs[argIndex] = converter.convertIfNecessary(argValue, paramType, methodParam);
}
catch (TypeMismatchException ex) {
String methodType = (methodOrCtor instanceof Constructor ? "constructor" : "factory method");
throw new UnsatisfiedDependencyException(
mbd.getResourceDescription(), beanName, argIndex, paramType,
"Could not convert " + methodType + " argument value of type [" +
ObjectUtils.nullSafeClassName(argValue) +
"] to required type [" + paramType.getName() + "]: " + ex.getMessage());
}
}
return resolvedArgs;
}
/**
* Template method for resolving the specified argument which is supposed to be autowired.
*/
protected Object resolveAutowiredArgument(
MethodParameter param, String beanName, Set<String> autowiredBeanNames, TypeConverter typeConverter) {
return this.beanFactory.resolveDependency(
new DependencyDescriptor(param, true), beanName, autowiredBeanNames, typeConverter);
}
/**
* Private inner class for holding argument combinations.
*/
private static class ArgumentsHolder {
public final Object rawArguments[];
public final Object arguments[];
public final Object preparedArguments[];
public boolean resolveNecessary = false;
public ArgumentsHolder(int size) {
this.rawArguments = new Object[size];
this.arguments = new Object[size];
this.preparedArguments = new Object[size];
}
public ArgumentsHolder(Object[] args) {
this.rawArguments = args;
this.arguments = args;
this.preparedArguments = args;
}
public int getTypeDifferenceWeight(Class[] paramTypes) {
// If valid arguments found, determine type difference weight.
// Try type difference weight on both the converted arguments and
// the raw arguments. If the raw weight is better, use it.
// Decrease raw weight by 1024 to prefer it over equal converted weight.
int typeDiffWeight = MethodInvoker.getTypeDifferenceWeight(paramTypes, this.arguments);
int rawTypeDiffWeight = MethodInvoker.getTypeDifferenceWeight(paramTypes, this.rawArguments) - 1024;
return (rawTypeDiffWeight < typeDiffWeight ? rawTypeDiffWeight : typeDiffWeight);
}
public int getAssignabilityWeight(Class[] paramTypes) {
for (int i = 0; i < paramTypes.length; i++) {
if (!ClassUtils.isAssignableValue(paramTypes[i], this.arguments[i])) {
return Integer.MAX_VALUE;
}
}
for (int i = 0; i < paramTypes.length; i++) {
if (!ClassUtils.isAssignableValue(paramTypes[i], this.rawArguments[i])) {
return Integer.MAX_VALUE - 512;
}
}
return Integer.MAX_VALUE - 1024;
}
public void storeCache(RootBeanDefinition mbd, Object constructorOrFactoryMethod) {
synchronized (mbd.constructorArgumentLock) {
mbd.resolvedConstructorOrFactoryMethod = constructorOrFactoryMethod;
mbd.constructorArgumentsResolved = true;
if (this.resolveNecessary) {
mbd.preparedConstructorArguments = this.preparedArguments;
}
else {
mbd.resolvedConstructorArguments = this.arguments;
}
}
}
}
/**
* Marker for autowired arguments in a cached argument array.
*/
private static class AutowiredArgumentMarker {
}
/**
* Inner class to avoid a Java 6 dependency.
*/
private static class ConstructorPropertiesChecker {
public static String[] evaluateAnnotation(Constructor<?> candidate, int paramCount) {
ConstructorProperties cp = candidate.getAnnotation(ConstructorProperties.class);
if (cp != null) {
String[] names = cp.value();
if (names.length != paramCount) {
throw new IllegalStateException("Constructor annotated with @ConstructorProperties but not " +
"corresponding to actual number of parameters (" + paramCount + "): " + candidate);
}
return names;
}
else {
return null;
}
}
}
} | [
"[email protected]"
] | |
0d92bf0099d93d96b85d9904ce042407c56b4c50 | 434b9f4c57ad9dca57d4cd478ec0c69b2b85ba9a | /src/main/java/com/yellowdoge/app/xiyoumusic/service/ChatService.java | 13315faf6d4e28a99b26d730aed0ce126f8a13cb | [] | no_license | yellowdoge1996/xiyouMusicService | 3c006a73ef1f4a193d20d0f0a36a340f29f8dfd7 | a0e1976a06209663fbb124332618251fe83cea4f | refs/heads/master | 2022-06-24T07:12:33.769692 | 2019-12-05T15:52:04 | 2019-12-05T15:52:04 | 226,136,489 | 0 | 0 | null | 2022-06-21T02:23:28 | 2019-12-05T15:48:20 | Java | UTF-8 | Java | false | false | 209 | java | package com.yellowdoge.app.xiyoumusic.service;
import com.yellowdoge.app.xiyoumusic.model.LiuYan;
public interface ChatService {
public void chat(LiuYan liuYan);
public void getMessage(String xh);
}
| [
"[email protected]"
] | |
ae31eff47fc7dd3710e8136eb7a3f20164b5ee4b | b4ba18c2c84b58d8b595e1294be06f669dc041d7 | /src/com/mZone/epro/account/twitter/TwitterWebLoginActivity.java | c44c5073960b10f3d3b1703006567e5eb7ac1e94 | [] | no_license | lochuynh211/ePro-Toeic | 85356ccab18a41a1c6dd98a2bfe1508ffecb7894 | 12816bd494641778c53a8713a9552f60eda8852f | refs/heads/master | 2021-01-10T23:20:48.652361 | 2016-10-11T13:26:17 | 2016-10-11T13:26:17 | 70,595,487 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 16,825 | java | package com.mZone.epro.account.twitter;
import com.mZone.epro.BuildConfig;
import com.mZone.epro.R;
import com.mZone.epro.client.utility.AbstractCacheAsyncTaskLoader;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.auth.AccessToken;
import twitter4j.auth.RequestToken;
import twitter4j.conf.Configuration;
import twitter4j.conf.ConfigurationBuilder;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.app.NavUtils;
import android.support.v4.content.Loader;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class TwitterWebLoginActivity extends ActionBarActivity {
/** ่ช่จผใใผใฏใณๅๅพๅคฑๆใใคใขใญใฐ็จใใฉใฐใกใณใใฟใฐ */
private static final String FRAGMENT_TAG_DIALOG_OAUTH_REQUEST_TOKEN_ERROR = "FRAGMENT_TAG_DIALOG_OAUTH_REQUEST_TOKEN_ERROR";
/** */
private Twitter mTwitter;
/** */
private String mOauthVerifier;
/** */
private WebView mWebView;
/** */
private final Handler mShowDialogHandler = new Handler() {
@Override
public void handleMessage(final Message msg) {
switch (msg.what) {
case MESSAGE_ID_OAUTH_REQUEST_TOKEN_ERROR_DIALOG:
final Object obj = msg.obj;
if (obj instanceof DialogFragment) {
// ใใคใขใญใฐใ่กจ็คบ
final DialogFragment dialogFragment = (DialogFragment) obj;
dialogFragment.show(getSupportFragmentManager(), FRAGMENT_TAG_DIALOG_OAUTH_REQUEST_TOKEN_ERROR);
}
break;
default:
break;
}
}
};
/** */
private static final int MESSAGE_ID_OAUTH_REQUEST_TOKEN_ERROR_DIALOG = 1;
@SuppressWarnings("deprecation")
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// ใฌใคใขใฆใใ่ชญใฟ่พผใฟ
setContentView(R.layout.account_twitter_web_login_activity);
// ActionBarใฎ่จญๅฎ
final ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
// WebViewใฎๆบๅ
mWebView = (WebView) findViewById(R.id.webView);
CookieSyncManager.createInstance(this);
// final CookieManager cookieManager = CookieManager.getInstance();
// cookieManager.removeAllCookie();
// cookieManager.setAcceptCookie(false);
// final WebSettings ws = mWebView.getSettings();
// ws.setSaveFormData(false);
// ws.setSavePassword(false);
mWebView.setWebViewClient(new LoginTwitterWebViewClient());
// Twitterใขใฏใปในใชใใธใงใฏใใไฝๆ
final ConfigurationBuilder builder = new ConfigurationBuilder();
builder.setDebugEnabled(true);
builder.setOAuthConsumerKey(TwitterConstants.CONSUMER_KEY);
builder.setOAuthConsumerSecret(TwitterConstants.CONSUMER_SECRET);
final Configuration configuration = builder.build();
mTwitter = new TwitterFactory(configuration).getInstance();
// ่ชญใฟ่พผใฟ้ๅง
final LoaderManager loaderManager = getSupportLoaderManager();
final GetTwitterOAuthRequestTokenLoaderCallback callback = new GetTwitterOAuthRequestTokenLoaderCallback();
loaderManager.restartLoader(R.id.twitter_web_login_activity_load_oauth_request_token, null, callback);
//
setResult(RESULT_CANCELED);
}
/**
*
* @param url
*/
private void loadUrl(final String url) {
mWebView.loadUrl(url);
}
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.twitter_web_login, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
boolean consumed = false;
switch (item.getItemId()) {
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
consumed = true;
default:
// ่ชใฏใฉในใงๆถ่ฒปใใชใๅ ดๅใฏ่ฆชใฏใฉในใซ่ญฒๆธกใใ
consumed = super.onOptionsItemSelected(item);
break;
}
return consumed;
}
/**
*
*/
private class LoginTwitterWebViewClient extends WebViewClient {
/** ใญใฐ็จใฟใฐ */
@Override
public boolean shouldOverrideUrlLoading(final WebView view, final String url) {
boolean handled = false;
if (url.contains(TwitterConstants.CALLBACK_URL)) {
// ใใผใฏใณใฎใใจใๅๅพ
final Uri uri = Uri.parse(url);
mOauthVerifier = uri.getQueryParameter("oauth_verifier");
// ใใผใฏใณใๅๅพ
if (!TextUtils.isEmpty(mOauthVerifier)){
final LoaderManager loaderManager = getSupportLoaderManager();
final GetAccessTokenLoaderCallback callback = new GetAccessTokenLoaderCallback();
loaderManager.initLoader(R.id.twitter_web_login_activity_load_access_token, null, callback);
handled = true;
}
else{
finishActivity();
}
}
return handled;
}
}
/**
*
*/
private static class GetTwitterOAuthRequestTokenLoader extends AbstractCacheAsyncTaskLoader<TwitterOAuthRequestToken> {
/** */
private final Twitter mTwitter;
/**
*
* @param context
* @param twitter
*/
public GetTwitterOAuthRequestTokenLoader(final Context context, final Twitter twitter) {
super(context);
mTwitter = twitter;
}
@Override
public TwitterOAuthRequestToken loadInBackground() {
final TwitterOAuthRequestToken result = new TwitterOAuthRequestToken();
try {
final RequestToken requestToken = mTwitter.getOAuthRequestToken(TwitterConstants.CALLBACK_URL);
result.isCausedByNetworkIssue = false;
result.isErrorMessageAvailable = false;
result.errorCode = 0;
result.authenticationURL = requestToken.getAuthenticationURL();
} catch (final TwitterException e) {
e.printStackTrace();
result.isCausedByNetworkIssue = e.isCausedByNetworkIssue();
result.isErrorMessageAvailable = e.isErrorMessageAvailable();
result.errorCode = e.getErrorCode();
result.exceptionCode = e.getExceptionCode();
result.errorMessage = e.getErrorMessage();
result.authenticationURL = null;
}
return result;
}
}
/**
*
*/
private static final class TwitterOAuthRequestToken {
/** */
public boolean isCausedByNetworkIssue;
/** */
public boolean isErrorMessageAvailable;
/** */
public int errorCode;
/** */
public String exceptionCode;
/** */
public String errorMessage;
/** */
public String authenticationURL;
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = (prime * result) + ((authenticationURL == null) ? 0 : authenticationURL.hashCode());
result = (prime * result) + errorCode;
result = (prime * result) + ((errorMessage == null) ? 0 : errorMessage.hashCode());
result = (prime * result) + ((exceptionCode == null) ? 0 : exceptionCode.hashCode());
result = (prime * result) + (isCausedByNetworkIssue ? 1231 : 1237);
result = (prime * result) + (isErrorMessageAvailable ? 1231 : 1237);
return result;
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TwitterOAuthRequestToken other = (TwitterOAuthRequestToken) obj;
if (authenticationURL == null) {
if (other.authenticationURL != null) {
return false;
}
} else if (!authenticationURL.equals(other.authenticationURL)) {
return false;
}
if (errorCode != other.errorCode) {
return false;
}
if (errorMessage == null) {
if (other.errorMessage != null) {
return false;
}
} else if (!errorMessage.equals(other.errorMessage)) {
return false;
}
if (exceptionCode == null) {
if (other.exceptionCode != null) {
return false;
}
} else if (!exceptionCode.equals(other.exceptionCode)) {
return false;
}
if (isCausedByNetworkIssue != other.isCausedByNetworkIssue) {
return false;
}
if (isErrorMessageAvailable != other.isErrorMessageAvailable) {
return false;
}
return true;
}
@Override
public String toString() {
return "TwitterOAuthRequestToken [isCausedByNetworkIssue=" + isCausedByNetworkIssue + ", isErrorMessageAvailable=" + isErrorMessageAvailable + ", errorCode=" + errorCode + ", exceptionCode=" + exceptionCode + ", errorMessage=" + errorMessage + ", authenticationURL=" + authenticationURL + "]";
}
}
private class GetTwitterOAuthRequestTokenLoaderCallback implements LoaderCallbacks<TwitterOAuthRequestToken> {
@Override
public Loader<TwitterOAuthRequestToken> onCreateLoader(final int id, final Bundle args) {
final GetTwitterOAuthRequestTokenLoader loader = new GetTwitterOAuthRequestTokenLoader(getApplicationContext(), mTwitter);
return loader;
}
@Override
public void onLoadFinished(final Loader<TwitterOAuthRequestToken> loader, final TwitterOAuthRequestToken twitterOAuthRequestToken) {
// URLใฎ่ชญใฟ่พผใฟ
final String authenticationURL = twitterOAuthRequestToken.authenticationURL;
if (!TextUtils.isEmpty(authenticationURL)) {
loadUrl(authenticationURL);
} else {
// ใจใฉใผใใคใขใญใฐใ่กจ็คบ
final OAuthRequestTokenErrorDialogFragment dialogFragment = OAuthRequestTokenErrorDialogFragment.newInstance(twitterOAuthRequestToken.isCausedByNetworkIssue, twitterOAuthRequestToken.isErrorMessageAvailable, twitterOAuthRequestToken.exceptionCode, twitterOAuthRequestToken.errorCode, twitterOAuthRequestToken.errorMessage);
final Message msg = mShowDialogHandler.obtainMessage(MESSAGE_ID_OAUTH_REQUEST_TOKEN_ERROR_DIALOG, dialogFragment);
mShowDialogHandler.sendMessage(msg);
}
}
@Override
public void onLoaderReset(final Loader<TwitterOAuthRequestToken> loader) {
}
}
/**
*
*/
private static class GetAccessTokenLoader extends AbstractCacheAsyncTaskLoader<Boolean> {
/** */
private final Twitter mTwitter;
/** */
private final String mOauthVerifier;
/**
*
* @param context
*/
public GetAccessTokenLoader(final Context context, final Twitter twitter, final String oauthVerifier) {
super(context);
mTwitter = twitter;
mOauthVerifier = oauthVerifier;
}
@Override
public Boolean loadInBackground() {
boolean successful = false;
try {
// ใใผใฏใณใๅๅพ
final AccessToken accessToken = mTwitter.getOAuthAccessToken(mOauthVerifier);
final String token = accessToken.getToken();
final String tokenSecret = accessToken.getTokenSecret();
// ใใผใฏใณใไฟๅญ
final TwitterDataController twitterDataController = TwitterDataController.getInstance(getContext());
successful = twitterDataController.saveOAuthAccessToken(token, tokenSecret);
if (!successful) {
return successful;
}
// Twitterใชใใธใงใฏใใๅ็ๆ
final ConfigurationBuilder builder = new ConfigurationBuilder();
builder.setDebugEnabled(BuildConfig.DEBUG);
builder.setOAuthConsumerKey(TwitterConstants.CONSUMER_KEY);
builder.setOAuthConsumerSecret(TwitterConstants.CONSUMER_SECRET);
builder.setOAuthAccessToken(token);
builder.setOAuthAccessTokenSecret(tokenSecret);
final Configuration configuration = builder.build();
// ในใฏใชใผใณๅใๅๅพ
final Twitter twitter = new TwitterFactory(configuration).getInstance();
final String screenName = twitter.getScreenName();
// ในใฏใชใผใณๅใไฟๅญ
successful = twitterDataController.saveAccountName(screenName);
} catch (final IllegalStateException e) {
e.printStackTrace();
successful = false;
} catch (final TwitterException e) {
e.printStackTrace();
successful = false;
}
return successful;
}
}
/**
*
*/
private class GetAccessTokenLoaderCallback implements LoaderCallbacks<Boolean> {
@Override
public Loader<Boolean> onCreateLoader(final int id, final Bundle args) {
// ใญใผใใผใไฝๆ
final GetAccessTokenLoader loader = new GetAccessTokenLoader(getApplicationContext(), mTwitter, mOauthVerifier);
return loader;
}
@Override
public void onLoadFinished(final Loader<Boolean> loader, final Boolean successful) {
if (successful) {
// Activityใ็ตไบ
if (!isFinishing()) {
setResult(RESULT_OK);
finish();
}
}
}
@Override
public void onLoaderReset(final Loader<Boolean> loader) {
}
}
/**
*
*/
public static class OAuthRequestTokenErrorDialogFragment extends DialogFragment {
/** */
private static final String FRAGMENT_ARGS_KEY_IS_CAUSED_BY_NETWORK_ISSUE = "isCausedByNetworkIssue";
/** */
private static final String FRAGMENT_ARGS_KEY_IS_ERROR_MESSAGE_AVAILAVLE = "isErrorMessageAvailable";
/** */
private static final String FRAGMENT_ARGS_KEY_EXCEPTION_CODE = "exceptionCode";
/** */
private static final String FRAGMENT_ARGS_KEY_ERROR_CODE = "errorCode";
/** */
private static final String FRAGMENT_ARGS_KEY_ERROR_MESSAGE = "errorMessage";
/**
*
* @param isCausedByNetworkIssue
* @param isErrorMessageAvailable
* @param exceptionCode
* @param errorCode
* @param errorMessage
* @return
*/
public static OAuthRequestTokenErrorDialogFragment newInstance(final boolean isCausedByNetworkIssue, final boolean isErrorMessageAvailable, final String exceptionCode, final int errorCode, final String errorMessage) {
// ใใฉใฐใกใณใใไฝๆ
final OAuthRequestTokenErrorDialogFragment fragment = new OAuthRequestTokenErrorDialogFragment();
// ใใฉใฐใกใณใใฎๅผๆฐใไฝๆ
final Bundle args = new Bundle();
args.putBoolean(FRAGMENT_ARGS_KEY_IS_CAUSED_BY_NETWORK_ISSUE, isCausedByNetworkIssue);
args.putBoolean(FRAGMENT_ARGS_KEY_IS_ERROR_MESSAGE_AVAILAVLE, isErrorMessageAvailable);
args.putString(FRAGMENT_ARGS_KEY_EXCEPTION_CODE, exceptionCode);
args.putInt(FRAGMENT_ARGS_KEY_ERROR_CODE, errorCode);
args.putString(FRAGMENT_ARGS_KEY_ERROR_MESSAGE, errorMessage);
fragment.setArguments(args);
return fragment;
}
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
// TODO : ใกใใปใผใธใxmlใซๅคๆดใใใใจ
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.twitter_web_login_activity_oauth_request_token_error);
// ๅผๆฐใๅๅพ
boolean isCausedByNetworkIssue = false;
boolean isErrorMessageAvailable = false;
String exceptionCode = null;
int errorCode = 0;
String errorMessage = null;
final Bundle args = getArguments();
if (args != null) {
isCausedByNetworkIssue = args.getBoolean(FRAGMENT_ARGS_KEY_IS_CAUSED_BY_NETWORK_ISSUE);
isErrorMessageAvailable = args.getBoolean(FRAGMENT_ARGS_KEY_IS_ERROR_MESSAGE_AVAILAVLE);
exceptionCode = args.getString(FRAGMENT_ARGS_KEY_EXCEPTION_CODE);
errorCode = args.getInt(FRAGMENT_ARGS_KEY_ERROR_CODE);
errorMessage = args.getString(FRAGMENT_ARGS_KEY_ERROR_MESSAGE);
}
// ใจใฉใผๅ
ๅฎนใซใใใกใใปใผใธใๅใๆฟใ
if (isCausedByNetworkIssue) {
builder.setMessage(R.string.twitter_web_login_activity_oauth_request_token_network_error);
} else if (isErrorMessageAvailable) {
final StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(errorMessage).append("\nErrorCode=").append(errorCode).append("\nExceptionCode=").append(exceptionCode).append("\n");
builder.setMessage(stringBuilder.toString());
} else {
builder.setMessage(R.string.twitter_web_login_activity_oauth_request_token_unknown_error);
}
// ใชในใใผใไฝๆ
final DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int which) {
switch (which) {
case DialogInterface.BUTTON_POSITIVE:
// Activityใ้ใใ
dialog.dismiss();
getActivity().finish();
break;
case DialogInterface.BUTTON_NEGATIVE:
default:
// ไฝใใใชใ
break;
}
}
};
builder.setPositiveButton(R.string.twitter_web_login_activity_oauth_request_token_positive_button, listener);
builder.setCancelable(false);
// ใใคใขใญใฐใไฝๆ
final Dialog dialog = builder.create();
return dialog;
}
}
private void finishActivity(){
finish();
}
}
| [
"[email protected]"
] | |
f6db8dc4a0568bc64508d64d90118a0447843e9a | 0eb1a5ea1afb5aec9d2652767e8391eeadf4370f | /retail-store/src/main/java/com/retail/store/model/CartItem.java | dbc6651081687fb9d04fe782c0c17bc0e66ce2cd | [] | no_license | yogeshrnaik/projects | 36b2b6e115c45a562a5206ab7280d7933c072561 | fed554cd365865a6e505d2c146fc820931d78da0 | refs/heads/master | 2022-12-23T05:32:11.548117 | 2022-09-08T07:48:48 | 2022-09-08T07:48:48 | 40,397,110 | 6 | 8 | null | 2022-12-16T03:41:00 | 2015-08-08T08:47:28 | Java | UTF-8 | Java | false | false | 2,457 | java | package com.retail.store.model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
@Entity
@Table(name = "cart_items")
public class CartItem implements Serializable {
private static final long serialVersionUID = -5454681550675014977L;
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
private Product product;
@ManyToOne
private Cart cart;
@NotNull
private int quantity;
private double salesTax;
private double priceBeforeTax;
private double totalPrice;
public CartItem() {
}
public CartItem(Product product, int quantity, Cart cart) {
this(null, product, quantity, cart);
}
public CartItem(Long id, Product product, int quantity, Cart cart) {
this.id = id;
this.product = product;
this.quantity = quantity;
this.cart = cart;
updateQuantity(quantity);
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public Double getSalesTax() {
return salesTax;
}
public void setSalesTax(Double salesTax) {
this.salesTax = salesTax;
}
public Double getPriceBeforeTax() {
return priceBeforeTax;
}
public void setPriceBeforeTax(Double price) {
priceBeforeTax = price;
}
public double getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(double totalPrice) {
this.totalPrice = totalPrice;
}
public void setSalesTax(double salesTax) {
this.salesTax = salesTax;
}
public void updateQuantity(int quantity) {
setQuantity(quantity);
priceBeforeTax = product.calculatePrice(quantity);
salesTax = product.calculateSalesTax(quantity);
totalPrice = priceBeforeTax + salesTax;
}
}
| [
"[email protected]"
] | |
19cd1f67a7d67aaeb6decbd3e3de4e84dcc1ca98 | a5d01febfd8d45a61f815b6f5ed447e25fad4959 | /Source Code/5.27.0/sources/com/iqoption/fragment/assets/i.java | 373aac1dce393c34677adcea312e7ae421cf3c75 | [] | no_license | kkagill/Decompiler-IQ-Option | 7fe5911f90ed2490687f5d216cb2940f07b57194 | c2a9dbbe79a959aa1ab8bb7a89c735e8f9dbc5a6 | refs/heads/master | 2020-09-14T20:44:49.115289 | 2019-11-04T06:58:55 | 2019-11-04T06:58:55 | 223,236,327 | 1 | 0 | null | 2019-11-21T18:17:17 | 2019-11-21T18:17:16 | null | UTF-8 | Java | false | false | 434 | java | package com.iqoption.fragment.assets;
import com.iqoption.fragment.assets.model.AssetSortType;
@kotlin.i(bne = {1, 1, 15})
public final /* synthetic */ class i {
public static final /* synthetic */ int[] aob = new int[AssetSortType.values().length];
static {
aob[AssetSortType.BY_DIFF.ordinal()] = 1;
aob[AssetSortType.BY_SPREAD.ordinal()] = 2;
aob[AssetSortType.BY_LEVERAGE.ordinal()] = 3;
}
}
| [
"[email protected]"
] | |
790c6478b7dab9e336e90a7cc119b4523bc73973 | b146594bccfded847236840ebeef357e6456a581 | /src/main/java/com/springmvc/final_project/Model/CompaniesFindByIdRequest.java | ae013d09d35594b2d342cd2db10ac2fc02fede27 | [] | no_license | BuiVanKhoa/backend | b79ee7fbe9b6f978593a396c079768e252b78399 | b6f262a269909700092f45d18568e3b91b052041 | refs/heads/master | 2022-11-30T09:57:13.519706 | 2020-08-14T03:59:14 | 2020-08-14T03:59:14 | 287,438,450 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 217 | java | package com.springmvc.final_project.Model;
public class CompaniesFindByIdRequest {
private int id;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
} | [
"[email protected]"
] | |
da0266f3acf0599190a559eab7ae66c7506362a0 | 935385f41daf85ddbf0970a8a3e5af2d1ff68f87 | /src/com/insanexs/leetcode/algorithms/IsIsomorphic.java | ba27d9f90d67b431a1a316d7044de13df201aad5 | [] | no_license | insaneXs/leetcode | 5b0919c30483662f909bd3212574248d3dd151d2 | 0a57ae7573dead698f90b91ff33460d51275890c | refs/heads/master | 2021-01-10T10:22:43.185736 | 2020-11-06T08:11:02 | 2020-11-06T08:11:02 | 50,817,992 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 694 | java | package com.insanexs.leetcode.algorithms;
import java.util.HashMap;
public class IsIsomorphic {
public static void main(String[] args){
System.out.println(isIsomorphic("aa", "ab"));
}
public static boolean isIsomorphic(String s, String t) {
HashMap<Character, Character> map = new HashMap<Character, Character> ();
char[] arr1 = s.toCharArray();
char[] arr2 = t.toCharArray();
for(int i = 0; i < arr1.length; i++){
if(map.containsKey(arr1[i])){
if(map.get(arr1[i]) != arr2[i])
return false;
}else{
map.put(arr1[i],arr2[i]);
}
}
return true;
}
}
| [
"[email protected]"
] | |
298f5126fb622ee12096a9ad3f38499d2c2945eb | 1d43fb019aa5abec9265f4e812af8775985879aa | /aeroperu/src/main/java/com/example/aeroperu/repo/CityRepo.java | b5a840ee5386ce9dffb0e2e683a85a268cda5efc | [] | no_license | ltoniut/tp5-rest | fc495120dd71153ec9289b481dedd2a69af3a39b | 45bf25448b0515e4d6ff6fb94aa6bc27c9787487 | refs/heads/master | 2020-03-19T10:45:21.760476 | 2018-06-09T22:55:43 | 2018-06-09T22:55:43 | 136,398,589 | 0 | 0 | null | 2018-06-07T00:00:56 | 2018-06-07T00:00:56 | null | UTF-8 | Java | false | false | 403 | java | package com.example.aeroperu.repo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.esq.models.City;
@Repository
public interface CityRepo extends JpaRepository<City, Long> {
public default City findByIata(String str) {
for (City c : findAll()) {
if (c.getIataCode() == str) {
return c;
}
}
return null;
}
} | [
"[email protected]"
] | |
68a3c9c6b64708aaa4930910899fe5f1275260f4 | b0cce84067ea5d37bf126bf671620a15b9d90890 | /app/src/main/java/com/mouqu/zhailu/zhailu/bean/CardBean.java | 38dc7169fd98faab26e73d6efac02fdac8ce7a48 | [] | no_license | 18668197127/ZhailuQB | f4df02dda885c5c8f19ef67857374f4b388542bd | 846f5d29df4d2c2fa7bad2f6239a2e41701e2c11 | refs/heads/master | 2020-04-17T16:30:39.044861 | 2019-01-21T03:39:06 | 2019-01-21T03:39:06 | 166,743,120 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 618 | java | package com.mouqu.zhailu.zhailu.bean;
import com.contrarywind.interfaces.IPickerViewData;
public class CardBean implements IPickerViewData {
int id;
String cardNo;
public CardBean(int id, String cardNo) {
this.id = id;
this.cardNo = cardNo;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCardNo() {
return cardNo;
}
public void setCardNo(String cardNo) {
this.cardNo = cardNo;
}
@Override
public String getPickerViewText() {
return cardNo;
}
} | [
"[email protected]"
] | |
af34709d7692df42a6e2418bda2f006c43e94ac8 | 950cde9a5c6ff2249618fa4e638ba14ba4a1ecd9 | /target/generated-sources/annotations/memstore/benchmarks/generated/PredicatedAllColumnsSumBench_testColumnTable_jmhTest.java | 6e536e72cf16bc79cac8caacdac4f2afce8ee89a | [
"Apache-2.0"
] | permissive | Zaidnabulsi/cs245-as1 | 027a3547ec8dea2717a347963762be102bfca590 | d0a10ed11e797913ae314d533a1b8d685c41e295 | refs/heads/master | 2020-12-22T04:11:58.652975 | 2020-01-30T03:07:20 | 2020-01-30T03:07:20 | 236,666,488 | 1 | 0 | Apache-2.0 | 2020-01-28T05:38:44 | 2020-01-28T05:38:44 | null | UTF-8 | Java | false | false | 17,720 | java | package memstore.benchmarks.generated;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.Collection;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.CompilerControl;
import org.openjdk.jmh.runner.InfraControl;
import org.openjdk.jmh.infra.ThreadParams;
import org.openjdk.jmh.results.BenchmarkTaskResult;
import org.openjdk.jmh.results.Result;
import org.openjdk.jmh.results.ThroughputResult;
import org.openjdk.jmh.results.AverageTimeResult;
import org.openjdk.jmh.results.SampleTimeResult;
import org.openjdk.jmh.results.SingleShotResult;
import org.openjdk.jmh.util.SampleBuffer;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.results.RawResults;
import org.openjdk.jmh.results.ResultRole;
import java.lang.reflect.Field;
import org.openjdk.jmh.infra.BenchmarkParams;
import org.openjdk.jmh.infra.IterationParams;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.infra.Control;
import org.openjdk.jmh.results.ScalarResult;
import org.openjdk.jmh.results.AggregationPolicy;
import org.openjdk.jmh.runner.FailureAssistException;
import memstore.benchmarks.generated.PredicatedAllColumnsSumBench_jmhType;
public final class PredicatedAllColumnsSumBench_testColumnTable_jmhTest {
boolean p000, p001, p002, p003, p004, p005, p006, p007, p008, p009, p010, p011, p012, p013, p014, p015;
boolean p016, p017, p018, p019, p020, p021, p022, p023, p024, p025, p026, p027, p028, p029, p030, p031;
boolean p032, p033, p034, p035, p036, p037, p038, p039, p040, p041, p042, p043, p044, p045, p046, p047;
boolean p048, p049, p050, p051, p052, p053, p054, p055, p056, p057, p058, p059, p060, p061, p062, p063;
boolean p064, p065, p066, p067, p068, p069, p070, p071, p072, p073, p074, p075, p076, p077, p078, p079;
boolean p080, p081, p082, p083, p084, p085, p086, p087, p088, p089, p090, p091, p092, p093, p094, p095;
boolean p096, p097, p098, p099, p100, p101, p102, p103, p104, p105, p106, p107, p108, p109, p110, p111;
boolean p112, p113, p114, p115, p116, p117, p118, p119, p120, p121, p122, p123, p124, p125, p126, p127;
boolean p128, p129, p130, p131, p132, p133, p134, p135, p136, p137, p138, p139, p140, p141, p142, p143;
boolean p144, p145, p146, p147, p148, p149, p150, p151, p152, p153, p154, p155, p156, p157, p158, p159;
boolean p160, p161, p162, p163, p164, p165, p166, p167, p168, p169, p170, p171, p172, p173, p174, p175;
boolean p176, p177, p178, p179, p180, p181, p182, p183, p184, p185, p186, p187, p188, p189, p190, p191;
boolean p192, p193, p194, p195, p196, p197, p198, p199, p200, p201, p202, p203, p204, p205, p206, p207;
boolean p208, p209, p210, p211, p212, p213, p214, p215, p216, p217, p218, p219, p220, p221, p222, p223;
boolean p224, p225, p226, p227, p228, p229, p230, p231, p232, p233, p234, p235, p236, p237, p238, p239;
boolean p240, p241, p242, p243, p244, p245, p246, p247, p248, p249, p250, p251, p252, p253, p254, p255;
int startRndMask;
BenchmarkParams benchmarkParams;
IterationParams iterationParams;
ThreadParams threadParams;
Blackhole blackhole;
Control notifyControl;
public BenchmarkTaskResult testColumnTable_Throughput(InfraControl control, ThreadParams threadParams) throws Throwable {
this.benchmarkParams = control.benchmarkParams;
this.iterationParams = control.iterationParams;
this.threadParams = threadParams;
this.notifyControl = control.notifyControl;
if (this.blackhole == null) {
this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
}
if (threadParams.getSubgroupIndex() == 0) {
RawResults res = new RawResults();
PredicatedAllColumnsSumBench_jmhType l_predicatedallcolumnssumbench0_0 = _jmh_tryInit_f_predicatedallcolumnssumbench0_0(control);
control.preSetup();
control.announceWarmupReady();
while (control.warmupShouldWait) {
blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable());
res.allOps++;
}
notifyControl.startMeasurement = true;
testColumnTable_thrpt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_predicatedallcolumnssumbench0_0);
notifyControl.stopMeasurement = true;
control.announceWarmdownReady();
try {
while (control.warmdownShouldWait) {
blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable());
res.allOps++;
}
control.preTearDown();
} catch (InterruptedException ie) {
control.preTearDownForce();
}
if (control.isLastIteration()) {
f_predicatedallcolumnssumbench0_0 = null;
}
res.allOps += res.measuredOps;
int batchSize = iterationParams.getBatchSize();
int opsPerInv = benchmarkParams.getOpsPerInvocation();
res.allOps *= opsPerInv;
res.allOps /= batchSize;
res.measuredOps *= opsPerInv;
res.measuredOps /= batchSize;
BenchmarkTaskResult results = new BenchmarkTaskResult(res.allOps, res.measuredOps);
results.add(new ThroughputResult(ResultRole.PRIMARY, "testColumnTable", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit()));
this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
return results;
} else
throw new IllegalStateException("Harness failed to distribute threads among groups properly");
}
public static void testColumnTable_thrpt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, PredicatedAllColumnsSumBench_jmhType l_predicatedallcolumnssumbench0_0) throws Throwable {
long operations = 0;
long realTime = 0;
result.startTime = System.nanoTime();
do {
blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable());
operations++;
} while(!control.isDone);
result.stopTime = System.nanoTime();
result.realTime = realTime;
result.measuredOps = operations;
}
public BenchmarkTaskResult testColumnTable_AverageTime(InfraControl control, ThreadParams threadParams) throws Throwable {
this.benchmarkParams = control.benchmarkParams;
this.iterationParams = control.iterationParams;
this.threadParams = threadParams;
this.notifyControl = control.notifyControl;
if (this.blackhole == null) {
this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
}
if (threadParams.getSubgroupIndex() == 0) {
RawResults res = new RawResults();
PredicatedAllColumnsSumBench_jmhType l_predicatedallcolumnssumbench0_0 = _jmh_tryInit_f_predicatedallcolumnssumbench0_0(control);
control.preSetup();
control.announceWarmupReady();
while (control.warmupShouldWait) {
blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable());
res.allOps++;
}
notifyControl.startMeasurement = true;
testColumnTable_avgt_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, l_predicatedallcolumnssumbench0_0);
notifyControl.stopMeasurement = true;
control.announceWarmdownReady();
try {
while (control.warmdownShouldWait) {
blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable());
res.allOps++;
}
control.preTearDown();
} catch (InterruptedException ie) {
control.preTearDownForce();
}
if (control.isLastIteration()) {
f_predicatedallcolumnssumbench0_0 = null;
}
res.allOps += res.measuredOps;
int batchSize = iterationParams.getBatchSize();
int opsPerInv = benchmarkParams.getOpsPerInvocation();
res.allOps *= opsPerInv;
res.allOps /= batchSize;
res.measuredOps *= opsPerInv;
res.measuredOps /= batchSize;
BenchmarkTaskResult results = new BenchmarkTaskResult(res.allOps, res.measuredOps);
results.add(new AverageTimeResult(ResultRole.PRIMARY, "testColumnTable", res.measuredOps, res.getTime(), benchmarkParams.getTimeUnit()));
this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
return results;
} else
throw new IllegalStateException("Harness failed to distribute threads among groups properly");
}
public static void testColumnTable_avgt_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, PredicatedAllColumnsSumBench_jmhType l_predicatedallcolumnssumbench0_0) throws Throwable {
long operations = 0;
long realTime = 0;
result.startTime = System.nanoTime();
do {
blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable());
operations++;
} while(!control.isDone);
result.stopTime = System.nanoTime();
result.realTime = realTime;
result.measuredOps = operations;
}
public BenchmarkTaskResult testColumnTable_SampleTime(InfraControl control, ThreadParams threadParams) throws Throwable {
this.benchmarkParams = control.benchmarkParams;
this.iterationParams = control.iterationParams;
this.threadParams = threadParams;
this.notifyControl = control.notifyControl;
if (this.blackhole == null) {
this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
}
if (threadParams.getSubgroupIndex() == 0) {
RawResults res = new RawResults();
PredicatedAllColumnsSumBench_jmhType l_predicatedallcolumnssumbench0_0 = _jmh_tryInit_f_predicatedallcolumnssumbench0_0(control);
control.preSetup();
control.announceWarmupReady();
while (control.warmupShouldWait) {
blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable());
res.allOps++;
}
notifyControl.startMeasurement = true;
int targetSamples = (int) (control.getDuration(TimeUnit.MILLISECONDS) * 20); // at max, 20 timestamps per millisecond
int batchSize = iterationParams.getBatchSize();
int opsPerInv = benchmarkParams.getOpsPerInvocation();
SampleBuffer buffer = new SampleBuffer();
testColumnTable_sample_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, buffer, targetSamples, opsPerInv, batchSize, l_predicatedallcolumnssumbench0_0);
notifyControl.stopMeasurement = true;
control.announceWarmdownReady();
try {
while (control.warmdownShouldWait) {
blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable());
res.allOps++;
}
control.preTearDown();
} catch (InterruptedException ie) {
control.preTearDownForce();
}
if (control.isLastIteration()) {
f_predicatedallcolumnssumbench0_0 = null;
}
res.allOps += res.measuredOps * batchSize;
res.allOps *= opsPerInv;
res.allOps /= batchSize;
res.measuredOps *= opsPerInv;
BenchmarkTaskResult results = new BenchmarkTaskResult(res.allOps, res.measuredOps);
results.add(new SampleTimeResult(ResultRole.PRIMARY, "testColumnTable", buffer, benchmarkParams.getTimeUnit()));
this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
return results;
} else
throw new IllegalStateException("Harness failed to distribute threads among groups properly");
}
public static void testColumnTable_sample_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, SampleBuffer buffer, int targetSamples, long opsPerInv, int batchSize, PredicatedAllColumnsSumBench_jmhType l_predicatedallcolumnssumbench0_0) throws Throwable {
long realTime = 0;
long operations = 0;
int rnd = (int)System.nanoTime();
int rndMask = startRndMask;
long time = 0;
int currentStride = 0;
do {
rnd = (rnd * 1664525 + 1013904223);
boolean sample = (rnd & rndMask) == 0;
if (sample) {
time = System.nanoTime();
}
for (int b = 0; b < batchSize; b++) {
if (control.volatileSpoiler) return;
blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable());
}
if (sample) {
buffer.add((System.nanoTime() - time) / opsPerInv);
if (currentStride++ > targetSamples) {
buffer.half();
currentStride = 0;
rndMask = (rndMask << 1) + 1;
}
}
operations++;
} while(!control.isDone);
startRndMask = Math.max(startRndMask, rndMask);
result.realTime = realTime;
result.measuredOps = operations;
}
public BenchmarkTaskResult testColumnTable_SingleShotTime(InfraControl control, ThreadParams threadParams) throws Throwable {
this.benchmarkParams = control.benchmarkParams;
this.iterationParams = control.iterationParams;
this.threadParams = threadParams;
this.notifyControl = control.notifyControl;
if (this.blackhole == null) {
this.blackhole = new Blackhole("Today's password is swordfish. I understand instantiating Blackholes directly is dangerous.");
}
if (threadParams.getSubgroupIndex() == 0) {
PredicatedAllColumnsSumBench_jmhType l_predicatedallcolumnssumbench0_0 = _jmh_tryInit_f_predicatedallcolumnssumbench0_0(control);
control.preSetup();
notifyControl.startMeasurement = true;
RawResults res = new RawResults();
int batchSize = iterationParams.getBatchSize();
testColumnTable_ss_jmhStub(control, res, benchmarkParams, iterationParams, threadParams, blackhole, notifyControl, startRndMask, batchSize, l_predicatedallcolumnssumbench0_0);
control.preTearDown();
if (control.isLastIteration()) {
f_predicatedallcolumnssumbench0_0 = null;
}
int opsPerInv = control.benchmarkParams.getOpsPerInvocation();
long totalOps = opsPerInv;
BenchmarkTaskResult results = new BenchmarkTaskResult(totalOps, totalOps);
results.add(new SingleShotResult(ResultRole.PRIMARY, "testColumnTable", res.getTime(), benchmarkParams.getTimeUnit()));
this.blackhole.evaporate("Yes, I am Stephen Hawking, and know a thing or two about black holes.");
return results;
} else
throw new IllegalStateException("Harness failed to distribute threads among groups properly");
}
public static void testColumnTable_ss_jmhStub(InfraControl control, RawResults result, BenchmarkParams benchmarkParams, IterationParams iterationParams, ThreadParams threadParams, Blackhole blackhole, Control notifyControl, int startRndMask, int batchSize, PredicatedAllColumnsSumBench_jmhType l_predicatedallcolumnssumbench0_0) throws Throwable {
long realTime = 0;
result.startTime = System.nanoTime();
for (int b = 0; b < batchSize; b++) {
if (control.volatileSpoiler) return;
blackhole.consume(l_predicatedallcolumnssumbench0_0.testColumnTable());
}
result.stopTime = System.nanoTime();
result.realTime = realTime;
}
PredicatedAllColumnsSumBench_jmhType f_predicatedallcolumnssumbench0_0;
PredicatedAllColumnsSumBench_jmhType _jmh_tryInit_f_predicatedallcolumnssumbench0_0(InfraControl control) throws Throwable {
if (control.isFailing) throw new FailureAssistException();
PredicatedAllColumnsSumBench_jmhType val = f_predicatedallcolumnssumbench0_0;
if (val == null) {
val = new PredicatedAllColumnsSumBench_jmhType();
val.prepare();
f_predicatedallcolumnssumbench0_0 = val;
}
return val;
}
}
| [
"[email protected]"
] | |
f0b03f09141ca797457b8ea2cd8d624f86d3e87d | 5538ecd8d2ec5850dcc3aea4a71eac5ea21f0444 | /src/BCI/TCPClient.java | 939e2dd1a26e92d99227b0894c12ead38de0a7be | [] | no_license | macc-n/BCI-Tello-Java-Client | 43c76e5bd161d64da8553e7deedb9888468e0ebb | dd524d42cdac94a336b62e0975e30963f3f7e2ed | refs/heads/master | 2020-08-06T12:47:45.279624 | 2019-10-05T10:23:02 | 2019-10-05T10:23:02 | 212,980,679 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,276 | java | package BCI;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
public class TCPClient {
private Socket clientSocket;
private String address;
private int port;
private boolean socketIsClosed = false;
private static final char stopChar = ';';
public TCPClient(String address, int port) {
try {
this.address = address;
this.port = port;
this.clientSocket = new Socket(address, port);
} catch (IOException e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
}
public void sendToServer(String message) {
try {
if (socketIsClosed) {
this.clientSocket = new Socket(address, port);
}
DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());
outToServer.writeBytes(message + stopChar);
} catch (IOException e) {
e.printStackTrace();
}
}
public void closeSocket() {
try {
clientSocket.close();
socketIsClosed = true;
} catch (IOException e) {
System.err.println(e.getMessage());
e.printStackTrace();
}
}
} | [
"[email protected]"
] | |
2e9d8c5e9ae3f3bd0a28456a17d325c1fd4b61ea | 81c700c2c62d07b01392706f6e36a7fb9d95d657 | /backend/auth/src/main/java/com/samuel/urlshortener/core/usecase/UseCase.java | 63a32bb677357c51fb3dbb1a166b952b141bb54a | [] | no_license | scys12/urlshortener | babce847fbc58f0cbdfa7a230b17467aba7b0efd | 54d60deb2f54383df48adabcf89c736a37c882cc | refs/heads/main | 2023-06-18T23:58:24.237347 | 2021-07-20T12:36:54 | 2021-07-20T12:36:54 | 296,908,611 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 278 | java | package com.samuel.urlshortener.core.usecase;
public abstract class UseCase<I extends UseCase.InputValues, O extends UseCase.OutputValues> {
public abstract O execute(I input);
public interface InputValues {
}
public interface OutputValues {
}
} | [
"[email protected]"
] | |
e8d1d7368cfbc0003c0b29aeb227f3492f268e4b | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/training/com/google/cloud/DateTest.java | 08e4a2c145ab3fd9d082a988c44dc0c85b377755 | [] | no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 3,187 | java | /**
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud;
import com.google.common.testing.EqualsTester;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/**
* Unit tests for {@link Date}.
*/
@RunWith(JUnit4.class)
public class DateTest {
private static final SimpleDateFormat SIMPLE_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
@Test
public void parseDate() {
Date date = Date.parseDate("2016-09-18");
assertThat(date.getYear()).isEqualTo(2016);
assertThat(date.getMonth()).isEqualTo(9);
assertThat(date.getDayOfMonth()).isEqualTo(18);
}
@Test
public void testToString() {
Date date = Date.fromYearMonthDay(10, 9, 5);
assertThat(date.toString()).isEqualTo("0010-09-05");
date = Date.fromYearMonthDay(2016, 12, 31);
assertThat(date.toString()).isEqualTo("2016-12-31");
date = Date.fromYearMonthDay(1, 1, 1);
assertThat(date.toString()).isEqualTo("0001-01-01");
}
@Test
public void equalAndHashCode() {
Date d1 = Date.fromYearMonthDay(2016, 9, 18);
Date d2 = Date.fromYearMonthDay(2016, 9, 18);
Date d3 = Date.fromYearMonthDay(2016, 9, 19);
EqualsTester tester = new EqualsTester();
tester.addEqualityGroup(d1, d2);
tester.addEqualityGroup(d3);
}
@Test
public void validOrdering() {
Date d1 = Date.fromYearMonthDay(2016, 9, 18);
Date d2 = Date.fromYearMonthDay(2016, 9, 19);
Date d3 = Date.fromYearMonthDay(2016, 9, 20);
Date d4 = Date.fromYearMonthDay(2016, 10, 1);
Date d5 = Date.fromYearMonthDay(2017, 1, 1);
assertDescending(d5, d4, d3, d2, d1);
}
@Test
public void serialization() {
reserializeAndAssert(Date.fromYearMonthDay(2017, 4, 20));
}
@Test
public void testToJavaUtilDate() throws ParseException {
Date gcDate = Date.parseDate("2016-09-18");
java.util.Date juDate1 = DateTest.SIMPLE_DATE_FORMAT.parse("2016-09-18");
java.util.Date juDate2 = Date.toJavaUtilDate(gcDate);
assertThat(juDate1).isEqualTo(juDate2);
}
@Test
public void testFromJavaUtilDate() throws ParseException {
java.util.Date juDate = DateTest.SIMPLE_DATE_FORMAT.parse("2016-09-18");
Date gcDate = Date.fromJavaUtilDate(juDate);
assertThat(gcDate.getYear()).isEqualTo(2016);
assertThat(gcDate.getMonth()).isEqualTo(9);
assertThat(gcDate.getDayOfMonth()).isEqualTo(18);
}
}
| [
"[email protected]"
] | |
22c58271ba582541268a3fd15b3b348d6ac85511 | 0e1e63bc2b0baf7f3379d873760a873e54fbd8e2 | /src/main/java/wang/huaichao/io/ExcelUtils.java | c4edff3a7d3caab6840feb258366f69abc4a25ae | [] | no_license | doodlecoge/tools4j | ab3818a235b58df22ccde10e7a285b7c84c37407 | febb8ddbb86239324a8835e98337aba63fdb88ce | refs/heads/master | 2021-01-23T20:12:56.277135 | 2015-03-13T06:01:32 | 2015-03-13T06:01:32 | 30,222,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,591 | java | package wang.huaichao.io;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
/**
* Created by Administrator on 2015/2/27.
*/
public class ExcelUtils {
public static void main(String[] args) throws IOException, BiffException, WriteException {
String oldfile = "e:\\tmp\\disc.xls";
String newfile = "e:\\tmp\\disc2.xls";
Workbook oldbook = Workbook.getWorkbook(new File(oldfile));
Sheet oldsheet = oldbook.getSheet(0);
WritableWorkbook newbook = Workbook.createWorkbook(new File(newfile));
WritableSheet newsheet = newbook.createSheet("xxx", 0);
int rows = oldsheet.getRows();
int cols = oldsheet.getColumns();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
String contents = oldsheet.getCell(j, i).getContents();
newsheet.addCell(new Label(j, i, contents));
}
if (i == 0) continue;
newsheet.addCell(new Label(cols, i, getType(
Integer.valueOf(oldsheet.getCell(2, i).getContents()),
Integer.valueOf(oldsheet.getCell(3, i).getContents()),
Integer.valueOf(oldsheet.getCell(4, i).getContents()),
Integer.valueOf(oldsheet.getCell(5, i).getContents())
)));
}
newbook.write();
newbook.close();
}
private static class KV {
public char k;
public int v;
public KV(char k, int v) {
this.k = k;
this.v = v;
}
}
public static String getType(int d, int i, int s, int c) {
final ArrayList<KV> kvs = new ArrayList<KV>();
if (d > 1) kvs.add(new KV('d', d));
if (i > 0) kvs.add(new KV('i', i));
if (s > 0) kvs.add(new KV('s', s));
if (c > -2) kvs.add(new KV('c', c));
if (kvs.size() == 0) return "-";
Collections.sort(kvs, new Comparator<KV>() {
@Override
public int compare(KV o1, KV o2) {
return o2.v - o1.v;
}
});
String ret = "";
ret += kvs.get(0).k;
if (kvs.size() > 1)
ret += kvs.get(1).k;
return ret;
}
}
| [
"[email protected]"
] | |
0d32239ce4254f620bdd22d23dae51d551abe2c2 | 859afa584f3def2f5da1de60048665ef7c54d87a | /car-repair/web-app/src/main/java/com/epam/brest/summer/courses2019/web_app/HelloController.java | 756a7db69d8341944b0f834a15940e667d5ff39d | [
"Apache-2.0"
] | permissive | brest-java-course-summer-2019/ihnat-misiyuk | 4b99009e83b039b3318ef8b258a4c7bdeb2aafff | a188f841c969b490570e0e124b5d0212fcad2141 | refs/heads/master | 2022-12-28T23:04:00.612544 | 2019-09-05T15:29:34 | 2019-09-05T15:29:34 | 191,216,112 | 0 | 0 | Apache-2.0 | 2022-12-16T05:02:50 | 2019-06-10T17:38:41 | JavaScript | UTF-8 | Java | false | false | 592 | java | package com.epam.brest.summer.courses2019.web_app;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* Hello MVC controller.
*/
@Controller
public class HelloController {
@GetMapping(value = "/hello")
public String hello(@RequestParam(value = "name", required = false, defaultValue = "World") String name,
Model model) {
model.addAttribute("name", name);
return "hello";
}
} | [
"[email protected]"
] | |
ca217f49e0576716aa81d08136d25e7b98bd8d17 | ec09a8a03a309439a68d15d8dec650e9c51a3ea4 | /src/main/java/com/mercury/SpringBootRestDemo/bean/Sample.java | 7044797dd3e613ff17a963f74b3e50898c4cd72d | [] | no_license | Rainie16/SpringBootRestDemo | e1abd152fb40bb3432b3be8740a00681a68a5f90 | 3add005080ca8dc6823b0ed020ab3a878efbbd3d | refs/heads/master | 2023-08-22T06:25:51.327619 | 2021-10-17T18:44:27 | 2021-10-17T18:44:27 | 418,213,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | package com.mercury.SpringBootRestDemo.bean;
public class Sample {
private String name;
private int age;
public Sample() {
}
public Sample(String name, int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
@Override
public String toString() {
return "Sample{" +
"name='" + name + '\'' +
", age=" + age +
'}';
}
}
| [
"[email protected]"
] | |
df6785bf2cb83235476455a99cd4d51cda9a80f3 | 709ffb56ca435adfe28b4c94b7c690350e8e1765 | /src/gui/ReceiveThread.java | 2da4faad646455db0ff9afd2e24d92dd085a53f0 | [] | no_license | Christopherfer/ChatApp | 06fb951a5cbc46748e1d9e3eeff3e0950329be5a | b02443ab6e80a0f2a277926d2580126847493580 | refs/heads/master | 2016-09-16T15:53:10.473512 | 2013-08-20T12:33:18 | 2013-08-20T12:33:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 502 | java | package gui;
import java.io.IOException;
import net.Client;
public class ReceiveThread extends Thread {
private Client client;
private ChatAppWindow chatAppWindow;
public ReceiveThread(Client client, ChatAppWindow chatAppWindow){
this.client = client;
this.chatAppWindow = chatAppWindow;
}
@Override
public void run(){
try{
while(true){
String words = client.receiveMessage();
chatAppWindow.setTextArea(words);
}
}catch(IOException e){
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
fda22c9a163bead31d41f153d6353afecf11c6c8 | 035db371d9454d458e1a4fdcda8e22e440cda0e0 | /app/src/main/java/com/jiefanproj/android/embutton_master2/data/PageDbManager.java | 17da9fe93667ed58ededdddca49e39757c99d121 | [] | no_license | Nafeij/NUSH-icode-proj | 2dbfec1dc15edd2a0deb49c76dda34707d7b0ff4 | ee127bdf3afcff7acbee6e4b1acb298930f712c5 | refs/heads/master | 2021-04-06T00:22:49.837752 | 2016-07-11T13:07:48 | 2016-07-11T13:07:48 | 62,054,785 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,882 | java | package com.jiefanproj.android.embutton_master2.data;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;
import java.util.ArrayList;
import java.util.List;
import com.jiefanproj.android.embutton_master2.AppConstants;
import com.jiefanproj.android.embutton_master2.model.Page;
import com.jiefanproj.android.embutton_master2.model.PageAction;
import com.jiefanproj.android.embutton_master2.model.PageChecklist;
import com.jiefanproj.android.embutton_master2.model.PageItem;
import com.jiefanproj.android.embutton_master2.model.PageStatus;
import com.jiefanproj.android.embutton_master2.model.PageTimer;
/**
* v 2.0.1
*/
public class PageDbManager {
private static final String TAG = PageDbManager.class.getSimpleName();
private static final String TABLE_PAGE = "page_table";
private static final String PAGE_ID = "page_id";
private static final String PAGE_LANGUAGE = "page_language";
private static final String PAGE_TYPE = "page_type";
private static final String PAGE_TITLE = "page_title";
private static final String PAGE_INTRODUCTION = "page_introduction";
private static final String PAGE_WARNING = "page_warning";
private static final String PAGE_COMPONENT = "page_component";
private static final String PAGE_CONTENT = "page_content";
private static final String PAGE_SUCCESS_ID = "page_success_id";
private static final String PAGE_FAILED_ID = "page_failed_id";
private static final String PAGE_HEADING = "page_heading";
private static final String PAGE_SECTION_ORDER = "page_section_order";
private static final String CREATE_TABLE_WIZARD_PAGE = "create table " + TABLE_PAGE + " ( "
+ AppConstants.TABLE_PRIMARY_KEY + " integer primary key autoincrement, " + PAGE_ID + " text, " + PAGE_LANGUAGE + " text, "
+ PAGE_TYPE + " text, " + PAGE_TITLE + " text, " + PAGE_INTRODUCTION + " text, " + PAGE_WARNING + " text, " + PAGE_COMPONENT + " text, "
+ PAGE_CONTENT + " text, " + PAGE_SUCCESS_ID + " text, " + PAGE_FAILED_ID + " text, " + PAGE_HEADING + " text, " + PAGE_SECTION_ORDER + " text);";
private static final String INSERT_SQL = "insert into " + TABLE_PAGE + " (" + PAGE_ID + ", " + PAGE_LANGUAGE + ", " + PAGE_TYPE + ", "
+ PAGE_TITLE + ", " + PAGE_INTRODUCTION + ", " + PAGE_WARNING + ", " + PAGE_COMPONENT + ", " + PAGE_CONTENT + ", " + PAGE_SUCCESS_ID
+ ", " + PAGE_FAILED_ID + ", " + PAGE_HEADING + ", " + PAGE_SECTION_ORDER + ") values (?,?,?,?,?,?,?,?,?,?,?,?)";
public static void createTable(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE_WIZARD_PAGE);
}
public static void dropTable(SQLiteDatabase db) {
db.execSQL("DROP TABLE IF EXISTS " + TABLE_PAGE);
}
public static long insert(SQLiteDatabase db, Page page) throws SQLException {
SQLiteStatement insertStatement = db.compileStatement(INSERT_SQL);
if(page.getId() != null)
insertStatement.bindString(1, page.getId());
if(page.getLang() != null)
insertStatement.bindString(2, page.getLang());
if(page.getType() != null)
insertStatement.bindString(3, page.getType());
if(page.getTitle() != null)
insertStatement.bindString(4, page.getTitle());
if(page.getIntroduction() != null)
insertStatement.bindString(5, page.getIntroduction());
if(page.getWarning() != null)
insertStatement.bindString(6, page.getWarning());
if(page.getComponent() != null)
insertStatement.bindString(7, page.getComponent());
if(page.getContent() != null)
insertStatement.bindString(8, page.getContent());
if(page.getSuccessId() != null)
insertStatement.bindString(9, page.getSuccessId());
if(page.getFailedId() != null)
insertStatement.bindString(10, page.getFailedId());
if(page.getHeading() != null)
insertStatement.bindString(11, page.getHeading());
if(page.getSectionOrder() != null)
insertStatement.bindString(12, page.getSectionOrder());
return insertStatement.executeInsert();
}
public static Page retrieve(SQLiteDatabase db, String pageId, String lang) throws SQLException {
Page page = null;
Cursor c = db.query(TABLE_PAGE, null, PAGE_ID + "=? AND " + PAGE_LANGUAGE + "=?", new String[]{pageId, lang}, null, null, null);
if (c != null && c.getCount() > 0) {
c.moveToFirst();
String pageType = c.getString(c.getColumnIndex(PAGE_TYPE));
String pageTitle = c.getString(c.getColumnIndex(PAGE_TITLE));
String pageIntro = c.getString(c.getColumnIndex(PAGE_INTRODUCTION));
String pageWarning = c.getString(c.getColumnIndex(PAGE_WARNING));
String pageComponent = c.getString(c.getColumnIndex(PAGE_COMPONENT));
String pageContent = c.getString(c.getColumnIndex(PAGE_CONTENT));
String successId = c.getString(c.getColumnIndex(PAGE_SUCCESS_ID));
String failedId = c.getString(c.getColumnIndex(PAGE_FAILED_ID));
String heading = c.getString(c.getColumnIndex(PAGE_HEADING));
String secOrder = c.getString(c.getColumnIndex(PAGE_SECTION_ORDER));
List<PageStatus> statusList = PageStatusDbManager.retrieve(db, pageId, lang);
List<PageAction> actionList = PageActionDbManager.retrieve(db, pageId, lang);
List<PageItem> itemList = PageItemDbManager.retrieve(db, pageId, lang);
PageTimer timer = PageTimerDbManager.retrieve(db, pageId, lang);
List<PageChecklist> checkList = PageChecklistDbManager.retrieve(db, pageId, lang);
page = new Page(pageId, lang, pageType, pageTitle, pageIntro, pageWarning, pageComponent, statusList, actionList,
itemList, pageContent, timer, successId, failedId, checkList, heading, secOrder);
}
c.close();
return page;
}
public static List<Page> retrieve(SQLiteDatabase db, String lang) throws SQLException {
List<Page> pageList = new ArrayList<Page>();
Cursor c = db.query(TABLE_PAGE, null, PAGE_LANGUAGE + "=?", new String[]{lang}, null, null, null);
if (c != null && c.getCount() > 0) {
c.moveToFirst();
while (!c.isAfterLast()) {
String pageId = c.getString(c.getColumnIndex(PAGE_ID));
String pageType = c.getString(c.getColumnIndex(PAGE_TYPE));
String pageTitle = c.getString(c.getColumnIndex(PAGE_TITLE));
String pageIntro = c.getString(c.getColumnIndex(PAGE_INTRODUCTION));
String pageWarning = c.getString(c.getColumnIndex(PAGE_WARNING));
String pageComponent = c.getString(c.getColumnIndex(PAGE_COMPONENT));
String pageContent = c.getString(c.getColumnIndex(PAGE_CONTENT));
String successId = c.getString(c.getColumnIndex(PAGE_SUCCESS_ID));
String failedId = c.getString(c.getColumnIndex(PAGE_FAILED_ID));
String heading = c.getString(c.getColumnIndex(PAGE_HEADING));
String secOrder = c.getString(c.getColumnIndex(PAGE_SECTION_ORDER));
List<PageStatus> statusList = PageStatusDbManager.retrieve(db, pageId, lang);
List<PageAction> actionList = PageActionDbManager.retrieve(db, pageId, lang);
List<PageItem> itemList = PageItemDbManager.retrieve(db, pageId, lang);
PageTimer timer = PageTimerDbManager.retrieve(db, pageId, lang);
List<PageChecklist> checkList = PageChecklistDbManager.retrieve(db, pageId, lang);
Page page = new Page(pageId, lang, pageType, pageTitle, pageIntro, pageWarning, pageComponent,
statusList, actionList, itemList, pageContent, timer, successId, failedId, checkList, heading, secOrder);
pageList.add(page);
c.moveToNext();
}
}
c.close();
return pageList;
}
public static long update(SQLiteDatabase db, Page page) throws SQLException {
ContentValues cv = new ContentValues();
cv.put(PAGE_TYPE, page.getType());
cv.put(PAGE_TITLE, page.getTitle());
cv.put(PAGE_INTRODUCTION, page.getIntroduction());
cv.put(PAGE_WARNING, page.getWarning());
cv.put(PAGE_COMPONENT, page.getComponent());
cv.put(PAGE_CONTENT, page.getContent());
cv.put(PAGE_SUCCESS_ID, page.getSuccessId());
cv.put(PAGE_FAILED_ID, page.getFailedId());
cv.put(PAGE_HEADING, page.getHeading());
cv.put(PAGE_SECTION_ORDER, page.getSectionOrder());
return db.update(TABLE_PAGE, cv, PAGE_ID + "=? AND " + PAGE_LANGUAGE + "=?", new String[]{page.getId(), page.getLang()});
}
public static boolean isExist(SQLiteDatabase db, String pageId, String lang) throws SQLException {
boolean itemExist = false;
Cursor c = db.query(TABLE_PAGE, null, PAGE_ID + "=? AND " + PAGE_LANGUAGE + "=?", new String[]{pageId, lang}, null, null, null);
if ((c != null) && (c.getCount() > 0)) {
itemExist = true;
}
c.close();
return itemExist;
}
public static void insertOrUpdate(SQLiteDatabase db, Page page){
if(isExist(db, page.getId(), page.getLang())){
update(db, page);
}
else{
insert(db, page);
}
}
public static int delete(SQLiteDatabase db, String pageId, String lang){
return db.delete(TABLE_PAGE, PAGE_ID + "=? AND " + PAGE_LANGUAGE + "=?", new String[]{pageId, lang});
}
}
| [
"[email protected]"
] | |
ae7bceffc7abaebc45ace505c293a1028b26bb92 | 86fa729606d159d001f299151610ea036e2460a8 | /app/src/main/java/cn/com/broadlink/blappsdkdemo/data/RmStbProviderInfoResult.java | 57e66de149ed246eb867750d2bcd1c4077342c5d | [] | no_license | ibroadlink/APPSDK_Android_Demo | d27e04d652fc5c7141fd50f21b369dcaae9ec08a | f8db69151820d9ea94096371fbac36a55962c388 | refs/heads/master | 2021-07-13T13:32:10.669618 | 2020-05-21T07:20:47 | 2020-05-21T07:20:47 | 140,553,214 | 10 | 5 | null | null | null | null | UTF-8 | Java | false | false | 748 | java | package cn.com.broadlink.blappsdkdemo.data;
import java.util.ArrayList;
import java.util.List;
public class RmStbProviderInfoResult extends BaseResult{
private RespbodyBean respbody = new RespbodyBean();
public RespbodyBean getRespbody() {
return respbody;
}
public void setRespbody(RespbodyBean respbody) {
this.respbody = respbody;
}
public List<RmStbProviderInfo> getProviderinfo() {
return respbody.getProviderinfo();
}
public static class RespbodyBean {
private List<RmStbProviderInfo> providerinfo = new ArrayList<>();
public List<RmStbProviderInfo> getProviderinfo() {
return providerinfo;
}
public void setProviderinfo(List<RmStbProviderInfo> providerinfo) {
this.providerinfo = providerinfo;
}
}
}
| [
"[email protected]"
] | |
712f1c343d6bd43b7928cf13777c8d42a2cfbbdc | 718bbc09370691f7564220d82bc3a735b61ed089 | /src/test/java/com/itexpt/seltest/test/DriverUtls.java | 531e9b3be83661266bcbdba43270cdc0ca802ca1 | [] | no_license | yabanakh/MySelPrg2 | f9e6b23676af325a1058211f62a52cca3f4f9000 | a079bdca6cca43f87cc1e42e6c870a4ac30090f0 | refs/heads/master | 2020-12-22T02:00:08.210103 | 2020-01-28T01:51:04 | 2020-01-28T01:51:04 | 236,636,730 | 0 | 0 | null | 2020-10-13T19:06:53 | 2020-01-28T01:47:42 | Java | UTF-8 | Java | false | false | 765 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.itexpt.seltest.test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
/**
*
* @author yaban
*/
public class DriverUtls {
public static WebDriver getChromeDriver(){
System.setProperty("webdriver.chrome.driver", "c:\\qa\\drivers\\chromedriver.exe");
DesiredCapabilities capabilities=DesiredCapabilities.chrome();
return new ChromeDriver(capabilities);
}
public static void main (String[] args){
getChromeDriver();
}
}
| [
"[email protected]"
] | |
8d31b6e635924055e45ecdb46b5af7b65b08e9bc | 683357e10855417d77c9ca24c889b8e20cb50510 | /core/src/main/java/com/karltech/tpk/core/service/FixExpenseServiceImpl.java | d914cd0f53b35804f2e77cb9772346d6ca49e077 | [] | no_license | chuquockhanh/tpkwhm | 49852487637ba1a51712b55d57bcd580811fec9a | 54b2bbec37592f5be29802dad9c7e3e796b92bdb | refs/heads/master | 2021-01-10T13:03:56.086654 | 2015-10-13T15:41:26 | 2015-10-13T15:41:26 | 44,185,475 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,687 | java | package com.karltech.tpk.core.service;
import com.karltech.tpk.core.dao.FixExpenseDAO;
import com.karltech.tpk.core.dao.GenericDAO;
import com.karltech.tpk.core.domain.FixExpense;
import com.karltech.tpk.core.dto.FixExpenseBean;
import com.karltech.tpk.core.exception.DuplicateException;
import com.karltech.tpk.core.exception.ObjectNotFoundException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class FixExpenseServiceImpl extends GenericServiceImpl<FixExpense,Long>
implements FixExpenseService {
protected final Log logger = LogFactory.getLog(getClass());
private FixExpenseDAO fixExpenseDAO;
public void setFixExpenseDAO(FixExpenseDAO fixExpenseDAO) {
this.fixExpenseDAO = fixExpenseDAO;
}
@Override
protected GenericDAO<FixExpense, Long> getGenericDAO() {
return fixExpenseDAO;
}
@Override
public void updateItem(FixExpenseBean colourBean) throws ObjectNotFoundException, DuplicateException {
FixExpense dbItem = this.fixExpenseDAO.findByIdNoAutoCommit(colourBean.getPojo().getFixExpenseID());
if (dbItem == null) throw new ObjectNotFoundException("Not found FixExpense " + colourBean.getPojo().getFixExpenseID());
FixExpense pojo = colourBean.getPojo();
this.fixExpenseDAO.detach(dbItem);
this.fixExpenseDAO.update(pojo);
}
@Override
public void addNew(FixExpenseBean colourBean) throws DuplicateException {
FixExpense pojo = colourBean.getPojo();
pojo = this.fixExpenseDAO.save(pojo);
colourBean.setPojo(pojo);
}
@Override
public Integer deleteItems(String[] checkList) {
Integer res = 0;
if (checkList != null && checkList.length > 0) {
res = checkList.length;
for (String id : checkList) {
fixExpenseDAO.delete(Long.parseLong(id));
}
}
return res;
}
@Override
public Object[] search(FixExpenseBean bean) {
Map<String, Object> properties = new HashMap<String, Object>();
if (StringUtils.isNotBlank(bean.getPojo().getName())) {
properties.put("name", bean.getPojo().getName());
}
return this.fixExpenseDAO.searchByProperties(properties, bean.getFirstItem(), bean.getMaxPageItems(), bean.getSortExpression(), bean.getSortDirection(), true);
}
@Override
public List<FixExpense> findAllByOrder(String name) {
return this.fixExpenseDAO.findAllByOrder(name);
}
} | [
"[email protected]"
] | |
f01123e17ddfa6a9876b59bce9219a879885ab6a | d323a6ac79df1047e9f68177232784ff7dc3b6d3 | /spring-boot-security-jwt-auth-mongodb-master/src/main/java/com/knf/dev/response/JwtResponse.java | 70f834db6e75b389e0547e94cdc73b3d250342a4 | [] | no_license | sandakelum00/KnowledgeFactory | 1999c156a335ae2f63ff5f1e0309df8a1337d855 | 6ea7c713a9730c58b57a3b129168f45a5d440cb3 | refs/heads/master | 2023-04-18T06:13:05.395476 | 2021-02-12T17:20:56 | 2021-02-12T17:20:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,154 | java | package com.knf.dev.response;
import java.util.List;
public class JwtResponse {
private String token;
private String type = "Bearer";
private String id;
private String employeename;
private String email;
private List<String> roles;
public JwtResponse(String accessToken, String id, String employeename, String email, List<String> roles) {
this.token = accessToken;
this.id = id;
this.employeename = employeename;
this.email = email;
this.roles = roles;
}
public String getAccessToken() {
return token;
}
public void setAccessToken(String accessToken) {
this.token = accessToken;
}
public String getTokenType() {
return type;
}
public void setTokenType(String tokenType) {
this.type = tokenType;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getEmployeename() {
return employeename;
}
public void setEmployeename(String employeename) {
this.employeename = employeename;
}
public List<String> getRoles() {
return roles;
}
}
| [
"[email protected]"
] | |
29f2b08c5ecf8a2087a6f72207aea0ceca1dca12 | b7910e40356c56c733b1a63484cc94dcc7426320 | /io/src/file/object/ObjectOutputStreamDemo1.java | 6b6430f42285b6f8ee7f0fa9ad3d6156bd179b66 | [] | no_license | jinhn/java_study | ffb748caf9d3704c16ba1d2f4d957d09ae7ce84a | 767c2ddb084ac911cbff7c8fbfd1cf28da94d5f0 | refs/heads/master | 2020-06-14T20:13:08.421228 | 2016-12-16T06:42:04 | 2016-12-16T06:42:04 | 75,351,691 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 793 | java | package file.object;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
public class ObjectOutputStreamDemo1 {
public static void main(String[] args) throws Exception{
Account account = new Account();
account.setName("ํ๊ธธ๋");
account.setAccNumber("111-222-333-4444");
account.setBalance(100000000);
// Rate ํด๋์ค๊ฐ ์ง๋ ฌํ ๋์ด์์ง ์์ผ๋ฉด
// NotSerializableException ๋ฐ์
Rate rate = new Rate();
rate.setMonth(0.03);
rate.setYear(0.3);
account.setRate(rate);
FileOutputStream fos = new FileOutputStream("account.sav");
ObjectOutputStream oos = new ObjectOutputStream(fos);
/*
* Account๊ฐ์ฒด๋ฅผ ์ง๋ ฌํํด์ FileOutputStream์ผ๋ก ํ๋ ค๋ณด๋ธ๋ค.
*/
oos.writeObject(account);
oos.close();
}
} | [
"[email protected]"
] | |
2d7e7cea2a824aab472f6d1414ea15a123d5e157 | d2fc5d5ad6ac340ae4e0004623d743c8d92d1f74 | /simplemad-android/src/main/java/com/simplemad/android/service/UserAccountServiceImpl.java | bd9b36fb12f2e182ea1effb4e1f87abe1fcf5944 | [] | no_license | MichaelScofield1/android-client | a033d34553a11bf500b2bdf0a66ebc7fe9e07d11 | d3501a3424312e921df5960d443f4e29cd792e20 | refs/heads/master | 2016-09-06T12:26:57.201688 | 2012-04-12T17:13:49 | 2012-04-12T17:13:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,242 | java | package com.simplemad.android.service;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.simplemad.android.SimpleMadApp;
import com.simplemad.android.client.ClientUtil;
import com.simplemad.android.client.TimerManager;
import com.simplemad.android.dao.UserAccountDAO;
import com.simplemad.android.dao.UserAccountDAOImpl;
import com.simplemad.bean.MessageType;
import com.simplemad.bean.Timer;
import com.simplemad.bean.UserAccount;
import com.simplemad.parameter.ClientParameter;
public class UserAccountServiceImpl implements UserAccountService {
private static final String PASSWORD = "password";
private static final String MOBILE = "mobile";
private UserAccountDAO userAccountDao;
private static UserAccountService instance;
private UserAccount userAccount;
private UserService userService;
private UserAccountServiceImpl() {
userAccountDao = new UserAccountDAOImpl();
userService = UserServiceImpl.instance();
}
public static synchronized UserAccountService instance() {
if(instance == null)
instance = new UserAccountServiceImpl();
return instance;
}
@Override
public UserAccount loadFirstUserAccount() {
return userAccountDao.first();
}
@Override
public boolean loginLocal(UserAccount userAccount, boolean isLoginToServer) {
boolean isLogined = false;
UserAccount loadedLocal = userAccountDao.find(userAccount.getMobile());
if(isLoginToServer) {
if(loadedLocal == null) {
/*if login to the server, do the following*/
loadedLocal = userAccount;
loadedLocal.setLogined(true);
loadedLocal.setLoginTime(new Date());
isLogined = userAccountDao.add(loadedLocal);
userService.setMobile(loadedLocal.getMobile());
userService.create();
} else {
loadedLocal.setLogined(true);
loadedLocal.setLoginTime(new Date());
isLogined = userAccountDao.update(loadedLocal);
}
} else {
if(loadedLocal == null) {
isLogined = false;
} else {
if(loadedLocal.getPassword().equals(userAccount.getPassword())) {
loadedLocal.setLogined(true);
loadedLocal.setLoginTime(new Date());
isLogined = userAccountDao.update(loadedLocal);
} else {
isLogined = false;
}
}
}
if(isLogined) {
userService.setMobile(loadedLocal.getMobile());
// if(isLoginToServer) {
// userService.synchronizedUser();
// }
this.userAccount = loadedLocal;
}
return isLogined;
}
@Override
public boolean loginRemote(UserAccount userAccount) {
if(this.userAccount == null) {
userAccount.setLogined(false);
} else if(this.userAccount.getMobile() != userAccount.getMobile()) {
userAccount.setLogined(false);
}
if(userAccount.isLogined()) {
userService.setMobile(userAccount.getMobile());
this.userAccount = userAccount;
return true;
}
try {
TimerManager.setTimer(ClientUtil.doGet(ClientParameter.TIMER, Timer.class));
} catch (IOException e) {
e.printStackTrace();
}
return loginToServer(userAccount);
}
/**
@Override
public boolean login(UserAccount userAccount) {
boolean isLogined = false;
System.out.println("UserAccountService userAccount.isLogined():" + userAccount.isLogined());
if(this.userAccount == null) {
userAccount.setLogined(false);
} else if(this.userAccount.getMobile() != userAccount.getMobile()) {
userAccount.setLogined(false);
}
if(userAccount.isLogined()) {
userService.setMobile(userAccount.getMobile());
this.userAccount = userAccount;
return true;
}
boolean isLogin = loginToServer(userAccount);
userAccount.setLogined(true);
System.out.println("UserAccountService loginToServer:" + isLogin);
UserAccount loadedLocal = userAccountDao.find(userAccount.getMobile());
if(!isLogin) {
isLogined = false;
} else {
if(loadedLocal == null) {
//f login to the server, do the following
userAccount.setLoginTime(new Date());
isLogined = userAccountDao.add(userAccount);
userService.setMobile(userAccount.getMobile());
userService.create();
} else {
userAccount.setLoginTime(new Date());
isLogined = userAccountDao.update(userAccount);
}
}
if(isLogined) {
logout();
userService.setMobile(userAccount.getMobile());
userService.synchronizedUser();
this.userAccount = userAccount;
}
return isLogined;
}
*/
private boolean loginAfterRegister(UserAccount userAccount) {
UserAccount loadedLocal = userAccountDao.find(userAccount.getMobile());
if(loadedLocal == null) {
return false;
}
userService.setMobile(loadedLocal.getMobile());
userService.create();
// userService.synchronizedUser();
this.userAccount = loadedLocal;
return true;
}
private boolean notNeedLoginToServer(UserAccount userAccount) {
if(SimpleMadApp.DEBUG_MODE) {
return true;
}
if(!SimpleMadApp.instance().isInNetwork()) {
return true;
} else {
return false;
}
}
private boolean loginToServer(UserAccount userAccount) {
if(notNeedLoginToServer(userAccount)) {
return true;
}
Map<String, Object> params = new HashMap<String, Object>();
params.put(MOBILE, userAccount.getMobile());
params.put(PASSWORD, userAccount.getPassword());
/**
try {
ClientUtil.doPost(ClientParameter.USER_LOGIN, params, Boolean.class);
} catch (IOException e) {
e.printStackTrace();
return true;
}
*/
ClientUtil.doSend(MessageType.LOGON, userAccount);
return false;
}
private void logoutToServer(UserAccount userAccount) {
if(SimpleMadApp.DEBUG_MODE) {
return;
}
if(!SimpleMadApp.instance().isInNetwork()) {
return;
}
Map<String, Object> params = new HashMap<String, Object>();
params.put(MOBILE, userAccount.getMobile());
params.put(PASSWORD, userAccount.getPassword());
/**
try {
ClientUtil.doPost(ClientParameter.USER_LOGOUT, params, Boolean.class);
} catch (IOException e) {
e.printStackTrace();
}
*/
ClientUtil.doSend(MessageType.LOGOFF, userAccount);
}
@Override
public boolean logout() {
if(userAccount != null) {
userAccount.setLogined(false);
userAccountDao.update(userAccount);
logoutToServer(userAccount);
}
userAccount = null;
return true;
}
@Override
public List<UserAccount> loadAvaiableUserAccounts() {
return userAccountDao.getAllUserAccountByLoginTime();
}
@Override
public boolean registerRemote(long mobile, String password) {
UserAccount userAccount = new UserAccount();
userAccount.setLoginTime(new Date());
userAccount.setPassword(password);
userAccount.setMobile(mobile);
return registerToServer(userAccount);
}
@Override
public boolean registerLocal(long mobile, String password) {
UserAccount userAccount = new UserAccount();
userAccount.setLoginTime(new Date());
userAccount.setPassword(password);
userAccount.setMobile(mobile);
userAccount.setLogined(true);
userAccountDao.add(userAccount);
return loginAfterRegister(userAccount);
}
private boolean registerToServer(UserAccount userAccount) {
if(SimpleMadApp.DEBUG_MODE) {
return false;
}
if(!SimpleMadApp.instance().isInNetwork()) {
return false;
}
Map<String, Object> params = new HashMap<String, Object>();
params.put(MOBILE, userAccount.getMobile());
params.put(PASSWORD, userAccount.getPassword());
try {
return ClientUtil.doPost(ClientParameter.USER_REGISTER, params, Boolean.class);
} catch (IOException e) {
e.printStackTrace();
return false;
}
}
@Override
public boolean clean(long mobile) {
UserAccount userAccount = new UserAccount();
userAccount.setMobile(mobile);
return userAccountDao.delete(userAccount);
}
@Override
public UserAccount getCurrentUserAccount() {
return userAccount;
}
@Override
public boolean modifyPassword(String newPassword, String oldPassword) {
boolean isModified = modifyPasswordInServer(newPassword, oldPassword);
if(isModified) {
userAccount.setPassword(newPassword);
userAccountDao.update(userAccount);
}
return isModified;
}
private boolean modifyPasswordInServer(String newPassword,
String oldPassword) {
if(SimpleMadApp.DEBUG_MODE) {
return true;
}
if(!SimpleMadApp.instance().isInNetwork()) {
return false;
}
try {
Map<String, Object> params = new HashMap<String, Object>();
params.put("mobile", userAccount.getMobile());
params.put("oldPassword", oldPassword);
params.put("newPassword", newPassword);
return ClientUtil.doPost(ClientParameter.USER_PASSWORD_MODIFY, params, Boolean.class);
} catch(IOException e) {
e.printStackTrace();
return false;
}
}
@Override
public boolean loginrecently() {
userAccount = userAccountDao.first();
userService.setMobile(userAccount.getMobile());
return true;
}
@Override
public boolean reloginRemote() {
if(getCurrentUserAccount() != null) {
UserAccount userAccount = new UserAccount();
userAccount.setLogined(false);
userAccount.setMobile(getCurrentUserAccount().getMobile());
userAccount.setPassword(getCurrentUserAccount().getPassword());
userAccount.setRemLoginStatus(getCurrentUserAccount().isRemLoginStatus());
userAccount.setRemPassword(getCurrentUserAccount().isRemPassword());
return !loginRemote(userAccount);
}
return false;
}
}
| [
"[email protected]"
] | |
601dc5586be3bc56df6a4452f70b95857c45d3b8 | b3a03bbd9380c7b6f7653ac31fe1bb7b7bfadcfe | /src/faq/pagingAction.java | 72bc674aa666b2e0c3eb7cae4561ddc74a6eb081 | [] | no_license | daegyung2/antman | 265b254f2780213659c64c68f5b7455d3f00d486 | 114dbb5be911f0b2f9d0179ec19fe69e7364df89 | HEAD | 2016-08-11T13:55:24.230934 | 2016-01-14T03:29:17 | 2016-01-14T03:29:17 | 47,238,993 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 4,302 | java | package faq;
public class pagingAction {
private int currentPage; // ํ์ฌํ์ด์ง
private int totalCount; // ์ ์ฒด ๊ฒ์๋ฌผ ์
private int totalPage; // ์ ์ฒด ํ์ด์ง ์
private int blockCount; // ํ ํ์ด์ง์ ๊ฒ์๋ฌผ์ ์
private int blockPage; // ํ ํ๋ฉด์ ๋ณด์ฌ์ค ํ์ด์ง ์
private int startCount; // ํ ํ์ด์ง์์ ๋ณด์ฌ์ค ๊ฒ์๊ธ์ ์์ ๋ฒํธ
private int endCount; // ํ ํ์ด์ง์์ ๋ณด์ฌ์ค ๊ฒ์๊ธ์ ๋ ๋ฒํธ
private int startPage; // ์์ ํ์ด์ง
private int endPage; // ๋ง์ง๋ง ํ์ด์ง
private StringBuffer pagingHtml;
// ํ์ด์ง ์์ฑ์
public pagingAction(int currentPage, int totalCount, int blockCount,
int blockPage) {
this.blockCount = blockCount;
this.blockPage = blockPage;
this.currentPage = currentPage;
this.totalCount = totalCount;
// ์ ์ฒด ํ์ด์ง ์
totalPage = (int) Math.ceil((double) totalCount / blockCount);
if (totalPage == 0) {
totalPage = 1;
}
// ํ์ฌ ํ์ด์ง๊ฐ ์ ์ฒด ํ์ด์ง ์๋ณด๋ค ํฌ๋ฉด ์ ์ฒด ํ์ด์ง ์๋ก ์ค์
if (currentPage > totalPage) {
currentPage = totalPage;
}
// ํ์ฌ ํ์ด์ง์ ์ฒ์๊ณผ ๋ง์ง๋ง ๊ธ์ ๋ฒํธ ๊ฐ์ ธ์ค๊ธฐ.
startCount = (currentPage - 1) * blockCount;
endCount = startCount + blockCount - 1;
// ์์ ํ์ด์ง์ ๋ง์ง๋ง ํ์ด์ง ๊ฐ ๊ตฌํ๊ธฐ.
startPage = (int) ((currentPage - 1) / blockPage) * blockPage + 1;
endPage = startPage + blockPage - 1;
// ๋ง์ง๋ง ํ์ด์ง๊ฐ ์ ์ฒด ํ์ด์ง ์๋ณด๋ค ํฌ๋ฉด ์ ์ฒด ํ์ด์ง ์๋ก ์ค์
if (endPage > totalPage) {
endPage = totalPage;
}
// ์ด์ block ํ์ด์ง
pagingHtml = new StringBuffer();
if (currentPage > blockPage) {
pagingHtml.append("<a href=/antman/praiseboard.do?PageNum="
+ (startPage - 1) + ">");
pagingHtml.append("์ด์ ");
pagingHtml.append("</a>");
}
pagingHtml.append(" | ");
//ํ์ด์ง ๋ฒํธ.ํ์ฌ ํ์ด์ง๋ ๋นจ๊ฐ์์ผ๋ก ๊ฐ์กฐํ๊ณ ๋งํฌ๋ฅผ ์ ๊ฑฐ.
for (int i = startPage; i <= endPage; i++) {
if (i > totalPage) {
break;
}
if (i == currentPage) {
pagingHtml.append(" <b> <font size='6' color='blue'>");
pagingHtml.append(i);
pagingHtml.append("</font></b>");
} else {
pagingHtml
.append(" <a href='/antman/praiseboard.do?PageNum=");
pagingHtml.append(i);
pagingHtml.append("'>");
pagingHtml.append(i);
pagingHtml.append("</a>");
}
pagingHtml.append(" ");
}
pagingHtml.append(" | ");
// ๋ค์ block ํ์ด์ง
if (totalPage - startPage >= blockPage) {
pagingHtml.append("<a href=/antman/praiseboard.do?PageNum="
+ (endPage + 1) + ">");
pagingHtml.append("๋ค์");
pagingHtml.append("</a>");
}
}
public int getCurrentPage() {
return currentPage;
}
public void setCurrentPage(int currentPage) {
this.currentPage = currentPage;
}
public int getTotalCount() {
return totalCount;
}
public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getBlockCount() {
return blockCount;
}
public void setBlockCount(int blockCount) {
this.blockCount = blockCount;
}
public int getBlockPage() {
return blockPage;
}
public void setBlockPage(int blockPage) {
this.blockPage = blockPage;
}
public int getStartCount() {
return startCount;
}
public void setStartCount(int startCount) {
this.startCount = startCount;
}
public int getEndCount() {
return endCount;
}
public void setEndCount(int endCount) {
this.endCount = endCount;
}
public int getStartPage() {
return startPage;
}
public void setStartPage(int startPage) {
this.startPage = startPage;
}
public int getEndPage() {
return endPage;
}
public void setEndPage(int endPage) {
this.endPage = endPage;
}
public StringBuffer getPagingHtml() {
return pagingHtml;
}
public void setPagingHtml(StringBuffer pagingHtml) {
this.pagingHtml = pagingHtml;
}
}
| [
"[email protected]"
] | |
3cfc21a2ac3adb0598d913a66a4c794bf9c05e37 | b56a92e25308f0979b1ff12ff04e31d6e3c69e5b | /main/src/test/java/ru/timmson/CompoundInterestCalculatorShould.java | 4d40d20e7dcda4215c8d9bbd6a9e90bd471fbafa | [
"MIT"
] | permissive | timmson/java-engineering-study | 32182e6cd99c4b782ab79805462d222a6420c9ed | 37df3f370f203e8763157e3fd32ef9ff06b64eee | refs/heads/master | 2021-10-20T17:25:44.690412 | 2021-10-16T10:48:18 | 2021-10-16T10:48:18 | 204,785,326 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 709 | java | package ru.timmson;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class CompoundInterestCalculatorShould {
@Test
void giveRevenueByOneYear() {
final var amount = 1000.0;
final var interestRate = 0.05;
final var years = 1;
final double revenue = Calc.convert(amount, interestRate, years);
assertEquals(1050.0, revenue);
}
@Test
void giveRevenueByTwoYear() {
final var amount = 1000.0;
final var interestRate = 0.05;
final var years = 2;
final double revenue = Calc.convert(amount, interestRate, years);
assertEquals(1102.5, revenue);
}
}
| [
"[email protected]"
] | |
32e420cadc2182d7dff337f52efd7150c11815f9 | 5d1fc477b017acc0042fe71b3de463e06d199b50 | /src/main/java/com/happybudui/venuesystem/wrapper/ResponseResult.java | a16df6957229b56b3ff522fc822e09991fd9124a | [
"MIT"
] | permissive | happybuduiorg/venuesystem | 9dda72446a4f7dba1dd0b7977b1913cb8a4dac7a | 4ff22f77c0a1d053c1cab66cbca377cd918d1cd6 | refs/heads/master | 2020-04-09T05:39:49.967012 | 2018-12-04T14:39:52 | 2018-12-04T14:39:52 | 160,068,045 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,358 | java | package com.happybudui.venuesystem.wrapper;
import com.fasterxml.jackson.annotation.JsonInclude;
//CopyRight ยฉ 2018-2018 Happybudui All Rights Reserved.
//Written by Happybudui
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class ResponseResult<T> {
private boolean success;
private int errorcode;
private String message;
private T data;
public ResponseResult() {
}
ResponseResult(boolean success, int errorcode,String message) {
this.success = success;
this.errorcode = errorcode;
this.message = message;
}
ResponseResult(boolean success, int errorcode, String message, T data) {
this.success = success;
this.errorcode = errorcode;
this.message = message;
this.data = data;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public int getErrorcode() {
return errorcode;
}
public void setErrorcode(int errorcode) {
this.errorcode = errorcode;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
}
| [
"[email protected]"
] | |
5e24beb8611b65a0bb2e52b6a98a628012405a78 | 63895b6ec2b1d554cfce92fe83f97874b9a0384a | /BinaryTree/src/_105ConstructBTPreorderInorder.java | 70b7d19df2b79caa02b07fefab1888c20060f0b6 | [] | no_license | Elliiee/CSNotesLT | 31fc8295826a19a937e320eb47f559c2820593e8 | 8bc8bebf923cc8cfbbe66ab2320f0d259e123058 | refs/heads/master | 2022-06-18T17:42:29.970060 | 2020-05-05T04:45:58 | 2020-05-05T04:45:58 | 257,099,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,007 | java | import java.util.HashMap;
public class _105ConstructBTPreorderInorder {
private int preorderFirst;
private int[] preorder;
private int[] inorder;
HashMap<Integer, Integer> inorderIndexMap = new HashMap<>();
public TreeNode buildTree(int[] preorder, int[] inorder) {
this.preorder = preorder;
this.inorder = inorder;
this.preorderFirst = 0;
int inorderIndex = 0;
for (Integer i : inorder){
inorderIndexMap.put(i, inorderIndex++);
}
return buildNode(0, inorder.length - 1);
}
private TreeNode buildNode(int inLeft, int inRight){
if (inLeft > inRight) return null;
int rootVal = preorder[preorderFirst];
TreeNode root = new TreeNode(rootVal);
int inorderRootIndex = inorderIndexMap.get(rootVal);
preorderFirst++;
root.left = buildNode(inLeft, inorderRootIndex - 1);
root.right = buildNode(inorderRootIndex + 1, inRight);
return root;
}
}
| [
"[email protected]"
] | |
2e97d1b00430638594f647c72c6bb13376a66dcb | 5fbf7863d76eab7999b821241115c642c532cd89 | /chrome/android/java/src/org/chromium/chrome/browser/omnibox/suggestions/AutocompleteCoordinatorImpl.java | 7d95d64cbae1cc25be17fb4062fe0e7f2326dc43 | [
"BSD-3-Clause"
] | permissive | klebertarcisio/chromium | cd5675f96c65b00fdad7dbfdfd65109f24482def | 4350a5e68f405a4e8eaf26d92025db55c5681431 | refs/heads/master | 2022-11-07T16:18:06.882020 | 2020-05-27T20:34:40 | 2020-05-27T20:34:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,459 | java | // Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.omnibox.suggestions;
import android.content.Context;
import android.os.Handler;
import android.util.Pair;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.core.view.ViewCompat;
import org.chromium.base.Callback;
import org.chromium.base.supplier.Supplier;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ActivityTabProvider;
import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior;
import org.chromium.chrome.browser.omnibox.UrlBarEditingTextStateProvider;
import org.chromium.chrome.browser.omnibox.suggestions.AutocompleteController.OnSuggestionsReceivedListener;
import org.chromium.chrome.browser.omnibox.suggestions.SuggestionListViewBinder.SuggestionListViewHolder;
import org.chromium.chrome.browser.omnibox.suggestions.answer.AnswerSuggestionViewBinder;
import org.chromium.chrome.browser.omnibox.suggestions.base.BaseSuggestionView;
import org.chromium.chrome.browser.omnibox.suggestions.base.BaseSuggestionViewBinder;
import org.chromium.chrome.browser.omnibox.suggestions.basic.SuggestionViewViewBinder;
import org.chromium.chrome.browser.omnibox.suggestions.editurl.EditUrlSuggestionProcessor;
import org.chromium.chrome.browser.omnibox.suggestions.editurl.EditUrlSuggestionViewBinder;
import org.chromium.chrome.browser.omnibox.suggestions.entity.EntitySuggestionViewBinder;
import org.chromium.chrome.browser.omnibox.suggestions.header.HeaderView;
import org.chromium.chrome.browser.omnibox.suggestions.header.HeaderViewBinder;
import org.chromium.chrome.browser.omnibox.suggestions.tail.TailSuggestionView;
import org.chromium.chrome.browser.omnibox.suggestions.tail.TailSuggestionViewBinder;
import org.chromium.chrome.browser.omnibox.suggestions.tiles.TileSuggestionViewBinder;
import org.chromium.chrome.browser.omnibox.voice.VoiceRecognitionHandler;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.share.ShareDelegate;
import org.chromium.chrome.browser.toolbar.ToolbarDataProvider;
import org.chromium.chrome.browser.util.KeyNavigationUtil;
import org.chromium.components.query_tiles.QueryTile;
import org.chromium.ui.ViewProvider;
import org.chromium.ui.base.WindowAndroid;
import org.chromium.ui.modelutil.LazyConstructionPropertyMcp;
import org.chromium.ui.modelutil.MVCListAdapter;
import org.chromium.ui.modelutil.MVCListAdapter.ModelList;
import org.chromium.ui.modelutil.PropertyModel;
import java.util.ArrayList;
import java.util.List;
/**
* Coordinator that handles the interactions with the autocomplete system.
*/
public class AutocompleteCoordinatorImpl implements AutocompleteCoordinator {
private final ViewGroup mParent;
private OmniboxQueryTileCoordinator mQueryTileCoordinator;
private AutocompleteMediator mMediator;
private OmniboxSuggestionsDropdown mDropdown;
/**
* See {@link AutocompleteCoordinatorFactory#createAutocompleteCoordinator}.
*
* Keep this constructor protected so clients use the factory instead.
*/
@VisibleForTesting
protected AutocompleteCoordinatorImpl(ViewGroup parent, AutocompleteDelegate delegate,
OmniboxSuggestionsDropdown.Embedder dropdownEmbedder,
UrlBarEditingTextStateProvider urlBarEditingTextProvider) {
mParent = parent;
Context context = parent.getContext();
PropertyModel listModel = new PropertyModel(SuggestionListProperties.ALL_KEYS);
MVCListAdapter.ModelList listItems = new MVCListAdapter.ModelList();
mQueryTileCoordinator = new OmniboxQueryTileCoordinator(context, this::onTileSelected);
mMediator = new AutocompleteMediator(context, delegate, urlBarEditingTextProvider,
new AutocompleteController(), mQueryTileCoordinator::setTiles, listModel,
new Handler());
mMediator.initDefaultProcessors();
listModel.set(SuggestionListProperties.EMBEDDER, dropdownEmbedder);
listModel.set(SuggestionListProperties.VISIBLE, false);
listModel.set(SuggestionListProperties.OBSERVER, mMediator);
listModel.set(SuggestionListProperties.SUGGESTION_MODELS, listItems);
ViewProvider<SuggestionListViewHolder> viewProvider =
createViewProvider(context, listItems);
viewProvider.whenLoaded((holder) -> { mDropdown = holder.dropdown; });
LazyConstructionPropertyMcp.create(listModel, SuggestionListProperties.VISIBLE,
viewProvider, SuggestionListViewBinder::bind);
// https://crbug.com/966227 Set initial layout direction ahead of inflating the suggestions.
updateSuggestionListLayoutDirection();
}
@Override
public void destroy() {
mQueryTileCoordinator.destroy();
mQueryTileCoordinator = null;
mMediator.destroy();
mMediator = null;
}
private ViewProvider<SuggestionListViewHolder> createViewProvider(
Context context, MVCListAdapter.ModelList modelList) {
return new ViewProvider<SuggestionListViewHolder>() {
private List<Callback<SuggestionListViewHolder>> mCallbacks = new ArrayList<>();
private SuggestionListViewHolder mHolder;
@Override
public void inflate() {
ViewGroup container = (ViewGroup) ((ViewStub) mParent.getRootView().findViewById(
R.id.omnibox_results_container_stub))
.inflate();
Pair<OmniboxSuggestionsDropdown, MVCListAdapter> dropdownAndAdapter =
OmniboxSuggestionsDropdownFactory.provideDropdownAndAdapter(
context, modelList);
OmniboxSuggestionsDropdown dropdown = dropdownAndAdapter.first;
MVCListAdapter adapter = dropdownAndAdapter.second;
// Start with visibility GONE to ensure that show() is called.
// http://crbug.com/517438
dropdown.getViewGroup().setVisibility(View.GONE);
dropdown.getViewGroup().setClipToPadding(false);
// Register a view type for a default omnibox suggestion.
// Note: clang-format does a bad job formatting lambdas so we turn it off here.
// clang-format off
adapter.registerType(
OmniboxSuggestionUiType.DEFAULT,
parent -> new BaseSuggestionView<View>(
parent.getContext(), R.layout.omnibox_basic_suggestion),
new BaseSuggestionViewBinder<View>(SuggestionViewViewBinder::bind));
adapter.registerType(
OmniboxSuggestionUiType.EDIT_URL_SUGGESTION,
parent -> EditUrlSuggestionProcessor.createView(parent.getContext()),
EditUrlSuggestionViewBinder::bind);
adapter.registerType(
OmniboxSuggestionUiType.ANSWER_SUGGESTION,
parent -> new BaseSuggestionView<View>(
parent.getContext(), R.layout.omnibox_answer_suggestion),
new BaseSuggestionViewBinder<View>(AnswerSuggestionViewBinder::bind));
adapter.registerType(
OmniboxSuggestionUiType.ENTITY_SUGGESTION,
parent -> new BaseSuggestionView<View>(
parent.getContext(), R.layout.omnibox_entity_suggestion),
new BaseSuggestionViewBinder<View>(EntitySuggestionViewBinder::bind));
adapter.registerType(
OmniboxSuggestionUiType.TAIL_SUGGESTION,
parent -> new BaseSuggestionView<TailSuggestionView>(
new TailSuggestionView(parent.getContext())),
new BaseSuggestionViewBinder<TailSuggestionView>(
TailSuggestionViewBinder::bind));
adapter.registerType(
OmniboxSuggestionUiType.CLIPBOARD_SUGGESTION,
parent -> new BaseSuggestionView<View>(
parent.getContext(), R.layout.omnibox_basic_suggestion),
new BaseSuggestionViewBinder<View>(SuggestionViewViewBinder::bind));
adapter.registerType(
OmniboxSuggestionUiType.TILE_SUGGESTION,
parent -> mQueryTileCoordinator.createView(parent.getContext()),
TileSuggestionViewBinder::bind);
adapter.registerType(
OmniboxSuggestionUiType.HEADER,
parent -> new HeaderView(parent.getContext()),
HeaderViewBinder::bind);
// clang-format on
mHolder = new SuggestionListViewHolder(container, dropdown);
for (int i = 0; i < mCallbacks.size(); i++) {
mCallbacks.get(i).onResult(mHolder);
}
mCallbacks = null;
}
@Override
public void whenLoaded(Callback<SuggestionListViewHolder> callback) {
if (mHolder != null) {
callback.onResult(mHolder);
return;
}
mCallbacks.add(callback);
}
};
}
@Override
public void onUrlFocusChange(boolean hasFocus) {
mMediator.onUrlFocusChange(hasFocus);
}
@Override
public void onUrlAnimationFinished(boolean hasFocus) {
mMediator.onUrlAnimationFinished(hasFocus);
}
@Override
public void setToolbarDataProvider(ToolbarDataProvider toolbarDataProvider) {
mMediator.setToolbarDataProvider(toolbarDataProvider);
}
@Override
public void setOverviewModeBehavior(OverviewModeBehavior overviewModeBehavior) {
mMediator.setOverviewModeBehavior(overviewModeBehavior);
}
@Override
public void setAutocompleteProfile(Profile profile) {
mMediator.setAutocompleteProfile(profile);
}
@Override
public void setWindowAndroid(WindowAndroid windowAndroid) {
mMediator.setWindowAndroid(windowAndroid);
}
@Override
public void setActivityTabProvider(ActivityTabProvider provider) {
mMediator.setActivityTabProvider(provider);
}
@Override
public void setShareDelegateSupplier(Supplier<ShareDelegate> shareDelegateSupplier) {
mMediator.setShareDelegateSupplier(shareDelegateSupplier);
}
@Override
public void setShouldPreventOmniboxAutocomplete(boolean prevent) {
mMediator.setShouldPreventOmniboxAutocomplete(prevent);
}
@Override
public int getSuggestionCount() {
return mMediator.getSuggestionCount();
}
@Override
public OmniboxSuggestion getSuggestionAt(int index) {
return mMediator.getSuggestionAt(index);
}
@Override
public void onNativeInitialized() {
mMediator.onNativeInitialized();
}
@Override
public void onVoiceResults(@Nullable List<VoiceRecognitionHandler.VoiceResult> results) {
mMediator.onVoiceResults(results);
}
@Override
public long getCurrentNativeAutocompleteResult() {
return mMediator.getCurrentNativeAutocompleteResult();
}
@Override
public void updateSuggestionListLayoutDirection() {
mMediator.setLayoutDirection(ViewCompat.getLayoutDirection(mParent));
}
@Override
public void updateVisualsForState(boolean useDarkColors, boolean isIncognito) {
mMediator.updateVisualsForState(useDarkColors, isIncognito);
}
@Override
public void setShowCachedZeroSuggestResults(boolean showCachedZeroSuggestResults) {
mMediator.setShowCachedZeroSuggestResults(showCachedZeroSuggestResults);
}
@Override
public boolean handleKeyEvent(int keyCode, KeyEvent event) {
boolean isShowingList = mDropdown != null && mDropdown.getViewGroup().isShown();
boolean isUpOrDown = KeyNavigationUtil.isGoUpOrDown(event);
if (isShowingList && mMediator.getSuggestionCount() > 0 && isUpOrDown) {
mMediator.allowPendingItemSelection();
}
boolean isValidListKey = isUpOrDown || KeyNavigationUtil.isGoRight(event)
|| KeyNavigationUtil.isGoLeft(event) || KeyNavigationUtil.isEnter(event);
if (isShowingList && isValidListKey && mDropdown.getViewGroup().onKeyDown(keyCode, event)) {
return true;
}
if (KeyNavigationUtil.isEnter(event) && mParent.getVisibility() == View.VISIBLE) {
mMediator.loadTypedOmniboxText(event.getEventTime());
return true;
}
return false;
}
@Override
public void onTextChanged(String textWithoutAutocomplete, String textWithAutocomplete) {
mMediator.onTextChanged(textWithoutAutocomplete, textWithAutocomplete);
}
@Override
public void startAutocompleteForQuery(String query) {
mMediator.startAutocompleteForQuery(query);
}
@Override
public String qualifyPartialURLQuery(String query) {
return AutocompleteControllerJni.get().qualifyPartialURLQuery(query);
}
@Override
public void prefetchZeroSuggestResults() {
AutocompleteControllerJni.get().prefetchZeroSuggestResults();
}
@VisibleForTesting
OmniboxSuggestionsDropdown getSuggestionsDropdown() {
return mDropdown;
}
@VisibleForTesting
void setAutocompleteController(AutocompleteController controller) {
mMediator.setAutocompleteController(controller);
}
@VisibleForTesting
OnSuggestionsReceivedListener getSuggestionsReceivedListenerForTest() {
return mMediator;
}
@VisibleForTesting
ModelList getSuggestionModelList() {
return mMediator.getSuggestionModelList();
}
private void onTileSelected(QueryTile queryTile) {
mMediator.onQueryTileSelected(queryTile);
}
}
| [
"[email protected]"
] | |
d56e102b6ea76baa47695153bb2446345081493e | 208ff39815fd6126e4ea726e6ba8be6a20576d07 | /app/src/main/java/com/dimana/bobo/bobodimanaapp/Rest/ApiClient.java | 21c332e479fc27acb1e903bcf4321aea3a60b8b9 | [] | no_license | ikowirya/BoboDimanaApp | 6f1b4acdf413908cdbc8c68ee5f5809051e926b7 | 6ca8ba02002338cb3062c6cd98970a36b5f53c11 | refs/heads/master | 2020-04-11T11:31:46.951134 | 2018-12-21T10:16:45 | 2018-12-21T10:16:45 | 161,750,735 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 819 | java | package com.dimana.bobo.bobodimanaapp.Rest;
import java.util.concurrent.TimeUnit;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class ApiClient {
private static Retrofit retrofit = null;
public static Retrofit getClient() {
//interval koneksi
OkHttpClient client = new OkHttpClient.Builder()
.connectTimeout(60, TimeUnit.SECONDS)
.readTimeout(60, TimeUnit.SECONDS)
.build();
//koneksi
retrofit = new Retrofit.Builder()
.baseUrl("http://192.168.43.81/rest_server/index.php/api/")
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build();
return retrofit;
}
}
| [
"[email protected]"
] | |
db359d109cf71abdea1e80450fa0a52bbab901b8 | 79302b85a9c7d8a93575d23b92a09520f37b7b06 | /src/leetcode/Code_003_LongestSubString.java | c925f0ea22992f9a5551181f7ef6a3ce23e0569a | [] | no_license | ColdLight230/Foundation | 83265c18f88d96034c0149c5a6e32cf7dda66588 | 20f560545c2dfcc24778eeaa5349cfc0299896c1 | refs/heads/master | 2021-07-08T17:25:14.743812 | 2020-08-05T12:14:08 | 2020-08-05T12:14:08 | 160,897,117 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,936 | java | package leetcode;
import java.util.HashMap;
/**
* Longest Substring Without Repeating Characters
* <p>
* Given a string, find the length of the longest substring without repeating characters.
* <p>
* Example 1:
* <p>
* Input: "abcabcbb"
* Output: 3
* Explanation: The answer is "abc", with the length of 3.
* Example 2:
* <p>
* Input: "bbbbb"
* Output: 1
* Explanation: The answer is "b", with the length of 1.
* Example 3:
* <p>
* Input: "pwwkew"
* Output: 3
* Explanation: The answer is "wke", with the length of 3.
* Note that the answer must be a substring, "pwke" is a subsequence and not a substring.
*/
public class Code_003_LongestSubString {
static class Helper {
public int preIndex = 0;
public int nextIndex = 0;
public int curIndex = 0;
public Helper() {
}
}
// public static int lengthOfLongestSubstring(String s) {
// if (s == null || s.length() == 0) {
// return 0;
// }
// if (s.length() == 1) {
// return 1;
// }
// char[] chars = s.toCharArray();
// HashMap<Character, Integer> map = new HashMap<>();
// Helper[] hasRepeat = new Helper[s.length()];
// for (int i = 0; i < chars.length; i++) {
// hasRepeat[i] = new Helper();
// hasRepeat[i].curIndex = i;
// hasRepeat[i].preIndex = i;
// hasRepeat[i].nextIndex = chars.length - 1;
// if (map.containsKey(chars[i])) {
// hasRepeat[i].preIndex = map.get(chars[i]);
// hasRepeat[map.get(chars[i])].nextIndex = i;
// }
// map.put(chars[i], i);
// }
// int maxOffset = 0;
// HashSet set = new HashSet();
// for (Helper helper : hasRepeat) {
// int curOffset;
// if (helper.curIndex != helper.preIndex && chars.length - 1 != helper.nextIndex) {
// curOffset = (helper.nextIndex - helper.curIndex) + (helper.curIndex - helper.preIndex) - 1;
// } else {
// curOffset = (helper.nextIndex - helper.curIndex) + (helper.curIndex - helper.preIndex);
// }
// if (curOffset > maxOffset) {
// for (int i = helper.preIndex; i <= helper.nextIndex; i++) {
// set.add(chars[i]);
// }
// if (set.size() != curOffset) {
// curOffset = 0;
// }
// set.clear();
// }
// maxOffset = curOffset > maxOffset ? curOffset : maxOffset;
// }
// return maxOffset == 0 ? s.length() : maxOffset;
// }
// hashmap ่งฃๆณ
public static int lengthOfLongestSubstring(String s) {
if (s == null || s.length() == 0) {
return 0;
}
if (s.length() == 1) {
return 1;
}
char[] chars = s.toCharArray();
int max = 0;
HashMap<Character, Integer> map = new HashMap<>();
for (int i = 0, j = 0; i < chars.length; i++) {
if (map.containsKey(chars[i])) {
// ่ฟไธช j ๆฏ็ฒพๅฆ็ไธ็ฌ๏ผๆฐธ่ฟๆฏๆๅๆฏไธชไธๅๅญๅบๅ็็ฌฌไธไธชไฝ็ฝฎ
// ๅญๅจ็ธๅ็ๆถๅ๏ผๅฐฑๆ j ๅพๅๆชไธๆญฅ
j = Math.max(j, map.get(chars[i]) + 1);
}
map.put(chars[i], i);
max = Math.max(max, i - j + 1);
}
return max;
}
public static void main(String[] args) {
// input bbbbb -> b -> 1
// input pwwkew -> wke -> 3
// input abcabcbb -> abc -> 3
// input abcdaefgha -> bcdaefgh ->8
String s = "bbbbb";
// String s = "pwwkew";
// String s = "abcabcbb";
// String s = "abcdaefgha";
// String s = "a";
// String s = "aab";
// String s = "asljlj";
System.out.println(lengthOfLongestSubstring(s));
}
}
| [
"[email protected]"
] | |
f49d17af3f9fc04117178d1642fc348f8f4215ca | 925ee2d77997ad588a79cb368840eba41034651e | /Tetris-4A/PieceEnFormeDeEsse.java | d53e105f6a10dcf20a3af5dda63d1395e3a78f8b | [] | no_license | Mankouri/Tris-Te-de-l-espace | 3edfa73a961f6b64a7f07a6af1fbe0f02c00b143 | da23233e735a13c3e5cb8713e9e20588d2a08568 | refs/heads/master | 2016-08-12T17:33:36.868770 | 2016-04-03T21:49:18 | 2016-04-03T21:49:18 | 55,365,565 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 707 | java | /**
* Piece de type: forme en 'S'.
* @author Ange FOFE, Jalil MANKOURI & Andy HARVEL;
* @version $Revision: 1.0 $
*/
public class PieceEnFormeDeEsse extends Piece {
/**
* Constructeur de la piece en 'S'.
* @param posX Position X de la piece.
* @param posY Position Y de la piece.
*/
public PieceEnFormeDeEsse(int posX, int posY) {
super(posX, posY);
/* Le 'S' tient dans une matrice 3x3: */
mat = new Matrix(3);
/* On choisit une couleur aleatoire: */
int couleur = (int) (Math.random() * 4);
/* Dessine la forme d'un 'S' dans la matrice: */
mat.setVal(1, 1, couleur);
mat.setVal(2, 1, couleur);
mat.setVal(0, 2, couleur);
mat.setVal(1, 2, couleur);
}
} | [
"[email protected]"
] | |
689a5bd6f8101dcd750fde1462ed9a276caf8fb1 | 34c8b01849d7265c73bcc696e7f0c11312c7f84d | /src/java/org/apache/commons/jelly/impl/TextScript.java | ec8fda1e5c0ca5dc4fc877aa6afe19d808d4a21f | [
"Apache-2.0"
] | permissive | pwntester/jelly | 03ddb422005970ddfc86f0e1cc7c5b5a84f7e431 | cb7966734f339619e5ee8e57b08009acbf5e1d10 | refs/heads/master | 2021-01-16T11:55:47.916026 | 2017-11-27T20:21:47 | 2017-11-27T20:21:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,365 | java | /*
* Copyright 2002,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.jelly.impl;
import org.apache.commons.jelly.JellyContext;
import org.apache.commons.jelly.JellyTagException;
import org.apache.commons.jelly.Script;
import org.apache.commons.jelly.XMLOutput;
import org.xml.sax.SAXException;
/** <p><code>TextScript</code> outputs some static text.</p>
*
* @author <a href="mailto:[email protected]">James Strachan</a>
* @version $Revision: 155420 $
*/
public class TextScript implements Script {
/** the text output by this script */
private String text;
public TextScript() {
}
public TextScript(String text) {
this.text = text;
}
public String toString() {
return super.toString() + "[text=" + text + "]";
}
/**
* Trims whitespace if this is ignorable whitespace.
*/
public void trimWhitespace() {
if(text.trim().length()==0)
this.text = "";
}
/** @return the text output by this script */
public String getText() {
return text;
}
/** Sets the text output by this script */
public void setText(String text) {
this.text = text;
}
// Script interface
//-------------------------------------------------------------------------
public Script compile() {
return this;
}
/** Evaluates the body of a tag */
public void run(JellyContext context, XMLOutput output) throws JellyTagException {
if ( text != null ) {
try {
output.write(text);
} catch (SAXException e) {
throw new JellyTagException("could not write to XMLOutput",e);
}
}
}
}
| [
"[email protected]"
] | |
9411ca13c6adc0dd76a660a2ea6e381904a639f5 | 5201cc60bd408eb765cee693847a5bfa8df6ab16 | /src/airBNB/PropInfo.java | c8f4e4f79ef77ac962b62aeec52047644a71af3e | [] | no_license | jagxman/AirBnB2.0 | 72dc33ceb9652ecd7bc6356e2eda5fc488f1220d | a11e179ce55e42f4d185ec3b8fd833e8bcea6a68 | refs/heads/main | 2023-08-25T06:41:12.686849 | 2023-08-04T00:19:45 | 2023-08-04T00:19:45 | 325,196,782 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 43,388 | 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 airBNB;
import javax.swing.JOptionPane;
import java.util.Map;
import java.sql.*;
import javax.swing.DefaultListModel;
import java.util.logging.Logger;
import java.util.logging.Level;
/**
*
* @author Administrator
*/
public class PropInfo extends javax.swing.JFrame {
private Map<String, String> bundle;
private Map<String, String> rental;
private Connection conn;
/**
* Creates new form login
*/
public PropInfo() {
initComponents();
}
public PropInfo(Map<String, String> bundle, Map<String, String> rental, Connection conn){
this();
this.bundle = bundle;
this.rental = rental;
this.conn = conn;
populateFields();
populateContractInfo();
}
private void populateFields() {
DefaultListModel model = new DefaultListModel();
Statement st = null;
try {
String q = String.format("select * from project.property where property_id=%s", rental.get("property_id"));
st = conn.createStatement();
ResultSet rs = st.executeQuery(q);
while(rs.next()) {
Property.setText(rs.getString("propertytype"));
Room.setText(rs.getString("roomtype"));
Accommodates.setText(rs.getString("accommodates"));
Amenities.setText(rs.getString("amenities"));
Bathrooms.setText(rs.getString("bathroom"));
Beds.setText(rs.getString("bedroom"));
Date.setText(rs.getString("availabledate"));
Price.setText(rs.getString("price"));
Country.setText(rs.getString("country"));
Location.setText(rs.getString("houseno") + " " + rs.getString("street") + " " + rs.getString("city"));
}
rs.close();
st.close();
} catch(SQLException ex) {
Logger.getLogger(PropInfo.class.getName()).log(Level.SEVERE, ex, null);
}
}
private void populateContractInfo(){
StartDate.setText(rental.get("startdate"));
EndDate.setText(rental.get("enddate"));
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
FrameClose1 = new javax.swing.JLabel();
PropLabel1 = new javax.swing.JLabel();
RoomTypeLabel = new javax.swing.JLabel();
AccommodatesLabel = new javax.swing.JLabel();
AmenitiesLabel = new javax.swing.JLabel();
BathroomLabel = new javax.swing.JLabel();
BedLabel = new javax.swing.JLabel();
AvailableDateLabel = new javax.swing.JLabel();
PriceLabel = new javax.swing.JLabel();
LocationLabel = new javax.swing.JLabel();
Property = new javax.swing.JLabel();
Room = new javax.swing.JLabel();
Accommodates = new javax.swing.JLabel();
Amenities = new javax.swing.JLabel();
Bathrooms = new javax.swing.JLabel();
Beds = new javax.swing.JLabel();
Date = new javax.swing.JLabel();
Price = new javax.swing.JLabel();
Location = new javax.swing.JLabel();
EndDate = new javax.swing.JLabel();
Sign = new java.awt.Button();
StartDateLabel = new javax.swing.JLabel();
EndDateLabel = new javax.swing.JLabel();
StartDate = new javax.swing.JLabel();
CountryLabel = new javax.swing.JLabel();
Country = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
setResizable(false);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jPanel1.setBackground(new java.awt.Color(32, 33, 35));
jPanel1.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseDragged(java.awt.event.MouseEvent evt) {
jPanel1MouseDragged(evt);
}
});
jPanel1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
jPanel1MousePressed(evt);
}
public void mouseReleased(java.awt.event.MouseEvent evt) {
jPanel1MouseReleased(evt);
}
});
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setFont(new java.awt.Font("Tahoma", 3, 14)); // NOI18N
jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText("Booking Info:");
jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 10, 110, -1));
FrameClose1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
FrameClose1.setForeground(new java.awt.Color(255, 255, 255));
FrameClose1.setText("X");
FrameClose1.setName(""); // NOI18N
FrameClose1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseReleased(java.awt.event.MouseEvent evt) {
FrameClose1MouseReleased(evt);
}
});
jPanel1.add(FrameClose1, new org.netbeans.lib.awtextra.AbsoluteConstraints(340, 0, 20, 20));
PropLabel1.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
PropLabel1.setForeground(new java.awt.Color(255, 255, 255));
PropLabel1.setText("Property Type:");
jPanel1.add(PropLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 30, 100, -1));
RoomTypeLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
RoomTypeLabel.setForeground(new java.awt.Color(255, 255, 255));
RoomTypeLabel.setText("Room Type:");
jPanel1.add(RoomTypeLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 70, 70, -1));
AccommodatesLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
AccommodatesLabel.setForeground(new java.awt.Color(255, 255, 255));
AccommodatesLabel.setText("Accommodates:");
jPanel1.add(AccommodatesLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 110, 90, -1));
AmenitiesLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
AmenitiesLabel.setForeground(new java.awt.Color(255, 255, 255));
AmenitiesLabel.setText("Amenities:");
jPanel1.add(AmenitiesLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 150, 70, -1));
BathroomLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
BathroomLabel.setForeground(new java.awt.Color(255, 255, 255));
BathroomLabel.setText("Bathrooms:");
jPanel1.add(BathroomLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 190, 70, -1));
BedLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
BedLabel.setForeground(new java.awt.Color(255, 255, 255));
BedLabel.setText("Beds:");
jPanel1.add(BedLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 230, 40, -1));
AvailableDateLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
AvailableDateLabel.setForeground(new java.awt.Color(255, 255, 255));
AvailableDateLabel.setText("Available Date:");
jPanel1.add(AvailableDateLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 270, 80, -1));
PriceLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
PriceLabel.setForeground(new java.awt.Color(255, 255, 255));
PriceLabel.setText("Price:");
jPanel1.add(PriceLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 310, 30, -1));
LocationLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
LocationLabel.setForeground(new java.awt.Color(255, 255, 255));
LocationLabel.setText("Location:");
jPanel1.add(LocationLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 350, 50, -1));
Property.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
Property.setForeground(new java.awt.Color(255, 255, 255));
Property.setText("NA");
jPanel1.add(Property, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 30, 130, -1));
Room.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
Room.setForeground(new java.awt.Color(255, 255, 255));
Room.setText("NA");
jPanel1.add(Room, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 70, 130, -1));
Accommodates.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
Accommodates.setForeground(new java.awt.Color(255, 255, 255));
Accommodates.setText("NA");
jPanel1.add(Accommodates, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 110, 120, -1));
Amenities.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
Amenities.setForeground(new java.awt.Color(255, 255, 255));
Amenities.setText("NA");
jPanel1.add(Amenities, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 150, 240, -1));
Bathrooms.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
Bathrooms.setForeground(new java.awt.Color(255, 255, 255));
Bathrooms.setText("NA");
jPanel1.add(Bathrooms, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 190, 70, -1));
Beds.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
Beds.setForeground(new java.awt.Color(255, 255, 255));
Beds.setText("NA");
jPanel1.add(Beds, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 230, 60, -1));
Date.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
Date.setForeground(new java.awt.Color(255, 255, 255));
Date.setText("NA");
jPanel1.add(Date, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 270, 140, -1));
Price.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
Price.setForeground(new java.awt.Color(255, 255, 255));
Price.setText("NA");
jPanel1.add(Price, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 310, 140, -1));
Location.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
Location.setForeground(new java.awt.Color(255, 255, 255));
Location.setText("NA");
jPanel1.add(Location, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 350, 260, -1));
EndDate.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
EndDate.setForeground(new java.awt.Color(255, 255, 255));
EndDate.setText("NA");
jPanel1.add(EndDate, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 470, 140, -1));
Sign.setActionCommand("Leave A Review");
Sign.setBackground(new java.awt.Color(102, 102, 255));
Sign.setFont(new java.awt.Font("DialogInput", 3, 18)); // NOI18N
Sign.setForeground(new java.awt.Color(255, 255, 255));
Sign.setLabel("Leave a Review");
Sign.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
SignActionPerformed(evt);
}
});
jPanel1.add(Sign, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 500, 180, 40));
StartDateLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
StartDateLabel.setForeground(new java.awt.Color(255, 255, 255));
StartDateLabel.setText("Start Date:");
StartDateLabel.setToolTipText("");
jPanel1.add(StartDateLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 430, 70, -1));
EndDateLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
EndDateLabel.setForeground(new java.awt.Color(255, 255, 255));
EndDateLabel.setText("End Date:");
jPanel1.add(EndDateLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 470, 70, -1));
StartDate.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
StartDate.setForeground(new java.awt.Color(255, 255, 255));
StartDate.setText("NA");
jPanel1.add(StartDate, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 430, 140, -1));
CountryLabel.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
CountryLabel.setForeground(new java.awt.Color(255, 255, 255));
CountryLabel.setText("End Date:");
jPanel1.add(CountryLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 390, 70, -1));
Country.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
Country.setForeground(new java.awt.Color(255, 255, 255));
Country.setText("NA");
jPanel1.add(Country, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 390, 140, -1));
getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 360, 550));
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
int xy;
int xx;
private void jPanel1MouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel1MouseDragged
// TODO add your handling code here:
int x = evt.getXOnScreen();
int y = evt.getYOnScreen();
this.setLocation(x-xx, y-xy);
}//GEN-LAST:event_jPanel1MouseDragged
private void jPanel1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel1MouseReleased
// TODO add your handling code here:
}//GEN-LAST:event_jPanel1MouseReleased
private void jPanel1MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel1MousePressed
// TODO add your handling code here:
xx = evt.getX();
xy = evt.getY();
}//GEN-LAST:event_jPanel1MousePressed
private void FrameClose1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_FrameClose1MouseReleased
// TODO add your handling code here:
dispose();
}//GEN-LAST:event_FrameClose1MouseReleased
private void SignActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SignActionPerformed
// TODO add your handling code here:
dispose();
Review r = new Review(bundle, rental, conn);
r.setVisible(true);
}//GEN-LAST:event_SignActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(PropInfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(PropInfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(PropInfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(PropInfo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new PropInfo().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel Accommodates;
private javax.swing.JLabel AccommodatesLabel;
private javax.swing.JLabel Amenities;
private javax.swing.JLabel AmenitiesLabel;
private javax.swing.JLabel AvailableDateLabel;
private javax.swing.JLabel BathroomLabel;
private javax.swing.JLabel Bathrooms;
private javax.swing.JLabel BedLabel;
private javax.swing.JLabel Beds;
private javax.swing.JLabel Country;
private javax.swing.JLabel CountryLabel;
private javax.swing.JLabel Date;
private javax.swing.JLabel EndDate;
private javax.swing.JLabel EndDateLabel;
private javax.swing.JLabel FrameClose1;
private javax.swing.JLabel Location;
private javax.swing.JLabel LocationLabel;
private javax.swing.JLabel Price;
private javax.swing.JLabel PriceLabel;
private javax.swing.JLabel PropLabel1;
private javax.swing.JLabel Property;
private javax.swing.JLabel Room;
private javax.swing.JLabel RoomTypeLabel;
private java.awt.Button Sign;
private javax.swing.JLabel StartDate;
private javax.swing.JLabel StartDateLabel;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
6f7f5e59ca6cdd7362d1537e80c869d07e65f513 | b814ecfa50da6c2423f5969641a5fadc972c6aea | /Hamburguesas/src/modelo/Pedido.java | bf9c68a15cd37ba98fa3baec9a375e5f088dbd04 | [] | no_license | DPOO-Talleres/Taller1 | 4e81de85581814848b9ced8c36aab5bcab5d365c | 117a29f83d74bd927773198bcf67fce181af325d | refs/heads/master | 2023-07-16T15:58:43.876353 | 2021-09-06T04:10:22 | 2021-09-06T04:10:22 | 402,787,537 | 0 | 0 | null | 2021-09-03T13:55:49 | 2021-09-03T13:55:49 | null | ISO-8859-3 | Java | false | false | 3,191 | java | package modelo;
import java.util.ArrayList;
import java.util.List;
import Logica.Restaurante;
public class Pedido {
private int numeroPedidos;
private int idPedido;
private String nombreCliente;
private String direccionCliente;
private Restaurante restaurante;
private ArrayList<Producto_Menu> productos=new ArrayList<>();
public boolean listo=false;
public Pedido (String pnombreCliente, String pdireccionCliente )
{
direccionCliente= pdireccionCliente;
nombreCliente=pnombreCliente;
}
public int getId()
{
// idPedido=restaurante.pedidos.size();
return idPedido;
}
public void agregarProducto(Producto_Menu nuevoItem)
{
if (restaurante.menus1.get(nuevoItem)!=null)
{
productos.add(nuevoItem);
}
else
{
System.out.println("No se ha encontrado el producto");
}
}
public ArrayList<Producto_Menu> listaDeProductos()
{
return (ArrayList<Producto_Menu>) productos;
}
public int getPrecioNetoPedido()
{
int precioNetoPedido=0;
for (int i=0; i<=productos.size(); i++)
{
precioNetoPedido+= Integer.parseInt(productos.get(i).getPrecioBase()) ;
}
return precioNetoPedido;
}
public int getPrecioIVAPedido()
{
int precioIVAPedido=0;
for(int i=0; i<=productos.size() ; i++)
{
int precioProducto= Integer.parseInt(productos.get(i).getPrecioBase());
int precioProductoIVA = (int) (0.19*precioProducto);
precioIVAPedido+=precioProductoIVA;
}
return precioIVAPedido;
}
public int getPrecioTotalPedido()
{
int precioTotalPedido=0;
int precioIVA= getPrecioIVAPedido();
int precioNeto= getPrecioNetoPedido();
precioTotalPedido= precioIVA+precioNeto;
return precioTotalPedido;
}
public boolean darEstado()
{
return listo;
}
public String generarTextoFactura()
{
listo=true;
System.out.println(" +++++++++++++++ FACTURA +++++++++++++++ ");
System.out.println("Id Pedido: "+idPedido);
System.out.println("Nombre Cliente: "+nombreCliente);
System.out.println("Direcciรณn: "+direccionCliente);
for (int i=0; i<=productos.size(); i++)
{
System.out.println("Nombre producto: "+productos.get(i).getNombre() + " Precio: "+productos.get(i).getPrecioBase());
}
System.out.println("Precio Neto del pedido: "+getPrecioNetoPedido());
System.out.println("Precio IVA del pedido: "+getPrecioIVAPedido());
System.out.println("Precio Total del pedido: "+getPrecioTotalPedido());
return"";
}
public String consultarInfoPedido()
{
System.out.println(" +++++++++++++++ INFO PEDIDO +++++++++++++++ ");
System.out.println("Id Pedido: "+idPedido);
System.out.println("Nombre Cliente: "+nombreCliente);
System.out.println("Direcciรณn: "+direccionCliente);
for (int i=0; i<=productos.size(); i++)
{
System.out.println("Nombre producto: "+productos.get(i).getNombre() + " Precio: "+productos.get(i).getPrecioBase());
}
System.out.println("Precio Neto del pedido: "+getPrecioNetoPedido());
System.out.println("Precio IVA del pedido: "+getPrecioIVAPedido());
System.out.println("Precio Total del pedido: "+getPrecioTotalPedido());
return"";
}
}
| [
"[email protected]"
] | |
bfce57c2914fc53dfa51e33bf50835206e97058d | 6485bbe2ea39b44d6dd3f587cd03eaeea90ac7d7 | /src/main/java/com/manoriega/dolarhoy/config/SpringSecurityConfig.java | 711bbd169f19456d4112e3f5be33a1d89b0b9ebe | [] | no_license | manuelnoriega13/dolarhoy | 434acaf776422cc31007b0d3dec9e9916f062868 | 097efad30026f50bb906fd0ce3d89196acc3a2f9 | refs/heads/master | 2022-09-10T09:36:29.121930 | 2018-11-26T03:51:15 | 2018-11-26T03:51:15 | 149,163,363 | 0 | 0 | null | 2022-09-01T22:30:03 | 2018-09-17T17:35:15 | JavaScript | UTF-8 | Java | false | false | 1,789 | java | //package com.manoriega.dolarhoy.config;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.authentication.AuthenticationManager;
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//import org.springframework.security.core.userdetails.User;
//import org.springframework.security.crypto.factory.PasswordEncoderFactories;
//import org.springframework.security.crypto.password.PasswordEncoder;
//import sun.security.util.Password;
//
//@Configuration
//public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
//
// @Autowired
// public void configureGlobal(AuthenticationManagerBuilder build) throws Exception {
//
// PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
// User.UserBuilder user = User.builder().passwordEncoder(encoder::encode);
//
// build.inMemoryAuthentication().withUser(user.username("admin").password("1234").roles("ADMIN", "USER"))
// .withUser(user.username("manuel").password("1313").roles("USER"));
// }
//
// @Override
// protected void configure(HttpSecurity http) throws Exception {
// http.authorizeRequests().antMatchers("/","/dolar/**", "/css/**", "/js/**", "/images/**").permitAll()
// .antMatchers("form").hasAnyRole("ADMIN").anyRequest().authenticated();
// }
//}
| [
"[email protected]"
] | |
74164d98a51fabf932e812b018acd7e3395952d4 | 2b84bd00a37ac2517645032c41fcfd864458765f | /app/src/main/java/io/moresushant48/saveyourwork/Model/User.java | 0d2f6fe056685d23cd5c78927838691b1c0d1480 | [] | no_license | moresushant48/SaveYourWork-Android | e90e591c545dd33172a662f66f755af96f5d0d1a | 982903667e70856c7ca2d7fa1fe790a4abfce5fd | refs/heads/master | 2020-08-09T01:04:08.510131 | 2020-05-06T15:12:21 | 2020-05-06T15:12:21 | 213,963,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,373 | java | package io.moresushant48.saveyourwork.Model;
public class User {
private int id;
private String email;
private String username;
private String password;
private String publicPass;
private Role role;
public User(int id, String email, String username, String password, String publicPass, Role role) {
this.id = id;
this.email = email;
this.username = username;
this.password = password;
this.publicPass = publicPass;
this.role = role;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPublicPass() {
return publicPass;
}
public void setPublicPass(String publicPass) {
this.publicPass = publicPass;
}
public Role getRole() {
return role;
}
public void setRole(Role role) {
this.role = role;
}
}
| [
"[email protected]"
] | |
c2feda429acf5aa07b2f972c2e2336bcd254048a | 7f9cc42a27e986a2adf1e6fd394c99cf6f9cf57c | /test/projectpaqman/GameEventTypeTest.java | 02357f9093a285b3db7b413cc737c9eae009a422 | [] | no_license | Jerrold01/PaQman | 509996f5df8184db7b3414ef764b63ad05b2ba44 | 2042a67c650e5737451c4497aa78fb630334734a | refs/heads/master | 2021-03-12T22:36:44.420915 | 2014-06-24T20:29:14 | 2014-06-24T20:29:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 724 | 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 projectpaqman;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author kevinwareman
*/
public class GameEventTypeTest {
public GameEventTypeTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
}
| [
"Kevin Wareman"
] | Kevin Wareman |
9d813543a05bc5eaa16e0caa6be89fabcdf4949e | 5d61b3eb60b220e1053f2411f3bf20cd359ff3a4 | /src/main/java/br/edu/ifes/sr/devweb/musyk/web/persistencia/Dao.java | 2a2e05f6be893e522dbdc04fe3735aaa8649e65f | [] | no_license | MarcosDias/Musyk | 728b63c0f9ce566ad7378aaf4b53cffb7437489c | bc504839a1294a2e126b4315b3b858b2340f2d19 | refs/heads/master | 2021-01-25T03:40:37.007424 | 2015-08-04T00:30:14 | 2015-08-04T00:30:14 | 35,940,269 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 456 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package br.edu.ifes.sr.devweb.musyk.web.persistencia;
import br.edu.ifes.sr.devweb.musyk.web.conexao.HibernateUtil;
import lombok.Setter;
import org.hibernate.Session;
/**
*
* @author marcosdias
*/
@Setter
public abstract class Dao{
protected Session session;
}
| [
"[email protected]"
] | |
f730d33a67417e0a207516ac8c7e1f404673c10c | 0609091f8d71b6c90a2d4fed4138f7038e7bf9e2 | /app/src/main/java/com/ldcovid19project/OnlineDoctorsActivity.java | 1f7625835fed603888ecf0ffd4968402b27ee300 | [] | no_license | COVID-19-Apps/LD-Covid-19-Project | 995cfb3272c865541d2c85186355d96c913943fd | 0f760da435c6fb7a26937e691eb70e47b6c41c9d | refs/heads/master | 2022-11-19T19:39:54.126318 | 2020-07-20T07:05:03 | 2020-07-20T07:05:03 | 281,040,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,934 | java | package com.ldcovid19project;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.SearchView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.app.SearchManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.ldcovid19project.Adapter.PersonAdapter;
import com.ldcovid19project.Models.Persons;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class OnlineDoctorsActivity extends AppCompatActivity implements PersonAdapter.SearchAdapterListener {
private FloatingActionButton Add;
private RecyclerView mPersonList;
private PersonAdapter personAdapter;
private List<Persons> personsList;
private RelativeLayout mNoPersons;
private DatabaseReference mPersonsDatabase;
private SearchView searchView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_online_doctors);
Add = findViewById(R.id.add);
mNoPersons = findViewById(R.id.no_persons);
mPersonList = findViewById(R.id.volunteer_list);
mPersonsDatabase = FirebaseDatabase.getInstance().getReference().child("Persons");
mPersonsDatabase.keepSynced(true);
mPersonList.setHasFixedSize(true);
LinearLayoutManager mLayoutManager = new LinearLayoutManager(this);
mPersonList.setLayoutManager(mLayoutManager);
personsList = new ArrayList<>();
personAdapter = new PersonAdapter(this, personsList, this);
mPersonList.setAdapter(personAdapter);
readPersons("Doctor Online Appointment");
Add.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (isNetworkConnected()) {
AlertDialog.Builder builder = new AlertDialog.Builder(OnlineDoctorsActivity.this);
builder.setMessage("Do you want to become Online Doctor ?").setTitle("Doctor Online Appointment");
builder.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent intent = new Intent(OnlineDoctorsActivity.this, ConfirmActivity.class);
startActivity(intent);
dialog.dismiss();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.setTitle("Doctor Online Appointment");
alert.show();
} else {
Toast.makeText(OnlineDoctorsActivity.this, "Connect to Internet", Toast.LENGTH_SHORT).show();
}
}
});
}
private void readPersons(final String title) {
mPersonsDatabase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
personsList.clear();
for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
Persons myStatus = snapshot.getValue(Persons.class);
if (myStatus.getType().contains(title))
personsList.add(myStatus);
}
if (!personsList.isEmpty()) {
mPersonList.setVisibility(View.VISIBLE);
mNoPersons.setVisibility(View.GONE);
personAdapter.notifyDataSetChanged();
}else{
mNoPersons.setVisibility(View.VISIBLE);
mPersonList.setVisibility(View.GONE);
}
} else {
mNoPersons.setVisibility(View.VISIBLE);
mPersonList.setVisibility(View.GONE);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
private boolean isNetworkConnected() {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
return cm.getActiveNetworkInfo() != null && cm.getActiveNetworkInfo().isConnected();
}
@Override
public void onSearchSelected(Persons persons) {
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_search, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
searchView = (SearchView) menu.findItem(R.id.action_search)
.getActionView();
searchView.setSearchableInfo(searchManager
.getSearchableInfo(getComponentName()));
searchView.setMaxWidth(Integer.MAX_VALUE);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
personAdapter.getFilter().filter(query);
return false;
}
@Override
public boolean onQueryTextChange(String query) {
personAdapter.getFilter().filter(query);
return false;
}
});
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_search) {
return true;
}
return super.onOptionsItemSelected(item);
}
} | [
"[email protected]"
] | |
a78b8e959fb3a30f7df7b1640bdf302f588f607e | 470a7abc183dc9e0c9bbb93a92f35c82f4bf34e0 | /src/main/java/com/furknyavuz/test/HappyCubePuzzle.java | cef51fd44064cebe2fec4152b80e24bda47eb989 | [] | no_license | furknyavuz/happyCubeSolver | de1488ae770c318e262a13c81c4390e8aac4a711 | 379ab6538d70cdd05defa93ee4f6dc771c1026da | refs/heads/master | 2021-01-10T11:09:59.507155 | 2015-09-25T00:51:22 | 2015-09-25T00:51:22 | 43,098,574 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,149 | java | package com.furknyavuz.test;
import com.furknyavuz.test.algorithm.BruteForceSolver;
import com.furknyavuz.test.input.InMemoryInput;
import com.furknyavuz.test.input.Input;
import com.furknyavuz.test.algorithm.Solver;
import java.io.*;
/**
* Happy Cube Puzzle
* Created by furkan on 06.09.2015.
*/
public class HappyCubePuzzle {
public static void main( String[] args ) {
try {
// Create input object
Input input = new InMemoryInput();
// Initialize solver with input
Solver solver = new BruteForceSolver(input.getPieces());
// Solve the problem
String result = solver.execute();
// Print the result
printToFile(result);
} catch (Exception e) {
e.printStackTrace();
}
}
private static void printToFile(String input) throws IOException {
File file = new File("result.txt");
file.createNewFile();
PrintWriter out = new PrintWriter(file);
String newInput = input.replaceAll("\n", System.lineSeparator());
out.println(newInput);
out.close();
}
}
| [
"[email protected]"
] | |
a65cf9233380f66cb6cf9ec5df2fe20dcca69c2d | 543626a533a9fd03445d83063632ad36f637bfc7 | /src/main/java/com/zhaomenghan/dao/AdminDao.java | 9be8cb35a01817143a540ef6fafb5f1522cfb129 | [] | no_license | Zhaomenghan512/XLWB | ea081667d0f7eede80b25d12bd98b3e6c908c241 | fc40ddb8d70dfef312f56932fdff366efc914084 | refs/heads/master | 2023-01-04T20:31:49.343911 | 2020-11-05T15:11:07 | 2020-11-05T15:11:07 | 310,335,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 300 | java | package com.zhaomenghan.dao;
import com.zhaomenghan.domain.Admin;
import org.springframework.stereotype.Component;
@Component
public interface AdminDao {
/**
* ้่ฟ็จๆทๅๆฅ่ฏข็ฎก็ๅ็จๆท
* @param username
* @return
*/
Admin findAdminByName(String username);
}
| [
"[email protected]"
] | |
c3e970c33bbfb7e4295ed194949d4306871c261a | ef51db085cfafe331b530019fa7935addd60be64 | /FragmentExample2/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/androidx/asynclayoutinflater/R.java | 0839c523e2bee199f0fb74b0058474527b23c011 | [
"Apache-2.0"
] | permissive | pamunoz/android_advanced_codelabs | a4a6fb0ce0d3ba9d450f4def5e6897e58962de99 | 5fa158d1a71ac75f47e7572f96da738ce5447b7c | refs/heads/master | 2020-05-09T11:12:58.309903 | 2019-05-09T19:00:25 | 2019-05-09T19:00:25 | 181,048,736 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,459 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package androidx.asynclayoutinflater;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f020027;
public static final int font = 0x7f020083;
public static final int fontProviderAuthority = 0x7f020085;
public static final int fontProviderCerts = 0x7f020086;
public static final int fontProviderFetchStrategy = 0x7f020087;
public static final int fontProviderFetchTimeout = 0x7f020088;
public static final int fontProviderPackage = 0x7f020089;
public static final int fontProviderQuery = 0x7f02008a;
public static final int fontStyle = 0x7f02008b;
public static final int fontVariationSettings = 0x7f02008c;
public static final int fontWeight = 0x7f02008d;
public static final int ttcIndex = 0x7f02014b;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f040040;
public static final int notification_icon_bg_color = 0x7f040041;
public static final int ripple_material_light = 0x7f04004c;
public static final int secondary_text_default_material_light = 0x7f04004e;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f050050;
public static final int compat_button_inset_vertical_material = 0x7f050051;
public static final int compat_button_padding_horizontal_material = 0x7f050052;
public static final int compat_button_padding_vertical_material = 0x7f050053;
public static final int compat_control_corner_material = 0x7f050054;
public static final int compat_notification_large_icon_max_height = 0x7f050055;
public static final int compat_notification_large_icon_max_width = 0x7f050056;
public static final int notification_action_icon_size = 0x7f050063;
public static final int notification_action_text_size = 0x7f050064;
public static final int notification_big_circle_margin = 0x7f050065;
public static final int notification_content_margin_start = 0x7f050066;
public static final int notification_large_icon_height = 0x7f050067;
public static final int notification_large_icon_width = 0x7f050068;
public static final int notification_main_column_padding_top = 0x7f050069;
public static final int notification_media_narrow_margin = 0x7f05006a;
public static final int notification_right_icon_size = 0x7f05006b;
public static final int notification_right_side_padding_top = 0x7f05006c;
public static final int notification_small_icon_background_padding = 0x7f05006d;
public static final int notification_small_icon_size_as_large = 0x7f05006e;
public static final int notification_subtext_size = 0x7f05006f;
public static final int notification_top_pad = 0x7f050070;
public static final int notification_top_pad_large_text = 0x7f050071;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f06005f;
public static final int notification_bg = 0x7f060060;
public static final int notification_bg_low = 0x7f060061;
public static final int notification_bg_low_normal = 0x7f060062;
public static final int notification_bg_low_pressed = 0x7f060063;
public static final int notification_bg_normal = 0x7f060064;
public static final int notification_bg_normal_pressed = 0x7f060065;
public static final int notification_icon_background = 0x7f060066;
public static final int notification_template_icon_bg = 0x7f060067;
public static final int notification_template_icon_low_bg = 0x7f060068;
public static final int notification_tile_bg = 0x7f060069;
public static final int notify_panel_notification_icon_bg = 0x7f06006a;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f07002f;
public static final int action_divider = 0x7f070031;
public static final int action_image = 0x7f070032;
public static final int action_text = 0x7f070038;
public static final int actions = 0x7f070039;
public static final int async = 0x7f070040;
public static final int blocking = 0x7f070043;
public static final int chronometer = 0x7f07004e;
public static final int forever = 0x7f070064;
public static final int icon = 0x7f07006b;
public static final int icon_group = 0x7f07006c;
public static final int info = 0x7f070070;
public static final int italic = 0x7f070072;
public static final int line1 = 0x7f070074;
public static final int line3 = 0x7f070075;
public static final int normal = 0x7f07007e;
public static final int notification_background = 0x7f07007f;
public static final int notification_main_column = 0x7f070080;
public static final int notification_main_column_container = 0x7f070081;
public static final int right_icon = 0x7f07008f;
public static final int right_side = 0x7f070090;
public static final int tag_transition_group = 0x7f0700b7;
public static final int tag_unhandled_key_event_manager = 0x7f0700b8;
public static final int tag_unhandled_key_listeners = 0x7f0700b9;
public static final int text = 0x7f0700ba;
public static final int text2 = 0x7f0700bb;
public static final int time = 0x7f0700be;
public static final int title = 0x7f0700bf;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f080004;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f0a001f;
public static final int notification_action_tombstone = 0x7f0a0020;
public static final int notification_template_custom_big = 0x7f0a0027;
public static final int notification_template_icon_group = 0x7f0a0028;
public static final int notification_template_part_chronometer = 0x7f0a002c;
public static final int notification_template_part_time = 0x7f0a002d;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0c0026;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0d00ed;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0d00ee;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0d00f0;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0d00f3;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0d00f5;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0d0161;
public static final int Widget_Compat_NotificationActionText = 0x7f0d0162;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] FontFamily = { 0x7f020085, 0x7f020086, 0x7f020087, 0x7f020088, 0x7f020089, 0x7f02008a };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f020083, 0x7f02008b, 0x7f02008c, 0x7f02008d, 0x7f02014b };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"[email protected]"
] | |
8c577422b20b43636c8b8457923d9bbb16c14f52 | 40665051fadf3fb75e5a8f655362126c1a2a3af6 | /ibinti-bugvm/247be47827899ba1da9c6dfdac9fdb3509672f45/5372/FaultRecoveringOutputStream.java | ae7c41c2db6301cb4512deae8896ec163fec3710 | [] | no_license | fermadeiral/StyleErrors | 6f44379207e8490ba618365c54bdfef554fc4fde | d1a6149d9526eb757cf053bc971dbd92b2bfcdf1 | refs/heads/master | 2020-07-15T12:55:10.564494 | 2019-10-24T02:30:45 | 2019-10-24T02:30:45 | 205,546,543 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,427 | java | /*
* Copyright (C) 2013 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bugvm.okhttp.internal;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import static com.bugvm.okhttp.internal.Util.checkOffsetAndCount;
/**
* An output stream wrapper that recovers from failures in the underlying stream
* by replacing it with another stream. This class buffers a fixed amount of
* data under the assumption that failures occur early in a stream's life.
* If a failure occurs after the buffer has been exhausted, no recovery is
* attempted.
*
* <p>Subclasses must override {@link #replacementStream} which will request a
* replacement stream each time an {@link IOException} is encountered on the
* current stream.
*/
public abstract class FaultRecoveringOutputStream extends AbstractOutputStream {
private final int maxReplayBufferLength;
/** Bytes to transmit on the replacement stream, or null if no recovery is possible. */
private ByteArrayOutputStream replayBuffer;
private OutputStream out;
/**
* @param maxReplayBufferLength the maximum number of successfully written
* bytes to buffer so they can be replayed in the event of an error.
* Failure recoveries are not possible once this limit has been exceeded.
*/
public FaultRecoveringOutputStream(int maxReplayBufferLength, OutputStream out) {
if (maxReplayBufferLength < 0) throw new IllegalArgumentException();
this.maxReplayBufferLength = maxReplayBufferLength;
this.replayBuffer = new ByteArrayOutputStream(maxReplayBufferLength);
this.out = out;
}
@Override public final void write(byte[] buffer, int offset, int count) throws IOException {
if (closed) throw new IOException("stream closed");
checkOffsetAndCount(buffer.length, offset, count);
while (true) {
try {
out.write(buffer, offset, count);
if (replayBuffer != null) {
if (count + replayBuffer.size() > maxReplayBufferLength) {
// Failure recovery is no longer possible once we overflow the replay buffer.
replayBuffer = null;
} else {
// Remember the written bytes to the replay buffer.
replayBuffer.write(buffer, offset, count);
}
}
return;
} catch (IOException e) {
if (!recover(e)) throw e;
}
}
}
@Override public final void flush() throws IOException {
if (closed) {
return; // don't throw; this stream might have been closed on the caller's behalf
}
while (true) {
try {
out.flush();
return;
} catch (IOException e) {
if (!recover(e)) throw e;
}
}
}
@Override public final void close() throws IOException {
if (closed) {
return;
}
while (true) {
try {
out.close();
closed = true;
return;
} catch (IOException e) {
if (!recover(e)) throw e;
}
}
}
/**
* Attempt to replace {@code out} with another equivalent stream. Returns true
* if a suitable replacement stream was found.
*/
private boolean recover(IOException e) {
if (replayBuffer == null) {
return false; // Can't recover because we've dropped data that we would need to replay.
}
while (true) {
OutputStream replacementStream = null;
try {
replacementStream = replacementStream(e);
if (replacementStream == null) {
return false;
}
replaceStream(replacementStream);
return true;
} catch (IOException replacementStreamFailure) {
// The replacement was also broken. Loop to ask for another replacement.
Util.closeQuietly(replacementStream);
e = replacementStreamFailure;
}
}
}
/**
* Returns true if errors in the underlying stream can currently be recovered.
*/
public boolean isRecoverable() {
return replayBuffer != null;
}
/**
* Replaces the current output stream with {@code replacementStream}, writing
* any replay bytes to it if they exist. The current output stream is closed.
*/
public final void replaceStream(OutputStream replacementStream) throws IOException {
if (!isRecoverable()) {
throw new IllegalStateException();
}
if (this.out == replacementStream) {
return; // Don't replace a stream with itself.
}
replayBuffer.writeTo(replacementStream);
Util.closeQuietly(out);
out = replacementStream;
}
/**
* Returns a replacement output stream to recover from {@code e} thrown by the
* previous stream. Returns a new OutputStream if recovery was successful, in
* which case all previously-written data will be replayed. Returns null if
* the failure cannot be recovered.
*/
protected abstract OutputStream replacementStream(IOException e) throws IOException;
}
| [
"[email protected]"
] | |
34750e6fc368d8491c8cdd14c2aa477380d671e1 | f089cb4883da7899e5ec4f66a12d2b9e3c680943 | /src/main/java/ma/sid/exceptions/RestResponseEntityExceptionHandler.java | fd3610d407a60f003067a3bc26af9171add4c162 | [] | no_license | soufiane-id/gestion-facture-services | a8dcd1b60a9815afdabe40d5153f1541a6e6d6c6 | 12c1cb1302c56d9be01c0f357d894165267d2429 | refs/heads/master | 2022-12-04T02:29:21.396671 | 2020-08-23T00:13:36 | 2020-08-23T00:13:36 | 212,868,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,136 | java | package ma.sid.exceptions;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import java.util.Date;
@RestControllerAdvice
public class RestResponseEntityExceptionHandler
extends ResponseEntityExceptionHandler {
@ExceptionHandler(value = { DataIntegrityViolationException.class})
public ResponseEntity<Object> constraintViolationException(DataIntegrityViolationException ex) {
JSONExceptionResponse apiError =
new JSONExceptionResponse(new Date(), HttpStatus.BAD_REQUEST, "Violation de la contrainte d\'unicitรฉ : Vรฉrifier que l\'enregistrement n\'existe pas dรฉjร ", ex.getLocalizedMessage());
return new ResponseEntity<Object>(
apiError, new HttpHeaders(), apiError.getStatus());
}
} | [
"[email protected]"
] | |
66ed0b7808dedec71446bfa0e674fd53162f9cb2 | a56b05b45e66cde7b533e88e23642a984f65ce68 | /app/src/main/java/com/epicodus/shoppinglist/util/ItemTouchHelperAdapter.java | 9cde391f3d04023db6c74e371ae91458e5991475 | [
"MIT"
] | permissive | epangelinan/ShoppingList | 7f44b6d9d8919232a2d6d90a144c6106a51c5750 | e9eb92312cfb438cc1bd91a553ffcff56d925dab | refs/heads/master | 2021-07-20T20:56:29.219471 | 2017-10-30T01:04:00 | 2017-10-30T01:04:00 | 105,486,981 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 181 | java | package com.epicodus.shoppinglist.util;
public interface ItemTouchHelperAdapter {
boolean onItemMove(int fromPosition, int toPosition);
void onItemDismiss(int position);
}
| [
"[email protected]"
] | |
f1c1ca34f8cacfd69a322ad981f21024cf6cb373 | 03e24b333daa2041ecefc3ce8f7febd517ac0c66 | /src/com/pcbje/ahbm/CaseWrapper.java | c8f727b36f80f82557c77f16c2f96a9e74e5d99f | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | peterclemenko/autopsy-ahbm | f12d3fc1882bfe9cfed1dab551ee735108455bb8 | 0f919e174348e3fc06036e8762ae2691d4282f3a | refs/heads/master | 2021-12-21T22:28:13.599456 | 2013-10-28T17:17:25 | 2013-10-28T17:17:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,293 | java | /**
* This work is made available under the Apache License, Version 2.0.
*
* 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.pcbje.ahbm;
import com.pcbje.ahbm.matchable.Matchable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Properties;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.ingest.IngestMessage;
import org.sleuthkit.autopsy.ingest.IngestServices;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.TskCoreException;
/**
*
* @author pcbje
*/
public class CaseWrapper {
private static final int AHBM_MAX_FILE_SIZE = 64;
private static final int READ_BUFFER_SIZE = 1024;
private static final String DEFAULT_SKIP_KNOWN_GOOD_FILES = "false";
private static final String DEFAULT_AGAINST_EXISTING = "false";
private volatile int messageID = 0;
public File getFileInModuleDir(String pathRelativeToModule) {
StringBuilder path = new StringBuilder();
path.append(Case.getCurrentCase().getModulesOutputDirAbsPath());
path.append(File.separator);
path.append("AHBM");
path.append(File.separator);
path.append(pathRelativeToModule);
File file = new File(path.toString());
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
return file;
}
public Content getContentById(long objId) throws TskCoreException {
return Case.getCurrentCase().getSleuthkitCase().getContentById(objId);
}
public void addOverizeWarning(Content content) throws TskCoreException {
IngestServices.getDefault().postMessage(IngestMessage.
createMessage(messageID++, IngestMessage.MessageType.WARNING, AhbmIngestModule.getDefault(),
String.format("File %s is too large for AHBM", content.getUniquePath())));
}
public void addMatchNotice(Matchable probe) throws TskCoreException {
String name = probe.getContent().getName();
IngestServices.getDefault().postMessage(IngestMessage.
createMessage(messageID++, IngestMessage.MessageType.INFO, AhbmIngestModule.getDefault(),
String.format("Found AHBM hits for %s", name)));
}
public Properties getProperties() {
Properties props = new Properties();
props.setProperty("ahbm.max.file.size", Integer.toString(AHBM_MAX_FILE_SIZE));
props.setProperty("read.buffer.size", Integer.toString(READ_BUFFER_SIZE));
props.setProperty("ahbm.skip.known.good", DEFAULT_SKIP_KNOWN_GOOD_FILES);
props.setProperty("ahbm.against.existing", DEFAULT_AGAINST_EXISTING);
try {
props.load(new FileInputStream(getFileInModuleDir("ahbm.properties")));
} catch (FileNotFoundException ex) {
storeProperties(props);
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
return props;
}
public void readFile(OutputStream baos, int bufferSize, Content content) {
byte[] buffer = new byte[bufferSize];
try {
for (long pos = 0; pos < content.getSize(); pos = pos + buffer.length) {
int remaining = (int) Math.min(content.getSize() - pos, buffer.length);
int read = content.read(buffer, pos, remaining);
baos.write(buffer, 0, read);
}
} catch (Exception e) {
Exceptions.printStackTrace(e);
}
}
public void storeProperties(Properties properties) {
try {
properties.store(new FileOutputStream(getFileInModuleDir("ahbm.properties")), null);
} catch (IOException ex1) {
Exceptions.printStackTrace(ex1);
}
}
}
| [
"[email protected]"
] | |
b69d25c13656f23488406c7d2765d9493e0baa95 | d2d30b2f6ede894b1c639c42d92e524a4b8dbbb2 | /demo/springcloud/service_ribbon/src/main/java/cloud/service/ribbon/service/HelloService.java | 1c8d57ef8ed3f3ce962e427374cd886d08aa6115 | [] | no_license | 492304732/notes | 613f5dfb9459eb472c2a1b9e52e761fe2a4afa8f | 679cd1261f9a24346fea7ff18a6dedda0ce11d84 | refs/heads/master | 2021-10-06T12:54:26.585787 | 2021-10-06T07:14:44 | 2021-10-06T07:14:44 | 130,651,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | package cloud.service.ribbon.service;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
@Service
public class HelloService {
@Autowired
RestTemplate restTemplate;
@HystrixCommand(fallbackMethod = "hiError")
public String hiService(String name) {
return restTemplate.getForObject("http://SERVICE-HI/hi?name="+name,String.class);
}
public String hiError(String name) {
return "hi,"+name+",sorry,error!";
}
} | [
"[email protected]"
] | |
e99601ed312f862cfc608f4b0aa04b3ab055ce60 | 699c3c05401813da60c9080af794aa39ef8479e8 | /owllinkhttpxml/src/main/java/org/semanticweb/owlapi/owllink/server/parser/OWLlinkGetFlattenedDataPropertySourcesElementHandler.java | 14ed18013d0a7e4becf72e72b232dc744ab82109 | [
"EPL-2.0",
"Apache-2.0"
] | permissive | sisinflab-swot/owllink-matchmaking-extension | 7201a0b82f42819d46ba7abb4220b1b41c24fb34 | 4bc6300bbde1a35576eac0324616d40131aa2fbf | refs/heads/master | 2021-08-07T13:13:28.823760 | 2020-06-08T19:10:40 | 2020-06-08T19:10:40 | 227,086,030 | 1 | 0 | Apache-2.0 | 2020-10-13T18:07:13 | 2019-12-10T10:06:05 | Java | UTF-8 | Java | false | false | 3,225 | java | /*
* This file is part of the OWLlink API.
*
* The contents of this file are subject to the LGPL License, Version 3.0.
*
* Copyright (C) 2011, derivo GmbH
*
* 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/.
*
*
* Alternatively, the contents of this file may be used under the terms of the Apache License, Version 2.0
* in which case, the provisions of the Apache License Version 2.0 are applicable instead of those above.
*
* Copyright 2011, derivo GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.semanticweb.owlapi.owllink.server.parser;
import org.coode.owlapi.owlxmlparser.OWLLiteralElementHandler;
import org.coode.owlapi.owlxmlparser.OWLXMLParserException;
import org.coode.owlapi.owlxmlparser.OWLXMLParserHandler;
import org.semanticweb.owlapi.model.OWLLiteral;
import org.semanticweb.owlapi.owllink.OWLlinkXMLVocabulary;
import org.semanticweb.owlapi.owllink.builtin.requests.GetFlattenedDataPropertySources;
/**
* Author: Olaf Noppens
* Date: 28.11.2009
*/
public class OWLlinkGetFlattenedDataPropertySourcesElementHandler extends AbstractOWLlinkDataPropertyElementHandler<GetFlattenedDataPropertySources> {
protected boolean isNegative = false;
protected OWLLiteral literal;
public OWLlinkGetFlattenedDataPropertySourcesElementHandler(OWLXMLParserHandler handler) {
super(handler);
}
public void startElement(String name) throws OWLXMLParserException {
super.startElement(name);
isNegative = false;
}
public void attribute(String localName, String value) throws OWLXMLParserException {
super.attribute(localName, value);
if (OWLlinkXMLVocabulary.NEGATIVE_ATTRIBUTE.getShortName().equals(localName)) {
isNegative = Boolean.valueOf(value);
}
}
public void handleChild(OWLLiteralElementHandler handler) throws OWLXMLParserException {
this.literal = handler.getOWLObject();
}
public GetFlattenedDataPropertySources getOWLObject() throws OWLXMLParserException {
return new GetFlattenedDataPropertySources(getKB(), getObject(), literal, isNegative);
}
}
| [
"[email protected]"
] | |
9d804f7fc03466dd9bbbbded5016a491c1dafc31 | e9a168309d1f54890612e7dbaf7575c96b1eeae7 | /project_master/app/src/main/java/com/example/project_master/recycleView/adaptater/CheckpointAdaptater.java | 2dd8dbaeecb4bac7ec6044eb6f5a80cda4926622 | [] | no_license | ajdin14200/ASProject | 70dd9721eb1397f198a6fd85e49dee508ad19398 | ff30efca554d2f29e26d02e3820c1bb90558b213 | refs/heads/master | 2021-05-17T02:55:40.600986 | 2020-03-28T16:37:30 | 2020-03-28T16:37:30 | 250,586,017 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,456 | java | package com.example.project_master.recycleView.adaptater;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.project_master.model.Checkpoint;
import com.example.project_master.R;
import com.example.project_master.recycleView.viewHolder.CheckpointViewHolder;
import java.util.ArrayList;
public class CheckpointAdaptater extends RecyclerView.Adapter<CheckpointViewHolder> {
Context context;
ArrayList<Checkpoint> arrayList;
Checkpoint checkpoint;
public CheckpointAdaptater(Context context, ArrayList<Checkpoint> arrayList) {
this.context = context;
this.arrayList = arrayList;
}
@NonNull
@Override
public CheckpointViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.recycler_checkpoint, parent, false);
return new CheckpointViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull CheckpointViewHolder holder, final int position) {
checkpoint=arrayList.get(position);
holder.bind(checkpoint);
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
final AlertDialog.Builder confirmation= new AlertDialog.Builder(context);
confirmation.setMessage(R.string.messagecheckpoint);
confirmation.setPositiveButton(R.string.removeYes,new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
arrayList.remove(checkpoint);
notifyDataSetChanged();
}
});
confirmation.setNegativeButton(R.string.removeNo, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
confirmation.show();
return false;
}
});
}
@Override
public int getItemCount() {
return arrayList.size();
}
}
| [
"[email protected]"
] | |
60de58473dccc0cde4e0da2bdd6e7c6ea09c0d22 | 4ff2af6df91cf977ddbcf5e177e2cc57f0eebd0b | /src/helpers/Protein.java | 432ac5255e571d7dc20f6445a21e205d0a7f972e | [] | no_license | kkF1796/HbVar | da0feb3e70f363165875055448fab7d2bac403cd | e4798eef02a5f10b9efa0a905a0bc132a75ee3ef | refs/heads/main | 2023-03-31T16:47:09.272963 | 2021-04-11T12:51:29 | 2021-04-11T12:51:29 | 356,865,551 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,576 | java | package helpers;
public class Protein {
private ProteinEnum[] proteinTab= {ProteinEnum.beta, ProteinEnum.alpha1,ProteinEnum.alpha2,
ProteinEnum.Ggamma,ProteinEnum.Agamma,ProteinEnum.delta};
private ProteinEnum protein;
public Protein(){
}
// used when the name is given
public Protein(String name){
for(ProteinEnum protein: proteinTab){
if(name.equals(protein.getNameHbVar())){
this.protein=protein;
break;
}
}
}
public String getNameHbVar(){
return this.protein.getNameHbVar();
}
public String getName(){
return this.protein.getName();
}
public String getIdSwissProt(){
return this.protein.getIdSwissProt();
}
public int getLength(){
return this.protein.getLength();
}
public String getSequence(){
return this.protein.getSequence();
}
/* Function that calculates the monoisotopic mass of the protein*/
public double getMonoisoMass(){
AminoAcid acidAmin;
String sequence= this.getSequence();
double mass=0;
int i;
for(i=0;i<sequence.length();i++){
acidAmin=new AminoAcid(sequence.charAt(i));
mass += acidAmin.getMonoisoMass();
}
return mass;
}
/* Function that calculates the average mass of the protein*/
public double getAverageMass(){
AminoAcid acidAmin;
String sequence= this.getSequence();
double mass=0;
int i;
for(i=0;i<sequence.length();i++){
acidAmin=new AminoAcid(sequence.charAt(i));
mass += acidAmin.getAverageMass();
}
return mass;
}
}
| [
"[email protected]"
] | |
0db34b737579da029c77bc7553509a20da1201d9 | 2fb4f07c330901757d1220f9d6ac07bac35daaff | /src/main/java/cn/beatree/paillier/entity/Numbers.java | 03f301c15a725c40417ca9cf34d28c4cc3191b28 | [] | no_license | seasky100/Paillier-Server | 04db083affcc1b8bcbdd05e99720fb0b5bcede72 | 3d938d7cff9b5854953587e40227505909652d71 | refs/heads/master | 2022-12-30T02:40:31.149809 | 2020-09-28T14:58:12 | 2020-09-28T14:58:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 153 | java | package cn.beatree.paillier.entity;
import lombok.Data;
import java.math.BigInteger;
@Data
public class Numbers {
private BigInteger[] numbers;
}
| [
"[email protected]"
] | |
71b0bb7157cb25552e79f39ce4df107b89fa9281 | 7896c3914c03d011ecb89ba9bca6707b3d8e4f19 | /core/src/main/java/juniter/core/utils/ExecUtils.java | 856e3b8216acd2a284e4aa58e79d77fc0be75302 | [] | no_license | Bertrandbenj/juniter | f0c98da2230a466b411966a9c797271ddf04836e | 0be954480ba24754b653af82c3c92678b65fdcad | refs/heads/master | 2020-03-21T10:16:15.035791 | 2020-01-22T12:15:19 | 2020-01-22T12:15:19 | 138,442,065 | 4 | 1 | null | 2019-07-31T12:29:18 | 2018-06-24T00:19:44 | Java | UTF-8 | Java | false | false | 1,288 | java | package juniter.core.utils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class ExecUtils {
private static final Logger LOG = LogManager.getLogger(ExecUtils.class);
/**
* Fail safe command execution
* TODO : streamline that for god sake, no need to have 2 intermediate disk write
*
* @param cmd :
* @return :
*/
public static Object run(String cmd) {
try {
LOG.info("Executing : " + cmd);
final Process process = new ProcessBuilder("bash", "-c", cmd).start();
final ArrayList<String> output = new ArrayList<>();
final BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line = null;
while ((line = br.readLine()) != null) {
output.add(line);
LOG.info(line);
}
// There should really be a timeout here.
if (0 != process.waitFor())
return null;
return output;
} catch (final Exception e1) {
LOG.error("executing "+cmd, e1);
}
return null;
}
}
| [
"[email protected]"
] | |
f46627c0014d70a177dc742136817287b4930918 | a52d6bb42e75ef0678cfcd291e5696a9e358fc4d | /af_webapp/src/main/java/org/kuali/kfs/module/purap/businessobject/PurchaseRequisitionItemUseTax.java | d17ca7b9e428f14c2591762271669c6e6ef87295 | [] | no_license | Ariah-Group/Finance | 894e39cfeda8f6fdb4f48a4917045c0bc50050c5 | ca49930ca456799f99aad57e1e974453d8fe479d | refs/heads/master | 2021-01-21T12:11:40.987504 | 2016-03-24T14:22:40 | 2016-03-24T14:22:40 | 26,879,430 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 749 | java | /*
* Copyright 2008 The Kuali Foundation
*
* Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
*
* 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.kuali.kfs.module.purap.businessobject;
public class PurchaseRequisitionItemUseTax extends PurApItemUseTaxBase {
}
| [
"[email protected]"
] | |
bfae87380070d183631d2c9a3654087acaf89b91 | d0c43aa56c4f32071c4176700ab81378a68751de | /src/main/java/io/github/pascalgrimaud/crm/repository/ProductOrderRepository.java | a6fb2b6e758e19470d0db87375cabc74f10cfc1d | [] | no_license | pascalgrimaud/jh-issue-13855-crm | c23fb548ce3a34eaeb71db41821d0ad64bd6bcf4 | 15e265aad9d97061630019a88a34d12df0a42e9f | refs/heads/main | 2023-03-01T19:01:29.028337 | 2021-02-13T13:06:46 | 2021-02-13T13:06:46 | 338,623,238 | 0 | 0 | null | 2021-02-13T17:00:21 | 2021-02-13T16:59:29 | Java | UTF-8 | Java | false | false | 398 | java | package io.github.pascalgrimaud.crm.repository;
import io.github.pascalgrimaud.crm.domain.ProductOrder;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;
/**
* Spring Data SQL repository for the ProductOrder entity.
*/
@SuppressWarnings("unused")
@Repository
public interface ProductOrderRepository extends JpaRepository<ProductOrder, Long> {}
| [
"[email protected]"
] | |
87acdf7f8e09119e9174698b1f700fd46a508139 | a2f9d3f6ed3b3ebeb1f7a1ff80f79c64e048ac22 | /src/mips/RInstruction.java | 44b346f343263910499dee925213cec30ce98b79 | [] | no_license | weidaru/mips_disassembler | 96ce89c845b76dcbaecdf333dbcfbb9aa21f4871 | c34f1dd809dad3341a08866da99cb825676aa1a3 | refs/heads/master | 2021-01-04T02:37:48.617569 | 2013-10-09T06:11:28 | 2013-10-09T06:11:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,605 | java | package mips;
import java.util.TreeMap;
public class RInstruction extends Instruction
{
private Register rs;
private Register rt;
private Register rd;
private int shamt;
private int funct;
public static TreeMap<Integer, String> fmMap = null;
static
{
fmMap = new TreeMap<Integer, String>();
fmMap.put(0x20, "add");
fmMap.put(0x21, "addu");
fmMap.put(0x24, "and");
fmMap.put(0x8, "jr");
fmMap.put(0x27, "nor");
fmMap.put(0x25, "or");
fmMap.put(0x2a, "slt");
fmMap.put(0x2b, "sltu");
fmMap.put(0x0, "sll");
fmMap.put(0x2, "srt");
fmMap.put(0x22, "sub");
fmMap.put(0x23, "subu");
}
public RInstruction(int pcAddr, int code)
{
super(pcAddr, code);
rs = Register.registerMap.get((machineCode>>21) & 0x1f);
rt = Register.registerMap.get((machineCode>>16) & 0x1f);
rd = Register.registerMap.get((machineCode>>11) & 0x1f);
shamt = (machineCode>>6) & 0x1f;
funct = machineCode & 0x3f;
mnemonic = fmMap.get(funct);
}
public String toString()
{
switch(funct)
{
case 0x20:
case 0x21:
case 0x24:
case 0x27:
case 0x25:
case 0x2a:
case 0x2b:
case 0x22:
case 0x23: return mnemonic+" "+rd.name+", "+rs.name+", "+rt.name;
case 0x08: return mnemonic+" "+rs.name;
case 0x00:
case 0x02: return mnemonic+" "+rd.name+", "+rt.name+", "+Integer.toHexString(shamt);
default: return null;
}
}
public Register getRs()
{
return rs;
}
public Register getRt()
{
return rt;
}
public Register getRd()
{
return rd;
}
public int getShamt()
{
return shamt;
}
public int getFunct()
{
return funct;
}
}
| [
"[email protected]"
] | |
14f8cbcff3b0642981985f9528265e128657e766 | 2a348707336f6f658de611267b36fd598457e7ea | /src/com/company/Cosidor.java | f2a9913e4ef4b515f9676b2baeb6cc5c2401a82b | [] | no_license | adrii3/TallerDeCosturas | 7d27df5a72a477f5729b6a1e52642086423f5664 | 2b6eb5b9f5f28c05a9c3509bcfaadb0ddf474a98 | refs/heads/master | 2020-12-28T09:16:57.620912 | 2020-02-10T16:31:25 | 2020-02-10T16:31:25 | 238,263,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 655 | java | package com.company;
public class Cosidor extends Thread {
Cistell cistell;
public Cosidor(Cistell cistell, String name) {
super(name);
this.cistell = cistell;
}
@Override
public void run() {
for(;;) {
//cosir un temps
try {
Thread.sleep((long) Math.random() * 1000 + 500);
} catch (InterruptedException e) {
e.printStackTrace();
}
//posar peรงa al cistell una mร niga cosida
int c = cistell.posar(1);
System.out.println(getName() + " he afegit una peรงa. Total = " + c);
}
}
}
| [
"[email protected]"
] | |
744f463630c7b34ba99b04045f76754511b2745f | 8168302aece7797e5fd46f6af87553bd06f2dc43 | /src/main/java/com/chainalysis/cryptoprice/exchange/ExchangeService.java | 1687acf1ebe9fc2cc1e3d7da085e78dc542f0152 | [] | no_license | aisenkim/BACKUP-_crypto_price_backend | 7b16ed2617c3497132d5a5ad229b10804ed546ed | 36be7e110b6abb58b0c5f2252ab1d23f3b05f851 | refs/heads/main | 2023-08-28T21:37:56.458417 | 2021-10-28T03:36:33 | 2021-10-28T03:36:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,407 | java | package com.chainalysis.cryptoprice.exchange;
import org.springframework.web.util.UriComponentsBuilder;
import java.math.BigDecimal;
import java.net.URI;
import java.util.Map;
public interface ExchangeService {
/**
* API call to retrieve last trade closed coin value
* @param coinSymbol - (BTC, ETH)
* @return - price
*/
String getPrice(String coinSymbol);
/**
* Calls API to retrieve maker fee and taker fee
* @param coinSymbol - (BTC, ETH)
* @return - mapped as {takerFee : "value", makerFee: "value"}
*/
Map<String, String> getFees(String coinSymbol);
/**
* Convert URL to URI
* @param url - API URL
* @return API in URI format
*/
static URI buildURI(String url) {
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(url);
return builder.build().encode().toUri();
}
/**
* Returns buyer price and seller price in string format
*/
Map<String, String> getBuySellPrice(String coinSymbol);
/**
* Calculates price with fees combined
* @param price - featured coin price
* @param fees - adding a makers or takers fee
* @return - total price in String format
*/
static String calculatePrice(BigDecimal price, BigDecimal fees) {
BigDecimal feePrice = price.multiply(fees);
return price.add(feePrice).toString();
}
}
| [
"[email protected]"
] | |
baa6552c7aa3b5489531afafd82de7b61e5c8449 | b5c43f75faff02041bdbf9c9a3ef82606042aae1 | /plugins/com.github.lbroudoux.dsl.eip.edit/src/com/github/lbroudoux/dsl/eip/provider/AggregatorItemProvider.java | 70ac895a6387031ea974f7d9ef8b2ce830ba67c9 | [
"Apache-2.0"
] | permissive | yanngv29/eip-designer | 0d87309c463bce52eb3d8968b5b779f595d8fe63 | 704a25844ceb144f4dc371502fcd01d23464f93a | refs/heads/master | 2021-01-18T08:00:18.330876 | 2015-07-16T12:37:56 | 2015-07-16T12:37:56 | 38,744,984 | 0 | 0 | null | 2015-07-08T09:34:20 | 2015-07-08T09:34:20 | null | UTF-8 | Java | false | false | 9,325 | java | /**
*/
package com.github.lbroudoux.dsl.eip.provider;
import com.github.lbroudoux.dsl.eip.Aggregator;
import com.github.lbroudoux.dsl.eip.EipPackage;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
/**
* This is the item provider adapter for a {@link com.github.lbroudoux.dsl.eip.Aggregator} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class AggregatorItemProvider
extends ItemProviderAdapter
implements
IEditingDomainItemProvider,
IStructuredItemContentProvider,
ITreeItemContentProvider,
IItemLabelProvider,
IItemPropertySource {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AggregatorItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
addNamePropertyDescriptor(object);
addToChannelPropertyDescriptor(object);
addFromChannelsPropertyDescriptor(object);
addPartPropertyDescriptor(object);
addStrategyPropertyDescriptor(object);
addExpressionPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Name feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addNamePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Endpoint_name_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Endpoint_name_feature", "_UI_Endpoint_type"),
EipPackage.Literals.ENDPOINT__NAME,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the To Channel feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addToChannelPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Endpoint_toChannel_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Endpoint_toChannel_feature", "_UI_Endpoint_type"),
EipPackage.Literals.ENDPOINT__TO_CHANNEL,
true,
false,
true,
null,
null,
null));
}
/**
* This adds a property descriptor for the From Channels feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addFromChannelsPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Endpoint_fromChannels_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Endpoint_fromChannels_feature", "_UI_Endpoint_type"),
EipPackage.Literals.ENDPOINT__FROM_CHANNELS,
true,
false,
true,
null,
null,
null));
}
/**
* This adds a property descriptor for the Part feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addPartPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Aggregator_part_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Aggregator_part_feature", "_UI_Aggregator_type"),
EipPackage.Literals.AGGREGATOR__PART,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Strategy feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addStrategyPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Aggregator_strategy_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Aggregator_strategy_feature", "_UI_Aggregator_type"),
EipPackage.Literals.AGGREGATOR__STRATEGY,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Expression feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addExpressionPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Aggregator_expression_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Aggregator_expression_feature", "_UI_Aggregator_type"),
EipPackage.Literals.AGGREGATOR__EXPRESSION,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
/**
* This returns Aggregator.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/Aggregator"));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected boolean shouldComposeCreationImage() {
return true;
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
String label = ((Aggregator)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_Aggregator_type") :
getString("_UI_Aggregator_type") + " " + label;
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(Aggregator.class)) {
case EipPackage.AGGREGATOR__NAME:
case EipPackage.AGGREGATOR__PART:
case EipPackage.AGGREGATOR__STRATEGY:
case EipPackage.AGGREGATOR__EXPRESSION:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
}
/**
* Return the resource locator for this item provider's resources.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
return EipEditPlugin.INSTANCE;
}
}
| [
"[email protected]"
] | |
037c3c83fa3cc68ddff1ceb6d8e8090225b27ad8 | ce9b6a3385534cc62df16d9769ad8ff5e0eb087e | /JDBC DEMO/src/com/beans/Book.java | 611a3d8f52c4e392a1d83c9e8e4295d38da0dd98 | [] | no_license | qwerty123jdh/readUs | c282abdc936e4aa3816509e34686d2f8dd4415c4 | f54b0ac887835ace4b2611e4bf2a1b9d9b6d6db0 | refs/heads/master | 2020-03-27T04:35:14.285325 | 2018-08-24T05:21:46 | 2018-08-24T05:21:46 | 145,952,089 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,055 | java | package com.beans;
public class Book {
private String isbn;
private String name;
private String publication;
private String author;
public Book()
{
isbn ="One";
name = "Core Java";
publication="My Publication";
author = "Sen";
}
@Override
public String toString() {
return "Book [isbn=" + isbn + ", name=" + name + ", publication=" + publication + ", author =" + author + "]";
}
public Book(String isbn, String name, String publication, double price) {
super();
this.isbn = isbn;
this.name = name;
this.publication = publication;
this.author = author;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPublication() {
return publication;
}
public void setPublication(String publication) {
this.publication = publication;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
}
| [
"[email protected]"
] | |
fc3205bd7b9f06d69d545c7b5e347d18f55f026e | 88370dbe8e25d1dcfafe557ea17252bef7c95948 | /Meal Management/src/mill/management/loginUser.java | 8c4856489c0132d950c9ad25055e96b97ad8ba1c | [] | no_license | akib9ctg/JavaProject | e9256c5edd048948bf73db65e9e9b02a4813f093 | 37b30ace957cd6ebb1491c009343eb9909bc96be | refs/heads/master | 2021-01-16T20:24:38.201351 | 2017-08-13T21:09:24 | 2017-08-13T21:09:24 | 100,204,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,945 | 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 mill.management;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
/**
*
* @author ACER
*/
public class loginUser extends javax.swing.JFrame {
/**
* Creates new form loginUser
*/
public loginUser() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
userName = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
password = new javax.swing.JPasswordField();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Log in");
jLabel1.setText("User Name:");
jLabel2.setText("Password:");
jButton1.setText("Log in");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(44, 44, 44)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(18, 18, 18)
.addComponent(password))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(userName, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(88, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton1)
.addGap(68, 68, 68))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(65, 65, 65)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(userName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(password, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jButton1)
.addContainerGap(43, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
String p = userName.getText();
String q = password.getText();
try {
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE",mainShape.oracle_username, mainShape.oracle_password);
Statement stmt = con.createStatement();
String query = "select *from realUser where id='" + p + "'and password = '" + q + "'";
ResultSet sql = stmt.executeQuery(query);
int ck = 0;
if (sql.next()) {
userView ob=new userView();
ob.id=p;
ob.name=sql.getString("name");
ob.setUsername();
ob.checkmill();
ob.setVisible(true);
super.dispose();
} else {
try {
query = "select *from requestmill where id='" + p + "'and password = '" + q + "'";
sql = stmt.executeQuery(query);
if (sql.next()) {
JOptionPane.showMessageDialog(null, "Wait for Admin Approval");
ck = 1;
}
if (ck == 0) {
JOptionPane.showMessageDialog(null, "Invalid User Name or Password");
}
} catch (SQLException ex) {
System.out.println(ex);
}
}
} catch (SQLException ex) {
System.out.println(ex);
}
}//GEN-LAST:event_jButton1ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(loginUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(loginUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(loginUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(loginUser.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
// new loginUser().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel1;
private javax.swing.JPasswordField password;
private javax.swing.JTextField userName;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
12aa1c6413a2d4869bba53014bd350aa8d64d9e3 | d151481f624c61ba7a6c570b29cf90d271bd3fbe | /swing/EventWithAIC.java | 0bd55cd239fee9abaae1fe5862a72b26885142e1 | [] | no_license | srikanthpragada/JavaSE_Material_2021_Programs | 04fc5e66a1d6a174b15b7535c1ef30d8070c5877 | 93d8ae573212bd66fc22c8fa78f53641fe17075e | refs/heads/master | 2023-05-08T10:47:18.109334 | 2021-06-01T05:33:54 | 2021-06-01T05:33:54 | 372,707,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 774 | java | package swing;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Date;
public class EventWithAIC extends JFrame {
JButton b1;
JLabel lbl;
public EventWithAIC() {
super("Event with Anonymous Inner Class");
lbl = new JLabel();
lbl.setHorizontalAlignment(JLabel.CENTER);
b1 = new JButton("Click Here");
b1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
lbl.setText(new Date().toString());
}
});
Container c = getContentPane();
c.add(lbl, BorderLayout.PAGE_START);
c.add(b1, BorderLayout.PAGE_END);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setSize(300, 200);
}
public static void main(String args[]) {
new EventWithAIC().setVisible(true);
}
} | [
"[email protected]"
] | |
8f734d92e3ca1ee05ccac7ba10670d08b61b29ef | 585b32aa908a603aed56565f54e0e4bc44e3a9e9 | /fastutil-6.4.6/src/it/unimi/dsi/fastutil/shorts/ShortHeapIndirectPriorityQueue.java | 91dbd1e77ab8e363e898694f6f349ba53e32a6eb | [
"Apache-2.0"
] | permissive | commoncrawl/example-languageentropy | 212008c219f2a2822321ca4e02bd35c4fb7eff1d | 0653cf112f1c16dec4b16f4503feba6b100a7440 | refs/heads/master | 2021-01-16T23:13:59.123943 | 2013-01-15T11:25:11 | 2013-01-15T11:25:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,290 | java | /* Generic definitions */
/* Assertions (useful to generate conditional code) */
/* Current type and class (and size, if applicable) */
/* Value methods */
/* Interfaces (keys) */
/* Interfaces (values) */
/* Abstract implementations (keys) */
/* Abstract implementations (values) */
/* Static containers (keys) */
/* Static containers (values) */
/* Implementations */
/* Synchronized wrappers */
/* Unmodifiable wrappers */
/* Other wrappers */
/* Methods (keys) */
/* Methods (values) */
/* Methods (keys/values) */
/* Methods that have special names depending on keys (but the special names depend on values) */
/* Equality */
/* Object/Reference-only definitions (keys) */
/* Primitive-type-only definitions (keys) */
/* Object/Reference-only definitions (values) */
/*
* Copyright (C) 2003-2012 Paolo Boldi and Sebastiano Vigna
*
* 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 it.unimi.dsi.fastutil.shorts;
import it.unimi.dsi.fastutil.ints.IntArrays;
import java.util.NoSuchElementException;
/** A type-specific heap-based indirect priority queue.
*
* <P>Instances of this class use an additional <em>inversion array</em>, of the same length of the reference array,
* to keep track of the heap position containing a given element of the reference array. The priority queue is
* represented using a heap. The heap is enlarged as needed, but it is never
* shrunk. Use the {@link #trim()} method to reduce its size, if necessary.
*
* <P>This implementation does <em>not</em> allow one to enqueue several times the same index.
*/
public class ShortHeapIndirectPriorityQueue extends ShortHeapSemiIndirectPriorityQueue {
/** The inversion array. */
protected int inv[];
/** Creates a new empty queue with a given capacity and comparator.
*
* @param refArray the reference array.
* @param capacity the initial capacity of this queue.
* @param c the comparator used in this queue, or <code>null</code> for the natural order.
*/
public ShortHeapIndirectPriorityQueue( short[] refArray, int capacity, ShortComparator c ) {
super( refArray, capacity, c );
if ( capacity > 0 ) this.heap = new int[ capacity ];
this.refArray = refArray;
this.c = c;
this.inv = new int[ refArray.length ];
IntArrays.fill( inv, -1 );
}
/** Creates a new empty queue with a given capacity and using the natural order.
*
* @param refArray the reference array.
* @param capacity the initial capacity of this queue.
*/
public ShortHeapIndirectPriorityQueue( short[] refArray, int capacity ) {
this( refArray, capacity, null );
}
/** Creates a new empty queue with capacity equal to the length of the reference array and a given comparator.
*
* @param refArray the reference array.
* @param c the comparator used in this queue, or <code>null</code> for the natural order.
*/
public ShortHeapIndirectPriorityQueue( short[] refArray, ShortComparator c ) {
this( refArray, refArray.length, c );
}
/** Creates a new empty queue with capacity equal to the length of the reference array and using the natural order.
* @param refArray the reference array.
*/
public ShortHeapIndirectPriorityQueue( short[] refArray ) {
this( refArray, refArray.length, null );
}
/** Wraps a given array in a queue using a given comparator.
*
* <P>The queue returned by this method will be backed by the given array.
* The first <code>size</code> element of the array will be rearranged so to form a heap (this is
* more efficient than enqueing the elements of <code>a</code> one by one).
*
* @param refArray the reference array.
* @param a an array of indices into <code>refArray</code>.
* @param size the number of elements to be included in the queue.
* @param c the comparator used in this queue, or <code>null</code> for the natural order.
*/
public ShortHeapIndirectPriorityQueue( final short[] refArray, final int[] a, final int size, final ShortComparator c ) {
this( refArray, 0, c );
this.heap = a;
this.size = size;
int i = size;
while( i-- != 0 ) {
if ( inv[ a[ i ] ] != -1 ) throw new IllegalArgumentException( "Index " + a[ i ] + " appears twice in the heap" );
inv[ a[ i ] ] = i;
}
ShortIndirectHeaps.makeHeap( refArray, a, inv, size, c );
}
/** Wraps a given array in a queue using a given comparator.
*
* <P>The queue returned by this method will be backed by the given array.
* The elements of the array will be rearranged so to form a heap (this is
* more efficient than enqueing the elements of <code>a</code> one by one).
*
* @param refArray the reference array.
* @param a an array of indices into <code>refArray</code>.
* @param c the comparator used in this queue, or <code>null</code> for the natural order.
*/
public ShortHeapIndirectPriorityQueue( final short[] refArray, final int[] a, final ShortComparator c ) {
this( refArray, a, a.length, c );
}
/** Wraps a given array in a queue using the natural order.
*
* <P>The queue returned by this method will be backed by the given array.
* The first <code>size</code> element of the array will be rearranged so to form a heap (this is
* more efficient than enqueing the elements of <code>a</code> one by one).
*
* @param refArray the reference array.
* @param a an array of indices into <code>refArray</code>.
* @param size the number of elements to be included in the queue.
*/
public ShortHeapIndirectPriorityQueue( final short[] refArray, final int[] a, int size ) {
this( refArray, a, size, null );
}
/** Wraps a given array in a queue using the natural order.
*
* <P>The queue returned by this method will be backed by the given array.
* The elements of the array will be rearranged so to form a heap (this is
* more efficient than enqueing the elements of <code>a</code> one by one).
*
* @param refArray the reference array.
* @param a an array of indices into <code>refArray</code>.
*/
public ShortHeapIndirectPriorityQueue( final short[] refArray, final int[] a ) {
this( refArray, a, a.length );
}
public void enqueue( final int x ) {
if ( inv[ x ] >= 0 ) throw new IllegalArgumentException( "Index " + x + " belongs to the queue" );
if ( size == heap.length ) heap = IntArrays.grow( heap, size + 1 );
inv[ heap[ size ] = x ] = size++;
ShortIndirectHeaps.upHeap( refArray, heap, inv, size, size - 1, c );
}
public boolean contains( final int index ) {
return inv[ index ] >= 0;
}
public int dequeue() {
if ( size == 0 ) throw new NoSuchElementException();
final int result = heap[ 0 ];
if ( --size != 0 ) inv[ heap[ 0 ] = heap[ size ] ] = 0;
inv[ result ] = -1;
if ( size != 0 ) ShortIndirectHeaps.downHeap( refArray, heap, inv, size, 0, c );
return result;
}
public void changed() {
ShortIndirectHeaps.downHeap( refArray, heap, inv, size, 0, c );
}
public void changed( final int index ) {
final int pos = inv[ index ];
if ( pos < 0 ) throw new IllegalArgumentException( "Index " + index + " does not belong to the queue" );
final int newPos = ShortIndirectHeaps.upHeap( refArray, heap, inv, size, pos, c );
ShortIndirectHeaps.downHeap( refArray, heap, inv, size, newPos, c );
}
/** Rebuilds this heap in a bottom-up fashion.
*/
public void allChanged() {
ShortIndirectHeaps.makeHeap( refArray, heap, inv, size, c );
}
public boolean remove( final int index ) {
final int result = inv[ index ];
if ( result < 0 ) return false;
inv[ index ] = -1;
if ( result < --size ) {
inv[ heap[ result ] = heap[ size ] ] = result;
final int newPos = ShortIndirectHeaps.upHeap( refArray, heap, inv, size, result, c );
ShortIndirectHeaps.downHeap( refArray, heap, inv, size, newPos, c );
}
return true;
}
public void clear() {
size = 0;
IntArrays.fill( inv, -1 );
}
}
| [
"participant@hadoop-vm.(none)"
] | participant@hadoop-vm.(none) |
3d8d877271140b9c4938cc9fe96165bbadee81e6 | 0c600206a70badccbb75fa91699b60102a91c8db | /src/test/java/com/musicmath_v2/service/TripletBpmServiceTest.java | 62eb78369ab8d18099cfb615b9549c731c8b9342 | [] | no_license | PeterEJensen/MixtoolsEXAM | 14511ba1c090a88457fd0f5e56234d2fcb016735 | e3768c02df80ec6ef4165430a8f24c97a83cde7b | refs/heads/master | 2020-04-11T07:34:17.210386 | 2019-01-06T20:29:09 | 2019-01-06T20:29:09 | 161,615,212 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 511 | java | package com.musicmath_v2.service;
import com.musicmath_v2.domain.DottedBpmEntity;
import com.musicmath_v2.domain.TripletBpmEntity;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class TripletBpmServiceTest {
TripletBpmService tS = new TripletBpmService();
TripletBpmEntity tE = new TripletBpmEntity();
@Test
public void tripletBpm64() {
tE.setSixtyfourNote(tS.tripletBpm(120));
assertEquals(20.84375,tE.getSixtyfourNote(),0000.00000);
}
} | [
"[email protected]"
] | |
ada048f2588ca2e647529a3bc9fe56146b5977fb | 81f689567f5a64989d73ba0ad2109418047bd52a | /Semester 1 and 2/Assignments/Java/LORD/Battlefield.java | 7cd9dd04cc410c23678abfdf9ac62d3259e62c87 | [] | no_license | hutiann/School_Stuff | b87459b7e2f9239b4f414d782de6b991beddde27 | 67024c9fac9e0b0517e0df30520b82053c91d3fd | refs/heads/master | 2020-07-01T12:46:59.390421 | 2012-11-12T23:24:31 | 2012-11-12T23:24:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,324 | java | /** Battlefield - models a two-dimensional array of Square objects
* Author: Linda Crane
* Data Fields: numRows: int - number of rows in array
* numCols: int - number of cols in array
* battlefield: Square[][]
* numElves: int - number of elves in array
* numOrcs: int - number of orcs in array
* Methods: initial constructor - using parameters of numRows and numCols
* getNumRows - returns numRows
* getNumCols - returns numCols
* getNumElves - returns numElves
* getNumOrcs - returns numOrcs
* setSquare: sets value of square based on parameters row, col and Square object, increments numElves and numOrcs
* display: displays the battlefield array
* moveActor: moves current actor at position indicated by parameters row and col, in direction indicated by parameter direction
*/
public class Battlefield {
private int numRows;
private int numCols;
private Square [] [] battlefield;
private int numElves;
private int numOrcs;
public Battlefield (int numRows, int numCols) {
this.numRows = numRows;
this.numCols = numCols;
battlefield = new Square[numRows][numCols];
for (int i = 0; i < numRows; i++)
for (int j = 0; j < numCols; j++)
battlefield[i][j] = new Square();
}
// get methods
public int getNumRows() { return numRows; }
public int getNumCols() { return numCols; }
public Square getSquare (int row, int col) {
return battlefield[row][col];
}
public int getNumElves() { return numElves; }
public int getNumOrcs() { return numOrcs; }
// set methods
public void setSquare(int row, int col, Square square) {
battlefield[row][col] = new Square(square);
if (square.getActor().getActorType() == 'o' || square.getActor().getActorType() == 'w') numOrcs++;
else if (square.getActor().getActorType() == 'e' || square.getActor().getActorType() == 'h') numElves++;
}
// other methods
public void display () {
// display top border
for (int i = 0; i < numCols+2; i++)
System.out.print("-");
System.out.println();
// display board
for (int i = 0; i < numRows; i++){
System.out.print ("|");
for (int j = 0; j < numCols; j++) {
System.out.print(battlefield[i][j]);
}
System.out.println ("|");
}
// display bottom border
for (int i = 0; i < numCols+2; i++)
System.out.print("-");
System.out.println();
System.out.println ("Current army count - Elves: " + numElves + " Orcs: " + numOrcs);
} // end of display
public void moveActor (int direction, int row, int col){
int newRow = 0;
int newCol = 0;
if (battlefield[row][col].getActor().getActorType() == ' ')
System.out.println ("No actor to move at row " + row + " col " + col);
else if (direction == 0 && row == 0) // move up not allowed
System.out.println ("Actor at row " + row + " col " + col + " cannot move up");
else if (direction == 1 && row == numRows-1) // move down not allowed
System.out.println ("Actor at row " + row + " col " + col + " cannot move down");
else if (direction == 2 && col == 0) // move left not allowed
System.out.println ("Actor at row " + row + " col " + col + " cannot move left");
else if (direction == 3 && col == numCols-1) // move right not allowed
System.out.println ("Actor at row " + row + " col " + col + " cannot move right");
else {
if (direction == 0){ // move up
newRow = row-1;
newCol = col;
} else if (direction == 1) { // move down
newRow = row + 1;
newCol = col;
} else if (direction == 2) { // move left
newRow = row;
newCol = col-1;
} else { // move right
newRow = row;
newCol = col+1;
}
if (battlefield[newRow][newCol].getTerrain() == 'm' && battlefield[row][col].getActor().getStrength() < 30) // cannot move onto a mountain
System.out.println ("Cannot move onto a mountain from row " + row + " and col " + col);
else if (battlefield[newRow][newCol].getTerrain() == 'm' && battlefield[row][col].getActor().getStrength() >= 30){
System.out.println ("Move onto Mountain with strength greater than 30");
battlefield[newRow][newCol].setTerrain('n');
battlefield[newRow][newCol].setActor (new Actor(battlefield[row][col].getActor().getActorType(),
battlefield[row][col].getActor().getStrength()));
battlefield[row][col].setActor (new Actor(' ', 0));
}
else if (battlefield[newRow][newCol].getActor().getActorTeam() == battlefield[row][col].getActor().getActorTeam() )
System.out.println ("Cannot move onto a space occupied by your own team player");
else if (battlefield[newRow][newCol].getActor().getActorType() == ' ' ) {
System.out.println ("Move onto normal terrain to position row " + newRow + " and col" + newCol);
battlefield[newRow][newCol].setActor (new Actor(battlefield[row][col].getActor().getActorType(),
battlefield[row][col].getActor().getStrength()));
battlefield[row][col].setActor (new Actor(' ', 0));
}else // fight
if (battlefield[newRow][newCol].getActor().getStrength() == battlefield[row][col].getActor().getStrength() )
System.out.println ("Battle resulted in draw at row "+ row + "and col" + col );
else if (battlefield[newRow][newCol].getActor().getStrength() > battlefield[row][col].getActor().getStrength() ){
System.out.println ("Lost the battle.... die at row " + row + " col " + col);
if (battlefield[row][col].getActor().getActorType() == 'e' || battlefield[row][col].getActor().getActorType() == 'h') numElves --;
else numOrcs--;
battlefield[row][col].setActor(new Actor(' ', 0));
}
else { System.out.println ("Won the battle...move to row " + row + " col " + col );
if (battlefield[row][col].getActor().getActorType() == 'e' || battlefield[row][col].getActor().getActorType() == 'h') numOrcs --;
else numElves--;
battlefield[newRow][newCol].setActor (new Actor(battlefield[row][col].getActor().getActorType(),
battlefield[row][col].getActor().getStrength()));
battlefield[row][col].setActor (new Actor(' ', 0));
}
} // end else
} // end moveActor method
}// end class Battlefield
| [
"willy@WILLY-LAPTOP.(none)"
] | willy@WILLY-LAPTOP.(none) |
081f18679b686f1a81de689b3ce862f2cb104387 | 17e28f979a105cadebf35d555d8e3199fd215d27 | /src/java/jlr/src/Jlr.java | 017f81392b588c73c4736eb2da0f5ecd758a198b | [
"MIT"
] | permissive | junjiemars/ant-ivy | 10b5408dc8ede7be02bb0a48372051da8b9bda10 | 6041d2e9c3472773bbefc2b67ac6420d8bd148a2 | refs/heads/master | 2016-09-02T00:16:01.925249 | 2014-09-23T09:56:11 | 2014-09-23T09:56:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,420 | java | import org.antlr.v4.runtime.ANTLRInputStream;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.ParseTree;
import org.antlr.v4.runtime.tree.ParseTreeWalker;
import java.io.StringReader;
import static java.lang.System.out;
public final class Jlr {
public static void main(String[] args) throws Exception {
ANTLRInputStream in = null;
if (args.length > 0) {
final StringReader reader = new StringReader(args[0]);
in = new ANTLRInputStream(reader);
} else {
in = new ANTLRInputStream(System.in);
}
// calcT(in); // build with -listener -no-visitor
// calcE(in); // build with -no-listener -visitor
// sqlT(in);
// sqlR(in);
// propT(in);
// propE(in);
rqlE(in);
}
static final void sqlR(final ANTLRInputStream in) throws Exception {
SQLLexer l = new SQLLexer(in);
CommonTokenStream t = new CommonTokenStream(l);
SQLParser p = new SQLParser(t);
ParseTree tree = p.sql();
out.println(tree.toStringTree(p));
SQLVisitor e = new SqlR();
e.visit(tree);
}
static final void sqlT(final ANTLRInputStream in) throws Exception {
SQLLexer l = new SQLLexer(in);
CommonTokenStream t = new CommonTokenStream(l);
SQLParser p = new SQLParser(t);
ParseTree tree = p.sql();
out.println(tree.toStringTree(p));
ParseTreeWalker w = new ParseTreeWalker();
w.walk(new SqlT(), tree);
out.println();
}
static final void calcT(final ANTLRInputStream in) throws Exception {
CalcLexer l = new CalcLexer(in);
CommonTokenStream t = new CommonTokenStream(l);
CalcParser p = new CalcParser(t);
ParseTree tree = p.calc();
out.println(tree.toStringTree(p));
ParseTreeWalker w = new ParseTreeWalker();
final CalcT T = new CalcT(p);
w.walk(T, tree);
out.println();
}
static final void calcE(final ANTLRInputStream in) throws Exception {
CalcLexer l = new CalcLexer(in);
CommonTokenStream t = new CommonTokenStream(l);
CalcParser p = new CalcParser(t);
ParseTree tree = p.calc();
out.println(tree.toStringTree(p));
CalcVisitor e = new CalcE();
e.visit(tree);
}
static final void propT(final ANTLRInputStream in) throws Exception {
PropertyLexer l = new PropertyLexer(in);
CommonTokenStream t = new CommonTokenStream(l);
PropertyParser p = new PropertyParser(t);
ParseTree tree = p.file();
out.println(tree.toStringTree(p));
ParseTreeWalker w = new ParseTreeWalker();
final PropertyT T = new PropertyT();
w.walk(T, tree);
out.println();
}
static final void propE(final ANTLRInputStream in) throws Exception {
PropertyLexer l = new PropertyLexer(in);
CommonTokenStream t = new CommonTokenStream(l);
PropertyParser p = new PropertyParser(t);
ParseTree tree = p.file();
out.println(tree.toStringTree(p));
PropertyVisitor e = new PropertyE();
e.visit(tree);
}
static final void rqlE(final ANTLRInputStream in) throws Exception {
RQLLexer l = new RQLLexer(in);
CommonTokenStream t = new CommonTokenStream(l);
RQLParser p = new RQLParser(t);
ParseTree tree = p.select();
out.println(tree.toStringTree(p));
RQLEmitter e = new RQLEmitter();
e.visit(tree);
for (String s : e.ins()) {
out.println(s);
}
}
}
| [
"[email protected]"
] | |
ff97bd675350d45fd4bedc5cd6defb278431114d | 79595075622ded0bf43023f716389f61d8e96e94 | /app/src/main/java/android/service/autofill/RequiredValidators.java | 118ade67d6bd007312c49a1e976116ea3551d28b | [] | no_license | dstmath/OppoR15 | 96f1f7bb4d9cfad47609316debc55095edcd6b56 | b9a4da845af251213d7b4c1b35db3e2415290c96 | refs/heads/master | 2020-03-24T16:52:14.198588 | 2019-05-27T02:24:53 | 2019-05-27T02:24:53 | 142,840,716 | 7 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,515 | java | package android.service.autofill;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import android.view.autofill.Helper;
import com.android.internal.util.Preconditions;
final class RequiredValidators extends InternalValidator {
public static final Creator<RequiredValidators> CREATOR = new Creator<RequiredValidators>() {
public RequiredValidators createFromParcel(Parcel parcel) {
return new RequiredValidators((InternalValidator[]) parcel.readParcelableArray(null, InternalValidator.class));
}
public RequiredValidators[] newArray(int size) {
return new RequiredValidators[size];
}
};
private final InternalValidator[] mValidators;
RequiredValidators(InternalValidator[] validators) {
this.mValidators = (InternalValidator[]) Preconditions.checkArrayElementsNotNull(validators, "validators");
}
public boolean isValid(ValueFinder finder) {
for (InternalValidator validator : this.mValidators) {
if (!validator.isValid(finder)) {
return false;
}
}
return true;
}
public String toString() {
if (Helper.sDebug) {
return "RequiredValidators: [validators=" + this.mValidators + "]";
}
return super.toString();
}
public int describeContents() {
return 0;
}
public void writeToParcel(Parcel dest, int flags) {
dest.writeParcelableArray(this.mValidators, flags);
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.