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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f8f5a48dfbd6926a95d5e8e517cce17caf498062 | d0f7e2e3f2a95fb51b4916194787c112d27412f3 | /src/popups/test5.java | c4542c31f2b2b8d273bd899464ddf0d33d39e383 | [] | no_license | navyakc/Basics | 4b63974830615f17ad27397b7bcdd6567b3db84d | 30a0fd05476ae45a080f54f1e5d16b8fce446fef | refs/heads/master | 2023-08-01T04:42:31.071931 | 2021-09-21T15:08:55 | 2021-09-21T15:08:55 | 408,868,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 585 | java | package popups;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
public class test5 {
public static void main(String[] args) {
ChromeOptions option=new ChromeOptions();
option.addArguments("--disable-notifications");
WebDriver driver=new ChromeDriver(option);//pass argument , parameterzed
driver.get("https://www.ajio.com/");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS);
}
}
| [
"[email protected]"
] | |
cb0a3de5e1c587996df63b1297e66842741a58e1 | 830de9c1616da3bf7dfad38075ffbe75f0316c69 | /JAVA-Advanced/15.Functional-programming/src/sumNumbers.java | 6a5bbf4e4bb2b32f340cbd2c363da9b9febccdfd | [] | no_license | vessos/JAVA | fdff26155e3211667503b2792343e2fc41e77dd1 | 99e8cf32af8fccbc03c75e575fc6c4a7b2589bda | refs/heads/master | 2021-01-20T01:10:51.793758 | 2017-04-24T10:53:09 | 2017-04-24T10:53:09 | 89,228,960 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 630 | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.function.Function;
public class sumNumbers {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String[]input = reader.readLine().split(", ");
Function<String,Integer>func = n->Integer.parseInt(n);
int sum = 0;
for (String s : input) {
sum+=func.apply(s);
}
System.out.println("Count = " + input.length);
System.out.println("Sum = " + sum);
}
}
| [
"[email protected]"
] | |
7c3685458f1a471c975d2792a7fb546d538eb230 | 5f0d0d6deb3faf5a64806f0a197ea22a672c69ab | /example-app/tests/com/roobit/android/restclient/exampleapp/RestClientTest.java | 1bb3e2fca1722e29d3cc0ee5ef5847b57949e7d0 | [] | no_license | moacap/RestClient | 73b0c43f3d902e3fd7a98cf32a4b2d54a6056007 | aed474de6d9e62a8106778525f00b5b8c2d647e4 | refs/heads/master | 2021-01-18T08:43:56.584902 | 2012-08-30T21:58:26 | 2012-08-30T21:58:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,527 | java | package com.roobit.android.restclient.exampleapp;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import java.io.FileNotFoundException;
import java.net.HttpURLConnection;
import java.util.LinkedHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.roobit.android.restclient.RestClient;
import com.roobit.android.restclient.RestResult;
import com.xtremelabs.robolectric.RobolectricTestRunner;
@RunWith(RobolectricTestRunner.class)
public class RestClientTest {
static final String TEST_ENDPOINT = "http://localhost:4567/test_endpoint";
RestResult restResult;
@Test
public void shouldConfigureSharedSingleton() {
RestClient.clearSharedClient();
RestClient first = RestClient.clientWithBaseUrl("http://api.example.org");
RestClient.clientWithBaseUrl("http://api.google.com");
assertThat(first.getBaseUrl(),
equalTo(RestClient.sharedClient().getBaseUrl()));
}
@Test
public void shouldSetResource() {
RestClient client = RestClient
.clientWithBaseUrl("http://api.example.org")
.setResource("articles");
assertThat("http://api.example.org/articles", equalTo(client.getUrl()));
}
@Test
public void shouldSetQueryParameters() {
LinkedHashMap<String,String> queryParams = new LinkedHashMap<String,String>();
queryParams.put("first_param", "first_value");
queryParams.put("second_param", Boolean.toString(true));
RestClient client = RestClient.clientWithBaseUrl("http://api.example.org")
.setResource("articles")
.setQueryParameters(queryParams);
assertThat("http://api.example.org/articles?first_param=first_value&second_param=true",
equalTo(client.getUrl()));
}
@Test
public void shouldGet() throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
RestClient.clientWithBaseUrl(TEST_ENDPOINT)
.setResource("articles")
.execute(new RestClient.OnCompletionListener() {
@Override
public void success(RestClient client, RestResult result) {
restResult = result;
latch.countDown();
}
@Override
public void failedWithError(RestClient restClient, int responseCode, RestResult result) {
restResult = result;
latch.countDown();
}
});
if (latch.await(5, TimeUnit.SECONDS)) {
assertTrue(restResult.isSuccess());
assertThat(HttpURLConnection.HTTP_OK, equalTo(restResult.getResponseCode()));
assertThat("Articles", equalTo(restResult.getResponse()));
}
else {
fail("Timed out waiting for GET completion");
}
}
@Test
public void shouldThrowOnNonExistentResource() throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
RestClient.clientWithBaseUrl(TEST_ENDPOINT)
.setResource("articles/does_not_exist")
.execute(new RestClient.OnCompletionListener() {
@Override
public void success(RestClient client, RestResult result) {
restResult = result;
latch.countDown();
}
@Override
public void failedWithError(RestClient restClient, int responseCode, RestResult result) {
restResult = result;
latch.countDown();
}
});
if (latch.await(5, TimeUnit.SECONDS)) {
assertFalse(restResult.isSuccess());
assertThat(restResult.getException(), is(FileNotFoundException.class));
assertThat(HttpURLConnection.HTTP_NOT_FOUND, equalTo(restResult.getResponseCode()));
}
else {
fail("Timed out waiting for non-existent POST completion");
}
}
}
| [
"[email protected]"
] | |
20ec6d789dbf2e43c7b013c6d0632e0aec7d75fe | d5f09c7b0e954cd20dd613af600afd91b039c48a | /sources/com/alibaba/baichuan/trade/biz/auth/b.java | 42cd7045a493b1e8d861e48213b322534598372a | [] | no_license | t0HiiBwn/CoolapkRelease | af5e00c701bf82c4e90b1033f5c5f9dc8526f4b3 | a6a2b03e32cde0e5163016e0078391271a8d33ab | refs/heads/main | 2022-07-29T23:28:35.867734 | 2021-03-26T11:41:18 | 2021-03-26T11:41:18 | 345,290,891 | 5 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,751 | java | package com.alibaba.baichuan.trade.biz.auth;
import android.text.TextUtils;
import com.alibaba.baichuan.trade.common.adapter.ut.AlibcUserTracker;
import com.alibaba.baichuan.trade.common.adapter.ut.AlibcUserTradeHelper;
import com.alibaba.baichuan.trade.common.utils.AlibcLogger;
import com.taobao.tao.remotebusiness.auth.AuthListener;
import com.taobao.tao.remotebusiness.auth.IRemoteAuth;
import java.util.List;
public class b implements IRemoteAuth {
private boolean a;
private static class a {
public static b a = new b();
}
/* renamed from: com.alibaba.baichuan.trade.biz.auth.b$b reason: collision with other inner class name */
class C0011b implements AlibcAuthListener {
AuthListener a;
C0011b(AuthListener authListener) {
this.a = authListener;
}
@Override // com.alibaba.baichuan.trade.biz.auth.AlibcAuthListener
public void onCancel() {
b.this.a(false);
AuthListener authListener = this.a;
if (authListener != null) {
authListener.onAuthCancel("FAIL_SYS_ACCESS_TOKEN_CANCEL", "用户取消授权");
}
}
@Override // com.alibaba.baichuan.trade.biz.auth.AlibcAuthListener
public void onError(String str, String str2) {
b.this.a(false);
AuthListener authListener = this.a;
if (authListener != null) {
authListener.onAuthFail(str, str2);
}
}
@Override // com.alibaba.baichuan.trade.biz.auth.AlibcAuthListener
public void onReTry() {
b.this.a(true);
}
@Override // com.alibaba.baichuan.trade.biz.auth.AlibcAuthListener
public void onSuccess() {
b.this.a(false);
AuthListener authListener = this.a;
if (authListener != null) {
authListener.onAuthSuccess();
}
}
}
private b() {
this.a = false;
}
public static b a() {
return a.a;
}
/* access modifiers changed from: private */
public synchronized void a(boolean z) {
this.a = z;
}
@Override // com.taobao.tao.remotebusiness.auth.IRemoteAuth
public void authorize(String str, String str2, String str3, boolean z, AuthListener authListener) {
AlibcLogger.d("Alibc", "call authorize authParam = " + str + " api_v = " + str2 + " errorInfo = " + str3);
a(true);
if (!TextUtils.isEmpty(str)) {
List<String> a2 = AlibcAuth.a(str);
AlibcAuth.postHintList(str, str3);
AlibcAuth.auth(a2, str3, z, new C0011b(authListener));
} else {
AlibcAuth.auth(str2, str3, z, new C0011b(authListener));
}
if (!TextUtils.isEmpty(str3)) {
AlibcUserTracker.getInstance().sendUsabilityFailure("BCPCSDK", "Hint_List_Error", AlibcUserTradeHelper.getArgs(), "190101", "权限列表配置错误");
}
}
@Override // com.taobao.tao.remotebusiness.auth.IRemoteAuth
public String getAuthToken() {
String authToken = AlibcAuthInfo.getInstance().getAuthToken();
AlibcLogger.d("Alibc", "getAuthToken = " + authToken);
return authToken;
}
@Override // com.taobao.tao.remotebusiness.auth.IRemoteAuth
public boolean isAuthInfoValid() {
boolean checkAuthToken = AlibcAuthInfo.getInstance().checkAuthToken();
AlibcLogger.d("Alibc", "isAuthInfoValid = " + checkAuthToken);
return checkAuthToken;
}
@Override // com.taobao.tao.remotebusiness.auth.IRemoteAuth
public synchronized boolean isAuthorizing() {
AlibcLogger.d("Alibc", "isAuthorizing = " + this.a);
return this.a;
}
}
| [
"[email protected]"
] | |
23eee2a7495cd427a0693c54586f6755663b1a96 | 9026519456f3a6bf274280d771f68cc4a6b72143 | /src/main/java/com/example/coding/workout/Multithreading/SimpleTaskCallable.java | 132b7aef59af0d3ea71437b998e7b9aa37585679 | [] | no_license | raviprakash438/coding.workout | f46fded352146c3050b565c8c474bd75c2c9d5cb | bfffc0a2d5d16132032c84511299f5396da8158a | refs/heads/main | 2023-06-10T17:42:39.285011 | 2021-06-27T13:09:28 | 2021-06-27T13:09:28 | 364,737,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 937 | java | package com.example.coding.workout.Multithreading;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
public class SimpleTaskCallable implements Callable {
private int i;
public SimpleTaskCallable(int i) {
this.i = i;
}
@Override
public Integer call() throws Exception {
Thread thread = Thread.currentThread();
System.out.println(thread.getName()+": Start executing Factorical!!");
int fact=1;
for(int j=i;j>1;j--){
fact *=j;
}
Thread.sleep(3000);
return fact;
}
public static void main(String[] args) {
SimpleTaskCallable simpleTaskCallable = new SimpleTaskCallable(1);
Thread t1= new Thread(() -> {
try {
simpleTaskCallable.call();
} catch (Exception e) {
e.printStackTrace();
}
});
t1.start();
}
}
| [
"Happy@2209"
] | Happy@2209 |
30633db6b782127caf45a76ccdc49374f3678ff6 | c2745516073be0e243c2dff24b4bb4d1d94d18b8 | /sdk/synapse/azure-resourcemanager-synapse/src/main/java/com/azure/resourcemanager/synapse/models/PrivateLinkHubInfoListResult.java | 8d02f4ab3898f8b866ba439c96930b6bc3062653 | [
"MIT",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause",
"CC0-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later"
] | permissive | milismsft/azure-sdk-for-java | 84b48d35e3fca8611933b3f86929788e5e8bceed | f4827811c870d09855417271369c592412986861 | refs/heads/master | 2022-09-25T19:29:44.973618 | 2022-08-17T14:43:22 | 2022-08-17T14:43:22 | 90,779,733 | 1 | 0 | MIT | 2021-12-21T21:11:58 | 2017-05-09T18:37:49 | Java | UTF-8 | Java | false | false | 2,051 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.synapse.models;
import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.synapse.fluent.models.PrivateLinkHubInner;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
/** List of privateLinkHubs. */
@Fluent
public final class PrivateLinkHubInfoListResult {
/*
* Link to the next page of results
*/
@JsonProperty(value = "nextLink")
private String nextLink;
/*
* List of privateLinkHubs
*/
@JsonProperty(value = "value")
private List<PrivateLinkHubInner> value;
/**
* Get the nextLink property: Link to the next page of results.
*
* @return the nextLink value.
*/
public String nextLink() {
return this.nextLink;
}
/**
* Set the nextLink property: Link to the next page of results.
*
* @param nextLink the nextLink value to set.
* @return the PrivateLinkHubInfoListResult object itself.
*/
public PrivateLinkHubInfoListResult withNextLink(String nextLink) {
this.nextLink = nextLink;
return this;
}
/**
* Get the value property: List of privateLinkHubs.
*
* @return the value value.
*/
public List<PrivateLinkHubInner> value() {
return this.value;
}
/**
* Set the value property: List of privateLinkHubs.
*
* @param value the value value to set.
* @return the PrivateLinkHubInfoListResult object itself.
*/
public PrivateLinkHubInfoListResult withValue(List<PrivateLinkHubInner> value) {
this.value = value;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (value() != null) {
value().forEach(e -> e.validate());
}
}
}
| [
"[email protected]"
] | |
a30aa340486e511a06508a4d59c71ee3786aeb22 | c474b03758be154e43758220e47b3403eb7fc1fc | /apk/decompiled/com.tinder_2018-07-26_source_from_JADX/sources/com/tinder/domain/meta/model/Location.java | dc3a3ae503e91d54d0aa85ff7b3f436de445e615 | [] | no_license | EstebanDalelR/tinderAnalysis | f80fe1f43b3b9dba283b5db1781189a0dd592c24 | 941e2c634c40e5dbf5585c6876ef33f2a578b65c | refs/heads/master | 2020-04-04T09:03:32.659099 | 2018-11-23T20:41:28 | 2018-11-23T20:41:28 | 155,805,042 | 0 | 0 | null | 2018-11-18T16:02:45 | 2018-11-02T02:44:34 | null | UTF-8 | Java | false | false | 407 | java | package com.tinder.domain.meta.model;
public abstract class Location {
public static abstract class Builder {
public abstract Location build();
public abstract Builder lat(double d);
public abstract Builder lon(double d);
}
public abstract double lat();
public abstract double lon();
public static Builder builder() {
return new Builder();
}
}
| [
"[email protected]"
] | |
e7f5c717c5ddd58a8844f5b8d1eda0a7a2b1cacb | 90559c08c863cc03321828b5862290f887c8f3a5 | /src/ua/com/alevel/coderepairing/Album.java | 7088efe4825254483ddc8d1fd3881a82c6d7bbd8 | [] | no_license | VitaliyFedorov021/alevel-generics | d2cfe5dd2142b2d9d0cedc333a494b8ef4207b8f | 3e4d9be75cab09ccea5b1b69214f293ccd10cf17 | refs/heads/master | 2022-12-15T22:24:47.366935 | 2020-09-03T11:53:57 | 2020-09-03T11:53:57 | 292,555,582 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 74 | java | package ua.com.alevel.coderepairing;
public class Album extends Book {
}
| [
"[email protected]"
] | |
98a9de8d2895f16946ee4289b27887519cadb0f9 | f1ba1dcaec413ef5fb2dcf2b4a92e0e7640a8660 | /src/test/java/io/ricall/kafka/delayservice/DelayServiceApplicationTests.java | 8201234b78e2b3d1a637a60d46aa1c84a1304be2 | [] | no_license | ricall/kafka-delay-service | 37c57be4d5f6b6e8bbf92a73c5b84c5e36aa841f | d412999216d90f48933d4f803e12fce5e1f2aa97 | refs/heads/main | 2023-04-21T09:41:23.242778 | 2021-05-29T12:58:20 | 2021-05-29T12:58:20 | 371,261,260 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package io.ricall.kafka.delayservice;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DelayServiceApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
8c8fd18740c57abb81580a04793d831a631cd666 | 3d279a0985820b21e9aef85d6194353f49b0f907 | /src/selfTestchap2/Building.java | d17aa71b6fb8bd9a856a394acd594e28f5febc3c | [] | no_license | willsonwill78/scjp6SierraBook | 24070448f23934cc528dcf2830a830f4b2dd2713 | c377ed26e65fdde0a82380edcb4c838ce8e32f29 | refs/heads/master | 2020-03-17T04:22:22.096830 | 2018-05-13T21:55:49 | 2018-05-13T21:55:49 | 133,272,265 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 173 | java | package selfTestchap2;
public class Building {
public Building(){
System.out.println("b ");
}
public Building(String name){
System.out.println("bn " + name);
}
}
| [
"[email protected]"
] | |
b287639788356529ac40ea7b80e60c1f2ee31d89 | da181f89e0b26ffb3fc5f9670a3a5f8f1ccf0884 | /CoreGestionTextilLevel/src/ar/com/textillevel/entidades/cuenta/detalles/DetalleMovimiento.java | 0593aeaa4fbb7f167ed767471c4ed06f240a414e | [] | no_license | nacho270/GTL | a1b14b5c95f14ee758e6b458de28eae3890c60e1 | 7909ed10fb14e24b1536e433546399afb9891467 | refs/heads/master | 2021-01-23T15:04:13.971161 | 2020-09-18T00:58:24 | 2020-09-18T00:58:24 | 34,962,369 | 2 | 1 | null | 2016-08-22T22:12:57 | 2015-05-02T20:31:49 | Java | UTF-8 | Java | false | false | 313 | java | package ar.com.textillevel.entidades.cuenta.detalles;
//TODO: Mapear herencia en una sola tabla
public abstract class DetalleMovimiento {
private Integer id;
public DetalleMovimiento() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
| [
"[email protected]@9de48aec-ec99-11dd-b2d9-215335d0b316"
] | [email protected]@9de48aec-ec99-11dd-b2d9-215335d0b316 |
fe4e65b2ee5f2eb5d509083c6f4a300ed41e88aa | 7e4267c64dc73904d9feef588b03d90bc4530fd9 | /app/src/main/java/com/swust/androidpile/home/fragment/QueryAroundFragment.java | 44b89d180bd684f747231bb2e834f798618fa202 | [] | no_license | P79N6A/pileAndroid | d5c1e9de40726044f71c0d8c5505b8688036f57c | b724a39ec2ea130dc8a36fb0a3b435590a541bce | refs/heads/master | 2020-04-08T02:18:33.204529 | 2018-11-24T11:36:16 | 2018-11-24T11:36:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,340 | java | package com.swust.androidpile.home.fragment;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.amap.api.location.AMapLocationListener;
import com.amap.api.maps.AMap;
import com.amap.api.maps.LocationSource;
import com.amap.api.maps.model.BitmapDescriptorFactory;
import com.amap.api.maps.model.LatLng;
import com.amap.api.maps.model.Marker;
import com.amap.api.maps.model.MarkerOptions;
import com.amap.api.navi.model.NaviLatLng;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonSyntaxException;
import com.swust.androidpile.R;
import com.swust.androidpile.home.activity.StationDetailsActivity;
import com.swust.androidpile.home.model.QueryAroundBiz;
import com.swust.androidpile.home.model.QueryAroundBizImpl;
import com.swust.androidpile.home.navi.GPSNaviActivity;
import com.swust.androidpile.home.presenter.QueryAroundPresenter;
import com.swust.androidpile.home.view.QueryAroundView;
import com.swust.androidpile.utils.LogUtil;
import com.swust.androidpile.utils.Url;
import com.swust.androidpile.utils.ToastUtil;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import cn.pedant.SweetAlert.SweetAlertDialog;
public class QueryAroundFragment extends LocationFragment implements LocationFragment.CallBack, QueryAroundView
, AMap.OnMarkerClickListener, LocationSource, AMapLocationListener {
private static final String TAG = "QueryAroundFragment";
private QueryAroundBiz model = new QueryAroundBizImpl();
public QueryAroundPresenter presenter = new QueryAroundPresenter();
private View view;
private ProgressDialog progressDialog;
private TextView titleName;
private Marker lastMarker;
public JsonArray array;
private android.support.v7.app.AlertDialog dialog;
private SweetAlertDialog pDialog;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = super.onCreateView(inflater, container, savedInstanceState);
try {
initPresenter();
initView();
} catch (Exception e) {
e.printStackTrace();
}
initListener();
return view;
}
/**
* 初始化视图
*/
private void initView() {
showProgressDialog();
titleName = (TextView) getActivity().findViewById(R.id.input_edittext);
}
/**
* 初始化事件分发器
*/
private void initPresenter() {
presenter.setViewAndModel(view.getContext(), this, model);
}
/**
* 初始化控件监听器
*/
private void initListener() {
aMap.setOnMarkerClickListener(this);// 设置点击marker事件监听器
setCallBack(this);//回调监听定位
}
/**
* 定位回调:获取当前定位点的经纬度以及城市名
*
* @param lp
* @param cityName
* @param aMap
*/
@Override
public void getInfo(LatLng lp, String cityName, AMap aMap) {
initTitleName(cityName);
String url = Url.getInstance().getPath(2);
presenter.findChargingStations(url, cityName, lp);
}
@Override
public void getError() {
//比如没网定位失败的时候,需要关闭弹出框
stopProgressDialog();
}
private void initTitleName(String cityName) {
String covertCity = cityName;
titleName.setTextColor(QueryAroundFragment.this.getResources().getColor(R.color.white));
if (cityName.equals("河南省")) {
covertCity = "济源市";
}
titleName.setText(covertCity);
}
@Override
public void show(String jsonstring) {
ToastUtil.showToast(view.getContext(), jsonstring);
}
@Override
public void showProgressDialog() {
//弹出框适配视图
pDialog = new SweetAlertDialog(getActivity(), SweetAlertDialog.PROGRESS_TYPE);
pDialog.getProgressHelper().setBarColor(getResources().getColor(R.color.barprogress));
pDialog.setTitleText("请稍后!");
pDialog.show();
}
@Override
public void stopProgressDialog() {
pDialog.dismiss();
}
/**
* 请求电站查询回调:获取充电站信息并添加到地图中去
*
* @param jsonstring
*/
@Override
public void getStations(String jsonstring) {
LogUtil.sop(TAG, jsonstring);//所有电桩信息
JsonParser parser = new JsonParser();
JsonObject obj = (JsonObject) parser.parse(jsonstring);
array = obj.get("infoArray").getAsJsonArray();
ArrayList<MarkerOptions> markerOptionlst = new ArrayList<MarkerOptions>();
for (int i = 0; i < array.size(); i++) {//image=map
JsonObject json_station = (JsonObject) ((JsonObject) array.get(i)).get("station");
//经纬度数据库有可能登记错误,需要捕捉
try {
double lat = json_station.get("lat").getAsDouble(), lng = json_station.get("lng").getAsDouble();
if (lat <= 90 && lat >= 0 && lng <= 180 && lng >= 0) {
MarkerOptions markerOption = new MarkerOptions()
.anchor(0.5f, 0.5f)
.snippet("" + i)//这个用来标记当前兴趣点是第几个电站
.position(new LatLng(json_station.get("lat").getAsDouble(), json_station.get("lng").getAsDouble()))
.icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory
.decodeResource(getResources(),
R.mipmap.ditu)))
.draggable(true);
markerOptionlst.add(markerOption);
}
} catch (Exception e) {
e.printStackTrace();
}
}
// aMap.moveCamera(CameraUpdateFactory.zoomTo(17)); //地图的缩放级别:3--19
// aMap.moveCamera(CameraUpdateFactory.changeLatLng(lp));
List<Marker> markerlst = aMap.addMarkers(markerOptionlst, true);
}
@Override
public void getStationsByUpdate(String jsonstring) {
}
/**
* 兴趣点点击弹出框自定义
*
* @param marker
* @return
*/
@Override
public boolean onMarkerClick(final Marker marker) {
lastMarker = marker;
final int index = Integer.parseInt(marker.getSnippet());
//自定义弹出框
LayoutInflater inflater = getActivity().getLayoutInflater();
//自定义布局
View layout = inflater.inflate(R.layout.view_markactivity_infowindow, null);
//ListView里面内容的适配
TextView textView1 = (TextView) layout.findViewById(R.id.textView1);//充电站名
TextView textView2 = (TextView) layout.findViewById(R.id.textView2);//距离
TextView textView3 = (TextView) layout.findViewById(R.id.textView3);//收费标准
TextView textView4 = (TextView) layout.findViewById(R.id.textView4);//总桩数
TextView textView5 = (TextView) layout.findViewById(R.id.textView5);//空桩数
final JsonObject json_station = (JsonObject) ((JsonObject) array.get(index)).get("station");
textView1.setText(json_station.get("stationname").getAsString());
double distance = ((JsonObject) array.get(index)).get("distance").getAsDouble();
if (distance > 1000) {
DecimalFormat df = new DecimalFormat("0.00");
distance = Double.parseDouble(df.format(distance / 1000));
textView2.setText("距离:" + distance + "KM");
} else {
textView2.setText("距离:" + distance + "M");
}
textView3.setText("收费标准:" + json_station.get("rate").getAsString());
try {
textView4.setText("总桩数:" + json_station.get("capacity").getAsString());
} catch (Exception e) {
e.printStackTrace();
}
textView5.setText("空闲数:" + json_station.get("relaxPiles").getAsString());
//进入导航
layout.findViewById(R.id.button1).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), GPSNaviActivity.class);
//先纬度latitude,后精度longitude
NaviLatLng mEndLatlng = new NaviLatLng(json_station.get("lat").getAsDouble(), json_station.get("lng").getAsDouble());
NaviLatLng mStartLatlng = new NaviLatLng(lp.latitude, lp.longitude);
intent.putExtra("mEndLatlng", mEndLatlng);
intent.putExtra("mStartLatlng", mStartLatlng);
startActivity(intent);
}
});
//进入充电桩详情页
layout.findViewById(R.id.button2).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {//pileQuery
try {
Intent intent = new Intent(getActivity(), StationDetailsActivity.class);
JsonObject obj = (JsonObject) array.get(index);
obj.addProperty("lat", lp.latitude);
obj.addProperty("lng", lp.longitude);
intent.putExtra("array_one", obj.toString());
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
}
});
//点击Dialog以外的区域触发事件
new AlertDialog.Builder(getActivity())
.setView(layout)
.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
lastMarker.hideInfoWindow();
}
})
.show();
return false;
}
}
| [
"[email protected]"
] | |
8a7d92e5209909c44f88dbe9990f00dcd33ac5a8 | 959381e3268a434a31b8663db27770388d246f46 | /profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/functions/ParseRequestStatusURI.java | e8070c31ceb725eace6f09075646419fe245797d | [
"Apache-2.0"
] | permissive | jclouds/jclouds-labs | 32f1e3f617d1353fcf5cf75af170061c202ce8af | 65d27af44a6e6fa7a1b115aea0891095adb81d82 | refs/heads/master | 2023-03-16T00:27:59.856520 | 2020-07-25T13:33:57 | 2020-07-25T13:33:57 | 10,040,970 | 35 | 72 | null | 2020-07-25T13:30:53 | 2013-05-13T20:47:47 | Java | UTF-8 | Java | false | false | 1,380 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jclouds.profitbricks.rest.functions;
import java.net.URI;
import javax.inject.Singleton;
import org.jclouds.http.HttpResponse;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Function;
import com.google.common.net.HttpHeaders;
@Singleton
public class ParseRequestStatusURI implements Function<HttpResponse, URI> {
@Override
@Nullable
public URI apply(HttpResponse input) {
String location = input.getFirstHeaderOrNull(HttpHeaders.LOCATION);
return location != null ? URI.create(location) : null;
}
}
| [
"[email protected]"
] | |
bd03736be0fbac345b955d91e064a2be834ea6be | ba74038a0d3a24d93e6dbd1f166530f8cb1dd641 | /teamclock/src/java/com/fivesticks/time/activity/ActivityTest.java | 041f02d1a44ae599ee4b04515ee847cb1463086a | [] | no_license | ReidCarlberg/teamclock | 63ce1058c62c0a00d63a429bac275c4888ada79a | 4ac078610be86cf0902a73b1ba2a697f9dcf4e3c | refs/heads/master | 2016-09-05T23:46:28.600606 | 2009-09-18T07:25:37 | 2009-09-18T07:25:37 | 32,190,901 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,109 | java | /*
Five Sticks
6957 W. North Ave., #202
Chicago, IL 60302
USA
http://www.fivesticks.com
mailto:[email protected]
Copyright (c) 2003-2004, Five Sticks Publications, Inc.
All rights reserved.
Redistribution and use in source and binary forms,
with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain
the above copyright notice, this list of conditions
and the following disclaimer.
* Redistributions in binary form must reproduce
the above copyright notice, this list of conditions
and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the Five Sticks Publications, Inc.,
nor the names of its contributors may be used to
endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
license: http://www.opensource.org/licenses/bsd-license.php
This software uses a variety of Open Source software as
a foundation. See the file
[your install]/WEB-INF/component-acknowledgement.txt
For more information.
*/
/*
* Created on Nov 1, 2003
*
*/
package com.fivesticks.time.activity;
import java.util.Date;
import junit.framework.TestCase;
import com.fivesticks.time.systemowner.SystemOwner;
import com.fivesticks.time.systemowner.SystemOwnerTestFactory;
import com.fivesticks.time.testutil.JunitSettings;
/**
* @author Reid
*
*/
public class ActivityTest extends TestCase {
SystemOwner systemOwner;
/*
* (non-Javadoc)
*
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception {
super.setUp();
JunitSettings.initializeTestSystem();
systemOwner = new SystemOwnerTestFactory().buildWithDefaultSettings();
}
public void testBasic_A() throws Exception {
Activity t = new Activity();
t.setComments("comments");
t.setDate(new Date());
t.setElapsed(new Double(1.0));
t.setProject("proj");
t.setStart(new Date());
t.setStop(new Date());
t.setTask("task");
t.setUsername("user");
t.setProjectId(new Long(1));
t.setOwnerKey(systemOwner.getKey());
t = ActivityDAOFactory.factory.build().save(t);
for (int i = 0; i < 100; i++) {
t.setComments("comments " + i);
t = ActivityDAOFactory.factory.build().save(t);
}
}
public void testBasic_B() throws Exception {
Activity t = new Activity();
t.setComments("comments");
t.setDate(new Date());
t.setElapsed(new Double(1.0));
t.setProject("proj");
t.setStart(new Date());
t.setStop(new Date());
t.setTask("task");
t.setUsername("user");
t.setProjectId(new Long(1));
t.setOwnerKey(systemOwner.getKey());
t = ActivityDAOFactory.factory.build().save(t);
for (int i = 0; i < 100; i++) {
Activity t2 = ActivityDAOFactory.factory.build().get(t.getId());
t2.setComments("comments " + i);
t2 = ActivityDAOFactory.factory.build().save(t2);
}
}
} | [
"reidcarlberg@c917f71e-a3f3-11de-ba6e-69e41c8db662"
] | reidcarlberg@c917f71e-a3f3-11de-ba6e-69e41c8db662 |
1e2bd9bf22c8c65e905edc35a9a5aa159e3a114d | 38687b3c6f314f793cf7cdf4ecf4ded127c0460a | /UsuarioGUI.java | 16d164ef2fddae01ebfe08559b80e7c9bd57663f | [
"MIT"
] | permissive | orozcojuan1998/Proyecto-Distribuidos-Final | 801e47c00ba53abf63d1c86fc9f479c3ce0ff335 | 2b18b136730d6f0659f6e9fef8d85f3afadbc689 | refs/heads/master | 2020-05-27T02:07:22.388345 | 2019-05-28T14:39:07 | 2019-05-28T14:39:07 | 188,447,544 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,607 | java | package distribuidos;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.BorderLayout;
import java.awt.Color;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.border.LineBorder;
import javax.swing.JButton;
import javax.swing.JPanel;
import java.awt.event.ActionListener;
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Vector;
import java.awt.event.ActionEvent;
import javax.swing.JScrollPane;
import javax.swing.JTable;
public class UsuarioGUI {
private JFrame frame;
private JTextField tarjeta;
private Vector<Vector<Number>> rowData;
private String[] nombreColumnas = {"Nombre","Precio", "Cantidad"};
private Vector<String> columnas;
private JTable tbProductos;
/**
* Launch the application.
* @throws NotBoundException
* @throws RemoteException
* @throws MalformedURLException
*/
public static void main(String[] args) throws MalformedURLException, RemoteException, NotBoundException {
RMIInterface control = (RMIInterface)Naming.lookup("rmi://localhost:1900" + "/distribuidos");
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
UsuarioGUI window = new UsuarioGUI(control);
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
* @param control
*/
public UsuarioGUI(RMIInterface control) {
initialize(control);
}
/**
* Initialize the contents of the frame.
*/
private void initialize(RMIInterface control) {
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.getContentPane().setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(0, 0, 434, 261);
frame.getContentPane().add(panel);
panel.setLayout(null);
JButton btnNewButton = new JButton("Comprar");
btnNewButton.setBounds(335, 227, 89, 23);
panel.add(btnNewButton);
panel.setVisible(false);
JLabel lblNoTarjeta = new JLabel("No. Tarjeta:");
lblNoTarjeta.setBounds(46, 72, 63, 14);
frame.getContentPane().add(lblNoTarjeta);
tarjeta = new JTextField();
tarjeta.setBounds(113, 70, 104, 20);
frame.getContentPane().add(tarjeta);
tarjeta.setColumns(10);
JButton btnIngresar = new JButton("Ingresar");
btnIngresar.setBounds(113, 158, 89, 23);
frame.getContentPane().add(btnIngresar);
JPanel pagoRealizado = new JPanel();
pagoRealizado.setBounds(0, 0, 434, 261);
frame.getContentPane().add(pagoRealizado);
pagoRealizado.setLayout(null);
JLabel compraResultado = new JLabel("");
compraResultado.setBounds(0, 0, 220, 17);
pagoRealizado.add(compraResultado);
pagoRealizado.setVisible(false);
btnIngresar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
boolean respuesta = false;
String tarjetaNum = tarjeta.getText();
try {
respuesta = control.login(tarjetaNum);
} catch (RemoteException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
if (respuesta) {
lblNoTarjeta.setVisible(false);
tarjeta.setVisible(false);
btnIngresar.setVisible(false);
panel.setVisible(true);
JScrollPane scrollPane = new JScrollPane();
scrollPane.setBounds(42, 182, 580, 136);
panel.add(scrollPane);
rowData.removeAllElements();
ArrayList<Producto> productos = new ArrayList<Producto>();
try {
productos = control.getProducts();
} catch (RemoteException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
for (Producto p: productos) {
Vector fila = new Vector();
fila.add(p.getNombre());
fila.add(p.getPrecio());
fila.add(p.getCantidadDisponible());
rowData.add(fila);
}
tbProductos = new JTable(rowData,columnas);
scrollPane.setViewportView(getDatosProductos());
}
}
});
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ArrayList<Producto> productos = new ArrayList<Producto>();
if(tbProductos.getSelectedRows().length > -1) {
int[] selectedrows = tbProductos.getSelectedRows();
for (int i = 0; i < selectedrows.length; i++) {
Producto p = new Producto();
p.setNombre((String) tbProductos.getValueAt(selectedrows[i], 0));
p.setPrecio((float) tbProductos.getValueAt(selectedrows[i], 1));
p.setCantidadDisponible((int) tbProductos.getValueAt(selectedrows[i], 2));
productos.add(p);
}
}
try {
boolean flag;
flag = control.check_out(productos);
if(flag) {
panel.setVisible(false);
pagoRealizado.setVisible(true);
}
} catch (RemoteException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
/*
jTable.setRowSelectionAllowed(true);
jTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
if (jTable.getSelectedRows() > -1) {
int[] selectedrows = jTable.getSelectedRows();
for (int i = 0; i < selectedrows.length; i++)
{
System.out.println(jTable.getValueAt(selectedrows[i], 0).toString());
}
}
*/
public JTable getDatosProductos()
{
if(tbProductos == null)
{
rowData = new Vector<Vector<Number>>();
columnas = new Vector<String>(Arrays.asList(this.nombreColumnas));
tbProductos = new JTable(rowData, columnas);
tbProductos.setForeground(new Color(255, 0, 0));
tbProductos.setBorder(new LineBorder(new Color(0, 0, 0)));
tbProductos.setBackground(new Color(255, 0, 0));
tbProductos.setForeground(Color.BLUE);
tbProductos.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
tbProductos.setCellSelectionEnabled(true);
tbProductos.setColumnSelectionAllowed(true);
tbProductos.getTableHeader().setReorderingAllowed(false);
tbProductos.getTableHeader().setResizingAllowed(false);
tbProductos.setRowSelectionAllowed(true);
tbProductos.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
}
return tbProductos;
}
}
| [
"[email protected]"
] | |
3ac50f27cb01c02de49d3cee7fdfaa72c93fca23 | 9e16de1d62d713e78518efb2af69ed3ad9a40e3b | /src/test/java/work/tomosse/TkyBrothersScoreServerApplicationTests.java | 12922a5cf4db544eff54bee32bc8f1a8513b8e41 | [] | no_license | n-karuta-club/tky-brothers-score-server | 9e9dae3072d59e27995934f98b3e04463a41a29a | 0304d56c492af74ea59e0f2f7ebe04cde678d20e | refs/heads/master | 2020-04-05T00:03:01.873008 | 2018-11-19T18:20:38 | 2018-11-19T18:20:38 | 156,381,264 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package work.tomosse;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class TkyBrothersScoreServerApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
] | |
e1b935779050fecfe433eda66abdf52ba5da8be6 | 49f1a1b3b99efb323ea26855acc6eccafcc642b2 | /src/main/java/dao/CourseDAOImpl.java | e203f88eddb60c5b8dc9a483b6a084c60df047a4 | [] | no_license | hollanderm12/cgs2 | 2b6ca3c089b59d43517141147e539681ee6f39f1 | 18a9e03cf72a59a6080f1b2df1111f24a337681e | refs/heads/master | 2020-03-26T09:45:45.264028 | 2018-09-04T14:38:19 | 2018-09-04T14:38:19 | 144,763,475 | 1 | 0 | null | 2018-08-14T19:33:33 | 2018-08-14T19:26:44 | Java | UTF-8 | Java | false | false | 1,606 | java | package dao;
import java.util.List;
import model.Course;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
public class CourseDAOImpl implements CourseDAO {
@Autowired
private SessionFactory sessionFactory;
public void setSessionFactory(SessionFactory sf){
this.sessionFactory = sf;
}
@Override
@Transactional
public void addCourse(Course s) {
Session session = this.sessionFactory.getCurrentSession();
session.persist(s);
}
@Override
public void updateCourse(Course s) {
Session session = this.sessionFactory.getCurrentSession();
session.update(s);
}
@SuppressWarnings("unchecked")
@Override
public List<Course> listCourses() {
Session session = this.sessionFactory.getCurrentSession();
List<Course> coursesList = session.createQuery("from Course order by courseID").list();
return coursesList;
}
@Override
public Course getCourseById(int id) {
Session session = this.sessionFactory.getCurrentSession();
Course s = (Course) session.get(Course.class, id);
return s;
}
@Override
public void removeCourse(int id) {
Session session = this.sessionFactory.getCurrentSession();
Course s = (Course) session.load(Course.class, id);
if(null != s){
session.delete(s);
}
}
}
| [
"[email protected]"
] | |
140fbf1bf6926f9a9c747a90f6673d90bf249d06 | 1f29f7842e30d6265fb9dbb302fe9414755e7403 | /src/main/java/com/eurodyn/okstra/OpenLRPoiWithAccessPointType.java | 498aec931477e4843ad2defb30a96ad75b007754 | [] | no_license | dpapageo/okstra-2018-classes | b4165aea3c84ffafaa434a3a1f8cf0fff58de599 | fb908eabc183725be01c9f93d39268bb8e630f59 | refs/heads/master | 2021-03-26T00:22:28.205974 | 2020-03-16T09:16:31 | 2020-03-16T09:16:31 | 247,657,881 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,631 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2020.03.09 at 04:49:50 PM EET
//
package com.eurodyn.okstra;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for OpenLR_PoiWithAccessPointType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="OpenLR_PoiWithAccessPointType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="LocationReferencePoint" type="{http://www.okstra.de/okstra/2.018.2}OpenLR_LocationReferencePointPropertyType"/>
* <element name="LastLocationReferencePoint" type="{http://www.okstra.de/okstra/2.018.2}OpenLR_LastLocationReferencePointPropertyType"/>
* <element name="Offsets" type="{http://www.okstra.de/okstra/2.018.2}OpenLR_OffsetsPropertyType" minOccurs="0"/>
* <element name="Coordinates" type="{http://www.opengis.net/gml/3.2}PointPropertyType"/>
* <element name="SideOfRoad_Type" type="{http://www.okstra.de/okstra/2.018.2/okstra-basis}KeyValuePropertyType" minOccurs="0"/>
* <element name="Orientation_Type" type="{http://www.okstra.de/okstra/2.018.2/okstra-basis}KeyValuePropertyType" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "OpenLR_PoiWithAccessPointType", propOrder = {
"locationReferencePoint",
"lastLocationReferencePoint",
"offsets",
"coordinates",
"sideOfRoadType",
"orientationType"
})
public class OpenLRPoiWithAccessPointType {
@XmlElement(name = "LocationReferencePoint", required = true)
protected OpenLRLocationReferencePointPropertyType locationReferencePoint;
@XmlElement(name = "LastLocationReferencePoint", required = true)
protected OpenLRLastLocationReferencePointPropertyType lastLocationReferencePoint;
@XmlElement(name = "Offsets")
protected OpenLROffsetsPropertyType offsets;
@XmlElement(name = "Coordinates", required = true)
protected PointPropertyType coordinates;
@XmlElement(name = "SideOfRoad_Type")
protected KeyValuePropertyType sideOfRoadType;
@XmlElement(name = "Orientation_Type")
protected KeyValuePropertyType orientationType;
/**
* Gets the value of the locationReferencePoint property.
*
* @return
* possible object is
* {@link OpenLRLocationReferencePointPropertyType }
*
*/
public OpenLRLocationReferencePointPropertyType getLocationReferencePoint() {
return locationReferencePoint;
}
/**
* Sets the value of the locationReferencePoint property.
*
* @param value
* allowed object is
* {@link OpenLRLocationReferencePointPropertyType }
*
*/
public void setLocationReferencePoint(OpenLRLocationReferencePointPropertyType value) {
this.locationReferencePoint = value;
}
/**
* Gets the value of the lastLocationReferencePoint property.
*
* @return
* possible object is
* {@link OpenLRLastLocationReferencePointPropertyType }
*
*/
public OpenLRLastLocationReferencePointPropertyType getLastLocationReferencePoint() {
return lastLocationReferencePoint;
}
/**
* Sets the value of the lastLocationReferencePoint property.
*
* @param value
* allowed object is
* {@link OpenLRLastLocationReferencePointPropertyType }
*
*/
public void setLastLocationReferencePoint(OpenLRLastLocationReferencePointPropertyType value) {
this.lastLocationReferencePoint = value;
}
/**
* Gets the value of the offsets property.
*
* @return
* possible object is
* {@link OpenLROffsetsPropertyType }
*
*/
public OpenLROffsetsPropertyType getOffsets() {
return offsets;
}
/**
* Sets the value of the offsets property.
*
* @param value
* allowed object is
* {@link OpenLROffsetsPropertyType }
*
*/
public void setOffsets(OpenLROffsetsPropertyType value) {
this.offsets = value;
}
/**
* Gets the value of the coordinates property.
*
* @return
* possible object is
* {@link PointPropertyType }
*
*/
public PointPropertyType getCoordinates() {
return coordinates;
}
/**
* Sets the value of the coordinates property.
*
* @param value
* allowed object is
* {@link PointPropertyType }
*
*/
public void setCoordinates(PointPropertyType value) {
this.coordinates = value;
}
/**
* Gets the value of the sideOfRoadType property.
*
* @return
* possible object is
* {@link KeyValuePropertyType }
*
*/
public KeyValuePropertyType getSideOfRoadType() {
return sideOfRoadType;
}
/**
* Sets the value of the sideOfRoadType property.
*
* @param value
* allowed object is
* {@link KeyValuePropertyType }
*
*/
public void setSideOfRoadType(KeyValuePropertyType value) {
this.sideOfRoadType = value;
}
/**
* Gets the value of the orientationType property.
*
* @return
* possible object is
* {@link KeyValuePropertyType }
*
*/
public KeyValuePropertyType getOrientationType() {
return orientationType;
}
/**
* Sets the value of the orientationType property.
*
* @param value
* allowed object is
* {@link KeyValuePropertyType }
*
*/
public void setOrientationType(KeyValuePropertyType value) {
this.orientationType = value;
}
}
| [
"[email protected]"
] | |
cf24b53b607ec408a0c7e81ef3fd8852583549ce | a8359035282e627d0264211907288315eeeb2557 | /app/src/main/java/com/qhzk/ciep/repository/remote/api/ApiException.java | 15217bcd2ddfff6e6c772390d029a86215a05197 | [] | no_license | pudao2010/java- | 608c823b218a746ca863a9d65b43d323e8c514dc | 78374f5a9683a348bce9d7b96431ac3867a57ec0 | refs/heads/master | 2020-05-20T20:00:10.015852 | 2017-03-10T06:58:23 | 2017-03-10T06:58:23 | 84,516,785 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,320 | java | package com.qhzk.ciep.repository.remote.api;
import android.text.TextUtils;
/**
* Created by liukun on 16/3/10.
* 对网络请求错误作统一处理
*/
public class ApiException extends RuntimeException {
public static final int CONVERSION_RESULT_NULL = -10001;
public ApiException(String msg) {
super(genErrorInfo(-1, msg));
}
public ApiException(int code) {
super(genErrorInfo(code, null));
}
public ApiException(int code, String msg) {
this(genErrorInfo(code, msg));
}
private static String genErrorInfo(int code, String msg) {
if (!TextUtils.isEmpty(msg)) return msg;
String message = getApiExceptionMessage(code);
if (!TextUtils.isEmpty(message)) return message;
return "error code:" + code;
}
/**
* 由于服务器传递过来的错误信息直接给用户看的话,用户未必能够理解
* 需要根据错误码对错误信息进行一个转换,在显示给用户
*
* @param code
* @return
*/
private static String getApiExceptionMessage(int code) {
String message = null;
switch (code) {
case CONVERSION_RESULT_NULL:
message = "请求结果转换为Null";
break;
}
return null;
}
}
| [
"[email protected]"
] | |
34f8a1c4a28006feaeec3988a19062dc0f06dee7 | 39601a1922997cd8b22f5ad15195637fd7a80e8e | /src/main/java/com/spring/primerspringboot/models/Factura.java | 4f6990b878c40fbf6b97569529a8a6d5d179c7fc | [] | no_license | adeliadanjou/primerSpringBoot | 9d42446374db3eb76abf7cd88f9674ebc816faa4 | bc35867d59961ec5b61781a336b140d8cffc6080 | refs/heads/master | 2020-08-15T09:48:16.894403 | 2019-10-16T09:49:12 | 2019-10-16T09:49:12 | 215,320,137 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,177 | java | package com.spring.primerspringboot.models;
import javax.persistence.Entity;
import java.util.Date;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.PostLoad;
import javax.persistence.PrePersist;
@Entity
public class Factura {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private Date date;
// Aquí almacenamos el id del cliente (clave ajena)
@ManyToOne
@JoinColumn(name = "cliente_id")
private Cliente cliente;// <---- este cliente es el mismo nombre de mappedBy
// Aquí establecemos con manyToMany una relacion con la tabla producto de n/n
// @JoinTable es para crear una nueva tabla con los ids de facturas relacionados con productos
@ManyToMany
@JoinTable(
name = "productos_facturas",
joinColumns = @JoinColumn(name = "factura_id"),
inverseJoinColumns = @JoinColumn(name = "producto_id")
)
private List<Producto> productos;
// PrePersist se usa para que el metodo que tiene abajo se use justo antes de
// guardar en base de datos(persistir)
@PrePersist
public void setFecha() {
date = new Date();
}
public Factura(Integer id, Date date, Cliente cliente, List<Producto> productos) {
super();
this.id = id;
this.date = date;
this.cliente = cliente;
this.productos = productos;
}
public Factura() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public Cliente getCliente() {
return cliente;
}
public void setCliente(Cliente cliente) {
this.cliente = cliente;
}
public List<Producto> getProductos() {
return productos;
}
//
// public void setProductos(List<Producto> productos) {
// this.productos = productos;
// }
}
| [
"[email protected]"
] | |
cf608e0077651035d934c69175399fb98dcf072d | f24aa8dd6bb606e9de49ef27c27938c43bf219b7 | /java/javaBasic/src/day01/Ex07.java | 48d39277bc7fc58d204ec37fa7e44092f5c7d171 | [] | no_license | HeeSeungPaek/java-workspace | de0fae94174f1308e426a1231fa77d9c99e0e71e | 7e89d3823c5fe8ca108c6dc7fc1362b41e236a59 | refs/heads/master | 2022-12-06T17:24:26.388534 | 2020-08-23T15:40:50 | 2020-08-23T15:40:50 | null | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,532 | java | package day01;
import java.util.Scanner;
//사용자로부터
//학년, 반, 이름, 국어, 영어, 수학 점수를 입력받아서
//몇학년 몇반 누구 국어점수 :#점, 영어점수 #점, 수학점수 : #점
//총점 #점, 평균 #.#점이 출력되는 프로그램을 작성하세요.
//예시)
//학년? 3
//반? 2
//이름? 백희승
//국어? 95
//영어? 100
//수학? 15
//3학년 2반 조재영 국어점수 : 80점, 영어점수: 80점, 수학점수: 81점
//총점: 210점, 평균: ##.##점
public class Ex07 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("학년 입력 : ");
int haknyeon = scanner.nextInt();
System.out.println("반 입력 : ");
int ban = scanner.nextInt();
// String을 입력 받기 전에는 scanner.nextLine(); 필요
scanner.nextLine();
System.out.println("이름 입력 :");
String name = scanner.nextLine();
System.out.println("국어 성적 입력 : ");
int kor = scanner.nextInt();
System.out.println("영어 성적 입력 : ");
int eng = scanner.nextInt();
System.out.println("수학 성적 입력 : ");
int math = scanner.nextInt();
int total = (kor + eng + math);
double average = (kor + eng + math) / 3;
System.out.println(
+haknyeon + "학년 " + ban + "반 " + name + "\n" + "국어점수 : " + kor + " 영어점수 : " + eng + " 수학점수 : " + math);
System.out.println("총점 : " + total + "점" + "\n평균 : " + average + "점");
scanner.close();
}
}
| [
"[email protected]"
] | |
5573d189b0862d988b1ea80665fa4c7d68e7d8bb | 75064514c10b2002058af614ca5883294779632b | /Exemplo22MVC/src/view/View.java | 601b931ed18d643784b9e1be8d42ffd106833852 | [] | no_license | viniciusdenovaes/Unip192ALPOOdiurno | 5e8a5e5d020960083d2a98afafbd6bacf5da171b | 7f02cd0e8d6ad44aa3a98455b3918903ef60d22c | refs/heads/master | 2020-07-05T05:15:27.386976 | 2019-10-24T14:10:51 | 2019-10-24T14:10:51 | 202,533,285 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 503 | java | package view;
import java.awt.event.ActionListener;
import java.util.List;
import model.Aluno;
public interface View {
public void prepare();
public void init();
// buscar aluno
public void exibirAlunos(List<Aluno> alunos);
public String getBuscaNomeAluno();
public void addComportamentoBusca(ActionListener al);
// adicionar aluno
public void exibirResultadoAdicionar(boolean resultado);
public Aluno getAdicionaAluno();
public void addComportamentoAdiciona(ActionListener al);
}
| [
"[email protected]"
] | |
83c00ddaa1fe35447e417c3b137183c4c76e498e | 0d99dc277b469b474a238a9bd5c505c86cfdd80e | /src/headfirstjava/chapter_16/Jukebox5.java | a5fa3a060bc647010e737ed787d3625d9258464d | [] | no_license | Borislove/Books | fa93d05274315b9440ae66c2c5a2109ef55f2a1e | 248c1b4ca743c860c34c3eed3543d116f0c2a308 | refs/heads/master | 2023-01-23T16:03:18.683669 | 2023-01-18T23:42:52 | 2023-01-18T23:42:52 | 254,092,418 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 852 | java | package headfirstjava.chapter_16;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
public class Jukebox5 {
ArrayList<Song> songList = new ArrayList<Song>();
public static void main(String[] args) {
new Jukebox5().go();
}
class ArtistCompare implements Comparator<Song> {
public int compare(Song one, Song two){
return one.getArtist().compareTo(two.getArtist());
}
}
public void go(){
getSongs();
System.out.println(songList);
Collections.sort(songList);
System.out.println(songList);
ArtistCompare artistCompare = new ArtistCompare();
Collections.sort(songList, artistCompare);
System.out.println(songList);
}
void getSongs(){
}
void addSong(String lineToParse){
}
}
| [
"[email protected]"
] | |
f0e9a69d320dacba7c247bc556f7fa78230bb153 | 8527bcb13413e795689d69e7090647d0b15bcb52 | /core/src/game/framework/layers/world/WorldHelper.java | cc29919fcacc29a41053646358d2ad91a4a94cf9 | [] | no_license | pealthoff/gameframework | 54af69673f7b5950a2c5c5644532eaf3f9b4f91e | 3f6ffb6e7def3d2d784ec8f83c4fa9e68b4c214b | refs/heads/master | 2021-01-19T07:53:50.072836 | 2014-08-27T12:17:21 | 2014-08-27T12:17:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 399 | java | package game.framework.layers.world;
import game.framework.gameobjects.GameObject;
import com.badlogic.gdx.utils.Array;
public class WorldHelper {
private GameWorld world;
public WorldHelper(GameWorld world) {
// Debug Message
System.out.println("World Helper Created!");
this.world = world;
}
public Array<GameObject> getWorldObjects() {
return world.getGameObjects();
}
}
| [
"[email protected]"
] | |
d2fc04e1ccddae09f467bfce1a5f0d1e1aeda2ba | fc3d9c8aa49987c65c4d454a911feaac96c4e81d | /src/main/java/linhVu/repository/NoteRepository.java | 542a0e490a8bc00eb3cc7f305ad4ea0081bae77d | [] | no_license | Vuthuylinh/iNote_File | a1c0324070c721a8f70efad186b974c59a29885a | 2fa46e1bcb298768c90d845e7f0dbd7d6a98952f | refs/heads/master | 2020-08-19T13:21:07.792040 | 2019-10-18T02:21:32 | 2019-10-18T02:21:32 | 215,924,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 563 | java | package linhVu.repository;
import linhVu.model.Note;
import linhVu.model.NoteType;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface NoteRepository extends PagingAndSortingRepository<Note,Long> {
Iterable<Note> findAllByNoteType(NoteType noteType);
Page<Note> findAllByNoteType(NoteType noteType, Pageable pageable);
Page<Note> findAllByTitleContaining(String name, Pageable pageable);
}
| [
"[email protected]"
] | |
1b9ee457ea5bea1ef7ce985d499da86583420cea | b4c2e0692566857671dfeeacf33d31f8485ec406 | /MyCode.java | 6ed553d91d52bb953ca6bf38c09127eb6f55f98d | [] | no_license | DeeeeeLLLL/Insight-Code-Challenge | c144a1a7fbfa0b47f03b0b15a6b1fb81288d1dc7 | 3863cfa07c660c057208dc5bb593d73aa4338d56 | refs/heads/master | 2020-12-02T21:10:38.787539 | 2017-07-05T02:37:26 | 2017-07-05T02:37:26 | 96,266,578 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,597 | java | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Scanner;
import java.io.FileReader;
import java.io.FileWriter;
import org.json.*;
public class MyCode {
//Define a class called "item" to store the information of purchase time and amount for each transaction
static class item {
String id; //user id
String purchase_time; //user's one purchase time
Double purchase_amount; //user's one purchase amount
}
//Defina a class called "user_info" to store the inforamtion about one user, including id, list of friends, and list of his or her own purchase history
static class user_info {
ArrayList <item> user_purchase_history;
ArrayList <String> user_friends_id;
}
public static HashMap<String, user_info> user_List = new HashMap<String, user_info>(); // Store all the user information, on individual user base
public static int Degree; //Degree of social network, defined in the input file
public static int Transaction; //Number of transaction included in the mean and sd calculation
public static ArrayList<String> already_checked_friends = new ArrayList<String>(); //List of users that have been already checked for their purchase transaction
public static ArrayList<item> friends_purchases =new ArrayList<item>(); //List of one target user's friends' all purchases (within the degree of social network)
public static void main(String[] args) {
ArrayList<JSONObject> batch_File = readJSONFile("batch_log.json"); //store the information from batch_log.json
ArrayList<JSONObject> stream_File = readJSONFile("stream_log.json"); //store the information from stram_log.json
ArrayList<JSONObject> out_put = new ArrayList<JSONObject>(); //store the output information; if none flagged transaction found, it will be null
List<item> sorted_purchases = new ArrayList<item>(); //a sub list of all the friends' transaction by the number of transaction and sorted by time
ArrayList<item> flagged_purchases = new ArrayList<item>(); //A list to store all the flagged purchase transactions if any. if there is none flagged transaction, it stays null
Degree = Integer.parseInt((String) batch_File.get(0).get("D")); //get the degree of social network from batch_log file
Transaction = Integer.parseInt((String) batch_File.get(0).get("T")); //get the number of transaction from batch_log file
buildNetwork(batch_File); //Collect the information from input files, organize it by each individual user and store properly
buildNetwork(stream_File);
Scanner input = new Scanner(System.in); //Collect input of targeted user id
System.out.println("Please enter the target user id");
String initial_user = input.nextLine();
while(!user_List.containsKey(initial_user)) {
System.out.println("User does not exist, sorry");
System.out.println("Please enter the target user id");
initial_user=input.nextLine();
}
input.close();
already_checked_friends.add(initial_user); //add the targeted user into the list of already checked users to avoid including its own transactions
go_through_friends(initial_user,0,Degree); //search the targeted user's social network to find his or her friends within the given degree, as well as friends' purchase history
Collections.sort(friends_purchases,new timeCompare()); //sort the list of friends purchase history by time, from most current to earlier ones
double sum =0;
double mean = 0;
double standard_deviation = 0;
double deviation =0;
if(friends_purchases.size()<=2) { //make sure only include the most recent transactions, by the given number of transaction
out_put = null;
flagged_purchases = null;
}
else {
if(friends_purchases.size()<Transaction) {
sorted_purchases = friends_purchases;
}
else {
sorted_purchases = friends_purchases.subList(0, Transaction);
}
//In the final pool of friend's purchase, we need to calculate the mean and sd to flag the large purchase.
mean = sum/sorted_purchases.size();
for(int j = 0; j< sorted_purchases.size(); j++) {
deviation = deviation+ ((sorted_purchases.get(j).purchase_amount-mean)*(sorted_purchases.get(j).purchase_amount-mean))/(sorted_purchases.size()-1);
}
standard_deviation = Math.sqrt(deviation);
}
//flag out those large transactions, which is above mean + 3*sd
for(int j = 0; j< sorted_purchases.size(); j++) {
if(sorted_purchases.get(j).purchase_amount>=mean+3*standard_deviation) {
flagged_purchases.add(sorted_purchases.get(j));
}
}
//transfer the flagged transaction information to the output JSONObject arraylist for writing into the output file
for(int j = 0; j< flagged_purchases.size(); j++) {
System.out.println(flagged_purchases.get(j).purchase_amount);
out_put.get(j).put("event_type", "purchase");
out_put.get(j).put("timestamp", flagged_purchases.get(j).purchase_time);
out_put.get(j).put("id", flagged_purchases.get(j).id);
out_put.get(j).put("amount", flagged_purchases.get(j).purchase_amount);
out_put.get(j).put("mean", mean);
out_put.get(j).put("sd", standard_deviation);
}
//export the output file
try {
FileWriter File = new FileWriter("flagged_purchases.json");
if(out_put==null) {
File.write("");
}
else {
for(int m=0;m<out_put.size();m++) {
System.out.println(m);
File.write(out_put.get(m).toString());
System.out.println(out_put.get(m).toString());
System.getProperty("line.separator");
}
}
File.close();
}
catch (IOException e){e.printStackTrace();}
System.out.println("Finished!");
}
//Define a Comparator class to help sort purchase time (from most recent to earier ones)
static class timeCompare implements Comparator<item>{
public int compare(item i1, item i2) {
return -(int) (i1.purchase_time.compareTo(i2.purchase_time));
}
}
//read information from JSONFile, line by line,return an ArrayList of JSONObject of each event information
private static ArrayList<JSONObject> readJSONFile(String FileName){
ArrayList<JSONObject> Batch = new ArrayList<JSONObject>();
try {
BufferedReader br = new BufferedReader(new FileReader(FileName));
String Line = br.readLine();
while(Line!=null && Line.startsWith("{")) {
JSONObject obj = new JSONObject(Line);
Batch.add(obj);
Line = br.readLine();
}
br.close();
}
catch(FileNotFoundException e) { e.printStackTrace();}
catch(IOException e) { e.printStackTrace();}
catch(Exception e) { e.printStackTrace();}
return Batch;
}
//Read the information from JSONObject files and organize it by each individual user, including user id, user purchase history, and list of friends, store into a HashMap called user_List
private static void buildNetwork(ArrayList<JSONObject> File) {
ArrayList<JSONObject> input = File;
JSONObject event = null;
for (int i = 0; i < input.size();i++){
event = input.get(i);
try {
if(event.get("D")!= null) {
continue;
};
}
catch(JSONException e) {}
//if the event is purchase, use the add_user_purchase method to add into the user's purchase history
if (event.get("event_type").equals("purchase")) {
item new_purchase = new item();
String id = new String();
id = (String) event.get("id");
new_purchase.id = (String) event.get("id");
new_purchase.purchase_time = (String) event.get("timestamp");
new_purchase.purchase_amount = Double.parseDouble((String) event.get("amount"));
add_user_purchase(id,new_purchase);
}
//if the event is befriend, then use the add_user_friend method to make sure both of the users have the other user in their friends list
if (event.get("event_type").equals("befriend")) {
String id1 = null;
String id2 = null;
id1 = (String) event.get("id1");
id2 = (String) event.get("id2");
add_user_friend(id1, id2);
add_user_friend(id2, id1);
}
//if the event is unfriend, then use the remove_user_friend method to remove the user from the other user's friends list, vice versa
if (event.get("event_type").equals("unfriend")) {
String id1 = null;
String id2 = null;
id1 = (String) event.get("id1");
id2 = (String) event.get("id2");
remove_user_friend(id1, id2);
remove_user_friend(id2, id1);
}
}
}
//check if the user is already in the user list, if yes, add the purchase transaction into the user_info object and update the user List
//if not in the user list, create a user_info object of the "new user" and added into the user List
private static void add_user_purchase(String user_id, item details) {
ArrayList<item> temp_List = new ArrayList<item>();
if(user_List.containsKey(user_id)) {
temp_List = user_List.get(user_id).user_purchase_history;
temp_List.add(details);
user_List.get(user_id).user_purchase_history = temp_List;
}
else {
user_info new_user = new user_info();
new_user.user_friends_id = new ArrayList<String>();
new_user.user_purchase_history = new ArrayList<item>();
user_List.put(user_id, new_user);
user_List.get(user_id).user_purchase_history.add(details);
}
}
//add friend's id into the user's list of friend; also add the user into the friend's list of friends
private static void add_user_friend(String user_id, String friend_id) {
ArrayList<String> temp_List = new ArrayList<String>();
if(user_List.containsKey(user_id)) {
temp_List = user_List.get(user_id).user_friends_id;
temp_List.add(friend_id);
user_List.get(user_id).user_friends_id = temp_List;
}
else {
user_info new_user = new user_info();
new_user.user_friends_id = new ArrayList<String>();
new_user.user_purchase_history = new ArrayList<item>();
user_List.put(user_id, new_user);
user_List.get(user_id).user_friends_id.add(friend_id);
}
}
//remove the friend's id from the user's list of friend; also remove this user's id from the friend's list of friends
private static void remove_user_friend(String user_id, String friend_id) {
ArrayList<String> current_friends = user_List.get(user_id).user_friends_id;
if(!current_friends.isEmpty() && current_friends.contains(friend_id)){
current_friends.remove(current_friends.indexOf(friend_id));
}
else {
return;
}
}
//Search through this user's social network within the given degree of friends to collect his or her friends' id and purchase history
private static void go_through_friends(String user_id, int current_degree, int max_degree){
ArrayList<String> friends_names = new ArrayList<String>();
int current_depth;
current_depth = current_degree;
friends_names = user_List.get(user_id).user_friends_id;
if(current_depth>=max_degree||friends_purchases.size()>=Transaction) {
return;
}
else{for(String name:friends_names) {
if(already_checked_friends.contains(name)) {
continue;
}
else {
already_checked_friends.add(name);
friends_purchases.addAll(user_List.get(name).user_purchase_history);
}
}
}
current_depth=current_depth+1;
for (String name:friends_names) {
go_through_friends(name,current_depth, max_degree);
}
}
}
| [
"[email protected]"
] | |
fdf350133a1636825cdba0c3ad568ac752df918d | 77890c99fd52ce3488e1621a0bf24cdd20991e76 | /src/main/java/demo/first/FirstMapper.java | 87724f2efcb41cf8cfe85607fb5071c6b08fdbb7 | [] | no_license | mabilalmirza/mapstruct-multiple-nested-objects | ffac29f7f4764955fe27946bd3d73c2991bdab6f | 7ccf395e2023cd1d0155c7a31c0f8b20fbca47fe | refs/heads/master | 2020-05-26T11:58:46.218327 | 2019-05-23T11:44:06 | 2019-05-23T11:44:06 | 188,225,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 613 | java | package demo.first;
import demo.first.source.Employee;
import demo.first.target.Person;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
@Mapper
public interface FirstMapper {
@Mapping(target = "name", source = "name")
@Mapping(target = "completeAddress.lineOne", source = "specialAddress.line1")
@Mapping(target = "completeAddress.lineTwo", source = "specialAddress.line2")
@Mapping(target = "completeAddress.city", source = "generalAddress.city")
@Mapping(target = "completeAddress.country", source = "generalAddress.country")
public Person mapPerson(Employee employee);
}
| [
"[email protected]"
] | |
322044ee91a38f37ed59cbefc5de056b13e8bcb4 | 6d60a8adbfdc498a28f3e3fef70366581aa0c5fd | /codebase/dataset/x/846_frag1.java | aee90e0a8efcac38c6e240c4a007e3bac65b44cc | [] | no_license | rayhan-ferdous/code2vec | 14268adaf9022d140a47a88129634398cd23cf8f | c8ca68a7a1053d0d09087b14d4c79a189ac0cf00 | refs/heads/master | 2022-03-09T08:40:18.035781 | 2022-02-27T23:57:44 | 2022-02-27T23:57:44 | 140,347,552 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,008 | java | if (system.hasAccess("Controle de Cheques")) {
MenuItem checkControlCenter = new MenuItem(financialMenu, SWT.NONE);
checkControlCenter.setText("Controle de Cheques");
checkControlCenter.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
windowControl.openCheckControlCenter();
}
});
}
if (system.hasAccess("Importa��o de Extrato")) {
MenuItem importExtractBankDialog = new MenuItem(financialMenu, SWT.NONE);
importExtractBankDialog.setText("Importa��o de Extrato Banc�rio");
importExtractBankDialog.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
windowControl.openLinkAccountBankControlCenter();
}
});
}
if (financialMenu.getItemCount() == 0) financialInfoMenuItem.dispose();
| [
"[email protected]"
] | |
0f3cbfdb0a51935475c83e7963aea5056add0771 | 766113b684ff5ff924380f6045912a8edefa0192 | /All Design Paterns/src/com/designpattern/structural/adapter/BankCustomer.java | 12ff9b2f52d6a8378e193e4766aee9b6882cb193 | [] | no_license | kishoresh/MyJavaLearningProjects | 7059ca269ac963e8a65e1c01cdf799e33baa2014 | e5caaf66b1080e1c2f7741fb0cfdbafba68842bf | refs/heads/master | 2020-03-19T10:00:16.632146 | 2018-06-29T09:50:22 | 2018-06-29T09:50:22 | 136,334,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,254 | java | package com.designpattern.structural.adapter;
/*
* This is the Adapter Class or the Wrapper, which implements the desired target interface and modifies the adaptee class.
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class BankCustomer extends BankDetails implements CreditCard { //Adapter Class
@Override
public void giveBankDetails() {
try{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter Acc Holder Name : ");
String customerName = br.readLine();
System.out.print("\n");
System.out.print("Enter the Acc No : ");
long accNo = Long.parseLong(br.readLine());
System.out.print("\n");
System.out.print("Enter the Bank Name : ");
String bankName = br.readLine();
setAccHolderName(customerName);
setAccNo(accNo);
setBankName(bankName);
}catch (Exception e){
e.printStackTrace();
}
}
@Override
public String getCreditCard() {
String accHolderNamme = getAccHolderName();
String bankName = getBankName();
long accno = getAccNo();
return ("The Account No "+accno + " of "+accHolderNamme +" in bank " + bankName+" is valid and authenticate for using the credit card.");
}
}
| [
"[email protected]"
] | |
6e6e430a91fbf94b57df9b611ae2070c025c9378 | c148cc8c215dc089bd346b0e4c8e21a2b8665d86 | /google-ads/src/test/java/com/google/ads/googleads/v0/services/MockProductGroupViewService.java | ac67dd16e546e7a0a2840b95b5a81d9e190b64f1 | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | duperran/google-ads-java | 39ae44927d64ceead633b2f3a47407f4e9ef0814 | da810ba8e1b5328a4b9b510eb582dc692a071408 | refs/heads/master | 2020-04-07T13:57:37.899838 | 2018-11-16T16:37:48 | 2018-11-16T16:37:48 | 158,428,852 | 0 | 0 | Apache-2.0 | 2018-11-20T17:42:50 | 2018-11-20T17:42:50 | null | UTF-8 | Java | false | false | 1,635 | java | /*
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.ads.googleads.v0.services;
import com.google.api.core.BetaApi;
import com.google.api.gax.grpc.testing.MockGrpcService;
import com.google.protobuf.GeneratedMessageV3;
import io.grpc.ServerServiceDefinition;
import java.util.List;
@javax.annotation.Generated("by GAPIC")
@BetaApi
public class MockProductGroupViewService implements MockGrpcService {
private final MockProductGroupViewServiceImpl serviceImpl;
public MockProductGroupViewService() {
serviceImpl = new MockProductGroupViewServiceImpl();
}
@Override
public List<GeneratedMessageV3> getRequests() {
return serviceImpl.getRequests();
}
@Override
public void addResponse(GeneratedMessageV3 response) {
serviceImpl.addResponse(response);
}
@Override
public void addException(Exception exception) {
serviceImpl.addException(exception);
}
@Override
public ServerServiceDefinition getServiceDefinition() {
return serviceImpl.bindService();
}
@Override
public void reset() {
serviceImpl.reset();
}
}
| [
"[email protected]"
] | |
107e9f13cfb84826cb7899b26e90aa47ed0f6f7b | 8463ed647a85c792e42ac03137b1b78e07a9fb36 | /src/main/java/example/SpringBootDockerApplication.java | 58d6ed147fff3300fc466b5faa8aeea6e5525d57 | [] | no_license | xchunzhao/springboot-docker | 1fbd141ac279913775430fd930a619850e9c479d | 90a26c6c9d97e7455832412f5b8d149455750ead | refs/heads/master | 2020-12-25T13:45:17.034253 | 2016-08-08T15:44:46 | 2016-08-08T15:44:46 | 62,551,930 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 543 | java | package example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@SpringBootApplication
public class SpringBootDockerApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootDockerApplication.class, args);
}
@RequestMapping(value = "/")
public String index(){
return "hello world";
}
}
| [
"[email protected]"
] | |
a44f3b46329d09c8fbca2c01233fdbf93c406047 | 283fe7633619296a1e126053e4627e17023ef7f5 | /sdk/dns/mgmt/src/main/java/com/azure/management/dns/models/RecordSetsInner.java | afcf2570c09aafd5922547dadfed2365111ba1d4 | [
"LicenseRef-scancode-generic-cla",
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer",
"LGPL-2.1-or-later",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | jyotsnaravikumar/azure-sdk-for-java | c39e79280d0e97f9a1a5c2eec81f71e7ddb4516a | aa39e866c545ea78cf810588ee3209158f6c2a58 | refs/heads/master | 2022-06-22T12:51:23.821173 | 2020-05-06T16:53:16 | 2020-05-06T16:53:16 | 261,849,429 | 1 | 0 | MIT | 2020-05-06T18:45:12 | 2020-05-06T18:45:12 | null | UTF-8 | Java | false | false | 64,052 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.management.dns.models;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.Delete;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
import com.azure.core.annotation.HeaderParam;
import com.azure.core.annotation.Headers;
import com.azure.core.annotation.Host;
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.Patch;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.annotation.UnexpectedResponseExceptionType;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.http.rest.Response;
import com.azure.core.http.rest.RestProxy;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.management.CloudException;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.management.dns.RecordType;
import reactor.core.publisher.Mono;
/** An instance of this class provides access to all the operations defined in RecordSets. */
public final class RecordSetsInner {
/** The proxy service used to perform REST calls. */
private final RecordSetsService service;
/** The service client containing this operation class. */
private final DnsManagementClientImpl client;
/**
* Initializes an instance of RecordSetsInner.
*
* @param client the instance of the service client containing this operation class.
*/
RecordSetsInner(DnsManagementClientImpl client) {
this.service =
RestProxy.create(RecordSetsService.class, client.getHttpPipeline(), client.getSerializerAdapter());
this.client = client;
}
/**
* The interface defining all the services for DnsManagementClientRecordSets to be used by the proxy service to
* perform REST calls.
*/
@Host("{$host}")
@ServiceInterface(name = "DnsManagementClientR")
private interface RecordSetsService {
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Patch(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(CloudException.class)
Mono<SimpleResponse<RecordSetInner>> update(
@HostParam("$host") String host,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("zoneName") String zoneName,
@PathParam(value = "relativeRecordSetName", encoded = true) String relativeRecordSetName,
@PathParam("recordType") RecordType recordType,
@HeaderParam("If-Match") String ifMatch,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") RecordSetInner parameters,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Put(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}")
@ExpectedResponses({200, 201})
@UnexpectedResponseExceptionType(CloudException.class)
Mono<SimpleResponse<RecordSetInner>> createOrUpdate(
@HostParam("$host") String host,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("zoneName") String zoneName,
@PathParam(value = "relativeRecordSetName", encoded = true) String relativeRecordSetName,
@PathParam("recordType") RecordType recordType,
@HeaderParam("If-Match") String ifMatch,
@HeaderParam("If-None-Match") String ifNoneMatch,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") RecordSetInner parameters,
Context context);
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}")
@ExpectedResponses({200, 204})
@UnexpectedResponseExceptionType(CloudException.class)
Mono<Response<Void>> delete(
@HostParam("$host") String host,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("zoneName") String zoneName,
@PathParam(value = "relativeRecordSetName", encoded = true) String relativeRecordSetName,
@PathParam("recordType") RecordType recordType,
@HeaderParam("If-Match") String ifMatch,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(CloudException.class)
Mono<SimpleResponse<RecordSetInner>> get(
@HostParam("$host") String host,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("zoneName") String zoneName,
@PathParam(value = "relativeRecordSetName", encoded = true) String relativeRecordSetName,
@PathParam("recordType") RecordType recordType,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/dnsZones/{zoneName}/{recordType}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(CloudException.class)
Mono<SimpleResponse<RecordSetListResultInner>> listByType(
@HostParam("$host") String host,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("zoneName") String zoneName,
@PathParam("recordType") RecordType recordType,
@QueryParam("$top") Integer top,
@QueryParam("$recordsetnamesuffix") String recordsetnamesuffix,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/dnsZones/{zoneName}/recordsets")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(CloudException.class)
Mono<SimpleResponse<RecordSetListResultInner>> listByDnsZone(
@HostParam("$host") String host,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("zoneName") String zoneName,
@QueryParam("$top") Integer top,
@QueryParam("$recordsetnamesuffix") String recordsetnamesuffix,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network"
+ "/dnsZones/{zoneName}/all")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(CloudException.class)
Mono<SimpleResponse<RecordSetListResultInner>> listAllByDnsZone(
@HostParam("$host") String host,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("zoneName") String zoneName,
@QueryParam("$top") Integer top,
@QueryParam("$recordsetnamesuffix") String recordSetNameSuffix,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(CloudException.class)
Mono<SimpleResponse<RecordSetListResultInner>> listByTypeNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(CloudException.class)
Mono<SimpleResponse<RecordSetListResultInner>> listByDnsZoneNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
@Headers({"Accept: application/json", "Content-Type: application/json"})
@Get("{nextLink}")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(CloudException.class)
Mono<SimpleResponse<RecordSetListResultInner>> listAllByDnsZoneNext(
@PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
}
/**
* Updates a record set within a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set.
* @param parameters Describes a DNS record set (a collection of DNS records with the same name and type).
* @param ifMatch The etag of the record set. Omit this value to always overwrite the current record set. Specify
* the last-seen etag value to prevent accidentally overwriting concurrent changes.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a DNS record set (a collection of DNS records with the same name and type).
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SimpleResponse<RecordSetInner>> updateWithResponseAsync(
String resourceGroupName,
String zoneName,
String relativeRecordSetName,
RecordType recordType,
RecordSetInner parameters,
String ifMatch) {
return FluxUtil
.withContext(
context ->
service
.update(
this.client.getHost(),
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType,
ifMatch,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
parameters,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Updates a record set within a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set.
* @param parameters Describes a DNS record set (a collection of DNS records with the same name and type).
* @param ifMatch The etag of the record set. Omit this value to always overwrite the current record set. Specify
* the last-seen etag value to prevent accidentally overwriting concurrent changes.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a DNS record set (a collection of DNS records with the same name and type).
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<RecordSetInner> updateAsync(
String resourceGroupName,
String zoneName,
String relativeRecordSetName,
RecordType recordType,
RecordSetInner parameters,
String ifMatch) {
return updateWithResponseAsync(
resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch)
.flatMap(
(SimpleResponse<RecordSetInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Updates a record set within a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set.
* @param parameters Describes a DNS record set (a collection of DNS records with the same name and type).
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a DNS record set (a collection of DNS records with the same name and type).
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<RecordSetInner> updateAsync(
String resourceGroupName,
String zoneName,
String relativeRecordSetName,
RecordType recordType,
RecordSetInner parameters) {
final String ifMatch = null;
final Context context = null;
return updateWithResponseAsync(
resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch)
.flatMap(
(SimpleResponse<RecordSetInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Updates a record set within a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set.
* @param parameters Describes a DNS record set (a collection of DNS records with the same name and type).
* @param ifMatch The etag of the record set. Omit this value to always overwrite the current record set. Specify
* the last-seen etag value to prevent accidentally overwriting concurrent changes.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a DNS record set (a collection of DNS records with the same name and type).
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RecordSetInner update(
String resourceGroupName,
String zoneName,
String relativeRecordSetName,
RecordType recordType,
RecordSetInner parameters,
String ifMatch) {
return updateAsync(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch).block();
}
/**
* Updates a record set within a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set.
* @param parameters Describes a DNS record set (a collection of DNS records with the same name and type).
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a DNS record set (a collection of DNS records with the same name and type).
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RecordSetInner update(
String resourceGroupName,
String zoneName,
String relativeRecordSetName,
RecordType recordType,
RecordSetInner parameters) {
final String ifMatch = null;
final Context context = null;
return updateAsync(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch).block();
}
/**
* Creates or updates a record set within a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set. Record sets of type SOA can be updated but not
* created (they are created when the DNS zone is created).
* @param parameters Describes a DNS record set (a collection of DNS records with the same name and type).
* @param ifMatch The etag of the record set. Omit this value to always overwrite the current record set. Specify
* the last-seen etag value to prevent accidentally overwriting any concurrent changes.
* @param ifNoneMatch Set to '*' to allow a new record set to be created, but to prevent updating an existing record
* set. Other values will be ignored.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a DNS record set (a collection of DNS records with the same name and type).
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SimpleResponse<RecordSetInner>> createOrUpdateWithResponseAsync(
String resourceGroupName,
String zoneName,
String relativeRecordSetName,
RecordType recordType,
RecordSetInner parameters,
String ifMatch,
String ifNoneMatch) {
return FluxUtil
.withContext(
context ->
service
.createOrUpdate(
this.client.getHost(),
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType,
ifMatch,
ifNoneMatch,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
parameters,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Creates or updates a record set within a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set. Record sets of type SOA can be updated but not
* created (they are created when the DNS zone is created).
* @param parameters Describes a DNS record set (a collection of DNS records with the same name and type).
* @param ifMatch The etag of the record set. Omit this value to always overwrite the current record set. Specify
* the last-seen etag value to prevent accidentally overwriting any concurrent changes.
* @param ifNoneMatch Set to '*' to allow a new record set to be created, but to prevent updating an existing record
* set. Other values will be ignored.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a DNS record set (a collection of DNS records with the same name and type).
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<RecordSetInner> createOrUpdateAsync(
String resourceGroupName,
String zoneName,
String relativeRecordSetName,
RecordType recordType,
RecordSetInner parameters,
String ifMatch,
String ifNoneMatch) {
return createOrUpdateWithResponseAsync(
resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch, ifNoneMatch)
.flatMap(
(SimpleResponse<RecordSetInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Creates or updates a record set within a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set. Record sets of type SOA can be updated but not
* created (they are created when the DNS zone is created).
* @param parameters Describes a DNS record set (a collection of DNS records with the same name and type).
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a DNS record set (a collection of DNS records with the same name and type).
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<RecordSetInner> createOrUpdateAsync(
String resourceGroupName,
String zoneName,
String relativeRecordSetName,
RecordType recordType,
RecordSetInner parameters) {
final String ifMatch = null;
final String ifNoneMatch = null;
final Context context = null;
return createOrUpdateWithResponseAsync(
resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch, ifNoneMatch)
.flatMap(
(SimpleResponse<RecordSetInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Creates or updates a record set within a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set. Record sets of type SOA can be updated but not
* created (they are created when the DNS zone is created).
* @param parameters Describes a DNS record set (a collection of DNS records with the same name and type).
* @param ifMatch The etag of the record set. Omit this value to always overwrite the current record set. Specify
* the last-seen etag value to prevent accidentally overwriting any concurrent changes.
* @param ifNoneMatch Set to '*' to allow a new record set to be created, but to prevent updating an existing record
* set. Other values will be ignored.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a DNS record set (a collection of DNS records with the same name and type).
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RecordSetInner createOrUpdate(
String resourceGroupName,
String zoneName,
String relativeRecordSetName,
RecordType recordType,
RecordSetInner parameters,
String ifMatch,
String ifNoneMatch) {
return createOrUpdateAsync(
resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch, ifNoneMatch)
.block();
}
/**
* Creates or updates a record set within a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set. Record sets of type SOA can be updated but not
* created (they are created when the DNS zone is created).
* @param parameters Describes a DNS record set (a collection of DNS records with the same name and type).
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a DNS record set (a collection of DNS records with the same name and type).
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RecordSetInner createOrUpdate(
String resourceGroupName,
String zoneName,
String relativeRecordSetName,
RecordType recordType,
RecordSetInner parameters) {
final String ifMatch = null;
final String ifNoneMatch = null;
final Context context = null;
return createOrUpdateAsync(
resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch, ifNoneMatch)
.block();
}
/**
* Deletes a record set from a DNS zone. This operation cannot be undone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are
* deleted when the DNS zone is deleted).
* @param ifMatch The etag of the record set. Omit this value to always delete the current record set. Specify the
* last-seen etag value to prevent accidentally deleting any concurrent changes.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> deleteWithResponseAsync(
String resourceGroupName,
String zoneName,
String relativeRecordSetName,
RecordType recordType,
String ifMatch) {
return FluxUtil
.withContext(
context ->
service
.delete(
this.client.getHost(),
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType,
ifMatch,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Deletes a record set from a DNS zone. This operation cannot be undone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are
* deleted when the DNS zone is deleted).
* @param ifMatch The etag of the record set. Omit this value to always delete the current record set. Specify the
* last-seen etag value to prevent accidentally deleting any concurrent changes.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteAsync(
String resourceGroupName,
String zoneName,
String relativeRecordSetName,
RecordType recordType,
String ifMatch) {
return deleteWithResponseAsync(resourceGroupName, zoneName, relativeRecordSetName, recordType, ifMatch)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Deletes a record set from a DNS zone. This operation cannot be undone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are
* deleted when the DNS zone is deleted).
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> deleteAsync(
String resourceGroupName, String zoneName, String relativeRecordSetName, RecordType recordType) {
final String ifMatch = null;
final Context context = null;
return deleteWithResponseAsync(resourceGroupName, zoneName, relativeRecordSetName, recordType, ifMatch)
.flatMap((Response<Void> res) -> Mono.empty());
}
/**
* Deletes a record set from a DNS zone. This operation cannot be undone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are
* deleted when the DNS zone is deleted).
* @param ifMatch The etag of the record set. Omit this value to always delete the current record set. Specify the
* last-seen etag value to prevent accidentally deleting any concurrent changes.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(
String resourceGroupName,
String zoneName,
String relativeRecordSetName,
RecordType recordType,
String ifMatch) {
deleteAsync(resourceGroupName, zoneName, relativeRecordSetName, recordType, ifMatch).block();
}
/**
* Deletes a record set from a DNS zone. This operation cannot be undone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are
* deleted when the DNS zone is deleted).
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String zoneName, String relativeRecordSetName, RecordType recordType) {
final String ifMatch = null;
final Context context = null;
deleteAsync(resourceGroupName, zoneName, relativeRecordSetName, recordType, ifMatch).block();
}
/**
* Gets a record set.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a record set.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<SimpleResponse<RecordSetInner>> getWithResponseAsync(
String resourceGroupName, String zoneName, String relativeRecordSetName, RecordType recordType) {
return FluxUtil
.withContext(
context ->
service
.get(
this.client.getHost(),
resourceGroupName,
zoneName,
relativeRecordSetName,
recordType,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Gets a record set.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a record set.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<RecordSetInner> getAsync(
String resourceGroupName, String zoneName, String relativeRecordSetName, RecordType recordType) {
return getWithResponseAsync(resourceGroupName, zoneName, relativeRecordSetName, recordType)
.flatMap(
(SimpleResponse<RecordSetInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
}
/**
* Gets a record set.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param relativeRecordSetName The name of the record set, relative to the name of the zone.
* @param recordType The type of DNS record in this record set.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a record set.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public RecordSetInner get(
String resourceGroupName, String zoneName, String relativeRecordSetName, RecordType recordType) {
return getAsync(resourceGroupName, zoneName, relativeRecordSetName, recordType).block();
}
/**
* Lists the record sets of a specified type in a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param recordType The type of record sets to enumerate.
* @param top The maximum number of record sets to return. If not specified, returns up to 100 record sets.
* @param recordsetnamesuffix The suffix label of the record set name that has to be used to filter the record set
* enumerations. If this parameter is specified, Enumeration will return only records that end with
* .<recordSetNameSuffix>.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<RecordSetInner>> listByTypeSinglePageAsync(
String resourceGroupName, String zoneName, RecordType recordType, Integer top, String recordsetnamesuffix) {
return FluxUtil
.withContext(
context ->
service
.listByType(
this.client.getHost(),
resourceGroupName,
zoneName,
recordType,
top,
recordsetnamesuffix,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
context))
.<PagedResponse<RecordSetInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Lists the record sets of a specified type in a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param recordType The type of record sets to enumerate.
* @param top The maximum number of record sets to return. If not specified, returns up to 100 record sets.
* @param recordsetnamesuffix The suffix label of the record set name that has to be used to filter the record set
* enumerations. If this parameter is specified, Enumeration will return only records that end with
* .<recordSetNameSuffix>.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<RecordSetInner> listByTypeAsync(
String resourceGroupName, String zoneName, RecordType recordType, Integer top, String recordsetnamesuffix) {
return new PagedFlux<>(
() -> listByTypeSinglePageAsync(resourceGroupName, zoneName, recordType, top, recordsetnamesuffix),
nextLink -> listByTypeNextSinglePageAsync(nextLink));
}
/**
* Lists the record sets of a specified type in a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param recordType The type of record sets to enumerate.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<RecordSetInner> listByTypeAsync(String resourceGroupName, String zoneName, RecordType recordType) {
final Integer top = null;
final String recordsetnamesuffix = null;
final Context context = null;
return new PagedFlux<>(
() -> listByTypeSinglePageAsync(resourceGroupName, zoneName, recordType, top, recordsetnamesuffix),
nextLink -> listByTypeNextSinglePageAsync(nextLink));
}
/**
* Lists the record sets of a specified type in a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param recordType The type of record sets to enumerate.
* @param top The maximum number of record sets to return. If not specified, returns up to 100 record sets.
* @param recordsetnamesuffix The suffix label of the record set name that has to be used to filter the record set
* enumerations. If this parameter is specified, Enumeration will return only records that end with
* .<recordSetNameSuffix>.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<RecordSetInner> listByType(
String resourceGroupName, String zoneName, RecordType recordType, Integer top, String recordsetnamesuffix) {
return new PagedIterable<>(listByTypeAsync(resourceGroupName, zoneName, recordType, top, recordsetnamesuffix));
}
/**
* Lists the record sets of a specified type in a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param recordType The type of record sets to enumerate.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<RecordSetInner> listByType(String resourceGroupName, String zoneName, RecordType recordType) {
final Integer top = null;
final String recordsetnamesuffix = null;
final Context context = null;
return new PagedIterable<>(listByTypeAsync(resourceGroupName, zoneName, recordType, top, recordsetnamesuffix));
}
/**
* Lists all record sets in a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param top The maximum number of record sets to return. If not specified, returns up to 100 record sets.
* @param recordsetnamesuffix The suffix label of the record set name that has to be used to filter the record set
* enumerations. If this parameter is specified, Enumeration will return only records that end with
* .<recordSetNameSuffix>.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<RecordSetInner>> listByDnsZoneSinglePageAsync(
String resourceGroupName, String zoneName, Integer top, String recordsetnamesuffix) {
return FluxUtil
.withContext(
context ->
service
.listByDnsZone(
this.client.getHost(),
resourceGroupName,
zoneName,
top,
recordsetnamesuffix,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
context))
.<PagedResponse<RecordSetInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Lists all record sets in a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param top The maximum number of record sets to return. If not specified, returns up to 100 record sets.
* @param recordsetnamesuffix The suffix label of the record set name that has to be used to filter the record set
* enumerations. If this parameter is specified, Enumeration will return only records that end with
* .<recordSetNameSuffix>.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<RecordSetInner> listByDnsZoneAsync(
String resourceGroupName, String zoneName, Integer top, String recordsetnamesuffix) {
return new PagedFlux<>(
() -> listByDnsZoneSinglePageAsync(resourceGroupName, zoneName, top, recordsetnamesuffix),
nextLink -> listByDnsZoneNextSinglePageAsync(nextLink));
}
/**
* Lists all record sets in a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<RecordSetInner> listByDnsZoneAsync(String resourceGroupName, String zoneName) {
final Integer top = null;
final String recordsetnamesuffix = null;
final Context context = null;
return new PagedFlux<>(
() -> listByDnsZoneSinglePageAsync(resourceGroupName, zoneName, top, recordsetnamesuffix),
nextLink -> listByDnsZoneNextSinglePageAsync(nextLink));
}
/**
* Lists all record sets in a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param top The maximum number of record sets to return. If not specified, returns up to 100 record sets.
* @param recordsetnamesuffix The suffix label of the record set name that has to be used to filter the record set
* enumerations. If this parameter is specified, Enumeration will return only records that end with
* .<recordSetNameSuffix>.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<RecordSetInner> listByDnsZone(
String resourceGroupName, String zoneName, Integer top, String recordsetnamesuffix) {
return new PagedIterable<>(listByDnsZoneAsync(resourceGroupName, zoneName, top, recordsetnamesuffix));
}
/**
* Lists all record sets in a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<RecordSetInner> listByDnsZone(String resourceGroupName, String zoneName) {
final Integer top = null;
final String recordsetnamesuffix = null;
final Context context = null;
return new PagedIterable<>(listByDnsZoneAsync(resourceGroupName, zoneName, top, recordsetnamesuffix));
}
/**
* Lists all record sets in a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param top The maximum number of record sets to return. If not specified, returns up to 100 record sets.
* @param recordSetNameSuffix The suffix label of the record set name that has to be used to filter the record set
* enumerations. If this parameter is specified, Enumeration will return only records that end with
* .<recordSetNameSuffix>.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<RecordSetInner>> listAllByDnsZoneSinglePageAsync(
String resourceGroupName, String zoneName, Integer top, String recordSetNameSuffix) {
return FluxUtil
.withContext(
context ->
service
.listAllByDnsZone(
this.client.getHost(),
resourceGroupName,
zoneName,
top,
recordSetNameSuffix,
this.client.getApiVersion(),
this.client.getSubscriptionId(),
context))
.<PagedResponse<RecordSetInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Lists all record sets in a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param top The maximum number of record sets to return. If not specified, returns up to 100 record sets.
* @param recordSetNameSuffix The suffix label of the record set name that has to be used to filter the record set
* enumerations. If this parameter is specified, Enumeration will return only records that end with
* .<recordSetNameSuffix>.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<RecordSetInner> listAllByDnsZoneAsync(
String resourceGroupName, String zoneName, Integer top, String recordSetNameSuffix) {
return new PagedFlux<>(
() -> listAllByDnsZoneSinglePageAsync(resourceGroupName, zoneName, top, recordSetNameSuffix),
nextLink -> listAllByDnsZoneNextSinglePageAsync(nextLink));
}
/**
* Lists all record sets in a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<RecordSetInner> listAllByDnsZoneAsync(String resourceGroupName, String zoneName) {
final Integer top = null;
final String recordSetNameSuffix = null;
final Context context = null;
return new PagedFlux<>(
() -> listAllByDnsZoneSinglePageAsync(resourceGroupName, zoneName, top, recordSetNameSuffix),
nextLink -> listAllByDnsZoneNextSinglePageAsync(nextLink));
}
/**
* Lists all record sets in a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @param top The maximum number of record sets to return. If not specified, returns up to 100 record sets.
* @param recordSetNameSuffix The suffix label of the record set name that has to be used to filter the record set
* enumerations. If this parameter is specified, Enumeration will return only records that end with
* .<recordSetNameSuffix>.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<RecordSetInner> listAllByDnsZone(
String resourceGroupName, String zoneName, Integer top, String recordSetNameSuffix) {
return new PagedIterable<>(listAllByDnsZoneAsync(resourceGroupName, zoneName, top, recordSetNameSuffix));
}
/**
* Lists all record sets in a DNS zone.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param zoneName The name of the DNS zone (without a terminating dot).
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<RecordSetInner> listAllByDnsZone(String resourceGroupName, String zoneName) {
final Integer top = null;
final String recordSetNameSuffix = null;
final Context context = null;
return new PagedIterable<>(listAllByDnsZoneAsync(resourceGroupName, zoneName, top, recordSetNameSuffix));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<RecordSetInner>> listByTypeNextSinglePageAsync(String nextLink) {
return FluxUtil
.withContext(context -> service.listByTypeNext(nextLink, context))
.<PagedResponse<RecordSetInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<RecordSetInner>> listByDnsZoneNextSinglePageAsync(String nextLink) {
return FluxUtil
.withContext(context -> service.listByDnsZoneNext(nextLink, context))
.<PagedResponse<RecordSetInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
/**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the response to a record set List operation.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<PagedResponse<RecordSetInner>> listAllByDnsZoneNextSinglePageAsync(String nextLink) {
return FluxUtil
.withContext(context -> service.listAllByDnsZoneNext(nextLink, context))
.<PagedResponse<RecordSetInner>>map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
}
| [
"[email protected]"
] | |
1d3268d30e5dc0f516ca1b50183598379428d283 | 9ba870704a5a38fc592ba34bb7b0f59390904a20 | /app/src/main/kotlin/at/droelf/codereview/utils/CircleTransform.java | 857e55b4902e6096c1723369722dfba8c59c1543 | [] | no_license | schlan/codereview | c555f23e8dfbdf65e4959959baf6dcb016c106a4 | 3bde82bf8b60a75c789b96a56d981c72a5eeb79f | refs/heads/master | 2021-05-01T05:13:43.782131 | 2017-01-22T14:07:46 | 2017-01-22T14:07:46 | 50,302,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,227 | java | package at.droelf.codereview.utils;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Paint;
import com.squareup.picasso.Transformation;
public class CircleTransform implements Transformation {
@Override
public Bitmap transform(Bitmap source) {
int size = Math.min(source.getWidth(), source.getHeight());
int x = (source.getWidth() - size) / 2;
int y = (source.getHeight() - size) / 2;
Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size);
if (squaredBitmap != source) {
source.recycle();
}
Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig());
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint();
BitmapShader shader = new BitmapShader(squaredBitmap,
BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
paint.setShader(shader);
paint.setAntiAlias(true);
float r = size / 2f;
canvas.drawCircle(r, r, r, paint);
squaredBitmap.recycle();
return bitmap;
}
@Override
public String key() {
return "circle";
}
} | [
"[email protected]"
] | |
2adc3f9f40605997b444e40742ed662a66375469 | 87cd3b8dfce6847cea472aec671486b3cb0bf66b | /src/exercises/arraylistpractice/ArrayListPractice1.java | 97d89c993b8eecd4fbf22427d2063e34843f1583 | [] | no_license | EyeTyrant/java-web-dev-exercises | f55dc724e50faa99eaeafdd81c7c7bcff745655b | 1b8dee78901d006482679bcb3f675742607256ec | refs/heads/master | 2020-09-04T02:05:25.774874 | 2019-11-25T03:05:16 | 2019-11-25T03:05:16 | 219,634,981 | 0 | 0 | null | 2019-11-05T01:55:42 | 2019-11-05T01:55:42 | null | UTF-8 | Java | false | false | 330 | java | package exercises.arraylistpractice;
import java.util.ArrayList;
import java.util.Arrays;
public class ArrayListPractice1 {
public static void main(String[] args) {
ArrayList<Integer> myNums = new ArrayList<>(Arrays.asList(3, 5, 35, 8, 9, 22, 14, 9, 3, 2, 2, 1, 7));
System.out.println(SumNums.sumNums(myNums));
}
}
| [
"[email protected]"
] | |
a887210353e03706c88a015503354065d76c4391 | a75cb2f83866582c72c9d9778526d5ab59e682c5 | /simplenestlist/src/main/java/com/xk/simplenestlist/layouthelper/LayoutHelper.java | 0bbb478b047119e2b30c2b00627edad5a5afbd1c | [] | no_license | XSation/SimpleNestList | 185014c138993221a72eb430f9772e2063df7940 | 9b4a70a638acaaf5fc20b048e66e1e65182edbd0 | refs/heads/master | 2020-05-16T16:14:23.466565 | 2019-05-31T08:07:25 | 2019-05-31T08:07:25 | 183,155,186 | 16 | 2 | null | null | null | null | UTF-8 | Java | false | false | 442 | java | package com.xk.simplenestlist.layouthelper;
/**
* 自定义布局继承他
* @author xuekai1
* @date 2019/4/24
*/
public abstract class LayoutHelper {
/**
* 需要支持的span。如果有多行需要支持3、4、5、6列,就用3 4 5 6
*/
protected int[] needSpan = {1};
public abstract int getSpanForPosition(int position, int maxSpanCount);
public int[] getNeedSpan() {
return needSpan;
}
}
| [
"[email protected]"
] | |
b5e52cb3122655b058387327f223b3a10818f338 | d25b7da67b2c5064a0760d915965185ef3709dbb | /src/twovillages/Village.java | 278ac1343a2e9052f936e56b09b9335277f3d295 | [] | no_license | jinkal11/TwoVillages | 34d573fd5c752550afcb9514b03922b978d0d3e4 | e51098f1193a87f5cb6501aad546721e3c0b759c | refs/heads/master | 2020-05-24T02:11:46.086931 | 2019-05-16T14:55:36 | 2019-05-16T14:55:36 | 187,048,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,177 | 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 twovillages;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
/**
* Village class contains multiple houses.
* @author Jinkal Dudhat, 000762953
*/
public class Village {
/** x and y coordinates **/
private double x, y;
/** size of house **/
private double size = 200;
/** size of the village **/
private double sum;
/** Color of house **/
private Color color;
/**name of the village **/
private String name;
/** house1 of the village **/
private House house1;
/** house2 of the village **/
private House house2;
/** house3 of the village **/
private House house3;
/**
*
* @param name contains name of the village
* @param x coordinates of the village
* @param y coordinates of the village
* @param color of the house
*/
public Village(String name, int x, int y, Color color) {
this.x = x;
this.y = y;
this.color = color;
this.name = name;
sum = 40 + (sum*20)/100;
System.out.printf("sum: %.2f m \n", sum);
/**
* Create House object house1
*/
house1 = new House(x, y, size, color);
/**
* Create House object house2
*/
house2 = new House((x + (size + 20)), (y + (size - (size * 0.90))), size * 0.90, color);
/**
* Create House object house3
*/
house3 = new House((x + (size * 2) + 20), (y + (size - (size * 0.80))), size * 0.80, color);
}
/** Draws door with graphic context
@param gc as graphicsContext object.
**/
public void draw(GraphicsContext gc) {
house1.draw(gc);
house2.draw(gc);
house3.draw(gc);
gc.setStroke(Color.ORANGE);
gc.strokeText(name, x+size, y+size+ 20);
}
}
| [
"USER@DESKTOP-LF9TSU0"
] | USER@DESKTOP-LF9TSU0 |
85d34e7c6f19acc858abd3cb30c74f5aaba2a664 | 443482f37a9e462e280d222f761b1f06500676be | /src/modelo/Datos.java | 1ad8ab6f77b25b41cd01e8a01256ca62fd12453d | [] | no_license | rmnba/Practica2 | 3d4b5931c30cb8385e0f224b1baeab9be3bc6287 | c0c6a9413412b7c6999ea1a12303f13e00358da4 | refs/heads/master | 2021-01-19T22:56:40.405550 | 2017-04-28T23:05:57 | 2017-04-28T23:05:57 | 88,897,058 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 407 | java | package modelo;
public class Datos
{
private int distancia[][];
private int flujo[][];
private int n;
public Datos(int distancia[][], int flujo[][], int n)
{
this.distancia = distancia;
this.flujo = flujo;
this.n = n;
}
public int [][] getDistancia()
{
return this.distancia;
}
public int [][] getFlujo()
{
return this.flujo;
}
public int getN()
{
return this.n;
}
}
| [
"[email protected]"
] | |
18764cadd6938c13ff53df37b8252eef84f739e5 | 1e786ee2c2a45574dfeb2fe8eabd610787783d89 | /app/src/main/java/com/darwins/userscrudproject/rest/ApiClient.java | cd811551388f11248bd674056f713ba9cd90826f | [] | no_license | rnx228/UsersCRUD | b48342fa32cedd4b96ae32b646c325d878733c8e | e879ce5483f99240c756553b472ef63c6ea74088 | refs/heads/main | 2023-06-14T22:50:23.249448 | 2021-07-12T03:59:37 | 2021-07-12T03:59:37 | 382,092,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 578 | java | package com.darwins.userscrudproject.rest;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class ApiClient {
public static final String BASE_URL = "https://reqres.in/api/";
private static Retrofit retrofit = null;
public static Retrofit getClient(){
if(retrofit==null){
retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
}
return retrofit;
}
} | [
"[email protected]"
] | |
f311835894577f79c4feee7216068240303244b1 | 8c914c8efddbe9616c2ee5ea4cd55e794d8ca036 | /src/test/java/io/github/jhipster/gco/web/rest/UserJWTControllerIntTest.java | da98351c8cdadc504414b37ae06241622bb69c1f | [] | no_license | trblft/jhipsterSampleApplication | cc1bdfd165fb986b273fcdf204733b1a469cf18b | 8adc8e37bf7992e473ff42371883740a28f9bbbf | refs/heads/master | 2021-05-09T01:34:59.821784 | 2018-02-01T08:51:48 | 2018-02-01T08:51:48 | 119,808,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,928 | java | package io.github.jhipster.gco.web.rest;
import io.github.jhipster.gco.JhipsterSampleApplicationApp;
import io.github.jhipster.gco.domain.User;
import io.github.jhipster.gco.repository.UserRepository;
import io.github.jhipster.gco.security.jwt.TokenProvider;
import io.github.jhipster.gco.web.rest.vm.LoginVM;
import io.github.jhipster.gco.web.rest.errors.ExceptionTranslator;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.Matchers.isEmptyString;
import static org.hamcrest.Matchers.not;
/**
* Test class for the UserJWTController REST controller.
*
* @see UserJWTController
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = JhipsterSampleApplicationApp.class)
public class UserJWTControllerIntTest {
@Autowired
private TokenProvider tokenProvider;
@Autowired
private AuthenticationManager authenticationManager;
@Autowired
private UserRepository userRepository;
@Autowired
private PasswordEncoder passwordEncoder;
@Autowired
private ExceptionTranslator exceptionTranslator;
private MockMvc mockMvc;
@Before
public void setup() {
UserJWTController userJWTController = new UserJWTController(tokenProvider, authenticationManager);
this.mockMvc = MockMvcBuilders.standaloneSetup(userJWTController)
.setControllerAdvice(exceptionTranslator)
.build();
}
@Test
@Transactional
public void testAuthorize() throws Exception {
User user = new User();
user.setLogin("user-jwt-controller");
user.setEmail("[email protected]");
user.setActivated(true);
user.setPassword(passwordEncoder.encode("test"));
userRepository.saveAndFlush(user);
LoginVM login = new LoginVM();
login.setUsername("user-jwt-controller");
login.setPassword("test");
mockMvc.perform(post("/api/authenticate")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(login)))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id_token").isString())
.andExpect(jsonPath("$.id_token").isNotEmpty())
.andExpect(header().string("Authorization", not(nullValue())))
.andExpect(header().string("Authorization", not(isEmptyString())));
}
@Test
@Transactional
public void testAuthorizeWithRememberMe() throws Exception {
User user = new User();
user.setLogin("user-jwt-controller-remember-me");
user.setEmail("[email protected]");
user.setActivated(true);
user.setPassword(passwordEncoder.encode("test"));
userRepository.saveAndFlush(user);
LoginVM login = new LoginVM();
login.setUsername("user-jwt-controller-remember-me");
login.setPassword("test");
login.setRememberMe(true);
mockMvc.perform(post("/api/authenticate")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(login)))
.andExpect(status().isOk())
.andExpect(jsonPath("$.id_token").isString())
.andExpect(jsonPath("$.id_token").isNotEmpty())
.andExpect(header().string("Authorization", not(nullValue())))
.andExpect(header().string("Authorization", not(isEmptyString())));
}
@Test
@Transactional
public void testAuthorizeFails() throws Exception {
LoginVM login = new LoginVM();
login.setUsername("wrong-user");
login.setPassword("wrong password");
mockMvc.perform(post("/api/authenticate")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(login)))
.andExpect(status().isUnauthorized())
.andExpect(jsonPath("$.id_token").doesNotExist())
.andExpect(header().doesNotExist("Authorization"));
}
}
| [
"[email protected]"
] | |
590fc1051d86bc53e27cae5b8f4a001386871612 | 82d29af5d9f218ea8d48e14673d0c72b25806200 | /app/src/main/java/com/example/kaspe/courseintroduction/Exercise3_6.java | 49c3cabb5ca0672fde3e07a65dd7adb6274bddc7 | [] | no_license | ChristianSoerensen/AND-Solutions | 6b8547df994f28883878fa7a7da0b2c1b76bce77 | 0a7784ca71aa21e16cb2cd1e5b7a697d64e7f9cf | refs/heads/master | 2020-05-03T10:41:56.015140 | 2018-09-10T16:38:57 | 2018-09-10T16:38:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,273 | java | package com.example.kaspe.courseintroduction;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class Exercise3_6 extends AppCompatActivity {
EditText edit_to;
EditText edit_subject;
EditText edit_body;
Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.exercise3_6);
edit_to = findViewById(R.id.edit_to);
edit_subject = findViewById(R.id.edit_subject);
edit_body = findViewById(R.id.edit_body);
button = findViewById(R.id.button);
}
public void sendNow(View v) {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{edit_to.getText().toString()});
intent.putExtra(Intent.EXTRA_SUBJECT, edit_subject.getText().toString());
intent.putExtra(Intent.EXTRA_TEXT, edit_body.getText().toString());
if(intent.resolveActivity(getPackageManager()) != null){
startActivity(intent);
}
}
}
| [
"[email protected]"
] | |
3ff0354f2c9d30dda0dcc598ad4cc0c812924d5a | 79e17d953b92885c79ec9f302c583f52fa7a1724 | /src/main/java/domain/movie/notification/NotificationText.java | 75e92be5260fa2c750a2748fdec295d91c9d5820 | [] | no_license | m-ohashi/movie_site | 646c22feb6b7263effb04ea4928d37a7cf41a13f | 94404f53b7d73b88d1e79ad5eba750d14cdb344a | refs/heads/master | 2020-03-07T08:32:58.517437 | 2018-04-27T08:38:56 | 2018-04-27T08:38:56 | 127,381,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 209 | java | package domain.movie.notification;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
@AllArgsConstructor
@EqualsAndHashCode
public class NotificationText {
private final String value;
}
| [
"[email protected]"
] | |
8e9e6e55eb285425bbab8423b06b0c6a6ae05956 | b8f4aa38d7f75b74e97f72f6c0766d3849fc7c94 | /helloSpringboot/src/main/java/springboot/hello/helloSpringboot/entity/UserAge.java | 9f120024374aa30128c5c9a799509eb910ba1cdc | [] | no_license | kongjingjun/kj | 28f8fce0fd973a7fa491a621e1210c89d04a9f99 | 51150f8d140e82b06552d74e425015c764096a2d | refs/heads/master | 2021-12-13T14:33:33.042960 | 2019-08-22T03:06:54 | 2019-08-22T03:06:54 | 178,008,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 377 | java | package springboot.hello.helloSpringboot.entity;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import lombok.Data;
@TableName("user_age")
@Data
public class UserAge {
@TableId("id")
private int id;
@TableField("name")
private String name;
}
| [
"[email protected]"
] | |
dfc91e5c835a3477b3b38fd5236005c694c046b4 | d9ef1dc6c3da9d6d2611e5679a69966f65435134 | /2.JavaCore/src/com/javarush/task/task19/task1906/Solution.java | 8c6cff1b3a54cea1a800dac0eac1a5aef6770268 | [] | no_license | diesudmedexpert1995/JavaRushTasks1 | a7c89fa46e4a2bbeb8690d3ec6602bd4910a4e70 | 02fdb84a884879de8f44c3880bd59d6dcbc837ac | refs/heads/master | 2023-02-21T12:59:44.137431 | 2021-01-25T12:41:12 | 2021-01-25T12:41:12 | 305,667,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 806 | java | package com.javarush.task.task19.task1906;
import java.io.*;
import java.util.ArrayList;
/*
Четные символы
*/
public class Solution {
public static void main(String[] args) throws IOException {
BufferedReader consoleReader = new BufferedReader(new InputStreamReader(System.in));
String filename1 = consoleReader.readLine();
String filename2 = consoleReader.readLine();
consoleReader.close();
FileReader fileReader = new FileReader(filename1);
FileWriter fileWriter = new FileWriter(filename2);
int i = 1;
while (fileReader.ready()){
int value = fileReader.read();
if (i%2 == 0) fileWriter.write(value);
i++;
}
fileReader.close();
fileWriter.close();
}
}
| [
"[email protected]"
] | |
c9c6373e94b75b802ad4ac9dee0438a6cf46e47b | d1bd1246f161b77efb418a9c24ee544d59fd1d20 | /java/Tools/src/org/jaudiotagger/tag/id3/ID3v1Tag.java | 458f55324ae2e0010e5f8a62a1c6f91d3245ad2c | [] | no_license | navychen2003/javen | f9a94b2e69443291d4b5c3db5a0fc0d1206d2d4a | a3c2312bc24356b1c58b1664543364bfc80e816d | refs/heads/master | 2021-01-20T12:12:46.040953 | 2015-03-03T06:14:46 | 2015-03-03T06:14:46 | 30,912,222 | 0 | 1 | null | 2023-03-20T11:55:50 | 2015-02-17T10:24:28 | Java | UTF-8 | Java | false | false | 28,629 | java | /**
* @author : Paul Taylor
* @author : Eric Farng
*
* Version @version:$Id: ID3v1Tag.java 1112 2013-03-01 14:09:01Z paultaylor $
*
* MusicTag Copyright (C)2003,2004
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser
* General Public License as published by the Free Software Foundation; either version 2.1 of the License,
* or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not,
* you can get a copy from http://www.opensource.org/licenses/lgpl-license.php or write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Description:
*
*/
package org.jaudiotagger.tag.id3;
import org.jaudiotagger.audio.generic.Utils;
import org.jaudiotagger.audio.mp3.MP3File;
import org.jaudiotagger.logging.ErrorMessage;
import org.jaudiotagger.tag.*;
import org.jaudiotagger.tag.images.Artwork;
import org.jaudiotagger.tag.reference.GenreTypes;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.*;
import java.util.regex.Matcher;
/**
* Represents an ID3v1 tag.
*
* @author : Eric Farng
* @author : Paul Taylor
*/
public class ID3v1Tag extends AbstractID3v1Tag implements Tag
{
static EnumMap<FieldKey, ID3v1FieldKey> tagFieldToID3v1Field = new EnumMap<FieldKey, ID3v1FieldKey>(FieldKey.class);
static
{
tagFieldToID3v1Field.put(FieldKey.ARTIST, ID3v1FieldKey.ARTIST);
tagFieldToID3v1Field.put(FieldKey.ALBUM, ID3v1FieldKey.ALBUM);
tagFieldToID3v1Field.put(FieldKey.TITLE, ID3v1FieldKey.TITLE);
tagFieldToID3v1Field.put(FieldKey.TRACK, ID3v1FieldKey.TRACK);
tagFieldToID3v1Field.put(FieldKey.YEAR, ID3v1FieldKey.YEAR);
tagFieldToID3v1Field.put(FieldKey.GENRE, ID3v1FieldKey.GENRE);
tagFieldToID3v1Field.put(FieldKey.COMMENT, ID3v1FieldKey.COMMENT);
}
//For writing output
protected static final String TYPE_COMMENT = "comment";
protected static final int FIELD_COMMENT_LENGTH = 30;
protected static final int FIELD_COMMENT_POS = 97;
protected static final int BYTE_TO_UNSIGNED = 0xff;
protected static final int GENRE_UNDEFINED = 0xff;
/**
*
*/
protected String album = "";
/**
*
*/
protected String artist = "";
/**
*
*/
protected String comment = "";
/**
*
*/
protected String title = "";
/**
*
*/
protected String year = "";
/**
*
*/
protected byte genre = (byte) -1;
private static final byte RELEASE = 1;
private static final byte MAJOR_VERSION = 0;
private static final byte REVISION = 0;
/**
* Retrieve the Release
*/
public byte getRelease()
{
return RELEASE;
}
/**
* Retrieve the Major Version
*/
public byte getMajorVersion()
{
return MAJOR_VERSION;
}
/**
* Retrieve the Revision
*/
public byte getRevision()
{
return REVISION;
}
/**
* Creates a new ID3v1 datatype.
*/
public ID3v1Tag()
{
}
public ID3v1Tag(ID3v1Tag copyObject)
{
super(copyObject);
this.album = copyObject.album;
this.artist = copyObject.artist;
this.comment = copyObject.comment;
this.title = copyObject.title;
this.year = copyObject.year;
this.genre = copyObject.genre;
}
public ID3v1Tag(AbstractTag mp3tag)
{
if (mp3tag != null)
{
ID3v11Tag convertedTag;
if (mp3tag instanceof ID3v1Tag)
{
throw new UnsupportedOperationException("Copy Constructor not called. Please type cast the argument");
}
if (mp3tag instanceof ID3v11Tag)
{
convertedTag = (ID3v11Tag) mp3tag;
}
else
{
convertedTag = new ID3v11Tag(mp3tag);
}
this.album = convertedTag.album;
this.artist = convertedTag.artist;
this.comment = convertedTag.comment;
this.title = convertedTag.title;
this.year = convertedTag.year;
this.genre = convertedTag.genre;
}
}
/**
* Creates a new ID3v1 datatype.
*
* @param file
* @param loggingFilename
* @throws TagNotFoundException
* @throws IOException
*/
public ID3v1Tag(RandomAccessFile file, String loggingFilename) throws TagNotFoundException, IOException
{
setLoggingFilename(loggingFilename);
FileChannel fc;
ByteBuffer byteBuffer;
fc = file.getChannel();
fc.position(file.length() - TAG_LENGTH);
byteBuffer = ByteBuffer.allocate(TAG_LENGTH);
fc.read(byteBuffer);
byteBuffer.flip();
read(byteBuffer);
}
/**
* Creates a new ID3v1 datatype.
*
* @param file
* @throws TagNotFoundException
* @throws IOException
* @deprecated use {@link #ID3v1Tag(RandomAccessFile,String)} instead
*/
public ID3v1Tag(RandomAccessFile file) throws TagNotFoundException, IOException
{
this(file, "");
}
public void addField(TagField field)
{
//TODO
}
/**
* Maps the generic key to the ogg key and return the list of values for this field as strings
*
* @param genericKey
* @return
* @throws KeyNotFoundException
*/
public List<String> getAll(FieldKey genericKey) throws KeyNotFoundException
{
List<String> list = new ArrayList<String>();
list.add(getFirst(genericKey.name()));
return list;
}
public List<TagField> getFields(String id)
{
if (FieldKey.ARTIST.name().equals(id))
{
return getArtist();
}
else if (FieldKey.ALBUM.name().equals(id))
{
return getAlbum();
}
else if (FieldKey.TITLE.name().equals(id))
{
return getTitle();
}
else if (FieldKey.GENRE.name().equals(id))
{
return getGenre();
}
else if (FieldKey.YEAR.name().equals(id))
{
return getYear();
}
else if (FieldKey.COMMENT.name().equals(id))
{
return getComment();
}
return new ArrayList<TagField>();
}
public int getFieldCount()
{
return 6;
}
public int getFieldCountIncludingSubValues()
{
return getFieldCount();
}
protected List<TagField> returnFieldToList(ID3v1TagField field)
{
List<TagField> fields = new ArrayList<TagField>();
fields.add(field);
return fields;
}
/**
* Set Album
*
* @param album
*/
public void setAlbum(String album)
{
if (album == null)
{
throw new IllegalArgumentException(ErrorMessage.GENERAL_INVALID_NULL_ARGUMENT.getMsg());
}
this.album = ID3Tags.truncate(album, FIELD_ALBUM_LENGTH);
}
/**
* Get Album
*
* @return album
*/
public String getFirstAlbum()
{
return album;
}
/**
* @return album within list or empty if does not exist
*/
public List<TagField> getAlbum()
{
if (getFirstAlbum().length() > 0)
{
ID3v1TagField field = new ID3v1TagField(ID3v1FieldKey.ALBUM.name(), getFirstAlbum());
return returnFieldToList(field);
}
else
{
return new ArrayList<TagField>();
}
}
/**
* Set Artist
*
* @param artist
*/
public void setArtist(String artist)
{
if (artist == null)
{
throw new IllegalArgumentException(ErrorMessage.GENERAL_INVALID_NULL_ARGUMENT.getMsg());
}
this.artist = ID3Tags.truncate(artist, FIELD_ARTIST_LENGTH);
}
/**
* Get Artist
*
* @return artist
*/
public String getFirstArtist()
{
return artist;
}
/**
* @return Artist within list or empty if does not exist
*/
public List<TagField> getArtist()
{
if (getFirstArtist().length() > 0)
{
ID3v1TagField field = new ID3v1TagField(ID3v1FieldKey.ARTIST.name(), getFirstArtist());
return returnFieldToList(field);
}
else
{
return new ArrayList<TagField>();
}
}
/**
* Set Comment
*
* @param comment
* @throws IllegalArgumentException if comment null
*/
public void setComment(String comment)
{
if (comment == null)
{
throw new IllegalArgumentException(ErrorMessage.GENERAL_INVALID_NULL_ARGUMENT.getMsg());
}
this.comment = ID3Tags.truncate(comment, FIELD_COMMENT_LENGTH);
}
/**
* @return comment within list or empty if does not exist
*/
public List<TagField> getComment()
{
if (getFirstComment().length() > 0)
{
ID3v1TagField field = new ID3v1TagField(ID3v1FieldKey.COMMENT.name(), getFirstComment());
return returnFieldToList(field);
}
else
{
return new ArrayList<TagField>();
}
}
/**
* Get Comment
*
* @return comment
*/
public String getFirstComment()
{
return comment;
}
/**
* Sets the genreID,
* <p/>
* <p>ID3v1 only supports genres defined in a predefined list
* so if unable to find value in list set 255, which seems to be the value
* winamp uses for undefined.
*
* @param genreVal
*/
public void setGenre(String genreVal)
{
if (genreVal == null)
{
throw new IllegalArgumentException(ErrorMessage.GENERAL_INVALID_NULL_ARGUMENT.getMsg());
}
Integer genreID = GenreTypes.getInstanceOf().getIdForValue(genreVal);
if (genreID != null)
{
this.genre = genreID.byteValue();
}
else
{
this.genre = (byte) GENRE_UNDEFINED;
}
}
/**
* Get Genre
*
* @return genre or empty string if not valid
*/
public String getFirstGenre()
{
Integer genreId = genre & BYTE_TO_UNSIGNED;
String genreValue = GenreTypes.getInstanceOf().getValueForId(genreId);
if (genreValue == null)
{
return "";
}
else
{
return genreValue;
}
}
/**
* Get Genre field
* <p/>
* <p>Only a single genre is available in ID3v1
*
* @return
*/
public List<TagField> getGenre()
{
if (getFirst(FieldKey.GENRE).length() > 0)
{
ID3v1TagField field = new ID3v1TagField(ID3v1FieldKey.GENRE.name(), getFirst(FieldKey.GENRE));
return returnFieldToList(field);
}
else
{
return new ArrayList<TagField>();
}
}
/**
* Set Title
*
* @param title
*/
public void setTitle(String title)
{
if (title == null)
{
throw new IllegalArgumentException(ErrorMessage.GENERAL_INVALID_NULL_ARGUMENT.getMsg());
}
this.title = ID3Tags.truncate(title, FIELD_TITLE_LENGTH);
}
/**
* Get title
*
* @return Title
*/
public String getFirstTitle()
{
return title;
}
/**
* Get title field
* <p/>
* <p>Only a single title is available in ID3v1
*
* @return
*/
public List<TagField> getTitle()
{
if (getFirst(FieldKey.TITLE).length() > 0)
{
ID3v1TagField field = new ID3v1TagField(ID3v1FieldKey.TITLE.name(), getFirst(FieldKey.TITLE));
return returnFieldToList(field);
}
else
{
return new ArrayList<TagField>();
}
}
/**
* Set year
*
* @param year
*/
public void setYear(String year)
{
this.year = ID3Tags.truncate(year, FIELD_YEAR_LENGTH);
}
/**
* Get year
*
* @return year
*/
public String getFirstYear()
{
return year;
}
/**
* Get year field
* <p/>
* <p>Only a single year is available in ID3v1
*
* @return
*/
public List<TagField> getYear()
{
if (getFirst(FieldKey.YEAR).length() > 0)
{
ID3v1TagField field = new ID3v1TagField(ID3v1FieldKey.YEAR.name(), getFirst(FieldKey.YEAR));
return returnFieldToList(field);
}
else
{
return new ArrayList<TagField>();
}
}
public String getFirstTrack()
{
throw new UnsupportedOperationException("ID3v10 cannot store track numbers");
}
public List<TagField> getTrack()
{
throw new UnsupportedOperationException("ID3v10 cannot store track numbers");
}
public TagField getFirstField(String id)
{
List<TagField> results = null;
if (FieldKey.ARTIST.name().equals(id))
{
results = getArtist();
}
else if (FieldKey.ALBUM.name().equals(id))
{
results = getAlbum();
}
else if (FieldKey.TITLE.name().equals(id))
{
results = getTitle();
}
else if (FieldKey.GENRE.name().equals(id))
{
results = getGenre();
}
else if (FieldKey.YEAR.name().equals(id))
{
results = getYear();
}
else if (FieldKey.COMMENT.name().equals(id))
{
results = getComment();
}
if (results != null)
{
if (results.size() > 0)
{
return results.get(0);
}
}
return null;
}
public Iterator<TagField> getFields()
{
throw new UnsupportedOperationException("TODO:Not done yet");
}
public boolean hasCommonFields()
{
//TODO
return true;
}
public boolean hasField(FieldKey genericKey)
{
return getFirst(genericKey).length() > 0;
}
public boolean hasField(String id)
{
try
{
FieldKey key = FieldKey.valueOf(id.toUpperCase());
return hasField(key);
}
catch(java.lang.IllegalArgumentException iae)
{
return false;
}
}
public boolean isEmpty()
{
return !(getFirst(FieldKey.TITLE).length() > 0 ||
getFirstArtist().length() > 0 ||
getFirstAlbum().length() > 0 ||
getFirst(FieldKey.GENRE).length() > 0 ||
getFirst(FieldKey.YEAR).length() > 0 ||
getFirstComment().length() > 0);
}
public void setField(FieldKey genericKey, String value) throws KeyNotFoundException, FieldDataInvalidException
{
TagField tagfield = createField(genericKey,value);
setField(tagfield);
}
public void addField(FieldKey genericKey, String value) throws KeyNotFoundException, FieldDataInvalidException
{
setField(genericKey,value);
}
@SuppressWarnings("incomplete-switch")
public void setField(TagField field)
{
FieldKey genericKey = FieldKey.valueOf(field.getId());
switch (genericKey)
{
case ARTIST:
setArtist(field.toString());
break;
case ALBUM:
setAlbum(field.toString());
break;
case TITLE:
setTitle(field.toString());
break;
case GENRE:
setGenre(field.toString());
break;
case YEAR:
setYear(field.toString());
break;
case COMMENT:
setComment(field.toString());
break;
}
}
/**
* @param encoding
* @return
*/
public boolean setEncoding(String encoding)
{
return true;
}
/**
* Create Tag Field using generic key
*/
public TagField createField(FieldKey genericKey, String value)
{
if (genericKey == null)
{
throw new IllegalArgumentException(ErrorMessage.GENERAL_INVALID_NULL_ARGUMENT.getMsg());
}
ID3v1FieldKey idv1FieldKey = tagFieldToID3v1Field.get(genericKey);
if(idv1FieldKey==null)
{
throw new KeyNotFoundException(ErrorMessage.INVALID_FIELD_FOR_ID3V1TAG.getMsg(genericKey.name()));
}
return new ID3v1TagField(idv1FieldKey .name(), value);
}
public String getEncoding()
{
return "ISO-8859-1";
}
public TagField getFirstField(FieldKey genericKey)
{
List<TagField> l = getFields(genericKey);
return (l.size() != 0) ? l.get(0) : null;
}
/**
* Returns a {@linkplain List list} of {@link TagField} objects whose "{@linkplain TagField#getId() id}"
* is the specified one.<br>
*
* @param genericKey The generic field key
* @return A list of {@link TagField} objects with the given "id".
*/
public List<TagField> getFields(FieldKey genericKey)
{
switch (genericKey)
{
case ARTIST:
return getArtist();
case ALBUM:
return getAlbum();
case TITLE:
return getTitle();
case GENRE:
return getGenre();
case YEAR:
return getYear();
case COMMENT:
return getComment();
default:
return new ArrayList<TagField>();
}
}
/**
* Retrieve the first value that exists for this key id
*
* @param genericKey
* @return
*/
public String getFirst(String genericKey)
{
FieldKey matchingKey = FieldKey.valueOf(genericKey);
if (matchingKey != null)
{
return getFirst(matchingKey);
}
else
{
return "";
}
}
/**
* Retrieve the first value that exists for this generic key
*
* @param genericKey
* @return
*/
public String getFirst(FieldKey genericKey)
{
switch (genericKey)
{
case ARTIST:
return getFirstArtist();
case ALBUM:
return getFirstAlbum();
case TITLE:
return getFirstTitle();
case GENRE:
return getFirstGenre();
case YEAR:
return getFirstYear();
case COMMENT:
return getFirstComment();
default:
return "";
}
}
/**
* The m parameter is effectively ignored
*
* @param id
* @param n
* @param m
* @return
*/
public String getSubValue(FieldKey id, int n, int m)
{
return getValue(id,n);
}
public String getValue(FieldKey genericKey, int index)
{
return getFirst(genericKey);
}
/**
* Delete any instance of tag fields with this key
*
* @param genericKey
*/
@SuppressWarnings("incomplete-switch")
public void deleteField(FieldKey genericKey)
{
switch (genericKey)
{
case ARTIST:
setArtist("");
break;
case ALBUM:
setAlbum("");
break;
case TITLE:
setTitle("");
break;
case GENRE:
setGenre("");
break;
case YEAR:
setYear("");
break;
case COMMENT:
setComment("");
break;
}
}
public void deleteField(String id)
{
FieldKey key = FieldKey.valueOf(id);
if(key!=null)
{
deleteField(key);
}
}
/**
* @param obj
* @return true if this and obj are equivalent
*/
public boolean equals(Object obj)
{
if (!(obj instanceof ID3v1Tag))
{
return false;
}
ID3v1Tag object = (ID3v1Tag) obj;
if (!this.album.equals(object.album))
{
return false;
}
if (!this.artist.equals(object.artist))
{
return false;
}
if (!this.comment.equals(object.comment))
{
return false;
}
if (this.genre != object.genre)
{
return false;
}
if (!this.title.equals(object.title))
{
return false;
}
return this.year.equals(object.year) && super.equals(obj);
}
/**
* @return an iterator to iterate through the fields of the tag
*/
@SuppressWarnings("rawtypes")
public Iterator iterator()
{
return new ID3v1Iterator(this);
}
/**
* @param byteBuffer
* @throws TagNotFoundException
*/
public void read(ByteBuffer byteBuffer) throws TagNotFoundException
{
if (!seek(byteBuffer))
{
throw new TagNotFoundException(getLoggingFilename() + ":" + "ID3v1 tag not found");
}
//logger.finer(getLoggingFilename() + ":" + "Reading v1 tag");
//Do single file read of data to cut down on file reads
byte[] dataBuffer = new byte[TAG_LENGTH];
byteBuffer.position(0);
byteBuffer.get(dataBuffer, 0, TAG_LENGTH);
title = Utils.getString(dataBuffer, FIELD_TITLE_POS, FIELD_TITLE_LENGTH, "ISO-8859-1").trim();
Matcher m = AbstractID3v1Tag.endofStringPattern.matcher(title);
if (m.find())
{
title = title.substring(0, m.start());
}
artist = Utils.getString(dataBuffer, FIELD_ARTIST_POS, FIELD_ARTIST_LENGTH, "ISO-8859-1").trim();
m = AbstractID3v1Tag.endofStringPattern.matcher(artist);
if (m.find())
{
artist = artist.substring(0, m.start());
}
album = Utils.getString(dataBuffer, FIELD_ALBUM_POS, FIELD_ALBUM_LENGTH, "ISO-8859-1").trim();
m = AbstractID3v1Tag.endofStringPattern.matcher(album);
//logger.finest(getLoggingFilename() + ":" + "Orig Album is:" + comment + ":");
if (m.find())
{
album = album.substring(0, m.start());
//logger.finest(getLoggingFilename() + ":" + "Album is:" + album + ":");
}
year = Utils.getString(dataBuffer, FIELD_YEAR_POS, FIELD_YEAR_LENGTH, "ISO-8859-1").trim();
m = AbstractID3v1Tag.endofStringPattern.matcher(year);
if (m.find())
{
year = year.substring(0, m.start());
}
comment = Utils.getString(dataBuffer, FIELD_COMMENT_POS, FIELD_COMMENT_LENGTH, "ISO-8859-1").trim();
m = AbstractID3v1Tag.endofStringPattern.matcher(comment);
//logger.finest(getLoggingFilename() + ":" + "Orig Comment is:" + comment + ":");
if (m.find())
{
comment = comment.substring(0, m.start());
//logger.finest(getLoggingFilename() + ":" + "Comment is:" + comment + ":");
}
genre = dataBuffer[FIELD_GENRE_POS];
}
/**
* Does a tag of this version exist within the byteBuffer
*
* @return whether tag exists within the byteBuffer
*/
public boolean seek(ByteBuffer byteBuffer)
{
byte[] buffer = new byte[FIELD_TAGID_LENGTH];
// read the TAG value
byteBuffer.get(buffer, 0, FIELD_TAGID_LENGTH);
return (Arrays.equals(buffer, TAG_ID));
}
/**
* Write this tag to the file, replacing any tag previously existing
*
* @param file
* @throws IOException
*/
public void write(RandomAccessFile file) throws IOException
{
//logger.config("Saving ID3v1 tag to file");
byte[] buffer = new byte[TAG_LENGTH];
int i;
String str;
delete(file);
file.seek(file.length());
//Copy the TAGID into new buffer
System.arraycopy(TAG_ID, FIELD_TAGID_POS, buffer, FIELD_TAGID_POS, TAG_ID.length);
int offset = FIELD_TITLE_POS;
if (TagOptionSingleton.getInstance().isId3v1SaveTitle())
{
str = ID3Tags.truncate(title, FIELD_TITLE_LENGTH);
for (i = 0; i < str.length(); i++)
{
buffer[i + offset] = (byte) str.charAt(i);
}
}
offset = FIELD_ARTIST_POS;
if (TagOptionSingleton.getInstance().isId3v1SaveArtist())
{
str = ID3Tags.truncate(artist, FIELD_ARTIST_LENGTH);
for (i = 0; i < str.length(); i++)
{
buffer[i + offset] = (byte) str.charAt(i);
}
}
offset = FIELD_ALBUM_POS;
if (TagOptionSingleton.getInstance().isId3v1SaveAlbum())
{
str = ID3Tags.truncate(album, FIELD_ALBUM_LENGTH);
for (i = 0; i < str.length(); i++)
{
buffer[i + offset] = (byte) str.charAt(i);
}
}
offset = FIELD_YEAR_POS;
if (TagOptionSingleton.getInstance().isId3v1SaveYear())
{
str = ID3Tags.truncate(year, AbstractID3v1Tag.FIELD_YEAR_LENGTH);
for (i = 0; i < str.length(); i++)
{
buffer[i + offset] = (byte) str.charAt(i);
}
}
offset = FIELD_COMMENT_POS;
if (TagOptionSingleton.getInstance().isId3v1SaveComment())
{
str = ID3Tags.truncate(comment, FIELD_COMMENT_LENGTH);
for (i = 0; i < str.length(); i++)
{
buffer[i + offset] = (byte) str.charAt(i);
}
}
offset = FIELD_GENRE_POS;
if (TagOptionSingleton.getInstance().isId3v1SaveGenre())
{
buffer[offset] = genre;
}
file.write(buffer);
//logger.config("Saved ID3v1 tag to file");
}
/**
* Create structured representation of this item.
*/
public void createStructure()
{
MP3File.getStructureFormatter().openHeadingElement(TYPE_TAG, getIdentifier());
//Header
MP3File.getStructureFormatter().addElement(TYPE_TITLE, this.title);
MP3File.getStructureFormatter().addElement(TYPE_ARTIST, this.artist);
MP3File.getStructureFormatter().addElement(TYPE_ALBUM, this.album);
MP3File.getStructureFormatter().addElement(TYPE_YEAR, this.year);
MP3File.getStructureFormatter().addElement(TYPE_COMMENT, this.comment);
MP3File.getStructureFormatter().addElement(TYPE_GENRE, this.genre);
MP3File.getStructureFormatter().closeHeadingElement(TYPE_TAG);
}
public List<Artwork> getArtworkList()
{
return Collections.emptyList();
}
public Artwork getFirstArtwork()
{
return null;
}
public TagField createField(Artwork artwork) throws FieldDataInvalidException
{
throw new UnsupportedOperationException(ErrorMessage.GENERIC_NOT_SUPPORTED.getMsg());
}
public void setField(Artwork artwork) throws FieldDataInvalidException
{
throw new UnsupportedOperationException(ErrorMessage.GENERIC_NOT_SUPPORTED.getMsg());
}
public void addField(Artwork artwork) throws FieldDataInvalidException
{
throw new UnsupportedOperationException(ErrorMessage.GENERIC_NOT_SUPPORTED.getMsg());
}
/**
* Delete all instance of artwork Field
*
* @throws KeyNotFoundException
*/
public void deleteArtworkField() throws KeyNotFoundException
{
throw new UnsupportedOperationException(ErrorMessage.GENERIC_NOT_SUPPORTED.getMsg());
}
public TagField createCompilationField(boolean value) throws KeyNotFoundException, FieldDataInvalidException
{
throw new UnsupportedOperationException(ErrorMessage.GENERIC_NOT_SUPPORTED.getMsg());
}
}
| [
"[email protected]"
] | |
62523ab58ac9f5547456f31d69057a8aba0c0a40 | 4115ba77c54030efec062057edf5ae6f981d1a52 | /src/main/java/cn/edu/njust/dev/ses/main/exception/UnfitPropertyTypeException.java | 5a3fe9fcacba1433e13548af6e340f9d648954e7 | [] | no_license | mike0228/SPM | d5e3c463776030c699c720f7926f1e48c832e9d8 | df9f514cf32eefe96b355917868072a94cd5fc47 | refs/heads/master | 2022-07-16T18:49:34.544443 | 2019-12-25T00:19:53 | 2019-12-25T00:19:53 | 226,887,462 | 4 | 2 | null | 2022-06-29T17:50:10 | 2019-12-09T14:12:40 | Java | UTF-8 | Java | false | false | 454 | java | package cn.edu.njust.dev.ses.main.exception;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
@Data
public class UnfitPropertyTypeException extends UnsupportedExcelFormatException{
public UnfitPropertyTypeException(){super();}
public UnfitPropertyTypeException(String message){super(message);}
public UnfitPropertyTypeException(String message, Throwable cause){super(message, cause);}
Integer row;
Integer column;
}
| [
"[email protected]"
] | |
d079fc54df3e6dc86dfd9490717faf786708bc19 | 0fd3e8f4155c71ebac4e4c120a8c8a21945034fb | /hdk/htc/lib1/ExoPlayer/src/com/google/android/exoplayer/text/Cue.java | f9476b5a5a1e91a80bbe09b3797c75eb6fb2af47 | [] | no_license | foryoung2018/UsageReport | f577c02e3236589bde702b81c4f4d126519f1d89 | eed1a71387ec120713d8febab6fbdc4a577e9dd5 | refs/heads/master | 2021-09-13T05:54:27.229906 | 2018-04-25T16:05:13 | 2018-04-25T16:05:13 | 131,033,364 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,454 | java | /*
* Copyright (C) 2014 The Android Open Source Project
*
* 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.android.exoplayer.text;
import android.text.Layout.Alignment;
/**
* Contains information about a specific cue, including textual content and formatting data.
*/
public class Cue {
/**
* Used by some methods to indicate that no value is set.
*/
public static final int UNSET_VALUE = -1;
public final CharSequence text;
public final int line;
public final int position;
public final Alignment alignment;
public final int size;
public Cue() {
this(null);
}
public Cue(CharSequence text) {
this(text, UNSET_VALUE, UNSET_VALUE, null, UNSET_VALUE);
}
public Cue(CharSequence text, int line, int position, Alignment alignment, int size) {
this.text = text;
this.line = line;
this.position = position;
this.alignment = alignment;
this.size = size;
}
}
| [
"[email protected]"
] | |
c528a9e7c6d143d1ef7cbe2fc5d8d58afab045a3 | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/spoon/testing/139/OverriddenMethodFilter.java | 74c6df3a2910da2048fd1c7a362fc9bc51259549 | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,897 | java | /**
* Copyright (C) 2006-2018 INRIA and contributors
* Spoon - http://spoon.gforge.inria.fr/
*
* This software is governed by the CeCILL-C License under French law and
* abiding by the rules of distribution of free software. You can use, modify
* and/or redistribute the software under the terms of the CeCILL-C license as
* circulated by CEA, CNRS and INRIA at http://www.cecill.info.
*
* 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 CeCILL-C License for more details.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms.
*/
package spoon.reflect.visitor.filter;
import spoon.reflect.declaration.CtMethod;
import spoon.reflect.visitor.Filter;
import spoon.support.visitor.ClassTypingContext;
/**
* Gets all overridden method from the method given.
*/
public class OverriddenMethodFilter implements Filter<CtMethod<?>> {
private final CtMethod<?>method;
private final ClassTypingContext context;
private boolean includingSelf = false;
/**
* Creates a new overridden method filter.
*
* @param method
* the executable to be tested for being invoked
*/
public OverriddenMethodFilter(CtMethod<?> method) {
this.method = method;
context = new ClassTypingContext(method.getDeclaringType());
}
/**
* @param includingSelf if false then element which is equal to the #method is not matching.
* false is default behavior
*/
public OverriddenMethodFilter includingSelf(boolean includingSelf) {
this.includingSelf = includingSelf;
return this;
}
@Override
public boolean matches(CtMethod<?> element) {
if (method == element) {
return this.includingSelf;
}
return context.isOverriding(method, element);
}
}
| [
"[email protected]"
] | |
69ffa52cbefd38fdcba6d4a3adc99bc14ba736e4 | 95b78443508637448d3f993f00eabe34533f52ce | /lbcode21/src/type_backtracking_2_K개중하나를N번선택하기_Conditional/_4_방향에맞춰최대로움직이기_1st_백트래킹_.java | 1ea0bcbaf5139c2e903253b7807f6307286d43d7 | [] | no_license | 3times3equals9/lbcode2021 | 26aa091025cc7e1a6f944d8d7b268703df975244 | 146ae272c30e2a737af8ee2db80b993eb988f646 | refs/heads/main | 2023-06-15T04:38:53.211197 | 2021-07-13T11:33:00 | 2021-07-13T11:33:00 | 343,917,781 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,367 | java | package type_backtracking_2_K개중하나를N번선택하기_Conditional;
import java.util.Scanner;
public class _4_방향에맞춰최대로움직이기_1st_백트래킹_ {
static final int MAX_N = 4;
static final int DIR_NUM = 8;
static int n;
static int[][] num, move_dir;
static int ans;
static boolean InRange(int x, int y) {
return 0 <= x && x < n && 0 <= y && y < n;
}
static boolean CanGo(int x, int y, int prev_num) {
return InRange(x, y) && num[x][y] > prev_num;
}
static void FindMax(int x, int y, int cnt) {
// 언제 끝날지 모르기 때문에
// 항상 최댓값을 갱신해줍니다.
ans = Math.max(ans, cnt);
int[] dx = {-1, -1, 0, 1, 1, 1, 0, -1};
int[] dy = {0, 1, 1, 1, 0, -1, -1, -1};
int d = move_dir[x][y] - 1;
for(int i = 0; i < n; i++) {
int nx = x + dx[d] * i, ny = y + dy[d] * i;
if(CanGo(nx, ny, num[x][y]))
FindMax(nx, ny, cnt + 1);
}
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//int num[MAX_N][MAX_N], move_dir[MAX_N][MAX_N];
n = sc.nextInt();
num = new int[n][n];
move_dir = new int[n][n];
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
num[i][j] = sc.nextInt();
for(int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
move_dir[i][j] = sc.nextInt();
int r, c;
r = sc.nextInt();
c = sc.nextInt();
FindMax(r - 1, c - 1, 0);
System.out.println(ans);
sc.close();
}
}
/*
Intuition
특정 위치로부터 주어진 방향에 놓여있는 칸 중 어떤 칸으로 움직일 것인지를 선택하는 재귀함수를 작성합니다. 이때, 현재 숫자보다 큰 칸으로만 움직이면 총 탐색 시간을 줄일 수 있습니다.
Algorithm
Backtracking을 이용하면 어느 위치로 움직일지에 대해 모든 조합을 만들어볼 수 있습니다. 이 각각의 조합에 대해 진행을 해본 후 그 중 최대 움직임 횟수를 출력하면 됩니다.
다만, 언제 움직임이 끝날지 확실하게 정의하기가 어려운 문제이기 때문에 함수가 호출될 때마다 항상 최댓값을 갱신해주는 것이 좋습니다. 또, 그 다음 위치를 선택할 시 현재 숫자보다 큰 숫자로만 이동해야만 원하는 답을 구할 수 있습니다.
*/
| [
"holic@DESKTOP-CAG76QN"
] | holic@DESKTOP-CAG76QN |
bc4247270291cc31b5c27441de0a93535f235bdc | 2ed700d4d3fee25e146a35c800c86d8c3f5fae50 | /src/projet/classesDeBases/Ent.java | f7d23300ccc6556cd861b65f253d0afb82ce510c | [] | no_license | Tboy70/Vivarium_UTBM | 71a546d5c4b850578e194312104ab0f5e7a4e7fe | c33c115ef90952224874ba3bc3e8dcca198fcf7c | refs/heads/master | 2020-04-15T01:15:36.850264 | 2014-06-27T12:32:16 | 2014-06-27T12:32:16 | 21,274,187 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 388 | java | package projet.classesDeBases;
/*********************************************/
/*** CLASSE DU PERSONANGE BIENVEILLANT ENT ***/
/*********************************************/
public class Ent extends Bienveillant{
public Ent(String n, Arme a, Lieu l){
super(n);
ptVie = ptVieMax = 150;
typeArme = 4;
arme = a;
lieuPrefere = l;
persoX = l.getX();
persoY = l.getY();
}
}
| [
"[email protected]"
] | |
7087cc2a0a1aaf9fd31308b84bda635b7c4823b6 | f8facdb442acc9c451b767928af319f2054345cc | /src/testCases/SS_CheckOut_LoginAtCheckout_CheckAddress_AllBlank.java | 94e5bdd642e2b3e41f80b1f8704a7b65842741ac | [] | no_license | nagarro-surender/Automation_ShopperStop | 19c0ffe3b9f20c68cf92b2b31b87f1c90d38e047 | c6786984cb4f7763b6394d616726f34d71dc441a | refs/heads/master | 2021-01-13T15:08:53.843652 | 2017-05-08T09:56:53 | 2017-05-08T09:56:53 | 79,217,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,924 | java | package testCases;
import org.apache.log4j.xml.DOMConfigurator;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterMethod;
//import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import pageObjects.BaseClass;
import pageObjects.Cart_Page;
import pageObjects.Checkout_Page;
import pageObjects.MiniCart_Page;
import pageObjects.ProductDetails_Page;
import pageObjects.ProductListing_Page;
import appModules.CheckOut_Action;
import appModules.HomePage_Action;
import appModules.PDP_Action;
import utility.Constant;
import utility.ExcelUtils;
import utility.Log;
import utility.Utils;
/**
*
* <h2 style="text-align:center;">SS_CheckOut_LoginAtCheckout_OrderUsingNetBanking</h2>
* <p style="font-size:19px"><b>Description -</b>This Test Case verifies checkout flow using Netbanking by Login at checkout</p>
* <TABLE width="100%" border="1">
* <caption style="font-size:17px">List of columns used from excel file</caption>
* <tr><th>Parameters</th><th>Description</th></tr>
* <tr><td>browser</td><td>Browser name in which test execution starts</td></tr>
* <tr><td>emailId</td><td>Email id of the registered user</td></tr>
* <tr><td>password</td><td>Password for the registered user</td></tr>
* <tr><td>productCategory</td><td>Product Main Category(e.g. MEN, WOMEN etc)</td></tr>
* <tr><td>productSubCategory</td><td>Product Sub Category(e.g. T-shirt, Watches etc)</td></tr>
* <tr><td>firstName</td><td>First Name for the delivery address</td></tr>
* <tr><td>lastName</td><td>Last Name for the delivery address</td></tr>
* <tr><td>postCode</td><td>Postal code for the delivery address</td></tr>
* <tr><td>address</td><td>Address field for the delivery</td></tr>
* <tr><td>landmark</td><td>Address2 field for the delivery</td></tr>
* <tr><td>mobileNumber</td><td>Phone for the delivery address</td></tr>
* <tr><td>paymentOption</td><td>NetBanking</td></tr>
* <tr><td>netbankingBankSelection</td><td>Bank selection criteria('SelectBankFromDropdown' in case selected bank is from the drop down list, 'SelectBankFromOptionList' in case selected bank is from the visible list)</td></tr>
* <tr><td>bank</td><td>Bank through which payment is to be done</td></tr>
* </table>
* <br>
* <br>
*
*/
public class SS_CheckOut_LoginAtCheckout_CheckAddress_AllBlank {
public WebDriver Driver;
private String sTestCaseName;
private int iTestCaseRow;
@BeforeMethod
public void BeforeMethod() throws Exception {
DOMConfigurator.configure("log4j.xml");
sTestCaseName = Utils.getTestCaseName(this.toString());
Log.info("Test case to be executed: " + sTestCaseName);
ExcelUtils.setExcelFile(Utils.ReadProperties(Constant.Path_ConfigProperties).getProperty("Path_TestData")
+ Constant.File_TestData, "Sheet1");
iTestCaseRow = ExcelUtils.getRowContains(sTestCaseName, Constant.testCaseName);
Log.startTestCase(sTestCaseName);
Driver = Utils.OpenBrowser(iTestCaseRow);
new BaseClass(Driver);
}
@Test
public void main() throws Exception {
try {
HomePage_Action.selectProductCategoryfromMenu(iTestCaseRow);
Log.info("Product category selected successfully");
ProductListing_Page.product().click();
Log.info("Product selected successfully");
PDP_Action.product_selectSize(ProductDetails_Page.Product.size_variant_buttonlist());
ProductDetails_Page.Product.Product_AddToCart().click();
Log.info("Add to cart button is clicked");
Utils.verifyElement(MiniCart_Page.MiniCartWindow());
Log.info("Product is added to the cart and mini cart is displayed");
MiniCart_Page.MiniCartProductDetails.MiniCartViewBag().click();
Log.info("View bag button is clicked on Mini cart window");
Utils.verifyElement(Cart_Page.CheckoutButton());
Cart_Page.CheckoutButton().click();
Log.info("Checkout button is clicked on cart page");
//Utils.verifyElement(Checkout_Page.TopNavigation.CheckOutText());
//Log.info("User successfully reached to Checkout page");
CheckOut_Action.LoginAsRegisteredUser(iTestCaseRow);
Log.info("Login successful at Checkout");
CheckOut_Action.ProceedwithNewAddressAllFieldEmpty(iTestCaseRow);
System.out.println(Cart_Page.FirstNameFieldAlert().getAttribute("title"));
//CheckOut_Action.PaymentOption(iTestCaseRow);
//ExcelUtils.setCellData("Pass", iTestCaseRow, Constant.result);
//Utils.captureScreenshot(sTestCaseName, "Pass", "Passed");
//Log.info("Payment successful using netbanking after login at checkout");
} catch (Exception e) {
Log.error("Issue in making payment using netbanking");
ExcelUtils.setCellData("Fail", iTestCaseRow, Constant.result);
Utils.captureScreenshot(sTestCaseName, "Fail", "Failure");
Log.error(e.getMessage());
throw (e);
}
}
@AfterMethod
public void afterMethod() {
Log.endTestCase(sTestCaseName);
Driver.close();
Driver.quit();
}
}
| [
"[email protected]"
] | |
e229302931616dd2fdf029dab995d5d12398f7ad | 0b1704ecf4a37c1724dd803b2bc4edeed0dc5632 | /src/test/java/com/crud/tasks/mapper/TrelloMapperTestSuite.java | 7441edb35e1739d9c7209ad2c03f4bcbe136503b | [] | no_license | anka-wojcik/anna-wojcik-tasks-application | 98c6f27f0b95927ab3f4132fafc4f5d0b10863a3 | 966e786fff6041cf4e951a28f4b149cfaac20e04 | refs/heads/master | 2020-03-17T00:36:21.844180 | 2018-08-21T16:08:42 | 2018-08-21T16:08:42 | 133,123,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,920 | java | package com.crud.tasks.mapper;
import com.crud.tasks.domain.*;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.runners.MockitoJUnitRunner;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@RunWith(MockitoJUnitRunner.class)
public class TrelloMapperTestSuite {
@InjectMocks
private TrelloMapper mapper;
@Test
public void testTrelloMapperMapToBoards() {
//Given
List<TrelloListDto> trelloListDto = new ArrayList<>();
List<TrelloBoardDto> trelloBoardDtos = Arrays.asList(
new TrelloBoardDto("Board no. 1", "1", trelloListDto),
new TrelloBoardDto("Board no. 2", "2", trelloListDto),
new TrelloBoardDto("Board no. 3", "3", trelloListDto));
//When
List<TrelloBoard> trelloBoards = mapper.mapToBoards(trelloBoardDtos);
//Then
Assert.assertEquals(3, trelloBoards.size());
Assert.assertEquals("Board no. 3", trelloBoards.get(2).getName());
}
@Test
public void testTrelloMapperMapToBoardsDto() {
//Given
List<TrelloList> trelloLists = new ArrayList<>();
List<TrelloBoard> trelloBoards = Arrays.asList(
new TrelloBoard("Board no. 1", "1", trelloLists),
new TrelloBoard("Board no. 2", "2", trelloLists),
new TrelloBoard("Board no. 3", "3", trelloLists));
//When
List<TrelloBoardDto> trelloBoardDto = mapper.mapToBoardsDto(trelloBoards);
//Then
Assert.assertEquals(3, trelloBoardDto.size());
Assert.assertEquals("Board no. 3", trelloBoardDto.get(2).getName());
}
@Test
public void testTrelloMapperMapToList() {
//Given
List<TrelloListDto> trelloListDto = new ArrayList<>();
trelloListDto.add(new TrelloListDto("1", "List no. 1", true));
trelloListDto.add(new TrelloListDto("2", "List no. 2", false));
trelloListDto.add(new TrelloListDto("3", "List no. 3", true));
//When
List<TrelloList> trelloList = mapper.mapToList(trelloListDto);
//Then
Assert.assertEquals(3, trelloList.size());
Assert.assertEquals("List no. 3", trelloList.get(2).getName());
}
@Test
public void testTrelloMapperMapToListDto() {
//Given
List<TrelloList> trelloList = new ArrayList<>();
trelloList.add(new TrelloList("1", "List no. 1", true));
trelloList.add(new TrelloList("2", "List no. 2", false));
trelloList.add(new TrelloList("3", "List no. 3", true));
//When
List<TrelloListDto> trelloListDto = mapper.mapToListDto(trelloList);
//Then
Assert.assertEquals(3, trelloListDto.size());
Assert.assertEquals("List no. 3", trelloListDto.get(2).getName());
}
@Test
public void testTrelloMapperMapToCardDto() {
//Given
TrelloCard trelloCard = new TrelloCard("No. 1", "Description", "top", "1");
//When
TrelloCardDto trelloCardDto = mapper.mapToCardDto(trelloCard);
//Then
Assert.assertEquals("No. 1", trelloCardDto.getName());
Assert.assertEquals("Description", trelloCardDto.getDescription());
Assert.assertEquals("top", trelloCardDto.getPos());
Assert.assertEquals("1", trelloCardDto.getListId());
}
@Test
public void testTrelloMapperMapToCard() {
//Given
TrelloCardDto trelloCardDto = new TrelloCardDto("No. 1", "Description", "top", "1");
//When
TrelloCard trelloCard = mapper.mapToCard(trelloCardDto);
//Then
Assert.assertEquals("No. 1", trelloCard.getName());
Assert.assertEquals("Description", trelloCard.getDescription());
Assert.assertEquals("top", trelloCard.getPos());
Assert.assertEquals("1", trelloCard.getListId());
}
}
| [
"“[email protected]"
] | |
7f671ac993bf91151ab92d3322bf17af23fb1b5f | c65d3142e26c25cb725e73914a6f2ab0641790ec | /app/src/main/java/com/diver/diver/SelectCityActivity.java | e39eb3f064fef9342b71981b9c2b3fe00735034b | [] | no_license | uduyt/fny2 | 92f724dc276c5ab22207ee81c284714c15b7f894 | bf59c8feb199c55e838c8686b39270064e7224b2 | refs/heads/master | 2021-01-13T03:14:29.503489 | 2016-08-19T12:23:21 | 2016-08-19T12:23:21 | 77,606,254 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,942 | java | package com.diver.diver;
import android.content.SharedPreferences;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ProgressBar;
import java.util.ArrayList;
import java.util.List;
import backend.SetCities;
public class SelectCityActivity extends AppCompatActivity {
private LocationListener mLocationListener;
private LocationManager mLocationManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_select_city);
Toolbar myToolbar = (Toolbar) findViewById(R.id.toolbar_main);
setSupportActionBar(myToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
final SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
RecyclerView rvCities = (RecyclerView) findViewById(R.id.rv_cities);
mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
Criteria criteria = new Criteria();
criteria.setAltitudeRequired(false);
criteria.setAccuracy(Criteria.ACCURACY_COARSE);
criteria.setPowerRequirement(Criteria.POWER_LOW);
criteria.setSpeedRequired(false);
criteria.setBearingRequired(false);
String provider = mLocationManager.getBestProvider(criteria, false);
try {
Location location=null;
if(provider!=null){
location= mLocationManager.getLastKnownLocation(provider);
}
SharedPreferences.Editor editor = sharedPref.edit();
if (location != null) {
editor.putFloat("lat", Float.valueOf(String.valueOf(location.getLatitude())));
editor.putFloat("long", Float.valueOf(String.valueOf(location.getLongitude())));
editor.commit();
}
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3000,
1000, new LocationListener() {
@Override
public void onLocationChanged(final Location location) {
SharedPreferences.Editor editor = sharedPref.edit();
if (location != null) {
editor.putFloat("lat", Float.valueOf(String.valueOf(location.getLatitude())));
editor.putFloat("long", Float.valueOf(String.valueOf(location.getLongitude())));
editor.apply();
}
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onProviderDisabled(String provider) {
}
});
} catch (SecurityException e) {
e.printStackTrace();
}
ProgressBar pbSelectCity = (ProgressBar) findViewById(R.id.pb_select_cities);
CityAdapter mAdapter= new CityAdapter(new ArrayList<Bundle>(),this);
SetCities setCities = new SetCities(this, rvCities, mAdapter, pbSelectCity);
setCities.execute();
}
@Override
public void onBackPressed() {
super.onBackPressed();
}
}
| [
"[email protected]"
] | |
7c9f58bb08908f0f892b0669c14c1ba24787f5f7 | 9f223e390d23c6cb4f580134b7d03277942b6da3 | /.svn/pristine/7c/7c9f58bb08908f0f892b0669c14c1ba24787f5f7.svn-base | c6daf58f31f87c3743e1a888875d19799a3adda7 | [] | no_license | linkingli/root | 99c51eddff31b5c58efa3ace99735adf96340d9a | 7b923467d48a239841b132e3ee3139f823c7109e | refs/heads/master | 2021-07-06T19:55:28.602712 | 2017-09-29T09:53:14 | 2017-09-29T09:53:14 | 105,256,623 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,095 | package cn.ssm.entity;
public class Divide {
private String id;
private String channelTopId;
private String channelDownId;
private String productId;
private String typeId;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getChannelTopId() {
return channelTopId;
}
public void setChannelTopId(String channelTopId) {
this.channelTopId = channelTopId;
}
public String getChannelDownId() {
return channelDownId;
}
public void setChannelDownId(String channelDownId) {
this.channelDownId = channelDownId;
}
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
this.productId = productId;
}
public String getTypeId() {
return typeId;
}
public void setTypeId(String typeId) {
this.typeId = typeId;
}
@Override
public String toString() {
return "Divide [id=" + id + ", channelTopId=" + channelTopId + ", channelDownId=" + channelDownId
+ ", productId=" + productId + ", typeId=" + typeId + "]";
}
}
| [
"[email protected]"
] | ||
4ab4bfce28fb1cef2ceadb6a1edfebc0f113f8ca | 4688d19282b2b3b46fc7911d5d67eac0e87bbe24 | /aws-java-sdk-iotjobsdataplane/src/main/java/com/amazonaws/services/iotjobsdataplane/model/transform/UpdateJobExecutionResultJsonUnmarshaller.java | ffec24e921aea50709f153c17a5a9c0d943dd8dd | [
"Apache-2.0"
] | permissive | emilva/aws-sdk-java | c123009b816963a8dc86469405b7e687602579ba | 8fdbdbacdb289fdc0ede057015722b8f7a0d89dc | refs/heads/master | 2021-05-13T17:39:35.101322 | 2018-12-12T13:11:42 | 2018-12-12T13:11:42 | 116,821,450 | 1 | 0 | Apache-2.0 | 2018-09-19T04:17:41 | 2018-01-09T13:45:39 | Java | UTF-8 | Java | false | false | 3,157 | java | /*
* Copyright 2012-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.iotjobsdataplane.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.iotjobsdataplane.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* UpdateJobExecutionResult JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class UpdateJobExecutionResultJsonUnmarshaller implements Unmarshaller<UpdateJobExecutionResult, JsonUnmarshallerContext> {
public UpdateJobExecutionResult unmarshall(JsonUnmarshallerContext context) throws Exception {
UpdateJobExecutionResult updateJobExecutionResult = new UpdateJobExecutionResult();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return updateJobExecutionResult;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("executionState", targetDepth)) {
context.nextToken();
updateJobExecutionResult.setExecutionState(JobExecutionStateJsonUnmarshaller.getInstance().unmarshall(context));
}
if (context.testExpression("jobDocument", targetDepth)) {
context.nextToken();
updateJobExecutionResult.setJobDocument(context.getUnmarshaller(String.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return updateJobExecutionResult;
}
private static UpdateJobExecutionResultJsonUnmarshaller instance;
public static UpdateJobExecutionResultJsonUnmarshaller getInstance() {
if (instance == null)
instance = new UpdateJobExecutionResultJsonUnmarshaller();
return instance;
}
}
| [
""
] | |
61aa5bbcb27ae765171e8c28b6648277bc0fceec | ad53c41b66df20aced216aaef57d13e2d6be286c | /DesignPatterns/GeneralDesignPatterns/src/facade/Game.java | 1ec13090d462dfe1dc23a0bf95c759d910144075 | [] | no_license | IvayloGoranov/Java | 8fc6dae9de942762604e656a6771e2ec468440a5 | cecd1dce3ed422ddf46a60b7a4fded7f11b3eee8 | refs/heads/master | 2021-01-18T22:30:40.227593 | 2016-06-06T20:43:14 | 2016-06-06T20:43:14 | 53,960,702 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 404 | java | package facade;
/*
* Facade class!!
*/
public class Game {
private InputSystem input = new InputSystem();
private GameObject objects = new GameObject();
private GameConsole screen = new GameConsole();
public void update() {
// Input
input.getInput();
// Update game objects (player, bad guys, etc)
objects.update(input);
// Draw
screen.draw(objects);
}
}
| [
"[email protected]"
] | |
53844474bef8f0eef10869df80fe0450198981c0 | ef224e124d5804b4a92c73ffe68449517515ee0f | /Clase 2-1/src/Animal.java | 8fa358b4cc481fca93c73e223b68bb4e66c9e716 | [] | no_license | JDanielRC/Java-POO | 5db3818f17abebb5fbeb441ed9421dce6d5e397f | 38862541a0ee6156a7c9a4cbc7c73f9c11e70b43 | refs/heads/master | 2020-03-27T05:18:08.812641 | 2018-11-28T23:58:09 | 2018-11-28T23:58:09 | 146,009,687 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 834 | java | //clase abstracta
// - un tipo de clase
// - PUEDE tener métodos abstractos (por definir)
// - NO PUEDE inicializarse, no existe new, no se puede hacer
// - para ser utilizada debe heredarse
// - objetos solo por medio de polimorfismo
public abstract class Animal {
private String nombre;
private int edad;
public String getNombre() {
return nombre;
}
public int getEdad() {
return edad;
}
public Animal(String nombre, int edad) {
super();
this.nombre = nombre;
this.edad = edad;
}
public void nacer() {
System.out.println("hola vida");
}
//abstract
//método abstracto
// - definicion de un metodo
// - solamente tiene la firma
// qué pero no cómo
// - una actividad que todos los miembros del grupo pueden hacen PERO
// cada subconjunto hace distintos
public abstract void comer();
}
| [
"[email protected]"
] | |
b41c6672bb47a833b05a9d460d3edb5f6a1d6cd9 | 9cff09e2ab73173e079b0b636c8ac950029b8fbe | /src/controllers/MainController.java | 7d3a1742f1036e7bfbeb18e77f114935ac73547d | [] | no_license | dmkits/test1 | 818d89d6f09b37b6fed42abff56c3b5366e4d4b0 | 2a33922487a27e81eda31ef865a8de60196e2f50 | refs/heads/master | 2021-01-11T20:00:34.477485 | 2017-07-03T09:00:12 | 2017-07-03T09:00:12 | 79,444,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 989 | java | package controllers;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
/**
* Created by ianagez on 16.01.17.
*/
public class MainController extends PageController {
public MainController() { sPAGE_URL="/pages/main.html"; }
@Override
protected boolean doGetAction(String sAction, HttpServletRequest req, HttpSession session, HashMap outData) {
if("get_data".equals(sAction)){
} else return false;
return true;
}
@Override
protected boolean doPostAction(String sAction, HttpServletRequest req, HttpSession session, HashMap data) throws Exception {
if ("exit".equals(sAction)) {
session.invalidate();
data.put("actionResult","successfull");
return true;
} else if ("load_file".equals(sAction)) {
return true;
} else return super.doPostAction(sAction, req, session, data);
// return true;
}
}
| [
"[email protected]"
] | |
23fcd9325b4b57651b562d2ef9f294bc9288dc13 | bb2c828eb21e12d470752ebe174c35f1a34e1c66 | /chuyue-system/src/main/java/com/chuyue/system/domain/SysRole.java | 9f446757d806e3b9dc6a85e64f8e0fb6b6fa8b6a | [
"MIT"
] | permissive | yujiantong/ChuYue | b3a8821181b4c879ed45627fd574b2d6d86bcae4 | b53d831da5ac8451333044bebd6b3853f9cc3f09 | refs/heads/master | 2022-09-24T20:28:56.952389 | 2020-12-28T05:11:26 | 2020-12-28T05:11:26 | 214,371,898 | 1 | 0 | MIT | 2022-09-01T23:13:56 | 2019-10-11T07:28:27 | HTML | UTF-8 | Java | false | false | 4,238 | java | package com.chuyue.system.domain;
import javax.validation.constraints.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.chuyue.common.annotation.Excel;
import com.chuyue.common.annotation.Excel.ColumnType;
import com.chuyue.common.core.domain.BaseEntity;
/**
* 角色表 sys_role
*
* @author chuyue
*/
public class SysRole extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 角色ID */
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
private Long roleId;
/** 角色名称 */
@Excel(name = "角色名称")
private String roleName;
/** 角色权限 */
@Excel(name = "角色权限")
private String roleKey;
/** 角色排序 */
@Excel(name = "角色排序", cellType = ColumnType.NUMERIC)
private String roleSort;
/** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限) */
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限")
private String dataScope;
/** 角色状态(0正常 1停用) */
@Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志(0代表存在 2代表删除) */
private String delFlag;
/** 用户是否存在此角色标识 默认不存在 */
private boolean flag = false;
/** 菜单组 */
private Long[] menuIds;
/** 部门组(数据权限) */
private Long[] deptIds;
public Long getRoleId()
{
return roleId;
}
public void setRoleId(Long roleId)
{
this.roleId = roleId;
}
public String getDataScope()
{
return dataScope;
}
public void setDataScope(String dataScope)
{
this.dataScope = dataScope;
}
@NotBlank(message = "角色名称不能为空")
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
public String getRoleName()
{
return roleName;
}
public void setRoleName(String roleName)
{
this.roleName = roleName;
}
@NotBlank(message = "权限字符不能为空")
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
public String getRoleKey()
{
return roleKey;
}
public void setRoleKey(String roleKey)
{
this.roleKey = roleKey;
}
@NotBlank(message = "显示顺序不能为空")
public String getRoleSort()
{
return roleSort;
}
public void setRoleSort(String roleSort)
{
this.roleSort = roleSort;
}
public String getStatus()
{
return status;
}
public String getDelFlag()
{
return delFlag;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public void setStatus(String status)
{
this.status = status;
}
public boolean isFlag()
{
return flag;
}
public void setFlag(boolean flag)
{
this.flag = flag;
}
public Long[] getMenuIds()
{
return menuIds;
}
public void setMenuIds(Long[] menuIds)
{
this.menuIds = menuIds;
}
public Long[] getDeptIds()
{
return deptIds;
}
public void setDeptIds(Long[] deptIds)
{
this.deptIds = deptIds;
}
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("roleId", getRoleId())
.append("roleName", getRoleName())
.append("roleKey", getRoleKey())
.append("roleSort", getRoleSort())
.append("dataScope", getDataScope())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
| [
"[email protected]"
] | |
9c356da0104f237fa320db8701842eeb830348e2 | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project214/src/test/java/org/gradle/test/performance/largejavamultiproject/project214/p1070/Test21417.java | 243de14a20e6bd380c490b167d80bbc6947a437d | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,113 | java | package org.gradle.test.performance.largejavamultiproject.project214.p1070;
import org.junit.Test;
import static org.junit.Assert.*;
public class Test21417 {
Production21417 objectUnderTest = new Production21417();
@Test
public void testProperty0() {
String value = "value";
objectUnderTest.setProperty0(value);
assertEquals(value, objectUnderTest.getProperty0());
}
@Test
public void testProperty1() {
String value = "value";
objectUnderTest.setProperty1(value);
assertEquals(value, objectUnderTest.getProperty1());
}
@Test
public void testProperty2() {
String value = "value";
objectUnderTest.setProperty2(value);
assertEquals(value, objectUnderTest.getProperty2());
}
@Test
public void testProperty3() {
String value = "value";
objectUnderTest.setProperty3(value);
assertEquals(value, objectUnderTest.getProperty3());
}
@Test
public void testProperty4() {
String value = "value";
objectUnderTest.setProperty4(value);
assertEquals(value, objectUnderTest.getProperty4());
}
@Test
public void testProperty5() {
String value = "value";
objectUnderTest.setProperty5(value);
assertEquals(value, objectUnderTest.getProperty5());
}
@Test
public void testProperty6() {
String value = "value";
objectUnderTest.setProperty6(value);
assertEquals(value, objectUnderTest.getProperty6());
}
@Test
public void testProperty7() {
String value = "value";
objectUnderTest.setProperty7(value);
assertEquals(value, objectUnderTest.getProperty7());
}
@Test
public void testProperty8() {
String value = "value";
objectUnderTest.setProperty8(value);
assertEquals(value, objectUnderTest.getProperty8());
}
@Test
public void testProperty9() {
String value = "value";
objectUnderTest.setProperty9(value);
assertEquals(value, objectUnderTest.getProperty9());
}
} | [
"[email protected]"
] | |
ed31f4b30cd4f448579eba2f7e9bc032191b072a | 6ffe72c021ac529a7b311ddc1721751007c45d68 | /Implementacao/SysPsi/src/main/java/br/com/syspsi/repository/GrupoPacienteRepositorio.java | b882ba25ba2a945418e9c9a9e8af282fb4a750d1 | [] | no_license | olecramsl/TCC | b7937803be72164b7ff5d10ccb23225eec7a7b1f | b8c17924e35a43a9f262bca7b6e3813a21437bf2 | refs/heads/master | 2021-03-27T09:23:36.255128 | 2017-09-16T14:47:11 | 2017-09-16T14:47:11 | 77,171,714 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 239 | java | package br.com.syspsi.repository;
import org.springframework.data.repository.CrudRepository;
import br.com.syspsi.model.entity.GrupoPaciente;
public interface GrupoPacienteRepositorio extends CrudRepository<GrupoPaciente, Integer> {
}
| [
"[email protected]"
] | |
bb24518abd3249aadeb8ea2b6589f6da3fee7303 | 8cabee5503cc65fc45546c2bd709e8884682ab72 | /model/Gomoku.java | 4bb7b7d8128b1ecb45640524a06720eec2e38132 | [] | no_license | vkuleshov23/Gomoku | ef75f835aa1b93711728216dbe19850234635b95 | c6663027e4ba7640b3b07f0db2ff26cbb51813e0 | refs/heads/master | 2023-07-17T13:19:15.130931 | 2021-08-25T12:05:09 | 2021-08-25T12:05:09 | 384,961,407 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,825 | java | package model;
import history.*;
import java.io.Serializable;
import java.util.LinkedList;
import java.io.IOException;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.Iterator;
public class Gomoku implements Serializable{
private static final int size = 15;
private static final int countForWin = 5;
private boolean drawFlag;
private char[][] board;
private boolean player;
private History history;
private boolean aiFlag;
private GomokuAI ai;
private class GomokuAI implements Serializable{
private HashSet<ListElement> posMove;
public GomokuAI(){
this.posMove = new HashSet<ListElement>();
this.loadHistory();
}
public void loadHistory(){
for(Element el : getHistory().getList()){
this.addPossibleMoves(new Coordinates(el.getX(), el.getY()));
}
this.checkPossibleMoves();
}
public Coordinates findMove(){
Coordinates lastMove;
if(getHistory().getSize() > 0){
lastMove = new Coordinates(getHistory().getLastX(), getHistory().getLastY());
} else {
lastMove = new Coordinates(8, 8);
}
this.checkPossibleMoves();
this.addPossibleMoves(lastMove);
Iterator<ListElement> iter = this.posMove.iterator();
int maxSum = 0;
while(iter.hasNext()){
ListElement element = iter.next();
int posSum = this.calculateMaxSum(element.getX(), element.getY());
element.setSum(posSum);
// System.out.println(element + ", sum: " + element.getSum());
if(posSum > maxSum)
maxSum = posSum;
}
ArrayList<ListElement> maxCostMoves = new ArrayList<ListElement>();
iter = this.posMove.iterator();
while(iter.hasNext()){
ListElement element = iter.next();
if(element.getSum() == maxSum){
maxCostMoves.add(element);
}
}
ListElement element = maxCostMoves.get((int)(Math.random() * maxCostMoves.size()));
addPossibleMoves(element.getCoordinates());
return element.getCoordinates();
}
private void addPossibleMoves(Coordinates lastMove){
for(int x = lastMove.getX()-1; x <= lastMove.getX()+1; x++){
if(x >= 0 && x < getSize()){
for(int y = lastMove.getY()-1; y <= lastMove.getY()+1; y++){
if(y >= 0 && y < getSize()){
if(getElement(x, y) == ' '){
this.posMove.add(new ListElement(x, y));
}
}
}
}
}
}
private void checkPossibleMoves(){
Iterator<ListElement> iter = this.posMove.iterator();
while(iter.hasNext()){
ListElement element = iter.next();
if(getElement(element.getX(), element.getY()) != ' '){
iter.remove();
}
}
}
private int calculateMaxSum(int x, int y){
int sum = 0;
for(int i = 0; i < 4; i++){
String line = "";
for(int j = -4; j <= 4; j++){
switch(i){
case(0):
if(x + j >= 0 && x + j < getSize())
line += (j == 0) ? '*' : getElement(x + j, y);
break;
case(1):
if(y + j >= 0 && y + j < getSize())
line += (j == 0) ? '*' : getElement(x, y + j);
break;
case(2):
if(x + j >= 0 && x + j < getSize())
if(y + j >= 0 && y + j < getSize())
line += (j == 0) ? '*' : getElement(x + j, y + j);
break;
case(3):
if(x - j >= 0 && x - j < getSize())
if(y + j >= 0 && y + j < getSize())
line += (j == 0) ? '*' : getElement(x - j, y + j);
break;
}
}
if(line.length() < 5)
continue;
// System.out.println("LINE: " + line);
for(int strategy = 0; strategy < 2; strategy++){ // 0 - attack; 1 - defence
char stratChar = ' ';
if(strategy == 0)
stratChar = getCurPlayerChar();
else
stratChar = getEmenyPlayerChar();
int curSum = 0;
for(int k = 0; k < PatternList.size; k++){
try{
// System.out.println(line + " : " + PatternList.getPattern(k, stratChar).getPattern());
curSum += compareWithPattern(line, PatternList.getPattern(k, stratChar), stratChar);
} catch (IOException e) {
System.out.println(e.getMessage());
return 0;
}
}
// System.out.println("--------------");
if(strategy == 0)
curSum += curSum * 1.1;
sum += curSum;
curSum = 0;
}
}
return sum;
}
private int compareWithPattern(String s, Pattern pattern, char stratChar){
// System.out.println("pattern length: " + pattern.getPattern().length() + " | line length: " + s.length());
if(pattern.getPattern().length() > s.length())
return 0;
int sum = 0;
int offset = getAstrixIndex(s);
s = changeAstrixToStrat(s, stratChar);
int patternStartPos = offset - pattern.getPattern().length()-1;
// System.out.println("Line: " + s);
for(;patternStartPos <= offset; patternStartPos++) {
if(patternStartPos < 0){
continue;
} else if(patternStartPos + pattern.getPattern().length() > s.length()){
break;
} else {
if(pattern.getPattern().regionMatches(0, s, patternStartPos, pattern.getPattern().length())){
sum += pattern.getSum();
} else {
continue;
}
}
}
return sum;
}
private int getAstrixIndex(String line){
int i = 0;
for(char c : line.toCharArray()){
if(c == '*'){
return i;
}
i++;
}
return i;
}
private String changeAstrixToStrat(String line, char stratChar){
String newLine = "";
for(char c : line.toCharArray()){
if(c == '*'){
c = stratChar;
}
newLine += c;
}
return newLine;
}
}
public Gomoku(boolean aiFlag){
history = new History();
this.board = new char[size][size];
for(int i = 0; i < size; i++){
for(int j = 0; j < size; j++){
this.board[i][j] = ' ';
}
}
this.aiFlag = aiFlag;
// if(this.aiFlag){
ai = new GomokuAI();
// }
this.player = true;
this.drawFlag = false;
}
// public Gomoku(char[][] board, boolean player, History history){
// this.history = history;
// this.player = player;
// for(int i = 0; i < size; i++){
// for (int j = 0; j < size; j++) {
// this.board[i][j] = board[i][j];
// }
// }
// this.drawFlag = false;
// }
public boolean getAIflag(){
return this.aiFlag;
}
public int aiMove(){
// if(aiFlag){
Coordinates crd = ai.findMove();
// System.out.print("AI ");
return this.move(crd);
// }
// return 0;
}
public int move(Coordinates xy){
return this.move(xy.getX(), xy.getY());
}
public int move(int x, int y){
if(!this.checkMove(x, y)){
return -1;
}
history.addMove(x, y, this.changeBoard(x, y, player));
if(this.checkWin())
return 1;
if(history.getSize() == size*size){
this.itIsDraw();
return 1;
}
this.changePlayer();
return 0;
}
private char changeBoard(int x, int y, boolean player){
if(player == true){
this.board[x][y] = 'X';
return 'X';
}
else{
this.board[x][y] = 'O';
return 'O';
}
}
private boolean checkMove(int x, int y){
if(x < 0 || x > size && y < 0 || y > size)
return false;
if(this.board[x][y] != ' ')
return false;
return true;
}
public void undo(){
this.undoMove();
if(aiFlag){
this.undoMove();
}
}
private void undoMove(){
if(history.getSize() != 0){
Element el = history.getLast();
this.board[el.getX()][el.getY()] = ' ';
char c = el.getPlayer();
if(c == 'X'){
this.player = true;
} else {
this.player = false;
}
history.deleteMove();
}
}
private boolean checkWin(){
char c = getCurPlayerChar();
int counter = 0;
for(int i = 0; i < size; i++){
for(int j = 0; j < size; j++){
if(c == this.board[i][j])
counter++;
else
counter = 0;
if(counter == this.countForWin)
return true;
}
counter = 0;
}
for(int i = 0; i < size; i++) {
for(int j = 0; j < size; j++) {
if(c == this.board[j][i])
counter++;
else
counter = 0;
if(counter == this.countForWin)
return true;
}
counter = 0;
}
for(int length = this.countForWin-1; length < size; length++){
for(int j = 0, i = length; j <= length; j++, i--){
if(c == this.board[i][j])
counter++;
else
counter = 0;
if(counter == this.countForWin)
return true;
}
counter = 0;
}
for (int length = size, start = 0; length > this.countForWin-1; length--, start++){
for(int j = 0, i = start; j < length; j++, i++){
if(c == this.board[i][j])
counter++;
else
counter = 0;
if(counter == this.countForWin)
return true;
}
counter = 0;
}
for (int length = size - 1, start = 1; length > this.countForWin-1; length--, start++) {
for(int j = start, i = size - 1, k = 0; k < length; j++, k++){
if(c == this.board[i-k][j])
counter++;
else
counter = 0;
if(counter == this.countForWin)
return true;
}
counter = 0;
}
for (int length = size - 1, start = 1; length > this.countForWin-1; length--, start++) {
for(int j = start, i = 0, k = 0; k < length; j++, k++){
if(c == this.board[i+k][j])
counter++;
else
counter = 0;
if(counter == this.countForWin)
return true;
}
counter = 0;
}
return false;
}
public History getHistory(){
return history;
}
public boolean checkDraw(){
return this.drawFlag;
}
public void itIsDraw(){
this.drawFlag = true;
}
public String getWinner(){
if(this.checkDraw()) return " Draw";
else if(this.player == true) return "Player X is winner";
else return "PLayer O is winner";
}
public int getSize(){ return this.size; }
public char getElement(int x, int y){
return this.board[x][y];
}
public boolean getPlayer(){
return this.player;
}
public char getCurPlayerChar(){
if(this.player == true)
return 'X';
else
return 'O';
}
public char getEmenyPlayerChar(){
if(this.player == true)
return 'O';
else
return 'X';
}
private void changePlayer(){
this.player = !this.player;
}
} | [
"[email protected]"
] | |
b397c5837cf64f18b6765607cba14e2387306a52 | 26aae7a4c71f966202ccef2831246d1d0de15014 | /jucacontrol-master/src/br/senai/sp/info/pweb/jucacontrol/dao/DAO.java | c39558ee920b675a78ea6b2aa3940b0050239d01 | [] | no_license | NakuraSagitary/ServicingDesk | 86b9fc537686a219eeb64f6a656733b2db48ea08 | a754f80e7fabdd81e23333687dfa5eee0590f2db | refs/heads/master | 2020-04-02T06:36:09.468119 | 2018-10-24T14:17:20 | 2018-10-24T14:17:20 | 154,158,382 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 624 | java | package br.senai.sp.info.pweb.jucacontrol.dao;
import java.util.List;
import java.util.Map;
import org.springframework.transaction.annotation.Transactional;
public interface DAO<T> {
@Transactional
public T buscar(Long id);
@Transactional
List<T> buscarPorCampo(String campo, Object valor);
@Transactional
public List<T> buscarPorCampos(Map<String, Object> campos);
@Transactional
public List<T> buscarTodos();
@Transactional
public void alterar(T obj);
@Transactional
public void deletar(Long id);
@Transactional
public void deletar(T obj);
@Transactional
public void inserir(T obj);
}
| [
"[email protected]"
] | |
249099cfe086c0d733df95c64bbd23aaa7df7894 | 75c09fc02ff4eb1cd8af6ecdc88c0947bd12bbae | /lshop_web/src/main/java/com/lshop/common/spring/ContainerRefreshEventListener.java | b976a327773e58c313341b7e01f44a6e43eda3ee | [] | no_license | apollo2099/lshop | f8372a3d80ef92958acf403f13d4ee3425b66452 | 4130d32ce54814b46473380c25c967ded20d2157 | refs/heads/master | 2020-03-13T15:10:43.574187 | 2018-05-05T03:45:28 | 2018-05-05T03:45:28 | 131,172,292 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 957 | java | package com.lshop.common.spring;
import javax.annotation.Resource;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import com.lshop.common.cache.component.CacheComponent;
/**
* 顶层容器启动事件处理
* @author caicl
*
*/
@Component
public class ContainerRefreshEventListener implements ApplicationListener<ContextRefreshedEvent>{
@Resource CacheComponent cacheComponent;
/* 异步触发顶层容器事件
* (non-Javadoc)
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
*/
@Override
@Async
public void onApplicationEvent(ContextRefreshedEvent event) {
if (event.getApplicationContext().getParent() == null) {
//顶层容器才触发
cacheComponent.initStartup();
}
}
}
| [
"[email protected]"
] | |
7c726ad7675cb7e7dce765269648ea8fcab32a5b | 9d2c0495522ed3f287a9cae2568f6b4f54aaeca5 | /job-core/src/main/java/com/buer/job/utils/FileUtil.java | bbb45bf6388d434e30bf38d67e049080861a02e3 | [] | no_license | wujieliyanxia/Job | f90d021dafcf19bbd8f1efa6a53f8ea6067356a6 | d2d89b3d0d02e35a8be7fff6123cd16ed1dc9959 | refs/heads/main | 2023-06-26T16:34:58.280191 | 2021-07-13T14:27:33 | 2021-07-13T14:27:33 | 330,160,561 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 5,504 | java | package com.buer.job.utils;
import com.buer.job.exception.JobException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
/**
* Created by jiewu on 2021/1/22
*/
@Slf4j
public class FileUtil {
private static final double MAX_IMAGE_FILE_SIZE = 1000.0 * 1000 * 2;
private static final double MAX_IMAGE_FILE_WIDTH = 4000;
private static BufferedImage rotateImage(final BufferedImage bufferedimage,
final int degree) {
int iw = bufferedimage.getWidth();
int ih = bufferedimage.getHeight();
int w = iw;
int h = ih;
if (degree == 90 || degree == 270) {
w = ih;
h = iw;
}
int x = (w / 2) - (iw / 2);//确定原点坐标
int y = (h / 2) - (ih / 2);
int type = bufferedimage.getColorModel().getTransparency();
BufferedImage img = new BufferedImage(w, h, type);
Graphics2D graphics2d = img.createGraphics();
graphics2d.setRenderingHint(
RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
graphics2d.rotate(Math.toRadians(degree), w / 2.0, h / 2.0);//旋转图象
graphics2d.translate(x, y);
graphics2d.drawImage(bufferedimage, 0, 0, null);
graphics2d.dispose();
return img;
}
public static byte[] toByteArray(File file) throws IOException {
return IOUtils.toByteArray(new FileInputStream(file));
}
public static byte[] resizeImage(File image) throws IOException {
long start = Clock.now();
try {
byte[] imageByte = IOUtils.toByteArray(new FileInputStream(image));
return resizeImage(imageByte);
} finally {
log.info("resize image cost {}", Clock.now() - start);
}
}
public static byte[] resizeImage(byte[] data) throws IOException {
double scale = getImageScale(data);
if (scale < 1) {
try (ByteArrayInputStream in = new ByteArrayInputStream(data);
ByteArrayOutputStream out = new ByteArrayOutputStream()) {
BufferedImage bufferedImage = scaleImage(in, scale);
ImageIO.write(bufferedImage, "jpeg", out);
data = out.toByteArray();
try {
bufferedImage.flush();
} catch (Exception e) {
log.warn("图片清理失败", e);
}
}
return data;
} else {
return data;
}
}
// 计算图片的压缩比例
private static double getImageScale(byte[] data) {
double scale = 1;
try (ByteArrayInputStream inputStream = new ByteArrayInputStream(data)) {
BufferedImage bufferedImage = ImageIO.read(inputStream);
if (bufferedImage == null)
throw JobException.error("图片格式不正确");
int width = bufferedImage.getWidth();
int height = bufferedImage.getHeight();
if (width <= MAX_IMAGE_FILE_WIDTH &&
height <= MAX_IMAGE_FILE_WIDTH &&
data.length <= MAX_IMAGE_FILE_SIZE) {
return scale;
}
double widthScale = width > height ? MAX_IMAGE_FILE_WIDTH / width : MAX_IMAGE_FILE_WIDTH / height;
double sizeScale = MAX_IMAGE_FILE_SIZE / data.length;
double result = widthScale < sizeScale ? widthScale : sizeScale;
try {
bufferedImage.flush();
} catch (Exception e) {
log.warn("计算图片的压缩比例失败", e);
}
return result;
} catch (IOException e) {
log.warn("计算图片的压缩比例失败", e);
}
return scale;
}
private static BufferedImage scaleImage(ByteArrayInputStream in, double scale) {
BufferedImage bufferedImage = null;
Image image = null;
try {
bufferedImage = ImageIO.read(in);
if (bufferedImage == null)
throw JobException.error("图片格式不正确");
int width = bufferedImage.getWidth();
int height = bufferedImage.getHeight();
width = (int) (width * scale);
height = (int) (height * scale);
image = bufferedImage.getScaledInstance(width, height, Image.SCALE_SMOOTH);
BufferedImage outputImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics graphics = outputImage.getGraphics();
graphics.drawImage(image, 0, 0, null);
graphics.dispose();
return outputImage;
} catch (IOException e) {
log.warn("照片缩放失败", e);
throw JobException.error("照片缩放失败");
} finally {
try {
if (image != null)
image.flush();
if (bufferedImage != null)
bufferedImage.flush();
} catch (Exception e) {
log.warn("图片清理失败", e);
}
}
}
public byte[] rotateImage(byte[] byteImage, int degree) {
if (degree != 0) {
try (ByteArrayInputStream in = new ByteArrayInputStream(byteImage);
ByteArrayOutputStream out = new ByteArrayOutputStream()) {
BufferedImage image = ImageIO.read(in);
if (image == null)
throw JobException.error("非法图片类型");
BufferedImage bufferedImage = rotateImage(image, degree);
ImageIO.write(bufferedImage, "jpeg", out);
byte[] result = out.toByteArray();
try {
image.flush();
bufferedImage.flush();
} catch (Exception e) {
log.warn("图片清理失败", e);
}
return result;
} catch (Exception ex) {
throw JobException.wrap(ex);
}
}
return byteImage;
}
}
| [
"[email protected]"
] | |
be62b26b6069de2b9cf5bead05f611b2e13f8758 | 490e9d0f3167b3f1143ef1e9b0f86c7542bb988e | /app/src/main/java/com/knyaz/testtask/base/ui/interfaces/BackPressable.java | 83a918c1fd7812a0ba7e8e45e4c23bae9b0691f5 | [
"Apache-2.0"
] | permissive | collosdeveloper/tt | 869a471a7a66597a9bf8febc650427a3fc67e98f | e09f190b8534ddf91845ac14647edb2f261b1220 | refs/heads/master | 2020-04-14T18:33:19.611270 | 2019-01-03T22:32:07 | 2019-01-03T22:32:07 | 164,023,547 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 111 | java | package com.knyaz.testtask.base.ui.interfaces;
public interface BackPressable {
boolean onBackPressed();
} | [
"[email protected]"
] | |
389604c71338116ba82b02041c5d6fa99540f932 | 86a84960892f0a3e97f18865fce8b2ec3be0973a | /src/main/java/example/store/security/AuthoritiesConstants.java | 7c41b221532d4462f65046685a7dc49610b72bf1 | [] | no_license | reinier-pv/JHStoreDemo | 0daddf51e643782f25cb0f1610be698c049b1fff | aa89d40c04c40d95f035f8bb960a2deb90d41f1c | refs/heads/master | 2021-06-30T05:26:38.587283 | 2018-05-04T12:53:48 | 2018-05-04T12:53:48 | 132,139,799 | 0 | 1 | null | 2020-09-18T11:12:36 | 2018-05-04T12:52:35 | Java | UTF-8 | Java | false | false | 343 | java | package example.store.security;
/**
* Constants for Spring Security authorities.
*/
public final class AuthoritiesConstants {
public static final String ADMIN = "ROLE_ADMIN";
public static final String USER = "ROLE_USER";
public static final String ANONYMOUS = "ROLE_ANONYMOUS";
private AuthoritiesConstants() {
}
}
| [
"[email protected]"
] | |
53a47bddd65824dd1af15311681b5afd3f4d0921 | 9e66452894d24949b87c7fe7fb31763065b16c31 | /UserInput.java | cd8c63f6921ca94ee2d27a9afb890e087c85db41 | [] | no_license | KevinSimbana/SpartaProject | 87cbf54b9c63a3b3f296e06b8d334b80163b3e6b | 25338106e0882aee735c0df7ffbe201310e829f4 | refs/heads/main | 2023-08-13T08:44:30.603438 | 2021-10-04T20:24:57 | 2021-10-04T20:24:57 | 411,214,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,178 | java | package com.sparta.sorting.controller;
import org.apache.log4j.Logger;
import java.util.ArrayList;
import java.util.Scanner;
public final class UserInput {
//PROPERTIES
private static Logger logger = Logger.getLogger("Sorting Application");
private static UserInput instance;
private int arraySize;
private int sortChoice;
private ArrayList<Integer> choice = new ArrayList<>();
Scanner scanner = new Scanner(System.in);
private UserInput(){
}
//GETTERS & SETTERS;
public static UserInput getInstance(){
if (instance == null) {
instance = new UserInput();
}
return instance;
}
public int getArraySize() {
return arraySize;
}
public void setArraySize() {
// int size = scanner.nextInt();
// if (size < 0) {
// System.out.println("input size invalid, number must be greater than 0");
// System.exit(0);
// }
int size = scanner.nextInt();
this.arraySize = size;
logger.info("user has array of size:" + size);
}
public ArrayList<Integer> getSortChoice() {
return choice;
}
public void setSortChoice() {
// while (scanner.nextInt() != 0) {
// this.choice.add(scanner.nextInt());
// }
boolean valid = false;
int input = -1;
while(!valid) {
input = scanner.nextInt();
choice.add(input);
if (input == 0) {
valid = true;
}
}
}
public void runUserInput(){
System.out.println("Sorting Application");
System.out.println();
System.out.println("1: bubbleSort");
System.out.println("2: mergeSort");
System.out.println("3: quickSort");
System.out.println("4: selectionSort");
System.out.println("5: insertionSort");
System.out.println("6: binaryTree");
System.out.println();
System.out.println("How big do you want the array");
setArraySize();
System.out.println("Choose a sort method or more: (enter 0 to sort your array.)");
setSortChoice();
}
}
| [
"[email protected]"
] | |
b6dda808bae97b7b9d49a894f5c2eaa710075933 | 55ebdc98f90bba37dd34f5020e9b2f55ab4f747b | /src/main/java/com/sybase365/mobiliser/web/btpn/bank/common/panels/ElimitCreateConfirmPanel.java | de146eb97df5db195985f9be1cab7c5581b21bb5 | [] | no_license | chandusekhar/btpn_portal | aa482eef5a760a4a3a79dd044258014c145183f1 | 809b857bfe01cbcf2b966e85ebb8fc3bde02680e | refs/heads/master | 2020-09-27T08:29:09.299858 | 2014-12-07T10:44:58 | 2014-12-07T10:45:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,398 | java | package com.sybase365.mobiliser.web.btpn.bank.common.panels;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.btpnwow.core.limitex.services.contract.v1_0.CreateLimitExRequest;
import com.btpnwow.core.limitex.services.contract.v1_0.CreateLimitExResponse;
import com.btpnwow.core.limitex.services.contract.v1_0.IsLimitAlreadyDefinedRequest;
import com.btpnwow.core.limitex.services.contract.v1_0.IsLimitAlreadyDefinedResponse;
import com.btpnwow.core.limitex.services.contract.v1_0.LimitExType;
import com.btpnwow.portal.common.util.MobiliserUtils;
import com.sybase365.mobiliser.web.btpn.application.pages.BtpnMobiliserBasePage;
import com.sybase365.mobiliser.web.btpn.bank.beans.ElimitBean;
import com.sybase365.mobiliser.web.btpn.bank.pages.portal.limit.ElimitCreatePage;
import com.sybase365.mobiliser.web.btpn.bank.pages.portal.limit.ElimitCreateSuccessPage;
import com.sybase365.mobiliser.web.btpn.bank.pages.portal.limit.ElimitPage;
import com.sybase365.mobiliser.web.btpn.bank.pages.portal.selfcare.BtpnBaseBankPortalSelfCarePage;
import com.sybase365.mobiliser.web.btpn.util.ConverterUtils;
/**
* This is the CashoutDetailsPanel page for bank portals.
*
* @author Febrie Subhan
*/
public class ElimitCreateConfirmPanel extends Panel {
private static final long serialVersionUID = 1L;
private static final Logger LOG = LoggerFactory
.getLogger(ElimitCreateConfirmPanel.class);
protected BtpnBaseBankPortalSelfCarePage basePage;
protected ElimitBean limitBean;
protected BtpnMobiliserBasePage mobBasePage;
public ElimitCreateConfirmPanel(String id,
BtpnBaseBankPortalSelfCarePage basePage, ElimitBean limitBean) {
super(id);
this.mobBasePage = basePage;
this.basePage = basePage;
this.limitBean = limitBean;
constructPanel();
}
protected void constructPanel() {
final Form<ElimitCreateConfirmPanel> form = new Form<ElimitCreateConfirmPanel>(
"limitCreateConfirmForm",
new CompoundPropertyModel<ElimitCreateConfirmPanel>(this));
// Add feedback panel for Error Messages
final FeedbackPanel feedBack = new FeedbackPanel("errorMessages");
form.add(feedBack);
form.add(new Label("limitBean.description").setEnabled(false));
form.add(new Label("limitBean.selectedPiType", limitBean.getSelectedPiType()==null ? "-|-" : limitBean.getSelectedPiType().getIdAndValue()).setEnabled(false));
form.add(new Label("limitBean.pi").setEnabled(false));
form.add(new Label("limitBean.selectedCustomerType", limitBean.getSelectedCustomerType()==null ?"-|-" : limitBean.getSelectedCustomerType().getIdAndValue()).setEnabled(false));
form.add(new Label("limitBean.customer").setEnabled(false));
form.add(new Label("limitBean.selectedUseCases", limitBean.getSelectedUseCases()==null ?"-|-" : limitBean.getSelectedUseCases().getIdAndValue()).setEnabled(false));
form.add(new Label("limitBean.singleDebitMinAmount"));
form.add(new Label("limitBean.singleDebitMaxAmount"));
form.add(new Label("limitBean.singleCreditMinAmount"));
form.add(new Label("limitBean.singleCreditMaxAmount"));
form.add(new Label("limitBean.dailyDebitMaxAmount"));
form.add(new Label("limitBean.weeklyDebitMaxAmount"));
form.add(new Label("limitBean.monthlyDebitMaxAmount"));
form.add(new Label("limitBean.dailyCreditMaxAmount"));
form.add(new Label("limitBean.weeklyCreditMaxAmount"));
form.add(new Label("limitBean.monthlyCreditMaxAmount"));
form.add(new Label("limitBean.dailyDebitMaxCount"));
form.add(new Label("limitBean.weeklyDebitMaxCount"));
form.add(new Label("limitBean.monthlyDebitMaxCount"));
form.add(new Label("limitBean.dailyCreditMaxCount"));
form.add(new Label("limitBean.weeklyCreditMaxCount"));
form.add(new Label("limitBean.monthlyCreditMaxCount"));
form.add(new Label("limitBean.maximumBalance").setEnabled(false));
form.add(new Label("limitBean.minimumBalance").setEnabled(false));
form.add(new Label("limitBean.status", "INITIAL").setEnabled(false));
Button submitButton = new Button("submitButton") {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit() {
handleCreateLimitBean();
};
};
form.add(submitButton);
Button backButton = new Button("backButton") {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit() {
setResponsePage(new ElimitCreatePage(limitBean));
};
};
form.add(backButton);
Button cancelButton = new Button("cancelButton") {
private static final long serialVersionUID = 1L;
@Override
public void onSubmit() {
setResponsePage(new ElimitPage());
};
};
form.add(cancelButton);
add(form);
}
/**
* This method handles the Creation of Fee Bean.
*/
private void handleCreateLimitBean() {
LimitExType limit = ConverterUtils.convertToLimitExType(limitBean);
try {
limit.setCreator(basePage.getMobiliserWebSession().getBtpnLoggedInCustomer().getCustomerId());
IsLimitAlreadyDefinedRequest req = this.mobBasePage.getNewMobiliserRequest(IsLimitAlreadyDefinedRequest.class);
req.setPi(limit.getPiId());
req.setPiType(limit.getPiType());
req.setCustomerType(limit.getCustomerType());
req.setCustomer(limit.getCustomerId());
req.setUseCaseId(limit.getUseCase());
IsLimitAlreadyDefinedResponse resp = this.mobBasePage.limitExClient.isLimitExAlreadyDefined(req);
if(resp.getStatus().getValue().equals("FALSE")){
CreateLimitExRequest request = this.mobBasePage.getNewMobiliserRequest(CreateLimitExRequest.class);
request.setData(limit);
CreateLimitExResponse response = this.mobBasePage.limitExClient.create(request);
if (this.mobBasePage.evaluateBankPortalMobiliserResponse(response)) {
this.mobBasePage.getWebSession().info(getLocalizer().getString("create.success.waiting.approval", this));
setResponsePage(new ElimitCreateSuccessPage(limitBean));
} else {
error(MobiliserUtils.errorMessage(response.getStatus().getCode(), response.getStatus().getValue(), getLocalizer(), this));
}
}else{
this.mobBasePage.getWebSession().error(getLocalizer().getString("Limit is already defined", this));
}
} catch (Exception e) {
e.printStackTrace();
this.mobBasePage.getWebSession().error(getLocalizer().getString("error.exception", this));
LOG.error("Exception occured while creating the fees ===> ", e);
}
}
/**
* This method handles the specific error message.
*/
private void handleSpecificErrorMessage(final int errorCode) {
// Specific error message handling
final String messageKey = "error." + errorCode;
String message = getLocalizer().getString(messageKey, this);
// Generice error messages
if (messageKey.equals(message)) {
message = getLocalizer().getString("error.create.Limit", this);
}
this.mobBasePage.getWebSession().error(message);
}
public boolean isLimitExAlreadyDefine(LimitExType req, IsLimitAlreadyDefinedResponse resp){
if(resp.getStatus().getValue().equals("FALSE") && req.getUseCase()!=null){
}
return false;
}
}
| [
"[email protected]"
] | |
2fa97a22bc9be484406d19beffecd12737411efd | 3b36b928c56817220777a9be39e68638cd73b315 | /src/main/java/ru/netology/Client.java | 538cfe0665d0616406117c5f24f553a9d9082abd | [] | no_license | alres1/clientserver2 | ab179335103c4905c5f412e97c6423b2e4fb5df9 | 97c81b4ab3220fefc0520c14dad534b1eae8cfaa | refs/heads/master | 2023-07-29T05:00:40.675592 | 2021-09-07T09:40:25 | 2021-09-07T09:40:25 | 403,922,345 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,405 | java | package ru.netology;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;
public class Client {
public static void main(String[] args) throws IOException {
InetSocketAddress socketAddress = new InetSocketAddress("127.0.0.1", 23334);
final SocketChannel socketChannel = SocketChannel.open();
socketChannel.connect(socketAddress);
try (Scanner scanner = new Scanner(System.in)) {
final ByteBuffer inputBuffer = ByteBuffer.allocate(2 << 10);
String msg;
while (true) {
System.out.println("Напишите строку с пробелами (end для выхода)");
msg = scanner.nextLine();
if ("end".equals(msg)) break;
socketChannel.write(ByteBuffer.wrap(msg.getBytes(StandardCharsets.UTF_8)));
Thread.sleep(2000);
int bytesCount = socketChannel.read(inputBuffer);
System.out.println(new String(inputBuffer.array(), 0, bytesCount, StandardCharsets.UTF_8).trim());
inputBuffer.clear();
}
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
socketChannel.close();
}
}
}
| [
"[email protected]"
] | |
4dab0c3ad5a67c7f419dae0da91248c876968645 | b5a14b332f8bd19c8f738137350fbde4b6db75c3 | /skyRateWAPI/src/main/java/com/skyrate/dao/EventLogRepository.java | 6c68eb34cab4fe3eb2c250d1c28f253ac67402a8 | [] | no_license | Lakshmanan95/SkyRateWAPI | 2d0ebd74ba1c9236a4c7bd34af2cb841adab3bae | 2b6eb6b333a5691860ec288f7e212b7e3729a54e | refs/heads/master | 2022-12-16T22:29:07.096509 | 2020-09-15T10:28:44 | 2020-09-15T10:28:44 | 295,690,693 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 318 | java | package com.skyrate.dao;
import org.springframework.data.repository.CrudRepository;
import com.skyrate.model.dbentity.EventLog;
public interface EventLogRepository extends CrudRepository<EventLog,Long>{
EventLog findByUniqueId(String uniqueId);
EventLog findByEventAndBusinessId(String event, int businessId);
}
| [
"[email protected]"
] | |
030649c8208f2ee567a060e64c1a9a42af521c0d | ddc720ba96d87488c3811f6436a88bfe6ea036ef | /Model/src/main/java/org/apidb/apicommon/model/datasetInjector/Pathways.java | 23e49b556fdfd8aec5b83eea5ecc5c88ae7a94c1 | [
"Apache-2.0"
] | permissive | VEuPathDB/EbrcModelCommon | a3de064a72b4087082674427e341f10f2d9a607d | 9265535b40d3940af62d831bb41f7540c1061c9b | refs/heads/master | 2023-08-17T05:01:10.655089 | 2023-08-16T19:36:24 | 2023-08-16T19:36:24 | 201,107,315 | 1 | 4 | Apache-2.0 | 2023-08-20T20:17:24 | 2019-08-07T18:35:44 | Java | UTF-8 | Java | false | false | 1,772 | java | package org.apidb.apicommon.model.datasetInjector;
import org.apidb.apicommon.datasetPresenter.DatasetInjector;
public class Pathways extends DatasetInjector {
@Override
public void injectTemplates() {
}
@Override
public void addModelReferences() {
addWdkReference("GeneRecordClasses.GeneRecordClass", "table", "CompoundsMetabolicPathways");
addWdkReference("GeneRecordClasses.GeneRecordClass", "table", "MetabolicPathways");
addWdkReference("TranscriptRecordClasses.TranscriptRecordClass", "question", "GeneQuestions.GenesByMetabolicPathway");
addWdkReference("PathwayRecordClasses.PathwayRecordClass", "table", "CompoundsMetabolicPathways");
addWdkReference("PathwayRecordClasses.PathwayRecordClass", "question", "PathwayQuestions.PathwaysByPathwayID");
addWdkReference("PathwayRecordClasses.PathwayRecordClass", "question", "PathwayQuestions.PathwaysByGeneList");
addWdkReference("PathwayRecordClasses.PathwayRecordClass", "question", "PathwayQuestions.PathwaysByCompounds");
addWdkReference("CompoundRecordClasses.CompoundRecordClass", "table", "CompoundsMetabolicPathways");
addWdkReference("CompoundRecordClasses.CompoundRecordClass", "table", "MetabolicPathways");
addWdkReference("CompoundRecordClasses.CompoundRecordClass", "question", "CompoundQuestions.CompoundsByPathway");
//don't show xrefs table for MPMP pathways
String datasetName = getDatasetName();
if (!datasetName.contains("MPMP")) {
addWdkReference("PathwayRecordClasses.PathwayRecordClass", "table", "PathwayReactionsXrefs");
}
}
// second column is for documentation
@Override
public String[][] getPropertiesDeclaration() {
String[][] propertiesDeclaration = {};
return propertiesDeclaration;
}
}
| [
"[email protected]"
] | |
5671c9413f7cbea3c1ed043fe41f683b34ce6575 | 234012d1ea713dbac2fc4e1dd8a3ebc97a94d2de | /demo/src/main/java/com/example/EmployeeRepository.java | e55e7a1c78f4070a7376c49f6f84d589b1c529f3 | [] | no_license | njega94/Ci346 | d6aca455bc34381a812c6c90328cb7c44ead49c2 | 55d7be1bdf88f3b6aee6330e6376b928193a86ec | refs/heads/master | 2021-01-20T09:31:50.782601 | 2017-05-04T12:27:00 | 2017-05-04T12:27:00 | 90,259,633 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 249 | java |
package com.example;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface EmployeeRepository extends PagingAndSortingRepository<Employee, Long> {
} | [
"[email protected]"
] | |
0b37242e9cfc65398e748167a26c26911b2d6ba6 | bf7cc13b1826b014a9fa360980e5dbb6bbc27eed | /src/java/dao/UserDAO.java | 2d53eca0e4e8fad98c07c6131edb66325a81dc77 | [] | no_license | ahmedhussin11394/webservice | 8ec3c6c03ea1ce7d5be0b37e6a76c16e8640f409 | fcb8063d2c04055872e531c8a7ab1b0491e9ce55 | refs/heads/master | 2021-01-10T14:55:54.849843 | 2016-03-30T06:17:45 | 2016-03-30T06:17:45 | 55,001,131 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,747 | 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 dao;
import java.util.ArrayList;
import model.util.HibernateUtil;
import org.hibernate.Query;
import org.hibernate.Session;
import pojos.Medicine;
import pojos.User;
/**
*
* @author Ahmed_telnet
*/
public class UserDAO {
Session session;
public UserDAO() {
this.session = HibernateUtil.getSessionFactory().openSession();
}
public User getUser(int userId) {
User user = (User) session.get(User.class, userId);
return user;
}
public void addUser(User user) {
session.beginTransaction();
session.save(user);
session.getTransaction().commit();
}
public void updateUser(User user) {
session.beginTransaction();
session.update(user);
session.getTransaction().commit();
}
public void deleteUser(User user) {
session.beginTransaction();
session.delete(user);
session.getTransaction().commit();
}
public User getUserbyMail(String email, String password) {
Query query = session.createQuery("from User u where u.email=:email and u.password=:password");
query.setString("email", email);
query.setString("password", password);
return (User)query.uniqueResult();
}
public ArrayList<Medicine> getMedicines(User user) {
User user1 = (User) session.get(User.class, user.getUserId());
session.beginTransaction();
session.persist(user1);
session.getTransaction().commit();
return new ArrayList<>(user1.getMedicines());
}
}
| [
"[email protected]"
] | |
feaebf5e66e3d6fde7245f597615ae7f0e7d96d5 | 3339e7c0198c60045b25542bdeeb6349ca48deb1 | /html/src/com/tgreenwood/humancannonball/client/HtmlLauncher.java | d9c05919858cbe97be27582e41e92e6da21af3b8 | [] | no_license | tgreenwood/HumanCannonBall | e10b399134ca55d7ee57c52030aab2f22947a663 | 2e473e6e10b144ff7d66b950ee1eb226668c20c5 | refs/heads/master | 2016-09-15T21:20:07.226400 | 2015-07-05T20:03:32 | 2015-07-05T20:03:32 | 38,071,050 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 595 | java | package com.tgreenwood.humancannonball.client;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.gwt.GwtApplication;
import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration;
import com.tgreenwood.humancannonball.HCBGame;
public class HtmlLauncher extends GwtApplication {
@Override
public GwtApplicationConfiguration getConfig () {
return new GwtApplicationConfiguration(480, 320);
}
@Override
public ApplicationListener getApplicationListener () {
return new HCBGame();
}
} | [
"[email protected]"
] | |
caca5c0097e813f4837c54805bc3a4440de238b6 | 14c8213abe7223fe64ff89a47f70b0396e623933 | /com/backdoored/mixin/MixinEntityPlayerSP.java | ee895546b07e0a006982c6b8481200b7af991b85 | [
"MIT"
] | permissive | PolitePeoplePlan/backdoored | c804327a0c2ac5fe3fbfff272ca5afcb97c36e53 | 3928ac16a21662e4f044db9f054d509222a8400e | refs/heads/main | 2023-05-31T04:19:55.497741 | 2021-06-23T15:20:03 | 2021-06-23T15:20:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,861 | java | package com.backdoored.mixin;
import org.spongepowered.asm.mixin.*;
import net.minecraft.client.entity.*;
import net.minecraft.client.*;
import org.spongepowered.asm.mixin.injection.callback.*;
import a.a.d.e.*;
import net.minecraftforge.common.*;
import net.minecraftforge.fml.common.eventhandler.*;
import com.backdoored.hacks.movement.*;
import a.a.g.b.*;
import net.minecraft.client.network.*;
import net.minecraft.network.*;
import org.spongepowered.asm.mixin.injection.*;
import a.a.d.b.f.*;
@Mixin({ EntityPlayerSP.class })
public abstract class MixinEntityPlayerSP extends MixinAbstractClientPlayer
{
private Minecraft mc;
public MixinEntityPlayerSP() {
super();
this.mc = Minecraft.getMinecraft();
}
@Inject(method = { "onUpdateWalkingPlayer" }, at = { @At("HEAD") })
private void preMotion(final CallbackInfo a1) {
final k.b v1 = new k.b(this.mc.player.rotationYaw, this.mc.player.rotationPitch, this.mc.player.onGround);
MinecraftForge.EVENT_BUS.post((Event)v1);
this.mc.player.rotationYaw = v1.ep;
this.mc.player.rotationPitch = v1.eq;
this.mc.player.onGround = v1.er;
}
@Inject(method = { "onUpdateWalkingPlayer" }, at = { @At("RETURN") })
private void postMotion(final CallbackInfo a1) {
final k.a v1 = new k.a(this.mc.player.rotationYaw, this.mc.player.rotationPitch, this.mc.player.onGround);
MinecraftForge.EVENT_BUS.post((Event)v1);
this.mc.player.rotationYaw = v1.ep;
this.mc.player.rotationPitch = v1.eq;
this.mc.player.onGround = v1.er;
}
@Override
public void jump() {
try {
final double v1 = ((EntityPlayerSP)this).motionX;
final double v2 = ((EntityPlayerSP)this).motionZ;
super.jump();
((Speed)c.a((Class)Speed.class)).a(v1, v2, (EntityPlayerSP)this);
}
catch (Exception v3) {
v3.printStackTrace();
}
}
@Redirect(method = { "onLivingUpdate" }, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/NetHandlerPlayClient;sendPacket(Lnet/minecraft/network/Packet;)V"))
private void onSendElytraStartPacket(final NetHandlerPlayClient a1, final Packet<?> a2) {
final e v1 = new e(this.mc.world.isRemote);
MinecraftForge.EVENT_BUS.post((Event)v1);
if (!v1.da && !this.isInWater()) {
this.setFlag(7, true);
}
a1.sendPacket((Packet)a2);
}
@Redirect(method = { "onLivingUpdate" }, at = @At(value = "FIELD", target = "Lnet/minecraft/client/entity/EntityPlayerSP;collidedHorizontally:Z"))
private boolean overrideCollidedHorizontally(final EntityPlayerSP a1) {
final a v1 = new a(a1.collidedHorizontally);
MinecraftForge.EVENT_BUS.post((Event)v1);
return v1.ct;
}
}
| [
"[email protected]"
] | |
9edb171ac511b2712a3914b2dadd0ff21f8ae4e8 | 19ffd8b63dd4e6c7e9ef785886740a7ef7e98871 | /persistenceEE/src/com/apbdoo/BooksStore/models/ShoppingCartEntity.java | 0b534adc168a79d783af9049858503c88a02ded5 | [] | no_license | cristian-guta/Bookstore | a17bd737162c5b9a75a6c2f8a017d53b48239561 | 1c57a89b5be4bdb696ca89684186c27ff7533147 | refs/heads/master | 2023-04-04T08:14:03.343018 | 2021-04-11T19:12:26 | 2021-04-11T19:12:26 | 354,543,496 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,247 | java | package com.apbdoo.BooksStore.models;
import javax.persistence.*;
import java.util.Objects;
@Entity
@Table(name = "shopping_cart", schema = "storedb", catalog = "")
public class ShoppingCartEntity {
private int id;
private int quantity;
private Integer userId;
@Id
@Column(name = "id")
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Basic
@Column(name = "quantity")
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
@Basic
@Column(name = "user_id")
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ShoppingCartEntity that = (ShoppingCartEntity) o;
return id == that.id &&
quantity == that.quantity &&
Objects.equals(userId, that.userId);
}
@Override
public int hashCode() {
return Objects.hash(id, quantity, userId);
}
}
| [
"[email protected]"
] | |
242de95ba32c9b7ed58a7b295717f8eab5b940cd | 9989bd7957efc5fe51d02d1d8a46fda365b59cc3 | /java-source/src/main/java/com/krishna/demo/HomeController.java | 3b5a551bbbd5ed48ac3124f8c6efb5fd9fdafb95 | [] | no_license | rmspavan/apps-devops-project | 17a1888c1c8261c28c3cd4f29dad9ac8a3637543 | 0b8fbc938482edaad4254491576a56848a495acc | refs/heads/master | 2023-07-30T06:15:48.072927 | 2021-09-21T15:01:44 | 2021-09-21T15:01:44 | 373,394,359 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 762 | java | package com.krishna.demo;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class HomeController {
@RequestMapping("home")
public ModelAndView home() {
ModelAndView mv = new ModelAndView("home");
//mv.addObject("username", "");
return mv;
}
@RequestMapping("/")
public ModelAndView Default() {
ModelAndView mv = new ModelAndView("home");
//mv.addObject("username", "");
return mv;
}
}
| [
"[email protected]"
] | |
1f1919312fefc6e1d694d751ea968af0d006fe38 | fe77ad51713c5f8d0be4afab0dec7cd2abe30d19 | /ejuzuo/ejuzuo-web/src/main/java/com/ejuzuo/web/util/RendererUtils.java | 841d3a9efc1849861824da22341b19a3bc3003fb | [] | no_license | allenwtl/ejuzuo | 1fdf2b342baa68fb5c06b3f513dd658240270184 | 593edd8fe1ce981b868cf201a98b3fb843a8dbd8 | refs/heads/master | 2021-01-01T18:18:59.057668 | 2017-07-25T13:18:39 | 2017-07-25T13:19:04 | 98,299,140 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,583 | java | package com.ejuzuo.web.util;
import com.ejuzuo.web.common.SystemConstants;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JsonConfig;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Collection;
/**
* 直接渲染的工具类
*
* @author xiemingmei
* @date 2013/10/16
*/
public class RendererUtils {
/**
* 直接输出字符串.
*/
public static void renderText(String text, HttpServletResponse response) {
render(text, "text/plain;charset="+ SystemConstants.GOBAL_ENCODE, response);
}
/**
* 输出JSON字符串
* @param obj
* @
*/
public static void renderJson(Object obj,HttpServletResponse response) {
renderJson(obj, null,response);
}
/**
* 直接输出XML.
*/
public static void renderHtml(String html, HttpServletResponse response) {
render(html, "text/html;charset="+SystemConstants.GOBAL_ENCODE,response);
}
/**
* 直接输出XML.
*/
public static void renderXML(String xml,HttpServletResponse response) {
render(xml, "text/xml;charset="+SystemConstants.GOBAL_ENCODE,response);
}
/**
* 绕过Template,直接输出内容的简便函数.
*/
private static void render(String text, String contentType, HttpServletResponse response) {
PrintWriter printWriter = null;
try {
response.setContentType(contentType);
printWriter = response.getWriter();
printWriter.write(text);
printWriter.flush();
} catch (IOException e) {
} finally {
if(printWriter != null){
printWriter.close();
}
}
}
/**
* 绕过Template,直接输出JSON的简便函数.
*/
private static void renderJson(Object obj, JsonConfig jsonConfig, HttpServletResponse response) {
if (obj instanceof Object[] || obj instanceof Collection) {
if (jsonConfig != null) {
renderText(JSONArray.fromObject(obj, jsonConfig).toString(), response);
} else {
renderText(JSONArray.fromObject(obj).toString(),response);
}
} else {
if (jsonConfig != null) {
renderText(JSONObject.fromObject(obj, jsonConfig).toString(),response);
} else {
renderText(JSONObject.fromObject(obj).toString(),response);
}
}
}
}
| [
"[email protected]"
] | |
310793fce71e067e48ba7a46d08fc14eefefdaa6 | 2cc9152d6d7bedde9e209437c327a52cdecdcca5 | /src/Model/Revista.java | 333b18a6e941a6f9990c640340e8e24a66ef8382 | [] | no_license | henriquemalone/BibliotecaBd | 0d92920d85e8620f45e1cfbe8f0db04951c93364 | 76eab412f50b6ed5c21ac37883fe9b0cd739f46d | refs/heads/master | 2021-05-06T22:05:56.528161 | 2017-11-30T21:05:22 | 2017-11-30T21:05:22 | 112,660,119 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 831 | java |
package Model;
import Controle.Controle;
import javax.swing.JOptionPane;
public class Revista extends Exemplar{
Controle c = new Controle();
public void addRevista(){
titulo = getTitulo(); //variavel titulo recebe o titulo da revista
try{ //tenta realizar
c.adicionaExemplar(titulo, "", "", "Revista"); //chama o metodo adicionaExemplar da classe Controle
JOptionPane.showMessageDialog(null, "Exemplar cadastrado com sucesso!"); //abre uma janela informando que o cadastro foi realizado com sucesso
} catch (Exception ex){ //caso nao consiga realizar
JOptionPane.showMessageDialog(null, "Erro ao cadastrar o exemplar!\nERRO:"+ex.getMessage()); //abre uma janela informando que ocorreu um erro e qual o erro
}
}
}
| [
"[email protected]"
] | |
47a49704e6e146361fe7643de58960e24293d7af | 4c6adf0ce6ef3f02dcef9c345e0e5e4ff139d886 | /Core/fi-ordercenter/src/main/java/com/pay/txncore/crosspay/dao/impl/PartnerWebsiteConfigDAOImpl.java | 43ae7e75a01a692347f626fe0f80edd113341c81 | [] | no_license | happyjianguo/pay-1 | 8631906be62707316f0ed3eb6b2337c90d213bc0 | 40ae79738cfe4e5d199ca66468f3a33e9d8f2007 | refs/heads/master | 2020-07-27T19:51:54.958859 | 2016-12-19T07:34:24 | 2016-12-19T07:34:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package com.pay.txncore.crosspay.dao.impl;
import com.pay.inf.dao.impl.BaseDAOImpl;
import com.pay.txncore.crosspay.dao.PartnerWebsiteConfigDAO;
import com.pay.txncore.crosspay.model.PartnerWebsiteConfig;
public class PartnerWebsiteConfigDAOImpl extends
BaseDAOImpl<PartnerWebsiteConfig> implements PartnerWebsiteConfigDAO {
}
| [
"[email protected]"
] | |
04d98712810d2f2af156dc39d9ced8f33df2e678 | 02d22093e0a6cdcd434d2385c143fb85e7a0489d | /app/src/main/java/com/androvista/kaustubh/joyofpython/LinkActivity.java | 8d12298cb733667e3995b260b17b119105b48f78 | [] | no_license | stubh505/JoyofPython | 41bbd27a5006819f1a424cb890a01712e6d788ca | 149eaa14b13279b0035cf76b78a96d9be7b76715 | refs/heads/master | 2022-04-22T01:34:35.855376 | 2020-04-24T16:16:26 | 2020-04-24T16:16:26 | 258,562,617 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,277 | java | package com.androvista.kaustubh.joyofpython;
import android.app.AlertDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.design.widget.Snackbar;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
public class LinkActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_link);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_home) {
finish();
} else if (id == R.id.nav_all_videos) {
Intent i = new Intent(this, AllVideosActivity.class);
i.putExtra("type", "JOC");
finish();
startActivity(i);
} else if (id == R.id.nav_week_wise) {
Intent i = new Intent(this, WeekWiseActivity.class);
finish();
startActivity(i);
} else if (id == R.id.nav_chapter_wise) {
Intent i = new Intent(this, ChapterWiseActivity.class);
i.putExtra("type", "JOC");
finish();
startActivity(i);
} else if (id == R.id.nav_all_videos_pds) {
Intent i = new Intent(this, AllVideosActivity.class);
i.putExtra("type", "PDS");
finish();
startActivity(i);
} else if (id == R.id.nav_week_wise_pds) {
} else if (id == R.id.nav_chapter_wise_pds) {
Intent i = new Intent(this, ChapterWiseActivity.class);
i.putExtra("type", "PDS");
finish();
startActivity(i);
} else if (id == R.id.nav_about) {
new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_dialog_info)
.setMessage(R.string.about)
.setTitle(R.string.about_title)
.setCancelable(true)
.show();
} else if (id == R.id.nav_share) {
Snackbar.make(findViewById(R.id.drawer_layout), R.string.no_sharing, Snackbar.LENGTH_LONG)
.setAction(android.R.string.ok, new View.OnClickListener() {
@Override
public void onClick(View view) {
}
}).show();
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
public void link1(View v) {
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("https://onlinecourses.nptel.ac.in/noc17_cs10/assets/img/8queens-global.py"));
startActivity(i);
}
public void link2(View v) {
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("https://onlinecourses.nptel.ac.in/noc17_cs10/assets/img/8queens-allsolns-global.py"));
startActivity(i);
}
public void link3(View v) {
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("https://onlinecourses.nptel.ac.in/noc17_cs10/assets/img/searchtree.py"));
startActivity(i);
}
}
| [
"[email protected]"
] | |
24a3557efa843d93e52861f17d5fbd8b73c7446b | b78f4e4fb8689c0c3b71a1562a7ee4228a116cda | /JFramework/crypto/src/main/java/org/bouncycastle/crypto/agreement/DHStandardGroups.java | a79d87bceeaa29a4c2a9ce62d04a270e91d6371e | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | richkmeli/JFramework | 94c6888a6bb9af8cbff924e8a1525e6ec4765902 | 54250a32b196bb9408fb5715e1c677a26255bc29 | refs/heads/master | 2023-07-24T23:59:19.077417 | 2023-05-05T22:52:14 | 2023-05-05T22:52:14 | 176,379,860 | 5 | 6 | Apache-2.0 | 2023-07-13T22:58:27 | 2019-03-18T22:32:12 | Java | UTF-8 | Java | false | false | 24,088 | java | package org.bouncycastle.crypto.agreement;
import org.bouncycastle.crypto.params.DHParameters;
import org.bouncycastle.util.encoders.Hex;
import java.math.BigInteger;
/**
* Standard Diffie-Hellman groups from various IETF specifications.
*/
public class DHStandardGroups {
private static final BigInteger TWO = BigInteger.valueOf(2);
private static BigInteger fromHex(String hex) {
return new BigInteger(1, Hex.decodeStrict(hex));
}
private static DHParameters fromPG(String hexP, String hexG) {
return new DHParameters(fromHex(hexP), fromHex(hexG));
}
private static DHParameters fromPGQ(String hexP, String hexG, String hexQ) {
return new DHParameters(fromHex(hexP), fromHex(hexG), fromHex(hexQ));
}
private static DHParameters rfc7919Parameters(String hexP, int l) {
// NOTE: All the groups in RFC 7919 use safe primes, i.e. q = (p-1)/2, and generator g = 2
BigInteger p = fromHex(hexP);
return new DHParameters(p, TWO, p.shiftRight(1), l);
}
/*
* RFC 2409
*/
private static final String rfc2409_768_p = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"
+ "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"
+ "E485B576625E7EC6F44C42E9A63A3620FFFFFFFFFFFFFFFF";
private static final String rfc2409_768_g = "02";
public static final DHParameters rfc2409_768 = fromPG(rfc2409_768_p, rfc2409_768_g);
private static final String rfc2409_1024_p = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"
+ "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"
+ "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381"
+ "FFFFFFFFFFFFFFFF";
private static final String rfc2409_1024_g = "02";
public static final DHParameters rfc2409_1024 = fromPG(rfc2409_1024_p, rfc2409_1024_g);
/*
* RFC 3526
*/
private static final String rfc3526_1536_p = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"
+ "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"
+ "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D"
+ "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" + "83655D23DCA3AD961C62F356208552BB9ED529077096966D"
+ "670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF";
private static final String rfc3526_1536_g = "02";
public static final DHParameters rfc3526_1536 = fromPG(rfc3526_1536_p, rfc3526_1536_g);
private static final String rfc3526_2048_p = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"
+ "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"
+ "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D"
+ "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" + "83655D23DCA3AD961C62F356208552BB9ED529077096966D"
+ "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" + "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9"
+ "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" + "15728E5A8AACAA68FFFFFFFFFFFFFFFF";
private static final String rfc3526_2048_g = "02";
public static final DHParameters rfc3526_2048 = fromPG(rfc3526_2048_p, rfc3526_2048_g);
private static final String rfc3526_3072_p = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"
+ "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"
+ "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D"
+ "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" + "83655D23DCA3AD961C62F356208552BB9ED529077096966D"
+ "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" + "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9"
+ "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" + "15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64"
+ "ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" + "ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B"
+ "F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" + "BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31"
+ "43DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF";
private static final String rfc3526_3072_g = "02";
public static final DHParameters rfc3526_3072 = fromPG(rfc3526_3072_p, rfc3526_3072_g);
private static final String rfc3526_4096_p = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"
+ "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"
+ "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D"
+ "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" + "83655D23DCA3AD961C62F356208552BB9ED529077096966D"
+ "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" + "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9"
+ "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" + "15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64"
+ "ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" + "ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B"
+ "F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" + "BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31"
+ "43DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7" + "88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA"
+ "2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6" + "287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED"
+ "1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9" + "93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199"
+ "FFFFFFFFFFFFFFFF";
private static final String rfc3526_4096_g = "02";
public static final DHParameters rfc3526_4096 = fromPG(rfc3526_4096_p, rfc3526_4096_g);
private static final String rfc3526_6144_p = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E08"
+ "8A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B"
+ "302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9"
+ "A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE6"
+ "49286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8"
+ "FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D"
+ "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C"
+ "180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF695581718"
+ "3995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D"
+ "04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7D"
+ "B3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D226"
+ "1AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200C"
+ "BBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFC"
+ "E0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B26"
+ "99C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB"
+ "04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2"
+ "233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127"
+ "D5B05AA993B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934028492"
+ "36C3FAB4D27C7026C1D4DCB2602646DEC9751E763DBA37BDF8FF9406"
+ "AD9E530EE5DB382F413001AEB06A53ED9027D831179727B0865A8918"
+ "DA3EDBEBCF9B14ED44CE6CBACED4BB1BDB7F1447E6CC254B33205151"
+ "2BD7AF426FB8F401378CD2BF5983CA01C64B92ECF032EA15D1721D03"
+ "F482D7CE6E74FEF6D55E702F46980C82B5A84031900B1C9E59E7C97F"
+ "BEC7E8F323A97A7E36CC88BE0F1D45B7FF585AC54BD407B22B4154AA"
+ "CC8F6D7EBF48E1D814CC5ED20F8037E0A79715EEF29BE32806A1D58B"
+ "B7C5DA76F550AA3D8A1FBFF0EB19CCB1A313D55CDA56C9EC2EF29632"
+ "387FE8D76E3C0468043E8F663F4860EE12BF2D5B0B7474D6E694F91E"
+ "6DCC4024FFFFFFFFFFFFFFFF";
private static final String rfc3526_6144_g = "02";
public static final DHParameters rfc3526_6144 = fromPG(rfc3526_6144_p, rfc3526_6144_g);
private static final String rfc3526_8192_p = "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1"
+ "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" + "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245"
+ "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" + "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D"
+ "C2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F" + "83655D23DCA3AD961C62F356208552BB9ED529077096966D"
+ "670C354E4ABC9804F1746C08CA18217C32905E462E36CE3B" + "E39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9"
+ "DE2BCBF6955817183995497CEA956AE515D2261898FA0510" + "15728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64"
+ "ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7" + "ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6B"
+ "F12FFA06D98A0864D87602733EC86A64521F2B18177B200C" + "BBE117577A615D6C770988C0BAD946E208E24FA074E5AB31"
+ "43DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D7" + "88719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA"
+ "2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6" + "287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED"
+ "1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA9" + "93B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934028492"
+ "36C3FAB4D27C7026C1D4DCB2602646DEC9751E763DBA37BD" + "F8FF9406AD9E530EE5DB382F413001AEB06A53ED9027D831"
+ "179727B0865A8918DA3EDBEBCF9B14ED44CE6CBACED4BB1B" + "DB7F1447E6CC254B332051512BD7AF426FB8F401378CD2BF"
+ "5983CA01C64B92ECF032EA15D1721D03F482D7CE6E74FEF6" + "D55E702F46980C82B5A84031900B1C9E59E7C97FBEC7E8F3"
+ "23A97A7E36CC88BE0F1D45B7FF585AC54BD407B22B4154AA" + "CC8F6D7EBF48E1D814CC5ED20F8037E0A79715EEF29BE328"
+ "06A1D58BB7C5DA76F550AA3D8A1FBFF0EB19CCB1A313D55C" + "DA56C9EC2EF29632387FE8D76E3C0468043E8F663F4860EE"
+ "12BF2D5B0B7474D6E694F91E6DBE115974A3926F12FEE5E4" + "38777CB6A932DF8CD8BEC4D073B931BA3BC832B68D9DD300"
+ "741FA7BF8AFC47ED2576F6936BA424663AAB639C5AE4F568" + "3423B4742BF1C978238F16CBE39D652DE3FDB8BEFC848AD9"
+ "22222E04A4037C0713EB57A81A23F0C73473FC646CEA306B" + "4BCBC8862F8385DDFA9D4B7FA2C087E879683303ED5BDD3A"
+ "062B3CF5B3A278A66D2A13F83F44F82DDF310EE074AB6A36" + "4597E899A0255DC164F31CC50846851DF9AB48195DED7EA1"
+ "B1D510BD7EE74D73FAF36BC31ECFA268359046F4EB879F92" + "4009438B481C6CD7889A002ED5EE382BC9190DA6FC026E47"
+ "9558E4475677E9AA9E3050E2765694DFC81F56E880B96E71" + "60C980DD98EDD3DFFFFFFFFFFFFFFFFF";
private static final String rfc3526_8192_g = "02";
public static final DHParameters rfc3526_8192 = fromPG(rfc3526_8192_p, rfc3526_8192_g);
/*
* RFC 4306
*/
public static final DHParameters rfc4306_768 = rfc2409_768;
public static final DHParameters rfc4306_1024 = rfc2409_1024;
/*
* RFC 5114
*/
private static final String rfc5114_1024_160_p = "B10B8F96A080E01DDE92DE5EAE5D54EC52C99FBCFB06A3C6"
+ "9A6A9DCA52D23B616073E28675A23D189838EF1E2EE652C0" + "13ECB4AEA906112324975C3CD49B83BFACCBDD7D90C4BD70"
+ "98488E9C219A73724EFFD6FAE5644738FAA31A4FF55BCCC0" + "A151AF5F0DC8B4BD45BF37DF365C1A65E68CFDA76D4DA708"
+ "DF1FB2BC2E4A4371";
private static final String rfc5114_1024_160_g = "A4D1CBD5C3FD34126765A442EFB99905F8104DD258AC507F"
+ "D6406CFF14266D31266FEA1E5C41564B777E690F5504F213" + "160217B4B01B886A5E91547F9E2749F4D7FBD7D3B9A92EE1"
+ "909D0D2263F80A76A6A24C087A091F531DBF0A0169B6A28A" + "D662A4D18E73AFA32D779D5918D08BC8858F4DCEF97C2A24"
+ "855E6EEB22B3B2E5";
private static final String rfc5114_1024_160_q = "F518AA8781A8DF278ABA4E7D64B7CB9D49462353";
/**
* @deprecated Existence of a "hidden SNFS" backdoor cannot be ruled out. see https://eprint.iacr.org/2016/961.pdf
*/
public static final DHParameters rfc5114_1024_160 = fromPGQ(rfc5114_1024_160_p, rfc5114_1024_160_g,
rfc5114_1024_160_q);
private static final String rfc5114_2048_224_p = "AD107E1E9123A9D0D660FAA79559C51FA20D64E5683B9FD1"
+ "B54B1597B61D0A75E6FA141DF95A56DBAF9A3C407BA1DF15" + "EB3D688A309C180E1DE6B85A1274A0A66D3F8152AD6AC212"
+ "9037C9EDEFDA4DF8D91E8FEF55B7394B7AD5B7D0B6C12207" + "C9F98D11ED34DBF6C6BA0B2C8BBC27BE6A00E0A0B9C49708"
+ "B3BF8A317091883681286130BC8985DB1602E714415D9330" + "278273C7DE31EFDC7310F7121FD5A07415987D9ADC0A486D"
+ "CDF93ACC44328387315D75E198C641A480CD86A1B9E587E8" + "BE60E69CC928B2B9C52172E413042E9B23F10B0E16E79763"
+ "C9B53DCF4BA80A29E3FB73C16B8E75B97EF363E2FFA31F71" + "CF9DE5384E71B81C0AC4DFFE0C10E64F";
private static final String rfc5114_2048_224_g = "AC4032EF4F2D9AE39DF30B5C8FFDAC506CDEBE7B89998CAF"
+ "74866A08CFE4FFE3A6824A4E10B9A6F0DD921F01A70C4AFA" + "AB739D7700C29F52C57DB17C620A8652BE5E9001A8D66AD7"
+ "C17669101999024AF4D027275AC1348BB8A762D0521BC98A" + "E247150422EA1ED409939D54DA7460CDB5F6C6B250717CBE"
+ "F180EB34118E98D119529A45D6F834566E3025E316A330EF" + "BB77A86F0C1AB15B051AE3D428C8F8ACB70A8137150B8EEB"
+ "10E183EDD19963DDD9E263E4770589EF6AA21E7F5F2FF381" + "B539CCE3409D13CD566AFBB48D6C019181E1BCFE94B30269"
+ "EDFE72FE9B6AA4BD7B5A0F1C71CFFF4C19C418E1F6EC0179" + "81BC087F2A7065B384B890D3191F2BFA";
private static final String rfc5114_2048_224_q = "801C0D34C58D93FE997177101F80535A4738CEBCBF389A99B36371EB";
/**
* @deprecated Existence of a "hidden SNFS" backdoor cannot be ruled out. see https://eprint.iacr.org/2016/961.pdf
*/
public static final DHParameters rfc5114_2048_224 = fromPGQ(rfc5114_2048_224_p, rfc5114_2048_224_g,
rfc5114_2048_224_q);
private static final String rfc5114_2048_256_p = "87A8E61DB4B6663CFFBBD19C651959998CEEF608660DD0F2"
+ "5D2CEED4435E3B00E00DF8F1D61957D4FAF7DF4561B2AA30" + "16C3D91134096FAA3BF4296D830E9A7C209E0C6497517ABD"
+ "5A8A9D306BCF67ED91F9E6725B4758C022E0B1EF4275BF7B" + "6C5BFC11D45F9088B941F54EB1E59BB8BC39A0BF12307F5C"
+ "4FDB70C581B23F76B63ACAE1CAA6B7902D52526735488A0E" + "F13C6D9A51BFA4AB3AD8347796524D8EF6A167B5A41825D9"
+ "67E144E5140564251CCACB83E6B486F6B3CA3F7971506026" + "C0B857F689962856DED4010ABD0BE621C3A3960A54E710C3"
+ "75F26375D7014103A4B54330C198AF126116D2276E11715F" + "693877FAD7EF09CADB094AE91E1A1597";
private static final String rfc5114_2048_256_g = "3FB32C9B73134D0B2E77506660EDBD484CA7B18F21EF2054"
+ "07F4793A1A0BA12510DBC15077BE463FFF4FED4AAC0BB555" + "BE3A6C1B0C6B47B1BC3773BF7E8C6F62901228F8C28CBB18"
+ "A55AE31341000A650196F931C77A57F2DDF463E5E9EC144B" + "777DE62AAAB8A8628AC376D282D6ED3864E67982428EBC83"
+ "1D14348F6F2F9193B5045AF2767164E1DFC967C1FB3F2E55" + "A4BD1BFFE83B9C80D052B985D182EA0ADB2A3B7313D3FE14"
+ "C8484B1E052588B9B7D2BBD2DF016199ECD06E1557CD0915" + "B3353BBB64E0EC377FD028370DF92B52C7891428CDC67EB6"
+ "184B523D1DB246C32F63078490F00EF8D647D148D4795451" + "5E2327CFEF98C582664B4C0F6CC41659";
private static final String rfc5114_2048_256_q = "8CF83642A709A097B447997640129DA299B1A47D1EB3750B"
+ "A308B0FE64F5FBD3";
/**
* @deprecated Existence of a "hidden SNFS" backdoor cannot be ruled out. see https://eprint.iacr.org/2016/961.pdf
*/
public static final DHParameters rfc5114_2048_256 = fromPGQ(rfc5114_2048_256_p, rfc5114_2048_256_g,
rfc5114_2048_256_q);
/*
* RFC 5996
*/
public static final DHParameters rfc5996_768 = rfc4306_768;
public static final DHParameters rfc5996_1024 = rfc4306_1024;
/*
* RFC 7919
*/
private static final String rfc7919_ffdhe2048_p = "FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1"
+ "D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" + "7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561"
+ "2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" + "984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735"
+ "30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" + "B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19"
+ "0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" + "9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73"
+ "3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" + "886B423861285C97FFFFFFFFFFFFFFFF";
public static final DHParameters rfc7919_ffdhe2048 = rfc7919Parameters(rfc7919_ffdhe2048_p, 225);
private static final String rfc7919_ffdhe3072_p = "FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1"
+ "D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" + "7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561"
+ "2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" + "984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735"
+ "30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" + "B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19"
+ "0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" + "9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73"
+ "3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" + "886B4238611FCFDCDE355B3B6519035BBC34F4DEF99C0238"
+ "61B46FC9D6E6C9077AD91D2691F7F7EE598CB0FAC186D91C" + "AEFE130985139270B4130C93BC437944F4FD4452E2D74DD3"
+ "64F2E21E71F54BFF5CAE82AB9C9DF69EE86D2BC522363A0D" + "ABC521979B0DEADA1DBF9A42D5C4484E0ABCD06BFA53DDEF"
+ "3C1B20EE3FD59D7C25E41D2B66C62E37FFFFFFFFFFFFFFFF";
public static final DHParameters rfc7919_ffdhe3072 = rfc7919Parameters(rfc7919_ffdhe3072_p, 275);
private static final String rfc7919_ffdhe4096_p = "FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1"
+ "D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" + "7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561"
+ "2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" + "984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735"
+ "30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" + "B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19"
+ "0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" + "9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73"
+ "3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" + "886B4238611FCFDCDE355B3B6519035BBC34F4DEF99C0238"
+ "61B46FC9D6E6C9077AD91D2691F7F7EE598CB0FAC186D91C" + "AEFE130985139270B4130C93BC437944F4FD4452E2D74DD3"
+ "64F2E21E71F54BFF5CAE82AB9C9DF69EE86D2BC522363A0D" + "ABC521979B0DEADA1DBF9A42D5C4484E0ABCD06BFA53DDEF"
+ "3C1B20EE3FD59D7C25E41D2B669E1EF16E6F52C3164DF4FB" + "7930E9E4E58857B6AC7D5F42D69F6D187763CF1D55034004"
+ "87F55BA57E31CC7A7135C886EFB4318AED6A1E012D9E6832" + "A907600A918130C46DC778F971AD0038092999A333CB8B7A"
+ "1A1DB93D7140003C2A4ECEA9F98D0ACC0A8291CDCEC97DCF" + "8EC9B55A7F88A46B4DB5A851F44182E1C68A007E5E655F6A"
+ "FFFFFFFFFFFFFFFF";
public static final DHParameters rfc7919_ffdhe4096 = rfc7919Parameters(rfc7919_ffdhe4096_p, 325);
private static final String rfc7919_ffdhe6144_p = "FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1"
+ "D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" + "7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561"
+ "2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" + "984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735"
+ "30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" + "B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19"
+ "0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" + "9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73"
+ "3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" + "886B4238611FCFDCDE355B3B6519035BBC34F4DEF99C0238"
+ "61B46FC9D6E6C9077AD91D2691F7F7EE598CB0FAC186D91C" + "AEFE130985139270B4130C93BC437944F4FD4452E2D74DD3"
+ "64F2E21E71F54BFF5CAE82AB9C9DF69EE86D2BC522363A0D" + "ABC521979B0DEADA1DBF9A42D5C4484E0ABCD06BFA53DDEF"
+ "3C1B20EE3FD59D7C25E41D2B669E1EF16E6F52C3164DF4FB" + "7930E9E4E58857B6AC7D5F42D69F6D187763CF1D55034004"
+ "87F55BA57E31CC7A7135C886EFB4318AED6A1E012D9E6832" + "A907600A918130C46DC778F971AD0038092999A333CB8B7A"
+ "1A1DB93D7140003C2A4ECEA9F98D0ACC0A8291CDCEC97DCF" + "8EC9B55A7F88A46B4DB5A851F44182E1C68A007E5E0DD902"
+ "0BFD64B645036C7A4E677D2C38532A3A23BA4442CAF53EA6" + "3BB454329B7624C8917BDD64B1C0FD4CB38E8C334C701C3A"
+ "CDAD0657FCCFEC719B1F5C3E4E46041F388147FB4CFDB477" + "A52471F7A9A96910B855322EDB6340D8A00EF092350511E3"
+ "0ABEC1FFF9E3A26E7FB29F8C183023C3587E38DA0077D9B4" + "763E4E4B94B2BBC194C6651E77CAF992EEAAC0232A281BF6"
+ "B3A739C1226116820AE8DB5847A67CBEF9C9091B462D538C" + "D72B03746AE77F5E62292C311562A846505DC82DB854338A"
+ "E49F5235C95B91178CCF2DD5CACEF403EC9D1810C6272B04" + "5B3B71F9DC6B80D63FDD4A8E9ADB1E6962A69526D43161C1"
+ "A41D570D7938DAD4A40E329CD0E40E65FFFFFFFFFFFFFFFF";
public static final DHParameters rfc7919_ffdhe6144 = rfc7919Parameters(rfc7919_ffdhe6144_p, 375);
private static final String rfc7919_ffdhe8192_p = "FFFFFFFFFFFFFFFFADF85458A2BB4A9AAFDC5620273D3CF1"
+ "D8B9C583CE2D3695A9E13641146433FBCC939DCE249B3EF9" + "7D2FE363630C75D8F681B202AEC4617AD3DF1ED5D5FD6561"
+ "2433F51F5F066ED0856365553DED1AF3B557135E7F57C935" + "984F0C70E0E68B77E2A689DAF3EFE8721DF158A136ADE735"
+ "30ACCA4F483A797ABC0AB182B324FB61D108A94BB2C8E3FB" + "B96ADAB760D7F4681D4F42A3DE394DF4AE56EDE76372BB19"
+ "0B07A7C8EE0A6D709E02FCE1CDF7E2ECC03404CD28342F61" + "9172FE9CE98583FF8E4F1232EEF28183C3FE3B1B4C6FAD73"
+ "3BB5FCBC2EC22005C58EF1837D1683B2C6F34A26C1B2EFFA" + "886B4238611FCFDCDE355B3B6519035BBC34F4DEF99C0238"
+ "61B46FC9D6E6C9077AD91D2691F7F7EE598CB0FAC186D91C" + "AEFE130985139270B4130C93BC437944F4FD4452E2D74DD3"
+ "64F2E21E71F54BFF5CAE82AB9C9DF69EE86D2BC522363A0D" + "ABC521979B0DEADA1DBF9A42D5C4484E0ABCD06BFA53DDEF"
+ "3C1B20EE3FD59D7C25E41D2B669E1EF16E6F52C3164DF4FB" + "7930E9E4E58857B6AC7D5F42D69F6D187763CF1D55034004"
+ "87F55BA57E31CC7A7135C886EFB4318AED6A1E012D9E6832" + "A907600A918130C46DC778F971AD0038092999A333CB8B7A"
+ "1A1DB93D7140003C2A4ECEA9F98D0ACC0A8291CDCEC97DCF" + "8EC9B55A7F88A46B4DB5A851F44182E1C68A007E5E0DD902"
+ "0BFD64B645036C7A4E677D2C38532A3A23BA4442CAF53EA6" + "3BB454329B7624C8917BDD64B1C0FD4CB38E8C334C701C3A"
+ "CDAD0657FCCFEC719B1F5C3E4E46041F388147FB4CFDB477" + "A52471F7A9A96910B855322EDB6340D8A00EF092350511E3"
+ "0ABEC1FFF9E3A26E7FB29F8C183023C3587E38DA0077D9B4" + "763E4E4B94B2BBC194C6651E77CAF992EEAAC0232A281BF6"
+ "B3A739C1226116820AE8DB5847A67CBEF9C9091B462D538C" + "D72B03746AE77F5E62292C311562A846505DC82DB854338A"
+ "E49F5235C95B91178CCF2DD5CACEF403EC9D1810C6272B04" + "5B3B71F9DC6B80D63FDD4A8E9ADB1E6962A69526D43161C1"
+ "A41D570D7938DAD4A40E329CCFF46AAA36AD004CF600C838" + "1E425A31D951AE64FDB23FCEC9509D43687FEB69EDD1CC5E"
+ "0B8CC3BDF64B10EF86B63142A3AB8829555B2F747C932665" + "CB2C0F1CC01BD70229388839D2AF05E454504AC78B758282"
+ "2846C0BA35C35F5C59160CC046FD8251541FC68C9C86B022" + "BB7099876A460E7451A8A93109703FEE1C217E6C3826E52C"
+ "51AA691E0E423CFC99E9E31650C1217B624816CDAD9A95F9" + "D5B8019488D9C0A0A1FE3075A577E23183F81D4A3F2FA457"
+ "1EFC8CE0BA8A4FE8B6855DFE72B0A66EDED2FBABFBE58A30" + "FAFABE1C5D71A87E2F741EF8C1FE86FEA6BBFDE530677F0D"
+ "97D11D49F7A8443D0822E506A9F4614E011E2A94838FF88C" + "D68C8BB7C5C6424CFFFFFFFFFFFFFFFF";
public static final DHParameters rfc7919_ffdhe8192 = rfc7919Parameters(rfc7919_ffdhe8192_p, 400);
}
| [
"[email protected]"
] | |
a18c1dd31ecf54a82bda0a78660bb67f8d995acb | 8ff94148c4f521900c31568a6c55af44972d45ad | /src/main/java/alivestill/Q641/Q641.java | 8cfa1f254300886748d4b5371903eb67d1861f79 | [] | no_license | AliveStill/leetcode-problems | 55b27d351d89814bfe9a2802a5c90912e920d917 | 5382649c51ba87d72d804d19103199ac7df6e551 | refs/heads/main | 2023-08-15T14:08:26.660604 | 2021-10-12T07:32:19 | 2021-10-12T07:32:19 | 352,991,896 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,694 | java | package alivestill.Q641;
import alivestill.utils.DoubleLinkedList.DoubleLinkedList;
import alivestill.utils.DoubleLinkedList.ListNode;
public class Q641 {
}
class MyCircularDeque extends DoubleLinkedList<Integer> {
int capacity;
/** Initialize your data structure here. Set the size of the deque to be k. */
public MyCircularDeque(int k) {
capacity = k;
}
/** Adds an item at the front of Deque. Return true if the operation is successful. */
public boolean insertFront(int value) {
if (getSize() == capacity) {
return false;
} else {
insertAfter(new ListNode<>(value), getHead());
return true;
}
}
/** Adds an item at the rear of Deque. Return true if the operation is successful. */
public boolean insertLast(int value) {
if (getSize() == capacity) {
return false;
} else {
insertBefore(new ListNode<>(value), getTail());
return true;
}
}
/** Deletes an item from the front of Deque. Return true if the operation is successful. */
public boolean deleteFront() {
if (isEmpty()) {
return false;
} else {
remove(getHead().getNext());
return true;
}
}
/** Deletes an item from the rear of Deque. Return true if the operation is successful. */
public boolean deleteLast() {
if (isEmpty()) {
return false;
} else {
remove(getTail().getPrev());
return true;
}
}
/** Get the front item from the deque. */
public int getFront() {
if (isEmpty()) {
return -1;
} else {
return getHead().getNext().getValue();
}
}
/** Get the last item from the deque. */
public int getRear() {
if (isEmpty()) {
return -1;
} else {
return getTail().getPrev().getValue();
}
}
/** Checks whether the circular deque is empty or not. */
public boolean isEmpty() {
return getSize() == 0;
}
/** Checks whether the circular deque is full or not. */
public boolean isFull() {
return getSize() == capacity;
}
}
/**
* Your MyCircularDeque object will be instantiated and called as such:
* MyCircularDeque obj = new MyCircularDeque(k);
* boolean param_1 = obj.insertFront(value);
* boolean param_2 = obj.insertLast(value);
* boolean param_3 = obj.deleteFront();
* boolean param_4 = obj.deleteLast();
* int param_5 = obj.getFront();
* int param_6 = obj.getRear();
* boolean param_7 = obj.isEmpty();
* boolean param_8 = obj.isFull();
*/
| [
"[email protected]"
] | |
939e9036cad7bd0cff76c2bb3f467bf744b420c4 | 95c8eafbddd8520280e30e2c6c4101b2aa892ae2 | /src/main/java/org/jbehave/business/StockAlertStatus.java | 5e9123e4ea69e370254f83d81336a0d1aaf72886 | [] | no_license | BillSchofield/JBehaveSpringMVCTemplate | afad39a40c6df5f60c716bf77d568587e633052f | 1f10ee36ccba8037c631ef34ed2524a3b69ab922 | refs/heads/master | 2021-01-19T08:26:08.139597 | 2015-12-11T22:59:07 | 2015-12-11T22:59:41 | 14,953,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 77 | java | package org.jbehave.business;
public enum StockAlertStatus {
ON,
OFF
}
| [
"[email protected]"
] | |
9a8eddae7929c9a9ee96dc8dc46050b7ecd6a844 | 83c7636480c39dc122a6eca20e8aa94b38d1f398 | /Digt-DepartmentService/src/test/java/com/verizon/digt/department/DigtDepartmentServiceApplicationTests.java | e780bde477f127db2d961ba0ac21bec0a71809ae | [] | no_license | siva1855/WS-MicroServicesProject | 48504aa56927ea117f36a08ab7ae8dae0f1a5782 | 3e2101a5bdc9ff07830ff9ea8a0f858313e78b0c | refs/heads/master | 2023-01-09T01:18:06.694668 | 2020-11-09T06:24:13 | 2020-11-09T06:24:13 | 310,647,754 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 234 | java | package com.verizon.digt.department;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DigtDepartmentServiceApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
b4214c9e9d04803bad30d8ab09d9eac9753f7c54 | 98782ebd5b3d643187db19cf1b9f7dec5085a7ab | /java8-lambda/src/main/java/chapter9/sector03/Person.java | 49218e998ce3e24fd52223634feb93e9f56c3507 | [] | no_license | biz-ckchoi/all-my-study | 286e6fa221cc7c07253a5a5f5a8c643126584ca8 | 114b3563a88ab6db98e0a542ca0282d99de4a573 | refs/heads/master | 2021-07-25T20:39:38.342939 | 2017-11-06T10:17:28 | 2017-11-06T10:17:28 | 107,922,918 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 556 | java | package chapter9.sector03;
import java.util.Objects;
public class Person {
private String first;
private String last;
public boolean equals(Object otherObject) {
if (this == otherObject) return true;
if (otherObject == null) return false;
if (getClass() != otherObject.getClass()) return false;
Person other = (Person) otherObject;
return Objects.equals(first, other.first) && Objects.equals(last, other.last);
}
public int hashCode() {
return Objects.hash(first, last);
}
}
| [
"[email protected]"
] | |
965302f19905ce28e4f696a3876a74821d73636e | 5148293c98b0a27aa223ea157441ac7fa9b5e7a3 | /Method_Scraping/xml_scraping/NicadOutputFile_t1_flink_new2/Nicad_t1_flink_new26440.java | 470b89b751eea9d9c124ac01d2be0298a262599b | [] | no_license | ryosuke-ku/TestCodeSeacherPlus | cfd03a2858b67a05ecf17194213b7c02c5f2caff | d002a52251f5461598c7af73925b85a05cea85c6 | refs/heads/master | 2020-05-24T01:25:27.000821 | 2019-08-17T06:23:42 | 2019-08-17T06:23:42 | 187,005,399 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 415 | java | // clone pairs:25581:80%
// 39051:flink/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobPlanInfo.java
public class Nicad_t1_flink_new26440
{
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RawJson rawJson = (RawJson) o;
return Objects.equals(json, rawJson.json);
}
} | [
"[email protected]"
] | |
0da447bec77df07a58ae387c51472e81c3ebe546 | e72a732abd0e77c38858d0885e6845d6494b67fd | /src/test/java/buyme/co/il/tests/SearchGiftCardTest.java | cdd3880ccead7f6dcc6135ffa81201a6cc0e634b | [] | no_license | inbalye/ByumeAutomationProject | 97e74c4c45959fd5b46d892175b43eb19439356e | 8557e331b9162e648eb0c9ed2562489b78f7ae26 | refs/heads/main | 2023-06-02T06:09:54.425073 | 2021-06-23T13:47:32 | 2021-06-23T13:47:32 | 378,926,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 820 | java | package buyme.co.il.tests;
import org.testng.Assert;
import org.testng.annotations.Test;
import buyme.co.il.pageobjects.HomePage;
import buyme.co.il.pageobjects.SearchGiftCardResultsPage;
public class SearchGiftCardTest extends BaseTest {
@Test(description = "search Gift Card, test should succeed")
public void searchGiftCardByMountAreaCategory() {
HomePage homeP = new HomePage(driver);
homeP.searchGiftCard();
SearchGiftCardResultsPage resultP = new SearchGiftCardResultsPage(driver);
// should check that we get the right search result text
String expectedText = "50 תוצאות חיפוש ל200-299 ש\"ח, ת\"א והסביבה, גיפט קארד למסעדות שף";
String actualText = resultP.getSearchResultText();
Assert.assertEquals(actualText, expectedText);
}
}
| [
"[email protected]"
] | |
6eedba399cadc65d11814361ba193b90b6605971 | 470957be807e03a726756ee0e5d863db5f6ecf7d | /src/main/java/com/embedGroup/metrics/Reservoir.java | 102372bd084efef3b24bc573bf7b9f23d8408c51 | [] | no_license | quieoo/metrics_src | 1dfdacbfc92069d36eaeb42dba163e80fa95a9b4 | b630ccad53bc1ca00c2dac47c0852501b127c220 | refs/heads/master | 2022-12-02T18:26:24.010856 | 2020-08-24T13:10:30 | 2020-08-24T13:10:30 | 288,661,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 566 | java | package com.embedGroup.metrics;
/**
* A statistically representative reservoir of a data stream.
*/
public interface Reservoir {
/**
* Returns the number of values recorded.
*
* @return the number of values recorded
*/
int size();
/**
* Adds a new recorded value to the reservoir.
*
* @param value a new recorded value
*/
void update(long value);
/**
* Returns a snapshot of the reservoir's values.
*
* @return a snapshot of the reservoir's values
*/
Snapshot getSnapshot();
}
| [
"[email protected]"
] | |
6247d054ba4654106d0de84d1f2f86f7759adebd | a213005ef9cc341cc6877a84eb02bf68f19eb699 | /android/app/src/main/java/org/autojs/autojs/tool/GsonUtils.java | bb0a9f09ec1df8de7c97e0ca9937c6a0ecc9fcda | [
"MPL-1.1",
"MPL-2.0",
"LicenseRef-scancode-unknown-license-reference",
"AGPL-3.0-only",
"GPL-2.0-only",
"LGPL-2.1-only",
"MPL-2.0-no-copyleft-exception",
"MIT"
] | permissive | snailuncle/autojs-web-control | 893c62e0a1b1e81a90b7e7fab31547591383584b | ec4586109c6b5da01183eb3f63913904e72b99c7 | refs/heads/master | 2020-09-24T20:10:53.489095 | 2019-12-04T09:20:17 | 2019-12-04T09:20:17 | 225,833,423 | 0 | 2 | MIT | 2019-12-04T09:51:43 | 2019-12-04T09:51:43 | null | UTF-8 | Java | false | false | 872 | java | package org.autojs.autojs.tool;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Stardust on 2017/7/21.
*/
public class GsonUtils {
public static List<String> toReservedStringList(JsonElement element) {
JsonArray array = element.getAsJsonArray();
List<String> list = new ArrayList<>(array.size());
for (int i = array.size() - 1; i >= 0; i--) {
list.add(array.get(i).getAsString());
}
return list;
}
public static List<String> toStringList(JsonElement element) {
JsonArray array = element.getAsJsonArray();
List<String> list = new ArrayList<>(array.size());
for (int i = 0; i < array.size(); i++) {
list.add(array.get(i).getAsString());
}
return list;
}
}
| [
"[email protected]"
] | |
910481d6a6616f3e20fbb453ba038f554d88ec22 | fc54ba9bf692830573bd599ccea6404b98a84aa9 | /2.JavaCore/src/com/codegym/task/task19/task1924/Solution.java | 402352390b4657fa294b4dab234a79a983dc8251 | [] | no_license | khal-alexa/CodeGymTasks | eddad25e98a55fd4bf86ff5926fe313e53555b61 | 0709928f74f6b9cc1de326af509271515e856bd1 | refs/heads/master | 2020-06-02T16:08:09.763281 | 2020-02-17T12:22:48 | 2020-02-17T12:22:48 | 241,100,005 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,049 | java | package com.codegym.task.task19.task1924;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
/*
Replacing numbers
*/
public class Solution {
public static Map<Integer, String> map = new HashMap<Integer, String>();
static {
map.put(0, "zero");
map.put(1, "one");
map.put(2, "two");
map.put(3, "three");
map.put(4, "four");
map.put(5, "five");
map.put(6, "six");
map.put(7, "seven");
map.put(8, "eight");
map.put(9, "nine");
map.put(10, "ten");
map.put(11, "eleven");
map.put(12, "twelve");
}
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String fileName = reader.readLine();
BufferedReader fileReader = new BufferedReader(new FileReader(fileName));
String s = "";
while ((s = fileReader.readLine()) != null) {
String[] strings = s.split(" ");
s = "";
for (int i = 0; i < strings.length; i++) {
if (strings[i].matches("\\d+")) {
int key = Integer.parseInt(strings[i]);
if (key > -1 && key < 13) {
strings[i] = map.get(key);
}
} else if (strings[i].matches("\\d+[\\.\\,]+")) {
char punctuation = strings[i].charAt(strings[i].length() - 1);
String digit = strings[i].substring(0, strings[i].length() - 1);
int key = Integer.parseInt(digit);
if (key > -1 && key < 13) {
strings[i] = map.get(key) + punctuation;
}
}
s = s + strings[i] + " ";
}
System.out.println(s.trim());
}
reader.close();
fileReader.close();
}
}
| [
"[email protected]"
] | |
8d4d5c1ff10b7eaf8145f669ed290b39162454e8 | 6a961e881194da44980f8a5aa68db272df6ac908 | /gamecores/minecraft-bungeecord/src/main/java/com/valaphee/cyclone/communication/packet/CryptographicRequestPacket.java | 3d7efea686136c857f2d613ebe11c03911c5911b | [
"BSD-2-Clause"
] | permissive | valaphee/Cyclone | 067b981d6fde0c47c3ff5c7091828f3b4143409f | b202797c81e94e4a3daeb89ce401896b178037e3 | refs/heads/master | 2023-07-17T23:55:55.935521 | 2021-08-25T13:40:55 | 2021-08-25T13:43:39 | 399,829,544 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,544 | java | /*
* Copyright (c) by Valaphee 2019.
*
* Licensed under the 4-clause BSD license (the "License");
* you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://deploy.valaphee.com/license/BSD-4-Clause.txt
*
* THIS SOFTWARE IS PROVIDED BY VALAPHEE "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
*/
package com.valaphee.cyclone.communication.packet;
import com.valaphee.cyclone.communication.Packet;
import com.valaphee.cyclone.communication.PacketBuffer;
import com.valaphee.cyclone.security.PublicIdentityCertificate;
import java.math.BigInteger;
/**
* Default
*
* @author valaphee
*/
public final class CryptographicRequestPacket
implements Packet<PacketProtocolSubscriber>
{
private PublicIdentityCertificate certificate;
private byte[] challenge;
public CryptographicRequestPacket()
{}
public CryptographicRequestPacket(final PublicIdentityCertificate certificate, final byte[] challenge)
{
this.certificate = certificate;
this.challenge = challenge;
}
public PublicIdentityCertificate getCertificate()
{
return certificate;
}
public byte[] getChallenge()
{
return challenge;
}
@Override
public void read(final PacketBuffer buffer)
{
final byte[] modulus = new byte[buffer.readUnsignedShort()];
buffer.readBytes(modulus);
final byte[] exponent = new byte[buffer.readUnsignedShort()];
buffer.readBytes(exponent);
final byte[] signature = new byte[buffer.readUnsignedShort()];
buffer.readBytes(signature);
certificate = new PublicIdentityCertificate(new BigInteger(modulus), new BigInteger(exponent), new BigInteger(signature));
challenge = new byte[buffer.readUnsignedShort()];
buffer.readBytes(challenge);
}
@Override
public void write(final PacketBuffer buffer)
{
final byte[] modulus = certificate.getModulus().toByteArray();
buffer.writeShort(modulus.length);
buffer.writeBytes(modulus);
final byte[] exponent = certificate.getExponent().toByteArray();
buffer.writeShort(exponent.length);
buffer.writeBytes(exponent);
final byte[] signature = certificate.getSignature().toByteArray();
buffer.writeShort(signature.length);
buffer.writeBytes(signature);
buffer.writeShort(challenge.length);
buffer.writeBytes(challenge);
}
@Override
public void handle(final PacketProtocolSubscriber subscriber)
{
subscriber.cryptographicRequest(this);
}
}
| [
"[email protected]"
] | |
f47fdaa3bb435c931203f0c216afaf3e3dc2b0a8 | ce237c2858d23b8f977d6a7e34f8da69ff8cc0c5 | /projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime/debug/LLVMDebugObjectBuilder.java | 1e00c894f9ba6f31accb5965f8aba4ec7c865de2 | [
"BSD-3-Clause",
"NCSA",
"MIT"
] | permissive | stabbylambda/sulong | 902bacc5e38cd302774c906208ef98902aeddb9d | 01a3eb502e7d0106876cc86206a1593638efa787 | refs/heads/master | 2020-03-19T08:29:58.405733 | 2018-06-05T12:19:31 | 2018-06-05T12:19:31 | 136,209,127 | 0 | 0 | null | 2018-06-05T17:02:45 | 2018-06-05T17:02:44 | null | UTF-8 | Java | false | false | 2,479 | java | /*
* Copyright (c) 2017, Oracle and/or its affiliates.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.oracle.truffle.llvm.runtime.debug;
import com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceLocation;
public abstract class LLVMDebugObjectBuilder {
public static final LLVMDebugObjectBuilder UNAVAILABLE = new LLVMDebugObjectBuilder() {
@Override
public LLVMDebugObject getValue(LLVMSourceType type, LLVMSourceLocation declaration) {
return LLVMDebugObject.instantiate(type, 0L, LLVMDebugValue.UNAVAILABLE, declaration);
}
};
protected LLVMDebugObjectBuilder() {
}
public LLVMDebugObject getValue(LLVMSourceSymbol symbol) {
if (symbol != null) {
return getValue(symbol.getType(), symbol.getLocation());
} else {
return getValue(LLVMSourceType.UNKNOWN, null);
}
}
public abstract LLVMDebugObject getValue(LLVMSourceType type, LLVMSourceLocation declaration);
}
| [
"[email protected]"
] | |
d30c44e0a5f6c31214a1a3bcbed1fd10cbf71d3f | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/training/org/apache/geode/internal/cache/partitioned/ColocatedRegionDetailsJUnitTest.java | a249743fc205ebe6cbb94e3221af83ec5366e8c8 | [] | 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 | 7,640 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License. You may obtain a
* copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package org.apache.geode.internal.cache.partitioned;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import org.junit.Assert;
import org.junit.Test;
public class ColocatedRegionDetailsJUnitTest {
@Test
public void testColocatedRegionDetailsConstructor() {
ColocatedRegionDetails crd = new ColocatedRegionDetails("host", "member name", "parent region", "child region");
Assert.assertNotNull(crd);
Assert.assertEquals("host", crd.getHost());
Assert.assertEquals("member name", crd.getMember());
Assert.assertEquals("parent region", crd.getParent());
Assert.assertEquals("child region", crd.getChild());
}
@Test
public void testColocatedRegion0ArgConstructor() {
ColocatedRegionDetails crd = new ColocatedRegionDetails();
Assert.assertNotNull(crd);
Assert.assertNull(crd.getHost());
Assert.assertNull(crd.getMember());
Assert.assertNull(crd.getParent());
Assert.assertNull(crd.getChild());
}
@Test
public void testConstructingWithNulls() {
ColocatedRegionDetails crd1 = new ColocatedRegionDetails(null, "member name", "parent region", "child region");
ColocatedRegionDetails crd2 = new ColocatedRegionDetails("host", null, "parent region", "child region");
ColocatedRegionDetails crd3 = new ColocatedRegionDetails("host", "member name", null, "child region");
ColocatedRegionDetails crd4 = new ColocatedRegionDetails("host", "member name", "parent region", null);
Assert.assertNotNull(crd1);
Assert.assertNotNull(crd2);
Assert.assertNotNull(crd3);
Assert.assertNotNull(crd4);
}
@Test
public void testSerialization() throws Exception {
ColocatedRegionDetails crd = new ColocatedRegionDetails("host", "member name", "parent region", "child region");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutput out = new DataOutputStream(baos);
crd.toData(out);
ColocatedRegionDetails crdIn = new ColocatedRegionDetails();
crdIn.fromData(new DataInputStream(new ByteArrayInputStream(baos.toByteArray())));
Assert.assertEquals(crd, crdIn);
}
@Test
public void testSerializationOfEmptyColocatedRegionDetails() throws Exception {
ColocatedRegionDetails crd = new ColocatedRegionDetails();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutput out = new DataOutputStream(baos);
crd.toData(out);
ColocatedRegionDetails crdIn = new ColocatedRegionDetails();
crdIn.fromData(new DataInputStream(new ByteArrayInputStream(baos.toByteArray())));
Assert.assertEquals(crd, crdIn);
}
@Test
public void testHostNotEquals() {
ColocatedRegionDetails crd1 = new ColocatedRegionDetails();
ColocatedRegionDetails crd2 = new ColocatedRegionDetails("host1", "member name", "parent region", "child region");
ColocatedRegionDetails crd3 = new ColocatedRegionDetails("host2", "member name", "parent region", "child region");
Assert.assertNotEquals(crd1, crd2);
Assert.assertNotEquals(crd2, crd3);
Assert.assertNotEquals(crd3, crd2);
}
@Test
public void testMemberNotEquals() {
ColocatedRegionDetails crd1 = new ColocatedRegionDetails("host", null, "parent region", "child region");
ColocatedRegionDetails crd2 = new ColocatedRegionDetails("host", "member1", "parent region", "child region");
ColocatedRegionDetails crd3 = new ColocatedRegionDetails("host", "member2", "parent region", "child region");
Assert.assertNotEquals(crd1, crd2);
Assert.assertNotEquals(crd2, crd3);
Assert.assertNotEquals(crd3, crd2);
}
@Test
public void testParentNotEquals() {
ColocatedRegionDetails crd1 = new ColocatedRegionDetails("host", "member1", null, "child region");
ColocatedRegionDetails crd2 = new ColocatedRegionDetails("host", "member1", "parent1", "child region");
ColocatedRegionDetails crd3 = new ColocatedRegionDetails("host", "member1", "parent2", "child region");
Assert.assertNotEquals(crd1, crd2);
Assert.assertNotEquals(crd2, crd3);
Assert.assertNotEquals(crd3, crd2);
}
@Test
public void testChildNotEquals() {
ColocatedRegionDetails crd1 = new ColocatedRegionDetails("host", "member1", "parent region", null);
ColocatedRegionDetails crd2 = new ColocatedRegionDetails("host", "member1", "parent region", "child1");
ColocatedRegionDetails crd3 = new ColocatedRegionDetails("host", "member1", "parent region", "child2");
Assert.assertNotEquals(crd1, crd2);
Assert.assertNotEquals(crd2, crd3);
Assert.assertNotEquals(crd3, crd2);
}
@Test
public void testClassInequality() {
ColocatedRegionDetails crd1 = new ColocatedRegionDetails("host", "member1", "parent region", null);
String crd2 = crd1.toString();
Assert.assertNotEquals(crd1, crd2);
Assert.assertNotEquals(crd2, crd1);
}
@Test
public void nullColocatedRegionDetailsEqualsTests() {
ColocatedRegionDetails crd1 = null;
ColocatedRegionDetails crd2 = new ColocatedRegionDetails("host", "member1", "parent region", "child1");
Assert.assertEquals(crd1, crd1);
Assert.assertEquals(crd2, crd2);
Assert.assertNotEquals(crd1, crd2);
Assert.assertNotEquals(crd2, crd1);
}
@Test
public void testToString() {
ColocatedRegionDetails crd = new ColocatedRegionDetails("host1", "member name", "parent region", "child region");
Assert.assertEquals("[host:host1, member:member name, parent:parent region, child:child region]", crd.toString());
}
@Test
public void testToStringOfEmptyColocatedRegionDetails() {
ColocatedRegionDetails crd = new ColocatedRegionDetails();
Assert.assertEquals("[,,,]", crd.toString());
}
@Test
public void testHashCode() {
ColocatedRegionDetails crd1 = new ColocatedRegionDetails();
ColocatedRegionDetails crd2 = new ColocatedRegionDetails("host1", "member name", "parent region", "child region");
ColocatedRegionDetails crd3 = new ColocatedRegionDetails("host2", "member name", "parent region", "child region");
Assert.assertNotEquals(crd1.hashCode(), crd2.hashCode());
Assert.assertNotEquals(crd1.hashCode(), crd3.hashCode());
Assert.assertNotEquals(crd2.hashCode(), crd3.hashCode());
Assert.assertEquals(923521, crd1.hashCode());
Assert.assertEquals(2077348855, crd2.hashCode());
Assert.assertEquals(2077378646, crd3.hashCode());
}
}
| [
"[email protected]"
] | |
fcc5feb99e8bec7c20b29040b67c67039bbdafb5 | 61a2665cac75e5083bfe9d9d82d0e5d32336cdae | /JimsBurgers.java | f38ede362643470ff087f3f7a8a2edb8b27a24cb | [] | no_license | abhiy77/Elite-FS | b6fb7c6f54c91a11f834812c257e0cdf4c9236d8 | 2812a05e03bf5a9e5ce8fb33c67d0d5cef5b4b70 | refs/heads/master | 2022-12-21T13:56:10.591242 | 2020-09-27T03:54:16 | 2020-09-27T03:54:16 | 287,303,635 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,765 | java | /* 14/04/2020 - HOME
* Jim's Burgers has a line of hungry customers.
Orders vary in the time it takes to prepare them.
Determine the order the customers receive their orders.
Start by numbering each of the customers from 1 to n, front of the line to the back.
You will then be given an order number and a preparation time for each customer.
The time of delivery is calculated as the sum of the order number and the preparation time.
If two orders are delivered at the same time,
assume they are delivered in ascending customer number order.
For example, there are n=5 customers in line.
They each receive an order number order[i] and a preparation time prep[i].:
Customer 1 2 3 4 5
Order No 8 5 6 2 4
Prep time 3 6 2 3 3
Calculate:
Serve time 11 11 8 5 7
We see that the orders are delivered to customers in the following order:
Order by:
Serve time 5 7 8 11 11
Customer 4 5 3 1 2
Input Format:
The first line contains an integer n, the number of customers.
Each of the next n lines contains two space-separated integers,
an order number and prep time for customer[i].
Output Format:
Print a single line of n space-separated customer numbers
(recall that customers are numbered from 1 to n)
that describes the sequence in which the customers receive their burgers.
If two or more customers receive their burgers at the same time,
print their numbers in ascending order.
Sample Input-1
3
1 3
2 3
3 3
Sample Output-1
1 2 3
Explanation-1
Jim has the following orders:
1. Order[1]=1, prep[1]=3. This order is delivered at time t=1+3=4 .
2. Order[2]=2, prep[2]=3. This order is delivered at time t=2+3=5 .
3. Order[3]=3, prep[3]=3. This order is delivered at time t=3+3=6 .
The orders were delivered in the same order as the customers stood in line.
The index in order[i] is the customer number and is what is printed.
In this case, the customer numbers match the order numbers.
Sample Input-2
5
8 1
4 2
5 6
3 1
4 3
Sample Output-2
4 2 5 1 3
Explanation-2
Jim has the following orders:
1. Order[1]=8, prep[1]=1. This order is delivered at time t=8+1=9.
1. Order[2]=4, prep[2]=2. This order is delivered at time t=4+2=6.
1. Order[3]=5, prep[3]=6. This order is delivered at time t=5+6=11.
1. Order[4]=3, prep[4]=1. This order is delivered at time t=3+1=4.
1. Order[5]=4, prep[5]=3. This order is delivered at time t=4+3=7.
When we order these by ascending fulfillment time, we get:
t=4: customer 4.
t=6: customer 2.
t=7: customer 5.
t=9: customer 1.
t=11: customer 3.
We print the ordered numbers in the bulleted listed above as 4 2 5 1 3.
Note: Any orders fulfilled at the same time must be listed by ascending order number.
========= Testcases Program-2 =========
case =1
input =3
1 3
2 3
3 3
output =1 2 3
case =2
input =5
8 1
4 2
5 6
3 1
4 3
output =4 2 5 1 3
case =3
input =2
1 1
1 1
output =1 2
case =4
input =25
122470 725261
193218 693005
355776 603340
830347 284246
974815 823134
251206 572501
55509 927152
299590 651593
222305 641645
984018 463771
494787 286091
217190 833029
820867 380896
744986 630663
875880 667
449199 520904
924615 511326
862614 890277
959638 373599
685864 923011
922324 407528
157354 943714
380643 714960
269853 608576
290422 195768
output =25 11 6 1 9 15 24 2 8 3 16 7 12 23 22 4 13 21 19 14 17 10 20 18 5
case =5
input =5
8 3
5 6
6 2
2 3
4 3
output =4 5 3 1 2
case =6
input =10
86 53
38 91
96 51
96 95
74 86
42 7
60 59
99 69
72 41
11 34
output =10 6 9 7 2 1 3 5 8 4
case =7
input =15
28 44
44 59
87 15
13 11
13 71
25 32
55 25
43 52
42 15
33 36
79 93
55 53
96 67
71 48
63 19
output =4 6 9 10 1 7 15 5 8 3 2 12 14 13 11
case =8
input =20
226 988
725 401
905 276
590 784
511 241
422 398
149 147
888 418
126 167
216 773
685 295
919 551
622 534
736 980
907 213
926 755
892 255
146 937
918 356
922 793
output =9 7 5 6 11 10 18 15 2 17 13 3 1 19 8 4 12 16 20 14
*/
package Elite;
import java.util.*;
public class JimsBurgers {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
LinkedList<Customer> customers = new LinkedList<>();
for(int i=0;i<n;i++) {
int orderNum = sc.nextInt();
int prepTime = sc.nextInt();
customers.add(new Customer(i+1, orderNum, prepTime));
}
Collections.sort(customers);
for(Customer customer : customers) {
System.out.print(customer.index + " ");
}
}
}
class Customer implements Comparable<Customer>{
int index,orderNo,prepTime;
public Customer(int index,int order_no, int prep_time) {
this.index = index;
this.orderNo = order_no;
this.prepTime = prep_time;
}
@Override
public int compareTo(Customer o) {
int sum1 = orderNo + prepTime;
int sum2 = o.orderNo + o.prepTime;
if(sum1 == sum2) return index - o.index;
else return sum1 - sum2;
}
} | [
"[email protected]"
] | |
4674f768ab25e60cd1c11154d374c9250293fea0 | f94b4ae7330a33647171d1d7b5874e81e1b9a99b | /jewels/src/cn/perfectgames/jewels/animation/ScoreBoardAnimation.java | 9d138ce4e47355894749366fcc9e61d41e84ef4e | [] | no_license | devinxutal/linuxpractice | 6d617f2b13390d0c9343a69caf900bce090a12f8 | 28d7797154110ca238ddda8713a6daff97dc7e2a | refs/heads/master | 2020-05-19T16:30:09.734738 | 2011-12-13T16:38:38 | 2011-12-13T16:38:38 | 32,123,432 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,970 | java | package cn.perfectgames.jewels.animation;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import cn.perfectgames.amaze.animation.AbstractAnimation;
import cn.perfectgames.jewels.GoJewelsApplication;
import cn.perfectgames.jewels.cfg.Constants;
import cn.perfectgames.jewels.util.BitmapUtil;
public class ScoreBoardAnimation extends AbstractAnimation {
public static final int FRAMES_PER_FLIP = Constants.FPS*400 /1000 ;
private int digitNUM;
private Bitmap[] digits;
private Rect rect;
private Paint paint;
private int score;
private int[] froms;
private int[] tos;
private int asiFrom =0; // alpha start index
private int asiTo = 0; // alpha start index
public ScoreBoardAnimation(int digitNum) {
super(FRAMES_PER_FLIP*2, true);
this.digitNUM = digitNum;
froms = new int[digitNum];
tos = new int[digitNum];
digits = new Bitmap[digitNUM];
paint = new Paint();
paint.setAntiAlias(true);
}
public void setRect(Rect rect) {
if (digits != null) {
for (Bitmap b : digits) {
if (b != null) {
b.recycle();
}
}
}
digits = new Bitmap[10];
for (int i = 0; i <= 9; i++) {
digits[i] = GoJewelsApplication.getBitmapUtil().getBitmap(
"images/digits/style1/" + i + ".png");
}
int w = digits[0].getWidth();
int h = digits[0].getHeight();
int aw = rect.width() / digitNUM;
int ah = rect.height();
double scale = Math.min(aw / (double) w, ah / (double) h);
aw = (int) (scale * w);
ah = (int) (scale * h);
this.rect = new Rect(rect.left + (rect.width() - digitNUM* aw) / 2, rect.top
+ (rect.height() - ah) / 2, rect.left
+ (rect.width() + digitNUM * aw) / 2, rect.top + (rect.height() + ah)
/ 2);
for (int i = 0; i <= 9; i++) {
Bitmap tmp = digits[i];
digits[i] = Bitmap.createScaledBitmap(tmp, aw, ah, true);
tmp.recycle();
}
}
@Override
protected void innerDraw(Canvas canvas, int current, int total) {
int ALPHA_TRANSPARENT = 100;
int ALPHA_SOLID = 255;
if (current < 0) {
// draw static score
int sc = this.score;
for (int i = digitNUM - 1; i >= 0; i--) {
int d = sc % 10;
if (i != digitNUM - 1 && sc == 0) {
paint.setAlpha(ALPHA_TRANSPARENT);
} else {
paint.setAlpha(ALPHA_SOLID);
}
canvas.drawBitmap(digits[d], rect.left + rect.width() * i
/ digitNUM, rect.top, paint);
sc /= 10;
}
} else {
// draw animated score
Rect bitmapRect = new Rect(0, 0, digits[0].getWidth(), digits[0].getHeight());
RectF toRect = new RectF();
for(int i = 0; i< froms.length; i++){
int alpha = ALPHA_SOLID;
Bitmap digit = digits[froms[i]];
int asi = asiFrom;
int ii = current;
if( current >= FRAMES_PER_FLIP){
ii = FRAMES_PER_FLIP*2 - current;
asi = asiTo;
digit = digits[tos[i]];
}
if(i<asi){
alpha = ALPHA_TRANSPARENT;
}
paint.setAlpha(alpha);
if(froms[i] == tos[i]){
canvas.drawBitmap(digit, rect.left + rect.width() * i
/ digitNUM, rect.top, paint);
}else{
float delta = ii * digit.getWidth() / FRAMES_PER_FLIP /2;
toRect.left = rect.left + rect.width() * i
/ digitNUM+ delta;
toRect.right = toRect.left + digit.getWidth() - 2 * delta;
toRect.top = rect.top;
toRect.bottom = rect.top+ digit.getHeight();
canvas.drawBitmap(digit, bitmapRect, toRect, paint);
}
}
}
}
public void setNewScore(int score) {
int old = this.score;
int neww = score;
asiFrom = asiTo = -1;
for (int i = digitNUM - 1; i >= 0; i--) {
froms[i] = old % 10;
tos[i] = neww % 10;
old /=10;
neww /= 10;
if(old == 0 && asiFrom <0){
asiFrom = i;
}
if(neww == 0 && asiTo <0){
asiTo = i;
}
}
this.score = score;
}
}
| [
"devinxutal@e9fc91c1-ad2e-0410-897a-033cf2015968"
] | devinxutal@e9fc91c1-ad2e-0410-897a-033cf2015968 |
036ac0aa9e7e11532a2a04239a75dfb1c30dba1f | 061bc4c2d980f5f60baa9ff04b2852d8be1e38a6 | /app/src/main/java/cn/scujcc/bug/bitcoinplatformandroid/activity/ActualTransactionCandlestickChartsActivity.java | bd1398ab94f36e97282c4285e11dc352760728da | [
"Apache-2.0"
] | permissive | dujiajucode/BitCoinPlatformAndroid | 54d66389e97f51b07dbedfb728ef76bcc1caea9f | cda835e611f424b7f18181e5362c639a91b5b9fb | refs/heads/master | 2021-01-21T21:33:24.215454 | 2016-05-27T03:18:21 | 2016-05-27T03:18:21 | 54,827,517 | 2 | 1 | null | 2016-04-25T02:35:07 | 2016-03-27T12:31:48 | Java | UTF-8 | Java | false | false | 12,525 | java | /*
* Apache License
* Version 2.0, January 2004
* http://www.apache.org/licenses/
*
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
*
* 1. Definitions.
*
* "License" shall mean the terms and conditions for use, reproduction,
* and distribution as defined by Sections 1 through 9 of this document.
*
* "Licensor" shall mean the copyright owner or entity authorized by
* the copyright owner that is granting the License.
*
* "Legal Entity" shall mean the union of the acting entity and all
* other entities that control, are controlled by, or are under common
* control with that entity. For the purposes of this definition,
* "control" means (i) the power, direct or indirect, to cause the
* direction or management of such entity, whether by contract or
* otherwise, or (ii) ownership of fifty percent (50%) or more of the
* outstanding shares, or (iii) beneficial ownership of such entity.
*
* "You" (or "Your") shall mean an individual or Legal Entity
* exercising permissions granted by this License.
*
* "Source" form shall mean the preferred form for making modifications,
* including but not limited to software source code, documentation
* source, and configuration files.
*
* "Object" form shall mean any form resulting from mechanical
* transformation or translation of a Source form, including but
* not limited to compiled object code, generated documentation,
* and conversions to other media types.
*
* "Work" shall mean the work of authorship, whether in Source or
* Object form, made available under the License, as indicated by a
* copyright notice that is included in or attached to the work
* (an example is provided in the Appendix below).
*
* "Derivative Works" shall mean any work, whether in Source or Object
* form, that is based on (or derived from) the Work and for which the
* editorial revisions, annotations, elaborations, or other modifications
* represent, as a whole, an original work of authorship. For the purposes
* of this License, Derivative Works shall not include works that remain
* separable from, or merely link (or bind by name) to the interfaces of,
* the Work and Derivative Works thereof.
*
* "Contribution" shall mean any work of authorship, including
* the original version of the Work and any modifications or additions
* to that Work or Derivative Works thereof, that is intentionally
* submitted to Licensor for inclusion in the Work by the copyright owner
* or by an individual or Legal Entity authorized to submit on behalf of
* the copyright owner. For the purposes of this definition, "submitted"
* means any form of electronic, verbal, or written communication sent
* to the Licensor or its representatives, including but not limited to
* communication on electronic mailing lists, source code control systems,
* and issue tracking systems that are managed by, or on behalf of, the
* Licensor for the purpose of discussing and improving the Work, but
* excluding communication that is conspicuously marked or otherwise
* designated in writing by the copyright owner as "Not a Contribution."
*
* "Contributor" shall mean Licensor and any individual or Legal Entity
* on behalf of whom a Contribution has been received by Licensor and
* subsequently incorporated within the Work.
*
* 2. Grant of Copyright License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* copyright license to reproduce, prepare Derivative Works of,
* publicly display, publicly perform, sublicense, and distribute the
* Work and such Derivative Works in Source or Object form.
*
* 3. Grant of Patent License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* (except as stated in this section) patent license to make, have made,
* use, offer to sell, sell, import, and otherwise transfer the Work,
* where such license applies only to those patent claims licensable
* by such Contributor that are necessarily infringed by their
* Contribution(s) alone or by combination of their Contribution(s)
* with the Work to which such Contribution(s) was submitted. If You
* institute patent litigation against any entity (including a
* cross-claim or counterclaim in a lawsuit) alleging that the Work
* or a Contribution incorporated within the Work constitutes direct
* or contributory patent infringement, then any patent licenses
* granted to You under this License for that Work shall terminate
* as of the date such litigation is filed.
*
* 4. Redistribution. You may reproduce and distribute copies of the
* Work or Derivative Works thereof in any medium, with or without
* modifications, and in Source or Object form, provided that You
* meet the following conditions:
*
* (a) You must give any other recipients of the Work or
* Derivative Works a copy of this License; and
*
* (b) You must cause any modified files to carry prominent notices
* stating that You changed the files; and
*
* (c) You must retain, in the Source form of any Derivative Works
* that You distribute, all copyright, patent, trademark, and
* attribution notices from the Source form of the Work,
* excluding those notices that do not pertain to any part of
* the Derivative Works; and
*
* (d) If the Work includes a "NOTICE" text file as part of its
* distribution, then any Derivative Works that You distribute must
* include a readable copy of the attribution notices contained
* within such NOTICE file, excluding those notices that do not
* pertain to any part of the Derivative Works, in at least one
* of the following places: within a NOTICE text file distributed
* as part of the Derivative Works; within the Source form or
* documentation, if provided along with the Derivative Works; or,
* within a display generated by the Derivative Works, if and
* wherever such third-party notices normally appear. The contents
* of the NOTICE file are for informational purposes only and
* do not modify the License. You may add Your own attribution
* notices within Derivative Works that You distribute, alongside
* or as an addendum to the NOTICE text from the Work, provided
* that such additional attribution notices cannot be construed
* as modifying the License.
*
* You may add Your own copyright statement to Your modifications and
* may provide additional or different license terms and conditions
* for use, reproduction, or distribution of Your modifications, or
* for any such Derivative Works as a whole, provided Your use,
* reproduction, and distribution of the Work otherwise complies with
* the conditions stated in this License.
*
* 5. Submission of Contributions. Unless You explicitly state otherwise,
* any Contribution intentionally submitted for inclusion in the Work
* by You to the Licensor shall be under the terms and conditions of
* this License, without any additional terms or conditions.
* Notwithstanding the above, nothing herein shall supersede or modify
* the terms of any separate license agreement you may have executed
* with Licensor regarding such Contributions.
*
* 6. Trademarks. This License does not grant permission to use the trade
* names, trademarks, service marks, or product names of the Licensor,
* except as required for reasonable and customary use in describing the
* origin of the Work and reproducing the content of the NOTICE file.
*
* 7. Disclaimer of Warranty. Unless required by applicable law or
* agreed to in writing, Licensor provides the Work (and each
* Contributor provides its Contributions) on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied, including, without limitation, any warranties or conditions
* of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
* PARTICULAR PURPOSE. You are solely responsible for determining the
* appropriateness of using or redistributing the Work and assume any
* risks associated with Your exercise of permissions under this License.
*
* 8. Limitation of Liability. In no event and under no legal theory,
* whether in tort (including negligence), contract, or otherwise,
* unless required by applicable law (such as deliberate and grossly
* negligent acts) or agreed to in writing, shall any Contributor be
* liable to You for damages, including any direct, indirect, special,
* incidental, or consequential damages of any character arising as a
* result of this License or out of the use or inability to use the
* Work (including but not limited to damages for loss of goodwill,
* work stoppage, computer failure or malfunction, or any and all
* other commercial damages or losses), even if such Contributor
* has been advised of the possibility of such damages.
*
* 9. Accepting Warranty or Additional Liability. While redistributing
* the Work or Derivative Works thereof, You may choose to offer,
* and charge a fee for, acceptance of support, warranty, indemnity,
* or other liability obligations and/or rights consistent with this
* License. However, in accepting such obligations, You may act only
* on Your own behalf and on Your sole responsibility, not on behalf
* of any other Contributor, and only if You agree to indemnify,
* defend, and hold each Contributor harmless for any liability
* incurred by, or claims asserted against, such Contributor by reason
* of your accepting any such warranty or additional liability.
*
* END OF TERMS AND CONDITIONS
*
*
* Copyright (c) Bug 2016.
*
*
*/
package cn.scujcc.bug.bitcoinplatformandroid.activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import cn.scujcc.bug.bitcoinplatformandroid.R;
import cn.scujcc.bug.bitcoinplatformandroid.fragment.CandlestickChartsFragment;
/**
* Created by lilujia on 16/5/3.
*/
public class ActualTransactionCandlestickChartsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_toolbar_fragment);
FragmentManager fragmentManager = getFragmentManager();
Fragment fragment = fragmentManager.findFragmentById(R.id.fragmentContainer);
if (fragment == null) {
fragment = new
CandlestickChartsFragment();
Bundle atChartsBundle = new Bundle();
atChartsBundle.putBoolean(CandlestickChartsFragment.ARGS_IS_FULL, true);
fragment.setArguments(atChartsBundle);
fragmentManager.beginTransaction().add(R.id.fragmentContainer, fragment).commit();
} else {
Bundle atChartsBundle = new Bundle();
atChartsBundle.putBoolean(CandlestickChartsFragment.ARGS_IS_FULL, true);
fragment.setArguments(atChartsBundle);
}
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
if (toolbar != null) {
toolbar.setTitle("K线图");
setSupportActionBar(toolbar);
}
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
@Override
protected void onResume() {
super.onResume();
MainActivity.MAIN_INDEX = 0;
}
}
| [
"[email protected]"
] | |
a284c6dc367f43190c8541ed93c3aacfcf51b382 | 8d98b49eb7b75ce49c3f918e6497f7434524a3ab | /src/main/java/org/openwms/wms/receiving/transport/impl/TransportUnitServiceImpl.java | 49a9f4196092819a2e3eeb0e651f81dab6e854ce | [
"Apache-2.0"
] | permissive | qqsskk/org.openwms.wms.receiving | cd4a1340433b74f80c5883f39f1a068810870d21 | 84c97cb31e5f3af0d5218ebfd5f2e260db0616f4 | refs/heads/master | 2022-09-03T05:45:36.622187 | 2020-05-25T21:53:22 | 2020-05-25T21:53:22 | 267,795,276 | 0 | 1 | Apache-2.0 | 2020-05-29T07:33:30 | 2020-05-29T07:33:29 | null | UTF-8 | Java | false | false | 1,669 | java | /*
* Copyright 2005-2020 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.openwms.wms.receiving.transport.impl;
import org.ameba.annotation.TxService;
import org.openwms.wms.receiving.transport.TransportUnit;
import org.openwms.wms.receiving.transport.TransportUnitService;
import org.springframework.util.Assert;
/**
* A TransportUnitServiceImpl.
*
* @author Heiko Scherrer
*/
@TxService
class TransportUnitServiceImpl implements TransportUnitService {
private final TransportUnitRepository repository;
public TransportUnitServiceImpl(TransportUnitRepository repository) {
this.repository = repository;
}
@Override
public TransportUnit upsert(TransportUnit transportUnit) {
Assert.notNull(transportUnit, "transportUnit must not be null");
Assert.hasText(transportUnit.getBarcode(), "barcode of TransportUnit must be set before saving");
TransportUnit merged = repository.findByBarcode(transportUnit.getBarcode()).orElse(transportUnit);
merged.setActualLocation(transportUnit.getActualLocation());
return repository.save(merged);
}
}
| [
"[email protected]"
] | |
ea365c1fd1989a402402b7203add483ac25ca158 | 2b7599a4f8560e332e72ecfd24e0e6eaa8c4335c | /client/Android/app/src/main/java/com/example/deuzumrehacer/InicioSesion.java | d15ed0ef92bf50103d633c58d52572e222b195e1 | [] | no_license | futotta-risu/deuZum | 3dabf92c89b7afce6b7ccf7b6039c95eb91ef7ec | b1edfd73e15a8a9b9984481dc8e0f5ed07839eb2 | refs/heads/master | 2021-07-09T00:29:25.744543 | 2020-01-12T22:42:19 | 2020-01-12T22:42:19 | 202,737,808 | 3 | 0 | null | 2020-10-13T18:00:11 | 2019-08-16T14:02:56 | Java | UTF-8 | Java | false | false | 2,851 | java | package com.example.deuzumrehacer;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import org.json.JSONException;
import org.json.JSONObject;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.logging.Level;
import java.util.logging.Logger;
public class InicioSesion extends AppCompatActivity {
private EditText nUsuario;
private EditText cUsuario;
private TextView tLogin;
private Button bIni;
private Button bReg;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_inicio_sesion);
nUsuario = findViewById(R.id.nomUsuario);
cUsuario = findViewById(R.id.contrUsuario);
tLogin = findViewById(R.id.textoLogin);
bIni = findViewById(R.id.botonIni);
bReg = findViewById(R.id.botonRegis);
Logger logger = Logger.getLogger(InicioSesion.class.getName());
logger.log(Level.INFO, "1");
logger.log(Level.WARNING, "2");
bIni.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
comprobarUsuarioContraseña();
}
});
bReg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
abrirCrearUsuario1();
}
});
}
public void comprobarUsuarioContraseña() {
JSONObject data = new JSONObject();
try {
data.put("useuario",nUsuario.getText().toString());
data.put("pass",cUsuario.getText().toString());
} catch (JSONException e) {
e.printStackTrace();
}
Thread t1 = new Thread(new MessageSender("logUser", data));
t1.start();
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
if(ServerRespond.result.equals("1")){
Toast toast= Toast. makeText(getApplicationContext(),"Conectado:"+ServerRespond.result,Toast. LENGTH_SHORT);
toast. setMargin(50,50);
toast. show();
}else{
Toast toast= Toast. makeText(getApplicationContext(),"Contraseña equivocada:"+ServerRespond.result,Toast. LENGTH_SHORT);
toast. setMargin(50,50);
toast. show();
}
}
public void abrirCrearUsuario1() {
Intent i = new Intent(this, CrearUsuario.class);
startActivity(i);
}
}
| [
"[email protected]"
] | |
95cd710f830757313f3f4cf01e199de2d77a90f4 | b72c102d6006dbe4d329c6c442c31f0574ed819b | /Clases_Java_Ciclo2/src/main/java/com/CCamiiloACastro/Clases_Java_Ciclo2/Semana1/Ejercicio1.java | 983173af764cc8b9cc86043f7273e78eb0949e9c | [] | no_license | CCamiloACastro/Java_Ciclo2 | 98896eae8c4eb1c5e5945343305ef81cd0e307f7 | dc63aab2154bde0651e4e8c773aedb18e30e9c28 | refs/heads/master | 2023-07-25T19:19:32.914693 | 2021-08-11T08:05:52 | 2021-08-11T08:05:52 | 391,092,389 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 506 | java | package com.CCamiiloACastro.Clases_Java_Ciclo2.Semana1;
import java.util.Scanner;
/**
* Hello world!
*
*/
public class Ejercicio1
{
public static void main( String[] args )
{
var sc = new Scanner (System.in);
System.out.println("Dime tu nombre:");
var nombre = sc.nextLine();
//var nombre = "Camilin";
System.out.println(saludo(nombre));
}
public static String saludo(String nombre) {
return "Hola " + nombre + "!!! Como vas?";
}
}
| [
"[email protected]"
] |
Subsets and Splits