blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
a5a0198b8655d0105c6ee5e1394e3c840da25dab
e1ee5932fc443bc797be25f3a6d199d2093e8f57
/src/test/java/testingClassData/UserLoginTests.java
e29c0fd442f6f11c26c912dffcc12740c1c1b543
[ "ISC" ]
permissive
nadvolod/selenium-java
f82b91629383e031eb359f05bfe552397594be1a
dc0776d8e61811a1f2f53d5d0e4c3b223765f9b4
refs/heads/master
2023-06-01T02:51:24.489439
2023-03-07T19:17:25
2023-03-07T19:17:25
239,385,671
55
65
ISC
2023-05-09T18:57:31
2020-02-09T22:42:51
Java
UTF-8
Java
false
false
1,430
java
package testingClassData; import io.github.bonigarcia.wdm.WebDriverManager; import junitparams.JUnitParamsRunner; import junitparams.Parameters; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; // We need to add an annotation to the class to instruct it that the tests will run using parameters @RunWith(JUnitParamsRunner.class) public class UserLoginTests { WebDriver driver; private WebDriver getDriver() { return new ChromeDriver(); } @Before public void setup() { WebDriverManager.chromedriver().setup(); driver = getDriver(); driver.get("https://www.saucedemo.com/"); } @After public void tearDown() { driver.quit(); } // In our test, we simply need to pass the data provider class to let the test know where the parameters come from: @Test @Parameters(source = UserDataProvider.class) public void loginTest(String userName, String password) { driver.findElement(By.id("user-name")).sendKeys(userName); driver.findElement(By.id("password")).sendKeys(password); driver.findElement(By.id("login-button")).click(); Assert.assertTrue(driver.findElement(By.className("title")).isDisplayed()); } }
[ "noreply@github.com" ]
nadvolod.noreply@github.com
d38ff527a1b4b58c5c09aee536927e7743388fb8
036e3ae9391640e7741ae02f2e337dfcef65ee3a
/app/src/main/java/com/ftninformatika/favoritesmovies/model/NavigationItem.java
0cd74b475fd9fe9ae918aff50b45cba9df78038f
[]
no_license
Kisker/FavoritesMovies
e390ed198cf3111898ca831577f786d861b308b9
4272a381ba9d1a51d74080086b060b1fb2b7ed37
refs/heads/master
2023-01-24T18:02:38.576081
2020-11-30T20:14:51
2020-11-30T20:14:51
317,335,040
0
0
null
null
null
null
UTF-8
Java
false
false
721
java
package com.ftninformatika.favoritesmovies.model; public class NavigationItem { private String title, subtitle; private int icon; public NavigationItem(String title, String subtitle, int icon) { this.title = title; this.subtitle = subtitle; this.icon = icon; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getSubtitle() { return subtitle; } public void setSubtitle(String subtitle) { this.subtitle = subtitle; } public int getIcon() { return icon; } public void setIcon(int icon) { this.icon = icon; } }
[ "zivkovic.sveto@gmail.com" ]
zivkovic.sveto@gmail.com
5906da0787550f081d060a6a6001c3a760b6b9a7
4335c87ce1d410a5d60023cb63c16e871387e2c6
/src/test/java/tests/SelenideCheckIssueTest.java
1721c060fc895db7ffee99f15b6138a3a85a856b
[]
no_license
Kratakey/QGHM6
25e1d694fca7f54fc8a52b05d5ab7cdc8831f42d
dc7f97ca5f2c5d96ff79a90261efdc75584c69a7
refs/heads/master
2023-08-04T18:14:42.654041
2021-09-19T22:31:37
2021-09-19T22:31:37
382,900,722
0
0
null
null
null
null
UTF-8
Java
false
false
492
java
package tests; import org.junit.jupiter.api.Test; import pages.CheckIssuePages; public class SelenideCheckIssueTest extends config.TestBase { String url = "https://github.com", repository = "amd/scalapack", issue_number = "4"; CheckIssuePages act = new CheckIssuePages(); @Test void issueTest() { act.openPage(url); act.findRepository(repository); act.openIssuesTab(); act.checkIssueNumber(issue_number); } }
[ "Kratakey@gmail.com" ]
Kratakey@gmail.com
c3fb195a4fccd62e3643694ecf7692a4a46fbc47
d42277640e910ebbb92fea0735b37700be9701ea
/AR-Web/src/ar/edu/uade/tic/tesis/arweb/modelo/tecnicas/generales/TecnicaG188.java
3df0e4d30c3ce27df278abeaee290075c10a60bc
[]
no_license
olivarimaximilianoUADE/ARWeb
9b135d8a626416f8c47ff43e6dfc646557340695
01de0cff3153f2a31d44f086bd8841a847289c38
refs/heads/master
2020-03-28T00:03:42.542695
2018-09-07T23:59:01
2018-09-07T23:59:01
147,371,812
0
0
null
null
null
null
ISO-8859-1
Java
false
false
2,623
java
package ar.edu.uade.tic.tesis.arweb.modelo.tecnicas.generales; import ar.edu.uade.tic.tesis.arweb.modelo.evaluacion.ResultadoEvaluacionTecnica; import ar.edu.uade.tic.tesis.arweb.modelo.evaluacion.ResultadoEvaluacionTecnicaItem; import ar.edu.uade.tic.tesis.arweb.modelo.evaluacion.TipoResultadoEvaluacion; import ar.edu.uade.tic.tesis.arweb.modelo.evaluacion.Tipologia; import ar.edu.uade.tic.tesis.arweb.modelo.tecnicas.CategoriaTecnica; import ar.edu.uade.tic.tesis.arweb.util.parser.Parseador; public class TecnicaG188 extends TecnicaGeneral { public TecnicaG188(CategoriaTecnica categoriaTecnica) { super( "G188", "Proporcionar un botón en la página para aumentar espacios de línea y espacios de párrafo.", "Muchas personas con discapacidades cognitivas tienen problemas para leer textos separados por espacios simples. Un botón que aumenta la altura de la línea les ayudará a leer el contenido. Para mantener la separación de los párrafos, el espacio entre los párrafos también debe aumentar, de modo que sea al menos 1,5 veces más alto que el espaciado entre líneas.", categoriaTecnica); } /** * 1. Compruebe que haya un botón o enlace en la página que aumente el tamaño de la altura de la línea y el espaciado entre párrafos, que está etiquetado como tal. * 2. Activa el botón o enlace. * 3. Compruebe que el botón o enlace aumenta la altura de la línea a al menos 1,5 (150%) * 4. Compruebe que el botón o enlace aumenta el espaciado entre párrafos al menos 1,5 veces mayor que el espaciado entre líneas. */ public ResultadoEvaluacionTecnica validarAccesibilidadPorTecnica(Parseador parseador) { this.setParseador(parseador); ResultadoEvaluacionTecnica resultadoEvaluacionTecnica = new ResultadoEvaluacionTecnica(this); ResultadoEvaluacionTecnicaItem comprobacionAumentoEspacioLineasYEntreParrafos = new ResultadoEvaluacionTecnicaItem( Tipologia.PAGINA_WEB, "Botón que aumente el espacio de lineas y de párrafos.", TipoResultadoEvaluacion.IMPOSIBLE, "Verificar que el sitio cuenta con un botón o enlace que aumente el tamaño de la altura de la línea y el espacio entre los párrafos.", "El sitio debe tener una opción para aumentar la altura de la línea al menos en 1,5 (150%) y el espacio entre párrados al menos 1,5 veces mayor al espacio entre líneas."); comprobacionAumentoEspacioLineasYEntreParrafos.procesar(); resultadoEvaluacionTecnica.agregarResultadoEvaluacionTecnicaItem(comprobacionAumentoEspacioLineasYEntreParrafos); return resultadoEvaluacionTecnica; } }
[ "molivari@ARHQ001LT078.central.manpower.com.ar" ]
molivari@ARHQ001LT078.central.manpower.com.ar
9b476f17504ceb6fa747da44f363af7053cae909
7413efa7a69b237e702a96dd5fc8bfdedf72c811
/annot8-components-spacy/src/main/java/org/openapi/spacy/ApiClient.java
55067637277c0c686556796c8e91d00a80450d5b
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-proprietary-license" ]
permissive
annot8/annot8-components
0442bdafbee29b5fc800a6676a64335dbecc3e4f
dc7580e74a479961be6d45da8c6bc4655ca27eef
refs/heads/develop
2022-09-17T21:27:00.892804
2022-05-06T13:25:39
2022-05-06T13:25:39
207,294,286
2
5
Apache-2.0
2022-09-01T23:49:49
2019-09-09T11:33:50
Java
UTF-8
Java
false
false
11,772
java
/* Annot8 (annot8.io) - Licensed under Apache-2.0. */ package org.openapi.spacy; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import java.io.InputStream; import java.net.URI; import java.net.URLEncoder; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.nio.charset.Charset; import java.time.Duration; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.StringJoiner; import java.util.function.Consumer; import java.util.stream.Collectors; import org.openapitools.jackson.nullable.JsonNullableModule; /** * Configuration and utility class for API clients. * * <p>This class can be constructed and modified, then used to instantiate the various API classes. * The API classes use the settings in this class to configure themselves, but otherwise do not * store a link to this class. * * <p>This class is mutable and not synchronized, so it is not thread-safe. The API classes * generated from this are immutable and thread-safe. * * <p>The setter methods of this class return the current object to facilitate a fluent style of * configuration. */ @javax.annotation.processing.Generated( value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2021-04-21T10:03:16.456502+01:00[Europe/London]") public class ApiClient { private static final Charset UTF_8 = Charset.forName("UTF-8"); private HttpClient.Builder builder; private ObjectMapper mapper; private String scheme; private String host; private int port; private String basePath; private Consumer<HttpRequest.Builder> interceptor; private Consumer<HttpResponse<InputStream>> responseInterceptor; private Duration readTimeout; private static String valueToString(Object value) { if (value == null) { return ""; } if (value instanceof OffsetDateTime) { return ((OffsetDateTime) value).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); } return value.toString(); } /** * URL encode a string in the UTF-8 encoding. * * @param s String to encode. * @return URL-encoded representation of the input string. */ public static String urlEncode(String s) { return URLEncoder.encode(s, UTF_8); } /** * Convert a URL query name/value parameter to a list of encoded {@link Pair} objects. * * <p>The value can be null, in which case an empty list is returned. * * @param name The query name parameter. * @param value The query value, which may not be a collection but may be null. * @return A singleton list of the {@link Pair} objects representing the input parameters, which * is encoded for use in a URL. If the value is null, an empty list is returned. */ public static List<Pair> parameterToPairs(String name, Object value) { if (name == null || name.isEmpty() || value == null) { return Collections.emptyList(); } return Collections.singletonList(new Pair(urlEncode(name), urlEncode(valueToString(value)))); } /** * Convert a URL query name/collection parameter to a list of encoded {@link Pair} objects. * * @param collectionFormat The swagger collectionFormat string (csv, tsv, etc). * @param name The query name parameter. * @param values A collection of values for the given query name, which may be null. * @return A list of {@link Pair} objects representing the input parameters, which is encoded for * use in a URL. If the values collection is null, an empty list is returned. */ public static List<Pair> parameterToPairs( String collectionFormat, String name, Collection<?> values) { if (name == null || name.isEmpty() || values == null || values.isEmpty()) { return Collections.emptyList(); } // get the collection format (default: csv) String format = collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat; // create the params based on the collection format if ("multi".equals(format)) { return values.stream() .map(value -> new Pair(urlEncode(name), urlEncode(valueToString(value)))) .collect(Collectors.toList()); } String delimiter; switch (format) { case "csv": delimiter = urlEncode(","); break; case "ssv": delimiter = urlEncode(" "); break; case "tsv": delimiter = urlEncode("\t"); break; case "pipes": delimiter = urlEncode("|"); break; default: throw new IllegalArgumentException("Illegal collection format: " + collectionFormat); } StringJoiner joiner = new StringJoiner(delimiter); for (Object value : values) { joiner.add(urlEncode(valueToString(value))); } return Collections.singletonList(new Pair(urlEncode(name), joiner.toString())); } /** Ctor. */ public ApiClient() { this.builder = createDefaultHttpClientBuilder(); this.mapper = createDefaultObjectMapper(); updateBaseUri(getDefaultBaseUri()); interceptor = null; readTimeout = null; responseInterceptor = null; } /** Ctor. */ public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri) { this.builder = builder; this.mapper = mapper; updateBaseUri(baseUri); interceptor = null; readTimeout = null; responseInterceptor = null; } protected ObjectMapper createDefaultObjectMapper() { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false); mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); mapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); mapper.registerModule(new JavaTimeModule()); mapper.registerModule(new JsonNullableModule()); return mapper; } protected String getDefaultBaseUri() { return "http://localhost:8000"; } protected HttpClient.Builder createDefaultHttpClientBuilder() { return HttpClient.newBuilder(); } public void updateBaseUri(String baseUri) { URI uri = URI.create(baseUri); scheme = uri.getScheme(); host = uri.getHost(); port = uri.getPort(); basePath = uri.getRawPath(); } /** * Set a custom {@link HttpClient.Builder} object to use when creating the {@link HttpClient} that * is used by the API client. * * @param builder Custom client builder. * @return This object. */ public ApiClient setHttpClientBuilder(HttpClient.Builder builder) { this.builder = builder; return this; } /** * Get an {@link HttpClient} based on the current {@link HttpClient.Builder}. * * <p>The returned object is immutable and thread-safe. * * @return The HTTP client. */ public HttpClient getHttpClient() { return builder.build(); } /** * Set a custom {@link ObjectMapper} to serialize and deserialize the request and response bodies. * * @param mapper Custom object mapper. * @return This object. */ public ApiClient setObjectMapper(ObjectMapper mapper) { this.mapper = mapper; return this; } /** * Get a copy of the current {@link ObjectMapper}. * * @return A copy of the current object mapper. */ public ObjectMapper getObjectMapper() { return mapper.copy(); } /** * Set a custom host name for the target service. * * @param host The host name of the target service. * @return This object. */ public ApiClient setHost(String host) { this.host = host; return this; } /** * Set a custom port number for the target service. * * @param port The port of the target service. Set this to -1 to reset the value to the default * for the scheme. * @return This object. */ public ApiClient setPort(int port) { this.port = port; return this; } /** * Set a custom base path for the target service, for example '/v2'. * * @param basePath The base path against which the rest of the path is resolved. * @return This object. */ public ApiClient setBasePath(String basePath) { this.basePath = basePath; return this; } /** * Get the base URI to resolve the endpoint paths against. * * @return The complete base URI that the rest of the API parameters are resolved against. */ public String getBaseUri() { return scheme + "://" + host + (port == -1 ? "" : ":" + port) + basePath; } /** * Set a custom scheme for the target service, for example 'https'. * * @param scheme The scheme of the target service * @return This object. */ public ApiClient setScheme(String scheme) { this.scheme = scheme; return this; } /** * Set a custom request interceptor. * * <p>A request interceptor is a mechanism for altering each request before it is sent. After the * request has been fully configured but not yet built, the request builder is passed into this * function for further modification, after which it is sent out. * * <p>This is useful for altering the requests in a custom manner, such as adding headers. It * could also be used for logging and monitoring. * * @param interceptor A function invoked before creating each request. A value of null resets the * interceptor to a no-op. * @return This object. */ public ApiClient setRequestInterceptor(Consumer<HttpRequest.Builder> interceptor) { this.interceptor = interceptor; return this; } /** * Get the custom interceptor. * * @return The custom interceptor that was set, or null if there isn't any. */ public Consumer<HttpRequest.Builder> getRequestInterceptor() { return interceptor; } /** * Set a custom response interceptor. * * <p>This is useful for logging, monitoring or extraction of header variables * * @param interceptor A function invoked before creating each request. A value of null resets the * interceptor to a no-op. * @return This object. */ public ApiClient setResponseInterceptor(Consumer<HttpResponse<InputStream>> interceptor) { this.responseInterceptor = interceptor; return this; } /** * Get the custom response interceptor. * * @return The custom interceptor that was set, or null if there isn't any. */ public Consumer<HttpResponse<InputStream>> getResponseInterceptor() { return responseInterceptor; } /** * Set the read timeout for the http client. * * <p>This is the value used by default for each request, though it can be overridden on a * per-request basis with a request interceptor. * * @param readTimeout The read timeout used by default by the http client. Setting this value to * null resets the timeout to an effectively infinite value. * @return This object. */ public ApiClient setReadTimeout(Duration readTimeout) { this.readTimeout = readTimeout; return this; } /** * Get the read timeout that was set. * * @return The read timeout, or null if no timeout was set. Null represents an infinite wait time. */ public Duration getReadTimeout() { return readTimeout; } }
[ "jdbaker@dstl.gov.uk" ]
jdbaker@dstl.gov.uk
260738a1a3dade823f924f4ccb2cdb51492a389c
a852b4e29001a0b72a793c92b182a6e5ad385f6d
/banko-backend/src/main/java/com/example/banko/Payment.java
93670f914b3ad76a438bf94b5f56620630c7d695
[]
no_license
osamahan999/CS157A-section9-team6
ca44df19b1b19d69d4dea0dfd0bcda17cbd990fd
a021d89d5b3a2394eaa1b542a708266ee6bba4ca
refs/heads/master
2023-01-28T12:14:14.518952
2020-12-09T04:01:15
2020-12-09T04:01:15
294,545,436
1
1
null
2020-12-09T04:01:16
2020-09-10T23:31:07
Java
UTF-8
Java
false
false
1,823
java
package com.example.banko; import java.sql.*; public class Payment { private int user_id; private int transaction_id; private int payment_complete; public Payment(int user_id, int transaction_id) { this.user_id = user_id; this.transaction_id = transaction_id; payment_complete = 0; } /** * Makes a pending payment for a user of user_id for the amount of the * transaction specified by the transaction id * * @return */ public int initializePayment() throws SQLException { Connection connection = BankoBackendServer.connection; String query = "INSERT INTO payment (user_id, transaction_id, payment_complete) VALUES (" + user_id + ", " + transaction_id + ", " + payment_complete + ")"; try { Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement.executeUpdate(query); return 1; // successful insert } catch (SQLException e) { e.printStackTrace(); } return -1; } /** * A feature to indicate that a user has made a payment. * * @return */ public boolean makePayment() throws SQLException { Connection connection = BankoBackendServer.connection; String query = "UPDATE payment SET payment_complete = 1 WHERE user_id = " + user_id; try { Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); statement.executeUpdate(query); return true; // successful insert } catch (SQLException e) { e.printStackTrace(); } return false; } }
[ "hanhan.osama@gmail.com" ]
hanhan.osama@gmail.com
358bf22c63aae425fec4443cc2e8a46452603a99
ea8d4e757ad0b2e6d09906e7cb6ec0ed0b14e772
/JavaSocket/src/main/java/firstPart/mythread/stopThread/ThreadDemo4.java
c2c4138b031626649116bdb0909d748ce9954681
[]
no_license
a1422020484/JavaSocketLearn
927f17251ba5883b9ae3f0de6ef594b04ecfeb4c
39b996a92041ee84e8bdfc79682c6e2231d6de91
refs/heads/master
2023-04-14T09:49:14.899848
2023-03-28T02:00:24
2023-03-28T02:00:24
99,089,437
1
0
null
2022-12-16T09:56:00
2017-08-02T08:01:20
Java
UTF-8
Java
false
false
428
java
package firstPart.mythread.stopThread; public class ThreadDemo4 { public static void main(String[] args) { ThreadDemo4Test threadDemo4Test = new ThreadDemo4Test(); threadDemo4Test.start(); } } class ThreadDemo4Test extends Thread { @Override public void run() { try { this.stop(); } catch (Exception e) { System.out.println("进入了 catch() 方法"); e.printStackTrace(); } } }
[ "1422020484@qq.com" ]
1422020484@qq.com
15dc74af2f742b3a2fdb76b47fbd98dd3c538840
cbe854be0fc86d1fc5a0946edd3c5f1537f533c4
/src/ast/Conditional.java
c0317e79ba347a47e1bd1e2913fc849ba31f157c
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
chengluyu/sheet
e3990387cffeb3afebb3d4b89a6f01664260b951
ea960c0f996c4823550dd9f2bd97223531ec9beb
refs/heads/master
2021-01-10T13:37:21.598561
2016-01-15T05:12:43
2016-01-15T05:12:43
46,905,465
7
1
null
2016-01-15T01:55:57
2015-11-26T05:17:13
Java
UTF-8
Java
false
false
928
java
package ast; import compiler.Blank; import compiler.ByteCodeCompiler; import utils.CompileError; public class Conditional extends Expression { public Conditional(Expression cond, Expression then, Expression otherwise) { cond_ = cond; then_ = then; else_ = otherwise; } private Expression cond_; private Expression then_; private Expression else_; @Override public void inspect(AstNodePrinter printer) { printer.beginBlock("conditional operation"); printer.child("condition", cond_); printer.child("then", then_); printer.child("else", else_); printer.endBlock(); } @Override public void compile(ByteCodeCompiler compiler) throws CompileError { cond_.compile(compiler); Blank jumpToElse = compiler.branchFalse(); then_.compile(compiler); Blank jumpToEnd = compiler.branch(); jumpToElse.fill(compiler.position()); else_.compile(compiler); jumpToEnd.fill(compiler.position()); } }
[ "chengluyu@live.cn" ]
chengluyu@live.cn
ead0eb5beabe53000bd12e15c040ea511a6f7d88
a334730728e61013de2aa77d900dfde241689806
/core/java/android/view/PointerIcon.java
09012b9ea710de90547bdccbbb22dc8d07ab2413
[ "LicenseRef-scancode-unicode", "Apache-2.0" ]
permissive
Project-Google-Tango/frameworks_base_jxd_yellowstone
3d5744e4d82fb5a99764303c0411c5081969d3d1
6ce9ba490b58b4b3e061a656c2fbbaa28ab006e9
refs/heads/master
2020-04-16T21:57:50.486420
2019-01-16T00:53:34
2019-01-16T00:53:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,946
java
/* * Copyright (C) 2011 The Android Open Source Project * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.view; import com.android.internal.util.XmlUtils; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.content.res.XmlResourceParser; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.Parcel; import android.os.Parcelable; import android.util.Log; /** * Represents an icon that can be used as a mouse pointer. * <p> * Pointer icons can be provided either by the system using system styles, * or by applications using bitmaps or application resources. * </p> * * @hide */ public final class PointerIcon implements Parcelable { private static final String TAG = "PointerIcon"; /** Style constant: Custom icon with a user-supplied bitmap. */ public static final int STYLE_CUSTOM = -1; /** Style constant: Null icon. It has no bitmap. */ public static final int STYLE_NULL = 0; /** Style constant: Arrow icon. (Default mouse pointer) */ public static final int STYLE_ARROW = 1000; /** {@hide} Style constant: Spot hover icon for touchpads. */ public static final int STYLE_SPOT_HOVER = 2000; /** {@hide} Style constant: Spot touch icon for touchpads. */ public static final int STYLE_SPOT_TOUCH = 2001; /** {@hide} Style constant: Spot anchor icon for touchpads. */ public static final int STYLE_SPOT_ANCHOR = 2002; // OEM private styles should be defined starting at this range to avoid // conflicts with any system styles that may be defined in the future. private static final int STYLE_OEM_FIRST = 10000; /** {@hide} Style constant: Spot anchor icon for touchpads. */ public static final int STYLE_SPOT_ERASER = STYLE_OEM_FIRST; /** {@hide} Style constant: Spot anchor icon for touchpads. */ public static final int STYLE_SPOT_STYLUS = STYLE_OEM_FIRST + 1; // The default pointer icon. private static final int STYLE_DEFAULT = STYLE_ARROW; private static final PointerIcon gNullIcon = new PointerIcon(STYLE_NULL); private final int mStyle; private int mSystemIconResourceId; private Bitmap mBitmap; private float mHotSpotX; private float mHotSpotY; private PointerIcon(int style) { mStyle = style; } /** * Gets a special pointer icon that has no bitmap. * * @return The null pointer icon. * * @see #STYLE_NULL */ public static PointerIcon getNullIcon() { return gNullIcon; } /** * Gets the default pointer icon. * * @param context The context. * @return The default pointer icon. * * @throws IllegalArgumentException if context is null. */ public static PointerIcon getDefaultIcon(Context context) { return getSystemIcon(context, STYLE_DEFAULT); } /** * Gets a system pointer icon for the given style. * If style is not recognized, returns the default pointer icon. * * @param context The context. * @param style The pointer icon style. * @return The pointer icon. * * @throws IllegalArgumentException if context is null. */ public static PointerIcon getSystemIcon(Context context, int style) { if (context == null) { throw new IllegalArgumentException("context must not be null"); } if (style == STYLE_NULL) { return gNullIcon; } int styleIndex = getSystemIconStyleIndex(style); if (styleIndex == 0) { styleIndex = getSystemIconStyleIndex(STYLE_DEFAULT); } TypedArray a = context.obtainStyledAttributes(null, com.android.internal.R.styleable.Pointer, com.android.internal.R.attr.pointerStyle, 0); int resourceId = a.getResourceId(styleIndex, -1); a.recycle(); if (resourceId == -1) { Log.w(TAG, "Missing theme resources for pointer icon style " + style); return style == STYLE_DEFAULT ? gNullIcon : getSystemIcon(context, STYLE_DEFAULT); } PointerIcon icon = new PointerIcon(style); if ((resourceId & 0xff000000) == 0x01000000) { icon.mSystemIconResourceId = resourceId; } else { icon.loadResource(context.getResources(), resourceId); } return icon; } /** * Creates a custom pointer from the given bitmap and hotspot information. * * @param bitmap The bitmap for the icon. * @param hotspotX The X offset of the pointer icon hotspot in the bitmap. * Must be within the [0, bitmap.getWidth()) range. * @param hotspotY The Y offset of the pointer icon hotspot in the bitmap. * Must be within the [0, bitmap.getHeight()) range. * @return A pointer icon for this bitmap. * * @throws IllegalArgumentException if bitmap is null, or if the x/y hotspot * parameters are invalid. */ public static PointerIcon createCustomIcon(Bitmap bitmap, float hotSpotX, float hotSpotY) { if (bitmap == null) { throw new IllegalArgumentException("bitmap must not be null"); } validateHotSpot(bitmap, hotSpotX, hotSpotY); PointerIcon icon = new PointerIcon(STYLE_CUSTOM); icon.mBitmap = bitmap; icon.mHotSpotX = hotSpotX; icon.mHotSpotY = hotSpotY; return icon; } /** * Loads a custom pointer icon from an XML resource. * <p> * The XML resource should have the following form: * <code> * &lt;?xml version="1.0" encoding="utf-8"?&gt; * &lt;pointer-icon xmlns:android="http://schemas.android.com/apk/res/android" * android:bitmap="@drawable/my_pointer_bitmap" * android:hotSpotX="24" * android:hotSpotY="24" /&gt; * </code> * </p> * * @param resources The resources object. * @param resourceId The resource id. * @return The pointer icon. * * @throws IllegalArgumentException if resources is null. * @throws Resources.NotFoundException if the resource was not found or the drawable * linked in the resource was not found. */ public static PointerIcon loadCustomIcon(Resources resources, int resourceId) { if (resources == null) { throw new IllegalArgumentException("resources must not be null"); } PointerIcon icon = new PointerIcon(STYLE_CUSTOM); icon.loadResource(resources, resourceId); return icon; } /** * Loads the bitmap and hotspot information for a pointer icon, if it is not already loaded. * Returns a pointer icon (not necessarily the same instance) with the information filled in. * * @param context The context. * @return The loaded pointer icon. * * @throws IllegalArgumentException if context is null. * @see #isLoaded() * @hide */ public PointerIcon load(Context context) { if (context == null) { throw new IllegalArgumentException("context must not be null"); } if (mSystemIconResourceId == 0 || mBitmap != null) { return this; } PointerIcon result = new PointerIcon(mStyle); result.mSystemIconResourceId = mSystemIconResourceId; result.loadResource(context.getResources(), mSystemIconResourceId); return result; } /** * Returns true if the pointer icon style is {@link #STYLE_NULL}. * * @return True if the pointer icon style is {@link #STYLE_NULL}. */ public boolean isNullIcon() { return mStyle == STYLE_NULL; } /** * Returns true if the pointer icon has been loaded and its bitmap and hotspot * information are available. * * @return True if the pointer icon is loaded. * @see #load(Context) */ public boolean isLoaded() { return mBitmap != null || mStyle == STYLE_NULL; } /** * Gets the style of the pointer icon. * * @return The pointer icon style. */ public int getStyle() { return mStyle; } /** * Gets the bitmap of the pointer icon. * * @return The pointer icon bitmap, or null if the style is {@link #STYLE_NULL}. * * @throws IllegalStateException if the bitmap is not loaded. * @see #isLoaded() * @see #load(Context) */ public Bitmap getBitmap() { throwIfIconIsNotLoaded(); return mBitmap; } /** * Gets the X offset of the pointer icon hotspot. * * @return The hotspot X offset. * * @throws IllegalStateException if the bitmap is not loaded. * @see #isLoaded() * @see #load(Context) */ public float getHotSpotX() { throwIfIconIsNotLoaded(); return mHotSpotX; } /** * Gets the Y offset of the pointer icon hotspot. * * @return The hotspot Y offset. * * @throws IllegalStateException if the bitmap is not loaded. * @see #isLoaded() * @see #load(Context) */ public float getHotSpotY() { throwIfIconIsNotLoaded(); return mHotSpotY; } private void throwIfIconIsNotLoaded() { if (!isLoaded()) { throw new IllegalStateException("The icon is not loaded."); } } public static final Parcelable.Creator<PointerIcon> CREATOR = new Parcelable.Creator<PointerIcon>() { public PointerIcon createFromParcel(Parcel in) { int style = in.readInt(); if (style == STYLE_NULL) { return getNullIcon(); } int systemIconResourceId = in.readInt(); if (systemIconResourceId != 0) { PointerIcon icon = new PointerIcon(style); icon.mSystemIconResourceId = systemIconResourceId; return icon; } Bitmap bitmap = Bitmap.CREATOR.createFromParcel(in); float hotSpotX = in.readFloat(); float hotSpotY = in.readFloat(); return PointerIcon.createCustomIcon(bitmap, hotSpotX, hotSpotY); } public PointerIcon[] newArray(int size) { return new PointerIcon[size]; } }; public int describeContents() { return 0; } public void writeToParcel(Parcel out, int flags) { out.writeInt(mStyle); if (mStyle != STYLE_NULL) { out.writeInt(mSystemIconResourceId); if (mSystemIconResourceId == 0) { mBitmap.writeToParcel(out, flags); out.writeFloat(mHotSpotX); out.writeFloat(mHotSpotY); } } } @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || !(other instanceof PointerIcon)) { return false; } PointerIcon otherIcon = (PointerIcon) other; if (mStyle != otherIcon.mStyle || mSystemIconResourceId != otherIcon.mSystemIconResourceId) { return false; } if (mSystemIconResourceId == 0 && (mBitmap != otherIcon.mBitmap || mHotSpotX != otherIcon.mHotSpotX || mHotSpotY != otherIcon.mHotSpotY)) { return false; } return true; } private void loadResource(Resources resources, int resourceId) { XmlResourceParser parser = resources.getXml(resourceId); final int bitmapRes; final float hotSpotX; final float hotSpotY; try { XmlUtils.beginDocument(parser, "pointer-icon"); TypedArray a = resources.obtainAttributes( parser, com.android.internal.R.styleable.PointerIcon); bitmapRes = a.getResourceId(com.android.internal.R.styleable.PointerIcon_bitmap, 0); hotSpotX = a.getFloat(com.android.internal.R.styleable.PointerIcon_hotSpotX, 0); hotSpotY = a.getFloat(com.android.internal.R.styleable.PointerIcon_hotSpotY, 0); a.recycle(); } catch (Exception ex) { throw new IllegalArgumentException("Exception parsing pointer icon resource.", ex); } finally { parser.close(); } if (bitmapRes == 0) { throw new IllegalArgumentException("<pointer-icon> is missing bitmap attribute."); } Drawable drawable = resources.getDrawable(bitmapRes); if (!(drawable instanceof BitmapDrawable)) { throw new IllegalArgumentException("<pointer-icon> bitmap attribute must " + "refer to a bitmap drawable."); } // Set the properties now that we have successfully loaded the icon. mBitmap = ((BitmapDrawable)drawable).getBitmap(); mHotSpotX = hotSpotX; mHotSpotY = hotSpotY; } private static void validateHotSpot(Bitmap bitmap, float hotSpotX, float hotSpotY) { if (hotSpotX < 0 || hotSpotX >= bitmap.getWidth()) { throw new IllegalArgumentException("x hotspot lies outside of the bitmap area"); } if (hotSpotY < 0 || hotSpotY >= bitmap.getHeight()) { throw new IllegalArgumentException("y hotspot lies outside of the bitmap area"); } } private static int getSystemIconStyleIndex(int style) { switch (style) { case STYLE_ARROW: return com.android.internal.R.styleable.Pointer_pointerIconArrow; case STYLE_SPOT_HOVER: return com.android.internal.R.styleable.Pointer_pointerIconSpotHover; case STYLE_SPOT_TOUCH: return com.android.internal.R.styleable.Pointer_pointerIconSpotTouch; case STYLE_SPOT_ANCHOR: return com.android.internal.R.styleable.Pointer_pointerIconSpotAnchor; case STYLE_SPOT_ERASER: return com.android.internal.R.styleable.Pointer_pointerIconSpotEraser; case STYLE_SPOT_STYLUS: return com.android.internal.R.styleable.Pointer_pointerIconSpotStylus; default: return 0; } } }
[ "matt.gorski@gmail.com" ]
matt.gorski@gmail.com
8da9940b6a6d38c3fdcec7c6e50b1d3b1a47d890
2d6a880b53513bf566e5b1420fa7f338d3be3bd2
/android/app/src/main/java/com/the_wave_22442/MainApplication.java
0a0bf5a690e47af036109f5742b2c249bb66d646
[]
no_license
crowdbotics-apps/the-wave-22442
0d23f63c1e28c8d214b50625f2b853542dbb55d7
cb2f079be3e1801356e5cd111b556bd4debef2d8
refs/heads/master
2023-01-10T03:59:53.591372
2020-11-09T16:38:35
2020-11-09T16:38:35
311,400,154
0
0
null
null
null
null
UTF-8
Java
false
false
2,691
java
package com.the_wave_22442; import android.app.Application; import android.content.Context; import com.facebook.react.PackageList; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactApplication; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.lang.reflect.InvocationTargetException; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List<ReactPackage> packages = new PackageList(this).getPackages(); // Packages that cannot be autolinked yet can be added manually here, for example: // packages.add(new MyReactNativePackage()); return packages; } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); } /** * Loads Flipper in React Native templates. Call this in the onCreate method with something like * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); * * @param context * @param reactInstanceManager */ private static void initializeFlipper( Context context, ReactInstanceManager reactInstanceManager) { if (BuildConfig.DEBUG) { try { /* We use reflection here to pick up the class that initializes Flipper, since Flipper library is not available in release mode */ Class<?> aClass = Class.forName("com.rndiffapp.ReactNativeFlipper"); aClass .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) .invoke(null, context, reactInstanceManager); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } }
[ "team@crowdbotics.com" ]
team@crowdbotics.com
5e52e2f40a07432c82ee958ff6887ef81f589fec
16bfc7d220ba2fca99403f5c77ee832ebe0e74f4
/app/src/main/java/com/example/andrewlam/fileiotoyproject/glide/MyAppGlideModule.java
f144b0398a8a402fe16f1de4e9054f1a543e437e
[]
no_license
andrewclam1991/android-toy-file-provider
ea9d911e6b9bf4bddc0caeb8e6b6841b7d31237f
05ba5f4d3d7baa78759c769bad104c046c9f79de
refs/heads/master
2021-04-12T01:50:37.091104
2018-03-18T20:05:01
2018-03-18T20:05:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
275
java
package com.example.andrewlam.fileiotoyproject.glide; import com.bumptech.glide.annotation.GlideModule; import com.bumptech.glide.module.AppGlideModule; /** * Created by andrewlam on 2/7/18. */ @GlideModule public final class MyAppGlideModule extends AppGlideModule { }
[ "23492362+andrewclam1991@users.noreply.github.com" ]
23492362+andrewclam1991@users.noreply.github.com
e65c531d5249619a68176fd6bd497a354f1766a6
0baa3c814320a61e5bc6b9ce1ca0f18f61681b3e
/app/src/main/java/com/example/madfinalproject/Product.java
3c4e31997ee7de7ff78b1cd554ed648425079151
[]
no_license
JollyJohhny/Android-POS-system
10728b2f20d8db3cc1839ed83d4a2bdbad2c49e8
291054e72128bd1627f3d980c70559caf73b5e18
refs/heads/master
2020-12-01T14:17:25.702366
2019-12-28T20:35:06
2019-12-28T20:35:06
230,660,212
1
0
null
null
null
null
UTF-8
Java
false
false
1,116
java
package com.example.madfinalproject; import android.widget.ImageView; public class Product { String Name; String Quantity; String Price; public String getUserId() { return UserId; } public void setUserId(String userId) { UserId = userId; } String UserId; public String getImage() { return Image; } public void setImage(String image) { Image = image; } String Image; public Product(){ } public String getName() { return Name; } public void setName(String name) { Name = name; } public String getQuantity() { return Quantity; } public void setQuantity(String quantity) { Quantity = quantity; } public String getPrice() { return Price; } public void setPrice(String price) { Price = price; } public Product(String price, String quantity, String name,String image,String userid){ Price = price; Quantity = quantity; Name = name; Image = image; UserId = userid; } }
[ "johhny424@gmail.com" ]
johhny424@gmail.com
c5c7ab750cad78346f479ca7c7b90e33c461222c
d1eba0caa2c0c6dcb621216bca1b0d07c98b200b
/01_java_basic/src/step1_05/constrolStatement/ifEx28_테스트문제.java
12296f4037f3af127ba336a58fff6a945c843e78
[]
no_license
bada0705/01_java_basic
8563e493aebb43871e1a915b23908b74121a0fbe
0bb3399686d672ef9f4cddcea5013060356b3417
refs/heads/master
2023-05-30T07:04:00.246923
2021-06-21T05:22:06
2021-06-21T05:22:06
376,691,630
0
0
null
null
null
null
UTF-8
Java
false
false
561
java
package step1_05.constrolStatement; /* ==== 가위 바위 보 (하나빼기) ==== 1) 가위바위보 2개씩 저장 meLeft 에 가위바위보 입력 meRight 에 가위바위보 입력 comLeft에 가위바위보 입력 (랜덤) comRight에 가위바위보 입력 (랜덤) 2) 둘중 하나만 저장 meFinal에 meLeft 또는 meRight 저장 (직접) comFinal에 comLeft 또는 comRight 저장 (랜덤) 3) 최종판정 */ public class ifEx28_테스트문제 { public static void main(String[] args) { } }
[ "12_web_cdy@DESKTOP-HB0IECH" ]
12_web_cdy@DESKTOP-HB0IECH
c22c961abc66d67fd10e785bc68d032866a0fa08
483d4a11e24d151f8491603e315fda0bbb6c4dad
/src/com/lzairport/ais/service/aodb/IFlightStateService.java
03f158c9654e7a791959bbbca897e5e3236593c1
[]
no_license
Cielll/com.lzairport.ais
0442e499878eddbde690d35ed60f588c3862d995
b66708cf06f0d9706e6b4c0cb0894a82d6787e6a
refs/heads/master
2020-06-18T07:10:39.287919
2017-06-17T14:40:32
2017-06-17T14:41:57
94,162,648
0
1
null
null
null
null
GB18030
Java
false
false
1,642
java
package com.lzairport.ais.service.aodb; import javax.ejb.Remote; import com.lzairport.ais.models.aodb.FlightState; import com.lzairport.ais.service.IService; /** * 航班状态Service接口,用以返回定义好的航班各状态 * @author ZhangYu * @version 0.9a 12/11/14 * @since JDK 1.6 * */ @Remote public interface IFlightStateService extends IService<Integer,FlightState> { /** * * @return 航班计划状态 */ public FlightState getPlnState(); /** * * @return 航班前场起飞 */ public FlightState getPreviousTakeOffState(); /** * * @return 航班本场起飞 */ public FlightState getLocalTakeOffState(); /** * * @return 航班备降起飞 */ public FlightState getAlternateTakeOffState(); /** * * @return 返航后起飞 */ public FlightState getReturnTakeoffState(); /** * * @return 航班正常落地 */ public FlightState getLandInState(); /** * * @return 航班备降落地 */ public FlightState getAlternateLandInState(); /** * * @return 航班返航落地 */ public FlightState getReturnLandInState(); /** * * @return 航班备降中 */ public FlightState getAlternateState(); /** * * @return 航班返航中 */ public FlightState getReturnState(); /** * * @return 航班延误 */ public FlightState getDlyState(); /** * * @return 航班取消 */ public FlightState getCnlState(); /** * * @return 航班FPL */ public FlightState getFPLState(); }
[ "ciel.tang@gmail.com" ]
ciel.tang@gmail.com
4007336a92714696a9a907a256dcc8be40843acc
0f717f6517890bde14b64712ee4d6bb95ec82118
/src/main/java/br/com/carlos/mangaorganizer/controllers/HomeController.java
01cd0f1fe9d28387a76188803d8dbdba11cf6954
[]
no_license
caduleonel1988/mangaorganizer
53609e8d4869e00a4dba65502053bc6c87bcb0c9
bf95b607836e222b76264bd3c806627bc47bdc1a
refs/heads/master
2022-12-21T02:18:43.500686
2020-01-29T02:55:10
2020-01-29T02:55:10
215,098,736
0
0
null
2022-12-16T10:00:39
2019-10-14T16:56:11
JavaScript
UTF-8
Java
false
false
571
java
package br.com.carlos.mangaorganizer.controllers; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.servlet.ModelAndView; @Controller @Scope(value = WebApplicationContext.SCOPE_REQUEST) public class HomeController { @RequestMapping(value= "/") public ModelAndView home() { ModelAndView modelAndView = new ModelAndView("home"); return modelAndView; } }
[ "caduleonel1988@gmail.com" ]
caduleonel1988@gmail.com
c38a97de2d2c5fbd38fd61369d108103b94e8896
5bc18c8d9812be035b53a4e40ca4c25c846de4aa
/example06-business/src/main/java/de/ls5/wt2/conf/auth/jwt/JWTUtil.java
7762878c12ffe70bf591dbc96007bfb3c92502f4
[]
no_license
janvdhorst/webtech2
9133516955dcc01f8731a96c43d3731c5dbd8f98
9710db2ed132c53eda944c30f15fe8b65a459371
refs/heads/master
2023-01-20T18:40:23.051663
2019-07-12T09:35:35
2019-07-12T09:35:35
187,199,150
4
0
null
2023-01-07T06:24:44
2019-05-17T10:45:01
Java
UTF-8
Java
false
false
2,336
java
package de.ls5.wt2.conf.auth.jwt; import java.text.ParseException; import java.util.Date; import java.util.UUID; import com.nimbusds.jose.JOSEException; import com.nimbusds.jose.JWSAlgorithm; import com.nimbusds.jose.JWSHeader; import com.nimbusds.jose.JWSObject; import com.nimbusds.jose.JWSSigner; import com.nimbusds.jose.JWSVerifier; import com.nimbusds.jose.Payload; import com.nimbusds.jose.crypto.MACSigner; import com.nimbusds.jose.crypto.MACVerifier; import com.nimbusds.jwt.JWTClaimsSet; import com.nimbusds.jwt.SignedJWT; public class JWTUtil { public final static String ROLES_CLAIM = "roles"; public static String createJWToken(JWTLoginData credentials) throws JOSEException { final String user = credentials.getUsername(); final JWTClaimsSet.Builder builder = new JWTClaimsSet.Builder(); // set additional fields if wanted builder.subject(user); builder.issueTime(new Date()); builder.jwtID(UUID.randomUUID().toString()); // add a custom claim for admins if ("admin".equals(user)) { builder.claim(ROLES_CLAIM, "admin"); } final JWTClaimsSet claimsSet = builder.build(); final JWSHeader header = new JWSHeader(JWSAlgorithm.HS256); final Payload payload = new Payload(claimsSet.toJSONObject()); final JWSObject jwsObject = new JWSObject(header, payload); final JWSSigner signer = new MACSigner(getSharedKey()); jwsObject.sign(signer); return jwsObject.serialize(); } public static boolean validateToken(String token) { try { final SignedJWT signed = SignedJWT.parse(token); final JWSVerifier verifier = new MACVerifier(getSharedKey()); return signed.verify(verifier); } catch (ParseException | JOSEException ex) { return false; } } public static String getSender(String token) { try { JWSObject jws = JWSObject.parse(token); JWTClaimsSet claimsSet = JWTClaimsSet.parse(jws.getPayload().toJSONObject()); return claimsSet.getSubject(); }catch(ParseException e) { return "Anonymous"; } } private static byte[] getSharedKey() { return "mySuperDuperSecure256BitLongSecret".getBytes(); } }
[ "jan.v.d.horst@dirkmedia.de" ]
jan.v.d.horst@dirkmedia.de
8df043cd08539577335c7e0388567671355bd93b
341ed102cd8c2e7ab9e07af58daed3c28253c1c9
/SistemaFat/SistemaFaturamento/src/gcom/micromedicao/hidrometro/HidrometroRelojoaria.java
a0f42fc0d665ef6ca037114023d050bcdf6e7551
[]
no_license
Relesi/Stream
a2a6772c4775a66a753d5cc830c92f1098329270
15710d5a2bfb5e32ff8563b6f2e318079bcf99d5
refs/heads/master
2021-01-01T17:40:52.530660
2017-08-21T22:57:02
2017-08-21T22:57:02
98,132,060
2
0
null
null
null
null
ISO-8859-1
Java
false
false
4,193
java
/* * Copyright (C) 2007-2007 the GSAN - Sistema Integrado de Gestão de Serviços de Saneamento * * This file is part of GSAN, an integrated service management system for Sanitation * * GSAN is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License. * * GSAN is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ /* * GSAN - Sistema Integrado de Gestão de Serviços de Saneamento * Copyright (C) <2007> * Adriano Britto Siqueira * Alexandre Santos Cabral * Ana Carolina Alves Breda * Ana Maria Andrade Cavalcante * Aryed Lins de Araújo * Bruno Leonardo Rodrigues Barros * Carlos Elmano Rodrigues Ferreira * Cláudio de Andrade Lira * Denys Guimarães Guenes Tavares * Eduardo Breckenfeld da Rosa Borges * Fabíola Gomes de Araújo * Flávio Leonardo Cavalcanti Cordeiro * Francisco do Nascimento Júnior * Homero Sampaio Cavalcanti * Ivan Sérgio da Silva Júnior * José Edmar de Siqueira * José Thiago Tenório Lopes * Kássia Regina Silvestre de Albuquerque * Leonardo Luiz Vieira da Silva * Márcio Roberto Batista da Silva * Maria de Fátima Sampaio Leite * Micaela Maria Coelho de Araújo * Nelson Mendonça de Carvalho * Newton Morais e Silva * Pedro Alexandre Santos da Silva Filho * Rafael Corrêa Lima e Silva * Rafael Francisco Pinto * Rafael Koury Monteiro * Rafael Palermo de Araújo * Raphael Veras Rossiter * Roberto Sobreira Barbalho * Rodrigo Avellar Silveira * Rosana Carvalho Barbosa * Sávio Luiz de Andrade Cavalcante * Tai Mu Shih * Thiago Augusto Souza do Nascimento * Tiago Moreno Rodrigues * Vivianne Barbosa Sousa * * Este programa é software livre; você pode redistribuí-lo e/ou * modificá-lo sob os termos de Licença Pública Geral GNU, conforme * publicada pela Free Software Foundation; versão 2 da * Licença. * Este programa é distribuído na expectativa de ser útil, mas SEM * QUALQUER GARANTIA; sem mesmo a garantia implícita de * COMERCIALIZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM * PARTICULAR. Consulte a Licença Pública Geral GNU para obter mais * detalhes. * Você deve ter recebido uma cópia da Licença Pública Geral GNU * junto com este programa; se não, escreva para Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA * 02111-1307, USA. */ package gcom.micromedicao.hidrometro; import gcom.util.filtro.Filtro; import gcom.util.tabelaauxiliar.TabelaAuxiliar; import java.util.Date; public class HidrometroRelojoaria extends TabelaAuxiliar{ private static final long serialVersionUID = 1L; private Integer id; private String descricao; private Short indicadorUso; private Date ultimaAlteracao; public HidrometroRelojoaria(Integer id, String descricao, Short indicadorUso, Date ultimaAlteracao) { this.id = id; this.descricao = descricao; this.indicadorUso = indicadorUso; this.ultimaAlteracao = ultimaAlteracao; } public HidrometroRelojoaria() {} public Filtro retornaFiltro() { return null; } public String[] retornaCamposChavePrimaria() { String[] retorno = { "id" }; return retorno; } public Integer getId() { return this.id; } public void setId(Integer id) { this.id = id; } public String getDescricao() { return descricao; } public void setDescricao(String descricao) { this.descricao = descricao; } public Short getIndicadorUso() { return indicadorUso; } public void setIndicadorUso(Short indicadorUso) { this.indicadorUso = indicadorUso; } public Date getUltimaAlteracao() { return this.ultimaAlteracao; } public void setUltimaAlteracao(Date ultimaAlteracao) { this.ultimaAlteracao = ultimaAlteracao; } }
[ "renatolessa.2011@hotmail.com" ]
renatolessa.2011@hotmail.com
91be0e522068691b347315f75e6c49bb44638598
bc81fb3ec596ede1b7bdd997750c79f9975825f6
/src/main/java/stackoverflow/q18808144/LoopVsRecursionMicrobe.java
57269ba36f49736b884fd35cb3ee179652a6ba1d
[ "Apache-2.0" ]
permissive
mohamedelnaggar/experiments-with-microbes
c465ae8fabea1e945934f0f3fe63214475900be5
d80ed5a08aad4c9f630d3c12ec09bb0762235609
refs/heads/master
2021-05-10T13:57:37.503923
2013-10-19T10:58:16
2013-10-19T10:58:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,091
java
package stackoverflow.q18808144; import com.chaschev.microbe.*; import com.chaschev.microbe.trial.AbstractTrial; import java.util.Random; /** * User: chaschev * Date: 9/21/13 */ /** * Loop is 10x faster */ public class LoopVsRecursionMicrobe { int n; boolean recursive; public LoopVsRecursionMicrobe(int n, boolean recursive) { this.n = n; this.recursive = recursive; } public static void main(String[] args) { new LoopVsRecursionMicrobe(60, true).run(100000); new LoopVsRecursionMicrobe(60, false).run(100000); } private static abstract class Calculation{ int[][] matrix; protected Calculation(int[][] matrix) { this.matrix = matrix; } public abstract long calc(); } static class LoopCalculation extends Calculation{ protected LoopCalculation(int[][] matrix) { super(matrix); } @Override public long calc() { long r = 0; for (int i = 0; i < matrix.length; i++) { final int[] row = matrix[i]; for (int j = 0; j < row.length; j++) { r += row[j]; } } return r; } } static class RecursiveCalculation extends Calculation{ protected RecursiveCalculation(int[][] matrix) { super(matrix); } @Override public long calc() { return calcRec(0, 0); } private long calcRec(int i, int j) { if(j < matrix.length){ return matrix[i][j] + calcRec(i, j + 1); }else{ if(i == matrix.length - 1){ return 0; } return calcRec(i + 1, 0); } } } @Override public String toString() { final StringBuilder sb = new StringBuilder("LoopVsRecursionMicrobe{"); sb.append("n=").append(n); sb.append(", recursive=").append(recursive); sb.append('}'); return sb.toString(); } void run(int numberOfTrials) { final Random rootRandom = new Random(4); final AbstractTrial trial = new com.chaschev.microbe.trial.AbstractTrial() { long r; int[][] matrix = new int[n][n]; final RecursiveCalculation recursiveCalculation = new RecursiveCalculation(matrix); final LoopCalculation loopCalculation = new LoopCalculation(matrix); @Override public Microbe.Trial prepare() { Random random = new Random(rootRandom.nextInt()); //speed up generation a bit int[] ref = new int[n]; for (int i = 0; i < ref.length; i++) { ref[i] = random.nextInt(); } for (int i = 0; i < matrix.length; i++) { final int[] row = matrix[i]; final int v = random.nextInt(); for (int j = 0; j < row.length; j++) { row[j] = ref[i] * v; } } return this; } @Override public Measurements run(int trialIndex) { // Arrays.fill(array, 0); if(recursive){ r = recursiveCalculation.calc(); }else{ r = loopCalculation.calc(); } return MeasurementsImpl.EMPTY; } @Override public void addResultsAfterCompletion(Measurements result) { result.add(new Value(r % 10000, "checksum")); } }; System.out.println(this); Microbe.newMicroCpu("LoopVsRecursion", numberOfTrials, new TrialFactory() { @Override public Microbe.Trial create(int trialIndex) { return trial; } }).setWarmUpTrials(numberOfTrials) .noSort() .runTrials(); } }
[ "chaschev@gmail.com" ]
chaschev@gmail.com
73463eb88c2cb433dc0f3c4a1df0a5b2186dc455
3dc344a570a85ee04dc50a7f963c363f07cf2d94
/app/src/main/java/com/huawei/deviceinfo/Bean/Network.java
bf101d02beae19505405f74701ef7a39a0bc7ce0
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
weijaky/DeviceInfo
4d30533919afd6b7f672e31955c3de0fa89d9449
2b52cd36198e0ff53168639c3f6546c02ee8aeb9
refs/heads/master
2020-03-21T11:14:24.346228
2018-06-24T15:52:10
2018-06-24T15:52:10
138,495,601
0
0
null
null
null
null
UTF-8
Java
false
false
4,531
java
package com.huawei.deviceinfo.Bean; import android.content.Context; import org.json.JSONObject; public class Network { private String IMEI; private String IMSI; private String phoneType; private String phoneNumber; private String operator; private String sIMSerial; private boolean isSimNetworkLocked; private boolean isNfcPresent; private boolean isNfcEnabled; private boolean isWifiEnabled; private boolean isNetworkAvailable; private String networkClass; private String networkType; public Network(Context context) { DeviceInfo deviceInfo = new DeviceInfo(context); this.IMEI = deviceInfo.getIMEI(); this.IMSI = deviceInfo.getIMSI(); this.phoneType = deviceInfo.getPhoneType(); this.phoneNumber = deviceInfo.getPhoneNumber(); this.operator = deviceInfo.getOperator(); this.sIMSerial = deviceInfo.getSIMSerial(); this.isSimNetworkLocked = deviceInfo.isSimNetworkLocked(); this.isNfcPresent = deviceInfo.isNfcPresent(); this.isNfcEnabled = deviceInfo.isNfcEnabled(); this.isWifiEnabled = deviceInfo.isWifiEnabled(); this.isNetworkAvailable = deviceInfo.isNetworkAvailable(); this.networkClass = deviceInfo.getNetworkClass(); this.networkType = deviceInfo.getNetworkType(); } public String getIMEI() { return IMEI; } public void setIMEI(String IMEI) { this.IMEI = IMEI; } public String getIMSI() { return IMSI; } public void setIMSI(String IMSI) { this.IMSI = IMSI; } public String getPhoneType() { return phoneType; } public void setPhoneType(String phoneType) { this.phoneType = phoneType; } public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public String getsIMSerial() { return sIMSerial; } public void setsIMSerial(String sIMSerial) { this.sIMSerial = sIMSerial; } public boolean isSimNetworkLocked() { return isSimNetworkLocked; } public void setSimNetworkLocked(boolean simNetworkLocked) { isSimNetworkLocked = simNetworkLocked; } public boolean isNfcPresent() { return isNfcPresent; } public void setNfcPresent(boolean nfcPresent) { isNfcPresent = nfcPresent; } public boolean isNfcEnabled() { return isNfcEnabled; } public void setNfcEnabled(boolean nfcEnabled) { isNfcEnabled = nfcEnabled; } public boolean isWifiEnabled() { return isWifiEnabled; } public void setWifiEnabled(boolean wifiEnabled) { isWifiEnabled = wifiEnabled; } public boolean isNetworkAvailable() { return isNetworkAvailable; } public void setNetworkAvailable(boolean networkAvailable) { isNetworkAvailable = networkAvailable; } public String getNetworkClass() { return networkClass; } public void setNetworkClass(String networkClass) { this.networkClass = networkClass; } public String getNetworkType() { return networkType; } public void setNetworkType(String networkType) { this.networkType = networkType; } public JSONObject toJSON() { try { JSONObject jsonObject= new JSONObject(); jsonObject.put("IMEI", getIMEI()); jsonObject.put("IMSI", getIMSI()); jsonObject.put("phoneType", getPhoneType()); jsonObject.put("phoneNumber", getPhoneNumber()); jsonObject.put("operator", getOperator()); jsonObject.put("sIMSerial", getsIMSerial()); jsonObject.put("isSimNetworkLocked", isSimNetworkLocked()); jsonObject.put("isNfcPresent", isNfcPresent()); jsonObject.put("isNfcEnabled", isNfcEnabled()); jsonObject.put("isWifiEnabled", isWifiEnabled()); jsonObject.put("isNetworkAvailable", isNetworkAvailable()); jsonObject.put("networkClass", getNetworkClass()); jsonObject.put("networkType", getNetworkType()); return jsonObject; } catch (Exception e) { e.printStackTrace(); return null; } } }
[ "you@example.com" ]
you@example.com
e8aad271c6d88bd0eaaa62c98d07560aeb6fbdf9
69cc44f00834ef702ab3bd5479dd05e610c3cdf5
/src/main/java/com/clouyun/charge/modules/monitor/vo/RealTimeVo.java
dadf0e41a46957cbf478efd1e241e4664fb52f26
[]
no_license
sqf-ice/charge-2
6e8b2183736c19c02f2ef75597525f002de15e82
4a2180945149332829d7df888386710c91786ca7
refs/heads/master
2020-04-17T22:25:56.241286
2017-09-11T06:07:30
2017-09-11T06:07:35
166,994,425
0
1
null
2019-01-22T12:57:01
2019-01-22T12:57:00
null
UTF-8
Java
false
false
957
java
package com.clouyun.charge.modules.monitor.vo; import java.util.ArrayList; import java.util.List; /** * 描述: TODO * 版权: Copyright (c) 2017 * 公司: 科陆电子 * 作者: yangshuai <yangshuai@szclou.com> * 版本: 2.0 * 创建日期: 2017年08月09日 */ public class RealTimeVo { private List<V1> u = new ArrayList<>(); private List<V1> i = new ArrayList<>(); private List<V1> p = new ArrayList<>(); public RealTimeVo() { super(); } public RealTimeVo(List<V1> u, List<V1> i, List<V1> p) { this.u = u; this.i = i; this.p = p; } public List<V1> getU() { return u; } public void setU(List<V1> u) { this.u = u; } public List<V1> getI() { return i; } public void setI(List<V1> i) { this.i = i; } public List<V1> getP() { return p; } public void setP(List<V1> p) { this.p = p; } }
[ "1536267522@qq.com" ]
1536267522@qq.com
30cdc60611777c73767cf398be8efdd97fd0f1ea
b0984569da945846ee61c4678dbc5f9aef7b2d66
/src/selfwork/Employee.java
abd9ef9d585e3e2127401063285f0fbce9e87f0f
[]
no_license
tugba54-test/Mars
3af6f9e3c4450ca75c9e732105ca8649496e34b8
1bd882a086164e2915df175f5a7d66b70ac8d80d
refs/heads/master
2021-04-03T12:05:20.897645
2020-06-15T18:11:01
2020-06-15T18:11:01
248,351,061
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
1,136
java
package selfwork; public class Employee { int eID , salary; static String Ceo="Sumair"; public static void main(String[] args) { // Create a Class called Employee: // Create three  variables eID , salary and set the CEO to “Sumair”  // Create two objects of the class Employee  // Set the value of eID, salary for each of the objects // Print out the eID , salary and  CEO for each of the objects  // ---------------------------------------------- // Create a Class called Students // Create three  variables studentName , studentID  and numberOfStudents // Create three objects of the Students Class  // Set the value for  studentName , studentID and increment  the numberOfStudents for each object // Print out  total number of students Employee em1=new Employee(); em1.eID=2345; em1.salary=7000; Employee em2=new Employee(); em2.eID=2675; em2.salary=7500; System.out.println("My id number is "+em1.eID+"my salary is "+em1.salary+" our ceo muz "+Ceo); System.out.println("My id number is "+em2.eID+"my salary is "+em2.salary+" our ceo muz "+Ceo); } }
[ "akcatugba@yahoo.com" ]
akcatugba@yahoo.com
11ec6a62f9bca3c58fd54cf6baa48913502383c2
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project9/src/test/java/org/gradle/test/performance9_5/Test9_401.java
f8fe5f0d2934f5c2cd727480ed336922c0c238bf
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
288
java
package org.gradle.test.performance9_5; import static org.junit.Assert.*; public class Test9_401 { private final Production9_401 production = new Production9_401("value"); @org.junit.Test public void test() { assertEquals(production.getProperty(), "value"); } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
1c5f8a505f7bac369e630bdbc9881ad9f625ca8e
1aa9425728e116ff1ae6477a73983c495685563b
/ch07/src/sub3/OverrideTest.java
adad22a43c37156f2942fe8e3ed2c87611241cb3
[]
no_license
enti3237/java
fb5e529a9d3fa317e9960c5dbba3e49d4bc0bf7e
4238b86d137bc780a60f3151b8ae3d7d5115d5f6
refs/heads/master
2020-08-23T01:36:46.770018
2020-02-07T02:11:18
2020-02-07T02:11:18
216,516,599
0
0
null
null
null
null
UHC
Java
false
false
952
java
package sub3; /* * 날짜:2019-10-21 * 이름:이지영 * 내용:오버라이드 메서드 실습 */ public class OverrideTest { public static void main(String[] args) { BBB b = new BBB(); // CCC c = new CCC(); //부모의 메서드와 자식의 메서드가 선언포함 모든면이 동일하면 자식 메서드가 위에 덮어씌워짐 (재정의=override) b.method2(); // c.method1(); // c.method2(); //int a의 method2는 오버로드 메소드 (같은 내용을 참조변수만 다르게 해서 쓴다) // c.method2(1); // c.method3(); //final 실습 (변수를 상수화 한다. 이 경우 값을 대문자로 지정하는 경향이 있음) // - final 변수 : 상수화 // - final 메소드 : 오버라이드 금지 // - final 클래스 : 상속 금지 final int NUM = 1; final double PI = 3.14; // num = 2; // 이렇게 못 바꿈 System.out.println(NUM); System.out.println(PI); } }
[ "seireid@gmail.com" ]
seireid@gmail.com
282fcc8f27f111e2aa62ae156be1d96ab69d15be
44ca1a0b455c4cd8b53aa6f7b9f572eddeeb1238
/src/main/java/guess/GuessGame.java
fdcf706ab471ca218ad82a78185d701b0c174c23
[]
no_license
lamarwitherspoon/super-heros
1545aa45da05a2d83e338c271a93463bb4a8e31c
c517f1987f31593a6b91cb8d021a14ba81989bdd
refs/heads/master
2020-03-29T23:10:59.837615
2018-09-27T18:49:19
2018-09-27T18:49:19
150,460,244
0
0
null
null
null
null
UTF-8
Java
false
false
205
java
package guess; public class GuessGame { public void startGame(){ } }
[ "lamarwitherspoon@yahoo.com" ]
lamarwitherspoon@yahoo.com
51296e404aad39013801745953a376e5191d8c8d
bca4b68ca6d8c1a8e0e5e7b35542d7acace6bb16
/temp/src/pdr.src/io/dcloud/common/b/a.java
cb5acf766d05cf1258032d3c4d8fddd002884040
[]
no_license
ConAlgorithm/fastapp
a891ea9496b7cc0451823a4e2d9405b95dc77219
6f0b64cf055c71a7055e5d025df5d801e8706b9b
refs/heads/master
2021-06-17T08:50:14.684447
2017-05-09T10:47:42
2017-05-09T10:47:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
24,464
java
/* */ package io.dcloud.common.b; /* */ /* */ import android.app.Activity; /* */ import android.content.Context; /* */ import android.content.Intent; /* */ import android.content.pm.PackageInfo; /* */ import android.content.pm.PackageManager; /* */ import android.os.Bundle; /* */ import android.text.TextUtils; /* */ import io.dcloud.common.DHInterface.AbsMgr; /* */ import io.dcloud.common.DHInterface.IActivityHandler; /* */ import io.dcloud.common.DHInterface.IApp; /* */ import io.dcloud.common.DHInterface.IApp.IAppStatusListener; /* */ import io.dcloud.common.DHInterface.IBoot; /* */ import io.dcloud.common.DHInterface.ICore; /* */ import io.dcloud.common.DHInterface.ICore.ICoreStatusListener; /* */ import io.dcloud.common.DHInterface.IMgr.MgrType; /* */ import io.dcloud.common.DHInterface.IOnCreateSplashView; /* */ import io.dcloud.common.DHInterface.ISysEventListener.SysEventType; /* */ import io.dcloud.common.adapter.util.AsyncTaskHandler; /* */ import io.dcloud.common.adapter.util.AsyncTaskHandler.IAsyncTaskListener; /* */ import io.dcloud.common.adapter.util.DeviceInfo; /* */ import io.dcloud.common.adapter.util.Logger; /* */ import io.dcloud.common.adapter.util.MessageHandler; /* */ import io.dcloud.common.adapter.util.MessageHandler.IMessages; /* */ import io.dcloud.common.adapter.util.PlatformUtil; /* */ import io.dcloud.common.b.b.l; /* */ import io.dcloud.common.constant.IntentConst; /* */ import io.dcloud.common.util.BaseInfo; /* */ import io.dcloud.common.util.NetTool; /* */ import io.dcloud.common.util.PdrUtil; /* */ import io.dcloud.common.util.TestUtil; /* */ import io.dcloud.common.util.ThreadPool; /* */ import io.dcloud.common.util.net.NetMgr; /* */ import io.dcloud.feature.b; /* */ import io.dcloud.feature.internal.sdk.SDK; /* */ import io.dcloud.feature.internal.sdk.SDK.IntegratedMode; /* */ import io.src.dcloud.adapter.DCloudAdapterUtil; /* */ import java.util.Collection; /* */ import java.util.HashMap; /* */ import java.util.LinkedHashMap; /* */ import org.json.JSONObject; /* */ /* */ class a /* */ implements ICore /* */ { /* 57 */ boolean a = false; /* 58 */ Context b = null; /* 59 */ AbsMgr c = null; /* 60 */ AbsMgr d = null; /* 61 */ AbsMgr e = null; /* 62 */ AbsMgr f = null; /* */ /* 64 */ private ICore.ICoreStatusListener l = null; /* */ /* 66 */ HashMap<String, IBoot> g = null; /* 67 */ final int h = 0; final int i = 1; final int j = 2; final int k = 3; /* */ /* 71 */ private boolean m = false; /* 72 */ private static a n = null; /* */ /* */ public static a a(Context paramContext, ICore.ICoreStatusListener paramICoreStatusListener) { /* 75 */ if (n == null) n = new a(); /* 76 */ n.b = paramContext; /* 77 */ n.l = paramICoreStatusListener; /* 78 */ SDK.initSDK(n); /* 79 */ return n; /* */ } /* */ /* */ public final boolean isStreamAppMode() { /* 83 */ return this.m; /* */ } /* */ public final void setIsStreamAppMode(boolean paramBoolean) { /* 86 */ this.m = paramBoolean; /* */ } /* */ /* */ public boolean onActivityExecute(Activity paramActivity, ISysEventListener.SysEventType paramSysEventType, Object paramObject) /* */ { /* 91 */ String str = null; /* */ Object localObject2; /* 92 */ if ((paramObject instanceof IApp)) { /* 93 */ str = ((IApp)paramObject).obtainAppId(); /* */ } else { /* 95 */ str = BaseInfo.sRuntimeMode != null ? null : BaseInfo.sDefaultBootApp; /* 96 */ localObject1 = paramActivity.getIntent(); /* 97 */ if (localObject1 != null) { /* 98 */ localObject2 = ((Intent)localObject1).getExtras(); /* 99 */ if ((localObject2 != null) && (((Bundle)localObject2).containsKey("appid"))) { /* 100 */ str = ((Bundle)localObject2).getString("appid"); /* */ } /* */ } /* */ } /* 104 */ Object localObject1 = dispatchEvent(IMgr.MgrType.AppMgr, 1, new Object[] { paramSysEventType, paramObject, str }); /* 105 */ if ((paramSysEventType.equals(ISysEventListener.SysEventType.onKeyUp)) && (!((Boolean)localObject1).booleanValue())) { /* 106 */ localObject2 = (Object[])paramObject; /* 107 */ int i1 = ((Integer)localObject2[0]).intValue(); /* 108 */ if (i1 == 4) { /* 109 */ if (paramSysEventType.equals(ISysEventListener.SysEventType.onKeyUp)) /* */ { /* 111 */ if ((paramActivity instanceof IActivityHandler)) { /* 112 */ ((IActivityHandler)paramActivity).closeAppStreamSplash(str); /* */ } /* 114 */ a(paramActivity, paramActivity.getIntent(), null, str); /* */ } /* 116 */ return true; /* */ } /* */ } /* 119 */ return Boolean.parseBoolean(String.valueOf(localObject1)); /* */ } /* */ /* */ public void a(Activity paramActivity, Bundle paramBundle, SDK.IntegratedMode paramIntegratedMode) /* */ { /* 132 */ BaseInfo.sRuntimeMode = paramIntegratedMode; /* 133 */ if (paramIntegratedMode != null) BaseInfo.USE_ACTIVITY_HANDLE_KEYEVENT = true; /* 134 */ if (this.a) return; /* 135 */ IActivityHandler localIActivityHandler = DCloudAdapterUtil.getIActivityHandler(paramActivity); /* 136 */ if (localIActivityHandler != null) { /* 137 */ this.m = localIActivityHandler.isStreamAppMode(); /* */ } /* 139 */ a(paramActivity.getApplicationContext()); /* 140 */ Logger.i("Core onInit mode=" + paramIntegratedMode); /* */ /* 142 */ a(ISysEventListener.SysEventType.onStart, paramBundle); /* 143 */ Logger.i("Core onInit mCoreListener=" + this.l); /* */ try { /* 145 */ if ((BaseInfo.sRuntimeMode == null) || (BaseInfo.sRuntimeMode == SDK.IntegratedMode.RUNTIME)) { /* 146 */ if (this.l != null) /* 147 */ this.l.onCoreInitEnd(this); /* */ } /* 149 */ else if (this.l != null) /* 150 */ this.l.onCoreInitEnd(this); /* */ } /* */ catch (Exception localException) { /* 153 */ localException.printStackTrace(); /* */ } /* */ } /* */ /* */ private void a(Context paramContext) { /* 158 */ TestUtil.record("core", Thread.currentThread()); /* */ /* 160 */ this.f = new b(this); /* 161 */ this.g = ((HashMap)dispatchEvent(IMgr.MgrType.FeatureMgr, 0, this.b)); /* */ /* 163 */ BaseInfo.parseControl(this, this.l); /* 164 */ Logger.initLogger(paramContext); /* 165 */ DeviceInfo.init(paramContext); /* */ /* 167 */ this.d = new io.dcloud.common.a.a(this); /* */ /* 169 */ this.c = new l(this); /* 170 */ this.e = new NetMgr(this); /* 171 */ this.a = true; /* */ try { /* 173 */ b(paramContext); /* */ } catch (Exception localException) { /* 175 */ Logger.e("initSDKData " + localException.getLocalizedMessage()); /* */ } /* */ } /* */ /* */ private void b(final Context paramContext) { /* 180 */ if ((!BaseInfo.s_Is_DCloud_Packaged) && (BaseInfo.existsBase()) && (TextUtils.isEmpty(PlatformUtil.getBundleData(BaseInfo.PDR, "ns")))) /* */ { /* 184 */ ThreadPool.self().addThreadTask(new Runnable() /* */ { /* */ public void run() { /* */ try { /* 188 */ String str1 = "https://service.dcloud.net.cn/sta/so?p=a&pn=%s&ver=%s&appid=%s"; /* 189 */ PackageManager localPackageManager = paramContext.getPackageManager(); /* 190 */ PackageInfo localPackageInfo = localPackageManager.getPackageInfo(paramContext.getPackageName(), 0); /* 191 */ String str2 = localPackageInfo.versionName; /* 192 */ byte[] arrayOfByte = NetTool.httpGet(String.format(str1, new Object[] { paramContext.getPackageName(), str2, BaseInfo.sDefaultBootApp })); /* 193 */ JSONObject localJSONObject = new JSONObject(new String(arrayOfByte, "utf-8")); /* 194 */ if ((localJSONObject != null) && (localJSONObject.has("ret")) && (localJSONObject.optInt("ret") == 0)) /* 195 */ PlatformUtil.setBundleData(BaseInfo.PDR, "ns", "true"); /* */ } catch (Exception localException) { /* */ } /* */ } /* */ }); /* */ } /* */ } /* */ /* */ private void a(Activity paramActivity, IApp paramIApp) { /* 204 */ onActivityExecute(paramActivity, ISysEventListener.SysEventType.onWebAppStop, paramIApp); /* */ } /* */ public void a(final Activity paramActivity, final Intent paramIntent, final IApp paramIApp, final String paramString) { /* 207 */ int i1 = 1; /* 208 */ if (this.l != null) { /* 209 */ i1 = !this.l.onCoreStop() ? 1 : 0; /* */ } /* 211 */ if (paramIApp != null) { /* 212 */ dispatchEvent(IMgr.MgrType.AppMgr, 13, paramIApp); /* */ } /* 214 */ if (i1 != 0) { /* 215 */ IActivityHandler localIActivityHandler = DCloudAdapterUtil.getIActivityHandler(paramActivity); /* 216 */ final boolean bool = TextUtils.equals(paramActivity.getIntent().getStringExtra("appid"), paramString); /* 217 */ if ((localIActivityHandler != null) && ((paramIApp == null) || ((paramIApp != null) && (paramIApp.isStreamApp())))) { /* 218 */ if (localIActivityHandler.isStreamAppMode()) /* */ { /* 220 */ IntentConst.modifyStartFrom(paramIntent); /* 221 */ int i2 = paramIntent.getIntExtra("__start_from__", -1); /* 222 */ if ((!BaseInfo.sAppStateMap.containsKey(paramString)) && (i2 != 1) && (!BaseInfo.isShowTitleBar(paramActivity)) && (bool)) /* */ { /* 230 */ Logger.d("Main_Path", "moveTaskToBack"); /* 231 */ paramActivity.moveTaskToBack(false); /* 232 */ BaseInfo.setLoadingLaunchePage(false, "core stopApp"); /* */ } /* */ } /* */ /* 236 */ MessageHandler.sendMessage(new MessageHandler.IMessages() /* */ { /* */ public void execute(Object paramAnonymousObject) { /* 239 */ Activity localActivity = paramActivity; /* 240 */ Intent localIntent = paramIntent; /* 241 */ String str = paramString; /* 242 */ if (paramIApp != null) { /* 243 */ a.a(a.this, paramActivity, paramIApp); /* 244 */ localActivity = paramIApp.getActivity(); /* 245 */ localIntent = paramIApp.obtainWebAppIntent(); /* 246 */ str = paramIApp.obtainAppId(); /* */ } /* 248 */ if (bool) { /* 249 */ a.a(a.this, paramActivity, localIntent, paramIApp, str); /* */ } /* 251 */ boolean bool = ((Boolean)a.this.dispatchEvent(IMgr.MgrType.WindowMgr, 32, new Object[] { paramActivity, paramString })).booleanValue(); /* 252 */ if (!bool) /* 253 */ paramActivity.finish(); /* */ } /* */ } /* */ , 10L, null); /* */ } /* */ else /* */ { /* 258 */ paramActivity.finish(); /* */ } /* */ } /* 261 */ BaseInfo.sGlobalFullScreen = false; /* */ } /* */ /* */ private void b(Activity paramActivity, Intent paramIntent, IApp paramIApp, String paramString) { /* 265 */ IntentConst.modifyStartFrom(paramIntent); /* */ /* 267 */ int i1 = paramIntent.getIntExtra("__start_from__", -1); /* 268 */ if (((i1 != 2) && (i1 != 5)) || (BaseInfo.isShowTitleBar(paramActivity))) /* */ { /* 271 */ if (!BaseInfo.sAppStateMap.containsKey(paramString)) { /* 272 */ IApp localIApp = (IApp)dispatchEvent(IMgr.MgrType.AppMgr, 19, null); /* 273 */ int i2 = localIApp != null ? 1 : 0; /* 274 */ String str1 = null; /* 275 */ Intent localIntent = null; /* 276 */ if (i2 != 0) /* 277 */ str1 = localIApp.obtainAppId(); /* 278 */ else if (!BaseInfo.sAppStateMap.isEmpty()) { /* 279 */ str1 = BaseInfo.getLastKey(BaseInfo.sAppStateMap); /* */ } /* */ /* 282 */ if ((paramIApp != null) && (paramIApp.getIAppStatusListener() != null)) /* */ { /* 284 */ str1 = paramIApp.getIAppStatusListener().onStoped(BaseInfo.sAppStateMap.containsKey(paramIApp.obtainAppId()), str1); /* */ } /* */ /* 288 */ if (str1 != null) { /* 289 */ String str2 = null; /* 290 */ if ((i2 != 0) && (TextUtils.equals(localIApp.obtainAppId(), str1))) { /* 291 */ paramActivity = localIApp.getActivity(); /* 292 */ localIntent = localIApp.obtainWebAppIntent(); /* 293 */ } else if (BaseInfo.sAppStateMap.containsKey(str1)) { /* 294 */ localIntent = (Intent)BaseInfo.sAppStateMap.get(str1); /* */ } else { /* 296 */ localIntent = new Intent(); /* 297 */ localIntent.putExtra("appid", str1); /* 298 */ localIntent.putExtra("__start_from__", 1); /* */ } /* 300 */ localIntent.putExtra("__webapp_reply__", true); /* 301 */ paramActivity.setIntent(localIntent); /* 302 */ Logger.d(str1 + " will be the Frontest"); /* 303 */ str2 = IntentConst.obtainArgs(localIntent, str1); /* 304 */ dispatchEvent(null, 2, new Object[] { paramActivity, str1, str2, paramActivity }); /* */ } /* */ } /* */ } /* */ } /* */ /* 310 */ public IApp a(Activity paramActivity, String paramString1, String paramString2, IOnCreateSplashView paramIOnCreateSplashView) { return a(paramActivity, paramString1, paramString2, paramIOnCreateSplashView, false); } /* */ /* */ public IApp a(Activity paramActivity, String paramString1, String paramString2, IOnCreateSplashView paramIOnCreateSplashView, boolean paramBoolean) /* */ { /* 314 */ TestUtil.record("GET_STATUS_BY_APPID"); /* 315 */ Logger.d("syncStartApp " + paramString1); /* 316 */ int i1 = Byte.parseByte(String.valueOf(dispatchEvent(IMgr.MgrType.AppMgr, 12, paramString1))); /* 317 */ TestUtil.print("GET_STATUS_BY_APPID"); /* 318 */ int i2 = !a(paramActivity.getIntent()) ? 1 : 0; /* 319 */ if (1 == i1) { /* 320 */ Logger.d("syncStartApp " + paramString1 + " STATUS_UN_RUNNING"); /* 321 */ if (paramIOnCreateSplashView != null) { /* 322 */ Logger.d("syncStartApp " + paramString1 + " ShowSplash"); /* 323 */ paramIOnCreateSplashView.onCreateSplash(paramActivity); /* */ } /* */ } /* */ /* 327 */ if (i2 != 0) { /* */ try { /* 329 */ TestUtil.record(TestUtil.START_APP_SET_ROOTVIEW, "启动" + paramString1); /* 330 */ IApp localIApp = (IApp)dispatchEvent(IMgr.MgrType.AppMgr, 0, new Object[] { paramActivity, paramString1, paramString2 }); /* 331 */ localIApp.setOnCreateSplashView(paramIOnCreateSplashView); /* */ /* 333 */ if ((paramBoolean) && ((3 == i1) || (2 == i1))) { /* 334 */ onActivityExecute(paramActivity, ISysEventListener.SysEventType.onNewIntent, paramString2); /* */ } /* */ /* 337 */ return localIApp; /* */ } catch (Exception localException) { /* 339 */ Logger.d("syncStartApp appid=" + paramString1); /* */ } /* */ } /* 342 */ return null; /* */ } /* */ public boolean a(Intent paramIntent) { /* 345 */ if (paramIntent != null) { /* 346 */ return paramIntent.getBooleanExtra("has_stream_splash", false); /* */ } /* 348 */ return false; /* */ } /* */ public void a(final Activity paramActivity, final String paramString1, final String paramString2) { /* 351 */ AsyncTaskHandler.executeAsyncTask(new AsyncTaskHandler.IAsyncTaskListener() /* */ { /* */ public void onExecuteBegin() /* */ { /* */ } /* */ /* */ public Object onExecuting() { /* 358 */ return null; /* */ } /* */ /* */ public void onExecuteEnd(Object paramAnonymousObject) /* */ { /* 363 */ MessageHandler.sendMessage(new MessageHandler.IMessages() /* */ { /* */ public void execute(Object paramAnonymous2Object) { /* 366 */ a.this.a(a.3.this.a, a.3.this.b, a.3.this.c, null); /* */ } /* */ } /* */ , null); /* */ } /* */ /* */ public void onCancel() /* */ { /* */ } /* */ } /* */ , null); /* */ } /* */ /* */ private void a(ISysEventListener.SysEventType paramSysEventType, Object paramObject) /* */ { /* 383 */ if (this.g != null) { /* 384 */ Collection localCollection = this.g.values(); /* 385 */ if (localCollection != null) /* 386 */ for (IBoot localIBoot : localCollection) /* */ try { /* 388 */ if (localIBoot != null) /* 389 */ switch (4.a[paramSysEventType.ordinal()]) /* */ { /* */ case 1: /* 394 */ localIBoot.onStart(this.b, (Bundle)paramObject, new String[] { BaseInfo.sDefaultBootApp }); /* 395 */ break; /* */ case 2: /* 397 */ localIBoot.onStop(); /* 398 */ break; /* */ case 3: /* 400 */ localIBoot.onPause(); /* 401 */ break; /* */ case 4: /* 403 */ localIBoot.onResume(); /* */ } /* */ } /* */ catch (Exception localException) { /* 407 */ localException.printStackTrace(); /* */ } /* */ } /* */ } /* */ /* */ public boolean a(Activity paramActivity) /* */ { /* 415 */ PlatformUtil.invokeMethod("io.dcloud.feature.apsqh.QHNotifactionReceiver", "doSaveNotifications", null, new Class[] { Context.class }, new Object[] { paramActivity.getBaseContext() }); /* */ try /* */ { /* 418 */ onActivityExecute(paramActivity, ISysEventListener.SysEventType.onStop, null); /* */ /* 420 */ this.a = false; /* 421 */ BaseInfo.setLoadingLaunchePage(false, "onStop"); /* 422 */ a(ISysEventListener.SysEventType.onStop, null); /* 423 */ n = null; /* 424 */ this.c.dispose(); /* 425 */ this.c = null; /* 426 */ this.d.dispose(); /* 427 */ this.d = null; /* 428 */ this.e.dispose(); /* 429 */ this.e = null; /* 430 */ this.f.dispose(); /* 431 */ this.f = null; /* 432 */ Logger.e("Main_Path", "core exit"); /* */ } catch (Exception localException) { /* 434 */ localException.printStackTrace(); /* */ } /* 436 */ return true; /* */ } /* */ /* */ public void b(Activity paramActivity) /* */ { /* 442 */ a(ISysEventListener.SysEventType.onPause, null); /* 443 */ if (this.a) { /* 444 */ if (this.e != null) { /* 445 */ this.e.onExecute(ISysEventListener.SysEventType.onPause, null); /* */ } /* 447 */ onActivityExecute(paramActivity, ISysEventListener.SysEventType.onPause, null); /* */ } /* 449 */ System.gc(); /* */ } /* */ /* */ public void c(Activity paramActivity) { /* 453 */ a(ISysEventListener.SysEventType.onResume, null); /* */ /* 455 */ this.e.onExecute(ISysEventListener.SysEventType.onResume, null); /* 456 */ boolean bool = onActivityExecute(paramActivity, ISysEventListener.SysEventType.onResume, null); /* 457 */ if (!bool) /* */ { /* 459 */ Object localObject1 = null; /* */ /* 461 */ Intent localIntent = paramActivity.getIntent(); /* */ Object localObject2; /* 462 */ if (localIntent != null) { /* 463 */ localObject2 = localIntent.getExtras(); /* 464 */ localObject1 = localObject2 != null ? ((Bundle)localObject2).getString("appid") : localObject1; /* */ } /* 466 */ if (!PdrUtil.isEmpty(localObject1)) { /* 467 */ localObject2 = IntentConst.obtainArgs(localIntent, localObject1); /* 468 */ a(paramActivity, localObject1, (String)localObject2, (paramActivity instanceof IOnCreateSplashView) ? (IOnCreateSplashView)paramActivity : null); /* */ } /* */ } /* */ } /* */ /* */ public Object dispatchEvent(IMgr.MgrType paramMgrType, int paramInt, Object paramObject) /* */ { /* 475 */ Object localObject = null; /* 476 */ if (paramMgrType == null) /* 477 */ localObject = a(paramInt, paramObject); /* */ else { /* */ try { /* 480 */ if (n == null) n = this; /* 481 */ switch (4.b[paramMgrType.ordinal()]) { /* */ case 1: /* 483 */ if (n.d != null) /* 484 */ localObject = n.d.processEvent(paramMgrType, paramInt, paramObject); break; /* */ case 2: /* 487 */ localObject = n.e.processEvent(paramMgrType, paramInt, paramObject); /* 488 */ break; /* */ case 3: /* 490 */ localObject = n.f.processEvent(paramMgrType, paramInt, paramObject); /* 491 */ break; /* */ case 4: /* 493 */ localObject = n.c.processEvent(paramMgrType, paramInt, paramObject); /* */ } /* */ } /* */ catch (Exception localException) { /* 497 */ localException.printStackTrace(); /* */ } /* */ } /* 500 */ return localObject; /* */ } /* */ /* */ private Object a(int paramInt, Object paramObject) { /* 504 */ Object localObject1 = null; /* */ Object localObject2; /* */ Object localObject3; /* */ String str; /* */ Object localObject4; /* */ Object localObject5; /* 505 */ switch (paramInt) { /* */ case -1: /* 507 */ localObject1 = BaseInfo.sRuntimeMode; /* 508 */ break; /* */ case 1: /* 510 */ localObject1 = Boolean.valueOf(this.g.containsValue((IBoot)paramObject)); /* 511 */ break; /* */ case 0: /* 513 */ localObject2 = null; /* 514 */ localObject3 = null; /* 515 */ str = null; /* 516 */ localObject4 = null; /* 517 */ if ((paramObject instanceof IApp)) { /* 518 */ localObject3 = (IApp)paramObject; /* 519 */ localObject2 = ((IApp)localObject3).getActivity(); /* 520 */ localObject4 = ((IApp)localObject3).obtainWebAppIntent(); /* 521 */ str = ((IApp)localObject3).obtainAppId(); /* 522 */ } else if ((paramObject instanceof Object[])) { /* 523 */ localObject5 = (Object[])paramObject; /* 524 */ localObject2 = (Activity)localObject5[0]; /* 525 */ localObject4 = (Intent)localObject5[1]; /* 526 */ str = (String)localObject5[2]; /* */ } /* 528 */ a((Activity)localObject2, (Intent)localObject4, (IApp)localObject3, str); /* */ /* 530 */ break; /* */ case 2: /* 532 */ localObject2 = (Object[])paramObject; /* 533 */ localObject3 = (Activity)localObject2[0]; /* 534 */ str = (String)localObject2[1]; /* 535 */ localObject4 = (String)localObject2[2]; /* 536 */ localObject5 = (IOnCreateSplashView)localObject2[3]; /* 537 */ a((Activity)localObject3, str, (String)localObject4, (IOnCreateSplashView)localObject5); /* */ } /* */ /* 541 */ return localObject1; /* */ } /* */ /* */ public Context obtainContext() { /* 545 */ return this.b; /* */ } /* */ /* */ public void removeStreamApp(String paramString) /* */ { /* 551 */ if (this.d != null) { /* 552 */ this.d.processEvent(IMgr.MgrType.AppMgr, 17, paramString); /* */ } /* 554 */ if (this.c != null) /* 555 */ this.d.processEvent(IMgr.MgrType.WindowMgr, 40, paramString); /* */ } /* */ } /* Location: F:\xunlei\sdk\Android-SDK@1.9.9.29448_20170217\Android-SDK\SDK\libs\pdr.jar * Qualified Name: io.dcloud.common.b.a * JD-Core Version: 0.6.2 */
[ "dlzdy@163.com" ]
dlzdy@163.com
e33c7a7e80f8f54f46e1005df60617765e38f932
208def053cad3cdde79865931373ee3476779c93
/mybatisgeneratorcore/src/main/java/com/alexgaoyh/common/enums/handler/EnumKeyTypeHandler.java
8512b79fec2e3883f72747c2b8793b46abdd8929
[]
no_license
tenchoo/clouddemo
620c0a8aa5b74211494f1510812bd9536ce15164
aa72b10a915bf714dbd235300214dcc1a5811b20
refs/heads/master
2021-07-10T19:45:48.531976
2017-10-10T10:10:19
2017-10-10T10:10:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,624
java
/** * File : EnumKeyTypeHandler.java <br/> * Author : lenovo <br/> * Version : 1.1 <br/> * Date : 2017年5月23日 <br/> * Modify : <br/> * Package Name : com.zhongpin.inventory.persist.enums.handler <br/> * Project Name : zp-persist-generator <br/> * Description : <br/> * */ package com.alexgaoyh.common.enums.handler; import com.alexgaoyh.common.enums.ICommonEnum; import org.apache.ibatis.type.BaseTypeHandler; import org.apache.ibatis.type.JdbcType; import java.sql.CallableStatement; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; /** * ClassName : EnumKeyTypeHandler <br/> * Function : 本系统所有枚举都是使用这个处理器将key定为存取的依据 . <br/> * Reason : 本系统所有枚举都是使用这个处理器将key定为存取的依据 . <br/> * Date : 2017年5月23日 上午10:27:51 <br/> * * 参考源码EnumOrdinalTypeHandler/EnumTypeHandler * 参考 http://mybatis.org/mybatis-3/zh/configuration.html#typeHandlers * * @author : alexgaoyh <br/> * @version : 1.1 <br/> * @since : JDK 1.6 <br/> * @see */ public class EnumKeyTypeHandler extends BaseTypeHandler<ICommonEnum> { private Class<ICommonEnum> type; private final ICommonEnum[] enums; /** * 设置配置文件设置的转换类以及枚举类内容,供其他方法更便捷高效的实现 * * @param type * 配置文件中设置的转换类 */ public EnumKeyTypeHandler(Class<ICommonEnum> type) { if (type == null) throw new IllegalArgumentException("Type argument cannot be null"); this.type = type; this.enums = type.getEnumConstants(); if (this.enums == null) throw new IllegalArgumentException(type.getSimpleName() + " does not represent an enum type."); } @Override public ICommonEnum getNullableResult(ResultSet rs, String columnName) throws SQLException { // 根据数据库存储类型决定获取类型,本例子中数据库中存放INT类型 int i = rs.getInt(columnName); if (rs.wasNull()) { return null; }else { // 根据数据库中的code值,定位ICommonEnum子类 return locateICommonEnum(i); } } @Override public ICommonEnum getNullableResult(ResultSet rs, int columnIndex) throws SQLException { // 根据数据库存储类型决定获取类型,本例子中数据库中存放INT类型 int i = rs.getInt(columnIndex); if (rs.wasNull()) { return null; }else { // 根据数据库中的code值,定位ICommonEnum子类 return locateICommonEnum(i); } } public ICommonEnum getNullableResult(CallableStatement cs, int columnIndex) throws SQLException { // 根据数据库存储类型决定获取类型,本例子中数据库中存放INT类型 int i = cs.getInt(columnIndex); if (cs.wasNull()) { return null; }else { // 根据数据库中的code值,定位ICommonEnum子类 return locateICommonEnum(i); } } public void setNonNullParameter(PreparedStatement ps, int i, ICommonEnum parameter, JdbcType jdbcType) throws SQLException { // baseTypeHandler已经帮我们做了parameter的null判断 ps.setInt(i, parameter.getKey()); } /** * 枚举类型转换,由于构造函数获取了枚举的子类enums,让遍历更加高效快捷 * * @param key * 数据库中存储的自定义code属性 * @return code对应的枚举类 */ private ICommonEnum locateICommonEnum(int key) { for (ICommonEnum status : enums) { if (status.getKey() == key) { return status; } } throw new IllegalArgumentException("未知的枚举类型:" + key + ",请核对" + type.getSimpleName()); } }
[ "alexgaoyh@sina.com" ]
alexgaoyh@sina.com
20ccce9cd4b41462e992d0dacec9c86d88fef43f
07e54e693845bf3b13a172f2ff0d798938bc3dfb
/src/graphs/DirectedEulerianPath.java
c4591e62899c6c57807e5ca37938944b5806cd24
[]
no_license
christinJiang/Algorithms_java
8cfec77d288b7f17467ab78b4fc1b80c12281166
fd33f715091fb36eeabfdd09077871d5033784d8
refs/heads/master
2021-06-06T01:10:22.256287
2021-01-26T14:43:15
2021-01-26T14:43:22
95,342,561
2
0
null
null
null
null
UTF-8
Java
false
false
8,559
java
/****************************************************************************** * Compilation: javac DirectedEulerianPath.java * Execution: java DirectedEulerianPath V E * Dependencies: Digraph.java Stack.java StdOut.java * BreadthFirstPaths.java * DigraphGenerator.java StdRandom.java * * Find an Eulerian path in a digraph, if one exists. * ******************************************************************************/ import java.util.Iterator; import edu.princeton.cs.algs4.In; import edu.princeton.cs.algs4.Stack; import edu.princeton.cs.algs4.StdOut; import edu.princeton.cs.algs4.StdRandom; /** * The {@code DirectedEulerianPath} class represents a data type * for finding an Eulerian path in a digraph. * An <em>Eulerian path</em> is a path (not necessarily simple) that * uses every edge in the digraph exactly once. * <p> * This implementation uses a nonrecursive depth-first search. * The constructor take &Theta;(<em>E</em> + <em>V</em>) time * in the worst case, where <em>E</em> is the number of edges and * <em>V</em> is the number of vertices. * It uses &Theta;(<em>V</em>) extra space (not including the digraph). * <p> * To compute Eulerian cycles in digraphs, see {@link DirectedEulerianCycle}. * To compute Eulerian cycles and paths in undirected graphs, see * {@link EulerianCycle} and {@link EulerianPath}. * <p> * For additional documentation, * see <a href="https://algs4.cs.princeton.edu/42digraph">Section 4.2</a> of * <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne. * * @author Robert Sedgewick * @author Kevin Wayne * @author Nate Liu */ public class DirectedEulerianPath { private Stack<Integer> path = null; // Eulerian path; null if no suh path /** * Computes an Eulerian path in the specified digraph, if one exists. * * @param G the digraph */ public DirectedEulerianPath(Digraph G) { // find vertex from which to start potential Eulerian path: // a vertex v with outdegree(v) > indegree(v) if it exits; // otherwise a vertex with outdegree(v) > 0 int deficit = 0; int s = nonIsolatedVertex(G); for (int v = 0; v < G.V(); v++) { if (G.outdegree(v) > G.indegree(v)) { deficit += (G.outdegree(v) - G.indegree(v)); s = v; } } // digraph can't have an Eulerian path // (this condition is needed) if (deficit > 1) return; // special case for digraph with zero edges (has a degenerate Eulerian path) if (s == -1) s = 0; // create local view of adjacency lists, to iterate one vertex at a time Iterator<Integer>[] adj = (Iterator<Integer>[]) new Iterator[G.V()]; for (int v = 0; v < G.V(); v++) adj[v] = G.adj(v).iterator(); // greedily add to cycle, depth-first search style Stack<Integer> stack = new Stack<Integer>(); stack.push(s); path = new Stack<Integer>(); while (!stack.isEmpty()) { int v = stack.pop(); while (adj[v].hasNext()) { stack.push(v); v = adj[v].next(); } // push vertex with no more available edges to path path.push(v); } // check if all edges have been used if (path.size() != G.E() + 1) path = null; assert check(G); } /** * Returns the sequence of vertices on an Eulerian path. * * @return the sequence of vertices on an Eulerian path; * {@code null} if no such path */ public Iterable<Integer> path() { return path; } /** * Returns true if the digraph has an Eulerian path. * * @return {@code true} if the digraph has an Eulerian path; * {@code false} otherwise */ public boolean hasEulerianPath() { return path != null; } // returns any non-isolated vertex; -1 if no such vertex private static int nonIsolatedVertex(Digraph G) { for (int v = 0; v < G.V(); v++) if (G.outdegree(v) > 0) return v; return -1; } /************************************************************************** * * The code below is solely for testing correctness of the data type. * **************************************************************************/ // Determines whether a digraph has an Eulerian path using necessary // and sufficient conditions (without computing the path itself): // - indegree(v) = outdegree(v) for every vertex, // except one vertex v may have outdegree(v) = indegree(v) + 1 // (and one vertex v may have indegree(v) = outdegree(v) + 1) // - the graph is connected, when viewed as an undirected graph // (ignoring isolated vertices) private static boolean satisfiesNecessaryAndSufficientConditions(Digraph G) { if (G.E() == 0) return true; // Condition 1: indegree(v) == outdegree(v) for every vertex, // except one vertex may have outdegree(v) = indegree(v) + 1 int deficit = 0; for (int v = 0; v < G.V(); v++) if (G.outdegree(v) > G.indegree(v)) deficit += (G.outdegree(v) - G.indegree(v)); if (deficit > 1) return false; // Condition 2: graph is connected, ignoring isolated vertices Graph H = new Graph(G.V()); for (int v = 0; v < G.V(); v++) for (int w : G.adj(v)) H.addEdge(v, w); // check that all non-isolated vertices are connected int s = nonIsolatedVertex(G); BreadthFirstPaths bfs = new BreadthFirstPaths(H, s); for (int v = 0; v < G.V(); v++) if (H.degree(v) > 0 && !bfs.hasPathTo(v)) return false; return true; } private boolean check(Digraph G) { // internal consistency check if (hasEulerianPath() == (path() == null)) return false; // hashEulerianPath() returns correct value if (hasEulerianPath() != satisfiesNecessaryAndSufficientConditions(G)) return false; // nothing else to check if no Eulerian path if (path == null) return true; // check that path() uses correct number of edges if (path.size() != G.E() + 1) return false; // check that path() is a directed path in G // TODO return true; } private static void unitTest(Digraph G, String description) { StdOut.println(description); StdOut.println("-------------------------------------"); StdOut.print(G); DirectedEulerianPath euler = new DirectedEulerianPath(G); StdOut.print("Eulerian path: "); if (euler.hasEulerianPath()) { for (int v : euler.path()) { StdOut.print(v + " "); } StdOut.println(); } else { StdOut.println("none"); } StdOut.println(); } /** * Unit tests the {@code DirectedEulerianPath} data type. * * @param args the command-line arguments */ public static void main(String[] args) { int V = Integer.parseInt(args[0]); int E = Integer.parseInt(args[1]); // Eulerian cycle Digraph G1 = DigraphGenerator.eulerianCycle(V, E); unitTest(G1, "Eulerian cycle"); // Eulerian path Digraph G2 = DigraphGenerator.eulerianPath(V, E); unitTest(G2, "Eulerian path"); // add one random edge Digraph G3 = new Digraph(G2); G3.addEdge(StdRandom.uniform(V), StdRandom.uniform(V)); unitTest(G3, "one random edge added to Eulerian path"); // self loop Digraph G4 = new Digraph(V); int v4 = StdRandom.uniform(V); G4.addEdge(v4, v4); unitTest(G4, "single self loop"); // single edge Digraph G5 = new Digraph(V); G5.addEdge(StdRandom.uniform(V), StdRandom.uniform(V)); unitTest(G5, "single edge"); // empty digraph Digraph G6 = new Digraph(V); unitTest(G6, "empty digraph"); // random digraph Digraph G7 = DigraphGenerator.simple(V, E); unitTest(G7, "simple digraph"); // 4-vertex digraph Digraph G8 = new Digraph(new In("eulerianD.txt")); unitTest(G8, "4-vertex Eulerian digraph"); } }
[ "jiangjinfengsh@outlook.com" ]
jiangjinfengsh@outlook.com
121bdfb7ad997ea38d86beb17fd99e5101945bbb
822dabbbf801fcfb05adf48682c4787369543733
/app/src/main/java/com/example/dell/smartpos/Settings/EMV_EntryMode.java
3a4ebf363f9e1aa893b2d0da1f8971fb876e0fde
[]
no_license
Kennedy0904/sPOS_20200123
d56fab4126a79af0de06a2b0f84f75cad6ed739a
eb7324704b9dac1259cf4a7062c093e5530a7ac2
refs/heads/master
2021-03-29T03:30:26.278612
2020-03-30T04:13:26
2020-03-30T04:13:26
247,917,497
1
1
null
null
null
null
UTF-8
Java
false
false
5,373
java
package com.example.dell.smartpos.Settings; import android.content.SharedPreferences; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import com.example.dell.smartpos.Constants; import com.example.dell.smartpos.R; public class EMV_EntryMode extends AppCompatActivity { private Button btnOkEntryMode; private CheckBox cbChip; private CheckBox cbSwipe; private CheckBox cbManualKeyIn; private CheckBox cbFallback; private CheckBox cbContactless; private static String temp_entry_mode = ""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_emv_entry_mode); this.setTitle(R.string.entry_mode); getSupportActionBar().setDisplayHomeAsUpEnabled(true); cbChip = (CheckBox) findViewById(R.id.cbChip); cbSwipe = (CheckBox) findViewById(R.id.cbSwipe); cbManualKeyIn = (CheckBox) findViewById(R.id.cbManualKeyIn); cbFallback = (CheckBox) findViewById(R.id.cbFallback); cbContactless = (CheckBox) findViewById(R.id.cbContactless); btnOkEntryMode = (Button) findViewById(R.id.btnOkEntryMode); initView(); if (cbChip.isChecked()) { temp_entry_mode += "-chip-"; } else { if (temp_entry_mode.contains("-chip-")) { temp_entry_mode.replaceAll("-chip-", ""); } } if (cbSwipe.isChecked()) { temp_entry_mode += "-swipe-"; } else { if (temp_entry_mode.contains("-swipe-")) { temp_entry_mode.replaceAll("-swipe-", ""); } } if (cbManualKeyIn.isChecked()) { temp_entry_mode += "-manual_key_in-"; } else { if (temp_entry_mode.contains("-manual_key_in-")) { temp_entry_mode.replaceAll("-manual_key_in-", ""); } } if (cbFallback.isChecked()) { temp_entry_mode += "-fallback-"; } else { if (temp_entry_mode.contains("-fallback-")) { temp_entry_mode.replaceAll("-fallback-", ""); } } if (cbContactless.isChecked()) { temp_entry_mode += "-contactless-"; } else { if (temp_entry_mode.contains("-contactless-")) { temp_entry_mode.replaceAll("-contactless-", ""); } } SharedPreferences prefsettings = getApplicationContext().getSharedPreferences( Constants.SETTINGS, MODE_PRIVATE); final SharedPreferences.Editor edit = prefsettings.edit(); btnOkEntryMode.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (cbChip.isChecked()) { temp_entry_mode = "-chip-"; } else { temp_entry_mode = ""; } if (cbSwipe.isChecked()) { temp_entry_mode += "-swipe-"; } else { temp_entry_mode += ""; } if (cbManualKeyIn.isChecked()) { temp_entry_mode += "-manual_key_in-"; } else { temp_entry_mode += ""; } if (cbFallback.isChecked()) { temp_entry_mode += "-fallback-"; } else { temp_entry_mode += ""; } if (cbContactless.isChecked()) { temp_entry_mode += "-contactless-"; } else { temp_entry_mode += ""; } edit.putString(Constants.entry_mode, temp_entry_mode); edit.apply(); finish(); } }); } private void initView() { SharedPreferences prefsettings = getApplicationContext().getSharedPreferences( Constants.SETTINGS, MODE_PRIVATE); if (prefsettings.getString(Constants.entry_mode, "").toLowerCase().contains("-chip-")) { cbChip.setChecked(true); } else { cbChip.setChecked(false); } if (prefsettings.getString(Constants.entry_mode, "").toLowerCase().contains("-swipe-")) { cbSwipe.setChecked(true); } else { cbSwipe.setChecked(false); } if (prefsettings.getString(Constants.entry_mode, "").toLowerCase().contains("-manual_key_in-")) { cbManualKeyIn.setChecked(true); } else { cbManualKeyIn.setChecked(false); } if (prefsettings.getString(Constants.entry_mode, "").toLowerCase().contains("-fallback-")) { cbFallback.setChecked(true); } else { cbFallback.setChecked(false); } if (prefsettings.getString(Constants.entry_mode, "").toLowerCase().contains("-contactless-")) { cbContactless.setChecked(true); } else { cbContactless.setChecked(false); } } @Override public boolean onSupportNavigateUp() { finish(); return true; } }
[ "leonkennedy0904@hotmail.com" ]
leonkennedy0904@hotmail.com
2c05eff8c4b5687795863c4621ad3b074436080e
bc681238d50d1ea9e0b046ea7379e808484aec7c
/src/main/java/com/cyhd/web/action/api/EnchashmentAction.java
b36d7a7dbcd414e4d307d5af050430c65373e5f0
[]
no_license
rhaik/mapi
6df16a87841a7ba50826ca13bfe92d84ed485b01
05475e7eaed537cac0e3e7d6e29781c35b1a748a
refs/heads/master
2020-12-24T20:33:43.202380
2016-05-26T02:13:42
2016-05-26T02:13:42
59,712,312
0
0
null
null
null
null
UTF-8
Java
false
false
14,604
java
package com.cyhd.web.action.api; import java.util.Date; import java.util.concurrent.locks.Lock; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.cyhd.common.util.*; import com.cyhd.service.util.GlobalConfig; import org.springframework.stereotype.Controller; import org.springframework.util.StringUtils; import org.springframework.web.bind.ServletRequestUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; import com.cyhd.common.util.richtext.HtmlUtil; import com.cyhd.service.constants.Constants; import com.cyhd.service.dao.po.User; import com.cyhd.service.dao.po.UserEnchashment; import com.cyhd.service.dao.po.UserEnchashmentAccount; import com.cyhd.service.dao.po.UserIncome; import com.cyhd.service.impl.AntiCheatService; import com.cyhd.service.impl.UserEnchashmentService; import com.cyhd.service.impl.UserIncomeService; import com.cyhd.service.impl.UserService; import com.cyhd.service.util.RequestUtil; import com.cyhd.service.util.UserLock; import com.cyhd.web.common.BaseAction; import com.cyhd.web.exception.CommonException; import com.cyhd.web.exception.ErrorCode; @Controller @RequestMapping("/api/v1") public class EnchashmentAction extends BaseAction { @Resource UserService userService; @Resource UserEnchashmentService userEnchashmentService; @Resource private AntiCheatService antiCheatService; private static final String prefix = "/api/v1/"; /** * 提现 * @param request * @param response * @return ModelAndView */ @Resource UserIncomeService userIncomeService; @RequestMapping(value = {"/enchashment/accounts","/ap/pa"}, method = RequestMethod.POST) public ModelAndView accounts(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView mv = new ModelAndView(); mv.setViewName(prefix + "enchashment/accounts.json.ftl"); User user = getUser(request); UserEnchashmentAccount ue = userEnchashmentService.getUserEnchashmentAccount(user.getId()); mv.addObject("ue", ue); fillStatus(mv); return mv; } @RequestMapping(value = {"/enchashment/save"},method=RequestMethod.POST) public ModelAndView save(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView mv = new ModelAndView(); mv.setViewName(prefix + "common/save.json.ftl"); User u = getUser(request); Lock lock = UserLock.getUserLock(u.getId()); lock.tryLock(); try{ int type = ServletRequestUtils.getIntParameter(request, "type", UserEnchashment.ACCOUNT_TYPE_WX); int amount = ServletRequestUtils.getIntParameter(request, "amount", 0); type = type == UserEnchashment.ACCOUNT_TYPE_WX ? UserEnchashment.ACCOUNT_TYPE_WX : UserEnchashment.ACCOUNT_TYPE_ALIPAY; if (amount <= 0){ throw new CommonException(ErrorCode.ERROR_CODE_WALLET_PARAMETER_WRONG, "提现金额错误"); } //检查提现金额是否是设定的金额 UserEnchashmentService.EnchashmentStage enchashmentStage = UserEnchashmentService.EnchashmentStage.getStageByAmount(amount); if (enchashmentStage == null){ //未找到对应的提现阶段 throw new CommonException(ErrorCode.ERROR_CODE_WALLET_PARAMETER_WRONG, "提现金额错误"); } //提现类型支不支持该金额 if (!enchashmentStage.isValidOfType(type)){ throw new CommonException(ErrorCode.ERROR_CODE_WALLET_PARAMETER_WRONG, "提现金额错误"); } UserIncome income = userIncomeService.getUserIncome(u.getId()); int balance = income.getBalance(); if(balance < 1000) { throw new CommonException(ErrorCode.ERROR_CODE_WALLET_NOT_ENOUTH,"账户余额不足!"); } //余额不足 if (amount > balance){ throw new CommonException(ErrorCode.ERROR_CODE_WALLET_PARAMETER_WRONG, "提现金额错误"); } //当前正在提现,保证一次只会有一笔在提现中 if (income.getEncashing() > 0){ throw new CommonException(ErrorCode.ERROR_CODE_WALLET_PARAMETER_WRONG, "您有未处理完成的提现"); } //检查今天是不是已经提现成功过 UserEnchashment lastEnchashment = userEnchashmentService.getUserLatestEnchashment(u.getId()); if (lastEnchashment != null && lastEnchashment.getStatus() == UserEnchashment.STATUS_SUCCESS && DateUtil.isSameDay(GenerateDateUtil.getCurrentDate(), lastEnchashment.getMention_time())){ throw new CommonException(ErrorCode.ERROR_CODE_SAME_DAY, "您今天已经提过现"); } UserEnchashmentAccount userAccount = userEnchashmentService.getUserEnchashmentAccount(u.getId()); //已被封禁 if (userAccount.isMasked()){ throw new CommonException(ErrorCode.ERROR_CODE_USER_MASKED, "您的账号异常,暂时无法提现,请联系客服处理"); } String accountName = "",account=""; if(type == UserEnchashment.ACCOUNT_TYPE_WX) { if(userAccount.getWx_bank_name().isEmpty()) { throw new CommonException(ErrorCode.ERROR_CODE_LACA_WX_PARAMETER, "缺少微信提现账号"); } if (!userEnchashmentService.isInWeixinEnchashTime()){ throw new CommonException(ErrorCode.ERROR_CODE_LACA_WX_PARAMETER, "不在微信提现的时间范围内"); } if (!userEnchashmentService.isUnderWeixinLimit()){ throw new CommonException(ErrorCode.ERROR_CODE_LACA_WX_PARAMETER, "今日微信提现总额已达上限,请使用支付宝提现"); } String openId = userService.getUserOpenID(GlobalConfig.weixin_pay_appid, u.getId()); if (StringUtil.isBlank(openId)){ throw new CommonException(ErrorCode.ERROR_CODE_PARAMETER, "您未关注“秒赚大钱”公众号,请关注后再提现到微信钱包"); } //微信提现,account为openID accountName = userAccount.getWx_bank_name(); account = openId; } else if(type == UserEnchashment.ACCOUNT_TYPE_ALIPAY) { if(userAccount.getAlipay_account().isEmpty()||userAccount.getAlipay_name().isEmpty() ) { throw new CommonException(ErrorCode.ERROR_CODE_LACA_ALIPAY_PARAMETER, "缺少支付宝提现账号"); } account = userAccount.getAlipay_account(); accountName = userAccount.getAlipay_name(); // if("jjww9009@126.com".equals(account)){ logger.error("jjww9009@126.com支付宝账号出现:账号:{},user:{},ip:{}",account,u,RequestUtil.getIpAddr(request)); throw new CommonException(ErrorCode.ERROR_CODE_LACA_ALIPAY_PARAMETER, "亲,财务回家结婚,一个月后才能回来!!!"); }else if(Constants.blacklist.contains(account)){ throw new CommonException(ErrorCode.ERROR_CODE_LACA_ALIPAY_PARAMETER, "绑定的支付宝账号过多"); }else{ int count = userEnchashmentService.countAccountByAlipay_account(account); if(count > 2){ throw new CommonException(ErrorCode.ERROR_CODE_LACA_ALIPAY_PARAMETER, "绑定的支付宝账号过多"); } } UserEnchashment enchashment = this.userEnchashmentService.getUserEnchashmentTopByAccount(account); if(enchashment != null){ if(DateUtil.isSameDay(GenerateDateUtil.getCurrentDate(), enchashment.getMention_time())){ throw new CommonException(ErrorCode.ERROR_CODE_SAME_DAY, "今天该支付宝已提现"); } } } UserEnchashment userEnchashment = new UserEnchashment(); userEnchashment.setUser_id(u.getId()); userEnchashment.setAmount(amount); userEnchashment.setAccount(account); userEnchashment.setAccount_name(accountName); userEnchashment.setMention_time(new Date()); userEnchashment.setStatus(UserEnchashment.STATUS_INIT); userEnchashment.setType(type); userEnchashment.setIp(RequestUtil.getIpAddr(request)); if (userAccount.isAutoPassed()){ userEnchashment.setStatus(UserEnchashment.STATUS_AUDIT_SUCCESS); logger.info("auto pass user enchashment, user:{}, account:{}, amount:{}", u.getId(), userAccount.getAlipay_account(), userEnchashment.getAmount()); }else if (antiCheatService.isAutoPassEnchashment(request, u, userEnchashment)){ //审核通过修改状态 userEnchashment.setStatus(UserEnchashment.STATUS_AUDIT_SUCCESS); //设置自动审核标志位 userEnchashmentService.setAutoCheckPassed(userAccount.getUser_id()); logger.info("auto pass user enchashment and set account passed, user:{}, account:{}, amount:{}", u.getId(), userAccount.getAlipay_account(), userEnchashment.getAmount()); } if (userIncomeService.addUserEncashingAmount(u.getId(), amount) && userEnchashmentService.save(userEnchashment) ) { if (userEnchashment.getStatus() == UserEnchashment.STATUS_INIT){ //未能自动审核通过,评估账号 antiCheatService.evaluateUserEnchash(request, u, userAccount, userEnchashment); } fillStatus(mv); } else { fillErrorStatus(mv, ErrorCode.ERROR_CODE_UNKNOWN); } }finally{ lock.unlock(); } return mv; } /** * 账号设置 * * @param request * @param response * @return ModelAndView */ @RequestMapping(value = {"/enchashment/setting","/ao/oa"},method=RequestMethod.POST) public ModelAndView saveAccount(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView mv = new ModelAndView(); mv.setViewName(prefix + "common/save.json.ftl"); int type = ServletRequestUtils.getIntParameter(request, "type", 1); User u = getUser(request); UserEnchashmentAccount account = userEnchashmentService.getUserEnchashmentAccount(u.getId()); if(account == null){ account = new UserEnchashmentAccount(); account.setUser_id(u.getId()); account.setCreatetime(new Date()); } account.setUpdatetime(new Date()); if(type == UserEnchashment.ACCOUNT_TYPE_WX) { //微信 String wx_bank_name = HtmlUtil.toPlainText(ServletRequestUtils.getStringParameter(request, "wx_bank_name")); if (StringUtil.isBlank(wx_bank_name)){ throw new CommonException(ErrorCode.ERROR_CODE_PARAMETER, "输入参数不合法!"); } if(Validator.isContainDigitalLetter(wx_bank_name)) { throw new CommonException(ErrorCode.ERROR_CODE_PARAMETER, "请输入您微信钱包绑定的银行卡的姓名!"); } String openId = userService.getUserOpenID(GlobalConfig.weixin_pay_appid, u.getId()); if (StringUtil.isBlank(openId)){ throw new CommonException(ErrorCode.ERROR_CODE_PARAMETER, "您未关注“秒赚大钱”公众号,请关注后再设置微信提现账号"); } account.setWx_bank_name(wx_bank_name); } else { //支付宝 String alipay_name = HtmlUtil.toPlainText(ServletRequestUtils.getStringParameter(request, "alipay_name")); String alipay_account = HtmlUtil.toPlainText(ServletRequestUtils.getStringParameter(request, "alipay_account")); if (StringUtils.isEmpty(alipay_name) || StringUtils.isEmpty(alipay_account)) { throw new CommonException(ErrorCode.ERROR_CODE_PARAMETER, "输入参数不合法!"); } if(Validator.isContainDigitalLetter(alipay_name)) { throw new CommonException(ErrorCode.ERROR_CODE_PARAMETER, "请输入您的支付宝实名认证姓名!"); } if(alipay_account.indexOf("@") >=0) { if(!Validator.isEmail(alipay_account)) { throw new CommonException(ErrorCode.ERROR_CODE_PARAMETER, "输入参数不合法!"); } } else { if(!Validator.isMobile(alipay_account)) { throw new CommonException(ErrorCode.ERROR_CODE_PARAMETER, "输入参数不合法!"); } //判断手机号是不是别的用户绑定过的手机号 User anotherUser = userService.getUserByMobile(alipay_account); if (anotherUser != null && anotherUser.getId() != u.getId()){ //不是当前用户绑定的手机号 logger.warn("用户的提现账号为其他用户绑定的手机号,user:{}, mobile:{}, another user:{}", u.getId(), alipay_account, anotherUser.getId()); throw new CommonException(ErrorCode.ERROR_CODE_PARAMETER, "该支付宝账号已被别人绑定"); } } account.setAlipay_account(alipay_account); account.setAlipay_name(alipay_name); //检查不通过 boolean checkFailed = false; if ("jjww9009@126.com".equals(account)) { logger.error("绑定支付宝达五次以上的支付宝账号出现:账号:{},user:{},ip:{}",alipay_account,u,RequestUtil.getIpAddr(request)); //TODO 先让你绑定成功,看看你有多少用户 }else if(Constants.blacklist.contains(alipay_account)) { logger.error("绑定支付宝达五次以上的支付宝账号出现:账号:{},user:{},ip:{}", alipay_account, u, RequestUtil.getIpAddr(request)); fillErrorStatus(mv, ErrorCode.ERROR_CODE_USER_TYPE); checkFailed = true; }else if(userEnchashmentService.isBlacklist(alipay_account, alipay_name)){ //检查要绑定的支付宝账号是不是已被封禁 logger.error("设置支付宝账号时,绑定一个已封掉的支付宝账号,账号:{},user:{},ip:{}", alipay_account, u, RequestUtil.getIpAddr(request)); //封用户 userService.setMaskedUser(u.getId(), true, "绑定一个已封禁的支付宝账号"); fillErrorStatus(mv, ErrorCode.ERROR_CODE_UNKNOWN); checkFailed = true; }else{ UserEnchashmentAccount accountTmp = userEnchashmentService.getAccountByAlipay_account(alipay_account); //不是同一个用户 if(accountTmp != null && accountTmp.getUser_id() != u.getId()){ logger.error("设置支付宝账号时,已存在的支付宝账号,账号:{},user:{},ip:{}",alipay_account,u,RequestUtil.getIpAddr(request)); fillErrorStatus(mv, ErrorCode.ERROR_CODE_UNKNOWN, "该支付宝账号已被别人绑定,请重新输入"); checkFailed = true; } } if(checkFailed){ return mv; } } if (userEnchashmentService.addOrUpdateEnchashmentAccount(account)){ antiCheatService.evaluateEnchashAccount(request, u, account); fillStatus(mv); } else { fillErrorStatus(mv, ErrorCode.ERROR_CODE_UNKNOWN); } return mv; } /** * 提现列表 * * @param request * @param response * @return ModelAndView */ @RequestMapping(value = "/enchashment/list", method = RequestMethod.GET) public ModelAndView list(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView mv = new ModelAndView(); mv.setViewName(prefix + "enchashment/list.json.ftl"); User u = getUser(request); int page = ServletRequestUtils.getIntParameter(request, "page", 0); int start = page * defaultPageSize; mv.addObject("userEnchashments", userEnchashmentService.getUserEnchashmentList(u.getId(), start, defaultPageSize)); return mv; } }
[ "rhaik@163.com" ]
rhaik@163.com
ca158fb67f336679aea5509cc69f95d982c2f207
04f6843fc4b230d5a333a7cc467cd4bf3608de97
/app/src/main/java/com/hf/resreader/resreader/DimenResReader.java
1b62a9e085d76ea28c4149a424be93a6620c5d3f
[ "Apache-2.0" ]
permissive
vancebs/ResReader
add0df6630c72266f5b31c6e1bd64c6151809c71
8c6c2ecdecd7cc704825f6383ebfbec151689ea2
refs/heads/master
2021-01-10T02:04:25.816047
2016-02-25T02:42:49
2016-02-25T02:42:49
46,897,616
3
0
null
null
null
null
UTF-8
Java
false
false
863
java
package com.hf.resreader.resreader; import android.content.Context; import android.content.res.Resources; import android.util.Log; /** * Created by Fan on 2015/8/21. * Dimen resource reader */ public class DimenResReader extends AbstractStringTypeResReader { public static final String TAG = "DimenResReader"; private static final String VALUE_FORMAT = "getDimension(): %fdp\ngetDimensionPixelOffset(): %dpx\ngetDimensionPixelSize: %dpx"; @Override public String getValue(Context resContext, int resId) { // ResourceNotFoundException Already handled by super class Resources res = resContext.getResources(); float dp = res.getDimension(resId); int px = res.getDimensionPixelOffset(resId); int size = res.getDimensionPixelSize(resId); return String.format(VALUE_FORMAT, dp, px, size); } }
[ "vancebs@qq.com" ]
vancebs@qq.com
312c7afca356be8f9733e7b6c363bc552406a504
11830d25dbd12a10d6cd590d70774d41b62b0c1e
/app/src/androidTest/java/com/example/preshlen/sologamelonesurvivour/ApplicationTest.java
7900ec18694784d9afcfbdcd7f31ccac5ea72bc6
[]
no_license
IvoRRaykov/IT-Talents_Project1
86c417c8e53621fe1c55e20c70b7e263fab61c45
29a86c3dbeab248182b2d9b6b68c3b2856314df5
refs/heads/master
2021-01-10T16:26:49.272438
2016-03-15T23:20:02
2016-03-15T23:20:02
53,722,180
0
0
null
null
null
null
UTF-8
Java
false
false
373
java
package com.example.preshlen.sologamelonesurvivour; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "ivo_raykow@abv.bg" ]
ivo_raykow@abv.bg
e323ca41f194f5aaeed88af4f5c9e067fffbc0a5
6dc3e20ab05923c125628df11cceef26b94b39ff
/src/main/java/org/hl7/v3/MFMIMT700711UV01ReplacementOf.java
2421a45c43578bb4084f8ffc368e758b050fdcbb
[]
no_license
joaoamilcar/barramento-cns
11ecccaa44a58dec1f8070c81401312d8a9f60ef
6349bb8c7de8fbf2dc946696380748bd65686c48
refs/heads/master
2021-01-10T09:52:42.688073
2016-02-25T17:33:21
2016-02-25T17:33:21
52,538,172
2
2
null
null
null
null
UTF-8
Java
false
false
6,100
java
package org.hl7.v3; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Classe Java de MFMI_MT700711UV01.ReplacementOf complex type. * * <p>O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. * * <pre> * &lt;complexType name="MFMI_MT700711UV01.ReplacementOf"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;group ref="{urn:hl7-org:v3}InfrastructureRootElements"/> * &lt;element name="priorRegistration" type="{urn:hl7-org:v3}MFMI_MT700711UV01.PriorRegistration"/> * &lt;/sequence> * &lt;attGroup ref="{urn:hl7-org:v3}InfrastructureRootAttributes"/> * &lt;attribute name="nullFlavor" type="{urn:hl7-org:v3}NullFlavor" /> * &lt;attribute name="typeCode" use="required" type="{urn:hl7-org:v3}ActRelationshipType" fixed="RPLC" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "MFMI_MT700711UV01.ReplacementOf", propOrder = { "realmCode", "typeId", "templateId", "priorRegistration" }) public class MFMIMT700711UV01ReplacementOf { protected List<CS> realmCode; protected II typeId; protected List<II> templateId; @XmlElement(required = true, nillable = true) protected MFMIMT700711UV01PriorRegistration priorRegistration; @XmlAttribute(name = "nullFlavor") protected List<String> nullFlavor; @XmlAttribute(name = "typeCode", required = true) protected List<String> typeCode; /** * Gets the value of the realmCode property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the realmCode property. * * <p> * For example, to add a new item, do as follows: * <pre> * getRealmCode().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link CS } * * */ public List<CS> getRealmCode() { if (realmCode == null) { realmCode = new ArrayList<CS>(); } return this.realmCode; } /** * Obtém o valor da propriedade typeId. * * @return * possible object is * {@link II } * */ public II getTypeId() { return typeId; } /** * Define o valor da propriedade typeId. * * @param value * allowed object is * {@link II } * */ public void setTypeId(II value) { this.typeId = value; } /** * Gets the value of the templateId property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the templateId property. * * <p> * For example, to add a new item, do as follows: * <pre> * getTemplateId().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link II } * * */ public List<II> getTemplateId() { if (templateId == null) { templateId = new ArrayList<II>(); } return this.templateId; } /** * Obtém o valor da propriedade priorRegistration. * * @return * possible object is * {@link MFMIMT700711UV01PriorRegistration } * */ public MFMIMT700711UV01PriorRegistration getPriorRegistration() { return priorRegistration; } /** * Define o valor da propriedade priorRegistration. * * @param value * allowed object is * {@link MFMIMT700711UV01PriorRegistration } * */ public void setPriorRegistration(MFMIMT700711UV01PriorRegistration value) { this.priorRegistration = value; } /** * Gets the value of the nullFlavor property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the nullFlavor property. * * <p> * For example, to add a new item, do as follows: * <pre> * getNullFlavor().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getNullFlavor() { if (nullFlavor == null) { nullFlavor = new ArrayList<String>(); } return this.nullFlavor; } /** * Gets the value of the typeCode property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the typeCode property. * * <p> * For example, to add a new item, do as follows: * <pre> * getTypeCode().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getTypeCode() { if (typeCode == null) { typeCode = new ArrayList<String>(); } return this.typeCode; } }
[ "joaoamilcar@gmail.com" ]
joaoamilcar@gmail.com
e198969b9af58e769815fe6a9470ebcd6b6b0a54
7b6f44c0b6f5d2f71b1ec12d292e1064dc81f00e
/Layer0/syntaxtree/Declarator.java
b05ea4b652625357cd4b29bfc687e92c2efc0d16
[]
no_license
bhuvan002/C-Obfuscator
a40af67702f4e067497e970a159ed4904fdb4e6d
1d87144ffea373670b31fd4578f6b2ebf470a81f
refs/heads/master
2021-05-09T02:00:17.669093
2016-11-29T11:44:52
2016-11-29T11:44:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
688
java
// // Generated by JTB 1.3.2 // package syntaxtree; /** * Grammar production: * f0 -> [ Pointer() ] * f1 -> DirectDeclarator() */ public class Declarator implements Node { public NodeOptional f0; public DirectDeclarator f1; public Declarator(NodeOptional n0, DirectDeclarator n1) { f0 = n0; f1 = n1; } public void accept(visitor.Visitor v) { v.visit(this); } public <R,A> R accept(visitor.GJVisitor<R,A> v, A argu) { return v.visit(this,argu); } public <R> R accept(visitor.GJNoArguVisitor<R> v) { return v.visit(this); } public <A> void accept(visitor.GJVoidVisitor<A> v, A argu) { v.visit(this,argu); } }
[ "bikashgogoi001@gmail.com" ]
bikashgogoi001@gmail.com
5b861c3919fc7d1ee8765b36f1b10e23c6a1c494
a2f0e76d9bebceb1241d079d7bba38bd0a35a69c
/unit3-3/src/MyRailwaySystem.java
c2340e476f1b38f58a65b2ef23d2d15f3e0ac7ef
[]
no_license
zzziyer/Object-Oriented-Unit3
b0ba6aa8244a2b9c0c4ab2accf530d391bea6834
80b2450e6245388dff868e7c2bd06c32ece243d8
refs/heads/master
2022-07-02T06:53:25.927064
2020-05-11T11:53:13
2020-05-11T11:53:13
263,015,437
0
0
null
null
null
null
UTF-8
Java
false
false
10,517
java
import com.oocourse.specs3.models.NodeIdNotFoundException; import com.oocourse.specs3.models.NodeNotConnectedException; import com.oocourse.specs3.models.Path; import com.oocourse.specs3.models.PathIdNotFoundException; import com.oocourse.specs3.models.PathNotFoundException; import com.oocourse.specs3.models.RailwaySystem; import javafx.util.Pair; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; //lehgth 1 //ticket 2 //transfer 3 //pleasant 4 public class MyRailwaySystem implements RailwaySystem { private HashMap<Integer, MyPath> pathHashMap = new HashMap<>(); private HashMap<Integer, Integer> nodes = new HashMap<>(); private HashMap<Pair<Integer, Integer>, Integer> edges = new HashMap<>(); private ArrayList<HashSet<Integer>> blocks = new ArrayList<>(); private int id = 1; private Weight weight = new Weight(); private boolean rootAgain = true; public MyRailwaySystem() { //none } //@Override public int getUnpleasantValue(Path path, int i, int i1) { return 0; } @Override public int getLeastTicketPrice(int i, int i1) throws NodeIdNotFoundException, NodeNotConnectedException { if (!nodes.containsKey(i)) { throw new NodeIdNotFoundException(i); } else if (!nodes.containsKey(i1)) { throw new NodeIdNotFoundException(i1); } else if (weight.inquire(i, i1, 1) == Integer.MAX_VALUE) { throw new NodeNotConnectedException(i, i1); } else { if (i == i1) { return 0; } return weight.inquire(i, i1, 2) - 2; } } @Override public int getLeastTransferCount(int i, int i1) throws NodeIdNotFoundException, NodeNotConnectedException { if (!nodes.containsKey(i)) { throw new NodeIdNotFoundException(i); } else if (!nodes.containsKey(i1)) { throw new NodeIdNotFoundException(i1); } else if (weight.inquire(i, i1, 1) == Integer.MAX_VALUE) { throw new NodeNotConnectedException(i, i1); } else { if (i == i1) { return 0; } return weight.inquire(i, i1, 3) - 1; } } @Override public int getLeastUnpleasantValue(int i, int i1) throws NodeIdNotFoundException, NodeNotConnectedException { if (!nodes.containsKey(i)) { throw new NodeIdNotFoundException(i); } else if (!nodes.containsKey(i1)) { throw new NodeIdNotFoundException(i1); } else if (weight.inquire(i, i1, 1) == Integer.MAX_VALUE) { throw new NodeNotConnectedException(i, i1); } else { if (i == i1) { return 0; } return weight.inquire(i, i1, 4) - 32; } } @Override public int getConnectedBlockCount() { if (rootAgain) { blocks.clear(); Collection<MyPath> paths = pathHashMap.values(); for (Path p : paths) { MyPath pp = (MyPath) p; ArrayList<Integer> n = pp.getPath(); if (blocks.size() == 0) { blocks.add(new HashSet<>(n)); continue; } ArrayList<Integer> merge = new ArrayList<>(); for (int k : n) { for (int i = 0; i < blocks.size(); i++) { if (blocks.get(i).contains(k)) { if (!new HashSet<Integer>(merge).contains(i)) { merge.add(i); } } } } //System.out.println(merge); HashSet<Integer> present = new HashSet<>(n); for (int i = 0; i < merge.size(); i++) { if (merge.get(i) >= blocks.size() || merge.get(i) < 0) { break; } present.addAll(blocks.get(merge.get(i))); int remo = merge.get(i); blocks.remove(remo); for (int j = i + 1; j < merge.size(); j++) { if (merge.get(j) > merge.get(i)) { merge.set(j, merge.get(j) - 1); } } } blocks.add(present); } rootAgain = false; } return blocks.size(); } @Override public boolean containsNode(int i) { if (nodes.containsKey(i)) { return true; } else { return false; } } @Override public boolean containsEdge(int i, int i1) { if (edges.containsKey(new Pair<>(i, i1))) { return true; } else { return false; } } @Override public boolean isConnected(int i, int i1) throws NodeIdNotFoundException { if (!nodes.containsKey(i)) { throw new NodeIdNotFoundException(i); } else if (!nodes.containsKey(i1)) { throw new NodeIdNotFoundException(i1); } else { if (i == i1) { return true; } if (weight.inquire(i, i1, 1) < Integer.MAX_VALUE) { return true; } else { return false; } } } @Override public int getShortestPathLength(int i, int i1) throws NodeIdNotFoundException, NodeNotConnectedException { if (!nodes.containsKey(i)) { throw new NodeIdNotFoundException(i); } else if (!nodes.containsKey(i1)) { throw new NodeIdNotFoundException(i1); } else if (weight.inquire(i, i1, 1) == Integer.MAX_VALUE) { throw new NodeNotConnectedException(i, i1); } else { if (i == i1) { return 0; } return weight.inquire(i, i1, 1); } } @Override public int size() { return pathHashMap.size(); } @Override public boolean containsPath(Path path) { if (pathHashMap.containsValue(path)) { return true; } else { return false; } } @Override public boolean containsPathId(int i) { if (pathHashMap.containsKey(i)) { return true; } else { return false; } } @Override public Path getPathById(int i) throws Exception { if (pathHashMap.containsKey(i)) { return pathHashMap.get(i); } else { throw new PathIdNotFoundException(i); } } @Override public int getPathId(Path path) throws Exception { if (path == null || !path.isValid() || !pathHashMap.containsValue(path)) { throw new PathNotFoundException(path); } Iterator iterator = pathHashMap.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry temp = (Map.Entry) iterator.next(); if (temp.getValue().equals(path)) { return (int) temp.getKey(); } } return 0; } @Override public int addPath(Path path) throws Exception { ArrayList<Integer> newnode = new ArrayList<>(); if (path == null || !path.isValid()) { return 0; } if (pathHashMap.containsValue(path)) { return getPathId(path); } else { rootAgain = true; pathHashMap.put(id, (MyPath) path); for (int k : path) { if (nodes.containsKey(k)) { nodes.put(k, nodes.get(k) + 1); } else { newnode.add(k); nodes.put(k, 1); } } for (int i = 0; i < path.size() - 1; i++) { Pair pair = new Pair<>(path.getNode(i), path.getNode(i + 1)); Pair pair1 = new Pair<>(path.getNode(i + 1), path.getNode(i)); if (edges.containsKey(pair)) { edges.put(pair, edges.get(pair) + 1); edges.put(pair1, edges.get(pair1) + 1); } else { edges.put(pair, 1); edges.put(pair1, 1); } } id += 1; weight.add((MyPath) path, newnode); return (id - 1); } } @Override public int removePath(Path path) throws Exception { if (path == null || !path.isValid() || !pathHashMap.containsValue(path)) { throw new PathNotFoundException(path); } int id = getPathId(path); pathHashMap.remove(id); ArrayList<Integer> denodes = remove(path); rootAgain = true; weight.remove((MyPath) path, denodes); return id; } @Override public void removePathById(int i) throws PathIdNotFoundException { if (!pathHashMap.containsKey(i)) { throw new PathIdNotFoundException(i); } Path temp = pathHashMap.remove(i); ArrayList<Integer> denodes = remove(temp); weight.remove((MyPath) temp, denodes); rootAgain = true; } public ArrayList<Integer> remove(Path path) { ArrayList<Integer> re = new ArrayList<>(); for (int k : path) { if (nodes.get(k) != 1) { nodes.put(k, nodes.get(k) - 1); } else { nodes.remove(k); re.add(k); } } for (int i = 0; i < path.size() - 1; i++) { Pair pair = new Pair<>(path.getNode(i), path.getNode(i + 1)); Pair pair1 = new Pair<>(path.getNode(i + 1), path.getNode(i)); if (edges.get(pair) != 1) { edges.put(pair, edges.get(pair) - 1); edges.put(pair1, edges.get(pair1) - 1); } else { edges.remove(pair); edges.remove(pair1); } } return re; } @Override public int getDistinctNodeCount() { return nodes.size(); } }
[ "1120007192@qq.com" ]
1120007192@qq.com
35b1c37e1fc5dc515ae1e13e0568eee46cd275f3
a0d616ffe4dd52448f07b06b17cf2d155b63d384
/passbook/src/main/java/com/web3n/passbook/service/impl/InventoryServiceImpl.java
44d7581c9787ad844348f720bff97522850d052c
[]
no_license
xyuh111/java_coupon
0264bf338a7c50fe36739be4599a48816d536afe
299d203e563d1e7572f36d2e2553368e665553bc
refs/heads/master
2022-06-27T05:35:24.971683
2020-03-06T10:47:46
2020-03-06T10:47:46
243,205,259
0
0
null
2022-06-21T02:53:17
2020-02-26T08:09:25
Java
UTF-8
Java
false
false
5,249
java
package com.web3n.passbook.service.impl; import com.spring4all.spring.boot.starter.hbase.api.HbaseTemplate; import com.web3n.passbook.constant.Constants; import com.web3n.passbook.dao.MerchantsDao; import com.web3n.passbook.entity.Merchants; import com.web3n.passbook.mapper.PassTemplateRowMapper; import com.web3n.passbook.service.IInventoryService; import com.web3n.passbook.service.IUserPassService; import com.web3n.passbook.utils.RowKeyGenUtil; import com.web3n.passbook.vo.*; import lombok.extern.slf4j.Slf4j; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.filter.CompareFilter; import org.apache.hadoop.hbase.filter.FilterList; import org.apache.hadoop.hbase.filter.LongComparator; import org.apache.hadoop.hbase.filter.SingleColumnValueFilter; import org.apache.hadoop.hbase.util.Bytes; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.*; import java.util.stream.Collectors; /** * @create 2020-03-05 14:49 * 获取库存信息,只返回用户没有领取的 */ @Slf4j @Service public class InventoryServiceImpl implements IInventoryService { /** HBase 客户端 */ private final HbaseTemplate hbaseTemplate; /** MerchantsDao 接口 */ private final MerchantsDao merchantsDao; private final IUserPassService userPassService; @Autowired public InventoryServiceImpl(HbaseTemplate hbaseTemplate, MerchantsDao merchantsDao, IUserPassService userPassService) { this.hbaseTemplate = hbaseTemplate; this.merchantsDao = merchantsDao; this.userPassService = userPassService; } @Override @SuppressWarnings("unchecked") /** 把强转警告注释 (List<PassInfo>) */ public Response getInventoryInfo(Long userId) throws Exception { Response allUserPass = userPassService.getUserAllPassInfo(userId); List<PassInfo> passInfos = (List<PassInfo>) allUserPass.getData(); List<PassTemplate> excludeObject = passInfos.stream().map(PassInfo::getPassTemplate).collect(Collectors.toList()); List<String> excludeIds = new ArrayList<>(); excludeObject.forEach(e -> excludeIds.add( RowKeyGenUtil.genPassTemplateRowKey(e) )); return new Response(new InventoryResponse(userId, buildPassTemplateInfo(getAvailablePassTemplate(excludeIds)))); } /** * 获取系统中可用的优惠券 * @param excludeIds 需要排除的优惠券 ids * @return {@link PassTemplate} */ private List<PassTemplate> getAvailablePassTemplate(List<String> excludeIds){ FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ONE); filterList.addFilter( new SingleColumnValueFilter( Bytes.toBytes(Constants.PassTemplateTable.FAMILY_C), Bytes.toBytes(Constants.PassTemplateTable.LIMIT), CompareFilter.CompareOp.GREATER, new LongComparator(0L) ) ); filterList.addFilter( new SingleColumnValueFilter( Bytes.toBytes(Constants.PassTemplateTable.FAMILY_C), Bytes.toBytes(Constants.PassTemplateTable.LIMIT), CompareFilter.CompareOp.GREATER, Bytes.toBytes("-1") ) ); Scan scan = new Scan(); scan.setFilter(filterList); List<PassTemplate> validTemplates = hbaseTemplate.find(Constants.PassTemplateTable.TABLE_NAME, scan, new PassTemplateRowMapper()); List<PassTemplate> availablePassTemplates = new ArrayList<>(); Date cur = new Date(); for (PassTemplate validTemplate : validTemplates) { if(excludeIds.contains(RowKeyGenUtil.genPassTemplateRowKey(validTemplate))){ continue; } if(cur.getTime() >= validTemplate.getStart().getTime() && cur.getTime() <= validTemplate.getEnd().getTime()){ availablePassTemplates.add(validTemplate); } } return availablePassTemplates; }; /** * 构造优惠券的信息 * @param passTemplates {@link PassTemplate} * @return {@link PassTemplateInfo} */ private List<PassTemplateInfo> buildPassTemplateInfo(List<PassTemplate> passTemplates){ Map<Integer, Merchants> merchantsMap = new HashMap<>(); List<Integer> merchantsIds = passTemplates.stream().map( PassTemplate::getId ).collect(Collectors.toList()); List<Merchants> merchants = merchantsDao.findByIdIn(merchantsIds); merchants.forEach(m -> merchantsMap.put(m.getId(), m)); List<PassTemplateInfo> result = new ArrayList<>(passTemplates.size()); for (PassTemplate passTemplate : passTemplates) { Merchants mc = merchantsMap.getOrDefault(passTemplate.getId(), null); if (null == mc){ log.error("Merchants Error : {}", passTemplate.getId()); continue; } result.add(new PassTemplateInfo(passTemplate, mc)); } return result; } }
[ "i@xieyuhui.com" ]
i@xieyuhui.com
8c2878c944806ca48efe629962814ae358e2da1b
3c40c28fd326b7dbb8d811031997cf21dabddc37
/src/org/communitybridge/main/CBMetrics.java
b452bf0af4ce89d2def264411f3234fa001e3065
[]
no_license
FabioZumbi12/CommunityBridge
de6f39203e7ee4b730e7d47989693e309e5957fa
7d0849bb1737786d8e120a5dd2880f6c82ee45a9
refs/heads/development
2020-12-03T06:37:08.041419
2015-02-12T14:41:04
2015-02-12T14:41:04
53,055,761
2
1
null
2016-03-03T14:20:00
2016-03-03T14:19:59
null
UTF-8
Java
false
false
25,078
java
/* * Copyright 2011-2013 Tyler Blair. 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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''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 AUTHOR 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. * * The views and conclusions contained in the software and documentation are those of the * authors and contributors and should not be interpreted as representing official policies, * either expressed or implied, of anybody else. */ package org.communitybridge.main; import org.bukkit.Bukkit; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.scheduler.BukkitTask; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.net.Proxy; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Set; import java.util.UUID; import java.util.logging.Level; import java.util.zip.GZIPOutputStream; public class CBMetrics { /** * The current revision number */ private final static int REVISION = 7; /** * The base url of the metrics domain */ private static final String BASE_URL = "http://report.mcstats.org"; /** * The url used to report a server's status */ private static final String REPORT_URL = "/plugin/%s"; /** * Interval of time to ping (in minutes) */ private static final int PING_INTERVAL = 15; /** * The plugin this metrics submits for */ private final Plugin plugin; /** * All of the custom graphs to submit to metrics */ private final Set<Graph> graphs = Collections.synchronizedSet(new HashSet<Graph>()); /** * The plugin configuration file */ private final YamlConfiguration configuration; /** * The plugin configuration file */ private final File configurationFile; /** * Unique server id */ private final String guid; /** * Debug mode */ private final boolean debug; /** * Lock for synchronization */ private final Object optOutLock = new Object(); /** * The scheduled task */ private volatile BukkitTask task = null; public CBMetrics(final Plugin plugin) throws IOException { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } this.plugin = plugin; // load the config configurationFile = getConfigFile(); configuration = YamlConfiguration.loadConfiguration(configurationFile); // add some defaults configuration.addDefault("opt-out", false); configuration.addDefault("guid", UUID.randomUUID().toString()); configuration.addDefault("debug", false); // Do we need to create the file? if (configuration.get("guid", null) == null) { configuration.options().header("http://mcstats.org").copyDefaults(true); configuration.save(configurationFile); } // Load the guid then guid = configuration.getString("guid"); debug = configuration.getBoolean("debug", false); } /** * Construct and create a Graph that can be used to separate specific plotters to their own graphs on the metrics * website. Plotters can be added to the graph object returned. * * @param name The name of the graph * @return Graph object created. Will never return NULL under normal circumstances unless bad parameters are given */ public Graph createGraph(final String name) { if (name == null) { throw new IllegalArgumentException("Graph name cannot be null"); } // Construct the graph object final Graph graph = new Graph(name); // Now we can add our graph graphs.add(graph); // and return back return graph; } /** * Add a Graph object to BukkitMetrics that represents data for the plugin that should be sent to the backend * * @param graph The name of the graph */ public void addGraph(final Graph graph) { if (graph == null) { throw new IllegalArgumentException("Graph cannot be null"); } graphs.add(graph); } private BukkitTask startTask(Runnable runnable) { return Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, runnable, 0, PING_INTERVAL * 1200); } /** * Start measuring statistics. This will immediately create an async repeating task as the plugin and send the * initial data to the metrics backend, and then after that it will post in increments of PING_INTERVAL * 1200 * ticks. * * @return True if statistics measuring is running, otherwise false. */ public boolean start() { synchronized (optOutLock) { // Did we opt out? if (isOptOut()) { return false; } // Is metrics already running? if (task != null) { return true; } // Begin hitting the server with glorious data task = startTask(new Runnable() { private boolean firstPost = true; @Override public void run() { try { // This has to be synchronized or it can collide with the disable method. synchronized (optOutLock) { // Disable Task, if it is running and the server owner decided to opt-out if (isOptOut() && task != null) { task.cancel(); task = null; // Tell all plotters to stop gathering information. for (Graph graph : graphs) { graph.onOptOut(); } } } // We use the inverse of firstPost because if it is the first time we are posting, // it is not a interval ping, so it evaluates to FALSE // Each time thereafter it will evaluate to TRUE, i.e PING! postPlugin(!firstPost); // After the first post we set firstPost to false // Each post thereafter will be a ping firstPost = false; } catch (IOException e) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage()); } } } }); return true; } } /** * Has the server owner denied plugin metrics? * * @return true if metrics should be opted out of it */ public boolean isOptOut() { synchronized (optOutLock) { try { // Reload the metrics file configuration.load(getConfigFile()); } catch (IOException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); } return true; } catch (InvalidConfigurationException ex) { if (debug) { Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); } return true; } return configuration.getBoolean("opt-out", false); } } /** * Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task. * * @throws java.io.IOException */ public void enable() throws IOException { // This has to be synchronized or it can collide with the check in the task. synchronized (optOutLock) { // Check if the server owner has already set opt-out, if not, set it. if (isOptOut()) { configuration.set("opt-out", false); configuration.save(configurationFile); } // Enable Task, if it is not running if (task == null) { start(); } } } /** * Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task. * * @throws java.io.IOException */ public void disable() throws IOException { // This has to be synchronized or it can collide with the check in the task. synchronized (optOutLock) { // Check if the server owner has already set opt-out, if not, set it. if (!isOptOut()) { configuration.set("opt-out", true); configuration.save(configurationFile); } // Disable Task, if it is running if (task != null) { task.cancel(); task = null; } } } public void cancelTask() { if (task != null) { task.cancel(); task = null; } } /** * Gets the File object of the config file that should be used to store data such as the GUID and opt-out status * * @return the File object for the config file */ public File getConfigFile() { // I believe the easiest way to get the base folder (e.g craftbukkit set via -P) for plugins to use // is to abuse the plugin object we already have // plugin.getDataFolder() => base/plugins/PluginA/ // pluginsFolder => base/plugins/ // The base is not necessarily relative to the startup directory. File pluginsFolder = plugin.getDataFolder().getParentFile(); // return => base/plugins/PluginMetrics/config.yml return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml"); } /** * Generic method that posts a plugin to the metrics website */ private void postPlugin(final boolean isPing) throws IOException { // Server software specific section PluginDescriptionFile description = plugin.getDescription(); String pluginName = description.getName(); boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled String pluginVersion = description.getVersion(); String serverVersion = Bukkit.getVersion(); int playersOnline = Bukkit.getServer().getOnlinePlayers().length; // END server software specific section -- all code below does not use any code outside of this class / Java // Construct the post data StringBuilder json = new StringBuilder(1024); json.append('{'); // The plugin's description file containg all of the plugin data such as name, version, author, etc appendJSONPair(json, "guid", guid); appendJSONPair(json, "plugin_version", pluginVersion); appendJSONPair(json, "server_version", serverVersion); appendJSONPair(json, "players_online", Integer.toString(playersOnline)); // New data as of R6 String osname = System.getProperty("os.name"); String osarch = System.getProperty("os.arch"); String osversion = System.getProperty("os.version"); String java_version = System.getProperty("java.version"); int coreCount = Runtime.getRuntime().availableProcessors(); // normalize os arch .. amd64 -> x86_64 if (osarch.equals("amd64")) { osarch = "x86_64"; } appendJSONPair(json, "osname", osname); appendJSONPair(json, "osarch", osarch); appendJSONPair(json, "osversion", osversion); appendJSONPair(json, "cores", Integer.toString(coreCount)); appendJSONPair(json, "auth_mode", onlineMode ? "1" : "0"); appendJSONPair(json, "java_version", java_version); // If we're pinging, append it if (isPing) { appendJSONPair(json, "ping", "1"); } if (graphs.size() > 0) { synchronized (graphs) { json.append(','); json.append('"'); json.append("graphs"); json.append('"'); json.append(':'); json.append('{'); boolean firstGraph = true; final Iterator<Graph> iter = graphs.iterator(); while (iter.hasNext()) { Graph graph = iter.next(); StringBuilder graphJson = new StringBuilder(); graphJson.append('{'); for (Plotter plotter : graph.getPlotters()) { appendJSONPair(graphJson, plotter.getColumnName(), Integer.toString(plotter.getValue())); } graphJson.append('}'); if (!firstGraph) { json.append(','); } json.append(escapeJSON(graph.getName())); json.append(':'); json.append(graphJson); firstGraph = false; } json.append('}'); } } // close json json.append('}'); // Create the url URL url = new URL(BASE_URL + String.format(REPORT_URL, urlEncode(pluginName))); // Connect to the website URLConnection connection; // Mineshafter creates a socks proxy, so we can safely bypass it // It does not reroute POST requests so we need to go around it if (isMineshafterPresent()) { connection = url.openConnection(Proxy.NO_PROXY); } else { connection = url.openConnection(); } byte[] uncompressed = json.toString().getBytes(); byte[] compressed = gzip(json.toString()); // Headers connection.addRequestProperty("User-Agent", "MCStats/" + REVISION); connection.addRequestProperty("Content-Type", "application/json"); connection.addRequestProperty("Content-Encoding", "gzip"); connection.addRequestProperty("Content-Length", Integer.toString(compressed.length)); connection.addRequestProperty("Accept", "application/json"); connection.addRequestProperty("Connection", "close"); connection.setDoOutput(true); if (debug) { System.out.println("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length); } // Write the data OutputStream os = connection.getOutputStream(); os.write(compressed); os.flush(); // Now read the response final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String response = reader.readLine(); // close resources os.close(); reader.close(); if (response == null || response.startsWith("ERR") || response.startsWith("7")) { if (response == null) { response = "null"; } else if (response.startsWith("7")) { response = response.substring(response.startsWith("7,") ? 2 : 1); } throw new IOException(response); } else { // Is this the first update this hour? if (response.equals("1") || response.contains("This is your first update this hour")) { synchronized (graphs) { final Iterator<Graph> iter = graphs.iterator(); while (iter.hasNext()) { final Graph graph = iter.next(); for (Plotter plotter : graph.getPlotters()) { plotter.reset(); } } } } } } /** * GZip compress a string of bytes * * @param input * @return */ @SuppressWarnings("PMD.EmptyCatchBlock") public static byte[] gzip(String input) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); GZIPOutputStream gzos = null; try { gzos = new GZIPOutputStream(baos); gzos.write(input.getBytes("UTF-8")); } catch (IOException e) { e.printStackTrace(); } finally { if (gzos != null) try { gzos.close(); } catch (IOException ignore) { } } return baos.toByteArray(); } /** * Check if mineshafter is present. If it is, we need to bypass it to send POST requests * * @return true if mineshafter is installed on the server */ private boolean isMineshafterPresent() { try { Class.forName("mineshafter.MineServer"); return true; } catch (Exception e) { return false; } } /** * Appends a json encoded key/value pair to the given string builder. * * @param json * @param key * @param value * @throws UnsupportedEncodingException */ private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException { boolean isValueNumeric = false; try { if (value.equals("0") || !value.endsWith("0")) { Double.parseDouble(value); isValueNumeric = true; } } catch (NumberFormatException e) { isValueNumeric = false; } if (json.charAt(json.length() - 1) != '{') { json.append(','); } json.append(escapeJSON(key)); json.append(':'); if (isValueNumeric) { json.append(value); } else { json.append(escapeJSON(value)); } } /** * Escape a string to create a valid JSON string * * @param text * @return */ private static String escapeJSON(String text) { StringBuilder builder = new StringBuilder(); builder.append('"'); for (int index = 0; index < text.length(); index++) { char chr = text.charAt(index); switch (chr) { case '"': case '\\': builder.append('\\'); builder.append(chr); break; case '\b': builder.append("\\b"); break; case '\t': builder.append("\\t"); break; case '\n': builder.append("\\n"); break; case '\r': builder.append("\\r"); break; default: if (chr < ' ') { String t = "000" + Integer.toHexString(chr); builder.append("\\u" + t.substring(t.length() - 4)); } else { builder.append(chr); } break; } } builder.append('"'); return builder.toString(); } /** * Encode text as UTF-8 * * @param text the text to encode * @return the encoded text, as UTF-8 */ private static String urlEncode(final String text) throws UnsupportedEncodingException { return URLEncoder.encode(text, "UTF-8"); } /** * Represents a custom graph on the website */ public static class Graph { /** * The graph's name, alphanumeric and spaces only :) If it does not comply to the above when submitted, it is * rejected */ private final String name; /** * The set of plotters that are contained within this graph */ private final Set<Plotter> plotters = new LinkedHashSet<Plotter>(); private Graph(final String name) { this.name = name; } /** * Gets the graph's name * * @return the Graph's name */ public String getName() { return name; } /** * Add a plotter to the graph, which will be used to plot entries * * @param plotter the plotter to add to the graph */ public void addPlotter(final Plotter plotter) { plotters.add(plotter); } /** * Remove a plotter from the graph * * @param plotter the plotter to remove from the graph */ public void removePlotter(final Plotter plotter) { plotters.remove(plotter); } /** * Gets an <b>unmodifiable</b> set of the plotter objects in the graph * * @return an unmodifiable {@link java.util.Set} of the plotter objects */ public Set<Plotter> getPlotters() { return Collections.unmodifiableSet(plotters); } @Override public int hashCode() { return name.hashCode(); } @Override public boolean equals(final Object object) { if (!(object instanceof Graph)) { return false; } final Graph graph = (Graph) object; return graph.name.equals(name); } /** * Called when the server owner decides to opt-out of BukkitMetrics while the server is running. */ protected void onOptOut() { } } /** * Interface used to collect custom data for a plugin */ public static abstract class Plotter { /** * The plot's name */ private final String name; /** * Construct a plotter with the default plot name */ public Plotter() { this("Default"); } /** * Construct a plotter with a specific plot name * * @param name the name of the plotter to use, which will show up on the website */ public Plotter(final String name) { this.name = name; } /** * Get the current value for the plotted point. Since this function defers to an external function it may or may * not return immediately thus cannot be guaranteed to be thread friendly or safe. This function can be called * from any thread so care should be taken when accessing resources that need to be synchronized. * * @return the current value for the point to be plotted. */ public abstract int getValue(); /** * Get the column name for the plotted point * * @return the plotted point's column name */ public String getColumnName() { return name; } /** * Called after the website graphs have been updated */ public void reset() { } @Override public int hashCode() { return getColumnName().hashCode(); } @Override public boolean equals(final Object object) { if (!(object instanceof Plotter)) { return false; } final Plotter plotter = (Plotter) object; return plotter.name.equals(name) && plotter.getValue() == getValue(); } } }
[ "iain@ruhlendavis.org" ]
iain@ruhlendavis.org
e79ab419a51c5c0685992bd2ae4edc6f21e60ae1
7b67fa4e000990951d8a8647b593457bd43824de
/src/com/hyphenate/chatuidemo/ui/DiagnoseActivity.java
b58b1a43bc143b4a2ed6fa9ebf31133c7f204d98
[ "Apache-2.0" ]
permissive
mengzhe1973/chatDemo
209b37be15b465e2b7708479783e56ca439247b2
646c98f90d1ef2053b774ea7b427e5a9764958e5
refs/heads/master
2020-12-25T14:23:03.354829
2016-08-31T14:33:14
2016-08-31T14:33:14
66,745,434
0
0
null
null
null
null
UTF-8
Java
false
false
3,548
java
package com.hyphenate.chatuidemo.ui; import android.app.ProgressDialog; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import com.hyphenate.EMCallBack; import com.hyphenate.chat.EMClient; import com.hyphenate.util.EMLog; import com.kiros.hximdemo.R; /** * Copyright (C) 2016 Hyphenate Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by * applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS * OF ANY KIND, either express or implied. See the License for the specific * language governing permissions and limitations under the License. */ /** * Diagnose activity;user can upload log for debug purpose * * @author lyuzhao * */ public class DiagnoseActivity extends BaseActivity implements OnClickListener { private TextView currentVersion; private Button uploadLog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.em_activity_diagnose); currentVersion = (TextView) findViewById(R.id.tv_version); uploadLog = (Button) findViewById(R.id.button_uploadlog); uploadLog.setOnClickListener(this); String strVersion = ""; try { strVersion = getVersionName(); } catch (Exception e) { } if (!TextUtils.isEmpty(strVersion)) currentVersion.setText("V" + strVersion); else{ String st = getResources().getString(R.string.Not_Set); currentVersion.setText(st);} } public void back(View view) { finish(); } private String getVersionName() throws Exception { return EMClient.getInstance().getChatConfig().getVersion(); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.button_uploadlog: uploadlog(); break; default: break; } } private ProgressDialog progressDialog; public void uploadlog() { if (progressDialog == null) progressDialog = new ProgressDialog(this); String stri = getResources().getString(R.string.Upload_the_log); progressDialog.setMessage(stri); progressDialog.setCancelable(false); progressDialog.show(); final String st = getResources().getString(R.string.Log_uploaded_successfully); EMClient.getInstance().uploadLog(new EMCallBack() { @Override public void onSuccess() { runOnUiThread(new Runnable() { @Override public void run() { progressDialog.dismiss(); Toast.makeText(DiagnoseActivity.this, st, Toast.LENGTH_SHORT).show(); } }); } @Override public void onProgress(final int progress, String status) { // getActivity().runOnUiThread(new Runnable() { // // @Override // public void run() { // progressDialog.setMessage("上传中 "+progress+"%"); // // } // }); } String st3 = getResources().getString(R.string.Log_Upload_failed); @Override public void onError(int code, String message) { EMLog.e("###", message); runOnUiThread(new Runnable() { @Override public void run() { progressDialog.dismiss(); Toast.makeText(DiagnoseActivity.this, st3, Toast.LENGTH_SHORT).show(); } }); } }); } }
[ "kiros_wang@infosys.com" ]
kiros_wang@infosys.com
30387a2e9d6cfb0139e0444dd9b0a583e2638d14
19691fb3680f45b88971f15c93b163d2f7564442
/Client.java
f05ddad084babab60da1dadc513a307958e07e9c
[]
no_license
ZainAhmedBaig/Operating-System-
82dabea32b0ef7147d6a4ad116659350ffa9beaf
d2527ea0557f9defbced1d6bfd4659ad60809dcd
refs/heads/master
2020-08-06T15:34:32.879429
2019-12-22T08:56:57
2019-12-22T08:56:57
213,058,703
0
0
null
null
null
null
UTF-8
Java
false
false
615
java
package Lab2; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.Socket; public class Client { public static void main(String[] args){ try { Socket s = new Socket("192.168.8.100",3999); DataOutputStream dos = new DataOutputStream(s.getOutputStream()); DataInputStream dis = new DataInputStream(s.getInputStream()); dos.writeUTF("Assalam-o-Alaikum"); System.out.println("Read:" +dis.readUTF()); dos.writeUTF("Walaikum Assalam"); s.close(); }catch(IOException e) {} } }
[ "noreply@github.com" ]
ZainAhmedBaig.noreply@github.com
72e1478a755f45affa095d2cf1b139c781ffaba3
9412cd1fc2ae3151f8516b7c141787a45da1cde6
/pp-workspace/component-entity/src/main/java/com/pengpeng/stargame/model/lucky/tree/LuckyTreeCall.java
50dd09939bf977bfa16a09b1843325821ad443e8
[]
no_license
imjamespond/java-recipe
2322d98d8db657fcd7e4784f706b66c10bee8d8b
6b8b0a6b46326dde0006d7544ffa8cc1ae647a0b
refs/heads/master
2021-08-28T18:22:43.811299
2016-09-27T06:41:00
2016-09-27T06:41:00
68,710,592
0
1
null
null
null
null
UTF-8
Java
false
false
268
java
package com.pengpeng.stargame.model.lucky.tree; import com.pengpeng.stargame.annotation.Desc; import com.pengpeng.stargame.vo.lucky.tree.LuckyTreeCallVO; /** * @author james * @since 13-5-29 上午10:46 */ public class LuckyTreeCall extends LuckyTreeCallVO { }
[ "imjamespond@gmai.com" ]
imjamespond@gmai.com
e1b2b81fb4bbcbff9d83d44506c461eb43b42776
bf2966abae57885c29e70852243a22abc8ba8eb0
/aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/ListUserProfilesResult.java
e6ba6f377339304fd5adf76fc0f2ae12274b18ce
[ "Apache-2.0" ]
permissive
kmbotts/aws-sdk-java
ae20b3244131d52b9687eb026b9c620da8b49935
388f6427e00fb1c2f211abda5bad3a75d29eef62
refs/heads/master
2021-12-23T14:39:26.369661
2021-07-26T20:09:07
2021-07-26T20:09:07
246,296,939
0
0
Apache-2.0
2020-03-10T12:37:34
2020-03-10T12:37:33
null
UTF-8
Java
false
false
7,056
java
/* * Copyright 2016-2021 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.sagemaker.model; import java.io.Serializable; import javax.annotation.Generated; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/sagemaker-2017-07-24/ListUserProfiles" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ListUserProfilesResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable { /** * <p> * The list of user profiles. * </p> */ private java.util.List<UserProfileDetails> userProfiles; /** * <p> * If the previous response was truncated, you will receive this token. Use it in your next request to receive the * next set of results. * </p> */ private String nextToken; /** * <p> * The list of user profiles. * </p> * * @return The list of user profiles. */ public java.util.List<UserProfileDetails> getUserProfiles() { return userProfiles; } /** * <p> * The list of user profiles. * </p> * * @param userProfiles * The list of user profiles. */ public void setUserProfiles(java.util.Collection<UserProfileDetails> userProfiles) { if (userProfiles == null) { this.userProfiles = null; return; } this.userProfiles = new java.util.ArrayList<UserProfileDetails>(userProfiles); } /** * <p> * The list of user profiles. * </p> * <p> * <b>NOTE:</b> This method appends the values to the existing list (if any). Use * {@link #setUserProfiles(java.util.Collection)} or {@link #withUserProfiles(java.util.Collection)} if you want to * override the existing values. * </p> * * @param userProfiles * The list of user profiles. * @return Returns a reference to this object so that method calls can be chained together. */ public ListUserProfilesResult withUserProfiles(UserProfileDetails... userProfiles) { if (this.userProfiles == null) { setUserProfiles(new java.util.ArrayList<UserProfileDetails>(userProfiles.length)); } for (UserProfileDetails ele : userProfiles) { this.userProfiles.add(ele); } return this; } /** * <p> * The list of user profiles. * </p> * * @param userProfiles * The list of user profiles. * @return Returns a reference to this object so that method calls can be chained together. */ public ListUserProfilesResult withUserProfiles(java.util.Collection<UserProfileDetails> userProfiles) { setUserProfiles(userProfiles); return this; } /** * <p> * If the previous response was truncated, you will receive this token. Use it in your next request to receive the * next set of results. * </p> * * @param nextToken * If the previous response was truncated, you will receive this token. Use it in your next request to * receive the next set of results. */ public void setNextToken(String nextToken) { this.nextToken = nextToken; } /** * <p> * If the previous response was truncated, you will receive this token. Use it in your next request to receive the * next set of results. * </p> * * @return If the previous response was truncated, you will receive this token. Use it in your next request to * receive the next set of results. */ public String getNextToken() { return this.nextToken; } /** * <p> * If the previous response was truncated, you will receive this token. Use it in your next request to receive the * next set of results. * </p> * * @param nextToken * If the previous response was truncated, you will receive this token. Use it in your next request to * receive the next set of results. * @return Returns a reference to this object so that method calls can be chained together. */ public ListUserProfilesResult withNextToken(String nextToken) { setNextToken(nextToken); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getUserProfiles() != null) sb.append("UserProfiles: ").append(getUserProfiles()).append(","); if (getNextToken() != null) sb.append("NextToken: ").append(getNextToken()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListUserProfilesResult == false) return false; ListUserProfilesResult other = (ListUserProfilesResult) obj; if (other.getUserProfiles() == null ^ this.getUserProfiles() == null) return false; if (other.getUserProfiles() != null && other.getUserProfiles().equals(this.getUserProfiles()) == false) return false; if (other.getNextToken() == null ^ this.getNextToken() == null) return false; if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getUserProfiles() == null) ? 0 : getUserProfiles().hashCode()); hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode()); return hashCode; } @Override public ListUserProfilesResult clone() { try { return (ListUserProfilesResult) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }
[ "" ]
bfbfea42a2b772ef7429b254c454119d2b461cde
1f9979f4763c9503f801d1ff9343b56708949064
/src/main/java/org/mitre/openid/connect/binder/config/MethodSecurityConfiguration.java
bb385bacfc5d04cd527d1ed1199448b694c65163
[ "Apache-2.0" ]
permissive
cberger8/identity-binder
ebe43d31ce495aa63fcca407234f6c371f83ff0f
97b4f9866c5330416f347bdc580148127f3b7949
refs/heads/master
2020-12-28T08:32:58.148637
2015-06-18T14:07:02
2015-06-18T14:07:02
37,598,606
0
0
null
2015-06-17T14:05:46
2015-06-17T14:05:46
null
UTF-8
Java
false
false
837
java
package org.mitre.openid.connect.binder.config; import org.springframework.context.annotation.Configuration; import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration; import org.springframework.security.oauth2.provider.expression.OAuth2MethodSecurityExpressionHandler; @Configuration @EnableGlobalMethodSecurity(prePostEnabled = true, proxyTargetClass = true) public class MethodSecurityConfiguration extends GlobalMethodSecurityConfiguration { @Override protected MethodSecurityExpressionHandler createExpressionHandler() { return new OAuth2MethodSecurityExpressionHandler(); } }
[ "wikkim@gmail.com" ]
wikkim@gmail.com
adf7e2c53b6f5aa393135abb5cfd6da9d19cfca1
bc6b6bac0eb103c3118222868051b108dbd8234a
/src/control/JoueurPhysique.java
01ab1c1a017f20d57c9db4a6a7e1c5295aef27ba
[]
no_license
liyangsifei/Jeu-Pandocreon
55f324a3690c64efe5adb1dc88b1da31c4419993
89f8e9e613e45a9796b37f8bad1faa4814f068a2
refs/heads/master
2021-07-12T06:37:36.886124
2017-10-09T20:19:45
2017-10-09T20:19:45
106,330,136
0
0
null
null
null
null
GB18030
Java
false
false
13,463
java
package control; import gui.Pandocreon_Frame; import java.util.*; import carteAction.Apocalypse; import carteAction.CartePile; import carteAction.CarteTable; import carteAction.Croyant; import carteAction.DeusEx; import carteAction.GuideSpirituel; import carteAction.Apocalypse; import carteAction.CarteAction; public class JoueurPhysique extends Joueur{ private int numeroAction; //constructeur public JoueurPhysique(int numero){ super(numero); } public int choisirNumeroDuAction(Partie p){ // System.out.println("Voici les actions vous pouvez choisir! (0 defausser 1 piocher 2 utiliser 3 capacité Divinité)Saisir le numero du action vous voulez choisir!"); // Scanner input=new Scanner(System.in); // int numeroDuAction=input.nextInt(); // numeroDuAction = f.getJoueurPhysiqueView().getJoueurPhysiqueView().getDiviniteView().getActionChoisi(); // numeroAction = numeroDuAction; return numeroAction; } public void defausserCarteP(int numero){ boolean end = false; //choisir le numero du carte vous voulez defausser List cartesA=this.getCarteEnMain(); System.out.println(" Les cartes en main sont:"); int i2 = 0; Iterator ii = cartesA.iterator(); while(ii.hasNext()){ CarteAction cartea=(CarteAction)ii.next(); System.out.println(i2 + ":" + cartea.getNom()+" "+cartea.getType()+" "+cartea.getOrigine()); i2++; } System.out.println("Vous voulez defausser carte "+numero+" !"); //int i = f.getJoueurPhysiqueView().getCarteMainView().getCarteDefausse(); ///**************新加入:手牌里的号码**** //Scanner input=new Scanner(System.in); // int i=input.nextInt(); //do{ // if(i < this.getCarteEnMain().size()&&i>=0){ this.getCarteEnMain().remove(numero); List cartes=this.getCarteEnMain(); System.out.println("Vous avez defausse ce carte! Les cartes en main sont:"); int i3 = 0; Iterator it = cartes.iterator(); while(it.hasNext()){ CarteAction carte=(CarteAction)it.next(); System.out.println(i3 + ":" + carte.getNom()+" "+carte.getType()+" "+carte.getOrigine()); i3++; } // }else{ // System.out.println("ce numéro n'est pas compris dans votre carte en main, entrer le numéro"); // i = input.nextInt(); // } // System.out.println("Si vous voulez arrêter de défausser cartes, saisissez 'end', si vous voulez continuer defausser carte, saisir le numreo du carte. "); // end = f.getJoueurPhysiqueView().getCarteMainView().isEndTour(); //*******新加入 不知道能不能endtour******* // end = input.next().equals("end"); // }while(end == false); } public void piocherCarte(Partie p){ CartePile cp = p.getPartie().getCarteEnJeu(); List l = cp.getCartes(); if(this.getCarteEnMain().size()== 7){ System.out.println("Vous ne pouvez pas piocher les cartes"); }else{ while(this.getCarteEnMain().size() < 7){ this.getCarteEnMain().add(l.get(0)); l.remove(0); } } cp.setCartes(l); p.getPartie().setCarteEnJeu(cp); //Afficher les cartes en main obtenu Iterator it = getCarteEnMain().iterator(); System.out.println("Les cartes en main de Joueur " + getNumeroJoueur() + " est:"); while(it.hasNext()){ CarteAction ca = (CarteAction)it.next(); System.out.println("CarteEnMain : " + ca.getNom() ); } } // public void utiliserCarteMain(Partie p,CarteAction ca){ // if(ca.getType().equals("Croyant")){ // ((Croyant)ca).utiliserCapacite(p.getJoueurs().get(0), f) // p.getJoueurs().get(0).getCarteEnMain().remove(ca); // } // } public void utiliserCarte(Partie p){ Iterator it = this.getCarteEnMain().iterator(); System.out.println("Attention! Le utilisation du DeusEx, Apocalypse, scrifier croyant, guide va couter vos points d'action!"); System.out.println("Le utilisation du croyant, guide ne coute pas vos points d'action! "); System.out.println("Les cartes en main de Joueur " + getNumeroJoueur() + " est:"); while(it.hasNext()){ CarteAction ca = (CarteAction)it.next(); System.out.println("CarteEnMain : " + ca.getNom()+" "+ca.getOrigine()+" "+ca.getType()); } boolean endTour = false; while(!endTour){ System.out.println("Vous avez " + getPointActionJour() + " point action Jour"); System.out.println("Vous avez " + getPointActionNuit() + " point action Nuit"); System.out.println("Vous avez " + getPointActionNéant() + " point action Néant"); System.out.println("Saisir 0 pour terminer ou 1 pour continuer"); Scanner sc = new Scanner(System.in); int i = -1; int d = -1; i=sc.nextInt(); if(i == 0){ endTour = true; }else if(i == 1){ boolean FLAG = false; while(!FLAG) { try{ System.out.println("Choisir une carte action et saisir son numero dans votre carte en main"); System.out.println("Par example: le numero du premier carte dans la liste est 0"); int ii = 0; Iterator it2 = getCarteEnMain().iterator(); System.out.println("Les cartes en main de Joueur " + getNumeroJoueur() + " est:"); while(it2.hasNext()){ CarteAction ca = (CarteAction)it2.next(); System.out.println("CarteEnMain:" + ii + ":" + ca.getNom() + " " + ca.getOrigine() + " " + ca.getDogme()); ii++; } d = sc.nextInt(); if(d >= 0 && d < this.getCarteEnMain().size()) { FLAG = true; }else { System.out.println("Le numéro de carte n'est pas compris dans votre carte en main"); FLAG = false; } }catch(InputMismatchException e) { System.out.println("Erreur"); sc.next(); FLAG = false; } } CarteAction ca = (CarteAction)this.getCarteEnMain().get(d); //Chercher le type de carte action et décider quelle méthode switch(ca.getType()) { case "Croyant": Croyant cc = (Croyant)ca; System.out.println("'sacrifier' ou 'poser'!"); Scanner sc1 = new Scanner(System.in); String input = sc1.next(); if(input.equals("sacrifier")){ utiliserCroyant(cc,p); }else if(input.equals("poser")){ switch(ca.getOrigine()) { case "Jour": if(this.getPointActionJour() >= 1) { this.setPointActionJour(this.getPointActionJour()-1); poserCroyant(cc); }else { System.out.println("Vous n'avez pas de point d'action Jour"); continue; } break; case "Nuit": if(this.getPointActionNuit() >= 1) { this.setPointActionNuit(this.getPointActionNuit()-1); poserCroyant(cc); }else{ System.out.println("Vous n'avez pas de point d'action Nuit"); continue; } break; case "Néant": if(this.getPointActionNéant() >= 1) { this.setPointActionNéant(this.getPointActionNéant()-1); poserCroyant(cc); }else { System.out.println("Vous n'avez pas de point d'action Néant"); continue; } break; case "": break; default : break; } } break; case "GuideSpirituel": GuideSpirituel guide = (GuideSpirituel)ca; System.out.println("'sacrifier' ou 'utiliser'!"); Scanner sc2 = new Scanner(System.in); String input2 = sc2.next(); if(input2.equals("sacrifier")){ utiliserGuideSpirituel(guide,p); }else if(input2.equals("utiliser")){ switch(ca.getOrigine()) { case "Jour": if(this.getPointActionJour() >= 1) { this.setPointActionJour(this.getPointActionJour()-1); poserGuideSpirituel(guide); }else { System.out.println("Vous n'avez pas de point d'action Jour"); continue; } break; case "Nuit": if(this.getPointActionNuit() >= 1) { this.setPointActionNuit(this.getPointActionNuit()-1); poserGuideSpirituel(guide); }else{ System.out.println("Vous n'avez pas de point d'action Nuit"); continue; } break; case "Néant": if(this.getPointActionNéant() >= 1) { this.setPointActionNéant(this.getPointActionNéant()-1); poserGuideSpirituel(guide); }else { System.out.println("Vous n'avez pas de point d'action Néant"); continue; } break; case "": break; default : break; } } break; case "DeusEx": DeusEx de = (DeusEx)ca; switch(ca.getOrigine()) { case "Jour": if(this.getPointActionJour() >= 1) { this.setPointActionJour(this.getPointActionJour()-1); utiliserDeusEx(de,p); }else { System.out.println("Vous n'avez pas de point d'action Jour"); continue; } break; case "Nuit": if(this.getPointActionNuit() >= 1) { this.setPointActionNuit(this.getPointActionNuit()-1); utiliserDeusEx(de,p); }else{ System.out.println("Vous n'avez pas de point d'action Nuit"); continue; } break; case "Néant": if(this.getPointActionNéant() >= 1) { this.setPointActionNéant(this.getPointActionNéant()-1); utiliserDeusEx(de,p); }else { System.out.println("Vous n'avez pas de point d'action Néant"); continue; } break; case "": utiliserDeusEx(de,p); break; default : break; } break; case "Apocalypse": Apocalypse ap = (Apocalypse)ca; switch(ca.getOrigine()) { case "Jour": if(this.getPointActionJour() >= 1) { this.setPointActionJour(this.getPointActionJour()-1); utiliserApocalypse(ap,p); }else { System.out.println("Vous n'avez pas de point d'action Jour"); continue; } break; case "Nuit": if(this.getPointActionNuit() >= 1) { this.setPointActionNuit(this.getPointActionNuit()-1); utiliserApocalypse(ap,p); }else{ System.out.println("Vous n'avez pas de point d'action Nuit"); continue; } break; case "Néant": if(this.getPointActionNéant() >= 1) { this.setPointActionNéant(this.getPointActionNéant()-1); utiliserApocalypse(ap,p); }else { System.out.println("Vous n'avez pas de point d'action Néant"); continue; } break; case "": utiliserApocalypse(ap,p); break; default : break; } break; } //Supprimer la carte action en main this.getCarteEnMain().remove(d); } } } public void poserGuideSpirituel(GuideSpirituel guide){ //int size = CarteTable.getCarteTable().getCroyantEnTable().size(); List cartes=this.carteTable.getCartesEnTable(); int nombreCroyant=0; List cartesCroyant=new ArrayList(); Iterator it=cartes.iterator(); while(it.hasNext()){ CarteAction carte=(CarteAction)it.next(); if(carte.getType()=="Croyant"){ cartesCroyant.add(carte); nombreCroyant++; } } int nbCroyant = guide.getNombreCroyant(); if(nombreCroyant==0){ System.out.println("Il y a pas de croyant sur table!"); } while( guide.getCroyantAttache().size() < nbCroyant && nombreCroyant!=0){ Iterator itc=cartesCroyant.iterator(); while(itc.hasNext()){ Croyant c=(Croyant)itc.next(); System.out.println("Ces sont les cartes Croyant sur table"); System.out.println(c.getNom()); } System.out.println("Joueur " + this.getNumeroJoueur() + "Saisir le numéro de carte en table vous voulez attacher"); System.out.println("Par example: le numéro du premier carte est 0"); Scanner sc = new Scanner(System.in); int num = sc.nextInt(); Croyant cy = (Croyant)cartesCroyant.get(num); boolean p = false; if(guide.getDogme().contains("Humain") && cy.getDogme().contains("Humain") ){ p = true; }else if(guide.getDogme().contains("Nature") && cy.getDogme().contains("Nature")){ p = true; }else if(guide.getDogme().contains("Mystique") && cy.getDogme().contains("Mystique")){ p = true; }else if(guide.getDogme().contains("Symboles") && cy.getDogme().contains("Symboles")){ p = true; }else if(guide.getDogme().contains("Chaos") && cy.getDogme().contains("Chaos")){ p = true; } if(p == true){ this.carteTable.getCartesEnTable().remove(cy); this.getCarteCroyantEnjeu().add(cy); this.getCarteGsEnjeu().add(guide); guide.getCroyantAttache().add(cy); cy.setGuideAttache(guide); break; }else{ System.out.println("Il n'y a pas de même dogme de ce Guide Spirituel et ce Croyant, continuer attacher? Si oui, saisissez 1,sinon 0"); int continu = sc.nextInt(); if(continu == 0){ break; }else if(continu ==1){ continue; } } } } public int getNumeroAction() { return numeroAction; } public void setNumeroAction(int numeroAction) { this.numeroAction = numeroAction; } @Override public void defausserCarte(Partie p) { // TODO Auto-generated method stub } }
[ "liyangsifei@gmail.com" ]
liyangsifei@gmail.com
f3bd49c0198c67dac21558bec2a05cce29ce390a
7f6afde512ea39b4acc805c0b1400f910b66c689
/DependencyInjection_Practice_Autowired/src/main/java/com/di/natalya/App.java
74ced2d14d66f991efff5241214b3b678326c26b
[]
no_license
natalya118/JavaEECourse
1b9be14aa02e179e5093e2f54449f0cc920831c8
d10eb3f4a627074a7d954033801109a0b43d5e1b
refs/heads/master
2021-01-11T16:17:31.765541
2017-03-21T09:06:09
2017-03-21T09:06:09
80,057,243
0
0
null
null
null
null
UTF-8
Java
false
false
693
java
package com.di.natalya; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class App { public static void main( String[] args ){ ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml"); MiddleDev middle = (MiddleDev)context.getBean("middle"); middle.createBugs(); MiddleDev middle2 = (MiddleDev)context.getBean("middle2"); middle2.createBugs(); JustProgrammer prog = (JustProgrammer)context.getBean("prog"); prog.createBugs(); AutowiredJustProgrammer prog2 = (AutowiredJustProgrammer)context.getBean("prog_annotations"); prog2.createBugs(); } }
[ "nutblog88@gmail.com" ]
nutblog88@gmail.com
e0f32abbddf4fb7f6de10cc8fc461ec161d71f1e
b4cfc092284db1a315ff207baf158a425a9c0d10
/src/Leader.java
6db5b4a79011ad309f11bfd86691242bec51df3b
[]
no_license
pronhubaaa/RICHRUC
1c34ad6273b46d49e8b34bcc047f51ea822b8a03
06a901840bed58718a451db24575493636c80619
refs/heads/master
2021-01-08T04:08:34.906669
2017-07-27T07:07:57
2017-07-27T07:07:57
null
0
0
null
null
null
null
GB18030
Java
false
false
3,345
java
import java.awt.CardLayout; import java.awt.Color; import java.awt.Container; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; import java.awt.Toolkit; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JFrame; public class Leader extends JFrame implements MouseListener { /** 声明音乐对象 */ public static Music gm = new Music(); public static Leader gs; boolean run = true; int index = 0; String[] imagePath = new String[] { "d:\\image\\c1.png", "d:\\image\\c2.png", "d:\\image\\c3.png", "d:\\image\\c4.png", "d:\\image\\c5.png" }; /** 布局管理 */ CardLayout cardLayout = new CardLayout(); Container container = this.getContentPane(); /** * 创建构造方法 实现窗体 容器 temp 背景图片 */ public Leader() { /** 将布局管理器设置为绝对定位 */ getContentPane().setLayout(cardLayout); /** 获取当前显示屏幕的尺寸 */ Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); /** 将当前窗口的位置设置为居中显示 */ setBounds((int) (dim.getWidth() - 500) / 2, (int) (dim.getHeight() - 400) / 2, 500, 400); /** 设置窗体大小,标题 */ setSize(500, 460); setTitle("RUCRICH"); /** 事件监听 */ this.addMouseListener(this); /** 窗体不可改变大小 */ this.setResizable(false); /** 面板背景色为黑色 */ this.setBackground(Color.BLUE); /** 设置程序关闭 */ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); /** 设置窗体可见 */ this.setVisible(true); /** 片头音乐 */ gm.sunAudio(); while (run) {// 如果run为true就执行该循环 repaint(); try { Thread.sleep(1000);// 主线程睡眠3秒画图 } catch (InterruptedException e) { e.printStackTrace(); } index ++; if (index == imagePath.length-1 ) { run = false;//停止当前事件 } } /** * 片头动画过后的面板 包括主面板和副面板 */ /** 停止片头动画音乐 */ /** 开始播放面板音乐 */ //gm.menuMusic(); //imagePath=null; /** 主面板 */ OurGameMenu ourGameMenuJPanel = new OurGameMenu(container, cardLayout); container.add("ourGameMenuJPanel", ourGameMenuJPanel); /** 游戏说明面板 */ GameSpeakJPanel gameSpeakJPanel = new GameSpeakJPanel(container, cardLayout); container.add("gameSpeakJPanel", gameSpeakJPanel); /** 开发小组面板 */ GameMaderJPanel gameMaderJPanel = new GameMaderJPanel(container, cardLayout); container.add("gameMaderJPanel", gameMaderJPanel); // this.setVisible(true); } /** * 画笔 把imagePath图像数组画出来 */ public void paint(Graphics g) { Image img = this.getToolkit().getImage(imagePath[index]); g.drawImage(img, 0, 0, 500, 460, this); } /** 鼠标单击事件 */ public void mouseClicked(MouseEvent arg0) { if (arg0.getClickCount() >= 2) { run = false;//停止执行当前事件 } } public void mousePressed(MouseEvent arg0) { } public void mouseReleased(MouseEvent arg0) { } public void mouseEntered(MouseEvent arg0) { } public void mouseExited(MouseEvent arg0) { } public static void main(String[] args) { gs=new Leader(); } }
[ "317958662@qq.com" ]
317958662@qq.com
94fffa2777b4359d39655a9b1a988f23a7b181ae
c885ef92397be9d54b87741f01557f61d3f794f3
/tests-without-trycatch/Jsoup-86/org.jsoup.nodes.Comment/BBC-F0-opt-50/18/org/jsoup/nodes/Comment_ESTest_scaffolding.java
00fa4c76267c74f1496cbf9859a2b7bdc97f8ce6
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
14,212
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Wed Oct 20 17:55:24 GMT 2021 */ package org.jsoup.nodes; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.junit.AfterClass; import org.evosuite.runtime.sandbox.Sandbox; import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; @EvoSuiteClassExclude public class Comment_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "org.jsoup.nodes.Comment"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); org.evosuite.runtime.classhandling.JDKClassResetter.init(); setSystemProperties(); initializeClasses(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @AfterClass public static void clearEvoSuiteFramework(){ Sandbox.resetDefaultSecurityManager(); java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); setSystemProperties(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); org.evosuite.runtime.classhandling.JDKClassResetter.reset(); resetClasses(); org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } public static void setSystemProperties() { java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); java.lang.System.setProperty("user.dir", "/experiment"); } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(Comment_ESTest_scaffolding.class.getClassLoader() , "org.jsoup.nodes.Document$QuirksMode", "org.jsoup.parser.TokeniserState$56", "org.jsoup.parser.TokeniserState$57", "org.jsoup.parser.TokeniserState$58", "org.jsoup.parser.TokeniserState$59", "org.jsoup.parser.TokeniserState$52", "org.jsoup.helper.ChangeNotifyingArrayList", "org.jsoup.parser.TokeniserState$53", "org.jsoup.parser.TreeBuilder", "org.jsoup.parser.TokeniserState$54", "org.jsoup.parser.TokeniserState$55", "org.jsoup.parser.TokeniserState$50", "org.jsoup.parser.TokeniserState$51", "org.jsoup.select.Evaluator$IndexEvaluator", "org.jsoup.parser.Parser", "org.jsoup.nodes.Entities$CoreCharset", "org.jsoup.select.Evaluator$AttributeWithValueMatching", "org.jsoup.nodes.Element", "org.jsoup.select.Evaluator$Class", "org.jsoup.select.NodeTraversor", "org.jsoup.parser.TokeniserState$67", "org.jsoup.parser.TokeniserState$63", "org.jsoup.nodes.Node$OuterHtmlVisitor", "org.jsoup.parser.TokeniserState$64", "org.jsoup.parser.TokeniserState$65", "org.jsoup.parser.Token", "org.jsoup.parser.TokeniserState$66", "org.jsoup.parser.TokeniserState$60", "org.jsoup.select.Evaluator$AttributeKeyPair", "org.jsoup.select.Evaluator$MatchesOwn", "org.jsoup.parser.TokeniserState$61", "org.jsoup.parser.TokeniserState$62", "org.jsoup.parser.Tag", "org.jsoup.parser.Token$Character", "org.jsoup.select.Evaluator$Attribute", "org.jsoup.parser.Token$EndTag", "org.jsoup.nodes.Document", "org.jsoup.nodes.Entities", "org.jsoup.select.Evaluator$AttributeWithValueContaining", "org.jsoup.select.Elements", "org.jsoup.Jsoup", "org.jsoup.parser.Token$CData", "org.jsoup.parser.HtmlTreeBuilder", "org.jsoup.select.Evaluator$AllElements", "org.jsoup.nodes.FormElement", "org.jsoup.nodes.TextNode", "org.jsoup.select.Evaluator$AttributeWithValue", "org.jsoup.select.Evaluator$AttributeWithValueNot", "org.jsoup.parser.ParseErrorList", "org.jsoup.nodes.BooleanAttribute", "org.jsoup.SerializationException", "org.jsoup.select.Evaluator$ContainsText", "org.jsoup.select.Evaluator$Id", "org.jsoup.select.Evaluator$IndexEquals", "org.jsoup.parser.Token$Tag", "org.jsoup.parser.XmlTreeBuilder$1", "org.jsoup.nodes.XmlDeclaration", "org.jsoup.parser.Token$Doctype", "org.jsoup.parser.CharacterReader", "org.jsoup.select.Evaluator$Tag", "org.jsoup.nodes.Document$OutputSettings$Syntax", "org.jsoup.select.NodeVisitor", "org.jsoup.parser.TokeniserState$2", "org.jsoup.parser.TokeniserState$12", "org.jsoup.internal.StringUtil", "org.jsoup.parser.TokeniserState$1", "org.jsoup.parser.TokeniserState$13", "org.jsoup.nodes.Attributes$1", "org.jsoup.parser.TokeniserState$14", "org.jsoup.parser.TokeniserState$15", "org.jsoup.select.Evaluator$AttributeWithValueStarting", "org.jsoup.parser.Token$StartTag", "org.jsoup.parser.Token$EOF", "org.jsoup.parser.TokeniserState$10", "org.jsoup.parser.Tokeniser", "org.jsoup.parser.TokeniserState$11", "org.jsoup.nodes.DocumentType", "org.jsoup.nodes.Comment", "org.jsoup.parser.TokeniserState$9", "org.jsoup.parser.TokeniserState$8", "org.jsoup.select.Evaluator$IndexGreaterThan", "org.jsoup.parser.TokeniserState$7", "org.jsoup.nodes.LeafNode", "org.jsoup.parser.TokeniserState$6", "org.jsoup.parser.TokeniserState$5", "org.jsoup.parser.TokeniserState$4", "org.jsoup.parser.TokeniserState$3", "org.jsoup.nodes.NodeUtils", "org.jsoup.select.Evaluator$Matches", "org.jsoup.select.Evaluator$AttributeWithValueEnding", "org.jsoup.parser.TokeniserState$16", "org.jsoup.parser.TokeniserState$17", "org.jsoup.parser.TokeniserState$18", "org.jsoup.parser.TokeniserState$19", "org.jsoup.nodes.Entities$1", "org.jsoup.parser.TokeniserState$23", "org.jsoup.UncheckedIOException", "org.jsoup.parser.TokeniserState$24", "org.jsoup.parser.TokeniserState$25", "org.jsoup.parser.TokeniserState$26", "org.jsoup.parser.TokeniserState$20", "org.jsoup.parser.TokeniserState$21", "org.jsoup.parser.TokeniserState$22", "org.jsoup.select.NodeFilter", "org.jsoup.parser.ParseSettings", "org.jsoup.nodes.Node", "org.jsoup.select.Evaluator$AttributeStarting", "org.jsoup.select.Evaluator$ContainsOwnText", "org.jsoup.nodes.DataNode", "org.jsoup.parser.TokeniserState$27", "org.jsoup.parser.TokeniserState", "org.jsoup.parser.TokeniserState$28", "org.jsoup.parser.TokeniserState$29", "org.jsoup.parser.TokeniserState$34", "org.jsoup.nodes.Attributes", "org.jsoup.select.Evaluator$IndexLessThan", "org.jsoup.parser.TokeniserState$35", "org.jsoup.parser.TokeniserState$36", "org.jsoup.parser.TokeniserState$37", "org.jsoup.parser.TokeniserState$30", "org.jsoup.parser.TokeniserState$31", "org.jsoup.parser.TokeniserState$32", "org.jsoup.parser.TokeniserState$33", "org.jsoup.nodes.Entities$EscapeMode", "org.jsoup.parser.XmlTreeBuilder", "org.jsoup.nodes.Document$OutputSettings", "org.jsoup.select.Evaluator", "org.jsoup.parser.TokeniserState$38", "org.jsoup.parser.TokeniserState$39", "org.jsoup.internal.Normalizer", "org.jsoup.nodes.CDataNode", "org.jsoup.parser.TokeniserState$45", "org.jsoup.parser.TokeniserState$46", "org.jsoup.helper.Validate", "org.jsoup.parser.TokeniserState$47", "org.jsoup.parser.TokeniserState$48", "org.jsoup.parser.TokeniserState$41", "org.jsoup.parser.TokeniserState$42", "org.jsoup.parser.TokeniserState$43", "org.jsoup.parser.TokeniserState$44", "org.jsoup.parser.TokeniserState$40", "org.jsoup.parser.Token$TokenType", "org.jsoup.nodes.Attribute", "org.jsoup.parser.Token$Comment", "org.jsoup.parser.TokeniserState$49", "org.jsoup.nodes.Element$NodeList" ); } private static void resetClasses() { org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(Comment_ESTest_scaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( "org.jsoup.nodes.Node", "org.jsoup.nodes.LeafNode", "org.jsoup.nodes.Comment", "org.jsoup.parser.Parser", "org.jsoup.parser.TreeBuilder", "org.jsoup.parser.HtmlTreeBuilder", "org.jsoup.parser.Token", "org.jsoup.parser.Token$Tag", "org.jsoup.parser.Token$StartTag", "org.jsoup.nodes.Attributes", "org.jsoup.parser.Token$TokenType", "org.jsoup.parser.Token$EndTag", "org.jsoup.parser.ParseSettings", "org.jsoup.parser.ParseErrorList", "org.jsoup.nodes.Element", "org.jsoup.nodes.Document", "org.jsoup.parser.Tag", "org.jsoup.internal.Normalizer", "org.jsoup.internal.StringUtil", "org.jsoup.nodes.Node$OuterHtmlVisitor", "org.jsoup.nodes.NodeUtils", "org.jsoup.select.NodeTraversor", "org.jsoup.select.Evaluator", "org.jsoup.select.Evaluator$IndexEvaluator", "org.jsoup.select.Evaluator$IndexEquals", "org.jsoup.select.Collector", "org.jsoup.select.Elements", "org.jsoup.select.Collector$Accumulator", "org.jsoup.helper.ChangeNotifyingArrayList", "org.jsoup.nodes.Element$NodeList", "org.jsoup.select.Evaluator$Tag", "org.jsoup.parser.HtmlTreeBuilderState", "org.jsoup.parser.Tokeniser", "org.jsoup.parser.TokeniserState", "org.jsoup.parser.Token$Character", "org.jsoup.parser.Token$Doctype", "org.jsoup.parser.Token$Comment", "org.jsoup.parser.Token$EOF", "org.jsoup.parser.HtmlTreeBuilderState$24", "org.jsoup.nodes.TextNode", "org.jsoup.select.NodeFilter$FilterResult", "org.jsoup.nodes.PseudoTextElement", "org.jsoup.nodes.Node$1", "org.jsoup.parser.XmlTreeBuilder", "org.jsoup.Jsoup", "org.jsoup.parser.XmlTreeBuilder$1", "org.jsoup.nodes.XmlDeclaration", "org.jsoup.nodes.Attributes$1", "org.jsoup.nodes.Attribute", "org.jsoup.select.Evaluator$Id", "org.jsoup.SerializationException", "org.jsoup.nodes.DocumentType", "org.jsoup.nodes.DataNode", "org.jsoup.nodes.CDataNode", "org.jsoup.select.Evaluator$AllElements", "org.jsoup.nodes.Entities$1", "org.jsoup.nodes.FormElement", "org.jsoup.select.Selector", "org.jsoup.select.QueryParser", "org.jsoup.parser.TokenQueue", "org.jsoup.select.Selector$SelectorParseException", "org.jsoup.select.Evaluator$ContainsText", "org.jsoup.nodes.Element$1", "org.jsoup.parser.ParseError", "org.jsoup.select.Evaluator$Class", "org.jsoup.select.CombiningEvaluator", "org.jsoup.select.CombiningEvaluator$And", "org.jsoup.select.Collector$FirstFinder", "org.jsoup.select.Evaluator$AttributeWithValueMatching", "org.jsoup.nodes.Attributes$Dataset", "org.jsoup.parser.HtmlTreeBuilderState$Constants", "org.jsoup.select.Evaluator$AttributeKeyPair", "org.jsoup.select.Evaluator$AttributeWithValue", "org.jsoup.select.Evaluator$AttributeWithValueEnding", "org.jsoup.select.Evaluator$AttributeWithValueNot", "org.jsoup.select.Evaluator$ContainsOwnText", "org.jsoup.select.Evaluator$IndexLessThan", "org.jsoup.select.Evaluator$IndexGreaterThan", "org.jsoup.select.Evaluator$MatchesOwn", "org.jsoup.nodes.Element$2", "org.jsoup.parser.Token$CData", "org.jsoup.select.Evaluator$Matches", "org.jsoup.select.Evaluator$AttributeWithValueContaining", "org.jsoup.select.Evaluator$AttributeWithValueStarting", "org.jsoup.select.Evaluator$AttributeStarting", "org.jsoup.select.StructuralEvaluator$Root", "org.jsoup.select.Evaluator$Attribute", "org.jsoup.select.Evaluator$CssNthEvaluator", "org.jsoup.select.Evaluator$IsNthChild", "org.jsoup.select.StructuralEvaluator", "org.jsoup.select.StructuralEvaluator$ImmediateParent", "org.jsoup.select.StructuralEvaluator$Parent", "org.jsoup.select.Evaluator$IsNthLastChild", "org.jsoup.select.Evaluator$IsEmpty", "org.jsoup.helper.Validate", "org.jsoup.nodes.Document$OutputSettings", "org.jsoup.nodes.Document$OutputSettings$Syntax", "org.jsoup.nodes.Entities", "org.jsoup.parser.CharacterReader", "org.jsoup.nodes.Entities$EscapeMode", "org.jsoup.nodes.Document$QuirksMode", "org.jsoup.nodes.Entities$CoreCharset" ); } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
03acbf6cee93115d07f33f5cdd3accca2651c99a
aca668592431a185225c33a421613057868e8272
/app/src/main/java/com/bignerdranch/android/criminalintent/CrimeActivity.java
1f1ba33c26d36f0ffc13244a68d57be867527276
[]
no_license
cloya13/CriminalIntent
31cb055ef941b2e250305882aa8ae8998d37f536
1774de8c289a4dade686b30ce52ee93850e36c87
refs/heads/master
2021-04-29T23:58:08.710035
2018-02-14T21:06:08
2018-02-14T21:06:08
121,549,022
0
0
null
null
null
null
UTF-8
Java
false
false
788
java
package com.bignerdranch.android.criminalintent; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class CrimeActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_crime); FragmentManager fm = getSupportFragmentManager(); Fragment fragment = fm.findFragmentById(R.id.fragment_container); if (fragment == null) { fragment = new CrimeFragment(); fm.beginTransaction() .add(R.id.fragment_container, fragment) .commit(); } } } //
[ "caloya1@buffs.wtamu.edu" ]
caloya1@buffs.wtamu.edu
a15c7ddc66ce70f5bb64e4bf56d239bd289bb005
863391b1105aaef090eecb9830d6f8ec659b9dc8
/src/filters/TogglePremiumFilter.java
ea300e09ff1f437c71fcd8c0c7c49a778e86a8c3
[]
no_license
JasiKPL/projekt
717f8e8dc24a69d56bf88da18f1401b58203664b
65f44e1105379b51865f2dbe790a80fa60509bab
refs/heads/master
2021-01-10T16:32:49.612571
2016-01-14T16:20:04
2016-01-14T16:20:13
49,233,066
0
0
null
null
null
null
UTF-8
Java
false
false
882
java
package filters; import java.io.IOException; import javax.servlet.*; import javax.servlet.http.*; import connector.Connector; import models.User; public class TogglePremiumFilter implements Filter { @Override public void destroy() {} @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain filter) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse res = (HttpServletResponse) response; HttpSession session = req.getSession(true); String username = (String) session.getAttribute("user"); if (username.isEmpty()) { res.sendError(401); } User user = Connector.getUser(username); if (!user.isAdmin()) { res.sendError(401); } filter.doFilter(request, response); } @Override public void init(FilterConfig arg0) throws ServletException {} }
[ "s11754@pjwstk.edu.pl" ]
s11754@pjwstk.edu.pl
bbc9b411ebc7e153d017849a16fe39230fe6ab18
27cda5e6fb5da7ae2dea91450ca1082bcaa55424
/Source/Java/CoreValueObjects/main/src/java/gov/va/med/imaging/exchange/business/dicom/rdsr/Dose.java
10eb375634ec9575980feec79dc3c33d749a0806
[ "Apache-2.0" ]
permissive
VHAINNOVATIONS/Telepathology
85552f179d58624e658b0b266ce83e905480acf2
989c06ccc602b0282c58c4af3455c5e0a33c8593
refs/heads/master
2021-01-01T19:15:40.693105
2015-11-16T22:39:23
2015-11-16T22:39:23
32,991,526
3
9
null
null
null
null
UTF-8
Java
false
false
1,599
java
/** * Package: MAG - VistA Imaging * WARNING: Per VHA Directive 2004-038, this routine should not be modified. * @date May 2, 2013 * Site Name: Washington OI Field Office, Silver Spring, MD * @author vhaiswlouthj * @version 1.0 * * ---------------------------------------------------------------- * Property of the US Government. * No permission to copy or redistribute this software is given. * Use of unreleased versions of this software requires the user * to execute a written test agreement with the VistA Imaging * Development Office of the Department of Veterans Affairs, * telephone (301) 734-0100. * * The Food and Drug Administration classifies this software as * a Class II medical device. As such, it may not be changed * in any way. Modifications to this software may result in an * adulterated medical device under 21CFR820, the use of which * is considered to be a violation of US Federal Statutes. * ---------------------------------------------------------------- */ package gov.va.med.imaging.exchange.business.dicom.rdsr; import gov.va.med.imaging.exchange.business.PersistentEntity; public abstract class Dose implements PersistentEntity { protected String irradiationEventUid; private int id; @Override public void setId(int id) { this.id = id; } @Override public int getId() { return this.id; } public String getIrradiationEventUid() { return irradiationEventUid; } public void setIrradiationEventUid(String irradiationEventUid) { this.irradiationEventUid = irradiationEventUid; } public abstract String getType(); }
[ "ctitton@vitelnet.com" ]
ctitton@vitelnet.com
bd46717afb3d43333eddca64d11dfd6d9ff05a51
e294196964464b5955bc19443c08b46cd3a6663f
/src/main/java/quickfix/field/TargetPartyID.java
7215e3a9e8067da2cc76d572ac10aae246a7665a
[]
no_license
fortexjava/ftquickfix
acb910e42c77c78f3802289f7ec0bc18f1caea5d
1a52a384bd7d013f77609c6f3441097b2a8b840e
refs/heads/master
2021-01-20T07:38:19.196683
2017-05-02T11:05:39
2017-05-02T11:05:39
90,023,265
0
0
null
null
null
null
UTF-8
Java
false
false
1,155
java
/* Generated Java Source File */ /******************************************************************************* * Copyright (c) quickfixengine.org All rights reserved. * * This file is part of the QuickFIX FIX Engine * * This file may be distributed under the terms of the quickfixengine.org * license as defined by quickfixengine.org and appearing in the file * LICENSE included in the packaging of this file. * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. * * See http://www.quickfixengine.org/LICENSE for licensing information. * * Contact ask@quickfixengine.org if any conditions of this licensing * are not clear to you. ******************************************************************************/ package quickfix.field; import quickfix.StringField; public class TargetPartyID extends StringField { static final long serialVersionUID = 20050617; public static final int FIELD = 1462; public TargetPartyID() { super(1462); } public TargetPartyID(String data) { super(1462, data); } }
[ "22345195@qq.com" ]
22345195@qq.com
be8023ba76dabd8eaa9fd3847ae1e22abe9d296f
2e494e24a478381e9948398702aaba93e8552136
/src/main/java/com/qa/pages/CareerPage.java
691b453f761600d3d465ce342eda71b786e99d96
[]
no_license
sindhumailme19/ELMO_QA_TEST1
946c9b31603117956e3d10b8650df952c94a4f7a
f7fe6c1d67839259a1a1801feff890f1ad9d942f
refs/heads/master
2021-07-08T15:40:17.516478
2019-08-04T12:30:11
2019-08-04T12:30:11
200,469,987
0
0
null
null
null
null
UTF-8
Java
false
false
133
java
package com.qa.pages; public class CareerPage { public final static String BROWSE_BUTTON = "//a[text()='Browse Jobs'] -- XPATH"; }
[ "sindhumailme19@gmail.com" ]
sindhumailme19@gmail.com
8dc22e70adbd36a20b07afe13a114a43b878ef6b
5de882aaa2f200a07128f9a7255b31ec7459240c
/app/src/main/java/com/example/koffeekafe/Register.java
a548247e5caf6f2447205ec8b9417fabf03369d3
[]
no_license
ashishpalta/Android
f449a4c554801d66e1861f66b279ebf8d9c53e66
2654f2f2b4da8ca2dddce016db1a190126f12e38
refs/heads/main
2023-02-10T18:07:08.202840
2021-01-05T01:46:29
2021-01-05T01:46:29
326,844,127
0
0
null
null
null
null
UTF-8
Java
false
false
7,360
java
package com.example.koffeekafe; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.firestore.DocumentReference; import com.google.firebase.firestore.FirebaseFirestore; import java.util.HashMap; import java.util.Map; public class Register extends AppCompatActivity { // DECLARATIONS ImageButton listButton ,homeButton , reviewsButton, loginButton; EditText mfullName,mEmail,mPassword,mreEnterPass; Button mRegisterBtn; FirebaseAuth fAuth; ProgressBar progressBar; TextView signIn; FirebaseFirestore fStore; String userID; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); mfullName =(EditText)findViewById(R.id.fullName); mEmail =(EditText)findViewById(R.id.emailAddress); mPassword =(EditText)findViewById(R.id.password); mRegisterBtn=(Button)findViewById(R.id.btnRegister); signIn = (TextView)findViewById(R.id.txtSignIp); homeButton = (ImageButton)findViewById(R.id.home); listButton = (ImageButton)findViewById(R.id.list); loginButton = (ImageButton)findViewById(R.id.login); mreEnterPass =(EditText)findViewById(R.id.reenter_password); //firebase authentication fAuth=FirebaseAuth.getInstance(); //firebase database fStore =FirebaseFirestore.getInstance(); progressBar = findViewById(R.id.progressBar); //CHECKING IF THERE IN NO LOGGED IN USER if(fAuth.getCurrentUser()!=null){ startActivity(new Intent(getApplicationContext(),MainActivity.class)); finish(); } // REGISTER BUTTON FUNCTION mRegisterBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { final String fullName = mfullName.getText().toString().trim(); final String email = mEmail.getText().toString().trim(); String password = mPassword.getText().toString().trim(); String rePass= mreEnterPass.getText().toString().trim(); //Validating the input data in the field if(TextUtils.isEmpty(fullName)){ mfullName.setError("Can't leave the field empty"); return; } if(TextUtils.isEmpty(email)){ mEmail.setError("Email is Required"); return; } if(TextUtils.isEmpty(password)){ mPassword.setError("Password is required"); return; } if(password.length()<6){ mPassword.setError("Password Must be >= 6"); return; } if(TextUtils.isEmpty(rePass)){ mreEnterPass.setError("Please reEnter Your Password"); return; } if(!password.equals(rePass)){ mreEnterPass.setError("Password didn't matched. Retry"); return; } //Setting progressbar to be visible whenever login button is pressed progressBar.setVisibility(View.VISIBLE); //CONNECTING TO FIREBASE AND REGISTERING AND AUTHENTICATING USER WITH IT fAuth.createUserWithEmailAndPassword(email,password).addOnCompleteListener(new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if(task.isSuccessful()){ Toast.makeText(Register.this,"User Created ",Toast.LENGTH_SHORT).show(); //creating a document in database and pushing user inputs userID = fAuth.getCurrentUser().getUid(); DocumentReference documentReference = fStore.collection("users").document(userID); Map<String,Object> user = new HashMap<>(); user.put("fName",fullName); user.put("email",email); documentReference.set(user).addOnSuccessListener(new OnSuccessListener<Void>() { @Override public void onSuccess(Void aVoid) { Log.d("TAG","onSuccess: user profile is created for "+ userID); } }).addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Log.d("TAG","onFailure:"+ e.toString()); } }); startActivity(new Intent(getApplicationContext(),MainActivity.class)); }else{ Toast.makeText(Register.this, "Error!" + task.getException(), Toast.LENGTH_SHORT).show(); progressBar.setVisibility(View.GONE); } } }); } }); //BACK TO SIGNiN PAGE signIn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intentLoadNewActivity = new Intent(Register.this,Login.class); startActivity(intentLoadNewActivity); } }); //HOMEPAGE LISTENER homeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intentLoadNewActivity = new Intent(Register.this,MainActivity.class); startActivity(intentLoadNewActivity); } }); //MENU LIST LISTENER listButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intentLoadNewActivity = new Intent(Register.this,menu_list.class); startActivity(intentLoadNewActivity); } }); //LOGIN PAGE loginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intentLoadNewActivity = new Intent(Register.this,Login.class); startActivity(intentLoadNewActivity); } }); } }
[ "apalta009@gmail.com" ]
apalta009@gmail.com
bb14406926110f176819fe34fefa94d3325b4732
888f1a7afb4afe5f022364924ef365f2f8fe3390
/src/tp7_Observer_Ej2_EncuentrosDeportivos/IInteresado.java
13d8f21a7f5902edd12cd81bf1a3b272bd791f70
[]
no_license
NFGarilli/unqui-po2-garilli
9bb7dbf12bcb0374c1723c83bc5aa3ecd6b10f7a
5fbb85c26a9a9222d1fc627a0353bd381c0db547
refs/heads/main
2023-06-21T18:48:33.559545
2021-07-05T07:05:26
2021-07-05T07:05:26
360,402,916
0
0
null
null
null
null
UTF-8
Java
false
false
307
java
package tp7_Observer_Ej2_EncuentrosDeportivos; public interface IInteresado { public void setInteresEnDeporte(String deporte); public void setInteresEnContrincante(String contrincante); public void removeInteresEnDeporte(String deporte); public void removeInteresEnContrincante(String contrincante); }
[ "garillinicolas@hotmail.com" ]
garillinicolas@hotmail.com
746c642c658cec88c330aa28db41b57186fc029d
e02bd66c176329db36e85d7a0bf3c5678d293022
/src/main/java/br/com/everis/applicant/conf/CacheConfig.java
57016a160d50ed4c561e086bff573378d18653e1
[]
no_license
rogeriofontes/applicant-api
be383f28498a5aaad8be65b727f41257a7a7bae4
f946bebaf2d4811e38f3cf3c20169d3af6b39c47
refs/heads/master
2022-11-28T11:29:51.171932
2020-07-29T00:30:27
2020-07-29T00:30:27
280,007,829
0
0
null
null
null
null
UTF-8
Java
false
false
3,987
java
package br.com.everis.applicant.conf; import br.com.everis.applicant.constants.Constants; import com.github.benmanes.caffeine.cache.Caffeine; import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.caffeine.CaffeineCache; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.util.concurrent.TimeUnit; @EnableCaching @Configuration public class CacheConfig { @Bean public CaffeineCache centersCache() { return new CaffeineCache(Constants.CENTERS_IN_CACHE, Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).maximumSize(Constants.MAXIMUM_SIZE).build()); } @Bean public CaffeineCache countrysCache() { return new CaffeineCache(Constants.COUNTRYS_IN_CACHE, Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).maximumSize(Constants.MAXIMUM_SIZE).build()); } @Bean public CaffeineCache manageHomeOfficesCache() { return new CaffeineCache(Constants.MANAGE_HOME_OFFICE_IN_CACHE, Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).maximumSize(Constants.MAXIMUM_SIZE).build()); } @Bean public CaffeineCache positionsCache() { return new CaffeineCache(Constants.POSITION_IN_CACHE, Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).maximumSize(Constants.MAXIMUM_SIZE).build()); } @Bean public CaffeineCache professionalsCache() { return new CaffeineCache(Constants.PROFESSIONAL_IN_CACHE, Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).maximumSize(Constants.MAXIMUM_SIZE).build()); } @Bean public CaffeineCache profilesCache() { return new CaffeineCache(Constants.PROFILE_IN_CACHE, Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).maximumSize(Constants.MAXIMUM_SIZE).build()); } @Bean public CaffeineCache programmingLanguagesCache() { return new CaffeineCache(Constants.PROGRAMMING_LANGUAGE_IN_CACHE, Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).maximumSize(Constants.MAXIMUM_SIZE).build()); } @Bean public CaffeineCache projectsCache() { return new CaffeineCache(Constants.PROJECT_IN_CACHE, Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).maximumSize(Constants.MAXIMUM_SIZE).build()); } @Bean public CaffeineCache teamsCache() { return new CaffeineCache(Constants.TEAM_IN_CACHE, Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).maximumSize(Constants.MAXIMUM_SIZE).build()); } @Bean public CaffeineCache usersCache() { return new CaffeineCache(Constants.USER_IN_CACHE, Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).maximumSize(Constants.MAXIMUM_SIZE).build()); } @Bean public CaffeineCache documentRegionsCache() { return new CaffeineCache(Constants.DOCUMENT_REGIONS_IN_CACHE, Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).maximumSize(Constants.MAXIMUM_SIZE).build()); } @Bean public CaffeineCache personTypesCache() { return new CaffeineCache(Constants.PERSON_TYPES_IN_CACHE, Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).maximumSize(Constants.MAXIMUM_SIZE).build()); } @Bean public CaffeineCache applicantsCache() { return new CaffeineCache(Constants.APPLICANT_IN_CACHE, Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).maximumSize(Constants.MAXIMUM_SIZE).build()); } @Bean public CaffeineCache applicantEvaluationsCache() { return new CaffeineCache(Constants.APPLICANT_EVALUATION_IN_CACHE, Caffeine.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).maximumSize(Constants.MAXIMUM_SIZE).build()); } }
[ "fontestz@gmail.com" ]
fontestz@gmail.com
5637721ff41c44505a5f76201b63cf56f84891c9
206dcc2a430a02fb0a7860ef11d090b5d4ebf686
/src/Rekord.java
63c020e2bf2cfe9eada6e547d7673c2a4b566adc
[]
no_license
madman556/PogodynkaAIBackup
666ed4be366c3de04882bffe6b4c07b016b0f906
f0f7eedf5e7412714429a3fba36d184e01d8be4e
refs/heads/master
2020-09-13T12:50:20.025581
2019-11-26T20:11:58
2019-11-26T20:11:58
222,786,242
0
0
null
null
null
null
UTF-8
Java
false
false
592
java
import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; import javax.swing.text.PlainDocument; public final class Rekord extends PlainDocument { private final int limit; public Rekord(int limit) { this.limit = limit; } @Override public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { if (str == null) return; if ((getLength() + str.length()) <= limit) { super.insertString(offs, str, a); } } }
[ "noreply@github.com" ]
madman556.noreply@github.com
249f8c9e3d100c6c8deb9aa40847340f4f74aa4e
5afad8c12856d14f6655c880c80a9f7eda25f465
/NiuCoderLesson_1/src/basic/Code_01_KMP.java
a0af028f3cc224157d3d49691b9689926f4d712d
[]
no_license
ltt19921124/eclipse-workspace
2fd693b5b5ce14c63b3d2833da4303fa1c2f6f58
29893e5c6b72493aa092b180eafe9f54f01faf29
refs/heads/master
2021-09-21T00:31:03.671721
2018-08-17T12:41:21
2018-08-17T12:41:21
118,131,590
0
0
null
null
null
null
UTF-8
Java
false
false
1,153
java
package basic; public class Code_01_KMP { public static int getIndexOf(String s, String m) { if (s == null || m == null || m.length() < 1 || s.length() < m.length()) { return -1; } char[] ss = s.toCharArray(); char[] ms = m.toCharArray(); int si = 0; int mi = 0; int[] next = getNextArray(ms); while (si < ss.length && mi < ms.length) { if (ss[si] == ms[mi]) { si++; mi++; } else if (next[mi] == -1) { si++; } else { mi = next[mi]; } } return mi == ms.length ? si - mi : -1; } public static int[] getNextArray(char[] ms) { if (ms.length == 1) { return new int[] { -1 }; } int[] next = new int[ms.length]; next[0] = -1; next[1] = 0; int pos = 2; int cn = 0; while (pos < next.length) { if (ms[pos - 1] == ms[cn]) { next[pos++] = ++cn; } else if (cn > 0) { cn = next[cn]; } else { next[pos++] = 0; } } return next; } public static void main(String[] args) { String str = "ccababacababaccc"; String match = "ababa"; /*char[] ss = str.toCharArray(); System.out.println(ss);*/ System.out.println(getIndexOf(str, match)); } }
[ "ltt19921124@163.com" ]
ltt19921124@163.com
1189656ccad3600c2a43b0564d6a087c126834e9
c0fcb1bafbf9a39efb384fdd31555b8bacb00846
/Assignments/Lab/Lab 05 - Nov 26 2020 Thursday/Lab05/app/src/main/java/com/abirhossain/nsu/fall2020/cse486/sec01/lab04/MainActivity.java
8ef39d0b267a156f3d4bd2ddad8705e2983d51fa
[]
no_license
abirhossain9/1731597_FA2020_CSE486.1
0feb20e6ed5a63ab6b508cb14d09d3205dd6e2c4
34b7c9546969f1afd65617b03594088d2bcfb76b
refs/heads/main
2023-02-19T09:22:42.408773
2021-01-21T07:39:00
2021-01-21T07:39:00
369,252,160
2
0
null
2021-05-20T15:18:44
2021-05-20T15:18:41
null
UTF-8
Java
false
false
2,465
java
package com.abirhossain.nsu.fall2020.cse486.sec01.lab04; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MainActivity extends AppCompatActivity { TextView t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; Button addItem1; public static final int TEXT_REQUEST = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); t1=(TextView)findViewById(R.id.text1); t2=(TextView)findViewById(R.id.text2); t3=(TextView)findViewById(R.id.text3); t4=(TextView)findViewById(R.id.text4); t5=(TextView)findViewById(R.id.text5); t6=(TextView)findViewById(R.id.text6); t7=(TextView)findViewById(R.id.text7); t8=(TextView)findViewById(R.id.text8); t9=(TextView)findViewById(R.id.text9); t10=(TextView)findViewById(R.id.text10); } public void add(View view) { Intent intent = new Intent(MainActivity.this,addData.class); startActivityForResult(intent,TEXT_REQUEST); } @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); if ( resultCode==RESULT_OK) { if(requestCode==TEXT_REQUEST){ String result= data.getStringExtra("Res"); if(result.equals("Rice")){ t1.setText(result); } else if(result.equals("Cake")){ t2.setText(result); } else if(result.equals("Butter")){ t3.setText(result); } else if(result.equals("Cheese")){ t4.setText(result); } else if(result.equals("Lemon")){ t6.setText(result); } else if(result.equals("Carrot")){ t7.setText(result); } else if(result.equals("Ice-cream")){ t8.setText(result); } else if(result.equals("Biscuit")){ t9.setText(result); } } } } }
[ "abir.hossain04@northsouth.edu" ]
abir.hossain04@northsouth.edu
67d9b199282dcce0f8e9f881c1cd630d151f2ceb
fca29d54905a2edd7fd4db82500bba9c43701966
/DataStructures/Exams/EXAM11032018/src/test/java/CorrectnessChainblock.java
f43cdff3a75880ac931a5992af37889bb65c6856
[ "MIT" ]
permissive
yangra/SoftUni
4046bd28e445f6cef98d2ee31179ba22892e6589
2fe8ac059fe398f8bf229200c5406840f026fb88
refs/heads/master
2021-01-13T15:16:53.303291
2018-04-22T18:19:58
2018-04-22T18:19:58
78,928,699
0
0
null
null
null
null
UTF-8
Java
false
false
48,008
java
import chainblock.Chainblock; import chainblock.IChainblock; import chainblock.Transaction; import chainblock.TransactionStatus; import org.junit.Assert; import org.junit.Test; import java.util.ArrayList; import java.util.List; import java.util.NoSuchElementException; public class CorrectnessChainblock { //addition @Test public void add_SingleElement_ShouldWorkCorrectly() { //Arrange IChainblock cb = new Chainblock(); Transaction tx = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 5); //Act cb.add(tx); //Assert for (Transaction transaction : cb) { Assert.assertSame(transaction, tx); } } @Test public void add_SingleElement_ShouldIncreaseCountTo1() { //Arrange IChainblock cb = new Chainblock(); Transaction tx = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 5); //Act cb.add(tx); //Assert for (Transaction transaction : cb) { Assert.assertSame(transaction, tx); } Assert.assertEquals(1, cb.getCount()); } @Test public void add_MultipleElements_CB_ShouldContainThem() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5); //Act cb.add(tx1); cb.add(tx2); cb.add(tx3); //Assert Assert.assertTrue(cb.contains(tx1)); Assert.assertTrue(cb.contains(tx2)); Assert.assertTrue(cb.contains(tx3)); } @Test public void add_MultipleElements_CB_ShouldContainThemById() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5); //Act cb.add(tx1); cb.add(tx2); cb.add(tx3); //Assert Assert.assertTrue(cb.contains(tx1.getId())); Assert.assertTrue(cb.contains(tx2.getId())); Assert.assertTrue(cb.contains(tx3.getId())); } //Contains @Test public void Contains_OnEmptyChainblock_ShouldReturnFalse() { //Arrange IChainblock cb = new Chainblock(); //Act //Assert Assert.assertFalse(cb.contains(5)); Assert.assertFalse(cb.contains(new Transaction(3, TransactionStatus.Failed, "a", "b", 0.5))); } @Test public void Contains_OnExistingElement_ShouldReturnTrue() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5); //Act cb.add(tx1); cb.add(tx2); cb.add(tx3); //Assert Assert.assertTrue(cb.contains(5)); Assert.assertFalse(cb.contains(3)); Assert.assertTrue(cb.contains(tx2)); Assert.assertFalse(cb.contains(new Transaction(0, TransactionStatus.Failed, "b", "b", 5))); } //Count @Test public void Count_Should_IncreaseOnMultiple_Elements() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5); //Act cb.add(tx1); cb.add(tx2); cb.add(tx3); //Assert Assert.assertEquals(3, cb.getCount()); } @Test public void Count_Should_Be_0_On_EmptyCollection() { //Arrange IChainblock cb = new Chainblock(); //Act //Assert Assert.assertEquals(0, cb.getCount()); } @Test public void Count_Should_RemainCorrect_AfterRemoving() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5); //Act cb.add(tx1); cb.add(tx2); cb.add(tx3); cb.removeTransactionById(tx1.getId()); cb.removeTransactionById(tx3.getId()); //Assert Assert.assertEquals(1, cb.getCount()); Assert.assertNotSame(tx1, cb.getById(tx2.getId())); } //GetById @Test public void GetById_On_ExistingElement_ShouldWorkCorrectly() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5); //Act cb.add(tx1); cb.add(tx2); cb.add(tx3); //Assert Assert.assertSame(tx1, cb.getById(5)); Assert.assertNotSame( new Transaction(53, TransactionStatus.Failed, "a", "b", 5), cb.getById(7) ); } @Test(expected = IllegalArgumentException.class) public void GetById_On_NonExistingElement_ShouldThrow() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5); //Act cb.add(tx1); cb.add(tx2); cb.add(tx3); cb.removeTransactionById(5); //Assert cb.getById(5); } @Test public void GetById_On_Empty_Chainblock_ShouldThrow() { //Arrange IChainblock cb = new Chainblock(); //Act //Assert boolean throwed = false; try{ cb.getById(5); }catch(IllegalArgumentException ex){ throwed = true; } Assert.assertTrue(throwed); } //ChangeTxStatus @Test public void ChangeTransactionStatus_ShouldWorkCorrectly_On_ExistingTX() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5); //Act cb.add(tx1); cb.add(tx2); cb.add(tx3); cb.changeTransactionStatus(5, TransactionStatus.Aborted); //Assert Assert.assertEquals(TransactionStatus.Aborted, tx1.getStatus()); Assert.assertEquals(3, cb.getCount()); } @Test public void ChangeTransactionStatus_OnMultipleTransactions_ShouldWorkCorrectly() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5); //Act cb.add(tx1); cb.add(tx2); cb.add(tx3); cb.changeTransactionStatus(7, TransactionStatus.Unauthorized); cb.changeTransactionStatus(5, TransactionStatus.Aborted); cb.changeTransactionStatus(6, TransactionStatus.Successfull); //Assert Assert.assertEquals(3, cb.getCount()); Assert.assertEquals(tx1.getStatus(), TransactionStatus.Aborted); Assert.assertEquals(tx3.getStatus(), TransactionStatus.Unauthorized); Assert.assertEquals(tx2.getStatus(), TransactionStatus.Successfull); } @Test public void GetAllOrderedByAmountDescendingThenById_ShouldReturnEmpty_OnEmptyCB() { //Arrange IChainblock cb = new Chainblock(); //Act //Assert List<Transaction> result = new ArrayList<>(); Iterable<Transaction> res = cb.getAllOrderedByAmountDescendingThenById(); for(Transaction tx : res){ result.add(tx); } Transaction[] actual = new Transaction[result.size()]; for(int i = 0 ; i < result.size(); i++){ actual[i] = result.get(i); } Assert.assertEquals(new Transaction[0], actual); } @Test public void GetAllOrderedByAmountDescendingThenById_ShouldWorkCorrectlyAfterRemove() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 5.5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5.5); Transaction tx4 = new Transaction(12, TransactionStatus.Successfull, "joro", "pesho", 15.6); Transaction tx5 = new Transaction(15, TransactionStatus.Successfull, "joro", "pesho", 7.8); Transaction[] expected = new Transaction[] { tx5,tx3,tx1 }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); ArrayList<Transaction> result = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getAllOrderedByAmountDescendingThenById(); for(Transaction tx : res){ result.add(tx); } Assert.assertEquals(5, result.size()); cb.removeTransactionById(tx4.getId()); cb.removeTransactionById(tx2.getId()); result = new ArrayList<Transaction>(); res = cb.getAllOrderedByAmountDescendingThenById(); for(Transaction tx : res){ result.add(tx); } Transaction[] actual = new Transaction[result.size()]; for(int i = 0 ; i < result.size(); i++){ actual[i] = result.get(i); } //Assert Assert.assertArrayEquals(expected, actual); } //GetAllOrderedByAmountDescendingThenById @Test public void GetAllOrderedByAmountDescendingThenById_ShouldWorkCorrectly() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 5.5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5.5); Transaction tx4 = new Transaction(12, TransactionStatus.Successfull, "joro", "pesho", 15.6); Transaction tx5 = new Transaction(15, TransactionStatus.Successfull, "joro", "pesho", 7.8); Transaction[] expected = new Transaction[] { tx4,tx5,tx2,tx3,tx1 }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); ArrayList<Transaction> list = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getAllOrderedByAmountDescendingThenById(); for(Transaction tx : res){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } //Assert Assert.assertArrayEquals(expected, actual); } @Test public void ChangeTransactionStatus_On_NonExistingTranasction_ShouldThrow() { //Arrange IChainblock cb = new Chainblock(); //Act //Assert boolean threw = false; try{ cb.changeTransactionStatus(6, TransactionStatus.Failed); }catch(IllegalArgumentException ex){ threw = true; } Assert.assertTrue(threw); } //Enumerator @Test public void CB_ShouldBeEnumeratedIn_InsertionOrder() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction[] expected = new Transaction[] { tx1,tx3,tx2 }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); ArrayList<Transaction> list = new ArrayList<Transaction>(); for(Transaction tx : cb){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } //Assert Assert.assertArrayEquals(expected, actual); } @Test public void CB_ShouldReturn_TransactionsInCorrectOrder_AfterDelete() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5); Transaction[] expected = new Transaction[] { tx2 }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.removeTransactionById(5); cb.removeTransactionById(7); ArrayList<Transaction> list = new ArrayList<Transaction>(); for(Transaction tx : cb){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } //Assert Assert.assertArrayEquals(expected, actual); } @Test public void GetByTransactionStatusAndMaximumAmount_ShouldReturnEmptyCollection() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(2, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx2 = new Transaction(1, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx3 = new Transaction(4, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx4 = new Transaction(3, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx5 = new Transaction(8, TransactionStatus.Failed, "valq", "pesho", 17.8); //Act cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); //Assert ArrayList<Transaction> list = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getByTransactionStatusAndMaximumAmount(TransactionStatus.Unauthorized,5); for(Transaction tx : res){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } Assert.assertArrayEquals(new Transaction[0], actual); cb = new Chainblock(); list = new ArrayList<Transaction>(); res = cb.getByTransactionStatusAndMaximumAmount(TransactionStatus.Unauthorized,1); for(Transaction tx : res){ list.add(tx); } actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } Assert.assertArrayEquals(new Transaction[0], actual); } @Test public void GetByTransactionStatusAndMaximumAmount_ShouldWorkCorrectly_AfterRemove() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(2, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx2 = new Transaction(1, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx3 = new Transaction(4, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx4 = new Transaction(3, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx5 = new Transaction(8, TransactionStatus.Failed, "valq", "pesho", 17.8); Transaction[] expected = new Transaction[] { tx2 }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); cb.removeTransactionById(tx1.getId()); //Assert ArrayList<Transaction> list = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getByTransactionStatusAndMaximumAmount(TransactionStatus.Successfull, 15.0); for(Transaction tx : res){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } Assert.assertArrayEquals(expected, actual); } @Test public void GetByTransactionStatusAndMaximumAmount_ShouldWorkCorrectly() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(2, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx2 = new Transaction(1, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx3 = new Transaction(4, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx4 = new Transaction(3, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx5 = new Transaction(8, TransactionStatus.Successfull, "valq", "pesho", 17.8); Transaction[] expected = new Transaction[] { tx3, tx4, tx1, tx2 }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); //Assert ArrayList<Transaction> list = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getByTransactionStatusAndMaximumAmount(TransactionStatus.Successfull, 17.0); for(Transaction tx : res){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } Assert.assertArrayEquals(expected, actual); } @Test(expected = IllegalArgumentException.class) public void GetByNonExistingTransactionStatus_ShouldThrow() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(2, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx2 = new Transaction(1, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx3 = new Transaction(4, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx4 = new Transaction(3, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx5 = new Transaction(8, TransactionStatus.Failed, "valq", "pesho", 17.8); //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); //Assert cb.getByTransactionStatus(TransactionStatus.Unauthorized); } @Test public void GetByTransactionStatus_ShouldReturnCorrectResult() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(2, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx2 = new Transaction(1, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx3 = new Transaction(4, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx4 = new Transaction(3, TransactionStatus.Failed, "valq", "pesho", 15.6); Transaction tx5 = new Transaction(8, TransactionStatus.Successfull, "valq", "pesho", 17.8); Transaction[] expected = new Transaction[] { tx5, tx3, tx1, tx2 }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); //Assert ArrayList<Transaction> list = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getByTransactionStatus(TransactionStatus.Successfull); for(Transaction tx : res){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } Assert.assertArrayEquals(expected, actual); } //GetByTransactionStatus @Test public void GetByTransactionStatus_ShouldReturnCorrectResultAfterRemove() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(2, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx2 = new Transaction(1, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx3 = new Transaction(4, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx4 = new Transaction(3, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx5 = new Transaction(8, TransactionStatus.Failed, "valq", "pesho", 17.8); Transaction[] expected = new Transaction[]{ tx3, tx1, tx2 }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); cb.removeTransactionById(8); cb.removeTransactionById(3); //Assert ArrayList<Transaction> list = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getByTransactionStatus(TransactionStatus.Successfull); for(Transaction tx : res){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } Assert.assertArrayEquals(expected, actual); } @Test(expected = IllegalArgumentException.class) public void GetBySenderOrderedByAmountDescending_ShouldOn_MissingSender() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(2, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx2 = new Transaction(1, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx3 = new Transaction(4, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx4 = new Transaction(3, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx5 = new Transaction(8, TransactionStatus.Failed, "valq", "pesho", 17.8); //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); cb.removeTransactionById(8); cb.removeTransactionById(3); //Assert cb.getBySenderOrderedByAmountDescending("momo"); } @Test public void GetBySenderOrderedByAmountDescending_ShouldWorkCorrectly_AfterRemove() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(2, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx2 = new Transaction(1, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx3 = new Transaction(4, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx4 = new Transaction(3, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx5 = new Transaction(8, TransactionStatus.Failed, "valq", "pesho", 17.8); Transaction[] expected = new Transaction[]{ tx3, tx1, tx2 }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); cb.removeTransactionById(8); cb.removeTransactionById(3); //Assert ArrayList<Transaction> list = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getBySenderOrderedByAmountDescending("valq"); for(Transaction tx : res){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } Assert.assertArrayEquals(expected, actual); } //GetBySenderOrderedByAmount @Test public void GetBySenderOrderedByAmountDescending_ShouldWorkCorrectly_OnExistingSender() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(2, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx2 = new Transaction(1, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx3 = new Transaction(4, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx4 = new Transaction(3, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx5 = new Transaction(8, TransactionStatus.Failed, "valq", "pesho", 17.8); Transaction[] expected = new Transaction[] { tx5, tx3, tx4, tx1, tx2 }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); //Assert ArrayList<Transaction> list = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getBySenderOrderedByAmountDescending("valq"); for(Transaction tx : res){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } Assert.assertArrayEquals(expected, actual); } @Test public void GetBySenderAndMinimumAmountDescending_ShouldThrowOnEmpty_CB() { //Arrange IChainblock cb = new Chainblock(); //Act //Assert boolean threw = false; cb.getBySenderAndMinimumAmountDescending("pesho",5); Assert.assertTrue(threw); } @Test public void GetBySenderAndMinimumAmountDescending_ShouldOrderAndPickCorrectly() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(2, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(1, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx3 = new Transaction(4, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx4 = new Transaction(3, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx5 = new Transaction(8, TransactionStatus.Failed, "valq", "pesho", 17.8); Transaction[] expected = new Transaction[] { tx3 }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); cb.removeTransactionById(8); cb.removeTransactionById(3); //Assert ArrayList<Transaction> list = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getBySenderAndMinimumAmountDescending("valq", 15.5); for(Transaction tx : res){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } Assert.assertArrayEquals(expected, actual); } //GetAllInRange @Test public void GetInAmountRange_ShouldReturn_CorrectTransactionsByInsertionOrder() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 2); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5.5); Transaction tx4 = new Transaction(12, TransactionStatus.Successfull, "joro", "pesho", 15.6); Transaction tx5 = new Transaction(15, TransactionStatus.Successfull, "joro", "pesho", 7.8); Transaction[] expected = new Transaction[] { tx4,tx5 }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); ArrayList<Transaction> list = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getAllInAmountRange(7.8, 16); for(Transaction tx : res){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } //Assert Assert.assertArrayEquals(expected, actual); } @Test public void GetAllInAmountRange_ShouldReturn_EmptyCollectionOnNonExistingRange() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 2); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5.5); Transaction tx4 = new Transaction(12, TransactionStatus.Successfull, "joro", "pesho", 15.6); Transaction tx5 = new Transaction(15, TransactionStatus.Successfull, "joro", "pesho", 7.8); Transaction[] expected = new Transaction[0]; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); ArrayList<Transaction> list = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getAllInAmountRange(7.7, 7.75); for(Transaction tx : res){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } //Assert Assert.assertArrayEquals(expected, actual); cb.removeTransactionById(12); cb.removeTransactionById(15); list = new ArrayList<Transaction>(); res = cb.getAllInAmountRange(7.8, 16); for(Transaction tx : res){ list.add(tx); } actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } Assert.assertArrayEquals(expected, actual); } //GetBySenderWithTransactionStatus @Test public void GetAllSendersWithTransactionStatus_ShouldWorkCorrectly() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(6, TransactionStatus.Aborted, "joro", "pesho", 5.5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5.5); Transaction tx4 = new Transaction(12, TransactionStatus.Unauthorized, "boro", "pesho", 15.6); Transaction tx5 = new Transaction(15, TransactionStatus.Unauthorized, "moro", "pesho", 7.8); String[] expected = new String[] { "boro", "moro" }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); ArrayList<String> list = new ArrayList<String>(); Iterable<String> res = cb.getAllSendersWithTransactionStatus(TransactionStatus.Unauthorized); for(String tx : res){ list.add(tx); } String[] actual = new String[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } //Assert Assert.assertArrayEquals(expected, actual); } @Test(expected = IllegalArgumentException.class) public void GetAllSendersWithTransactionStatus_OnNonExistantTxs_ShouldThrow() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(6, TransactionStatus.Aborted, "joro", "pesho", 5.5); Transaction tx3 = new Transaction(7, TransactionStatus.Aborted, "joro", "pesho", 5.5); Transaction tx4 = new Transaction(12, TransactionStatus.Failed, "joro", "pesho", 15.6); Transaction tx5 = new Transaction(15, TransactionStatus.Successfull, "joro", "pesho", 7.8); //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); //Assert cb.getAllSendersWithTransactionStatus(TransactionStatus.Unauthorized); } @Test(expected = IllegalArgumentException.class) public void GetAllSendersWithTransactionStatus_ShoudlThrowAfterRemove() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 5.5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5.5); Transaction tx4 = new Transaction(12, TransactionStatus.Successfull, "joro", "pesho", 15.6); Transaction tx5 = new Transaction(15, TransactionStatus.Failed, "joro", "pesho", 7.8); //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); cb.removeTransactionById(5); cb.removeTransactionById(7); cb.removeTransactionById(6); cb.removeTransactionById(12); cb.removeTransactionById(15); //Assert cb.getAllSendersWithTransactionStatus(TransactionStatus.Failed); } //GetBySenderWithTransactionStatus @Test public void GetAllReceiversWithTransactionStatus_ShouldWorkCorrectly() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(6, TransactionStatus.Aborted, "joro", "pesho", 5.5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5.5); Transaction tx4 = new Transaction(12, TransactionStatus.Unauthorized, "joro", "pesho", 15.6); Transaction tx5 = new Transaction(15, TransactionStatus.Unauthorized, "moro", "vesho", 7.8); String[] expected = new String[]{ "pesho", "vesho" }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); ArrayList<String> list = new ArrayList<String>(); Iterable<String> res = cb.getAllReceiversWithTransactionStatus(TransactionStatus.Unauthorized); for(String tx : res){ list.add(tx); } String[] actual = new String[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } //Assert Assert.assertArrayEquals(expected, actual); } @Test(expected = IllegalArgumentException.class) public void GetAllReceiversWithTransactionStatus_ShoudlThrowAfterRemove() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 5.5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5.5); Transaction tx4 = new Transaction(12, TransactionStatus.Successfull, "joro", "pesho", 15.6); Transaction tx5 = new Transaction(15, TransactionStatus.Failed, "joro", "pesho", 7.8); //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); cb.removeTransactionById(5); cb.removeTransactionById(7); cb.removeTransactionById(6); cb.removeTransactionById(12); cb.removeTransactionById(15); //Assert cb.getAllReceiversWithTransactionStatus(TransactionStatus.Failed); } @Test public void GetAllReceiversWithTransactionStatus_OnNonExistantTxs_ShouldThrow() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(6, TransactionStatus.Aborted, "joro", "pesho", 5.5); Transaction tx3 = new Transaction(7, TransactionStatus.Aborted, "joro", "pesho", 5.5); Transaction tx4 = new Transaction(12, TransactionStatus.Failed, "joro", "pesho", 15.6); Transaction tx5 = new Transaction(15, TransactionStatus.Successfull, "joro", "pesho", 7.8); //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); //Assert boolean threw = false; try{ cb.getAllReceiversWithTransactionStatus(TransactionStatus.Unauthorized).iterator().next(); }catch(IllegalArgumentException ex) { threw = true; }catch(NoSuchElementException e){ threw = true; } Assert.assertTrue(threw); } //GetByReceiverAndAmountRange @Test public void GetByReceiverAndAmountRange_ShouldWorkCorrectly_On_CorrectRange() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "pesho", 5.5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "pesho", 5.5); Transaction tx4 = new Transaction(12, TransactionStatus.Successfull, "joro", "pesho", 15.6); Transaction tx5 = new Transaction(15, TransactionStatus.Failed, "joro", "resho", 7.8); Transaction[] expected = new Transaction[] { tx4, tx2, tx3, tx1 }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); //Assert ArrayList<Transaction> list = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getByReceiverAndAmountRange("pesho", 0, 20); for(Transaction tx : res){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } Assert.assertArrayEquals(expected, actual); } @Test public void GetByRceiver_ShouldReturnCorrectRange_CorrectlyOrdered() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(2, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(1, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx3 = new Transaction(4, TransactionStatus.Successfull, "joro", "pesho", 15.6); Transaction tx4 = new Transaction(3, TransactionStatus.Successfull, "joro", "pesho", 15.6); Transaction tx5 = new Transaction(8, TransactionStatus.Failed, "joro", "pesho", 17.8); Transaction[] expected = new Transaction[] { tx5, tx4, tx3, tx2, tx1 }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); //Assert ArrayList<Transaction> list = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getByReceiverAndAmountRange("pesho", 0, 20); for(Transaction tx : res){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } Assert.assertArrayEquals(expected, actual); } @Test public void GetByReceiverAndAmountRange_ShouldThrow_AfterRemovingReceiver() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(5, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(6, TransactionStatus.Successfull, "joro", "mesho", 5.5); Transaction tx3 = new Transaction(7, TransactionStatus.Successfull, "joro", "vesho", 5.5); //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.removeTransactionById(5); //Assert boolean threw = false; try{ cb.getByReceiverAndAmountRange("pesho", 0, 20).iterator().next(); }catch(IllegalArgumentException ex){ threw = true; } Assert.assertTrue(threw); } @Test public void GetByReceiverAndAmountRange_ShouldThrow_On_EmptyCB() { //Arrange IChainblock cb = new Chainblock(); //Act //Assert boolean threw = false; try{ cb.getByReceiverAndAmountRange("pesho", 0, 20).iterator().next(); }catch(IllegalArgumentException ex){ threw = true; } Assert.assertTrue(threw); } //GetAllByReceiverOrderedByAmountDescendingThenById @Test public void GetByReceiver_ShouldWorkCorrectly() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(2, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(1, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx3 = new Transaction(4, TransactionStatus.Successfull, "joro", "pesho", 15.6); Transaction tx4 = new Transaction(3, TransactionStatus.Successfull, "joro", "pesho", 15.6); Transaction tx5 = new Transaction(8, TransactionStatus.Failed, "joro", "pesho", 17.8); Transaction[] expected = new Transaction[] { tx5, tx4, tx3, tx2, tx1 }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); //Assert ArrayList<Transaction> list = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getByReceiverOrderedByAmountThenById("pesho"); for(Transaction tx : res){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } Assert.assertArrayEquals(expected, actual); } @Test(expected = IllegalArgumentException.class) public void GetByReceiver_On_NonExisting_Receiver_ShouldThrow() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(2, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(1, TransactionStatus.Successfull, "joro", "mesho", 1); Transaction tx3 = new Transaction(4, TransactionStatus.Successfull, "joro", "kalin", 15.6); Transaction tx4 = new Transaction(3, TransactionStatus.Successfull, "joro", "pesho", 15.6); Transaction tx5 = new Transaction(8, TransactionStatus.Failed, "joro", "barko", 17.8); //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); //Assert cb.getByReceiverOrderedByAmountThenById("mecho"); } @Test(expected = IllegalArgumentException.class) public void GetByReceiver_ShouldThrow_On_EmptyCB() { //Arrange IChainblock cb = new Chainblock(); //Act //Assert cb.getByReceiverOrderedByAmountThenById("pesho"); } @Test public void GetBySenderAndMinimumAmountDescending_ShouldWorkCorrectly_OnExistingSender() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(2, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(1, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx3 = new Transaction(4, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx4 = new Transaction(3, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx5 = new Transaction(8, TransactionStatus.Failed, "valq", "pesho", 17.8); Transaction[] expected = new Transaction[] { tx5, tx3, tx4 }; //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); //Assert ArrayList<Transaction> list = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getBySenderAndMinimumAmountDescending("valq",15.5); for(Transaction tx : res){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } Assert.assertArrayEquals(expected, actual); } @Test(expected = IllegalArgumentException.class) public void GetBySenderAndMinimumAmountDescending_ShouldThrow_OnMissingSender() { //Arrange IChainblock cb = new Chainblock(); Transaction tx1 = new Transaction(2, TransactionStatus.Successfull, "joro", "pesho", 1); Transaction tx2 = new Transaction(1, TransactionStatus.Successfull, "valq", "pesho", 14.8); Transaction tx3 = new Transaction(4, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx4 = new Transaction(3, TransactionStatus.Successfull, "valq", "pesho", 15.6); Transaction tx5 = new Transaction(8, TransactionStatus.Failed, "valq", "pesho", 17.8); //Act cb.add(tx1); cb.add(tx3); cb.add(tx2); cb.add(tx4); cb.add(tx5); //Assert cb.getBySenderAndMinimumAmountDescending("poncho", 15.5); } @Test public void GetAllInAmountRange_ShouldReturnEmptyEnumeration_On_EmptyCB() { //Arrange IChainblock cb = new Chainblock(); //Act ArrayList<Transaction> list = new ArrayList<Transaction>(); Iterable<Transaction> res = cb.getAllInAmountRange(7.7, 7.75); for(Transaction tx : res){ list.add(tx); } Transaction[] actual = new Transaction[list.size()]; for(int i = 0 ; i < list.size(); i++){ actual[i] = list.get(i); } //Assert Assert.assertArrayEquals(new Transaction[0], actual); } }
[ "brambazluk@gmail.com" ]
brambazluk@gmail.com
8deed835a2a16249f59219f63520fb19098c7e11
0e7900ac1bd7690138077f495d307269f16bafa8
/app/src/main/java/org/huihui/smallplugindemo/SmallApp.java
f4372ce162444a17ce4e9ed4318d4fcd473b9a42
[]
no_license
ab503044120/SmallPluginDemo
7ad86e42de201f35e84623a43e16e2dd40ea8057
8b5d1cdfa9231eb2fd67bc9bb1346438c23eea69
refs/heads/master
2021-01-13T03:15:48.760223
2017-01-04T09:55:17
2017-01-04T09:55:17
77,601,632
0
1
null
null
null
null
UTF-8
Java
false
false
1,126
java
package org.huihui.smallplugindemo; import android.app.Application; import net.wequick.small.Small; /** * The host application for Small */ public class SmallApp extends Application { public SmallApp() { // This should be the very first of the application lifecycle. // It's also ahead of the installing of content providers by what we can avoid // the ClassNotFound exception on if the provider is unimplemented in the host. Small.preSetUp(this); } @Override public void onCreate() { super.onCreate(); // Whether load the bundles from assets or not. // AUTO-SET VALUE. DO NOT MODIFY. // This value will be automatically set by define: // small { // buildToAssets = true|false // } // in your root build.gradle. Small.setLoadFromAssets(BuildConfig.LOAD_FROM_ASSETS); // If you have some native web modules, uncomment following // to declare a base URI for cross-platform page jumping. // Small.setBaseUri("https://huihui.org/"); // } }
[ "503044120@qq.com" ]
503044120@qq.com
637ce19dbf54d4d09f814512a7f095d538e57c6e
a29c69639ed376bd1f07a2729d457a0a5995e4e7
/HandsOn/src/main/java/my/threadnew/FastThreadLocal/InternalThreadLocalMap.java
6d8fcc8c75f67a8940bbb311bec5331f47acd90a
[ "Apache-2.0" ]
permissive
ThreadNew/HandsOnCode
1089ce791190a846476a07b8a673a81ffdad8f2a
e94d16549f846a3a2b9484b9f56f959cd48068cc
refs/heads/master
2023-05-06T14:35:35.441872
2021-05-30T10:10:09
2021-05-30T10:10:09
368,573,825
0
0
null
null
null
null
UTF-8
Java
false
false
2,305
java
package my.threadnew.FastThreadLocal; import java.util.Arrays; import java.util.concurrent.atomic.AtomicInteger; /** * @Author: ThreadNew * @Description: TODO * @Date: 2021/5/18 20:51 * @Version: 1.0 */ public class InternalThreadLocalMap { // 唯一ID ,线程安全 private static final AtomicInteger nextIndex = new AtomicInteger(); // 存储数据 private Object[] indexedVariables; // 数组长度 private static final int INDEXED_VARIABLE_TABLE_INITIAL_SIZE = 32; // 默认存储值 public static final Object UNSET = new Object(); // 构造函数 private InternalThreadLocalMap() { // 初始化数组 indexedVariables = newIndexedVariabledTable(); } private static Object[] newIndexedVariabledTable() { Object[] array = new Object[INDEXED_VARIABLE_TABLE_INITIAL_SIZE]; Arrays.fill(array, UNSET); return array; } //得到下标 public static int nextVariableIndex() { int index = nextIndex.getAndIncrement(); return index; } // 插入 public boolean setIndexedVariable(int index, Object value) { Object[] lookup = indexedVariables; if (index < lookup.length) { Object oldValue = lookup[index]; lookup[index] = value; System.out.println(Thread.currentThread()+" "+(String)value); return oldValue == UNSET; } else {// 扩容处理 } return true; } public Object indexedVariable(int index) { Object[] lookup = indexedVariables; return index < lookup.length ? lookup[index] : UNSET; } // get public static InternalThreadLocalMap get() { Thread thread = Thread.currentThread(); if (thread instanceof FastThreadLocalThread) { return fastGet((FastThreadLocalThread) thread); } return null; } private static InternalThreadLocalMap fastGet(FastThreadLocalThread thread) { InternalThreadLocalMap threadLocalMap = thread.threadLocalMap(); if (threadLocalMap == null) { thread.setThreadLocalMap(threadLocalMap = new InternalThreadLocalMap()); } return threadLocalMap; } }
[ "1402583417@qq.com" ]
1402583417@qq.com
5e394d1081d45f7ded8c99fd4744b05d215092b4
c6f83665b0977271c0cd1f480ad0917b6c750fd8
/app/src/main/java/com/example/day02_homework1/MainActivity.java
1d33035cb9da09633665040f6d56852bffd11fbc
[]
no_license
qx2259100367/ZuoYe
c710c5c94590231c5493cb6e16bf8a1d548cf6d4
e4bdb806f944dae7258d9b3ddb04b5399c4e9d54
refs/heads/master
2020-07-30T07:30:15.025096
2019-09-22T11:39:18
2019-09-22T11:39:18
210,135,564
0
0
null
null
null
null
UTF-8
Java
false
false
3,670
java
package com.example.day02_homework1; import android.os.Bundle; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.StaggeredGridLayoutManager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import com.example.day02_homework1.Beans.FuliBean; import com.example.day02_homework1.adaper.FuliAdaper; import com.example.day02_homework1.presenter.FuliPresenter; import com.example.day02_homework1.view.FuliView; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; public class MainActivity extends AppCompatActivity implements FuliView { @BindView(R.id.MyRec) RecyclerView mMyRec; @BindView(R.id.MyVp) ViewPager mMyVp; private FuliPresenter fuliPresenter; private ArrayList<FuliBean.ResultsBean> list; private FuliAdaper adaper; private int index; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); fuliPresenter = new FuliPresenter(this); initRec(); } private void initRec() { mMyRec.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL)); // mMyRec.addItemDecoration(new DividerItemDecoration(this,LinearLayout.VERTICAL)); fuliPresenter.loadDatas(); list = new ArrayList<>(); adaper = new FuliAdaper(list, this); mMyRec.setAdapter(adaper); adaper.setA(new FuliAdaper.A() { @Override public void setonLongClick(View v, int position) { mMyRec.setVisibility(View.GONE); mMyVp.setVisibility(View.VISIBLE); initViewPage(position); } }); } private void initViewPage(int position) { final ArrayList<FuliBean.ResultsBean> fulilist = adaper.list; PagerAdapter adapter = new PagerAdapter(){ @Override public int getCount() { return fulilist.size(); } @Override public boolean isViewFromObject(View view, Object object) { return view==object; } @Override public Object instantiateItem(ViewGroup container, int position) { View view = LayoutInflater.from(MainActivity.this).inflate(R.layout.img_item, null); ImageView imgs = view.findViewById(R.id.img); TextView tvs = view.findViewById(R.id.tv); Glide.with(MainActivity.this).load(fulilist.get(position).getUrl()).into(imgs); tvs.setText((position+1)+"/"+fulilist.size()); container.addView(view); return view; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } }; mMyVp.setAdapter(adapter); mMyVp.setCurrentItem(position); } @Override public void onSuccess(List<FuliBean.ResultsBean> resultsBeans) { list.addAll(resultsBeans); adaper.notifyDataSetChanged(); } @Override public void onFailed(String str) { Toast.makeText(this, str, Toast.LENGTH_SHORT).show(); } }
[ "2259100367@qq.com" ]
2259100367@qq.com
3b26284c5d50340431c70bd3089750ae42b1b969
260eb4e7e2d0fa8bd17612afef3b652e8019767f
/src/main/java/br/com/panoramico/dao/PassaporteValorDao.java
775e27a797449d51f824b8725ab060fb48b48cae
[]
no_license
julioizidoro/panoramico
02b1be3e5731ca31bf56d54ba0c9b5cb712bd80b
ac77dc40241fd0bb5a460e3704830b372e990dea
refs/heads/master
2020-04-15T14:04:08.050331
2017-10-23T16:56:44
2017-10-23T16:56:44
56,233,529
0
0
null
null
null
null
UTF-8
Java
false
false
483
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package br.com.panoramico.dao; import br.com.panoramico.model.Passaportevalor; import javax.ejb.Stateless; @Stateless public class PassaporteValorDao extends AbstractDao<Passaportevalor>{ public PassaporteValorDao() { super(Passaportevalor.class); } }
[ "Anderson Luiz@DESKTOP-PMPNJL0" ]
Anderson Luiz@DESKTOP-PMPNJL0
29405d3c24c7d816b151975afe8a640ad62510c8
60ee62be7600c6e6f0c449226d9dd731e76a61ab
/src/org/maintenance/component/MMPJobStandardResource.java
9c6cd325a02ee4136bdb4b3fa7cc7a8a460d4ce2
[]
no_license
Frontuari/org.asset.maintenance
cb078e6e3c0783ef2b46a96d3a9497a09add83ee
3b478faf8f835a9b8f18487136f3b23c7836e6d4
refs/heads/master
2021-09-15T02:31:22.753461
2021-08-17T21:09:22
2021-08-17T21:09:22
233,240,392
0
1
null
null
null
null
UTF-8
Java
false
false
1,148
java
/** * Licensed under the KARMA v.1 Law of Sharing. As others have shared freely to you, so shall you share freely back to us. * If you shall try to cheat and find a loophole in this license, then KARMA will exact your share. * and your worldly gain shall come to naught and those who share shall gain eventually above you. * In compliance with previous GPLv2.0 works of ComPiere USA, OFBConsulting CHILE, Redhuan D. Oon (www.red1.org) and other contributors * THIS ASSET MAINTENANCE module is contribution of Ramiro Vergara, OFB Consulting, CHILE. */ package org.maintenance.component; import java.sql.ResultSet; import java.util.Properties; import org.maintenance.model.X_MP_JobStandar_Resource; public class MMPJobStandardResource extends X_MP_JobStandar_Resource{ /** * */ private static final long serialVersionUID = 1L; public MMPJobStandardResource(Properties ctx, int MP_JobStandar_Resource_ID, String trxName) { super(ctx, MP_JobStandar_Resource_ID, trxName); // TODO Auto-generated constructor stub } public MMPJobStandardResource(Properties ctx, ResultSet rs, String trxName) { super(ctx,rs,trxName); } }
[ "red1@localhost" ]
red1@localhost
8af77fe39ac9f06fb3234142bc80f192629b7de6
e1f46e3358be046b2c9a855c091b3cc7c8f355ee
/app/src/main/java/com/example/edward/firebaseproject2/RegisterActivity.java
c0568ed50fbdc85768a62ec9b9c3b62ba3857c9a
[]
no_license
edzabrensky/NearMe
0b63ba70bb6d11f6fe1b3e99e688a536184de896
5faf64dbd948f8cabbbedf9fac5ce4ea2e2ed7ee
refs/heads/master
2021-03-27T16:00:16.523233
2016-10-22T23:46:38
2016-10-22T23:46:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,121
java
package com.example.edward.firebaseproject2; import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.Toast; import com.firebase.client.Firebase; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; public class RegisterActivity extends AppCompatActivity { private FirebaseAuth mAuth; private FirebaseAuth.AuthStateListener mAuthListener; EditText etEmail; EditText etPassword1; EditText etPassword2; EditText etName; Button bRegister; Spinner sGender; Spinner sRelationship; Spinner sSexuality; private Firebase mRef; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); mAuth = FirebaseAuth.getInstance(); mAuthListener = new FirebaseAuth.AuthStateListener() { @Override public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { FirebaseUser user = firebaseAuth.getCurrentUser(); if (user != null) { // User is signed in Intent intent = new Intent(RegisterActivity.this, MainActivity.class); RegisterActivity.this.startActivity(intent); } } }; } @Override protected void onStart() { super.onStart(); etEmail = (EditText)findViewById(R.id.etEmail); etPassword1 = (EditText)findViewById(R.id.etPassword1); etPassword2 = (EditText)findViewById(R.id.etPassword2); etName = (EditText)findViewById(R.id.etName); bRegister = (Button)findViewById(R.id.bRegister); mAuth.addAuthStateListener(mAuthListener); mRef = new Firebase("https://tutorial2-d6f2e.firebaseio.com/"); sGender = (Spinner)findViewById(R.id.sGender); sRelationship = (Spinner)findViewById(R.id.sRelationship); sSexuality = (Spinner)findViewById(R.id.sSexuality); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.gender_array, android.R.layout.simple_spinner_item); //// Specify the layout to use when the list of choices appears adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); sGender.setAdapter(adapter); adapter = ArrayAdapter.createFromResource(this, R.array.relationship_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); sRelationship.setAdapter(adapter); adapter = ArrayAdapter.createFromResource(this, R.array.sexuality_array, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); sSexuality.setAdapter(adapter); bRegister.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { final String email = etEmail.getText().toString(); final String pass1 = etPassword1.getText().toString(); final String pass2 = etPassword2.getText().toString(); final String name = etName.getText().toString(); if(pass1.equals(pass2)) { mAuth.createUserWithEmailAndPassword(email, pass1) .addOnCompleteListener(RegisterActivity.this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { // If sign in fails, display a message to the user. If sign in succeeds // the auth state listener will be notified and logic to handle the // signed in user can be handled in the listener. if (!task.isSuccessful()) { sendRegistrationError("Registration failed."); } else { FirebaseUser user1 = FirebaseAuth.getInstance().getCurrentUser(); user User = new user(user1.getUid(), email, sRelationship.getSelectedItem().toString(), sGender.getSelectedItem().toString(), sSexuality.getSelectedItem().toString(), name); mRef.child("users").child(user1.getUid()).setValue(User); Intent intent = new Intent(RegisterActivity.this, LoginActivity.class); RegisterActivity.this.startActivity(intent); } } }); } else { sendRegistrationError("Passwords do not match."); } } }); } @Override protected void onStop() { super.onStop(); if (mAuthListener != null) { mAuth.removeAuthStateListener(mAuthListener); } } private void sendRegistrationError(String error) { AlertDialog.Builder builder = new AlertDialog.Builder(RegisterActivity.this); builder.setMessage("Registration Failed: " + error) .setNegativeButton("Retry", null) .create() .show(); } }
[ "ezabr001@ucr.edu" ]
ezabr001@ucr.edu
9690c1462e3113c3aca37abf8ed4307c7127f75a
f4478ed99294ba90986520afae10932bc941d4ad
/src/main/java/com/zh/fizzbuzz/common/enumeration/FizzBuzzStratageEnum.java
039b975493d1b7eb8d8b6906f18d117e528fb22b
[]
no_license
dark12345678/fizzbuzz
d9d7342bb9936051a1a1172a94e4be08c766e456
7cb86248f6ecc7ce5748df2f4193f62d0c8d6081
refs/heads/master
2020-05-15T14:59:09.756730
2019-04-20T03:28:25
2019-04-20T03:28:25
182,354,411
0
0
null
null
null
null
UTF-8
Java
false
false
452
java
package com.zh.fizzbuzz.common.enumeration; public enum FizzBuzzStratageEnum { /** * append all IntegerToStringService transfer result in ASC order */ APPEND_ALL_ASC("APPEND_ALL_ASC"), /** * append all IntegerToStringService transfer result in DESC order */ APPEND_ALL_DESC("APPEND_ALL_DESC"); private String code; private FizzBuzzStratageEnum(String code) { this.code = code; } public String getCode() { return code; } }
[ "zhanghua_here@hotmail.com" ]
zhanghua_here@hotmail.com
c8e005a855f54351a9354497b3b4f57b29aa6187
34b713d69bae7d83bb431b8d9152ae7708109e74
/core/broadleaf-framework/src/main/java/org/broadleafcommerce/core/offer/domain/OfferCodeImpl.java
c904e2d0093c1bdf38072a4a27be330995e9b438
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
sinotopia/BroadleafCommerce
d367a22af589b51cc16e2ad094f98ec612df1577
502ff293d2a8d58ba50a640ed03c2847cb6369f6
refs/heads/BroadleafCommerce-4.0.x
2021-01-23T14:14:45.029362
2019-07-26T14:18:05
2019-07-26T14:18:05
93,246,635
0
0
null
2017-06-03T12:27:13
2017-06-03T12:27:13
null
UTF-8
Java
false
false
11,180
java
/* * #%L * BroadleafCommerce Framework * %% * Copyright (C) 2009 - 2013 Broadleaf Commerce * %% * 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. * #L% */ package org.broadleafcommerce.core.offer.domain; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.broadleafcommerce.common.copy.CreateResponse; import org.broadleafcommerce.common.copy.MultiTenantCopyContext; import org.broadleafcommerce.common.extensibility.jpa.copy.DirectCopyTransform; import org.broadleafcommerce.common.extensibility.jpa.copy.DirectCopyTransformMember; import org.broadleafcommerce.common.extensibility.jpa.copy.DirectCopyTransformTypes; import org.broadleafcommerce.common.persistence.ArchiveStatus; import org.broadleafcommerce.common.persistence.DefaultPostLoaderDao; import org.broadleafcommerce.common.persistence.PostLoaderDao; import org.broadleafcommerce.common.presentation.AdminPresentation; import org.broadleafcommerce.common.presentation.AdminPresentationClass; import org.broadleafcommerce.common.presentation.AdminPresentationToOneLookup; import org.broadleafcommerce.common.presentation.ConfigurationItem; import org.broadleafcommerce.common.presentation.PopulateToOneFieldsEnum; import org.broadleafcommerce.common.presentation.ValidationConfiguration; import org.broadleafcommerce.common.util.DateUtil; import org.broadleafcommerce.common.util.HibernateUtils; import org.broadleafcommerce.core.order.domain.Order; import org.broadleafcommerce.core.order.domain.OrderImpl; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.Index; import org.hibernate.annotations.Parameter; import org.hibernate.annotations.SQLDelete; import org.hibernate.proxy.HibernateProxy; import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Embedded; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.JoinColumn; import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Transient; @Entity @Table(name = "BLC_OFFER_CODE") @Inheritance(strategy=InheritanceType.JOINED) @Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region="blOrderElements") @AdminPresentationClass(populateToOneFields = PopulateToOneFieldsEnum.FALSE, friendlyName = "OfferCodeImpl_baseOfferCode") @SQLDelete(sql="UPDATE BLC_OFFER_CODE SET ARCHIVED = 'Y' WHERE OFFER_CODE_ID = ?") @DirectCopyTransform({ @DirectCopyTransformMember(templateTokens = DirectCopyTransformTypes.SANDBOX, skipOverlaps = true), @DirectCopyTransformMember(templateTokens = DirectCopyTransformTypes.MULTITENANT_CATALOG) }) public class OfferCodeImpl implements OfferCode { public static final long serialVersionUID = 1L; @Id @GeneratedValue(generator= "OfferCodeId") @GenericGenerator( name="OfferCodeId", strategy="org.broadleafcommerce.common.persistence.IdOverrideTableGenerator", parameters = { @Parameter(name="segment_value", value="OfferCodeImpl"), @Parameter(name="entity_name", value="org.broadleafcommerce.core.offer.domain.OfferCodeImpl") } ) @Column(name = "OFFER_CODE_ID") @AdminPresentation(friendlyName = "OfferCodeImpl_Offer_Code_Id") protected Long id; @ManyToOne(targetEntity = OfferImpl.class, optional=false, cascade = CascadeType.REFRESH) @JoinColumn(name = "OFFER_ID") @Index(name="OFFERCODE_OFFER_INDEX", columnNames={"OFFER_ID"}) @AdminPresentation(friendlyName = "OfferCodeImpl_Offer", order=2000, prominent = true, gridOrder = 2000) @AdminPresentationToOneLookup() protected Offer offer; @Column(name = "OFFER_CODE", nullable=false) @Index(name="OFFERCODE_CODE_INDEX", columnNames={"OFFER_CODE"}) @AdminPresentation(friendlyName = "OfferCodeImpl_Offer_Code", order = 1000, prominent = true, gridOrder = 1000) protected String offerCode; @Column(name = "START_DATE") @AdminPresentation(friendlyName = "OfferCodeImpl_Code_Start_Date", order = 3000, defaultValue = "today") protected Date offerCodeStartDate; @Column(name = "END_DATE") @AdminPresentation(friendlyName = "OfferCodeImpl_Code_End_Date", order = 4000, validationConfigurations = { @ValidationConfiguration( validationImplementation = "blAfterStartDateValidator", configurationItems = { @ConfigurationItem(itemName = "otherField", itemValue = "offerCodeStartDate") }) }) protected Date offerCodeEndDate; @Column(name = "MAX_USES") @AdminPresentation(friendlyName = "OfferCodeImpl_Code_Max_Uses", order = 5000) protected Integer maxUses; @Column(name = "USES") @Deprecated protected int uses; @Embedded protected ArchiveStatus archiveStatus = new ArchiveStatus(); @ManyToMany(fetch = FetchType.LAZY, mappedBy="addedOfferCodes", targetEntity = OrderImpl.class) @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region="blOrderElements") protected List<Order> orders = new ArrayList<Order>(); @Transient protected Offer sbClonedOffer; @Transient protected Offer deproxiedOffer; @Override public Long getId() { return id; } @Override public void setId(Long id) { this.id = id; } @Override public Offer getOffer() { if (deproxiedOffer == null) { PostLoaderDao postLoaderDao = DefaultPostLoaderDao.getPostLoaderDao(); if (postLoaderDao != null && offer.getId() != null) { Long id = offer.getId(); deproxiedOffer = postLoaderDao.find(OfferImpl.class, id); } else if (offer instanceof HibernateProxy) { deproxiedOffer = HibernateUtils.deproxy(offer); } else { deproxiedOffer = offer; } } return deproxiedOffer; } @Override public void setOffer(Offer offer) { this.offer = offer; sbClonedOffer = deproxiedOffer = null; } @Override public String getOfferCode() { return offerCode; } @Override public void setOfferCode(String offerCode) { this.offerCode = offerCode; } @Override public int getMaxUses() { return maxUses == null ? 0 : maxUses; } @Override public void setMaxUses(int maxUses) { this.maxUses = maxUses; } @Override public boolean isUnlimitedUse() { return getMaxUses() == 0; } @Override public boolean isLimitedUse() { return getMaxUses() > 0; } @Override @Deprecated public int getUses() { return uses; } @Override @Deprecated public void setUses(int uses) { this.uses = uses; } @Override public Date getStartDate() { return offerCodeStartDate; } @Override public void setStartDate(Date startDate) { this.offerCodeStartDate = startDate; } @Override public Date getEndDate() { return offerCodeEndDate; } @Override public void setEndDate(Date endDate) { this.offerCodeEndDate = endDate; } @Override public List<Order> getOrders() { return orders; } @Override public void setOrders(List<Order> orders) { this.orders = orders; } @Override public Character getArchived() { ArchiveStatus temp; if (archiveStatus == null) { temp = new ArchiveStatus(); } else { temp = archiveStatus; } return temp.getArchived(); } @Override public void setArchived(Character archived) { if (archiveStatus == null) { archiveStatus = new ArchiveStatus(); } archiveStatus.setArchived(archived); } @Override public boolean isActive() { boolean datesActive; // If the start date for this offer code has not been set, just delegate to the offer to determine if the code is // active rather than requiring the user to set offer code dates as well if (offerCodeStartDate == null) { datesActive = DateUtil.isActive(getOffer().getStartDate(), getOffer().getEndDate(), true); } else { datesActive = DateUtil.isActive(offerCodeStartDate, offerCodeEndDate, true); } return datesActive && 'Y' != getArchived(); } @Override public int hashCode() { return new HashCodeBuilder() .append(offer) .append(offerCode) .build(); } @Override public boolean equals(Object o) { if (o != null && getClass().isAssignableFrom(o.getClass())) { OfferCodeImpl that = (OfferCodeImpl) o; return new EqualsBuilder() .append(this.id, that.id) .append(this.offer, that.offer) .append(this.offerCode, that.offerCode) .build(); } return false; } @Override public <G extends OfferCode> CreateResponse<G> createOrRetrieveCopyInstance(MultiTenantCopyContext context) throws CloneNotSupportedException { CreateResponse<G> createResponse = context.createOrRetrieveCopyInstance(this); if (createResponse.isAlreadyPopulated()) { return createResponse; } OfferCode cloned = createResponse.getClone(); cloned.setEndDate(offerCodeEndDate); cloned.setMaxUses(maxUses); if (offer != null) { cloned.setOffer(offer.createOrRetrieveCopyInstance(context).getClone()); } cloned.setStartDate(offerCodeStartDate); cloned.setArchived(getArchived()); cloned.setOfferCode(offerCode); cloned.setUses(uses); return createResponse; } }
[ "sinosie7en@gmail.com" ]
sinosie7en@gmail.com
5b457692a3451e8a6a3a7ccb48d827a7bcb371d4
5cf9749de043e7af019fc246b63977aae89d039f
/Clan/Clan/src/com/youzu/taobao/main/wechatstyle/PlaceholderFragment.java
fd310d6486f1420a8cb19e61245915114602bb3c
[ "Apache-2.0" ]
permissive
raycraft/MyBigApp_Discuz_Android
def12d04bf3318e2a6d711c75a70042f551dcdfc
6f80f5a260f3cfa1694cab0a39f6034dd49ce7f8
refs/heads/master
2021-01-12T04:19:05.602028
2016-12-29T05:34:24
2016-12-29T05:34:24
77,585,600
2
3
null
null
null
null
UTF-8
Java
false
false
11,675
java
package com.youzu.taobao.main.wechatstyle; import android.app.Activity; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.kit.app.core.task.DoSomeThing; import com.kit.bottomtabui.model.TabItem; import com.kit.bottomtabui.view.MainBottomTabLayout; import com.kit.bottomtabui.view.OnTabClickListener; import com.kit.bottomtabui.view.OnTabItemSelectedClickListener; import com.kit.utils.AppUtils; import com.kit.utils.ListUtils; import com.kit.utils.ZogUtils; import com.kit.utils.intentutils.IntentUtils; import com.youzu.taobao.R; import com.youzu.taobao.base.enums.MainActivityStyle; import com.youzu.taobao.base.json.forumnav.NavForum; import com.youzu.taobao.base.util.AppSPUtils; import com.youzu.taobao.base.util.ClanUtils; import com.youzu.taobao.base.util.ToastUtils; import com.youzu.taobao.base.widget.SuperViewPager; import com.youzu.taobao.base.widget.list.PinnedSectionRefreshListView; import com.youzu.taobao.base.widget.list.RefreshListView; import com.youzu.taobao.main.base.IndexPageFragment; import com.youzu.taobao.main.base.PortalPageFragment; import com.youzu.taobao.main.base.forumnav.DBForumNavUtils; import com.youzu.taobao.main.base.forumnav.ForumnavFragment; import com.youzu.taobao.message.pm.MyPMFragment; import com.youzu.taobao.thread.ThreadPublishActivity; import java.util.ArrayList; import java.util.List; /** * A placeholder fragment containing a simple view. */ public class PlaceholderFragment extends Fragment { private WeChatStyleFragmentAdapter mAdapter; private SuperViewPager mPager; private MainBottomTabLayout mTabLayout; private TextView tvDo, tvPreDo; private ArrayList<Fragment> fragments; private List<Integer> positionList = new ArrayList<Integer>(); private int lastPosition; public static PlaceholderFragment placeholderFragment; public PlaceholderFragment() { } public static PlaceholderFragment getInstance(TextView tv0, TextView tv1, ArrayList<Fragment> fragments) { if (placeholderFragment == null) { placeholderFragment = new PlaceholderFragment(); placeholderFragment.tvPreDo = tv0; placeholderFragment.tvDo = tv1; placeholderFragment.fragments = fragments; } return placeholderFragment; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_bottom_tab_ui_main, container, false); setViews(rootView); return rootView; } private void setViews(final View view) { mAdapter = new WeChatStyleFragmentAdapter(getFragmentManager(), fragments); mPager = (SuperViewPager) view.findViewById(com.kit.bottomtabui.R.id.tab_pager); mPager.setScrollable(AppSPUtils.isWechatScroll(getActivity())); mPager.setAdapter(mAdapter); //预加载全部 mPager.setOffscreenPageLimit(placeholderFragment.fragments.size()); mTabLayout = (MainBottomTabLayout) view.findViewById(com.kit.bottomtabui.R.id.main_bottom_tablayout); ArrayList<TabItem> tabItems = new ArrayList<TabItem>(); int textNormalColor = getResources().getColor(R.color.gray); int textSelectedColor = getResources().getColor(R.color.black); TabItem tabItem0 = new TabItem("门户", getResources().getDrawable(R.drawable.ic_tab_home), getResources().getDrawable(R.drawable.ic_tab_home_pressed), textNormalColor, textSelectedColor,false,0); TabItem tabItem1 = new TabItem("论坛", getResources().getDrawable(R.drawable.ic_tab_forum), getResources().getDrawable(R.drawable.ic_tab_forum_pressed), textNormalColor, textSelectedColor,false,0); TabItem tabItem2 = new TabItem("发帖", getResources().getDrawable(R.drawable.trans_144_144), getResources().getDrawable(R.drawable.trans_144_144), textNormalColor, textSelectedColor, true,false,0, new View.OnClickListener() { @Override public void onClick(View v) { if (ClanUtils.isToLogin(getActivity(), null, Activity.RESULT_OK, false)) { return; } List<NavForum> forums = DBForumNavUtils.getAllNavForum(getActivity()); if (ListUtils.isNullOrContainEmpty(forums)) { ToastUtils.mkShortTimeToast(getActivity(), getString(R.string.wait_a_moment)); } else IntentUtils.gotoNextActivity(getActivity(), ThreadPublishActivity.class); } }); TabItem tabItem3 = new TabItem("消息", getResources().getDrawable(R.drawable.ic_tab_message), getResources().getDrawable(R.drawable.ic_tab_message_pressed), textNormalColor, textSelectedColor,false,0); TabItem tabItem4 = new TabItem("我的", getResources().getDrawable(R.drawable.ic_tab_profile), getResources().getDrawable(R.drawable.ic_tab_profile_pressed), textNormalColor, textSelectedColor,false,0); tabItems.add(tabItem0); tabItems.add(tabItem1); tabItems.add(tabItem2); tabItems.add(tabItem3); tabItems.add(tabItem4); ArrayList<Integer> jp = new ArrayList<>(); jp.add(2); mTabLayout.setJustBottonPosition(jp); // mTabLayout.getTabView(2).setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // // } // }); mTabLayout.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { int back = 0; @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(final int position) { setCurr(position); //没有登录,回滚viewpager if ((fragments.get(position) instanceof MyPMFragment) && ClanUtils.isToLogin(getActivity(), null, Activity.RESULT_OK, false)) { if (positionList.size() > 0) { back = positionList.get(positionList.size() - 1); } AppUtils.delay(500, new DoSomeThing() { @Override public void execute(Object... objects) { mPager.setCurrentItem(back); } }); return; } positionList.add(position); int size = placeholderFragment.fragments.size(); if (positionList.size() >= size) positionList = ListUtils.subList(positionList, positionList.size() - size, size); if (fragments.get(position) instanceof MyPMFragment) { getTabLayout().setNotifyText(WeChatStyleMainActivity.MESSAGE_POSITION, ""); } } @Override public void onPageScrollStateChanged(int state) { } }); OnTabItemSelectedClickListener OnTabItemSelectedClickListener = new OnTabItemSelectedClickListener() { @Override public void onItemClick(View v,int position) { int curr = mPager.getCurrentItem(); ZogUtils.printError(PlaceholderFragment.class, "mPager.getCurrentItem():" + curr); switch (curr) { case 0: if (MainActivityStyle.TAB_BOTTOM == AppSPUtils.getConfig(getActivity()).getAppStyle()) { Fragment fragment = fragments.get(curr); if (fragment instanceof PortalPageFragment) { PortalPageFragment f = (PortalPageFragment) fragment; ZogUtils.printError(PlaceholderFragment.class, "PortalPageFragment f:" + f + " f.getListView():" + f.getListView()); f.getListView().setRefreshing(true); if (f.getListView() instanceof PinnedSectionRefreshListView) { ((PinnedSectionRefreshListView) f.getListView()).getRefreshableView().smoothScrollToPosition(0); ((PinnedSectionRefreshListView) f.getListView()).refresh(); } else { ((RefreshListView) f.getListView()).getRefreshableView().smoothScrollToPosition(0); ((RefreshListView) f.getListView()).refresh(); } } else if (fragment instanceof IndexPageFragment) { IndexPageFragment f = (IndexPageFragment) fragment; ZogUtils.printError(PlaceholderFragment.class, "IndexPageFragment f:" + f + " f.getListView():" + f.getListView()); f.getListView().setRefreshing(true); f.getListView().getRefreshableView().smoothScrollToPosition(0); f.getListView().refresh(); } } else { ((IndexPageFragment) fragments.get(curr)).getListView().setRefreshing(true); ((IndexPageFragment) fragments.get(curr)).getListView().getRefreshableView().smoothScrollToPosition(0); ((IndexPageFragment) fragments.get(curr)).getListView().refresh(); } break; case 1: if (fragments.get(curr) instanceof ForumnavFragment) { ((ForumnavFragment) fragments.get(curr)).getListView().setRefreshing(true); ((ForumnavFragment) fragments.get(curr)).getListView().getRefreshableView().smoothScrollToPosition(0); ((ForumnavFragment) fragments.get(curr)).getListView().refresh(); } break; } } }; // mTabLayout.setOnTabSelectedClickListener(onTabSelectedClickListener); // OnTabClick onTabClickListener = new OnTabClick(mTabLayout, mPager, null, OnTabItemSelectedClickListener); OnTabClickListener.OnItemClickListener onItemClickListener = new OnTabClickListener.OnItemClickListener() { @Override public boolean onItemClick(View v, int position) { if (position == 3 && ClanUtils.isToLogin( getActivity(), null, Activity.RESULT_OK, false)) { return false; } if (position ==2 && mTabLayout.getTabItems().get(position).isJustButton()) { mTabLayout.getTabItems().get(position).getJustButtonClickListener().onClick(v); return false; } return true; } }; mTabLayout.bind(tabItems, mPager, onItemClickListener, OnTabItemSelectedClickListener); setCurr(0); } private void setCurr(int position) { final WeChatStyleMainActivity activity = ((WeChatStyleMainActivity) getActivity()); activity.setPosition(position); activity.setTopbar(true, activity, position); } public MainBottomTabLayout getTabLayout() { return mTabLayout; } }
[ "raycraft@qq.com" ]
raycraft@qq.com
77bada2a3692982f78d0384e1e2b5a68a8219123
01134dff36da11c294fbe9a05843136668aeaaed
/src/application/client/ui/admin/adminStatisticsView/AdminStatisticsView.java
94d9553d1bdb9c531b1934cf3307689eeb669513
[]
no_license
Philtoft/motioncbs
9be90de2592756f03539ea6ab905cdfba20cfedc
5086c332ea7161b69cf28d935f24f37941f99e7a
refs/heads/master
2020-05-06T20:27:20.116697
2019-04-19T16:33:12
2019-04-19T16:33:12
180,238,409
1
0
null
null
null
null
UTF-8
Java
false
false
12,020
java
package application.client.ui.admin.adminStatisticsView; // https://www.mkyong.com/java/java-display-double-in-2-decimal-points/ import application.shared.User; import com.google.gwt.core.client.GWT; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.Label; import java.util.ArrayList; public class AdminStatisticsView extends Composite { interface AdminStatisticsViewUiBinder extends UiBinder<HTMLPanel, AdminStatisticsView> { } @UiField HTMLPanel item1_1; @UiField HTMLPanel item1_2; @UiField HTMLPanel item1_3; @UiField HTMLPanel item1_4; @UiField HTMLPanel item1_5; @UiField HTMLPanel item1_6; @UiField HTMLPanel item1_7; @UiField HTMLPanel item2_1; @UiField HTMLPanel item2_2; @UiField HTMLPanel item2_3; @UiField HTMLPanel item2_4; @UiField HTMLPanel item2_5; @UiField HTMLPanel item2_6; @UiField HTMLPanel item2_7; @UiField HTMLPanel item3_1; @UiField HTMLPanel item3_2; @UiField HTMLPanel item3_3; @UiField HTMLPanel item3_4; @UiField HTMLPanel item3_5; @UiField HTMLPanel item3_6; @UiField HTMLPanel item3_7; @UiField HTMLPanel item4_1; @UiField HTMLPanel item4_2; @UiField HTMLPanel item4_3; @UiField HTMLPanel item4_4; @UiField HTMLPanel item4_5; @UiField HTMLPanel item4_6; @UiField HTMLPanel item4_7; @UiField Label totalMembers; @UiField Label averageAge; @UiField Label totalBronzeMembers; @UiField Label averageBronzeAge; @UiField Label totalSiverMembers; @UiField Label averageSilverAge; @UiField Label totalGoldMembers; @UiField Label averageGoldAge; private static AdminStatisticsViewUiBinder ourUiBinder = GWT.create(AdminStatisticsViewUiBinder.class); public AdminStatisticsView() { initWidget(ourUiBinder.createAndBindUi(this)); } public void statistics(ArrayList<User> users){ int i1_1 = 0, i1_2 = 0, i1_3 = 0, i1_4 = 0, i1_5 = 0, i1_6 = 0, i1_7 = 0, i2_1 = 0, i2_2 = 0, i2_3 = 0, i2_4 = 0, i2_5 = 0, i2_6 = 0, i2_7 = 0, i3_1 = 0, i3_2 = 0, i3_3 = 0, i3_4 = 0, i3_5 = 0, i3_6 = 0, i3_7 = 0, i4_1 = 0, i4_2 = 0, i4_3 = 0, i4_4 = 0, i4_5 = 0, i4_6 = 0, i4_7 = 0, // Gets number of total users totalUsers = users.size(), totalBMembers = 0, totalSMembers = 0, totalGMembers = 0; double avgAge = 0, avgBronzeAge = 0, avgSilverAge = 0, avgGoldAge = 0; totalMembers.getElement().setInnerText("Samlet antal medlemmer: " + totalUsers); for (User user : users) { int age = user.getAge(); // Checks if user is not admin if (user.getMembertypeId() != 4) { if (age >= 15 && age < 20) { i1_1+=1; } else if (age >= 20 && age < 30) { i1_2+=1; } else if (age >= 30 && age < 40) { i1_3+=1; } else if (age >= 40 && age < 50) { i1_4+=1; } else if (age >= 50 && age < 60) { i1_5+=1; } else if (age >= 60 && age < 70) { i1_6+=1; } else { i1_7+=1; } avgAge += age; } // Bronze members if (user.getMembertypeId() == 3) { if (age >= 15 && age < 20) { i2_1+=1; } else if (age >= 20 && age < 30) { i2_2+=1; } else if (age >= 30 && age < 40) { i2_3+=1; } else if (age >= 40 && age < 50) { i2_4+=1; } else if (age >= 50 && age < 60) { i2_5+=1; } else if (age >= 60 && age < 70) { i2_6+=1; } else { i2_7+=1; } totalBMembers++; avgBronzeAge+=age; } // Silver members if (user.getMembertypeId() == 2) { if (age >= 15 && age < 20) { i3_1+=1; } else if (age >= 20 && age < 30) { i3_2+=1; } else if (age >= 30 && age < 40) { i3_3+=1; } else if (age >= 40 && age < 50) { i3_4+=1; } else if (age >= 50 && age < 60) { i3_5+=1; } else if (age >= 60 && age < 70) { i3_6+=1; } else { i3_7+=1; } totalSMembers++; avgSilverAge+=age; } // Silver members if (user.getMembertypeId() == 1) { if (age >= 15 && age < 20) { i4_1+=1; } else if (age >= 20 && age < 30) { i4_2+=1; } else if (age >= 30 && age < 40) { i4_3+=1; } else if (age >= 40 && age < 50) { i4_4+=1; } else if (age >= 50 && age < 60) { i4_5+=1; } else if (age >= 60 && age < 70) { i4_6+=1; } else { i4_7+=1; } totalGMembers++; avgGoldAge+=age; } } averageAge.getElement().setInnerText("Den gennemsnitlige alder er: " + Math.round(avgAge / totalUsers)); averageBronzeAge.getElement().setInnerText("Den gennemsnitlige alder er: " + Math.round(avgBronzeAge / totalBMembers)); averageSilverAge.getElement().setInnerText("Den gennemsnitlige alder er: " + Math.round(avgSilverAge / totalSMembers)); averageGoldAge.getElement().setInnerText("Den gennemsnitlige alder er: " + Math.round(avgGoldAge / totalGMembers)); totalBronzeMembers.getElement().setInnerText("Samlet antal bronze medlemmer: " + totalBMembers); totalSiverMembers.getElement().setInnerText("Samlet antal bronze medlemmer: " + totalSMembers); totalGoldMembers.getElement().setInnerText("Samlet antal bronze medlemmer: " + totalGMembers); i1_1 = (i1_1 * 100) / totalUsers; i1_2 = (i1_2 * 100) / totalUsers; i1_3 = (i1_3 * 100) / totalUsers; i1_4 = (i1_4 * 100) / totalUsers; i1_5 = (i1_5 * 100) / totalUsers; i1_6 = (i1_6 * 100) / totalUsers; i1_7 = (i1_7 * 100) / totalUsers; i2_1 = (i2_1 * 100) / totalBMembers; i2_2 = (i2_2 * 100) / totalBMembers; i2_3 = (i2_3 * 100) / totalBMembers; i2_4 = (i2_4 * 100) / totalBMembers; i2_5 = (i2_5 * 100) / totalBMembers; i2_6 = (i2_6 * 100) / totalBMembers; i2_7 = (i2_7 * 100) / totalBMembers; i3_1 = (i3_1 * 100) / totalSMembers; i3_2 = (i3_2 * 100) / totalSMembers; i3_3 = (i3_3 * 100) / totalSMembers; i3_4 = (i3_4 * 100) / totalSMembers; i3_5 = (i3_5 * 100) / totalSMembers; i3_6 = (i3_6 * 100) / totalSMembers; i3_7 = (i3_7 * 100) / totalSMembers; i4_1 = (i4_1 * 100) / totalGMembers; i4_2 = (i4_2 * 100) / totalGMembers; i4_3 = (i4_3 * 100) / totalGMembers; i4_4 = (i4_4 * 100) / totalGMembers; i4_5 = (i4_5 * 100) / totalGMembers; i4_6 = (i4_6 * 100) / totalGMembers; i4_7 = (i4_7 * 100) / totalGMembers; item1_1.getElement().setAttribute("style", "width:" + (i1_1 * 2) + "%"); item1_1.getElement().setInnerText(i1_1 + "%"); item1_2.getElement().setAttribute("style", "width:" + (i1_2 * 2) + "%"); item1_2.getElement().setInnerText(i1_2 + "%"); item1_3.getElement().setAttribute("style", "width:" + (i1_3 * 2) + "%"); item1_3.getElement().setInnerText(i1_3 + "%"); item1_4.getElement().setAttribute("style", "width:" + (i1_4 * 2) + "%"); item1_4.getElement().setInnerText(i1_4 + "%"); item1_5.getElement().setAttribute("style", "width:" + (i1_5 * 2) + "%"); item1_5.getElement().setInnerText(i1_5 + "%"); item1_6.getElement().setAttribute("style", "width:" + (i1_6 * 2) + "%"); item1_6.getElement().setInnerText(i1_6 + "%"); item1_7.getElement().setAttribute("style", "width:" + (i1_7 * 2) + "%"); item1_7.getElement().setInnerText(i1_7 + "%"); item2_1.getElement().setAttribute("style", "width:" + (i2_1 * 2) + "%"); item2_1.getElement().setInnerText(i2_1 + "%"); item2_2.getElement().setAttribute("style", "width:" + (i2_2 * 2) + "%"); item2_2.getElement().setInnerText(i2_2 + "%"); item2_3.getElement().setAttribute("style", "width:" + (i2_3 * 2) + "%"); item2_3.getElement().setInnerText(i2_3 + "%"); item2_4.getElement().setAttribute("style", "width:" + (i2_4 * 2) + "%"); item2_4.getElement().setInnerText(i2_4 + "%"); item2_5.getElement().setAttribute("style", "width:" + (i2_5 * 2) + "%"); item2_5.getElement().setInnerText(i2_5 + "%"); item2_6.getElement().setAttribute("style", "width:" + (i2_6 * 2) + "%"); item2_6.getElement().setInnerText(i2_6 + "%"); item2_7.getElement().setAttribute("style", "width:" + (i2_7 * 2) + "%"); item2_7.getElement().setInnerText(i2_7 + "%"); item3_1.getElement().setAttribute("style", "width:" + (i3_1 * 2) + "%"); item3_1.getElement().setInnerText(i3_1 + "%"); item3_2.getElement().setAttribute("style", "width:" + (i3_2 * 2) + "%"); item3_2.getElement().setInnerText(i3_2 + "%"); item3_3.getElement().setAttribute("style", "width:" + (i3_3 * 2) + "%"); item3_3.getElement().setInnerText(i3_3 + "%"); item3_4.getElement().setAttribute("style", "width:" + (i3_4 * 2) + "%"); item3_4.getElement().setInnerText(i3_4 + "%"); item3_5.getElement().setAttribute("style", "width:" + (i3_5 * 2) + "%"); item3_5.getElement().setInnerText(i3_5 + "%"); item3_6.getElement().setAttribute("style", "width:" + (i3_6 * 2) + "%"); item3_6.getElement().setInnerText(i3_6 + "%"); item3_7.getElement().setAttribute("style", "width:" + (i3_7 * 2) + "%"); item3_7.getElement().setInnerText(i3_7 + "%"); item4_1.getElement().setAttribute("style", "width:" + (i4_1 * 2) + "%"); item4_1.getElement().setInnerText(i4_1 + "%"); item4_2.getElement().setAttribute("style", "width:" + (i4_2 * 2) + "%"); item4_2.getElement().setInnerText(i4_2 + "%"); item4_3.getElement().setAttribute("style", "width:" + (i4_3 * 2) + "%"); item4_3.getElement().setInnerText(i4_3 + "%"); item4_4.getElement().setAttribute("style", "width:" + (i4_4 * 2) + "%"); item4_4.getElement().setInnerText(i4_4 + "%"); item4_5.getElement().setAttribute("style", "width:" + (i4_5 * 2) + "%"); item4_5.getElement().setInnerText(i4_5 + "%"); item4_6.getElement().setAttribute("style", "width:" + (i4_6 * 2) + "%"); item4_6.getElement().setInnerText(i4_6 + "%"); item4_7.getElement().setAttribute("style", "width:" + (i4_7 * 2) + "%"); item4_7.getElement().setInnerText(i4_7 + "%"); } }
[ "philip@severincreatives.dk" ]
philip@severincreatives.dk
35dc4d03f71b24ef60df27e2bb1705e1f440a47e
3dedaf43ac93fec631ab835a908d6c3963be0f17
/app/src/main/java/com/gasmpgmanager/Gas.java
c1be1ee00483cdfa0669c908abe7ab758e6ee8c9
[]
no_license
kendallmangrum/Gas-MPG-Manager-App
82199aff6783f2e02511e8975d32ef456bd5a4ca
432a6260031333a31049a8a191a54339623cf6a5
refs/heads/main
2023-08-15T22:16:42.795541
2021-10-18T18:44:47
2021-10-18T18:44:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,496
java
package com.gasmpgmanager; import androidx.annotation.NonNull; import androidx.room.Entity; import androidx.room.PrimaryKey; @Entity(tableName = "gasHistory") public class Gas { @PrimaryKey (autoGenerate = true) @NonNull private int id; private String StationName; private String date; private String pricePerGallon; private String totalPrice; private String totalGallons; private String mpg; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getStationName() { return StationName; } public void setStationName(String stationName) { StationName = stationName; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getPricePerGallon() { return pricePerGallon; } public void setPricePerGallon(String pricePerGallon) { this.pricePerGallon = pricePerGallon; } public String getTotalPrice() { return totalPrice; } public void setTotalPrice(String totalPrice) { this.totalPrice = totalPrice; } public String getTotalGallons() { return totalGallons; } public void setTotalGallons(String totalGallons) { this.totalGallons = totalGallons; } public String getMpg() { return mpg; } public void setMpg(String mpg) { this.mpg = mpg; } }
[ "klmangrum17@gmail.com" ]
klmangrum17@gmail.com
611cf415292e0c9a4c6528baae8c0e2498740a94
eb5d6c3b89dcc0de89f736b34fe52a10ef2898c9
/src/main/java/com/example/cardbordcollector/model/Card.java
913ec88a55655ebc21bb500d4356b37e31a3ce10
[]
no_license
Omen4/CardboardCollector_Spring
d05ffa48c8ad74b0103f659a18dd135e55c9ad6c
2d0663cbed3430d8167f80aa3493aa4cf2bbf54e
refs/heads/main
2023-06-12T18:17:22.907042
2021-07-11T22:58:49
2021-07-11T22:58:49
376,811,055
0
0
null
null
null
null
UTF-8
Java
false
false
2,563
java
package com.example.cardbordcollector.model; import lombok.Data; import lombok.Getter; import lombok.Setter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.lang.Nullable; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.client.RestTemplate; import org.springframework.web.reactive.function.client.WebClient; import javax.persistence.*; import java.util.ArrayList; import java.util.List; @Entity @EntityListeners(AuditingEntityListener.class) @Table(name="YGOCARDS") @Getter @Setter public class Card { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="cardid") private int id; @Column(name="ygoid") private int ygoid; @Column(name="cardname") private String name; @Column(name="cardtype") private String type; @Lob @Column(name="carddesc", length=512) private String desc; @Nullable @Column(name="cardatk") private Integer atk; @Nullable @Column(name="carddef") private Integer def; @Nullable @Column(name="cardlevel") private Integer level; @Column(name="cardrace") private String race; @Nullable @Column(name="cardattribute") private String attribute; //toUpperCase @Nullable @Column(name="cardarchetype") private String archetype; @Nullable @Column(name="cardscale") private Integer scale; @Nullable @Column(name="cardlinkval") private Integer linkval; @Nullable @Column(name="cardlinkmarkers") private String linkmarkers; @OneToMany @JoinTable( name = "ygocards_ygosets", joinColumns = @JoinColumn(name = "cardid", referencedColumnName = "cardid"), inverseJoinColumns = @JoinColumn(name = "setid", referencedColumnName = "setid")) private List<YgoSet> listCardSets; @Column(name="setname") private String set_name; @Column(name="setcode") private String set_code; @Column(name="setrarity") private String set_rarity; @Nullable @Column(name="setprice") private Float set_price; @Column(name="imageurl") private String image_url; @Nullable @Column(name="tcgdate") private String tcg_date; @Nullable @Column(name="ocgdate") private String ocg_date; }
[ "florian.grosdidier@gmail.com" ]
florian.grosdidier@gmail.com
4ed66e473e2499a7b39223f7feb246533bfcb987
10d560ecbbbe88b855786e7907b640bd2543fed6
/POSANDROID/app/src/main/java/com/pos/marlton/posandroid/MainActivity.java
096cc46dfd764c490840d6be4b7bc877011bf2cb
[]
no_license
Therabyteme/JUEGAMASPEGAMAS
bb4dc1da31e93e37efc6542fac01295d53f55063
bdc788a2e1316f6eb71eff2a58ff1e77982e519a
refs/heads/master
2021-01-20T05:13:15.680254
2017-08-28T17:21:47
2017-08-28T17:21:47
101,420,556
0
0
null
null
null
null
UTF-8
Java
false
false
3,832
java
package com.pos.marlton.posandroid; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.text.Spannable; import android.text.SpannableString; import android.text.style.RelativeSizeSpan; import android.view.View; import android.support.design.widget.NavigationView; 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.webkit.WebView; import android.widget.Button; public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); 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.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); WebView web = (WebView) findViewById(R.id.online); web.loadUrl("http://dev.2x2clienttracker.droisys.info/Tickets/Login.html#!/"); for(int i = 0; i < navigationView.getMenu().size(); i++) { MenuItem item = navigationView.getMenu().getItem(i); SpannableString spanString = new SpannableString(navigationView.getMenu().getItem(i).getTitle().toString()); int end = spanString.length(); spanString.setSpan(new RelativeSizeSpan(1.5f), 0, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); item.setTitle(spanString); } } public void Lanzar(){ Intent i = getPackageManager().getLaunchIntentForPackage("com.utelecard.utd_mobile"); startActivity(i); } @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.utd) { Lanzar(); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } }
[ "brandonthera@gmail.com" ]
brandonthera@gmail.com
72ff1e845ebb705c57770205c3e7987d67cfd928
27daee2af9ae631248bc8330ca145fee3a631358
/netty-client/src/main/java/com/vteba/protostuff/OfflineReconnectHandler.java
655484a1335e8713d4f2c9384e138402a30fba18
[]
no_license
skmbw/netty-client
98b95c4dce0a1c19b57218fc6963fb4a00f4b2bf
46626b86eae5e66e231e6ad0c42d85d4955f7571
refs/heads/master
2016-09-05T08:56:54.582986
2014-11-21T06:01:10
2014-11-21T06:01:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,500
java
package com.vteba.protostuff; import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import javax.inject.Inject; import javax.inject.Named; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.vteba.netty.handler.HeartBeatHandler; import com.vteba.utils.json.Node; /** * 掉线重连处理器 * @author yinlei * @since 2014-6-22 */ @Named @Sharable// 语义性检查,不保证线程安全。要自己确认该handler是无状态的,可以共享的,无线程并发问题 public class OfflineReconnectHandler extends ChannelInboundHandlerAdapter { private static final Logger LOGGER = LoggerFactory.getLogger(OfflineReconnectHandler.class); private ScheduledExecutorService scheduler; private volatile AtomicBoolean started = new AtomicBoolean(false);// 是否启动定时,假如有多个连接断掉了,可能会开启多个 @Inject private Client client; @Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { if (!client.isConnected() && !started.getAndSet(true)) { if (LOGGER.isInfoEnabled()) { LOGGER.info("Client连接Server掉线,进行重连。"); } getScheduler().scheduleAtFixedRate(new Runnable() { @Override public void run() { client.start(true); } }, 1, 5, TimeUnit.SECONDS); } } @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { started.set(false);// 断线重连成功,设置为不再重连 Node node = new Node(); node.setName(HeartBeatHandler.PING); ctx.write(node);// 发送ping消息给Server ctx.fireChannelActive();// 向下传递事件 } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { client.setConnected(false); LOGGER.error("发生异常信息,", cause.getMessage()); ctx.close();// 发生异常,关闭链接 } public ScheduledExecutorService getScheduler() { if (scheduler == null) { scheduler = Executors.newScheduledThreadPool(1); } return scheduler; } public void shutdown() { if (scheduler != null) { scheduler.shutdown(); scheduler = null; } } }
[ "tongku2008@126.com" ]
tongku2008@126.com
43b6ccabbd1a48df27ca219efb1d69fd76c9889d
d204e765d5c5b0f75bcb91b3c5a5aefeb203d186
/java_oop_advanced/src/enumeration_and_annotation_ex/j_inferno_infiniti2/repositories/Repository.java
7412304b120b9c4cd052e2c9d8e470e5d9a0c92d
[]
no_license
cvet-yordanova/Java-OOP-Advanced
d4201e8877a715c31ade5b5c9804d9831ac7b30e
57a6a5a5c437041560cf85211b83e90dc3371390
refs/heads/master
2021-09-03T06:13:12.601060
2018-01-06T07:54:30
2018-01-06T07:54:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
133
java
package enumeration_and_annotation_ex.j_inferno_infiniti2.repositories; public interface Repository<T> { void add(T element); }
[ "cvet_yordanova@abv.bg" ]
cvet_yordanova@abv.bg
5f9964278b6356a87b11895122491007d2fa776e
fb1e7ce6f0f63860b499b16fedc39c71195a2d78
/osprey-common/src/main/java/com/kaiqi/osprey/common/mybatis/sharding/service/AbstractEditService.java
42d00609b80dd1523d77787265c15f8c26c1f59d
[]
no_license
Baiyadia/osprey
8e1437ffbc69fa6fb7e033e6d8af02be3d1f999e
cecd46d98a5506bebe85f22afa8de2fd54671acd
refs/heads/master
2022-12-24T12:08:45.431259
2022-02-21T06:10:43
2022-02-21T06:10:43
179,511,365
3
0
null
2022-12-10T05:39:05
2019-04-04T14:13:36
Java
UTF-8
Java
false
false
1,058
java
package com.kaiqi.osprey.common.mybatis.sharding.service; import com.kaiqi.osprey.common.mybatis.sharding.ShardTable; import com.kaiqi.osprey.common.mybatis.sharding.data.UpdateRepository; import org.springframework.beans.factory.annotation.Autowired; import java.util.List; /** * @param <Dao> * @param <Po> * @param <Example> * @author wangs * @date 2017/12/09 */ public abstract class AbstractEditService<Dao extends UpdateRepository<Po, Example>, Po, Example> implements EditService<Po, Example> { @Autowired protected Dao dao; @Override public int editById(final Po record, final ShardTable shardTable) { return this.dao.updateById(record, shardTable); } @Override public int editByExample(final Po record, final Example example, final ShardTable shardTable) { return this.dao.updateByExample(record, example, shardTable); } @Override public int batchEdit(final List<Po> records, final ShardTable shardTable) { return this.dao.batchUpdate(records, shardTable); } }
[ "wangshuai@zhuanzhuan.com" ]
wangshuai@zhuanzhuan.com
7e9ba34d16685ac428bca16724eec5a20d7bbd1f
4743420493efb0b7de8bf179a0c85299ef38721c
/src/Employee.java
0074fde73e4ae7754351f74259c62a8fad353e24
[]
no_license
kxz5047/SimUniversity
654417bd9f3fcb83f39d6b1c23d1ef115320b54d
7520e86a83187a367940f87abcd32315ca9cc6f0
refs/heads/master
2021-05-15T04:01:25.693919
2017-10-07T01:11:27
2017-10-07T01:11:27
106,062,571
0
0
null
null
null
null
UTF-8
Java
false
false
886
java
public class Employee extends Person { //Employee's office number String officeNumber; //Employee's office phone number String officePhoneNumber; //Employee's date of employment String dateOfEmployment; //Returns the employee's office number String getOfficeNumber() { return officeNumber; } //Sets the employee's office number void setOfficeNumber(String offNumber) { officeNumber = offNumber; } //Returns the employee's office phone number String getOfficePhoneNumber() { return officePhoneNumber; } //Sets the employee's office phone number void setOfficePhoneNumber(String phNum) { officePhoneNumber = phNum; } //Returns the employee's date of employment String getDateOfEmployment() { return dateOfEmployment; } //Sets the employee's date of employment void setDateOfEmployment(String doe) { dateOfEmployment = doe; } }
[ "kxz5047@psu.edu" ]
kxz5047@psu.edu
633fa65916a5b7cc59616a5296806aea97093cd7
b881607eb72dcd5cd6ed2b941589abffb1176690
/WEB-INF/classes/mms/mongo/beans/User.java
3eeaf96e6859c176db157fbc2136c02cc1d89c0c
[]
no_license
ernitishkumar/mmsnewmango
7cb2108bdc059a4375308d9e7927504a4211ea3c
bdf55fd46f2aca71f9b4541b8495218b60cdf851
refs/heads/master
2021-01-10T12:38:56.393700
2016-01-07T09:51:54
2016-01-07T09:51:54
49,129,793
0
0
null
null
null
null
UTF-8
Java
false
false
926
java
package mms.mongo.beans; public class User { private String id; private String username; private String password; private String name; public User(String id, String username, String password, String name) { this.id = id; this.username = username; this.password = password; this.name = name; } public User(String username, String password, String name) { this.username = username; this.password = password; this.name = name; } public User() { } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "erkumarnitish@gmail.com" ]
erkumarnitish@gmail.com
d7440a34d9f03f42ea26001625f9bf9db341859e
6bae747714b48da24b1e51ba957aa345c0f3ed71
/BookManageSystem/src/servlets/CheckUserServlet.java
47481008f5295244f14cd9d88661aaca6469c343
[]
no_license
lljj-ai/BookManageSystem
7b610a7370cf8f789e2b07dfde37d05c7caa4b1b
db24d8a1ff9ad735be0fac9880c06874663e609d
refs/heads/master
2022-12-16T08:51:15.395276
2020-08-21T02:22:34
2020-08-21T02:22:34
289,156,105
0
0
null
null
null
null
UTF-8
Java
false
false
2,446
java
package servlets; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javaBean.ManagerDao; import javaBean.UserDao; /** * Servlet implementation class CheckUserManager */ @WebServlet("/docheck") public class CheckUserServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public CheckUserServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); String idf = request.getParameter("userid"); int id=Integer.parseInt(idf); String password=request.getParameter("password"); String select=request.getParameter("select"); System.out.println(select); if("user".equals(select)) {//用户登录 UserDao userdao=new UserDao(); boolean isSuccess=userdao.loginUser(id, password); if(isSuccess) { RequestDispatcher view=request.getRequestDispatcher("useroperate.jsp"); view.forward(request, response); }else { RequestDispatcher view=request.getRequestDispatcher("errorpage.jsp"); view.forward(request, response); } }else if("manager".equals(select)) {//管理员登录 ManagerDao managerdao=new ManagerDao(); boolean isSuccess=managerdao.loginManager(id, password); if(isSuccess) { RequestDispatcher view=request.getRequestDispatcher("manageroperate.jsp"); view.forward(request, response); }else { RequestDispatcher view=request.getRequestDispatcher("errorpage.jsp"); view.forward(request, response); } } } }
[ "noreply@github.com" ]
lljj-ai.noreply@github.com
b32c11499aaad6f0c00a1dd3538624e8d743f85a
1db87be135769059210415365648b64a654b13fc
/spring_learn/src/main/java/com/chain/mvcframework/annotation/CHService.java
dd7a180799940985c2745cba1dadea05c2b35f75
[]
no_license
ChenChain/Toys
ac3753bfbc8d011db0d943e13a00c2849bd51df9
4266d651c1b1b00b5a41c33234075120f3534fa2
refs/heads/master
2022-09-09T12:30:07.438339
2020-08-16T10:52:28
2020-08-16T10:52:28
241,329,729
0
0
null
2022-09-01T23:27:08
2020-02-18T10:11:04
Java
UTF-8
Java
false
false
264
java
package com.chain.mvcframework.annotation; import java.lang.annotation.*; /** * @author chenqian091 * @date 2020-08-16 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface CHService { String value() default ""; }
[ "chenqian091@ke.com" ]
chenqian091@ke.com
51633292485599ffb3ea9b174ae7124bccf73a0f
6140f3f0ff9c53b85a8454436f401234389e8018
/2.18-FinalExam/src/BestCowLine.java
8cfa8ba93ff485d6bbdb3dc8090fcb12593304a3
[]
no_license
sarahlc888/USACO-2018-Season
04aadc2269b3eb3e9e8a588b722ef992ec810d6b
23b6b3c60b023d99d10ac1c7b93a592557c86f7d
refs/heads/master
2021-06-30T04:10:14.728915
2019-03-13T01:58:12
2019-03-13T01:58:12
136,196,626
4
0
null
null
null
null
UTF-8
Java
false
false
2,006
java
import java.io.*; import java.util.*; public class BestCowLine { public static void main(String args[]) throws IOException { // INPUT BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); // num cows String[] cows = new String[N+1]; cows[0] = ""; for (int i = 1; i <= N; i++) { cows[i] = br.readLine().trim(); } // DP[i][j] = optimal new string possible using 0...i and j...N-1 String[][] DP = new String[N+2][N+2]; DP[0][N+1] = ""; // basecase, redundant String best = "a"; // will always come after for (int i = 0; i <= N+1; i++) { for (int j = N+1; j >= i; j--) { if (i == 0 && j == N+1) continue; // basecase if (i == N+1 && j == N+1) continue; // redundant if (i == 0 && j == 0) continue; // redundant // //System.out.println("i: " + i + " j: " + j); if (i-1 >= 0 && j+1 <= N+1) { // left and right // //System.out.println(" h1"); DP[i][j] = minString(DP[i-1][j]+cows[i], DP[i][j+1] + cows[j]).trim(); } else if (i-1 >= 0) { // left // //System.out.println(" h2"); DP[i][j] = DP[i-1][j]+cows[i].trim(); } else { // right // //System.out.println(" h3"); DP[i][j] = DP[i][j+1] + cows[j].trim(); } // //System.out.println(" " + DP[i][j]); if (j == i+1) { if (DP[i][j] != "" && DP[i][j].length() == N) { best = minString(best, DP[i][j]).trim(); } } } } //System.out.println("end1"); //System.out.println(best.length()); //System.out.println(best.charAt(1)); int ind1 = 0; int ind2 = 80; boolean looped = false; while (ind2 <= best.length()) { looped = true; //System.out.println("loooooppppp"); System.out.println(best.substring(ind1, ind2)); ind1 += 80; ind2 += 80; } System.out.println(best.substring(ind1)); //System.out.println(best); } public static String minString(String a, String b) { if (a.compareTo(b) < 0) return a; else return b; } }
[ "sarahlc888@gmail.com" ]
sarahlc888@gmail.com
6eac6c49298b168ab7f70b3f3dd75b92f107847c
fde4ac0d5c651c030efebcbbe9c375ada8e655a2
/TestRecipe.java
24cf51a7c3316c948501e761fcf72f7e855a2b60
[]
no_license
WarrenMfg/recipe-builder
fc20939373c215d79b364ea4b8679cbce16a817d
003aa8a87ea69e2ba7b0c45436b4feec9aaa6ee0
refs/heads/main
2023-01-21T20:15:59.048120
2020-11-14T19:12:18
2020-11-14T19:12:18
312,884,689
0
0
null
null
null
null
UTF-8
Java
false
false
1,166
java
/** * TestRecipe class */ public class TestRecipe { // Point-of-entry to build Recipe class public static void main(String[] args) { // build basic recipe for rice Recipe rice = new Recipe.RecipeBuilder("Rice").addIngredient("Rice", "1 cup") .addIngredient("Water", "2 cups").addIngredient("Salt", "1 pinch").build(); System.out.println(""); // invoke recipe methods after ingredient is built rice.getRecipe(); rice.getIngredients(); rice.getQuantities(); // print new line System.out.println(""); // build recipe for oatmeal, but use update and delete functionality Recipe oatmeal = new Recipe.RecipeBuilder("Porridge").addIngredient("Oatmeal", "1/2 cup") .addIngredient("Water", "1/4 cup").deleteIngredient("Water") .addIngredient("Milk", "1/4 cup").updateTitle("Oatmeal") .addIngredient("Brown Sugar", "1 tablespoon").updateQuantity("Brown Sugar", "1 teaspoon") .build(); // invoke recipe methods after ingredient is built oatmeal.getRecipe(); oatmeal.getIngredients(); oatmeal.getQuantities(); // print new line System.out.println(""); } }
[ "warrenmfg@icloud.com" ]
warrenmfg@icloud.com
7e90b9037b97e07f99621c1ecd69254da3e7e634
74b47b895b2f739612371f871c7f940502e7165b
/aws-java-sdk-forecast/src/main/java/com/amazonaws/services/forecast/model/transform/DeleteExplainabilityRequestProtocolMarshaller.java
f093e35e9be5449acde84040d801e0eb6f4da3c3
[ "Apache-2.0" ]
permissive
baganda07/aws-sdk-java
fe1958ed679cd95b4c48f971393bf03eb5512799
f19bdb30177106b5d6394223a40a382b87adf742
refs/heads/master
2022-11-09T21:55:43.857201
2022-10-24T21:08:19
2022-10-24T21:08:19
221,028,223
0
0
Apache-2.0
2019-11-11T16:57:12
2019-11-11T16:57:11
null
UTF-8
Java
false
false
2,767
java
/* * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.forecast.model.transform; import javax.annotation.Generated; import com.amazonaws.SdkClientException; import com.amazonaws.Request; import com.amazonaws.http.HttpMethodName; import com.amazonaws.services.forecast.model.*; import com.amazonaws.transform.Marshaller; import com.amazonaws.protocol.*; import com.amazonaws.protocol.Protocol; import com.amazonaws.annotation.SdkInternalApi; /** * DeleteExplainabilityRequest Marshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") @SdkInternalApi public class DeleteExplainabilityRequestProtocolMarshaller implements Marshaller<Request<DeleteExplainabilityRequest>, DeleteExplainabilityRequest> { private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.AWS_JSON).requestUri("/") .httpMethodName(HttpMethodName.POST).hasExplicitPayloadMember(false).hasPayloadMembers(true) .operationIdentifier("AmazonForecast.DeleteExplainability").serviceName("AmazonForecast").build(); private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory; public DeleteExplainabilityRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) { this.protocolFactory = protocolFactory; } public Request<DeleteExplainabilityRequest> marshall(DeleteExplainabilityRequest deleteExplainabilityRequest) { if (deleteExplainabilityRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { final ProtocolRequestMarshaller<DeleteExplainabilityRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(SDK_OPERATION_BINDING, deleteExplainabilityRequest); protocolMarshaller.startMarshalling(); DeleteExplainabilityRequestMarshaller.getInstance().marshall(deleteExplainabilityRequest, protocolMarshaller); return protocolMarshaller.finishMarshalling(); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
[ "" ]
68349e36dd177fa0382d6fb15ba4415e74b42c7f
931c531723135e4b7c155c69ece86e3eb768815a
/spring-boot-04-web-restfulcrud/src/main/java/com/atguigu/springboot/service/FileUploadService.java
e9e2e7120d3b80b426d6cdbf6b3c6ae0c025a8b1
[]
no_license
YellowGreen1/springBoot
a01fdb31e344a9717547059a7d9c41fdf98d46e7
4978d49f8f15d76d82ec7cb332799661c0d37601
refs/heads/main
2023-07-14T06:36:51.121318
2021-08-24T13:11:35
2021-08-24T13:11:35
399,474,680
0
0
null
null
null
null
UTF-8
Java
false
false
308
java
package com.atguigu.springboot.service; import org.springframework.web.multipart.MultipartFile; import com.atguigu.springboot.PackParam; import com.atguigu.springboot.Result.AjaxList; public interface FileUploadService { AjaxList<String> handlerUpload(MultipartFile zipFile,PackParam packParam); }
[ "17621592689@163.com" ]
17621592689@163.com
70702635a0e6e631e79e6aaf2d92ffc7f0fea1ef
780a603de26551edb818b613ff4a263eb4633850
/src/main/java/com/example/demo/cache/ICacheManager.java
4ac069dda4d9864a6e0bb0cb644e8288c551fb4f
[]
no_license
stwen/stwen-springboot-demo
4d642bbc1891ff31ddb55adbedfa325a3c9a8bd7
077266021c27623b41bc387e1f3874f29e567366
refs/heads/master
2023-02-17T23:57:43.586630
2021-01-15T02:42:29
2021-01-15T02:42:29
283,638,070
0
0
null
null
null
null
UTF-8
Java
false
false
1,384
java
package com.example.demo.cache; import java.util.Map; import java.util.Set; /** * @description: 缓存操作接口 * @author: xianhao_gan * @date: 2020/09/02 **/ public interface ICacheManager { /** * 存入缓存 * * @param key * @param cache */ void putCache(String key, EntityCache cache); /** * 存入缓存,设置过期时间 * * @param key * @param datas * @param timeOut */ void putCache(String key, Object datas, long timeOut); /** * 获取对应缓存 * * @param key * @return */ EntityCache getCacheByKey(String key); /** * 获取对应缓存 * * @param key * @return */ Object getCacheDataByKey(String key); /** * 获取所有缓存 * * @return */ Map<String, EntityCache> getCacheAll(); /** * 判断是否在缓存中 * * @param key * @return */ boolean isContains(String key); /** * 清除所有缓存 */ void clearAll(); /** * 清除对应缓存 * * @param key */ void clearByKey(String key); /** * 缓存是否超时失效 * * @param key * @return */ boolean isTimeOut(String key); /** * 获取所有key * * @return */ Set<String> getAllKeys(); }
[ "xianhao_gan@qq.com" ]
xianhao_gan@qq.com
92eb617fcac99bb27ab3f250198d47636975cb06
9a9139a788219378cbc6735ca5caf29c97bec74f
/src/main/java/com/joaodcpjunior/workshopmongo/controllers/UserController.java
802d2999e41c67291cf321ee87979882b2337190
[]
no_license
joaodcpjunior/workshop_spring_mongodb
7ac7dafba10e986d53b061ed3390cc8e986eed1a
d8de8ccb47243fe58c0ad649ab9c40d2475ab264
refs/heads/main
2023-07-17T23:55:05.664688
2021-08-15T17:42:11
2021-08-15T17:42:11
392,861,481
0
0
null
null
null
null
UTF-8
Java
false
false
2,769
java
package com.joaodcpjunior.workshopmongo.controllers; import java.net.URI; import java.util.List; import java.util.stream.Collectors; import com.joaodcpjunior.workshopmongo.dtos.UserDto; import com.joaodcpjunior.workshopmongo.entities.Post; import com.joaodcpjunior.workshopmongo.entities.User; import com.joaodcpjunior.workshopmongo.services.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; @RestController @RequestMapping(value = "/api/v1/users") public class UserController { @Autowired private UserService service; @GetMapping public ResponseEntity<List<UserDto>> findAll(){ List<User> list = service.findAll(); List<UserDto> listDto = list.stream().map(x -> new UserDto(x)).collect(Collectors.toList()); return ResponseEntity.ok().body(listDto); } @GetMapping(value = "/{id}") public ResponseEntity<UserDto> findById(@PathVariable String id) { User obj = service.findById(id); return ResponseEntity.ok().body(new UserDto(obj)); } @PostMapping public ResponseEntity<Void> insert(@RequestBody UserDto objDto) { User obj = service.fromDto(objDto); service.insert(obj); URI uri = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}").buildAndExpand(obj.getId()).toUri();//passando a localização do novo recurso criado pelo cabeçalho da resposta, boa prática return ResponseEntity.created(uri).build(); } @DeleteMapping(value = "/{id}") public ResponseEntity<Void> delete(@PathVariable String id) { service.delete(id); return ResponseEntity.noContent().build(); } @PutMapping(value = "/{id}") public ResponseEntity<Void> update(@RequestBody UserDto objDto, @PathVariable String id) { User obj = service.fromDto(objDto); obj.setId(id); service.update(obj); return ResponseEntity.noContent().build(); } @GetMapping(value = "/{id}/posts") public ResponseEntity<List<Post>> findPosts(@PathVariable String id) { User obj = service.findById(id); return ResponseEntity.ok().body(obj.getPosts()); } }
[ "joaodcpjunior@gmail.com" ]
joaodcpjunior@gmail.com
d502f17c9fc1b738a8b22b33d87dbd5a09593d4e
b82c78e4ff1bdffe82f1dbe5299f633c48a0804d
/src/kpi/skarlet/cad/poliz/performer/Performer.java
917d502d498dc2db6f1b9f5ca2b959bbcf72d279
[]
no_license
SkarletKill/Translator
2993cf2d495f343414bab689c882ffe12ab7acb3
01ce935304bcbb685d7dfd835186c40453ed7df5
refs/heads/master
2020-05-01T11:22:35.606408
2019-06-18T17:48:02
2019-06-18T17:48:02
154,184,559
0
0
null
null
null
null
UTF-8
Java
false
false
14,872
java
package kpi.skarlet.cad.poliz.performer; import kpi.skarlet.cad.controller.Controller; import kpi.skarlet.cad.lexer.VariableType; import kpi.skarlet.cad.lexer.constants.CharacterConstants; import kpi.skarlet.cad.lexer.constants.InitKeywords; import kpi.skarlet.cad.lexer.constants.TerminalSymbols; import kpi.skarlet.cad.lexer.lexemes.Lexeme; import kpi.skarlet.cad.poliz.CodeParser; import kpi.skarlet.cad.poliz.constants.PolizConstants; import kpi.skarlet.cad.poliz.memory.Constant; import kpi.skarlet.cad.poliz.memory.Label; import kpi.skarlet.cad.poliz.memory.ProgramMemory; import kpi.skarlet.cad.poliz.memory.Variable; import kpi.skarlet.cad.poliz.performer.exceptions.RuntimeExceptions; import kpi.skarlet.cad.poliz.performer.exceptions.runtime.VariableUsingException; import javax.swing.*; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Stack; import java.util.stream.Collectors; public class Performer { private Controller controller; private final Map<String, Integer> keywords; private TerminalSymbols TS; private PolizConstants PC; private ProgramMemory memory; private Stack<Lexeme> stack; private VariableType currentType; private List<Lexeme> lexemes; private int lastOperatorIdx = 0; // index of last used operator private int conLimit = -1; // index of last constant generated by Lexer public boolean firstStart = true; public Performer() { this.keywords = new InitKeywords(); this.memory = new ProgramMemory(); this.stack = new Stack<>(); this.lexemes = new ArrayList<>(); } public void clear() { this.memory.clear(); this.stack.clear(); this.lexemes.clear(); this.lastOperatorIdx = 0; this.conLimit = -1; } public void perform(Controller controller, CodeParser parser) { this.clear(); this.controller = controller; this.rewriteConstants(parser.getLexer().getConstants()); this.mergeLabels(parser.getLabels()); // Here mb sort labels this.lexemes.addAll(parser.getResult()); if (firstStart) { this.setLabelsSpCode(); this.setVarSpCode(); firstStart = false; } try { this.handleAll(this.lexemes); } catch (RuntimeExceptions ex) { String output = ex.getMessage() + "\r\n"; controller.appendOutput(output); } } private void rewriteConstants(List<kpi.skarlet.cad.lexer.lexemes.Constant> constants) { List<Constant> collect = constants.stream() .map(c -> new Constant(Float.valueOf(c.getName()), c.getType())) .collect(Collectors.toList()); memory.getConstants().addAll(collect); this.conLimit = memory.getConstants().size() - 1; } private void mergeLabels(List<Label> labels) { for (int i = 0; i < labels.size(); i++) { Label l = labels.get(i); if (l.getName().contains(String.valueOf(CharacterConstants.colon))) continue; Label label = new Label(l.getFromIdx(), l.getName(), l.getToIdx()); for (Label l1 : labels) { if (l1.getName().charAt(l1.getName().length() - 1) == CharacterConstants.colon && l1.getName().substring(0, l1.getName().length() - 1).equals(l.getName())) { if (!label.hasToIdx()) label.setToIdx(l1.getToIdx()); break; } } this.memory.getLabels().add(label); } } private void setLabelsSpCode() { for (Lexeme lexeme : lexemes) { if (lexeme.getCode() == getCode(TS.LABEL)) { if (lexeme.getName().contains(String.valueOf(TS.COLON))) { lexeme.setName(lexeme.getName().substring(0, lexeme.getName().length() - 1)); } List<Label> labels = memory.getLabels(); for (int i = 0; i < labels.size(); i++) { if (labels.get(i).getName().equals(lexeme.getName())) { lexeme.setSpCode(i); break; } } } } } private void setVarSpCode() { for (Lexeme lexeme : lexemes) { int code = lexeme.getCode(); if (code == getCode(TS.CONSTANT) || code == getCode(TS.IDENTIFIER)) { lexeme.setSpCode(lexeme.getSpCode() - 1); } } } public void handleOne(Lexeme lexeme) { } public void handleAllDemo(List<Lexeme> lexemes) { for (Lexeme lexeme : lexemes) { handleOne(lexeme); } } public void handleAll(List<Lexeme> lexemes) throws RuntimeExceptions { handleDeclarationList(lexemes); for (int i = lastOperatorIdx + 1; i < lexemes.size(); i++) { Lexeme lexeme = lexemes.get(i); int lexCode = lexeme.getCode(); // handleOne(lexeme); if (lexCode == getCode(TS.IDENTIFIER) || lexeme.getCode() == getCode(TS.CONSTANT)) { stack.push(lexeme); } else if (lexCode == getCode(TS.LABEL)) { if (memory.getLabels().get(lexeme.getSpCodeLbl()).getToIdx() == i + 1) continue; // not push if it is label jump point stack.push(lexeme); } else if (lexCode != PC.SP_CODE) { // operator if (lexCode == getCode(TS.EQUAL)) { handleAssignment(); } else if (isArithmeticSignCode(lexCode)) { handleArithmeticOperation(lexCode); } else if (isLogicalSignCode(lexCode)) { handleLogicalOperation(lexCode); } } else { // lexeme.getCode() == PC.SP_CODE if (lexeme.getName().equals(PC.JMP)) { int lblSpCode = stack.pop().getSpCodeLbl(); i = memory.getLabels().get(lblSpCode).getToIdx(); } else if (lexeme.getName().equals(PC.JNE)) { i = handleJNE(i); } else if (lexeme.getName().equals(PC.OUTPUT)) { Lexeme pop = stack.pop(); float valF = valueOf(pop); String output; boolean typeInt = pop.getCode() == getCode(TS.IDENTIFIER) && memory.getVariables().get(pop.getSpCodeIdn()).getType().equals(VariableType.INT); int valI = (int) valF; if (typeInt) { output = String.valueOf(valI); } else { output = String.valueOf(valF); } output += '\n'; controller.appendOutput(output); } else if (lexeme.getName().equals(PC.INPUT)) { // future feature controller.setInputPrompt("Enter " + stack.peek().getName()); Waiter waiter = new Waiter(); waiter.start(); try { waiter.join(); controller.enterPressed = false; } catch (InterruptedException e) { e.printStackTrace(); } checkInput(); } /*else if()*/ } } } private int handleJNE(int i) { Lexeme o2 = stack.pop(); // second operand (label) Lexeme o1 = stack.pop(); // first operand (condition) if (o1.getSpCodeCon() != null) { // if true if (memory.getConstants().get(o1.getSpCode()).getValue() == 0f) { int lblSpCode = o2.getSpCodeLbl(); // (SpCodeLbl != null)? i = memory.getLabels().get(lblSpCode).getToIdx(); } } else { System.err.println("Required CON code in condition constant!"); } return i; } private void handleDeclarationList(List<Lexeme> lexemes) { int typeIndex = findFirstTypeIndex(lexemes, lastOperatorIdx + 1); if (typeIndex == -1) return; else { currentType = lexemes.get(typeIndex).getName().equals(PC.TYPE_INT) ? VariableType.INT : VariableType.FLOAT; for (int i = lastOperatorIdx; i < typeIndex; i++) { Lexeme lexeme = lexemes.get(i); if (lexeme.getCode() == getCode(TS.IDENTIFIER)) { Variable variable = new Variable(lexeme.getName(), currentType); // (currentType.equals(VariableType.INT)) ? VariableType.INT : VariableType.FLOAT; this.memory.getVariables().add(variable); } else { // throw new RuntimeExceptions(); System.err.println("Expected only identifier, but found: lexCode = " + lexeme.getCode()); } } this.lastOperatorIdx = typeIndex; handleDeclarationList(lexemes); } } private int findFirstTypeIndex(List<Lexeme> list, int start) { for (int i = start; i < list.size(); i++) { if (list.get(i).getName().equals(PC.TYPE_INT) || list.get(i).getName().equals(PC.TYPE_FLOAT)) return i; } return -1; } private Integer getCode(String string) { return keywords.get(string); } private float valueOf(Lexeme lexeme) throws RuntimeExceptions { if (lexeme.getCode() == getCode(TS.CONSTANT)) { return memory.getConstants().get(lexeme.getSpCodeCon()).getValue(); } else if (lexeme.getCode() == getCode(TS.IDENTIFIER)) { Variable variable = memory.getVariables().get(lexeme.getSpCodeIdn()); if (variable.getValue() == null) throw new VariableUsingException(variable.getName(), lexeme.getLine()); return variable.getValue(); } else { System.err.println("Found valueOf request of {Not CON & Not IDN}"); return 0; } } private boolean isArithmeticSignCode(int code) { return code >= 24 && code <= 27; } private boolean isLogicalSignCode(int code) { return code >= 17 && code <= 22; } private void checkConstantDisposable(Lexeme o2) { if (o2.getSpCodeCon() != null && o2.getSpCode() > conLimit) memory.getConstants().remove(memory.getConstants().get(o2.getSpCode())); } private void handleArithmeticOperation(int opCode) throws RuntimeExceptions { Lexeme o2 = stack.pop(); // second operand Lexeme o1 = stack.pop(); // first operand String result = "-1"; Lexeme res; if (opCode == getCode(TS.ASTERISK)) { result = String.valueOf(valueOf(o1) * valueOf(o2)); } else if (opCode == getCode(TS.SLASH)) { result = String.valueOf(valueOf(o1) / valueOf(o2)); } else if (opCode == getCode(TS.PLUS)) { result = String.valueOf(valueOf(o1) + valueOf(o2)); } else if (opCode == getCode(TS.MINUS)) { result = String.valueOf(valueOf(o1) - valueOf(o2)); } checkConstantDisposable(o2); checkConstantDisposable(o1); res = new Lexeme(result, o2.getLine(), getCode(TS.CONSTANT), memory.getConstants().size(), false); Constant constant = new Constant(Float.valueOf(result), VariableType.FLOAT); memory.getConstants().add(constant); stack.push(res); } private void handleLogicalOperation(int opCode) throws RuntimeExceptions { boolean twoOperand = true; Lexeme o2 = stack.pop(); // second operand Lexeme o1 = stack.pop(); // first operand String result = "-1"; Lexeme res; if (opCode == getCode(TS.COMPARE)) { result = String.valueOf(valueOf(o1) == valueOf(o2) ? 1 : 0); } else if (opCode == getCode(TS.COMPARE_NEGATION)) { result = String.valueOf(valueOf(o1) != valueOf(o2) ? 1 : 0); } else if (opCode == getCode(TS.MORE)) { result = String.valueOf(valueOf(o1) > valueOf(o2) ? 1 : 0); } else if (opCode == getCode(TS.LESS)) { result = String.valueOf(valueOf(o1) < valueOf(o2) ? 1 : 0); } else if (opCode == getCode(TS.MORE_OR_EQUAL)) { result = String.valueOf(valueOf(o1) >= valueOf(o2) ? 1 : 0); } else if (opCode == getCode(TS.LESS_OR_EQUAL)) { result = String.valueOf(valueOf(o1) <= valueOf(o2) ? 1 : 0); } else if (opCode == getCode(TS.AND)) { result = String.valueOf(valueOf(o1) * valueOf(o2) == 0 ? 0 : 1); } else if (opCode == getCode(TS.OR)) { result = String.valueOf((valueOf(o1) != 0 || valueOf(o2) != 0) ? 1 : 0); } else if (opCode == getCode(TS.NEGATION)) { stack.push(o1); twoOperand = false; result = String.valueOf(valueOf(o2) == 0 ? 1 : 0); } checkConstantDisposable(o2); if (twoOperand) checkConstantDisposable(o1); res = new Lexeme(result, o2.getLine(), getCode(TS.CONSTANT), memory.getConstants().size(), false); Constant constant = new Constant(Float.valueOf(result), VariableType.INT); memory.getConstants().add(constant); stack.push(res); } private void handleAssignment() throws RuntimeExceptions { Lexeme o2 = stack.pop(); // second operand Lexeme o1 = stack.pop(); // first operand if (o1.getSpCodeIdn() != null) { Variable variable = memory.getVariables().get(o1.getSpCode()); variable.setValue(valueOf(o2)); checkConstantDisposable(o2); } else { System.err.println("Missing identifier special code! Assignment required a identifier as first operand"); } } private void checkInput() { String inputString = controller.input; Lexeme idn = stack.pop(); Float value = null; try { value = Float.parseFloat(inputString); memory.getVariables().get(idn.getSpCodeIdn()).setValue(value); } catch (NumberFormatException e) { System.err.println("Wrong input format"); controller.appendOutput("Wrong number format! " + idn.getName() + " wasn't initialized"); } } class Waiter extends Thread { @Override public void run() { System.out.println("Waiter run..."); while (!controller.enterPressed) { try { sleep(1000L); } catch (InterruptedException e) { } } System.out.println("Waiter stop"); } } }
[ "Skarletvlad@gmail.com" ]
Skarletvlad@gmail.com
6d22e980b782ae548fb48e2baae661370cdce3d8
dd69fdedbd202fda0d7f747490f25f040169bc03
/Java Programs/Sample Programs/StudentDetails.java
c2d414effb0a3e4c6abdce4c90b60be1c8a6bf52
[]
no_license
ArunaChinnathambi/Dobby
3de6c78e9690411a5be04f80fc02925fc4d0aea1
db8b6f0198aaa932e29166b4fd49136db969c0d4
refs/heads/master
2021-09-06T18:00:31.368874
2018-02-09T11:00:58
2018-02-09T11:00:58
103,948,083
1
0
null
null
null
null
UTF-8
Java
false
false
1,912
java
import java.util.*; public class StudentDetails{ static Scanner scan = new Scanner(System.in); static ArrayList<Data> d = new ArrayList<Data>(); public static void main(String[] args) { while(true){ System.out.println("\nChoose an option\n1.Enter Details\n2.Show Details\n3.Exit"); switch(scan.nextInt()){ case 1: setDetails(); break; case 2: getDetails(); break; case 3: System.exit(0); break; default: System.out.println("Input Error, please try again"); } } } static void setDetails() { String name; int age, phone; double height; name = System.console().readLine("Name : \n"); System.out.println("Age : "); age = scan.nextInt(); System.out.println("Phone : "); phone = scan.nextInt(); System.out.println("Height : "); height = scan.nextDouble(); d.add(new Data().setName(name).setAge(age).setPhone(phone).setHeight(height)); } static void getDetails() { System.out.println("Total Details"); for (Data dd : d) { System.out.println(dd); } } } class Data { private String name; private int age, phone; private double height; Data setName(String temp) { name = temp; return this; } Data setAge(int temp) { age = temp; return this; } Data setPhone(int temp) { phone = temp; return this; } Data setHeight(double temp) { height = temp; return this; } public String toString() { return "\nName - " + name + "\nAge - " + age + "\nPhone - " + phone + "\nHeight - " + height; } }
[ "aruna.c@KGFSL.COM" ]
aruna.c@KGFSL.COM
da0215ee3ba46ef8f3fd8fb92f8e4b3dfb42aedd
e8acc85eb01fae1fa4e0247868d1314090570e84
/Conways_Life/src/LifeRunner.java
64e6e0064b280611c22060c72f5fc2fa112d28e8
[]
no_license
chloe-jeon/AP-Computer-Science
4c8e9b213f7b345cb96cd3432ceeedc91c96208f
44471bdf44d396102e54b9056d35995f93951418
refs/heads/master
2021-01-06T03:48:26.199232
2020-02-17T21:54:08
2020-02-17T21:54:08
241,215,115
0
0
null
null
null
null
UTF-8
Java
false
false
4,994
java
import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.*; import javax.swing.*; import info.gridworld.grid.*; import info.gridworld.world.*; public final class LifeRunner { private JFrame frame = new JFrame("Life, as we know it!"); private JPanel panel; private int currentGen; private int numClicks; private int[][] grid;// to be constructed in the makeGrid method private final boolean SHOW_GUI = true; // JOptionPane promter = new JOptionPane("Pick a color scheme:"); public static void main(String[] args) { new LifeRunner().start(); } private void start() { makeGrid(45,60, 116);// row, col, lives if(this.SHOW_GUI) makeFrame(); printGrid(); if(this.SHOW_GUI) this.frame.repaint(); printGrid(); if(this.SHOW_GUI) frame.repaint(); } private void makeFrame() { frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panel = new JPanel() { public void paintComponent(Graphics g) { super.paintComponent(g); // code to draw on graphics // g.setColor(new Color(100,100,100)); // g.fillRect(200, 100+15*currentGen, 75, 20); // g.setColor(Color.RED); // g.drawLine(10+10*currentGen, 50, 600, 100); showLife(g); } }; frame.add(panel); panel.setLayout(null); JButton button = new JButton("Next"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { // Code to be performed when button is clicked nextGen(); panel.repaint(); } }); panel.add(button); button.setBounds(350, 250, 100,100); panel.setPreferredSize(new Dimension(800,600)); frame.pack(); frame.setVisible(true); } final int WIDTH = 13; protected void showLife(Graphics g) { for (int i = 1; i < (grid.length - 1); i++) { for (int j = 1; j < (grid[i].length - 1); j++) { g.setColor(Color.gray); if (grid[i][j] == 1) g.setColor(Color.yellow); g.fillRect(j * WIDTH, i * WIDTH, WIDTH, WIDTH); g.setColor(Color.white); g.drawRect(j * WIDTH, i * WIDTH, WIDTH, WIDTH); } } } /** * create a grid with dimension of rows X cols with lives objects * randomly placed into the grid. One tricky part is to make sure you are * placing the correct number of objects in the grid. If you randomly * come up with the same location, your code needs to account for that! * * After making the grid, it is added to the List of grids * * @param rows number of rows in the grid * @param cols number of cols in the grid * @param lives number of lives to be added to the grid */ private void makeGrid(int rows, int cols, int lives) { grid = new int[rows + 2][cols + 2]; //buffer zone of 0's while (lives > 0) { int r = (int)(rows * Math.random()) + 1; int c = (int)(cols * Math.random()) + 1; if (grid[r][c] == 0) { grid[r][c] = 1; lives--; } } } /** * Prints the specified 2D array of int to the console. * @param grid2 */ private void printGrid() { for (int i = 1; i < (grid.length - 1); i++) { for (int j = 1; j < (grid[i].length - 1); j++) { if (grid[i][j] == 1) System.out.print("*"); else System.out.print("-"); } System.out.println(); } } /** * This method advances grid from the previous generation to the next generation * based on these two simple rules: * 1. If there are 3 or more neighboring objects around a cell, that cell will contain a * life in the subsequent generation. * 2. If there are 1 or less neighboring objects around a cell, that cell won't contain a * life in the subsequent generation. * * Be sure to make all the changes to a different grid. * Finally, the newest grid is added to the list of generations */ private void nextGen() { this.currentGen++; System.out.println("creating next gen "+currentGen); int[][] grid2 = new int[grid.length][grid[0].length]; for (int i = 1; i < (grid.length - 1); i++) { for (int j = 1; j < (grid[i].length - 1); j++) { int numNeighbors = 0; numNeighbors += grid[i - 1][j - 1]; numNeighbors += grid[i - 1][j - 0]; numNeighbors += grid[i - 1][j + 1]; numNeighbors += grid[i - 0][j - 1]; numNeighbors += grid[i - 0][j + 1]; numNeighbors += grid[i + 1][j - 1]; numNeighbors += grid[i + 1][j - 0]; numNeighbors += grid[i + 1][j + 1]; if (numNeighbors > 2) grid2[i][j] = 1; else if (numNeighbors < 2) grid2[i][j] = 0; else grid2[i][j] = grid[i][j]; } } for (int i = 1; i < (grid.length - 1); i++) { for (int j = 1; j < (grid[i].length - 1); j++) { grid[i][j] = grid2[i][j]; } } printGrid(); makeFrame(); } }
[ "chloejeon@Chloes-Air.hsd1.ca.comcast.net" ]
chloejeon@Chloes-Air.hsd1.ca.comcast.net
a208ab92f3d4156b4f90e9062c6281f54444d2e1
07c03fef5729bc34f3e58b30eadb529ee556996d
/GitTestProject/src/com/neosoft/GitHubTest.java
ab43786f7105f1e40ce1a6ac4ce146c9681e8042
[]
no_license
saurabhdharamkar/GitHubTestProject
33674f9dce2c6b0b88c858d601b04d9a4e386617
f9f7aa5af99d5d879eb22178288e2895557ab71b
refs/heads/master
2023-08-11T23:08:10.937109
2021-09-16T21:06:52
2021-09-16T21:06:52
407,053,734
0
0
null
null
null
null
UTF-8
Java
false
false
205
java
package com.neosoft; public class GitHubTest { public static void main(String[] args) { String code="SE"; if(code=="SE") System.out.println("SE"); else System.out.println(" Not a SEEE"); } }
[ "saurabhdharamkar2714@gmail.com" ]
saurabhdharamkar2714@gmail.com
3465e974d9f98d781aac9cf04a6da85620efbc4f
32b541f9e2acb81033b77d32d60a83e6c10a4d9f
/Java 8/JavaExercise/src/ChapterSix/MethodEx.java
9d58014f1f2df63055ccd3eda39a0c2f961463cd
[]
no_license
mortozafsti/Java-SE-8
4c81da201a71cb3181c94a87f84cd4770dfca8dc
d95cd2bdca087e89d4ec7eedcd6ba5b0387fa30d
refs/heads/master
2021-07-19T17:35:21.535803
2018-12-07T06:57:30
2018-12-07T06:57:30
146,238,654
1
0
null
null
null
null
UTF-8
Java
false
false
1,337
java
package ChapterSix; /** * * @author User */ public class MethodEx { String abc; String msg; //Main Meyhod public static void main(String[] args) { MethodEx mm = new MethodEx(); System.out.println("M: "+mm.display()); System.out.println("M: "+mm.display2()); } //Simple Meyhod //1.Access modifer like public,protected,private,default //if empty then it is default //2.data type primitive type(int,long,float,double,short,byte,boolean) or class type(String or any class name) or void //if public is void, then method will not return anything //syntax of method //Access modifer>+data typr>+method Name>+parameter is optional+{} //Method 1: public String display() { String n = "I am Void Method"; return n; } //Method 2: data type is int so we must return kwyword and public int display2() { int x = 10; return x; } //Method 3: public String display3() { return "Hello Word"; } //Method 4: public String display4() { String str = "Hello Word"; return str; } //Method 5: public String display5() { abc = "Hello Word"; return abc; } //Method 6: public String display6() { return msg; } }
[ "mortozafsti@gmail.com" ]
mortozafsti@gmail.com
d45f1d9a48124aa7012c341d2a9860f84bc46b88
eef6bb100f91afafa9c2a7bc6a7308279835d199
/src/main/java/com/fw/instagram/member/model/service/MemberService.java
ae8ec1fb1907f7b6d9fcf8e87b9bb2a3d6e3b89a
[]
no_license
KiyeonYun/instagramProject
46c383718cac58402f2c9be02b29e21dbc4e42f3
c6c7e7acd3bfbf488fa7ec1e5c839442b770de9f
refs/heads/main
2023-09-04T11:17:33.910287
2021-10-19T10:30:03
2021-10-19T10:30:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
80
java
package com.fw.instagram.member.model.service; public class MemberService { }
[ "71883439+hamvely@users.noreply.github.com" ]
71883439+hamvely@users.noreply.github.com
5e334cd4dd51aaa058e0ffa23fdeb1c20b20813a
8c2b763a71842796073b15f2a87dbbfcf9ba763d
/pattern3.java
e201216e7354218936d785a46475c7d656a71688
[]
no_license
AmanBansal619/Java
f7bfec7e00f4c09f646baca524d76e64dc617677
ac967242e48b0e6473d687d854c4271590ff65e5
refs/heads/master
2020-04-27T09:20:17.715782
2019-03-06T19:59:19
2019-03-06T19:59:19
174,210,719
0
0
null
null
null
null
UTF-8
Java
false
false
399
java
import java.util.Scanner; public class pattern3 { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); int i=1; while(i<=n) { int j=i; int k=1; while(j<n) { System.out.print(" "); j++; } while(k<(i*2)) { System.out.print("*"); k++; } System.out.println(); i++; } } }
[ "noreply@github.com" ]
AmanBansal619.noreply@github.com
c02fb960f6b0380cb5cdc37653f223f89cfa0def
f2572433519cf82e981adf972a5b0d93aaa9bf5a
/src/test/java/com/albion/sort/topK/v2/TopKElementsTest.java
9275247801f60fc6c6d4f30d8a81aa89ee7033b1
[]
no_license
KyleLearnedThis/CodingChallenges
eda0639387c20ecbe4a1328fb64b45a8d3863721
3933ab1c1e1445d1c78e77818cbc60d696c68f6b
refs/heads/master
2021-09-14T07:02:49.683825
2017-10-11T03:55:24
2017-10-11T03:55:24
77,719,000
0
0
null
2017-10-11T03:55:25
2016-12-31T01:16:50
Java
UTF-8
Java
false
false
481
java
package com.albion.sort.topK.v2; import org.testng.Assert; import org.testng.annotations.Test; import java.util.List; public class TopKElementsTest { @Test public void testTopKFrequent() throws Exception { int[] input = {1,2,2,3,3,3,4,4,4,4,5,5,5,5,5}; int k = 3; int expected = 3; TopKElements t = new TopKElements(); List<Integer> result = t.topKFrequent(input, k); Assert.assertEquals(result.size(), expected); } }
[ "kyle.learned.this@gmail.com" ]
kyle.learned.this@gmail.com
7efde83e379e5b45498e0fb6ce5a160817a06f5d
d4e26758e967a1471944e0dd9fc2c3d2538ee50e
/src/domain/Category.java
acb7873ab4bb639a3dd45020b58c7888c78c7b20
[]
no_license
zhonghaoli/BookStore
3c9665693c7510c81083426cc52029e0a9e08d16
038bb999c292ffa1b7ce2e65fbdeec69dc6121af
refs/heads/master
2021-05-15T10:56:39.097846
2017-08-26T04:01:31
2017-08-26T04:01:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
691
java
package domain; public class Category { private String id; private String name; private String description; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Category(String id, String name, String description) { super(); this.id = id; this.name = name; this.description = description; } public Category() { super(); // TODO Auto-generated constructor stub } }
[ "3287320990@qq.com" ]
3287320990@qq.com
ac353e0d7f19b9fdc4f4ff94c4b1368697038cb0
882f133473fe45b5297f3fcb97922c80f838bd6d
/sandbox/src/main/java/ru/stqa/pft/sandbox/Primes.java
4c5838357a3d15584d4edce2a658ff1f8ba9c692
[ "Apache-2.0" ]
permissive
IvanMesh/java_pft
35a4f9f24449c5cc0a763ca1801b05d1146f8c24
da436d7fba11d34106e63efd2a38b633f24711db
refs/heads/master
2020-12-02T16:17:52.503252
2017-09-21T11:19:16
2017-09-21T11:19:16
96,530,661
1
1
null
null
null
null
UTF-8
Java
false
false
671
java
package ru.stqa.pft.sandbox; public class Primes { public static boolean isPrime(int n) { for (int i = 2; i < n; i++) { if (n % i == 0) { return false; } } return true; } public static boolean isPrimeWhile(int n) { int i = 2; while (i < n && n % i != 0) { i++; } return i == n; } public static boolean isPrime(long n) { for (long i = 2; i < n; i++) { if (n % i == 0) { return false; } } return true; } public static boolean isPrimeFast(int n) { for (int i = 2; i < n / 2; i++) { if (n % i == 0) { return false; } } return true; } }
[ "imeshcheriyakov@gmail.com" ]
imeshcheriyakov@gmail.com
2332e34826fa2699dda84e346d9288fef8777497
f12346044abbcbf451707bff8b7aebaa2bafe3e6
/src/main/java/com/residencia/ecommerce/config/WebSecurityConfig.java
66c4a1c7c6575094d709e4eebf9e7c97770cf80b
[]
no_license
Diogo-Mendes-Martins/APIRestful-e-commerce
5d6a927048a09c810bfd75c77aad4ef115b2fbbd
f168dc0a39d293c69d19344e6e865c1db747bde0
refs/heads/main
2023-05-26T19:17:47.600670
2021-06-14T11:50:06
2021-06-14T11:50:06
375,763,848
0
0
null
null
null
null
UTF-8
Java
false
false
1,350
java
package com.residencia.ecommerce.config; import org.springframework.context.annotation.Bean; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.CorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import java.util.Arrays; @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.cors().and().csrf().disable(); } @Bean CorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration = new CorsConfiguration(); configuration.setAllowedOrigins(Arrays.asList("*")); configuration.setAllowedMethods(Arrays.asList("*")); configuration.setAllowedHeaders(Arrays.asList("*")); configuration.setAllowCredentials(true); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", configuration); return source; } }
[ "digmartins17@gmail.com" ]
digmartins17@gmail.com
46db314565541d872aef8abdc96924a90390be22
d0abeabf17aac1e754e7e46b8b24025fed0f740f
/core/service/service-core/src/main/java/com/test/task/service/user/dto/UpdateUserDto.java
85467c832a00566a197947672865b8fe64a7ce80
[]
no_license
gevorgyanarman/test-task
c08d7e5e1137671bed32e782b218ffda88d66a0f
8e99fea2d1cd3c05db13e7c2283aef2aa005b9c1
refs/heads/master
2022-12-15T18:37:10.805882
2020-09-22T14:27:09
2020-09-22T14:27:09
297,440,419
0
0
null
null
null
null
UTF-8
Java
false
false
1,494
java
package com.test.task.service.user.dto; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import org.springframework.util.Assert; public final class UpdateUserDto { private final Long id; private final String login; public UpdateUserDto(final Long id, final String login) { Assert.notNull(id, "The user id should not be null"); Assert.hasText(login, "The user login should not be null or empty"); this.id = id; this.login = login; } @Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof UpdateUserDto)) { return false; } final UpdateUserDto that = (UpdateUserDto) o; return new EqualsBuilder() .append(id, that.id) .append(login, that.login) .isEquals(); } @Override public int hashCode() { return new HashCodeBuilder() .append(id) .append(login) .toHashCode(); } @Override public String toString() { return new ToStringBuilder(this) .append("id", id) .append("login", login) .toString(); } public Long getId() { return id; } public String getLogin() { return login; } }
[ "armangevorg.post@gmail.com" ]
armangevorg.post@gmail.com
cad4d137c2758bf7363a5f7b40738a4d96bc9241
9b4f876a8d39132ce98f8e121d357ad228941b90
/salesdemo/src/main/java/salesdemo/app/config/WebInitializer.java
47deedefc2fdf353254a47cc5070f9d7d9e8ed64
[]
no_license
applifireAlgo/todaycheck
7cc393f6c5a62bb429360801ddb0749df1ed866e
54ec458db341d9bd2d7f3c960d5435792296c5c5
refs/heads/master
2021-01-10T13:52:11.681295
2016-01-13T10:11:38
2016-01-13T10:11:38
48,320,146
0
0
null
null
null
null
UTF-8
Java
false
false
4,697
java
package salesdemo.app.config; import java.util.EnumSet; import javax.servlet.FilterRegistration; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.ServletRegistration; import javax.servlet.SessionTrackingMode; import org.springframework.context.annotation.PropertySource; import org.springframework.context.annotation.Configuration; import org.springframework.web.WebApplicationInitializer; import org.springframework.web.context.ContextLoaderListener; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; import org.springframework.web.servlet.DispatcherServlet; import com.athena.config.appsetUp.model.AppConfiguration; import java.io.File; /** * * * @author Anant * */ @Configuration public class WebInitializer implements WebApplicationInitializer { private final String APP_PKG = getPackage(); private final String SOLR_HOME = getSolrHome(); @Override public void onStartup(ServletContext servletContext) throws ServletException { WebApplicationContext context = getContext(); ServletRegistration.Dynamic dispatcher = servletContext.addServlet("DispatcherServlet", new DispatcherServlet(context)); dispatcher.setLoadOnStartup(1); dispatcher.addMapping("/secure/*"); servletContext.addListener(new ContextLoaderListener(context)); servletContext.setSessionTrackingModes(EnumSet.of(SessionTrackingMode.COOKIE)); } private AnnotationConfigWebApplicationContext getContext() { AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext(); context.setConfigLocation(APP_PKG); return context; } public void setSystemProperty(String propertyName, String propertyValue) { System.setProperty(propertyName, propertyValue); } public void setSolrDispatcher(ServletContext servletContext) { FilterRegistration.Dynamic dynaFilterReg = servletContext.addFilter("SolrRequestFilter", "org.apache.solr.servlet.SolrDispatchFilter"); dynaFilterReg.addMappingForUrlPatterns(null, true, "/*"); } public String getSolrHomeDir(ServletContext servletContext) { AppConfiguration appConfiguration = appSetup(servletContext); return appConfiguration.getSolrProperties() != null && appConfiguration.getSolrProperties().getSolrHome() != null && appConfiguration.getSolrProperties().getSolrHome().length() > 0 ? appConfiguration.getSolrProperties().getSolrHome() : SOLR_HOME; } public AppConfiguration appSetup(ServletContext servletContext) { com.athena.config.app.xmlParser.AppXMLLoader appXMLLoader = null; try { appXMLLoader = new com.athena.config.app.xmlParser.AppXMLLoader(); appXMLLoader.loadAppProperties(new File(servletContext.getRealPath("/WEB-INF/conf/appConfiguration.xml"))); } catch (Exception e) { e.printStackTrace(); } return appXMLLoader.getAppConfiguration(); } public static boolean isSolrHomeExistOrNot(String solrHome) { File file = new File(solrHome); if (!file.exists()) { System.out.println("|**************************************************************|"); System.out.println("| |"); System.out.println("| |"); System.out.println("| |"); System.out.println("| PLEASE CHECK |"); System.out.println("| SOLR HOME NOT Exists, SOLR WILL NOT WORK |"); System.out.println("| PATH For SOLR HOME :" + solrHome + " |"); System.out.println("| Is NOT Exists |"); System.out.println("| |"); System.out.println("| |"); System.out.println("| |"); System.out.println("|**************************************************************|"); return false; } return true; } public String getSolrHome() { return "/home/applifire/workspace/XCUE2MXC3AD7APQYXIBQRG/salesdemoSolr-4.9.0"; } public String getPackage() { return "salesdemo.app"; } }
[ "applifire@2e81e773db27" ]
applifire@2e81e773db27
ac91d682f6ebf4f58bb18f78f888ed469b4dd97b
8f899f8bb9ed28e4d204d54a74423ff2ed22cbba
/Spring-Auto-Mapping-Objects/src/main/java/com/example/springautomappingobjects/CommandLineRunnerImpl.java
662bf06b9acdc491f61bdcc4cb5d5a03daa3b1f0
[]
no_license
jivko25/Softuni-SpringData
63125cf4b2fa87c397c880c1297b024f8d1987a1
905bd1c76bf43496c0bfd3827e6b1b61407bcfe9
refs/heads/main
2023-07-10T23:20:52.174687
2021-08-05T08:49:54
2021-08-05T08:49:54
379,914,512
0
0
null
null
null
null
UTF-8
Java
false
false
2,590
java
package com.example.springautomappingobjects; import com.example.springautomappingobjects.model.dto.GameAddDto; import com.example.springautomappingobjects.model.dto.UserLoginDto; import com.example.springautomappingobjects.model.dto.UserRegisterDto; import com.example.springautomappingobjects.survice.GameService; import com.example.springautomappingobjects.survice.UserServece; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; import java.math.BigDecimal; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.Scanner; @Component public class CommandLineRunnerImpl implements CommandLineRunner { private final UserServece userService; private final GameService gameService; @Autowired public CommandLineRunnerImpl(UserServece userService, GameService gameService) { this.userService = userService; this.gameService = gameService; } @Override public void run(String... args) throws Exception { Scanner scanner = new Scanner(System.in); while (true){ String[] data = scanner.nextLine().split("\\|"); switch (data[0]){ case "RegisterUser": UserRegisterDto userRegisterDto = new UserRegisterDto(data[1],data[2],data[3],data[4]); System.out.println(this.userService.registerUser(userRegisterDto)); break; case "LoginUser": UserLoginDto userLoginDto = new UserLoginDto(data[1],data[2]); System.out.println(this.userService.loginUser(userLoginDto)); this.gameService.setLoggedInUser(userLoginDto.getEmail()); break; case "Logout": System.out.println(this.userService.logOutUser()); this.gameService.logOutUser(); break; case "AddGame": GameAddDto gameAddDto = new GameAddDto( data[1],data[4],data[5], Double.parseDouble(data[3]), new BigDecimal(data[2]), data[6], LocalDate.parse(data[7], DateTimeFormatter.ofPattern("dd-MM-yyyy")) ); System.out.println(this.gameService.addGame(gameAddDto)); break; case "EditGame": break; case "DeleteGame": break; } } } }
[ "jivkou@yahoo.com" ]
jivkou@yahoo.com
41f8d94439fc118954c02c77fe6cdd554a282166
3a740e219d3a1f4c8c654ded3cb47f3780dabd7b
/button/src/SwingApplicationWindow.java
7c5d1da63398ceaa3b8e21ea2bf8554256fe0512
[]
no_license
abdarum/Java
9d3b80d2aebf95480c74f3292e0e23285565e048
0fb7f7d7def02602af923e41b2a6a37b2bee4726
refs/heads/master
2020-04-28T16:55:30.322537
2019-06-06T07:35:02
2019-06-06T07:35:02
175,428,588
0
0
null
null
null
null
UTF-8
Java
false
false
1,757
java
package button; import javax.swing.*; import java.awt.Toolkit; import java.awt.event.*; //import java.awt.*; import java.util.*; import java.awt.Color; import static java.awt.GraphicsDevice.WindowTranslucency.*; public class SwingApplicationWindow { private static JButton b1 = new JButton("Play"); private static JFrame f = new JFrame(); private static JPanel p = new JPanel(); private static Random randomnumber = new Random(); private static int location1=50; private static int location2=20; private static int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height; private static int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width; private static int buttonHeight = b1.getHeight(); private static int buttonWidth = b1.getWidth(); public static void main(String[]args){ //f.setOpacity((float) 1); p.setBackground(new Color(0,0,0,0)); //f.setOpacity((float) 0.10); f.setUndecorated(true); f.setVisible(true); //b1.setBackground(new Color(255,0,0,255)); f.setBackground(new Color(0.0f,0.0f,0.0f,0.0f)); //f.setSize(JFrame.MAXIMIZED_BOTH,JFrame.MAXIMIZED_BOTH); f.setExtendedState(JFrame.MAXIMIZED_BOTH); //f.setUndecorated(true); //f.setLayout(null); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); p.add(b1); f.add(p); b1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { f.repaint(); b1.setLocation(randomnumber.nextInt(screenWidth-buttonWidth),randomnumber.nextInt(screenHeight-buttonWidth)); System.out.println(b1.getLocation()); } }); } }
[ "36505427+abdarum@users.noreply.github.com" ]
36505427+abdarum@users.noreply.github.com
da1f50af6f95271e1d0a1ebd6cc1d986ee5006dd
76936cf1ad93a7a02ed4bd8630537a9b332da53d
/core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/DefaultRegisteredServiceAuthenticationPolicy.java
fd4028a8bd56304a172f793c499de8965d5a2909
[ "Apache-2.0", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
amasr/cas
07d72bced7aac41f5071c2a7f6691123becffa91
513a708796e458285747210ccfe3c214f761402a
refs/heads/master
2022-11-17T05:10:26.604549
2022-11-07T04:26:53
2022-11-07T04:26:53
239,546,074
0
0
Apache-2.0
2020-02-10T15:34:05
2020-02-10T15:34:04
null
UTF-8
Java
false
false
951
java
package org.apereo.cas.services; import com.fasterxml.jackson.annotation.JsonInclude; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import lombok.ToString; import lombok.experimental.Accessors; import java.io.Serial; import java.util.HashSet; import java.util.Set; /** * This is {@link DefaultRegisteredServiceAuthenticationPolicy}. * * @author Misagh Moayyed * @since 6.2.0 */ @ToString @Getter @EqualsAndHashCode @Setter @Accessors(chain = true) @JsonInclude(JsonInclude.Include.NON_DEFAULT) public class DefaultRegisteredServiceAuthenticationPolicy implements RegisteredServiceAuthenticationPolicy { @Serial private static final long serialVersionUID = -6777133646772207331L; private Set<String> requiredAuthenticationHandlers = new HashSet<>(); private Set<String> excludedAuthenticationHandlers = new HashSet<>(); private RegisteredServiceAuthenticationPolicyCriteria criteria; }
[ "mm1844@gmail.com" ]
mm1844@gmail.com
335973f24852f5c6bedf0fb927f9711fac30ac6f
09d8cdf469f12be998ae8cd94a8c2e77c13f01fd
/modules/integration/tests-iot-web-ui/src/test/java/org/wso2/carbon/iot/integration/web/ui/test/samples/SampleFunctionalityTest.java
d8bde532cdada7723593fa42a65e77b8551264d8
[ "Apache-2.0" ]
permissive
milindsalwe/entgramdm
664b2442b6de0ec496aaf0bcd3d155f607aade22
29020bf2be2cb6a6734e5af093aefae4e4dd58e2
refs/heads/master
2022-12-22T09:03:58.700579
2020-01-11T17:00:22
2020-01-11T17:00:22
239,490,032
0
2
Apache-2.0
2022-12-09T22:32:10
2020-02-10T10:56:43
TSQL
UTF-8
Java
false
false
9,451
java
/* * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. 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.wso2.carbon.iot.integration.web.ui.test.samples; import junit.framework.Assert; import org.openqa.selenium.WebDriver; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.wso2.carbon.automation.extensions.selenium.BrowserManager; import org.wso2.carbon.iot.integration.web.ui.test.common.Constants; import org.wso2.carbon.iot.integration.web.ui.test.common.LoginUtils; import org.wso2.carbon.iot.integration.web.ui.test.common.IOTIntegrationUIBaseTestCase; import org.wso2.iot.integration.ui.pages.devices.DevicesPage; import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceViewPage; import org.wso2.iot.integration.ui.pages.samples.ConnectedCupDeviceInterface; import javax.xml.stream.XMLStreamException; import javax.xml.xpath.XPathExpressionException; import java.io.IOException; /** * Test cases for test the functionality of the connected cup sample. * In these test cases following features are tested. * 1. Setting temperature and Coffee level * 2. Order coffee * 3. Test the stat graphs */ public class SampleFunctionalityTest extends IOTIntegrationUIBaseTestCase { private WebDriver driverDevice; private WebDriver driverServer; private ConnectedCupDeviceInterface sampleViewPage; private ConnectedCupDeviceViewPage deviceViewPage; @BeforeClass(alwaysRun = true) public void setUp() throws XPathExpressionException, XMLStreamException, IOException { super.init(); driverDevice = BrowserManager.getWebDriver(); driverServer = BrowserManager.getWebDriver(); LoginUtils.login(driverServer, automationContext, getWebAppURL()); driverServer.get(getWebAppURL() + Constants.IOT_DEVICES_URL); DevicesPage devicesPage = new DevicesPage(driverServer); deviceViewPage = devicesPage.viewDevice(Constants.IOT_CONNECTED_CUP_NAME); //Opens the connected cup device interface in the browser. driverDevice.get(deviceViewPage.getDeviceLink()); sampleViewPage = new ConnectedCupDeviceInterface(driverDevice); } @Test(description = "Set the temperature level.", groups = Constants.TestSample.VERIFY, dependsOnGroups = Constants.TestSample.ENROLL_VERIFY) public void setTemperatureTest() { Assert.assertTrue(sampleViewPage.changeTemperature(Constants.ConnectedCup.TEMPERATURE)); } @Test(description = "Set the coffee level.", groups = Constants.TestSample.VERIFY, dependsOnGroups = Constants.TestSample.ENROLL_VERIFY) public void setCoffeeLevelTest() throws IOException { Assert.assertTrue(sampleViewPage.changeCoffeeLevel(Constants.ConnectedCup.COFFEE_LEVEl)); } @Test(description = "Verify order coffee function.", groups = Constants.TestSample.VERIFY, dependsOnGroups = Constants.TestSample.ENROLL_VERIFY) public void orderCoffeeTest() throws IOException, InterruptedException { Assert.assertTrue(sampleViewPage.orderCoffee()); } @Test(description = "Test the graphs are present in device view.", groups = Constants.TestSample.VERIFY, dependsOnMethods = {"setTemperatureTest", "setCoffeeLevelTest", "orderCoffeeTest"}) public void verifyGraphs() throws IOException { Assert.assertTrue(deviceViewPage.isGraphsAvailable(2)); } @Test(description = "Test the Y axis name of Temperature graph.", groups = {Constants.TestSample.VERIFY, Constants.TestSample.TEMPERATURE}, dependsOnGroups = Constants.TestSample.ENROLL_VERIFY, dependsOnMethods = {"verifyGraphs"}) public void temperatureGraphYAxisNameTest() throws IOException { Assert.assertTrue(deviceViewPage.graphAxisName(Constants.IOT_GRAPH_Y_AXIS, Constants.ConnectedCup.TEMPERATURE_ID, Constants.ConnectedCup.TEMPERATURE_Y_AXIS)); } @Test(description = "Test the X axis name of Temperature graph.", groups = {Constants.TestSample.VERIFY, Constants.TestSample.TEMPERATURE}, dependsOnGroups = Constants.TestSample.ENROLL_VERIFY, dependsOnMethods = {"verifyGraphs"}) public void temperatureGraphXAxisNameTest() throws IOException { Assert.assertTrue(deviceViewPage.graphAxisName(Constants.IOT_GRAPH_X_AXIS, Constants.ConnectedCup.TEMPERATURE_ID, Constants.ConnectedCup.TEMPERATURE_X_AXIS)); } @Test(description = "Test the whether the Coffee Level graph legend is present.", groups = {Constants.TestSample.VERIFY, Constants.TestSample.TEMPERATURE}, dependsOnGroups = Constants.TestSample.ENROLL_VERIFY, dependsOnMethods = {"verifyGraphs"}) public void temperatureGraphLegendTest() { Assert.assertTrue(deviceViewPage.graphLegendName(Constants.ConnectedCup.TEMPERATURE_ID, Constants.ConnectedCup.TEMPERATURE_LEGEND)); } @Test(description = "Test the whether the Temperature graph path is visible.", groups = {Constants.TestSample.VERIFY, Constants.TestSample.TEMPERATURE}, dependsOnGroups = Constants.TestSample.ENROLL_VERIFY, dependsOnMethods = {"verifyGraphs"}) public void temperatureGraphPathTest() { Assert.assertTrue(deviceViewPage.checkGraphPath(Constants.ConnectedCup.TEMPERATURE_GRAPH_ID)); } @Test(description = "Test the whether the Temperature graph gets values.", groups = {Constants.TestSample.VERIFY, Constants.TestSample.TEMPERATURE}, dependsOnGroups = Constants.TestSample.ENROLL_VERIFY, dependsOnMethods = {"verifyGraphs"}) public void temperatureGraphDataPublisherTest() { Assert.assertTrue(deviceViewPage.checkGraphValues(Constants.ConnectedCup.TEMPERATURE_GRAPH_ID, Constants.ConnectedCup.TEMPERATURE)); } @Test(description = "Test the Y axis name of Coffee Level graph.", groups = Constants.TestSample.COFFEE_LEVEL, dependsOnGroups = Constants.TestSample.TEMPERATURE) public void coffeeLevelGraphYAxisNameTest() { Assert.assertTrue(deviceViewPage.graphAxisName(Constants.IOT_GRAPH_Y_AXIS, Constants.ConnectedCup .COFFEE_LEVEL_ID, Constants.ConnectedCup.COFFEE_LEVEL_Y_AXIS)); } @Test(description = "Test the X axis name of Coffee Level graph.", groups = Constants.TestSample.COFFEE_LEVEL, dependsOnGroups = {Constants.TestSample.ENROLL_VERIFY, Constants.TestSample.TEMPERATURE}) public void coffeeLevelGraphXAxisNameTest() { Assert.assertTrue(deviceViewPage.graphAxisName(Constants.IOT_GRAPH_X_AXIS, Constants.ConnectedCup.COFFEE_LEVEL_ID, Constants.ConnectedCup.COFFEE_LEVEL_X_AXIS)); } @Test(description = "Test the whether the Coffee Level graph legend is present.", groups = Constants.TestSample.COFFEE_LEVEL, dependsOnGroups = {Constants.TestSample.TEMPERATURE}) public void coffeeLevelGraphLegendTest() throws IOException { Assert.assertTrue(deviceViewPage.graphLegendName(Constants.ConnectedCup.COFFEE_LEVEL_ID, Constants.ConnectedCup.COFFEE_LEVEL_LEGEND)); } @Test(description = "Test the whether the Coffee Level graph path is visible.", groups = Constants.TestSample.COFFEE_LEVEL, dependsOnGroups = {Constants.TestSample.TEMPERATURE}) public void coffeeLevelGraphPathTest() { Assert.assertTrue(deviceViewPage.checkGraphPath(Constants.ConnectedCup.COFFEE_LEVEL_GRAPH_ID)); } @Test(description = "Test the whether the Coffee Level graph gets values.", groups = Constants.TestSample.COFFEE_LEVEL, dependsOnGroups = Constants.TestSample.TEMPERATURE) public void coffeeLevelGraphDataPublisherTest() { Assert.assertTrue(deviceViewPage.checkGraphValues(Constants.ConnectedCup.COFFEE_LEVEL_GRAPH_ID, Constants.ConnectedCup.COFFEE_LEVEl)); } @AfterClass(alwaysRun = true) public void tearDown() { driverServer.quit(); driverDevice.quit(); } }
[ "menaka12350@gmail.com" ]
menaka12350@gmail.com