blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
37500a99ff12d428c89ce996ee9660c445a898f9 | e0be0dc80e085b021f37232de4401d5bd64fe693 | /im/src/main/java/ga/im/xmpp/XMPPAuthenticationManager.java | 0512b9d54635abe5665e691133917ca4ecb27711 | [] | no_license | LaraEvdokimova/samples | d1f903d693d1b7ff32c4d9958bb1a609ef75a126 | 52ff5217d1dea0231d0de4c77640504caaf9cfbb | refs/heads/master | 2022-07-08T01:02:06.483120 | 2020-05-10T08:53:39 | 2020-05-10T08:53:39 | 262,746,918 | 0 | 0 | null | 2020-05-10T08:52:05 | 2020-05-10T08:52:04 | null | UTF-8 | Java | false | false | 3,794 | java | package ga.im.xmpp;
import ga.im.xmpp.packet.*;
import org.jivesoftware.smack.util.Base64;
import javax.security.auth.callback.*;
import javax.security.sasl.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
/**
* @author Ivan Khalopik
* @version $Revision$ $Date$
*/
public class XMPPAuthenticationManager implements PacketListener, CallbackHandler {
private final XMPPConnectionConfiguration configuration;
private final XMPPConnection connection;
private final List<String> supportedMechanisms = new ArrayList<String>();
private boolean authenticated;
private String mechanism;
private SaslClient client;
XMPPAuthenticationManager(XMPPConnection connection) {
assert connection != null;
this.connection = connection;
configuration = connection.getConfiguration();
supportedMechanisms.add("PLAIN");
supportedMechanisms.add("DIGEST-MD5");
}
boolean isAuthenticated() {
return authenticated;
}
void login() {
if (!connection.isConnected()) {
throw new XMPPException("Not connected to server.");
}
if (authenticated) {
throw new XMPPException("Already logged in to server.");
}
try {
client = Sasl.createSaslClient(new String[]{mechanism},
configuration.getUser(), "xmpp", configuration.getHost(),
new HashMap<String, Object>(), this);
final AuthPacket packet = new AuthPacket(mechanism);
if (client.hasInitialResponse()) {
byte[] response = client.evaluateChallenge(new byte[0]);
final String authenticationText = Base64.encodeBytes(response, Base64.DONT_BREAK_LINES);
packet.setContent(authenticationText);
}
connection.send(packet);
} catch (SaslException e) {
logout();
throw new XMPPException("Could not log on", e);
}
}
void logout() {
//To change body of implemented methods use File | Settings | File Templates.
}
public void packetReceived(Packet packet) {
if (packet instanceof FeaturesPacket) {
final MechanismsPacket mechanisms = ((FeaturesPacket) packet).getMechanisms();
if (mechanisms != null) {
mechanism = getPreferredMechanism(mechanisms.getMechanisms());
}
} else if (packet instanceof ChallengePacket) {
final String content = ((ChallengePacket) packet).getContent();
if (content != null) {
try {
final byte[] bytes = client.evaluateChallenge(Base64.decode(content));
final String authenticationText = Base64.encodeBytes(bytes, Base64.DONT_BREAK_LINES);
connection.send(new ResponsePacket(authenticationText));
} catch (SaslException e) {
throw new XMPPException("Could not log on", e);
}
}
} else if (packet instanceof SaslResultPacket) {
if (((SaslResultPacket) packet).isSuccess()) {
try {
connection.start();
authenticated = true;
} catch (Exception e) {
throw new XMPPException("Could not start stream", e);
}
}
}
}
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (Callback callback : callbacks) {
if (callback instanceof NameCallback) {
((NameCallback) callback).setName(configuration.getUser());
} else if (callback instanceof PasswordCallback) {
((PasswordCallback) callback).setPassword(configuration.getPassword().toCharArray());
} else if (callback instanceof RealmCallback) {
((RealmCallback) callback).setText(configuration.getHost());
} else if (!(callback instanceof RealmChoiceCallback)) {
throw new UnsupportedCallbackException(callback);
}
}
}
private String getPreferredMechanism(Collection<String> mechanisms) {
for (String supportedMechanism : supportedMechanisms) {
if (mechanisms.contains(supportedMechanism)) {
return supportedMechanism;
}
}
return null;
}
}
| [
"[email protected]"
] | |
6602a683c87dbc58fd83cdeda69c8768b3a15d43 | 90eb7a131e5b3dc79e2d1e1baeed171684ef6a22 | /sources/androidx/savedstate/SavedStateRegistry.java | 54212da449259137de2d0208d8365c187c206930 | [] | no_license | shalviraj/greenlens | 1c6608dca75ec204e85fba3171995628d2ee8961 | fe9f9b5a3ef4a18f91e12d3925e09745c51bf081 | refs/heads/main | 2023-04-20T13:50:14.619773 | 2021-04-26T15:45:11 | 2021-04-26T15:45:11 | 361,799,768 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,110 | java | package androidx.savedstate;
import android.annotation.SuppressLint;
import android.os.Bundle;
import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.arch.core.internal.SafeIterableMap;
import androidx.lifecycle.GenericLifecycleObserver;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleOwner;
import androidx.savedstate.Recreator;
import java.util.Map;
import p005b.p035e.p036a.p037a.C0843a;
@SuppressLint({"RestrictedApi"})
public final class SavedStateRegistry {
private static final String SAVED_COMPONENTS_KEY = "androidx.lifecycle.BundlableSavedStateRegistry.key";
public boolean mAllowingSavingState = true;
private SafeIterableMap<String, SavedStateProvider> mComponents = new SafeIterableMap<>();
private Recreator.SavedStateProvider mRecreatorProvider;
private boolean mRestored;
@Nullable
private Bundle mRestoredState;
public interface AutoRecreated {
void onRecreated(@NonNull SavedStateRegistryOwner savedStateRegistryOwner);
}
public interface SavedStateProvider {
@NonNull
Bundle saveState();
}
@MainThread
@Nullable
public Bundle consumeRestoredStateForKey(@NonNull String str) {
if (this.mRestored) {
Bundle bundle = this.mRestoredState;
if (bundle == null) {
return null;
}
Bundle bundle2 = bundle.getBundle(str);
this.mRestoredState.remove(str);
if (this.mRestoredState.isEmpty()) {
this.mRestoredState = null;
}
return bundle2;
}
throw new IllegalStateException("You can consumeRestoredStateForKey only after super.onCreate of corresponding component");
}
@MainThread
public boolean isRestored() {
return this.mRestored;
}
@MainThread
public void performRestore(@NonNull Lifecycle lifecycle, @Nullable Bundle bundle) {
if (!this.mRestored) {
if (bundle != null) {
this.mRestoredState = bundle.getBundle(SAVED_COMPONENTS_KEY);
}
lifecycle.addObserver(new GenericLifecycleObserver() {
public void onStateChanged(LifecycleOwner lifecycleOwner, Lifecycle.Event event) {
SavedStateRegistry savedStateRegistry;
boolean z;
if (event == Lifecycle.Event.ON_START) {
savedStateRegistry = SavedStateRegistry.this;
z = true;
} else if (event == Lifecycle.Event.ON_STOP) {
savedStateRegistry = SavedStateRegistry.this;
z = false;
} else {
return;
}
savedStateRegistry.mAllowingSavingState = z;
}
});
this.mRestored = true;
return;
}
throw new IllegalStateException("SavedStateRegistry was already restored.");
}
@MainThread
public void performSave(@NonNull Bundle bundle) {
Bundle bundle2 = new Bundle();
Bundle bundle3 = this.mRestoredState;
if (bundle3 != null) {
bundle2.putAll(bundle3);
}
SafeIterableMap<K, V>.IteratorWithAdditions iteratorWithAdditions = this.mComponents.iteratorWithAdditions();
while (iteratorWithAdditions.hasNext()) {
Map.Entry entry = (Map.Entry) iteratorWithAdditions.next();
bundle2.putBundle((String) entry.getKey(), ((SavedStateProvider) entry.getValue()).saveState());
}
bundle.putBundle(SAVED_COMPONENTS_KEY, bundle2);
}
@MainThread
public void registerSavedStateProvider(@NonNull String str, @NonNull SavedStateProvider savedStateProvider) {
if (this.mComponents.putIfAbsent(str, savedStateProvider) != null) {
throw new IllegalArgumentException("SavedStateProvider with the given key is already registered");
}
}
@MainThread
public void runOnNextRecreation(@NonNull Class<? extends AutoRecreated> cls) {
if (this.mAllowingSavingState) {
if (this.mRecreatorProvider == null) {
this.mRecreatorProvider = new Recreator.SavedStateProvider(this);
}
try {
cls.getDeclaredConstructor(new Class[0]);
this.mRecreatorProvider.add(cls.getName());
} catch (NoSuchMethodException e) {
StringBuilder u = C0843a.m460u("Class");
u.append(cls.getSimpleName());
u.append(" must have default constructor in order to be automatically recreated");
throw new IllegalArgumentException(u.toString(), e);
}
} else {
throw new IllegalStateException("Can not perform this action after onSaveInstanceState");
}
}
@MainThread
public void unregisterSavedStateProvider(@NonNull String str) {
this.mComponents.remove(str);
}
}
| [
"[email protected]"
] | |
cb03db5f126d4436ac28ec03c1579601960b4750 | 81bfaf367da7c1d0cd02bcbebe81abbefda1f3ca | /app/src/main/java/com/nytimes/articles/data/remote/RequestInterceptor.java | e4651d6829497a83608d40f30ac0588e0c385876 | [] | no_license | pramodpnckr1/NytimeApi | acaa6f6000f89b9d3975c30d613da6b99c401795 | 68f2c1931683daba7a75865d00a7e56c140e7f99 | refs/heads/master | 2020-05-04T20:17:37.069640 | 2019-04-04T06:44:08 | 2019-04-04T06:44:08 | 179,431,783 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 964 | java | package com.nytimes.articles.data.remote;
import android.support.annotation.NonNull;
import java.io.IOException;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
/**
* This okhttp interceptor is responsible for adding the common query parameters and headers
* for every service calls
* Author: PRAMOD K P
* Email: [email protected]
* Created: 3/28/2019
* Modified: 3/28/2019
*/
public class RequestInterceptor implements Interceptor {
@Override
public Response intercept(@NonNull Chain chain) throws IOException {
Request originalRequest = chain.request();
HttpUrl originalHttpUrl = originalRequest.url();
HttpUrl url = originalHttpUrl.newBuilder()
.addQueryParameter("api-key", ApiConstants.API_KEY)
.build();
Request request = originalRequest.newBuilder().url(url).build();
return chain.proceed(request);
}
} | [
"[email protected]"
] | |
8989abdbffe6e7b370d3896029a848cd8c95e0e6 | e3c8861eae2e0c65ef76a58107d3f0d0c4d9595e | /javamars-base/src/test/java/io/github/richardmars/utils/MathTest.java | 25d958af22064ae1c95f3ce89c1baa7cc0a82030 | [] | no_license | richardmars/javamars | 9a2f0251b4b87a37f75087716201ffe0ae1e638e | c58b9b68b39b520be83b52b32becafb3bc9d2006 | refs/heads/master | 2022-12-26T03:32:03.336297 | 2020-09-11T11:25:18 | 2020-09-11T11:25:18 | 90,506,292 | 1 | 0 | null | 2022-12-16T05:15:45 | 2017-05-07T03:29:13 | Java | UTF-8 | Java | false | false | 417 | java | package io.github.richardmars.utils;
import org.junit.Test;
import io.github.richardmars.utils.Math;
public class MathTest {
@Test
public void testMax() {
System.out.println(Math.max(new int[] {1, 2, 2, -1}));
}
@Test
public void testMaxMap() {
System.out.println(Math.maxMap(new int[] {1, 2, 2, -1}));
}
@Test
public void testMod() {
System.out.println(-24%5);
System.out.println(24%-5);
}
}
| [
"流云"
] | 流云 |
92c03d3a697b8262ffac936c31993eaedc1b5671 | e71119e22a67174546a1f7b64e28ac2fecff9652 | /src/main/java/com/softage/epurchase/repository/UserRepository.java | 9c6a21378ceb5ed159ca06cd2cc87c69d9a440e8 | [] | no_license | BulkSecurityGeneratorProject/epurchage | 3a0b46b794aeb3a07e9594c0946b8d48c2aa98af | 1d222705ede7a43b0835a13f36d1ec42ce2cc804 | refs/heads/master | 2022-12-24T19:26:51.590638 | 2017-03-24T06:25:57 | 2017-03-24T06:28:37 | 296,601,886 | 0 | 0 | null | 2020-09-18T11:30:18 | 2020-09-18T11:30:17 | null | UTF-8 | Java | false | false | 1,026 | java | package com.softage.epurchase.repository;
import com.softage.epurchase.domain.User;
import java.time.ZonedDateTime;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
import java.util.Optional;
/**
* Spring Data JPA repository for the User entity.
*/
public interface UserRepository extends JpaRepository<User, Long> {
Optional<User> findOneByActivationKey(String activationKey);
List<User> findAllByActivatedIsFalseAndCreatedDateBefore(ZonedDateTime dateTime);
Optional<User> findOneByResetKey(String resetKey);
Optional<User> findOneByEmail(String email);
Optional<User> findOneByLogin(String login);
@Query(value = "select distinct user from User user left join fetch user.authorities",
countQuery = "select count(user) from User user")
Page<User> findAllWithAuthorities(Pageable pageable);
}
| [
"[email protected]"
] | |
d4eb781a4f32e8b0387979ac61c08f36953c5212 | fe8d950a190fa22e13fa875fe5cdc5e6eee3b378 | /WeatherService.java | d4d33710be4bb6197f814a3af20159abd178ffff | [] | no_license | RomanValeryanov/lab5 | 3f3eeea91671a895e5601c1ae95eb17aec66d50f | f6f4f7816e75fee5499a74a952760f3ef6e6b160 | refs/heads/master | 2021-01-12T06:03:40.754796 | 2016-12-24T15:16:20 | 2016-12-24T15:16:20 | 77,288,422 | 0 | 0 | null | 2016-12-24T15:12:27 | 2016-12-24T15:12:27 | null | UTF-8 | Java | false | false | 540 | java | package lab5.weather;
import com.github.fedy2.weather.YahooWeatherService;
import com.github.fedy2.weather.data.Channel;
import com.github.fedy2.weather.data.unit.DegreeUnit;
import javax.xml.bind.JAXBException;
import java.io.IOException;
public class WeatherService {
public Channel getWeather (String location) throws JAXBException, IOException {
YahooWeatherService service = new YahooWeatherService();
return service.getForecastForLocation(location, DegreeUnit.CELSIUS).first(1).get(0);
}
}
| [
"[email protected]"
] | |
2159657fe1f7b942eb71922fd1931f93f211b3db | 9e825a2a0dd47d8e790ae392eeb070d7c165fe4d | /src/org/dlese/dpc/schemedit/action/form/SessionsForm.java | fde65e5a473f90200f501dea36aac1ae2bbe4903 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | NCAR/joai-project | 3a3a2344d3d9b22a8c313a8b92c7accbc089e89f | e3feea29785e3ac959ae683152b26de5c4626619 | refs/heads/master | 2022-03-14T04:48:27.874321 | 2022-02-19T19:00:19 | 2022-02-19T19:00:19 | 84,133,272 | 13 | 6 | NOASSERTION | 2022-02-18T21:28:04 | 2017-03-06T23:56:53 | Java | UTF-8 | Java | false | false | 2,170 | java | /*
Copyright 2017 Digital Learning Sciences (DLS) at the
University Corporation for Atmospheric Research (UCAR),
P.O. Box 3000, Boulder, CO 80307
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.dlese.dpc.schemedit.action.form;
import org.dlese.dpc.schemedit.*;
import org.dlese.dpc.webapps.tools.*;
import org.dlese.dpc.util.*;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.util.MessageResources;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.io.*;
import java.text.*;
/**
* This class uses the getter methods of the ProviderBean and then adds setter methods
* for editable fields.
*
* @author Jonathan Ostwald
*/
public final class SessionsForm extends ActionForm implements Serializable {
private Map lockedRecords = null;
private List sessionBeans = null;
private boolean showAnonymousSessions = false;
public SessionsForm () {}
public List getSessionBeans () {
return sessionBeans;
}
public void setSessionBeans (List sessionBeans) {
this.sessionBeans = sessionBeans;
}
public void setLockedRecords (Map lockedRecords) {
this.lockedRecords = lockedRecords;
}
public Map getLockedRecords () {
return lockedRecords;
}
public void setShowAnonymousSessions (boolean show) {
showAnonymousSessions = show;
}
public boolean getShowAnonymousSessions () {
return showAnonymousSessions;
}
}
| [
"[email protected]"
] | |
76db857d07711c807ffa321d4e4c97ef8aa652b0 | c8b88d3d70b44ccbe2e5d571f423ef6ce5445cce | /src/cn/com/zdez/gateway/servlet/Util.java | da0e06e710652f509ab006db9aa3c66f7a430851 | [] | no_license | glutech/ZdezServer | bbb34702bd424afce3816f5d5fa6ac70dd734f66 | 64b7ff51af740f53c724b69e80d3337689446782 | refs/heads/master | 2021-01-21T23:38:47.232381 | 2014-03-14T03:02:52 | 2014-03-14T03:03:13 | 13,730,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 536 | java | package cn.com.zdez.gateway.servlet;
public class Util {
private Util() {
}
public static boolean isStringNullOrEmpty(String s) {
return s == null || s.equals("");
}
public static boolean isStringEquals(String s1, String s2) {
return s1 == null ? false : s1.equals(s2);
}
public static boolean isStringLengthEqual(String s, int length) {
return s.length() == length;
}
public static boolean isStringLengthRange(String s, int min, int max) {
int length = s.length();
return length >= min && length <= max;
}
}
| [
"[email protected]"
] | |
6a7cefbae4ccf61efa92878423c477efcc644cff | d16652d0a7c238b39f950380b0a909bcb5fefb01 | /ChildArg.java | a6e65f2165760ffd17d66de6d73598cb852ebf3b | [] | no_license | JunhwanKang/JSP_Study | eded42422745bd373927aa5bb0a7c358e514584a | 61adc2f63ecbec22ae0b0b3e9adf641fcf074793 | refs/heads/master | 2023-03-07T00:21:20.800545 | 2021-02-19T12:03:15 | 2021-02-19T12:03:15 | 280,646,080 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 154 | java | package javaStudy;
public class ChildArg extends ParentArg{
public ChildArg() {
super("ChildArg");
System.out.println("Child Constructor");
}
}
| [
"[email protected]"
] | |
10924ffcc83eb6d91cb1895d60a50ce95dab36c9 | 08c17ec05b4ed865c2b9be53f19617be7562375d | /aws-java-sdk-quicksight/src/main/java/com/amazonaws/services/quicksight/model/transform/DeleteDataSetResultJsonUnmarshaller.java | 935f689635a0574ac1d60d92a032fd214be99d39 | [
"Apache-2.0"
] | permissive | shishir2510GitHub1/aws-sdk-java | c43161ac279af9d159edfe96dadb006ff74eefff | 9b656cfd626a6a2bfa5c7662f2c8ff85b7637f60 | refs/heads/master | 2020-11-26T18:13:34.317060 | 2019-12-19T22:41:44 | 2019-12-19T22:41:44 | 229,156,587 | 0 | 1 | Apache-2.0 | 2020-02-12T01:52:47 | 2019-12-19T23:45:32 | null | UTF-8 | Java | false | false | 3,366 | java | /*
* Copyright 2014-2019 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.quicksight.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.quicksight.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* DeleteDataSetResult JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DeleteDataSetResultJsonUnmarshaller implements Unmarshaller<DeleteDataSetResult, JsonUnmarshallerContext> {
public DeleteDataSetResult unmarshall(JsonUnmarshallerContext context) throws Exception {
DeleteDataSetResult deleteDataSetResult = new DeleteDataSetResult();
deleteDataSetResult.setStatus(context.getHttpResponse().getStatusCode());
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return deleteDataSetResult;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("Arn", targetDepth)) {
context.nextToken();
deleteDataSetResult.setArn(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("DataSetId", targetDepth)) {
context.nextToken();
deleteDataSetResult.setDataSetId(context.getUnmarshaller(String.class).unmarshall(context));
}
if (context.testExpression("RequestId", targetDepth)) {
context.nextToken();
deleteDataSetResult.setRequestId(context.getUnmarshaller(String.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return deleteDataSetResult;
}
private static DeleteDataSetResultJsonUnmarshaller instance;
public static DeleteDataSetResultJsonUnmarshaller getInstance() {
if (instance == null)
instance = new DeleteDataSetResultJsonUnmarshaller();
return instance;
}
}
| [
""
] | |
80c3a7f00b70963e4817d9d9d9fee89a0ff31d30 | 06e43d5905014e23dbd730a8a35b7bdf839dd22f | /src/main/ShoppingCart.java | 9040c5f67abc3d7c5c8ffe73cc9416069ccb9dac | [] | no_license | HayTran94/home-test | d2f7f2d734c8e4dc83c6e5844f82dca0dfe3daa9 | feb452d74313bae3283467971498b4f372068244 | refs/heads/master | 2022-04-21T16:07:55.979221 | 2020-04-19T08:29:22 | 2020-04-19T08:29:22 | 197,815,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,552 | java | package main;
import java.util.HashMap;
/**
* This class represent a shopping cart has a associated user and many cart item.
* @see User
* @see CartItem
* @author Hay Tran Van
*/
public class ShoppingCart {
private User user;
private HashMap<String, CartItem> cartItems;
/**
* The constructor of the ShoppingCart class.
* @param user A user instance.
*/
public ShoppingCart(User user) {
this.user = user;
this.cartItems = new HashMap<>();
}
/**
* Return the user instance of this shopping cart.
* @return A user instance.
*/
public User getUser() {
return user;
}
/**
* Set a user instance for this shopping cart.
* @param user A user instance.
*/
public void setUser(User user) {
this.user = user;
}
/**
* This method add a product to this shopping cart along with its quantity.
* @param product A product instance.
* @param number A int value specify the number of the product.
*/
public void addProduct(Product product, int number) {
CartItem cartItem = cartItems.get(product.getName());
if (cartItem == null) {
CartItem newCartItem = new CartItem(product, number);
cartItems.put(product.getName(), newCartItem);
} else {
cartItem.increaseQty(number);
}
}
/**
* This method remove a product from this shopping cart along with its quantity.
* @param product A product instance.
* @param number A int value specify the number of the product.
* @throws Exception A exception when the given product is not exist in the shopping cart.
*/
public void removeProduct(Product product, int number) throws Exception {
CartItem cartItem = cartItems.get(product.getName());
if (cartItem == null) {
throw new Exception("The given product is not exist in the shopping cart");
} else {
if (cartItem.getQty() == number) {
cartItems.remove(product.getName());
} else {
cartItem.decreaseQty(number);
}
}
}
/**
* Calculate total price for this shopping cart.
* @return A double value specify the total price for the shopping cart.
*/
public double calculateTotalPrice() {
double totalPrice = 0;
for (CartItem cartItem : cartItems.values()) {
totalPrice += cartItem.calculateTotalPrice();
}
return totalPrice;
}
}
| [
"[email protected]"
] | |
3fb8b7512a8dad161feebc468fb02385f4792807 | ec489a71283ef8bb6e20cbf82fe7c26cc372c339 | /backend/src/main/java/com/web/curation/team/challenge/TeamChallengeDao.java | 83edf15f38cd36e5fbe97f0f4242de0540744d1f | [] | no_license | h982/SNS-Project | 9f907a1ba2df5070d8bceb47e7b75d4051e463a5 | 3f859d38a044dcbcca90f566d48945cd23d1d730 | refs/heads/master | 2023-07-28T04:47:59.084634 | 2021-08-06T07:13:38 | 2021-08-06T07:13:38 | 397,934,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 427 | java | package com.web.curation.team.challenge;
import java.util.List;
import java.util.Optional;
import com.web.curation.team.Team;
import org.springframework.data.jpa.repository.JpaRepository;
import com.web.curation.member.Member;
import com.web.curation.team.TeamDto;
public interface TeamChallengeDao extends JpaRepository<TeamChallenge, Integer>{
public Optional<List<TeamChallenge>> findTeamChallengeByTeam(Team team);
}
| [
"[email protected]"
] | |
1304c840b06ae01bbca6472832b572946de2bde1 | 36aa7c3cb267ecfd51c2ba0548409c5785988cf1 | /DFS-Backtracking/Word Break II.java | 0565f8ae63840cd2bde2ee37573a99dac3337a27 | [] | no_license | yiyiyayahu/2nd_round | 122f43116ce9f65ff1ca2aea0762e798194489f0 | 9f2a71405440c67086887e4360959fbb50b6c619 | refs/heads/master | 2020-04-06T16:11:16.217941 | 2016-09-14T18:17:52 | 2016-09-14T18:17:52 | 37,892,776 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,794 | java | /*
Given a string s and a dictionary of words dict,
add spaces in s to construct a sentence where each word is a valid dictionary word.
Return all such possible sentences.
For example, given
s = "catsanddog",
dict = ["cat", "cats", "and", "sand", "dog"].
A solution is ["cats and dog", "cat sand dog"].
*/
/*
这道题其实是DFS加剪枝,剪枝的时候要用到DP (word break I主要就是DP)
如果直接DFS的话有很多重复计算,会TLE的
剪枝用DP,notFound[i]表示在(i+1,n)的区间里找不到可能的分解方法,如果是true的话,找到i就可以停止不用找下去了
helper里面就是从当前开始的index往后找,找到一个放到sb里面,接着从当前的i+1开始再调用helper函数
*/
public class Solution {
public List<String> wordBreak(String s, Set<String> wordDict) {
List<String> list = new ArrayList<String>();
boolean[] notFound = new boolean[s.length()];
helper(s, 0, wordDict, new StringBuilder(), notFound, list);
return list;
}
public void helper(String s, int index, Set<String> wordDict, StringBuilder sb, boolean[] notFound, List<String> list) {
if(index == s.length()) {
sb.deleteCharAt(sb.length() - 1);
list.add(sb.toString());
return;
}
for(int i = index; i < s.length(); i++) {
String sub = s.substring(index, i+1);
StringBuilder tmp = new StringBuilder(sb);
if(wordDict.contains(sub) && !notFound[i]) {
sb.append(sub).append(" ");
int presize = list.size();
helper(s, i+1, wordDict, sb, notFound, list);
if(list.size() == presize) notFound[i] = true;
sb = tmp;
}
}
}
}
| [
"[email protected]"
] | |
3529e6a95f26abdaaa5ff50a74d5a53ebdeb8625 | 80166124a93de3e0fb920bcb4e4948bc2df2bdd0 | /app/src/main/java/com/video2brain/holamundo/ManejoEstilos.java | 42d05ef46d18ad6f039a6ab4465c70ec9fb40268 | [] | no_license | QiqeMtz/AndroidStudioExample | bb0fc3f33ab0ef6eb290293ad6fee7f8d37f2b50 | 0a406c62e3c3c03599a6b4fb56633f9393b67d5b | refs/heads/master | 2021-01-10T16:07:35.021604 | 2015-11-03T03:29:07 | 2015-11-03T03:29:07 | 45,439,307 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,030 | java | package com.video2brain.holamundo;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
public class ManejoEstilos extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_manejo_estilos);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
findViewById(R.id.button9).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.i("Mensaje LogCat", "Hola, acabas de presionar el boton regresar a Home");
startActivity(new Intent(ManejoEstilos.this, HolaMundo.class));
}
});
}
}
| [
"[email protected]"
] | |
298f42004b011136eb37a8fd6b359d59a353bd0b | 72e99212693a0a916fd729b9b66490fe15a7b036 | /app/src/main/java/com/kongdy/hasee/magicsound/MainActivity.java | 83f2b62f78924f1a334951eeec30eab786d7cd07 | [] | no_license | Kongdy/MagicSound | 8073f675dfda55129594f10fab2f5c861a1ad44d | 200c013fee0ad192b64684eee2cf9bba703164ab | refs/heads/master | 2020-05-22T21:23:49.471124 | 2017-03-12T12:55:51 | 2017-03-12T12:55:51 | 84,725,437 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,042 | java | package com.kongdy.hasee.magicsound;
import android.os.Environment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import com.kongdy.hasee.magicsound.voicehelp.Voicer;
import java.io.File;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void btnClick(View v) {
String path = Environment.getExternalStorageDirectory().getAbsolutePath()+ File.separatorChar+"testSound.wma";
switch (v.getId()) {
case R.id.btn_org:
toast("原声");
break;
case R.id.btn_girl:
toast("女声");
Voicer.fix(path,Voicer.MODE_GRIL);
break;
}
}
private void toast(CharSequence text) {
Toast.makeText(this,text,Toast.LENGTH_SHORT).show();
}
}
| [
"[email protected]"
] | |
3f279f855545203e74b1a74978f07bf1c73a883c | ddb80863990d1563b850da6b1fb7aaee52e6466d | /runtime/citrus-testng/src/test/java/com/consol/citrus/integration/inject/ContextInjectionJavaIT.java | 198de4d074031fee655ac93e83c19f5fa746d809 | [
"Apache-2.0"
] | permissive | riteshjkeloth/citrus | 60e59bbb3e30307b2e53477d2714c1e8eb09f73f | 7d29c01b71ee15a9cb5ec311f54a39396eceaab8 | refs/heads/master | 2021-03-28T00:35:23.900504 | 2020-03-16T21:20:40 | 2020-03-16T21:20:40 | 247,821,050 | 0 | 0 | Apache-2.0 | 2020-03-16T21:36:16 | 2020-03-16T21:36:16 | null | UTF-8 | Java | false | false | 1,917 | java | /*
* Copyright 2006-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.consol.citrus.integration.inject;
import com.consol.citrus.annotations.CitrusResource;
import com.consol.citrus.annotations.CitrusTest;
import com.consol.citrus.context.TestContext;
import com.consol.citrus.testng.TestNGCitrusSupport;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import static com.consol.citrus.actions.EchoAction.Builder.echo;
/**
* @author Christoph Deppisch
* @since 2.5
*/
public class ContextInjectionJavaIT extends TestNGCitrusSupport {
@Test
@Parameters("context")
@CitrusTest
public void contextInjection(@Optional @CitrusResource TestContext context) {
context.setVariable("message", "Injection worked!");
run(echo("${message}"));
}
@Test(dataProvider = "testData")
@Parameters({ "data", "context" })
@CitrusTest
public void contextInjectionCombinedWithParameters(String data, @CitrusResource TestContext context) {
context.setVariable("message", "Injection worked!");
run(echo("${message}"));
run(echo("${data}"));
}
@DataProvider
public Object[][] testData() {
return new Object[][] { { "hello", null }, { "bye", null } };
}
}
| [
"[email protected]"
] | |
8e9f4c2381512dcbc7e25632850f909bfa5c391f | cc0439b02147d47b2694d7c2e5ce771849ced874 | /Clase03/ConsultarClientes/src/consultarclientes/view/ClienteView.java | 80ea6c5a698861936d8b8ad069101ffcf6fc77d1 | [] | no_license | albjoa/ISIL-EMP-JAVA-EE-001 | 3bf9de310fab3796d23ed3ede7701af2fe343b4d | d9c408ecbd65210be866911c184cfb0eb0ef94e9 | refs/heads/master | 2020-09-14T02:51:29.693491 | 2018-07-18T02:49:56 | 2018-07-18T02:49:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,284 | 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 consultarclientes.view;
import java.util.List;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import pe.egcc.eureka.dto.ClienteDto;
import pe.egcc.eureka.service.ClienteService;
/**
*
* @author Profesor
*/
public class ClienteView extends javax.swing.JFrame {
/**
* Creates new form ClienteView
*/
public ClienteView() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
txtPaterno = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
txtMaterno = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
txtNombre = new javax.swing.JTextField();
btnConsultar = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
tblRepo = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("CONSULTAR CLIENTES");
jLabel1.setText("Paterno");
jLabel2.setText("Materno");
jLabel3.setText("Nombre");
btnConsultar.setText("Consultar");
btnConsultar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnConsultarActionPerformed(evt);
}
});
tblRepo.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"CODIGO", "PATERNO", "MATERNO", "NOMBRE"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane1.setViewportView(tblRepo);
if (tblRepo.getColumnModel().getColumnCount() > 0) {
tblRepo.getColumnModel().getColumn(0).setResizable(false);
tblRepo.getColumnModel().getColumn(1).setResizable(false);
tblRepo.getColumnModel().getColumn(2).setResizable(false);
tblRepo.getColumnModel().getColumn(3).setResizable(false);
}
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 529, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)
.addComponent(txtPaterno))
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)
.addComponent(txtMaterno))
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)
.addComponent(txtNombre))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btnConsultar, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(12, 12, 12)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(1, 1, 1)
.addComponent(txtPaterno, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(1, 1, 1)
.addComponent(txtMaterno, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(1, 1, 1)
.addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(btnConsultar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 312, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnConsultarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConsultarActionPerformed
// Datos
String paterno = txtPaterno.getText();
String materno = txtMaterno.getText();
String nombre = txtNombre.getText();
// Proceso
ClienteService clienteService = new ClienteService();
List<ClienteDto> lista = clienteService.getClientes(paterno, materno, nombre);
if( clienteService.getCode() == -1){
JOptionPane.showMessageDialog(rootPane, clienteService.getError(),
"ERROR", JOptionPane.ERROR_MESSAGE);
return;
}
// Mostrar lista
DefaultTableModel tabla;
tabla = (DefaultTableModel) tblRepo.getModel();
tabla.setRowCount(0);
for (ClienteDto dto : lista) {
Object[] rowData = {dto.getCodigo(), dto.getPaterno(), dto.getMaterno(), dto.getNombre()};
tabla.addRow(rowData);
}
}//GEN-LAST:event_btnConsultarActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(ClienteView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ClienteView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ClienteView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ClienteView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ClienteView().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnConsultar;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable tblRepo;
private javax.swing.JTextField txtMaterno;
private javax.swing.JTextField txtNombre;
private javax.swing.JTextField txtPaterno;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
04d223e710d21dfb7ffa43fd80a569dff85b5570 | 86085b40ea56999dfa8d7f1ccb9b3966230f0d60 | /src/debugger/ClaseDebug.java | 1d5cb9d1457d20122896d186b3c190f6bdc167c9 | [] | no_license | dario1227/Progra-2-Algoritmos | 9067e84d05832fb07ea86de4cb26e0b9d1d2e2bb | 6c4bf87858ac10f938b5374ccd61098973a38bff | refs/heads/master | 2021-07-20T17:24:12.408045 | 2017-10-31T02:15:33 | 2017-10-31T02:15:33 | 104,790,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,025 | java | package debugger;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IThread;
public class ClaseDebug {
public static int leerdebug() throws DebugException {
try {
DebugPlugin plugin = DebugPlugin.getDefault();
ILaunchManager manager = plugin.getLaunchManager();
IDebugTarget[] target = manager.getDebugTargets();
// System.out.println(target[0].getThreads()[4].getStackFrames()[0].getLineNumber());
return target[0].getThreads()[4].getStackFrames()[0].getLineNumber();
// int x = 0;
//
// for(IThread stack: target[0].getThreads() ) {
// System.out.println(x);
// try {
// return target[0].getThreads()[4].getStackFrames()[0].getLineNumber();
// }catch(Exception e)
// {
// return 0;
// }
//
//
// }
}catch(Exception e ){
return 0;
}
}
}
| [
"kenne@LAPTOP-C41V0LJ6"
] | kenne@LAPTOP-C41V0LJ6 |
a475701d4f5cb8e50e00a894f4b373147a1c0e84 | 5b435c231f53ecb59c5ca7f4d1200bae17f7c476 | /common/src/androidTest/java/com/example/windpush/comment/ApplicationTest.java | 969d235564f52e2fc3d2c43e2a77fbce2d453a8f | [] | no_license | windpush/fknote | 45cdc521691fd30a1604a4f910dff221e53e1569 | 4756cd902daa8f765fb0b248b6b76c4291bd1393 | refs/heads/master | 2021-01-09T20:17:42.592742 | 2016-05-29T06:07:45 | 2016-05-29T06:07:45 | 59,924,903 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | package com.example.windpush.comment;
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);
}
} | [
"[email protected]"
] | |
f32ff7cf76234aadd4c7075ca5d4415ff74592cb | d369fb31d098d648dae20322e4bddae186998ab4 | /AdminPassword.java | a09fdaac3279a7a4242ed728604026524a48a060 | [] | no_license | sidlebj/CSE201 | ed96f536c219c68285e3abce927734aa7e8ec290 | 93d5c1a22d2c8e7a01990e6f1101dda725b32336 | refs/heads/master | 2021-01-21T13:18:24.188117 | 2016-05-05T03:46:55 | 2016-05-05T03:46:55 | 52,320,832 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,551 | java | import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Arrays;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.border.EmptyBorder;
public class AdminPassword extends JFrame {
private JPasswordField password;
private JPanel contentPane;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
AdminPassword frame = new AdminPassword();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public AdminPassword() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel(null);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
password = new JPasswordField(10);
password.setPreferredSize(new Dimension(10, 40));
JButton enter = new JButton("Enter");
JButton back = new JButton("Back");
JLabel label = new JLabel("Enter admin password: ");
label.setLabelFor(password);
enter.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (isCorrect(password.getPassword())) {
dispose();
EnterAllCourses enter = new EnterAllCourses();
enter.setVisible(true);
}
else {
password.setText("");
JOptionPane.showMessageDialog(contentPane, "Incorrect Password,"
+ " try again");
}
}
});
back.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
ChooseUser user = new ChooseUser();
user.setVisible(true);
}
});
password.setSize(200, 30);
password.setLocation(125, 100);
enter.setSize(70, 30);
enter.setLocation(320, 100);
back.setSize(70, 30);
back.setLocation(380, 250);
label.setLocation(129, 65);
label.setSize(200, 50);
contentPane.add(label);
contentPane.add(password);
contentPane.add(enter);
contentPane.add(back);
setContentPane(contentPane);
}
public boolean isCorrect (char[] password) {
char[] correctPassword = {'M', 'U', 'c', 's', 'e'};
boolean isCorrect;
if (password.length != correctPassword.length) {
isCorrect = false;
} else {
isCorrect = Arrays.equals(password, correctPassword);
}
return isCorrect;
}
}
| [
"[email protected]"
] | |
1779bc7809d7d53570881c07cee7ee5dcbc9f434 | 70077d0e08d9a18bff355929ee18cb88031392a9 | /app/src/androidTest/java/kr/hs/emirim/w2026/project7_2/ExampleInstrumentedTest.java | 8771a6b5739aebaafdcf989e50fe61519d09c86f | [] | no_license | Winni-Lina/Project7_2 | 19b4ac1faa2f0c336ae41bec67e0d4159f95d9eb | d8269e11aa27a2172062ddab90c9e7f67c26aa2b | refs/heads/master | 2023-06-24T10:16:09.818003 | 2021-07-22T04:45:28 | 2021-07-22T04:45:28 | 388,306,169 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 772 | java | package kr.hs.emirim.w2026.project7_2;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("kr.hs.emirim.w2026.project7_2", appContext.getPackageName());
}
} | [
"[email protected]"
] | |
fa6367464cb7e2a568a2eabe352584c411b10831 | caf3d013e54b21bd1874f4abb6fc1d67268a9329 | /src/test/java/findElement/CaptureWebpage.java | f7cb4984713f8121ed071bae15666e7058941f7f | [] | no_license | phattest/selenium-java | c79cce35e8731f48e8ffaedd9c205aa7efc68a34 | 975dc7d083e3028c90876fd99bc9b0739f901fb5 | refs/heads/master | 2023-01-11T01:10:18.252282 | 2020-11-14T07:57:57 | 2020-11-14T07:57:57 | 306,807,954 | 0 | 0 | null | 2020-11-16T15:46:29 | 2020-10-24T04:50:22 | Java | UTF-8 | Java | false | false | 879 | java | package findElement;
import io.github.bonigarcia.wdm.WebDriverManager;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
import java.io.File;
import java.io.IOException;
public class CaptureWebpage {
@Test
void captureWebPage(){
WebDriverManager.chromedriver().setup();
WebDriver driver = new ChromeDriver();
driver.get("https://google.com.vn");
File screenshot =((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
try {
FileUtils.copyFile(screenshot, new File("./target/screenshot-google-"+System.currentTimeMillis()+".png"));
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
427c00db46f347f6ae58f97e8ea644615d3d37ee | a018a4b39471f2ee8d17e47cc91b4082b7cf44b8 | /code/Web/src/test/java/com.bis.web.controller/ItemsControllerTest.java | f9b65c3e252dddddd7e252d47ca5d559bee0c983 | [] | no_license | dspraveen/BIS | f597d76e7bb6c6f2f3597e9b8072cbcc8657555b | 1d7897f00feda8aafacec2b45bb89384349a2ccb | refs/heads/master | 2021-01-20T21:20:48.345993 | 2012-02-05T13:49:49 | 2012-02-05T13:49:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,210 | java | package com.bis.web.controller;
import com.bis.core.services.ItemMasterService;
import com.bis.domain.Item;
import com.bis.domain.ItemCycle;
import com.bis.domain.ItemReturnType;
import com.bis.testcommon.ItemBuilder;
import com.bis.web.viewmodel.ItemList;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.servlet.ModelAndView;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
public class ItemsControllerTest {
@Mock
private ItemMasterService itemMasterService;
@Mock
private BindingResult bindingResult;
@Mock
private Model model;
private ItemsController controller;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
controller = new ItemsController(itemMasterService);
}
@Test
public void shouldGetItemModelAndViewForGivenItemCode() {
int itemCode = 12;
Item item = new Item();
item.setItemCode(itemCode);
when(itemMasterService.get(itemCode)).thenReturn(item);
ModelAndView modelAndView = controller.show(itemCode);
Item itemModel = (Item) modelAndView.getModel().get("item");
Assert.assertEquals(item, itemModel);
assertEquals("item/show", modelAndView.getViewName());
}
@Test
public void shouldGetCreateItemForm() {
ModelAndView modelAndView = controller.createForm();
Item item = (Item) modelAndView.getModel().get("item");
Assert.assertNull(item.getItemCode());
assertEquals("item/createForm", modelAndView.getViewName());
}
@Test
public void shouldGetUpdateItemForm() {
int itemCode = 12;
Item item = new Item();
item.setItemCode(itemCode);
when(itemMasterService.get(itemCode)).thenReturn(item);
ModelAndView modelAndView = controller.updateForm(itemCode);
Item itemModel = (Item) modelAndView.getModel().get("item");
assertEquals(item, itemModel);
assertEquals("item/updateForm", modelAndView.getViewName());
}
@Test
public void shouldCreateNewItem() {
Item item = new Item();
item.setItemCode(12);
String result = controller.create(item, bindingResult, model);
assertEquals("redirect:/item/show/12", result);
verify(itemMasterService).create(item);
}
@Test
public void shouldUpdateItem() {
Item item = new Item();
item.setItemCode(12);
String result = controller.update(item, bindingResult, model);
assertEquals("redirect:/item/show/12", result);
verify(itemMasterService).update(item);
}
@Test
public void shouldGetListOfItemTypes() {
Map<Character, String> itemTypes = controller.itemTypes();
assertEquals(ItemCycle.WEEKLY.toString(), itemTypes.get(ItemCycle.WEEKLY.getCode()));
assertEquals(ItemCycle.FORTNIGHT.toString(), itemTypes.get(ItemCycle.FORTNIGHT.getCode()));
assertEquals(ItemCycle.MONTHLY.toString(), itemTypes.get(ItemCycle.MONTHLY.getCode()));
}
@Test
public void shouldGetListOfItemReturnTypes() {
Map<Character, String> itemReturnTypes = controller.itemReturnTypes();
assertEquals(ItemReturnType.YES.toString(), itemReturnTypes.get(ItemReturnType.YES.getCode()));
assertEquals(ItemReturnType.NO.toString(), itemReturnTypes.get(ItemReturnType.NO.getCode()));
}
@Test
public void shouldGetListOfItems() {
Item itemOne = new ItemBuilder().withDefaults().setItemCode(0).setName("pqr").build();
Item itemTwo = new ItemBuilder().withDefaults().setItemCode(1).setName("abc").build();
ArrayList<Item> items = new ArrayList<Item>();
items.add(itemOne);
items.add(itemTwo);
when(itemMasterService.getAll()).thenReturn(items);
ModelAndView modelAndView = controller.list(1);
ItemList itemList = (ItemList) modelAndView.getModel().get("itemList");
assertEquals(2, itemList.getCount());
assertEquals(1, itemList.getSelectedItemCode());
assertEquals(itemTwo.getItemName(), itemList.getItems().get(0).getItemName());
assertEquals(itemOne.getItemName(), itemList.getItems().get(1).getItemName());
assertEquals(itemTwo, itemList.getSelectedItem());
}
@Test
public void shouldGetItemPriceJson() throws IOException {
MockHttpServletResponse response = new MockHttpServletResponse();
Item item = new Item();
item.setDefaultPrice(10f);
when(itemMasterService.get(1)).thenReturn(item);
controller.getItemPrice(1,response);
Assert.assertEquals("{\"price\":10.0}",response.getContentAsString());
}
}
| [
"[email protected]"
] | |
49aa8d4acb2dac55f2a9080df5e389f72792c5af | fba04ebb561eedd5fa53908dd068598967357b36 | /SellMe/src/com/younes/sellme/ActivityProductDetails.java | 8e981a2353066276b8e6d3892dbab0eb74462b2e | [] | no_license | Eyad-Alama/younes | f89ba9380fdf7545bd35404fb51002a8acb317df | 7716cdfb18737ca29ed5a396dba0f42811e7dd48 | refs/heads/master | 2021-01-02T09:37:47.227479 | 2014-06-08T14:31:23 | 2014-06-08T14:31:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,407 | java | package com.younes.sellme;
import java.util.List;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.parse.FindCallback;
import com.parse.GetDataCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseUser;
public class ActivityProductDetails extends Activity {
ImageView ivImage;
TextView tvDesc;
TextView tvProductCondition;
TextView tvProductPrice;
LinearLayout llAddToCart;
ParseObject Product;
Bitmap bmp;
private Context mContext;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_product_details);
mContext = this;
ivImage = (ImageView) findViewById(R.id.ivImage);
tvDesc = (TextView) findViewById(R.id.tvDesc);
tvProductCondition = (TextView) findViewById(R.id.tvProductCondition);
tvProductPrice = (TextView) findViewById(R.id.tvProductPrice);
llAddToCart = (LinearLayout) findViewById(R.id.llAddToCart);
llAddToCart.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Cart");
query.whereEqualTo("prod_id",Product.getObjectId());
query.whereEqualTo("userID",ParseUser.getCurrentUser().getObjectId());
Log.d("prod_id", Product.getObjectId());
Log.d("userID", ParseUser.getCurrentUser().getObjectId());
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> scoreList, ParseException e) {
if (e == null) {
if(scoreList.size() !=0)
{
ParseObject ob = scoreList.get(0);
ob.increment("quantity");
ob.saveInBackground();
Toast.makeText(mContext, "Item Added to cart !", Toast.LENGTH_SHORT).show();
}
else
{
ParseObject object = new ParseObject("Cart");
object.put("prod_id", MyApplication.Product.getObjectId());
object.put("quantity",1);
object.put("userID", ParseUser.getCurrentUser().getObjectId());
object.saveInBackground();
Toast.makeText(mContext, "Item Added to cart !", Toast.LENGTH_SHORT).show();
}
} else {
Log.d("score", "Error: " + e.getMessage());
}
}
});
}
});
Product= MyApplication.Product;
tvProductCondition.setText(Product.getString("Condition"));
tvProductPrice.setText("RM " + Product.getInt("Price"));
tvDesc.setText(Product.getString("Description"));
ParseFile applicantResume = (ParseFile)Product.get("Image");
applicantResume.getDataInBackground(new GetDataCallback() {
public void done(byte[] data, ParseException e) {
if (e == null) {
bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
ivImage.setImageBitmap(bmp);
Bitmap ss = bmp;
} else {
// something went wrong
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.product_details, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
if(id == R.id.action_cart)
{
Intent cartInt = new Intent(mContext, ActivityCart.class);
mContext.startActivity(cartInt);
}
return super.onOptionsItemSelected(item);
}
}
| [
"[email protected]"
] | |
7070d15219cb86108f8644f4f7518eacc33b1b7a | fc6c869ee0228497e41bf357e2803713cdaed63e | /weixin6519android1140/src/sourcecode/com/tencent/xweb/x5/j.java | afe4d2dba384a85ec97ec8f9189c55ce9af63173 | [] | no_license | hyb1234hi/reverse-wechat | cbd26658a667b0c498d2a26a403f93dbeb270b72 | 75d3fd35a2c8a0469dbb057cd16bca3b26c7e736 | refs/heads/master | 2020-09-26T10:12:47.484174 | 2017-11-16T06:54:20 | 2017-11-16T06:54:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,518 | java | package com.tencent.xweb.x5;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebSettings.RenderPriority;
import com.tencent.smtt.sdk.WebSettings;
import com.tencent.smtt.sdk.WebSettings.TextSize;
import com.tencent.smtt.sdk.WebView;
import com.tencent.xweb.l;
import com.tencent.xweb.l.a;
public final class j
extends l
{
WebView yoR;
public j(WebView paramWebView)
{
this.yoR = paramWebView;
}
public final void a(l.a parama)
{
try
{
this.yoR.getSettings().setTextSize(WebSettings.TextSize.valueOf(parama.name()));
return;
}
finally
{
parama = finally;
throw parama;
}
}
public final void crX()
{
this.yoR.getSettings().setDisplayZoomControls(false);
}
public final void crY()
{
this.yoR.getSettings().setSaveFormData(false);
}
public final void crZ()
{
this.yoR.getSettings().setJavaScriptEnabled(false);
}
public final void csa()
{
this.yoR.getSettings().setDefaultFontSize(8);
}
public final void csb()
{
this.yoR.getSettings().setJavaScriptEnabled(true);
}
public final void csc()
{
this.yoR.getSettings().setAppCacheMaxSize(10485760L);
}
public final void csd()
{
this.yoR.getSettings().setDatabaseEnabled(true);
}
public final void cse()
{
this.yoR.getSettings().setDomStorageEnabled(true);
}
public final void csf()
{
this.yoR.getSettings().setCacheMode(-1);
}
public final void csg()
{
this.yoR.getSettings().setMixedContentMode(0);
}
public final String getUserAgentString()
{
return this.yoR.getSettings().getUserAgentString();
}
public final void setAppCachePath(String paramString)
{
this.yoR.getSettings().setAppCachePath(paramString);
}
public final void setBuiltInZoomControls(boolean paramBoolean)
{
this.yoR.getSettings().setBuiltInZoomControls(paramBoolean);
}
public final void setDatabasePath(String paramString)
{
this.yoR.getSettings().setDatabasePath(paramString);
}
public final void setDefaultTextEncodingName(String paramString)
{
this.yoR.getSettings().setDefaultTextEncodingName(paramString);
}
public final void setGeolocationEnabled(boolean paramBoolean)
{
this.yoR.getSettings().setJavaScriptEnabled(paramBoolean);
}
public final void setJavaScriptCanOpenWindowsAutomatically(boolean paramBoolean)
{
this.yoR.getSettings().setJavaScriptCanOpenWindowsAutomatically(paramBoolean);
}
public final void setJavaScriptEnabled(boolean paramBoolean)
{
this.yoR.getSettings().setJavaScriptEnabled(paramBoolean);
}
public final void setLayoutAlgorithm(WebSettings.LayoutAlgorithm paramLayoutAlgorithm)
{
paramLayoutAlgorithm = com.tencent.smtt.sdk.WebSettings.LayoutAlgorithm.values()[paramLayoutAlgorithm.ordinal()];
this.yoR.getSettings().setLayoutAlgorithm(paramLayoutAlgorithm);
}
public final void setLoadWithOverviewMode(boolean paramBoolean)
{
this.yoR.getSettings().setLoadWithOverviewMode(paramBoolean);
}
public final void setLoadsImagesAutomatically(boolean paramBoolean)
{
this.yoR.getSettings().setLoadsImagesAutomatically(paramBoolean);
}
public final void setMediaPlaybackRequiresUserGesture(boolean paramBoolean)
{
this.yoR.getSettings().setMediaPlaybackRequiresUserGesture(paramBoolean);
}
public final void setPluginsEnabled(boolean paramBoolean)
{
this.yoR.getSettings().setPluginsEnabled(paramBoolean);
}
public final void setRenderPriority(WebSettings.RenderPriority paramRenderPriority)
{
paramRenderPriority = com.tencent.smtt.sdk.WebSettings.RenderPriority.values()[paramRenderPriority.ordinal()];
this.yoR.getSettings().setRenderPriority(paramRenderPriority);
}
public final void setSupportZoom(boolean paramBoolean)
{
this.yoR.getSettings().setSupportZoom(paramBoolean);
}
public final void setTextZoom(int paramInt)
{
this.yoR.getSettings().setTextZoom(paramInt);
}
public final void setUseWideViewPort(boolean paramBoolean)
{
this.yoR.getSettings().setUseWideViewPort(paramBoolean);
}
public final void setUserAgentString(String paramString)
{
this.yoR.getSettings().setUserAgentString(paramString);
}
}
/* Location: D:\tools\apktool\weixin6519android1140\jar\classes3-dex2jar.jar!\com\tencent\xweb\x5\j.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
] | |
5c358e2c88050c96eec0f022657baa727ff77edd | cc21fa7967976e600ae004eca79c97c704d1b73e | /backend/src/main/java/com/tuannx/webtimviec/service/JobRequireSkillService.java | 5c07429984ef536cb8014a100b45dabe522dacc2 | [] | no_license | tuannx2106/webtimviec_KLTN | 944a413fe5c92a387c84380acf2693953bfbcab9 | 451c9df69f49c42809db983bd64d78f0a0a63de9 | refs/heads/master | 2022-12-12T08:31:31.934742 | 2019-07-10T15:03:38 | 2019-07-10T15:03:38 | 188,041,119 | 0 | 0 | null | 2022-12-10T00:08:43 | 2019-05-22T13:09:22 | HTML | UTF-8 | Java | false | false | 1,338 | java | package com.tuannx.webtimviec.service;
import com.tuannx.webtimviec.model.Identity.JobRequireSkillId;
import com.tuannx.webtimviec.model.JobRequireSkill;
import com.tuannx.webtimviec.repository.JobRequireSkillRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
@Service
public class JobRequireSkillService {
@Autowired
JobRequireSkillRepository jobRequireSkillRepository;
public List<JobRequireSkill> findAll() {
return jobRequireSkillRepository.findAll();
}
public Optional<JobRequireSkill> getJobRequireSkill(JobRequireSkillId jobRequireSkillId)
{
return jobRequireSkillRepository.findById(jobRequireSkillId);
}
public void saveJobRequireSkill(JobRequireSkill jobRequireSkill) {
jobRequireSkillRepository.save(jobRequireSkill);
}
public void deleteJobRequireSkill(JobRequireSkillId jobRequireSkillId) {
Optional<JobRequireSkill> optionalJobRequireSkill = getJobRequireSkill(jobRequireSkillId);
if(optionalJobRequireSkill.isPresent()) {
JobRequireSkill jobRequireSkill = optionalJobRequireSkill.get();
jobRequireSkillRepository.delete(jobRequireSkill);
}
else
{
}
}
}
| [
"[email protected]"
] | |
2630481580ffe9fd38f1142cbeb972237e32d621 | 19d673734bf30b0e06f6d577e1ad3b63e356b414 | /app/src/test/java/com/app/graduationproject/ExampleUnitTest.java | d9e635e7e1e9851d0603e86c5e81c78c346a445f | [
"Apache-2.0"
] | permissive | ahaliulang/Graduation-Project | 0ef4b2ffd3d5f234c6ab6f0a2e7e1ffb11446ea1 | daf11d89bff9a54a830578f7bb30a98abff206b0 | refs/heads/master | 2021-01-11T04:02:57.754504 | 2017-04-11T03:26:28 | 2017-04-11T03:26:28 | 71,230,845 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 318 | java | package com.app.graduationproject;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
7e8b98fb6c0a1bc1b8984602075fb12145afb479 | 9e8cbd8809454916e909385f1254725982310785 | /KarmelExerzitien/src/at/karmel/karmelexerzitien/DayFragment.java | 5b6214e55370ba8d1eab4138f58c2d73858cebee | [] | no_license | Christophorus3/KarmelExerzitien-Android | d2991fd3c35ec3e526ab1c5cc3992a604fe97f68 | 9ec7550a2861946f51996d34aa0c98bb9c90f1cd | refs/heads/master | 2020-05-28T03:32:37.161810 | 2019-05-27T15:34:25 | 2019-05-27T15:34:25 | 188,867,784 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,185 | java | package at.karmel.karmelexerzitien;
import java.io.IOException;
import java.io.InputStream;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
public class DayFragment extends Fragment implements OnClickListener{
public Day day;
public DayFragment() {
}
public static DayFragment newInstance(Day day) {
DayFragment fragment = new DayFragment();
fragment.day = day;
return fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
ViewGroup rootView = (ViewGroup)inflater.inflate(R.layout.fragment_day_index, container, false);
//find all elements in Fragment View
ImageView poster = (ImageView)rootView.findViewById(R.id.posterImage);
TextView date = (TextView) rootView.findViewById(R.id.date);
TextView title = (TextView) rootView.findViewById(R.id.title);
Button impulseButton = (Button) rootView.findViewById(R.id.impulse);
Button gospelButton = (Button) rootView.findViewById(R.id.gospel);
gospelButton.setOnClickListener(this);
impulseButton.setOnClickListener(this);
date.setText(this.day.dateDescription());
title.setText(this.day.headline);
try {
InputStream is = getActivity().getAssets().open(day.number + ".jpg");
poster.setImageDrawable(Drawable.createFromStream(is, day.number + ".jpg"));
} catch (IOException e) {
}
return rootView;
}
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), ContentViewActivity.class);
switch (v.getId()) {
case R.id.impulse:
intent.putExtra(ContentViewActivity.URL, "file:///android_asset/" + day.number + ".html");
startActivity(intent);
break;
case R.id.gospel:
intent.putExtra(ContentViewActivity.URL, "file:///android_asset/" + day.number + "e.html");
startActivity(intent);
break;
}
}
}
| [
"[email protected]"
] | |
22f9aa14e3f7117b5c7aa664788b0012de3ddde7 | 5276166e2042d798cbca5f4683966874e6b2401d | /1-100/74.search-a-2-d-matrix.java | 584984f969a60ed7631d10bacc4fa60aaa82f818 | [
"MIT"
] | permissive | sumit4tech/leetcode-in-java | fd3633f0cdd30120470e328d10ff9db30341ae49 | 56185e6e3fbc1863e3a4108a812695802a0916ef | refs/heads/master | 2023-04-07T15:38:36.136226 | 2021-04-16T03:15:35 | 2021-04-16T03:15:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,026 | java | /*
* @lc app=leetcode id=74 lang=java
*
* [74] Search a 2D Matrix
*/
// @lc code=start
class Solution {
public boolean searchMatrix(int[][] matrix, int target) {
if (matrix.length == 0 || matrix[0].length == 0) {
return false;
}
int lo = 0;
int hi = matrix.length - 1;
while (lo <= hi) {
int mid = lo + (hi - lo) / 2;
if (matrix[mid][0] <= target) {
lo = mid + 1;
} else {
hi = mid - 1;
}
}
int row = hi;
if (row < 0) {
return false;
}
lo = 0;
hi = matrix[row].length - 1;
while (lo <= hi) {
int mid = lo + (hi - lo) / 2;
if (matrix[row][mid] < target) {
lo = mid + 1;
} else if (matrix[row][mid] == target) {
return true;
} else {
hi = mid - 1;
}
}
return false;
}
}
// @lc code=end
| [
"[email protected]"
] | |
73eb1eeb4739de14d5ddda64804f251bdc2db7f2 | 55d0460db45b8fcecfb12ee2fd7097cbc0a9964e | /Hotel Web/src/java/br/com/ufjf/dcc078/Controller/FrontController.java | 22c42bc88eaaee391a9cfd5437b6c4208388a23f | [] | no_license | andremagno06/ufjf-ddc078-trabalho1 | 76cff36a43a090227a9d9a1ffc008703cbeaa7e9 | 80828f778b0a5256a139650fcb30bd63193396d2 | refs/heads/master | 2021-08-19T10:07:49.141993 | 2017-11-25T21:29:49 | 2017-11-25T21:29:49 | 105,277,751 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,664 | 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.ufjf.dcc078.Controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author 07228620674
*/
public class FrontController extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
String action = request.getParameter("action");
Action actionObject = null;
if(action != null || action.equals("")){
actionObject = ActionFactory.create(action);
}
if(actionObject != null){
actionObject.execute(request, response);
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"[email protected]"
] | |
0970987d0429ed96a7221673b30a46a3552a8f09 | 0645feb3082ac9a25e0421e1684a992eef150121 | /app/src/main/java/ecarrara/eng/vilibra/domain/executor/ThreadExecutor.java | 6f87115290b910bd5a2f1ff5aae61d600a9cf823 | [
"MIT"
] | permissive | ecarrara-araujo/vilibra | acff27244173e17571f973821f172c23b130f32d | 089df9fe3dd4f33b5a79b1d75a03df90ef595456 | refs/heads/master | 2021-01-18T13:53:51.141960 | 2015-12-30T19:53:22 | 2016-01-11T11:51:17 | 39,380,991 | 12 | 2 | null | 2017-08-24T17:51:54 | 2015-07-20T11:53:11 | Java | UTF-8 | Java | false | false | 1,772 | java | package ecarrara.eng.vilibra.domain.executor;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* {@link Executor} implementation based on a ThreadPoolExecutor.
*
* This implementation is based on the reference implementation of Pedro Vicente
* on https://github.com/pedrovgs/EffectiveAndroidUI/blob/master/app/src/main/java/com/github/pedrovgs/effectiveandroidui/executor/ThreadExecutor.java
*/
public class ThreadExecutor implements Executor {
private static final int CORE_POOL_SIZE = 3;
private static final int MAX_POOL_SIZE = 5;
private static final int KEEP_ALIVE_TIME = 120;
private static final TimeUnit TIME_UNIT = TimeUnit.SECONDS;
private static final BlockingQueue<Runnable> WORK_QUEUE = new LinkedBlockingQueue<Runnable>();
private ThreadPoolExecutor threadPoolExecutor;
public ThreadExecutor() {
int corePoolSize = CORE_POOL_SIZE;
int maxPoolSize = MAX_POOL_SIZE;
int keepAliveTime = KEEP_ALIVE_TIME;
TimeUnit timeUnit = TIME_UNIT;
BlockingQueue<Runnable> workQueue = WORK_QUEUE;
threadPoolExecutor = new ThreadPoolExecutor(
corePoolSize,
maxPoolSize,
keepAliveTime,
timeUnit,
workQueue);
}
@Override public void execute(final Interactor interactor) {
if (interactor == null) {
throw new IllegalArgumentException("Interactor to execute can't be null");
}
threadPoolExecutor.submit(new Runnable() {
@Override public void run() {
interactor.operation();
}
});
}
}
| [
"[email protected]"
] | |
575f6da86cc3f15185e8fe393f553af8e873f61b | 4a5f24baf286458ddde8658420faf899eb22634b | /aws-java-sdk-waf/src/main/java/com/amazonaws/services/waf/model/RegexMatchTuple.java | d2356e7d09b4e69d64dd81c7310da62e6a483a5a | [
"Apache-2.0"
] | permissive | gopinathrsv/aws-sdk-java | c2876eaf019ac00714724002d91d18fadc4b4a60 | 97b63ab51f2e850d22e545154e40a33601790278 | refs/heads/master | 2021-05-14T17:18:16.335069 | 2017-12-29T19:49:30 | 2017-12-29T19:49:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 48,465 | java | /*
* Copyright 2012-2017 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.waf.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* The regular expression pattern that you want AWS WAF to search for in web requests, the location in requests that you
* want AWS WAF to search, and other settings. Each <code>RegexMatchTuple</code> object contains:
* </p>
* <ul>
* <li>
* <p>
* The part of a web request that you want AWS WAF to inspect, such as a query string or the value of the
* <code>User-Agent</code> header.
* </p>
* </li>
* <li>
* <p>
* The identifier of the pattern (a regular expression) that you want AWS WAF to look for. For more information, see
* <a>RegexPatternSet</a>.
* </p>
* </li>
* <li>
* <p>
* Whether to perform any conversions on the request, such as converting it to lowercase, before inspecting it for the
* specified string.
* </p>
* </li>
* </ul>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/waf-regional-2016-11-28/RegexMatchTuple" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class RegexMatchTuple implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* Specifies where in a web request to look for the <code>RegexPatternSet</code>.
* </p>
*/
private FieldToMatch fieldToMatch;
/**
* <p>
* Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to
* bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on
* <code>RegexPatternSet</code> before inspecting a request for a match.
* </p>
* <p>
* <b>CMD_LINE</b>
* </p>
* <p>
* When you're concerned that attackers are injecting an operating system commandline command and using unusual
* formatting to disguise some or all of the command, use this option to perform the following transformations:
* </p>
* <ul>
* <li>
* <p>
* Delete the following characters: \ " ' ^
* </p>
* </li>
* <li>
* <p>
* Delete spaces before the following characters: / (
* </p>
* </li>
* <li>
* <p>
* Replace the following characters with a space: , ;
* </p>
* </li>
* <li>
* <p>
* Replace multiple spaces with one space
* </p>
* </li>
* <li>
* <p>
* Convert uppercase letters (A-Z) to lowercase (a-z)
* </p>
* </li>
* </ul>
* <p>
* <b>COMPRESS_WHITE_SPACE</b>
* </p>
* <p>
* Use this option to replace the following characters with a space character (decimal 32):
* </p>
* <ul>
* <li>
* <p>
* \f, formfeed, decimal 12
* </p>
* </li>
* <li>
* <p>
* \t, tab, decimal 9
* </p>
* </li>
* <li>
* <p>
* \n, newline, decimal 10
* </p>
* </li>
* <li>
* <p>
* \r, carriage return, decimal 13
* </p>
* </li>
* <li>
* <p>
* \v, vertical tab, decimal 11
* </p>
* </li>
* <li>
* <p>
* non-breaking space, decimal 160
* </p>
* </li>
* </ul>
* <p>
* <code>COMPRESS_WHITE_SPACE</code> also replaces multiple spaces with one space.
* </p>
* <p>
* <b>HTML_ENTITY_DECODE</b>
* </p>
* <p>
* Use this option to replace HTML-encoded characters with unencoded characters. <code>HTML_ENTITY_DECODE</code>
* performs the following operations:
* </p>
* <ul>
* <li>
* <p>
* Replaces <code>(ampersand)quot;</code> with <code>"</code>
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)nbsp;</code> with a non-breaking space, decimal 160
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)lt;</code> with a "less than" symbol
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)gt;</code> with <code>></code>
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in hexadecimal format, <code>(ampersand)#xhhhh;</code>, with the
* corresponding characters
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in decimal format, <code>(ampersand)#nnnn;</code>, with the
* corresponding characters
* </p>
* </li>
* </ul>
* <p>
* <b>LOWERCASE</b>
* </p>
* <p>
* Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
* </p>
* <p>
* <b>URL_DECODE</b>
* </p>
* <p>
* Use this option to decode a URL-encoded value.
* </p>
* <p>
* <b>NONE</b>
* </p>
* <p>
* Specify <code>NONE</code> if you don't want to perform any text transformations.
* </p>
*/
private String textTransformation;
/**
* <p>
* The <code>RegexPatternSetId</code> for a <code>RegexPatternSet</code>. You use <code>RegexPatternSetId</code> to
* get information about a <code>RegexPatternSet</code> (see <a>GetRegexPatternSet</a>), update a
* <code>RegexPatternSet</code> (see <a>UpdateRegexPatternSet</a>), insert a <code>RegexPatternSet</code> into a
* <code>RegexMatchSet</code> or delete one from a <code>RegexMatchSet</code> (see <a>UpdateRegexMatchSet</a>), and
* delete an <code>RegexPatternSet</code> from AWS WAF (see <a>DeleteRegexPatternSet</a>).
* </p>
* <p>
* <code>RegexPatternSetId</code> is returned by <a>CreateRegexPatternSet</a> and by <a>ListRegexPatternSets</a>.
* </p>
*/
private String regexPatternSetId;
/**
* <p>
* Specifies where in a web request to look for the <code>RegexPatternSet</code>.
* </p>
*
* @param fieldToMatch
* Specifies where in a web request to look for the <code>RegexPatternSet</code>.
*/
public void setFieldToMatch(FieldToMatch fieldToMatch) {
this.fieldToMatch = fieldToMatch;
}
/**
* <p>
* Specifies where in a web request to look for the <code>RegexPatternSet</code>.
* </p>
*
* @return Specifies where in a web request to look for the <code>RegexPatternSet</code>.
*/
public FieldToMatch getFieldToMatch() {
return this.fieldToMatch;
}
/**
* <p>
* Specifies where in a web request to look for the <code>RegexPatternSet</code>.
* </p>
*
* @param fieldToMatch
* Specifies where in a web request to look for the <code>RegexPatternSet</code>.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RegexMatchTuple withFieldToMatch(FieldToMatch fieldToMatch) {
setFieldToMatch(fieldToMatch);
return this;
}
/**
* <p>
* Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to
* bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on
* <code>RegexPatternSet</code> before inspecting a request for a match.
* </p>
* <p>
* <b>CMD_LINE</b>
* </p>
* <p>
* When you're concerned that attackers are injecting an operating system commandline command and using unusual
* formatting to disguise some or all of the command, use this option to perform the following transformations:
* </p>
* <ul>
* <li>
* <p>
* Delete the following characters: \ " ' ^
* </p>
* </li>
* <li>
* <p>
* Delete spaces before the following characters: / (
* </p>
* </li>
* <li>
* <p>
* Replace the following characters with a space: , ;
* </p>
* </li>
* <li>
* <p>
* Replace multiple spaces with one space
* </p>
* </li>
* <li>
* <p>
* Convert uppercase letters (A-Z) to lowercase (a-z)
* </p>
* </li>
* </ul>
* <p>
* <b>COMPRESS_WHITE_SPACE</b>
* </p>
* <p>
* Use this option to replace the following characters with a space character (decimal 32):
* </p>
* <ul>
* <li>
* <p>
* \f, formfeed, decimal 12
* </p>
* </li>
* <li>
* <p>
* \t, tab, decimal 9
* </p>
* </li>
* <li>
* <p>
* \n, newline, decimal 10
* </p>
* </li>
* <li>
* <p>
* \r, carriage return, decimal 13
* </p>
* </li>
* <li>
* <p>
* \v, vertical tab, decimal 11
* </p>
* </li>
* <li>
* <p>
* non-breaking space, decimal 160
* </p>
* </li>
* </ul>
* <p>
* <code>COMPRESS_WHITE_SPACE</code> also replaces multiple spaces with one space.
* </p>
* <p>
* <b>HTML_ENTITY_DECODE</b>
* </p>
* <p>
* Use this option to replace HTML-encoded characters with unencoded characters. <code>HTML_ENTITY_DECODE</code>
* performs the following operations:
* </p>
* <ul>
* <li>
* <p>
* Replaces <code>(ampersand)quot;</code> with <code>"</code>
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)nbsp;</code> with a non-breaking space, decimal 160
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)lt;</code> with a "less than" symbol
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)gt;</code> with <code>></code>
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in hexadecimal format, <code>(ampersand)#xhhhh;</code>, with the
* corresponding characters
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in decimal format, <code>(ampersand)#nnnn;</code>, with the
* corresponding characters
* </p>
* </li>
* </ul>
* <p>
* <b>LOWERCASE</b>
* </p>
* <p>
* Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
* </p>
* <p>
* <b>URL_DECODE</b>
* </p>
* <p>
* Use this option to decode a URL-encoded value.
* </p>
* <p>
* <b>NONE</b>
* </p>
* <p>
* Specify <code>NONE</code> if you don't want to perform any text transformations.
* </p>
*
* @param textTransformation
* Text transformations eliminate some of the unusual formatting that attackers use in web requests in an
* effort to bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on
* <code>RegexPatternSet</code> before inspecting a request for a match.</p>
* <p>
* <b>CMD_LINE</b>
* </p>
* <p>
* When you're concerned that attackers are injecting an operating system commandline command and using
* unusual formatting to disguise some or all of the command, use this option to perform the following
* transformations:
* </p>
* <ul>
* <li>
* <p>
* Delete the following characters: \ " ' ^
* </p>
* </li>
* <li>
* <p>
* Delete spaces before the following characters: / (
* </p>
* </li>
* <li>
* <p>
* Replace the following characters with a space: , ;
* </p>
* </li>
* <li>
* <p>
* Replace multiple spaces with one space
* </p>
* </li>
* <li>
* <p>
* Convert uppercase letters (A-Z) to lowercase (a-z)
* </p>
* </li>
* </ul>
* <p>
* <b>COMPRESS_WHITE_SPACE</b>
* </p>
* <p>
* Use this option to replace the following characters with a space character (decimal 32):
* </p>
* <ul>
* <li>
* <p>
* \f, formfeed, decimal 12
* </p>
* </li>
* <li>
* <p>
* \t, tab, decimal 9
* </p>
* </li>
* <li>
* <p>
* \n, newline, decimal 10
* </p>
* </li>
* <li>
* <p>
* \r, carriage return, decimal 13
* </p>
* </li>
* <li>
* <p>
* \v, vertical tab, decimal 11
* </p>
* </li>
* <li>
* <p>
* non-breaking space, decimal 160
* </p>
* </li>
* </ul>
* <p>
* <code>COMPRESS_WHITE_SPACE</code> also replaces multiple spaces with one space.
* </p>
* <p>
* <b>HTML_ENTITY_DECODE</b>
* </p>
* <p>
* Use this option to replace HTML-encoded characters with unencoded characters.
* <code>HTML_ENTITY_DECODE</code> performs the following operations:
* </p>
* <ul>
* <li>
* <p>
* Replaces <code>(ampersand)quot;</code> with <code>"</code>
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)nbsp;</code> with a non-breaking space, decimal 160
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)lt;</code> with a "less than" symbol
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)gt;</code> with <code>></code>
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in hexadecimal format, <code>(ampersand)#xhhhh;</code>, with the
* corresponding characters
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in decimal format, <code>(ampersand)#nnnn;</code>, with the
* corresponding characters
* </p>
* </li>
* </ul>
* <p>
* <b>LOWERCASE</b>
* </p>
* <p>
* Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
* </p>
* <p>
* <b>URL_DECODE</b>
* </p>
* <p>
* Use this option to decode a URL-encoded value.
* </p>
* <p>
* <b>NONE</b>
* </p>
* <p>
* Specify <code>NONE</code> if you don't want to perform any text transformations.
* @see TextTransformation
*/
public void setTextTransformation(String textTransformation) {
this.textTransformation = textTransformation;
}
/**
* <p>
* Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to
* bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on
* <code>RegexPatternSet</code> before inspecting a request for a match.
* </p>
* <p>
* <b>CMD_LINE</b>
* </p>
* <p>
* When you're concerned that attackers are injecting an operating system commandline command and using unusual
* formatting to disguise some or all of the command, use this option to perform the following transformations:
* </p>
* <ul>
* <li>
* <p>
* Delete the following characters: \ " ' ^
* </p>
* </li>
* <li>
* <p>
* Delete spaces before the following characters: / (
* </p>
* </li>
* <li>
* <p>
* Replace the following characters with a space: , ;
* </p>
* </li>
* <li>
* <p>
* Replace multiple spaces with one space
* </p>
* </li>
* <li>
* <p>
* Convert uppercase letters (A-Z) to lowercase (a-z)
* </p>
* </li>
* </ul>
* <p>
* <b>COMPRESS_WHITE_SPACE</b>
* </p>
* <p>
* Use this option to replace the following characters with a space character (decimal 32):
* </p>
* <ul>
* <li>
* <p>
* \f, formfeed, decimal 12
* </p>
* </li>
* <li>
* <p>
* \t, tab, decimal 9
* </p>
* </li>
* <li>
* <p>
* \n, newline, decimal 10
* </p>
* </li>
* <li>
* <p>
* \r, carriage return, decimal 13
* </p>
* </li>
* <li>
* <p>
* \v, vertical tab, decimal 11
* </p>
* </li>
* <li>
* <p>
* non-breaking space, decimal 160
* </p>
* </li>
* </ul>
* <p>
* <code>COMPRESS_WHITE_SPACE</code> also replaces multiple spaces with one space.
* </p>
* <p>
* <b>HTML_ENTITY_DECODE</b>
* </p>
* <p>
* Use this option to replace HTML-encoded characters with unencoded characters. <code>HTML_ENTITY_DECODE</code>
* performs the following operations:
* </p>
* <ul>
* <li>
* <p>
* Replaces <code>(ampersand)quot;</code> with <code>"</code>
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)nbsp;</code> with a non-breaking space, decimal 160
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)lt;</code> with a "less than" symbol
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)gt;</code> with <code>></code>
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in hexadecimal format, <code>(ampersand)#xhhhh;</code>, with the
* corresponding characters
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in decimal format, <code>(ampersand)#nnnn;</code>, with the
* corresponding characters
* </p>
* </li>
* </ul>
* <p>
* <b>LOWERCASE</b>
* </p>
* <p>
* Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
* </p>
* <p>
* <b>URL_DECODE</b>
* </p>
* <p>
* Use this option to decode a URL-encoded value.
* </p>
* <p>
* <b>NONE</b>
* </p>
* <p>
* Specify <code>NONE</code> if you don't want to perform any text transformations.
* </p>
*
* @return Text transformations eliminate some of the unusual formatting that attackers use in web requests in an
* effort to bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on
* <code>RegexPatternSet</code> before inspecting a request for a match.</p>
* <p>
* <b>CMD_LINE</b>
* </p>
* <p>
* When you're concerned that attackers are injecting an operating system commandline command and using
* unusual formatting to disguise some or all of the command, use this option to perform the following
* transformations:
* </p>
* <ul>
* <li>
* <p>
* Delete the following characters: \ " ' ^
* </p>
* </li>
* <li>
* <p>
* Delete spaces before the following characters: / (
* </p>
* </li>
* <li>
* <p>
* Replace the following characters with a space: , ;
* </p>
* </li>
* <li>
* <p>
* Replace multiple spaces with one space
* </p>
* </li>
* <li>
* <p>
* Convert uppercase letters (A-Z) to lowercase (a-z)
* </p>
* </li>
* </ul>
* <p>
* <b>COMPRESS_WHITE_SPACE</b>
* </p>
* <p>
* Use this option to replace the following characters with a space character (decimal 32):
* </p>
* <ul>
* <li>
* <p>
* \f, formfeed, decimal 12
* </p>
* </li>
* <li>
* <p>
* \t, tab, decimal 9
* </p>
* </li>
* <li>
* <p>
* \n, newline, decimal 10
* </p>
* </li>
* <li>
* <p>
* \r, carriage return, decimal 13
* </p>
* </li>
* <li>
* <p>
* \v, vertical tab, decimal 11
* </p>
* </li>
* <li>
* <p>
* non-breaking space, decimal 160
* </p>
* </li>
* </ul>
* <p>
* <code>COMPRESS_WHITE_SPACE</code> also replaces multiple spaces with one space.
* </p>
* <p>
* <b>HTML_ENTITY_DECODE</b>
* </p>
* <p>
* Use this option to replace HTML-encoded characters with unencoded characters.
* <code>HTML_ENTITY_DECODE</code> performs the following operations:
* </p>
* <ul>
* <li>
* <p>
* Replaces <code>(ampersand)quot;</code> with <code>"</code>
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)nbsp;</code> with a non-breaking space, decimal 160
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)lt;</code> with a "less than" symbol
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)gt;</code> with <code>></code>
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in hexadecimal format, <code>(ampersand)#xhhhh;</code>, with the
* corresponding characters
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in decimal format, <code>(ampersand)#nnnn;</code>, with the
* corresponding characters
* </p>
* </li>
* </ul>
* <p>
* <b>LOWERCASE</b>
* </p>
* <p>
* Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
* </p>
* <p>
* <b>URL_DECODE</b>
* </p>
* <p>
* Use this option to decode a URL-encoded value.
* </p>
* <p>
* <b>NONE</b>
* </p>
* <p>
* Specify <code>NONE</code> if you don't want to perform any text transformations.
* @see TextTransformation
*/
public String getTextTransformation() {
return this.textTransformation;
}
/**
* <p>
* Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to
* bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on
* <code>RegexPatternSet</code> before inspecting a request for a match.
* </p>
* <p>
* <b>CMD_LINE</b>
* </p>
* <p>
* When you're concerned that attackers are injecting an operating system commandline command and using unusual
* formatting to disguise some or all of the command, use this option to perform the following transformations:
* </p>
* <ul>
* <li>
* <p>
* Delete the following characters: \ " ' ^
* </p>
* </li>
* <li>
* <p>
* Delete spaces before the following characters: / (
* </p>
* </li>
* <li>
* <p>
* Replace the following characters with a space: , ;
* </p>
* </li>
* <li>
* <p>
* Replace multiple spaces with one space
* </p>
* </li>
* <li>
* <p>
* Convert uppercase letters (A-Z) to lowercase (a-z)
* </p>
* </li>
* </ul>
* <p>
* <b>COMPRESS_WHITE_SPACE</b>
* </p>
* <p>
* Use this option to replace the following characters with a space character (decimal 32):
* </p>
* <ul>
* <li>
* <p>
* \f, formfeed, decimal 12
* </p>
* </li>
* <li>
* <p>
* \t, tab, decimal 9
* </p>
* </li>
* <li>
* <p>
* \n, newline, decimal 10
* </p>
* </li>
* <li>
* <p>
* \r, carriage return, decimal 13
* </p>
* </li>
* <li>
* <p>
* \v, vertical tab, decimal 11
* </p>
* </li>
* <li>
* <p>
* non-breaking space, decimal 160
* </p>
* </li>
* </ul>
* <p>
* <code>COMPRESS_WHITE_SPACE</code> also replaces multiple spaces with one space.
* </p>
* <p>
* <b>HTML_ENTITY_DECODE</b>
* </p>
* <p>
* Use this option to replace HTML-encoded characters with unencoded characters. <code>HTML_ENTITY_DECODE</code>
* performs the following operations:
* </p>
* <ul>
* <li>
* <p>
* Replaces <code>(ampersand)quot;</code> with <code>"</code>
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)nbsp;</code> with a non-breaking space, decimal 160
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)lt;</code> with a "less than" symbol
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)gt;</code> with <code>></code>
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in hexadecimal format, <code>(ampersand)#xhhhh;</code>, with the
* corresponding characters
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in decimal format, <code>(ampersand)#nnnn;</code>, with the
* corresponding characters
* </p>
* </li>
* </ul>
* <p>
* <b>LOWERCASE</b>
* </p>
* <p>
* Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
* </p>
* <p>
* <b>URL_DECODE</b>
* </p>
* <p>
* Use this option to decode a URL-encoded value.
* </p>
* <p>
* <b>NONE</b>
* </p>
* <p>
* Specify <code>NONE</code> if you don't want to perform any text transformations.
* </p>
*
* @param textTransformation
* Text transformations eliminate some of the unusual formatting that attackers use in web requests in an
* effort to bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on
* <code>RegexPatternSet</code> before inspecting a request for a match.</p>
* <p>
* <b>CMD_LINE</b>
* </p>
* <p>
* When you're concerned that attackers are injecting an operating system commandline command and using
* unusual formatting to disguise some or all of the command, use this option to perform the following
* transformations:
* </p>
* <ul>
* <li>
* <p>
* Delete the following characters: \ " ' ^
* </p>
* </li>
* <li>
* <p>
* Delete spaces before the following characters: / (
* </p>
* </li>
* <li>
* <p>
* Replace the following characters with a space: , ;
* </p>
* </li>
* <li>
* <p>
* Replace multiple spaces with one space
* </p>
* </li>
* <li>
* <p>
* Convert uppercase letters (A-Z) to lowercase (a-z)
* </p>
* </li>
* </ul>
* <p>
* <b>COMPRESS_WHITE_SPACE</b>
* </p>
* <p>
* Use this option to replace the following characters with a space character (decimal 32):
* </p>
* <ul>
* <li>
* <p>
* \f, formfeed, decimal 12
* </p>
* </li>
* <li>
* <p>
* \t, tab, decimal 9
* </p>
* </li>
* <li>
* <p>
* \n, newline, decimal 10
* </p>
* </li>
* <li>
* <p>
* \r, carriage return, decimal 13
* </p>
* </li>
* <li>
* <p>
* \v, vertical tab, decimal 11
* </p>
* </li>
* <li>
* <p>
* non-breaking space, decimal 160
* </p>
* </li>
* </ul>
* <p>
* <code>COMPRESS_WHITE_SPACE</code> also replaces multiple spaces with one space.
* </p>
* <p>
* <b>HTML_ENTITY_DECODE</b>
* </p>
* <p>
* Use this option to replace HTML-encoded characters with unencoded characters.
* <code>HTML_ENTITY_DECODE</code> performs the following operations:
* </p>
* <ul>
* <li>
* <p>
* Replaces <code>(ampersand)quot;</code> with <code>"</code>
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)nbsp;</code> with a non-breaking space, decimal 160
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)lt;</code> with a "less than" symbol
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)gt;</code> with <code>></code>
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in hexadecimal format, <code>(ampersand)#xhhhh;</code>, with the
* corresponding characters
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in decimal format, <code>(ampersand)#nnnn;</code>, with the
* corresponding characters
* </p>
* </li>
* </ul>
* <p>
* <b>LOWERCASE</b>
* </p>
* <p>
* Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
* </p>
* <p>
* <b>URL_DECODE</b>
* </p>
* <p>
* Use this option to decode a URL-encoded value.
* </p>
* <p>
* <b>NONE</b>
* </p>
* <p>
* Specify <code>NONE</code> if you don't want to perform any text transformations.
* @return Returns a reference to this object so that method calls can be chained together.
* @see TextTransformation
*/
public RegexMatchTuple withTextTransformation(String textTransformation) {
setTextTransformation(textTransformation);
return this;
}
/**
* <p>
* Text transformations eliminate some of the unusual formatting that attackers use in web requests in an effort to
* bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on
* <code>RegexPatternSet</code> before inspecting a request for a match.
* </p>
* <p>
* <b>CMD_LINE</b>
* </p>
* <p>
* When you're concerned that attackers are injecting an operating system commandline command and using unusual
* formatting to disguise some or all of the command, use this option to perform the following transformations:
* </p>
* <ul>
* <li>
* <p>
* Delete the following characters: \ " ' ^
* </p>
* </li>
* <li>
* <p>
* Delete spaces before the following characters: / (
* </p>
* </li>
* <li>
* <p>
* Replace the following characters with a space: , ;
* </p>
* </li>
* <li>
* <p>
* Replace multiple spaces with one space
* </p>
* </li>
* <li>
* <p>
* Convert uppercase letters (A-Z) to lowercase (a-z)
* </p>
* </li>
* </ul>
* <p>
* <b>COMPRESS_WHITE_SPACE</b>
* </p>
* <p>
* Use this option to replace the following characters with a space character (decimal 32):
* </p>
* <ul>
* <li>
* <p>
* \f, formfeed, decimal 12
* </p>
* </li>
* <li>
* <p>
* \t, tab, decimal 9
* </p>
* </li>
* <li>
* <p>
* \n, newline, decimal 10
* </p>
* </li>
* <li>
* <p>
* \r, carriage return, decimal 13
* </p>
* </li>
* <li>
* <p>
* \v, vertical tab, decimal 11
* </p>
* </li>
* <li>
* <p>
* non-breaking space, decimal 160
* </p>
* </li>
* </ul>
* <p>
* <code>COMPRESS_WHITE_SPACE</code> also replaces multiple spaces with one space.
* </p>
* <p>
* <b>HTML_ENTITY_DECODE</b>
* </p>
* <p>
* Use this option to replace HTML-encoded characters with unencoded characters. <code>HTML_ENTITY_DECODE</code>
* performs the following operations:
* </p>
* <ul>
* <li>
* <p>
* Replaces <code>(ampersand)quot;</code> with <code>"</code>
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)nbsp;</code> with a non-breaking space, decimal 160
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)lt;</code> with a "less than" symbol
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)gt;</code> with <code>></code>
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in hexadecimal format, <code>(ampersand)#xhhhh;</code>, with the
* corresponding characters
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in decimal format, <code>(ampersand)#nnnn;</code>, with the
* corresponding characters
* </p>
* </li>
* </ul>
* <p>
* <b>LOWERCASE</b>
* </p>
* <p>
* Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
* </p>
* <p>
* <b>URL_DECODE</b>
* </p>
* <p>
* Use this option to decode a URL-encoded value.
* </p>
* <p>
* <b>NONE</b>
* </p>
* <p>
* Specify <code>NONE</code> if you don't want to perform any text transformations.
* </p>
*
* @param textTransformation
* Text transformations eliminate some of the unusual formatting that attackers use in web requests in an
* effort to bypass AWS WAF. If you specify a transformation, AWS WAF performs the transformation on
* <code>RegexPatternSet</code> before inspecting a request for a match.</p>
* <p>
* <b>CMD_LINE</b>
* </p>
* <p>
* When you're concerned that attackers are injecting an operating system commandline command and using
* unusual formatting to disguise some or all of the command, use this option to perform the following
* transformations:
* </p>
* <ul>
* <li>
* <p>
* Delete the following characters: \ " ' ^
* </p>
* </li>
* <li>
* <p>
* Delete spaces before the following characters: / (
* </p>
* </li>
* <li>
* <p>
* Replace the following characters with a space: , ;
* </p>
* </li>
* <li>
* <p>
* Replace multiple spaces with one space
* </p>
* </li>
* <li>
* <p>
* Convert uppercase letters (A-Z) to lowercase (a-z)
* </p>
* </li>
* </ul>
* <p>
* <b>COMPRESS_WHITE_SPACE</b>
* </p>
* <p>
* Use this option to replace the following characters with a space character (decimal 32):
* </p>
* <ul>
* <li>
* <p>
* \f, formfeed, decimal 12
* </p>
* </li>
* <li>
* <p>
* \t, tab, decimal 9
* </p>
* </li>
* <li>
* <p>
* \n, newline, decimal 10
* </p>
* </li>
* <li>
* <p>
* \r, carriage return, decimal 13
* </p>
* </li>
* <li>
* <p>
* \v, vertical tab, decimal 11
* </p>
* </li>
* <li>
* <p>
* non-breaking space, decimal 160
* </p>
* </li>
* </ul>
* <p>
* <code>COMPRESS_WHITE_SPACE</code> also replaces multiple spaces with one space.
* </p>
* <p>
* <b>HTML_ENTITY_DECODE</b>
* </p>
* <p>
* Use this option to replace HTML-encoded characters with unencoded characters.
* <code>HTML_ENTITY_DECODE</code> performs the following operations:
* </p>
* <ul>
* <li>
* <p>
* Replaces <code>(ampersand)quot;</code> with <code>"</code>
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)nbsp;</code> with a non-breaking space, decimal 160
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)lt;</code> with a "less than" symbol
* </p>
* </li>
* <li>
* <p>
* Replaces <code>(ampersand)gt;</code> with <code>></code>
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in hexadecimal format, <code>(ampersand)#xhhhh;</code>, with the
* corresponding characters
* </p>
* </li>
* <li>
* <p>
* Replaces characters that are represented in decimal format, <code>(ampersand)#nnnn;</code>, with the
* corresponding characters
* </p>
* </li>
* </ul>
* <p>
* <b>LOWERCASE</b>
* </p>
* <p>
* Use this option to convert uppercase letters (A-Z) to lowercase (a-z).
* </p>
* <p>
* <b>URL_DECODE</b>
* </p>
* <p>
* Use this option to decode a URL-encoded value.
* </p>
* <p>
* <b>NONE</b>
* </p>
* <p>
* Specify <code>NONE</code> if you don't want to perform any text transformations.
* @return Returns a reference to this object so that method calls can be chained together.
* @see TextTransformation
*/
public RegexMatchTuple withTextTransformation(TextTransformation textTransformation) {
this.textTransformation = textTransformation.toString();
return this;
}
/**
* <p>
* The <code>RegexPatternSetId</code> for a <code>RegexPatternSet</code>. You use <code>RegexPatternSetId</code> to
* get information about a <code>RegexPatternSet</code> (see <a>GetRegexPatternSet</a>), update a
* <code>RegexPatternSet</code> (see <a>UpdateRegexPatternSet</a>), insert a <code>RegexPatternSet</code> into a
* <code>RegexMatchSet</code> or delete one from a <code>RegexMatchSet</code> (see <a>UpdateRegexMatchSet</a>), and
* delete an <code>RegexPatternSet</code> from AWS WAF (see <a>DeleteRegexPatternSet</a>).
* </p>
* <p>
* <code>RegexPatternSetId</code> is returned by <a>CreateRegexPatternSet</a> and by <a>ListRegexPatternSets</a>.
* </p>
*
* @param regexPatternSetId
* The <code>RegexPatternSetId</code> for a <code>RegexPatternSet</code>. You use
* <code>RegexPatternSetId</code> to get information about a <code>RegexPatternSet</code> (see
* <a>GetRegexPatternSet</a>), update a <code>RegexPatternSet</code> (see <a>UpdateRegexPatternSet</a>),
* insert a <code>RegexPatternSet</code> into a <code>RegexMatchSet</code> or delete one from a
* <code>RegexMatchSet</code> (see <a>UpdateRegexMatchSet</a>), and delete an <code>RegexPatternSet</code>
* from AWS WAF (see <a>DeleteRegexPatternSet</a>).</p>
* <p>
* <code>RegexPatternSetId</code> is returned by <a>CreateRegexPatternSet</a> and by
* <a>ListRegexPatternSets</a>.
*/
public void setRegexPatternSetId(String regexPatternSetId) {
this.regexPatternSetId = regexPatternSetId;
}
/**
* <p>
* The <code>RegexPatternSetId</code> for a <code>RegexPatternSet</code>. You use <code>RegexPatternSetId</code> to
* get information about a <code>RegexPatternSet</code> (see <a>GetRegexPatternSet</a>), update a
* <code>RegexPatternSet</code> (see <a>UpdateRegexPatternSet</a>), insert a <code>RegexPatternSet</code> into a
* <code>RegexMatchSet</code> or delete one from a <code>RegexMatchSet</code> (see <a>UpdateRegexMatchSet</a>), and
* delete an <code>RegexPatternSet</code> from AWS WAF (see <a>DeleteRegexPatternSet</a>).
* </p>
* <p>
* <code>RegexPatternSetId</code> is returned by <a>CreateRegexPatternSet</a> and by <a>ListRegexPatternSets</a>.
* </p>
*
* @return The <code>RegexPatternSetId</code> for a <code>RegexPatternSet</code>. You use
* <code>RegexPatternSetId</code> to get information about a <code>RegexPatternSet</code> (see
* <a>GetRegexPatternSet</a>), update a <code>RegexPatternSet</code> (see <a>UpdateRegexPatternSet</a>),
* insert a <code>RegexPatternSet</code> into a <code>RegexMatchSet</code> or delete one from a
* <code>RegexMatchSet</code> (see <a>UpdateRegexMatchSet</a>), and delete an <code>RegexPatternSet</code>
* from AWS WAF (see <a>DeleteRegexPatternSet</a>).</p>
* <p>
* <code>RegexPatternSetId</code> is returned by <a>CreateRegexPatternSet</a> and by
* <a>ListRegexPatternSets</a>.
*/
public String getRegexPatternSetId() {
return this.regexPatternSetId;
}
/**
* <p>
* The <code>RegexPatternSetId</code> for a <code>RegexPatternSet</code>. You use <code>RegexPatternSetId</code> to
* get information about a <code>RegexPatternSet</code> (see <a>GetRegexPatternSet</a>), update a
* <code>RegexPatternSet</code> (see <a>UpdateRegexPatternSet</a>), insert a <code>RegexPatternSet</code> into a
* <code>RegexMatchSet</code> or delete one from a <code>RegexMatchSet</code> (see <a>UpdateRegexMatchSet</a>), and
* delete an <code>RegexPatternSet</code> from AWS WAF (see <a>DeleteRegexPatternSet</a>).
* </p>
* <p>
* <code>RegexPatternSetId</code> is returned by <a>CreateRegexPatternSet</a> and by <a>ListRegexPatternSets</a>.
* </p>
*
* @param regexPatternSetId
* The <code>RegexPatternSetId</code> for a <code>RegexPatternSet</code>. You use
* <code>RegexPatternSetId</code> to get information about a <code>RegexPatternSet</code> (see
* <a>GetRegexPatternSet</a>), update a <code>RegexPatternSet</code> (see <a>UpdateRegexPatternSet</a>),
* insert a <code>RegexPatternSet</code> into a <code>RegexMatchSet</code> or delete one from a
* <code>RegexMatchSet</code> (see <a>UpdateRegexMatchSet</a>), and delete an <code>RegexPatternSet</code>
* from AWS WAF (see <a>DeleteRegexPatternSet</a>).</p>
* <p>
* <code>RegexPatternSetId</code> is returned by <a>CreateRegexPatternSet</a> and by
* <a>ListRegexPatternSets</a>.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public RegexMatchTuple withRegexPatternSetId(String regexPatternSetId) {
setRegexPatternSetId(regexPatternSetId);
return this;
}
/**
* Returns a string representation of this object; useful for testing and debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getFieldToMatch() != null)
sb.append("FieldToMatch: ").append(getFieldToMatch()).append(",");
if (getTextTransformation() != null)
sb.append("TextTransformation: ").append(getTextTransformation()).append(",");
if (getRegexPatternSetId() != null)
sb.append("RegexPatternSetId: ").append(getRegexPatternSetId());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof RegexMatchTuple == false)
return false;
RegexMatchTuple other = (RegexMatchTuple) obj;
if (other.getFieldToMatch() == null ^ this.getFieldToMatch() == null)
return false;
if (other.getFieldToMatch() != null && other.getFieldToMatch().equals(this.getFieldToMatch()) == false)
return false;
if (other.getTextTransformation() == null ^ this.getTextTransformation() == null)
return false;
if (other.getTextTransformation() != null && other.getTextTransformation().equals(this.getTextTransformation()) == false)
return false;
if (other.getRegexPatternSetId() == null ^ this.getRegexPatternSetId() == null)
return false;
if (other.getRegexPatternSetId() != null && other.getRegexPatternSetId().equals(this.getRegexPatternSetId()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getFieldToMatch() == null) ? 0 : getFieldToMatch().hashCode());
hashCode = prime * hashCode + ((getTextTransformation() == null) ? 0 : getTextTransformation().hashCode());
hashCode = prime * hashCode + ((getRegexPatternSetId() == null) ? 0 : getRegexPatternSetId().hashCode());
return hashCode;
}
@Override
public RegexMatchTuple clone() {
try {
return (RegexMatchTuple) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.waf.model.waf_regional.transform.RegexMatchTupleMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| [
""
] | |
81afac5a7ce25bcf09efde9211b32393feb6bbbd | 2b438c607ca0b2ee575eec4752cc7c5c7792f4cc | /Java6/src/ConsoleClass.java | 355a9fabc094fc4becf9eb8d194b6eb9b46882b8 | [] | no_license | cherkavi/java-code-example | a94a4c5eebd6fb20274dc4852c13e7e8779a7570 | 9c640b7a64e64290df0b4a6820747a7c6b87ae6d | refs/heads/master | 2023-02-08T09:03:37.056639 | 2023-02-06T15:18:21 | 2023-02-06T15:18:21 | 197,267,286 | 0 | 4 | null | 2022-12-15T23:57:37 | 2019-07-16T21:01:20 | Java | WINDOWS-1251 | Java | false | false | 4,959 | java | import java.io.Console;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.InterfaceAddress;
import java.net.NetworkInterface;
import java.util.Enumeration;
import java.util.List;
import java.util.Properties;
public class ConsoleClass {
/** вывод отладочной информации */
private static void debug(Object information){
StackTraceElement element=(new Throwable()).getStackTrace()[1];
System.out.print(element.getClassName()+"#"+element.getMethodName());
System.out.print(" DEBUG ");
System.out.println(information);
}
private static void printByteArray(PrintStream writer,byte[] byteArray){
for(int counter=0;counter<byteArray.length;counter++){
writer.print(counter+":"+(byte)byteArray[counter]);
}
writer.println();
}
/** new Class {@link java.io.Console} может не работать в режиме отладки, необходим запуск *.class файла из консоли операционной системы */
private static void consoleExample(){
try{
debug("This is console example: ");
debug("Get console:");
Console console=System.console();
debug("Get writer");
PrintWriter writer=console.writer();
writer.println("InputString");
String inputString=console.readLine();
System.out.println("InputString:"+inputString);
System.out.println("Hello, input your password:");
char[] value=console.readPassword();
System.out.println("your passowrd:"+new String(value));
}catch(Exception ex){
System.out.println("Exception:"+ex.getMessage());
}
}
/** получение всех свойств среды, для определения некоторых особенностей системы */
private static void getProperties(String pathToFile){
Properties properties=System.getProperties();
try{
properties.store(new FileOutputStream(pathToFile),"System.properties");
}catch(Exception ex){
System.out.println("Properties: "+ex.getMessage());
}
}
/** Получение расширенной информации об указанном узле */
private static void getInformation(){
try{
NetworkInterface networkInterface=NetworkInterface.getByInetAddress(InetAddress.getLocalHost());
String displayName=networkInterface.getDisplayName();
System.out.println("DisplayName:"+displayName);
byte[] hardwareAddress=networkInterface.getHardwareAddress();
System.out.println("Hardware address:");printByteArray(System.out,hardwareAddress);
Enumeration<InetAddress> address=networkInterface.getInetAddresses();
System.out.println("Inet Address:");
InetAddress element;
while((element=address.nextElement())!=null){
System.out.println("--- new InetAddress: ---");
System.out.println("Address:");printByteArray(System.out,element.getAddress());
System.out.println("CanonicalHostName: "+element.getCanonicalHostName());
System.out.println("HostAddress:"+element.getHostAddress());
System.out.println("HostName:"+element.getHostName());
System.out.println("--------------------");
}
List<InterfaceAddress> list=networkInterface.getInterfaceAddresses();
for(InterfaceAddress addressElement:list){
System.out.println("--- AddressElement ---");
System.out.println("Network Prefix length:"+addressElement.getNetworkPrefixLength());
System.out.println("--- BroadCast: begin");
System.out.println("Address:");printByteArray(System.out,addressElement.getBroadcast().getAddress());
System.out.println("CanonicalHostName: "+addressElement.getBroadcast().getCanonicalHostName());
System.out.println("HostAddress:"+addressElement.getBroadcast().getHostAddress());
System.out.println("HostName:"+addressElement.getBroadcast().getHostName());
System.out.println("--- BroadCast: end");
System.out.println("Address begin");
System.out.println("Address:"+addressElement.getAddress().getAddress());
System.out.println("CanonicalHostName: "+addressElement.getAddress().getCanonicalHostName());
System.out.println("HostAddress:"+addressElement.getAddress().getHostAddress());
System.out.println("HostName:"+addressElement.getAddress().getHostName());
System.out.println("Address end");
System.out.println("");
System.out.println("----------------------");
}
int mtu=networkInterface.getMTU();
System.out.println("MTU:"+mtu);
String name=networkInterface.getName();
System.out.println("NetworkInterface Name:"+name);
}catch(Exception ex){
}
}
public static void main(String[] args){
//getProperties("c:\\out.properties"); // java.runtime.version=1.6 не ниже
//debug("Console Example:");
//consoleExample();
getInformation();
}
}
| [
"[email protected]"
] | |
5056c68106933102095d9fab3d622c90d2f5dae3 | 83e81c25b1f74f88ed0f723afc5d3f83e7d05da8 | /core/java/android/database/sqlite/SQLiteCompatibilityWalFlags.java | 5c9ed8b869a9603b9b0955e12bf844578437c63c | [
"Apache-2.0",
"LicenseRef-scancode-unicode"
] | permissive | Ankits-lab/frameworks_base | 8a63f39a79965c87a84e80550926327dcafb40b7 | 150a9240e5a11cd5ebc9bb0832ce30e9c23f376a | refs/heads/main | 2023-02-06T03:57:44.893590 | 2020-11-14T09:13:40 | 2020-11-14T09:13:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,240 | java | /*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.database.sqlite;
import android.annotation.TestApi;
import android.app.ActivityThread;
import android.app.Application;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.KeyValueListParser;
import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;
/**
* Helper class for accessing
* {@link Settings.Global#SQLITE_COMPATIBILITY_WAL_FLAGS global compatibility WAL settings}.
*
* <p>The value of {@link Settings.Global#SQLITE_COMPATIBILITY_WAL_FLAGS} is cached on first access
* for consistent behavior across all connections opened in the process.
* @hide
*/
@TestApi
public class SQLiteCompatibilityWalFlags {
private static final String TAG = "SQLiteCompatibilityWalFlags";
private static volatile boolean sInitialized;
private static volatile boolean sLegacyCompatibilityWalEnabled;
private static volatile String sWALSyncMode;
private static volatile long sTruncateSize = -1;
// This flag is used to avoid recursive initialization due to circular dependency on Settings
private static volatile boolean sCallingGlobalSettings;
private SQLiteCompatibilityWalFlags() {
}
/**
* @hide
*/
@VisibleForTesting
public static boolean isLegacyCompatibilityWalEnabled() {
initIfNeeded();
return sLegacyCompatibilityWalEnabled;
}
/**
* @hide
*/
@VisibleForTesting
public static String getWALSyncMode() {
initIfNeeded();
// The configurable WAL sync mode should only ever be used if the legacy compatibility
// WAL is enabled. It should *not* have any effect if app developers explicitly turn on
// WAL for their database using setWriteAheadLoggingEnabled. Throwing an exception here
// adds an extra layer of checking that we never use it in the wrong place.
if (!sLegacyCompatibilityWalEnabled) {
throw new IllegalStateException("isLegacyCompatibilityWalEnabled() == false");
}
return sWALSyncMode;
}
/**
* Override {@link com.android.internal.R.integer#db_wal_truncate_size}.
*
* @return the value set in the global setting, or -1 if a value is not set.
*
* @hide
*/
@VisibleForTesting
public static long getTruncateSize() {
initIfNeeded();
return sTruncateSize;
}
private static void initIfNeeded() {
if (sInitialized || sCallingGlobalSettings) {
return;
}
ActivityThread activityThread = ActivityThread.currentActivityThread();
Application app = activityThread == null ? null : activityThread.getApplication();
String flags = null;
if (app == null) {
Log.w(TAG, "Cannot read global setting "
+ Settings.Global.SQLITE_COMPATIBILITY_WAL_FLAGS + " - "
+ "Application state not available");
} else {
try {
sCallingGlobalSettings = true;
flags = Settings.Global.getString(app.getContentResolver(),
Settings.Global.SQLITE_COMPATIBILITY_WAL_FLAGS);
} finally {
sCallingGlobalSettings = false;
}
}
init(flags);
}
/**
* @hide
*/
@VisibleForTesting
public static void init(String flags) {
if (TextUtils.isEmpty(flags)) {
sInitialized = true;
return;
}
KeyValueListParser parser = new KeyValueListParser(',');
try {
parser.setString(flags);
} catch (IllegalArgumentException e) {
Log.e(TAG, "Setting has invalid format: " + flags, e);
sInitialized = true;
return;
}
sLegacyCompatibilityWalEnabled = parser.getBoolean(
"legacy_compatibility_wal_enabled", false);
sWALSyncMode = parser.getString("wal_syncmode", SQLiteGlobal.getWALSyncMode());
sTruncateSize = parser.getInt("truncate_size", -1);
Log.i(TAG, "Read compatibility WAL flags: legacy_compatibility_wal_enabled="
+ sLegacyCompatibilityWalEnabled + ", wal_syncmode=" + sWALSyncMode);
sInitialized = true;
}
/**
* @hide
*/
@VisibleForTesting
@TestApi
public static void reset() {
sInitialized = false;
sLegacyCompatibilityWalEnabled = false;
sWALSyncMode = null;
}
}
| [
"[email protected]"
] | |
ac306686cb20bf7b1d3d42249f6cfa3197551ca6 | d2fd451292b7fa0ed4fac02bee27d050d284f525 | /statlib/src/test/java/com/shahin/statlib/ExampleUnitTest.java | cfe1b0bd9cb5525e903e3fb55956a1aef725a454 | [] | no_license | shaikhshahin/StatLibrary | 387f669d0554046d5a1ab24af5d5b5e82be45686 | 18805620e498cda09ba495924d9d7c9e5babb516 | refs/heads/master | 2021-04-03T05:54:53.813002 | 2018-03-13T06:48:44 | 2018-03-13T06:48:44 | 124,995,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package com.shahin.statlib;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
efadd542f2cd00a9c05563ef1b240b13794310be | 684f50dd1ae58a766ce441d460214a4f7e693101 | /modules/bid/bid-user-service/src/main/java/com/dimeng/p2p/modules/bid/user/service/ZqzrManage.java | dfc62491e3d4ea6eb0611ca860df79c924325c26 | [] | no_license | wang-shun/rainiee-core | a0361255e3957dd58f653ae922088219738e0d25 | 80a96b2ed36e3460282e9e21d4f031cfbd198e69 | refs/heads/master | 2020-03-29T16:40:18.372561 | 2018-09-22T10:05:17 | 2018-09-22T10:05:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,606 | java | package com.dimeng.p2p.modules.bid.user.service;
import java.math.BigDecimal;
import com.dimeng.framework.service.Service;
import com.dimeng.framework.service.query.Paging;
import com.dimeng.framework.service.query.PagingResult;
import com.dimeng.p2p.modules.bid.user.service.entity.InSellFinacing;
import com.dimeng.p2p.modules.bid.user.service.entity.InSellFinacingExt;
import com.dimeng.p2p.modules.bid.user.service.entity.MaySettleFinacing;
import com.dimeng.p2p.modules.bid.user.service.entity.OutSellFinacing;
import com.dimeng.p2p.modules.bid.user.service.entity.SellFinacingInfo;
import com.dimeng.p2p.modules.bid.user.service.entity.ZrzdzqEntity;
import com.dimeng.p2p.modules.bid.user.service.query.addTransfer;
public abstract interface ZqzrManage extends Service{
/**
* 得到线上债权转让信息
* @return
*/
public SellFinacingInfo getSellFinacingInfo() throws Throwable;
/**
* 分页查询转让中的债权
* @param paging
* @return
*/
public PagingResult<ZrzdzqEntity> getSellFinacing(Paging paging) throws Throwable;
/**
* 分页查询可转让的债权
* @param paging
* @return
*/
public PagingResult<MaySettleFinacing> getMaySettleFinacing(Paging paging) throws Throwable;
/**
* 分页查询已转出的债权
* @param paging
* @return
*/
public PagingResult<OutSellFinacing> getOutSellFinacing(Paging paging) throws Throwable;
/**
* 分页查询已转入的债权
* @param paging
* @return
*/
public PagingResult<InSellFinacing> getInSellFinacing(Paging paging) throws Throwable;
/**
* 取消转让中的债权
* @param zcbId
* @throws Throwable
*/
public void cancel(int zcbId)throws Throwable;
/**
* 转让债权
* @param zcbId
* @throws Throwable
*/
public void transfer(addTransfer addTransfer)throws Throwable;
/**
* 转让债权
* @param zcbId
* @throws Throwable
*/
public void transfer(addTransfer addTransfer,String tranPwd)throws Throwable;
/**
* 获取最新的线上债权转让ID
* @return
* @throws Throwable
*/
public int getCrid()throws Throwable;
/**
* 获取预计收益
* @param loanId
* @return
* @throws Throwable
*/
public BigDecimal getDslx(int loanId)throws Throwable;
/**
* 分页查询已转入的债权
* @param paging
* @return
*/
public PagingResult<InSellFinacingExt> getInSellFinacingExt(Paging paging) throws Throwable;
/** 操作类别
* 日志内容
* @param type
* @param log
* @throws Throwable
*/
public void writeFrontLog(String type, String log)
throws Throwable;
}
| [
"[email protected]"
] | |
ed65073a4b6250a801cdefe9d7ee93de78b467bb | c3d56ab0b16fd534a377681f956525e6cbffc18d | /spring-boot-tptRpg/spring-boot-tptRpg/src/main/java/spring/boot/tptRpg/model/TypePersonnage.java | 1bc1d553f9b0b4d33ddcf831301d7788e0c4d0fb | [] | no_license | Alexandre-Lacoste/RpgProjet | ade59a1a2e2b51c495872f5e5adfd4399e778172 | 6afe567dcc64e43c764970ef8f21f1a8a40a25a0 | refs/heads/main | 2023-07-22T13:35:44.200850 | 2021-09-02T21:18:16 | 2021-09-02T21:18:16 | 400,522,880 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 118 | java | package spring.boot.tptRpg.model;
public enum TypePersonnage {
elf,guerrier,archer,assassin,chevalier,berserker;
}
| [
"[email protected]"
] | |
717f44b1aa71e1fc42ef2d152ced83529f3cc487 | 7b941595841176fdeb3fd64d8ab17ce303b0d59f | /src/main/java/com/codingera/Command/AttackCommand.java | 5cbe482080ec5723bf7ed637c9990a9e16271f33 | [] | no_license | saludyan/learn-design-pattern | 26aaf40aee4e76ec1c91e643ee9beeb5fc2b3271 | 030b1de86f28db423d6590e86c7d474861a689f6 | refs/heads/master | 2021-01-19T21:01:45.283556 | 2017-08-15T05:59:03 | 2017-08-15T05:59:03 | 88,596,116 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package com.codingera.Command;
public class AttackCommand implements InterfaceCommand {
private InterfacePlayer player;
/**
*
* @param player
*/
public AttackCommand(InterfacePlayer player) {
this.player = player;
}
public void execute() {
player.attack();
}
} | [
"[email protected]"
] | |
0da89db3a46709baf033e9bca9027f1bf968c50c | 164e40a75d57748fe0fa9656b6a608641efa6afe | /manage-code-generator/src/main/java/com/feng/manage/code/generator/CodeGenerator.java | e62af598bbe5e2d06ddd0762c174642ecc6933de | [] | no_license | shuishuiafeng/feng-manage | bb658e593b9cf260561050c1fb2579fa9fffbe48 | bd5dc4e1c18e180d34ad578df47f096eb407e979 | refs/heads/master | 2022-11-25T02:45:21.100734 | 2019-07-11T08:10:30 | 2019-07-11T08:10:30 | 195,360,647 | 0 | 0 | null | 2022-11-16T11:53:23 | 2019-07-05T07:27:56 | Java | UTF-8 | Java | false | false | 641 | java | package com.feng.manage.code.generator;
import com.feng.manage.code.generator.ext.AutoGeneratorCaller;
import com.feng.manage.code.generator.ext.items.ItemEnum;
import com.feng.manage.code.generator.ext.names.SystemAuthNameGeneration;
/**
* @Author: Xiaofeng
* @Date: 2019/7/8 11:33
* @Description: 代码生成器
*/
public class CodeGenerator {
private static ItemEnum item = ItemEnum.USER;
/**
* 作者
*/
public static final String AUTH_NAME = new SystemAuthNameGeneration().name();
public static void main(String[] args) {
AutoGeneratorCaller.doExec(AUTH_NAME, item, "t_permission");
}
}
| [
"[email protected]"
] | |
465ace88deea4b895a47bb3522f9ba13137402f2 | a7b58ab19eb035d8ef599e35d5d3d68f1a38cc5b | /Arka-web/src/main/java/restWs/CartonRessource.java | bc86e227e5667ead416bc2788378efe210ddb9b1 | [] | no_license | DP-Team2018/ARKA | 2c3f17bdbfa65bbc2fe9e21dde4758a32de099a2 | 174b01f6f46f5a731b746470a868d89918a0c6fe | refs/heads/master | 2020-03-22T15:47:52.541749 | 2018-09-28T23:32:13 | 2018-09-28T23:32:13 | 140,279,237 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,204 | java | package restWs;
import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.SessionScoped;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import arka.domain.Carton;
import arka.domain.Client;
import arka.domain.Location;
import arka.service.CartonService;
import arka.service.EmplacementService;
@SessionScoped
@Path("carton")
public class CartonRessource {
private static List<Carton> cartons = new ArrayList<Carton>();
private static List<Client> clients = new ArrayList<Client>();
@EJB
CartonService cartonservice;
@EJB
EmplacementService emplacementservice;
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response displayCarton()
{
cartons=cartonservice.afficher_carton();
if(cartons!=null)
{
return Response.status(Status.OK).entity(cartons).build();
}
return Response.status(Status.NO_CONTENT).build();
}
@GET
@Path("rech1/{idcodecarton}")
@Produces(MediaType.APPLICATION_JSON)
public Response displayCarton_avec_codecartonclient(@PathParam("idcodecarton") int idcodecarton)
{
Carton carton=cartonservice.rechercher_carton_avec_codecartonclient(idcodecarton);
if(carton!=null)
{
return Response.status(Status.OK).entity(carton).build();
}
return Response.status(Status.NO_CONTENT).build();
}
@GET
@Path("rech2/{nom}")
@Produces(MediaType.APPLICATION_JSON)
public Response displayCarton_nomclient(@PathParam("nom") String nom)
{
cartons=cartonservice.rechercher_carton_avec_nomclient(nom);
if(cartons!=null)
{
return Response.status(Status.OK).entity(cartons).build();
}
return Response.status(Status.NO_CONTENT).build();
}
@GET
@Path("clients")
@Produces(MediaType.APPLICATION_JSON)
public Response displayClient()
{
clients=cartonservice.afficher_client();
if(clients!=null)
{
return Response.status(Status.OK).entity(clients).build();
}
return Response.status(Status.NO_CONTENT).build();
}
@POST
@Path("{idclient}/{idCartonClient}/{arrivalDate}/{destructionDate}/{duration}")
@Consumes(MediaType.APPLICATION_JSON)
public Response add_Carton(@PathParam("idclient") int idclient,@PathParam("idCartonClient") int idCartonClient,@PathParam("arrivalDate") String arrivalDate,@PathParam("destructionDate") String destructionDate,@PathParam("duration") long duration) throws ParseException
{
Client client=new Client();
client=cartonservice.rechercher_client_avec_id(idclient);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
java.util.Date parsed =format.parse(arrivalDate);
java.sql.Date sql = new java.sql.Date(parsed.getTime());
SimpleDateFormat formt = new SimpleDateFormat("yyyy-MM-dd");
java.util.Date pars =formt.parse(destructionDate);
java.sql.Date sql_date = new java.sql.Date(pars.getTime());
Carton carton=new Carton();
carton.setIdCartonClient(idCartonClient);
carton.setArrivalDate(sql);
carton.setDestructionDate(sql_date);
carton.setDuration(duration);
if(cartonservice.ajoutercarton(carton, client)==true)
{
return Response.status(Status.OK).entity("ok").build();
}
return Response.status(Status.NO_CONTENT).build();
}
@POST
@Path("/remplir/{idcarton}/{idlocation}")
@Consumes(MediaType.APPLICATION_JSON)
public Response affect_Carton_to_Location(@PathParam("idcarton") int idcarton,@PathParam("idlocation") int idlocation)
{
Carton carton =cartonservice.rechercher_carton_avec_id(idcarton);;
Location location=emplacementservice.rechercher_emplacement_avec_id(idlocation);
if(cartonservice.affectercarton_au_emplacement(carton, location)==true)
{
return Response.status(Status.OK).entity("ok").build();
}
return Response.status(Status.NO_CONTENT).build();
}
@POST
@Path("/{idcarton}/{idclient}")
@Consumes(MediaType.APPLICATION_JSON)
public Response affect_Carton_to_Client(@PathParam("idcarton") int idcarton,@PathParam("idclient") int idclient)
{
Carton carton =new Carton();
carton=cartonservice.rechercher_carton_avec_id(idcarton);
Client client=new Client();
client=cartonservice.rechercher_client_avec_id(idclient);
if(cartonservice.affectercarton_au_client(carton, client)==true)
{
return Response.status(Status.OK).entity("ok").build();
}
return Response.status(Status.NO_CONTENT).build();
}
@DELETE
@Path("{id}")
@Consumes(MediaType.APPLICATION_JSON)
public Response delete_carton(@PathParam("id") int id)
{
Carton carton=cartonservice.rechercher_carton_avec_id(id);
if(cartonservice.detruire_carton(carton)==true)
{
return Response.status(Status.OK).entity("ok").build();
}
return Response.status(Status.NOT_FOUND).build();
}
}
| [
"[email protected]"
] | |
2751b4f52a69692224b4e0bb5269f5e4a0a04575 | a2586ffe167249aac02d7a11041644e7516cb6f8 | /app/src/main/java/com/example/schedulecreator/ScheduleUtils/ScheduleCreatorUtil.java | 2e1c656075bd838005e9c492cb08dfccde8cc70a | [] | no_license | antonioS87/ScheduleCreator | 1a0afac03771f1f0420d802131ba730cdad90bea | f857ae3a9f78fc6a3d2f36248b1249f9068777cf | refs/heads/master | 2023-02-26T09:47:47.086176 | 2021-01-31T20:27:15 | 2021-01-31T20:27:15 | 306,467,743 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,317 | java | package com.example.schedulecreator.ScheduleUtils;
import android.util.Log;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.Observer;
import com.example.schedulecreator.Interfaces.SchedulerSettingsManager;
import com.example.schedulecreator.Models.DayOfWeek;
import com.example.schedulecreator.Models.Schedule;
import com.example.schedulecreator.Database.HolidayDb;
import com.example.schedulecreator.Database.Worker;
import com.example.schedulecreator.Repositories.HolidayRepoManager;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
public class ScheduleCreatorUtil {
//List of worker available for scheduling
private ArrayList<Worker> selectedWorkers = new ArrayList<>();
//Schedule in which ordered scheduled days will be stored
private Schedule mSchedule;
private Date mStartDate;
private Date mEndDate;
private DayOfWeek dayOfWeek;
private ArrayList<HolidayDb> holidays;
public void generateSchedule(SchedulerSettingsManager settings, LifecycleOwner activity, HolidayRepoManager holidayRepoManager){
Log.d("generator_test", " Generating schedule....");
mStartDate = settings.getStartDate().getValue();
mEndDate = settings.getEndDate().getValue();
if(holidayRepoManager.getHolidays().getValue() != null){
holidays = holidayRepoManager.getHolidays().getValue();
}
//Create new schedule and fill it with blank dates
Schedule schedule = new Schedule();
Calendar cal = Calendar.getInstance();
cal.setTime(mStartDate);
while(cal.getTime().before(mEndDate)){
//Get the date
Date date = cal.getTime();
//If the date is not a holiday assign it to an eligible worker
if(!isHolliday(date)){
Log.d("holiday_test", " day is NOT HOLIDAY: " + date.toString());
// schedule.addDay(new ScheduledDay(date, getEligibleWorkerId(date)));
}else{
Log.d("holiday_test", " day IS HOLIDAY: " + date.toString());
// schedule.addDay(new ScheduledDay(date, null));
}
cal.add(Calendar.DAY_OF_MONTH, 1);
}
for(Worker worker : settings.getSchedulerSettPersonnelList().getValue()){
if(worker.getSelected().getValue()){
selectedWorkers.add(worker);
Log.d("antonio_test", " adding worker to selected list: " + worker.toString());
}
}
holidayRepoManager.getHolidays().observe(activity, new Observer<ArrayList<HolidayDb>>() {
@Override
public void onChanged(ArrayList<HolidayDb> holidays) {
for(HolidayDb holiday : holidays){
Log.d("generator_test", " Holiday: " + holiday.getName() + " " + holiday.getDate());
}
}
});
Calendar calendar = Calendar.getInstance();
calendar.setTime(mStartDate);
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy");
}
private String getEligibleWorkerId(Date date) {
return "workerId";
}
private boolean isHolliday(Date date) {
return holidays.contains(date) ? true : false;
}
}
| [
"[email protected]"
] | |
2b5619a8c4292f035ee5441b7ac73353c5a6370b | 42e94aa09fe8d979f77449e08c67fa7175a3e6eb | /src/net/minecraft/network/status/server/S01PacketPong.java | 8ebb0bf2733332ff21def7293e591b20a5adbbf9 | [
"Unlicense"
] | permissive | HausemasterIssue/novoline | 6fa90b89d5ebf6b7ae8f1d1404a80a057593ea91 | 9146c4add3aa518d9aa40560158e50be1b076cf0 | refs/heads/main | 2023-09-05T00:20:17.943347 | 2021-11-26T02:35:25 | 2021-11-26T02:35:25 | 432,312,803 | 1 | 0 | Unlicense | 2021-11-26T22:12:46 | 2021-11-26T22:12:45 | null | UTF-8 | Java | false | false | 728 | java | package net.minecraft.network.status.server;
import java.io.IOException;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.status.INetHandlerStatusClient;
public class S01PacketPong implements Packet {
public long clientTime;
public S01PacketPong() {
}
public S01PacketPong(long var1) {
this.clientTime = var1;
}
public void readPacketData(PacketBuffer var1) throws IOException {
this.clientTime = var1.readLong();
}
public void writePacketData(PacketBuffer var1) throws IOException {
var1.writeLong(this.clientTime);
}
public void processPacket(INetHandlerStatusClient var1) {
var1.handlePong(this);
}
}
| [
"[email protected]"
] | |
98fe5cc9fe456a60cd934338cdf63988396703e4 | 8af1aa1ffb75ef3c350d87f56b9f30d099a7d9a5 | /src/com/mmm/entity/Member.java | 691af150e73ebf2d7d79c02fac500eb82eb67340 | [] | no_license | tdlite/CashBook | bda28b24221a06a29fc2cea2080e43681c5a20a8 | b22f6827cdf4872c2fd289455d07b6ea1ebfcbdf | refs/heads/master | 2020-03-30T17:58:41.579002 | 2012-05-01T08:49:34 | 2012-05-01T08:49:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 615 | java | package com.mmm.entity;
import javax.persistence.*;
/**
* @author galimru
*/
@Entity
@Table(name = "members")
public class Member {
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(name = "name")
private String name;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
}
| [
"[email protected]"
] | |
48ef03eee789fcf7e971dcc5209eccc20d47e7b5 | 101f9fea43526cc6a4ef692b8ae492dd4607aec0 | /app/src/main/java/com/ionic/ekhelp/ui/item/entry/ItemEntryActivity.java | 73b0603af1609ef97f3abb39a1005115e92cbffe | [] | no_license | indresh999/ekhelp-android | 451433b6edc03a8d285d17e45487fbec630d21e8 | 659524aa008ec8ff1a268b0103ec275691962317 | refs/heads/master | 2023-03-14T07:21:57.159614 | 2021-03-06T13:01:11 | 2021-03-06T13:01:11 | 345,089,382 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,461 | java | package com.ionic.ekhelp.ui.item.entry;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;
import androidx.fragment.app.Fragment;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import com.ionic.ekhelp.Config;
import com.ionic.ekhelp.R;
import com.ionic.ekhelp.databinding.ActivityItemEntryBinding;
import com.ionic.ekhelp.ui.common.PSAppCompactActivity;
import com.ionic.ekhelp.utils.Constants;
import com.ionic.ekhelp.utils.MyContextWrapper;
public class ItemEntryActivity extends PSAppCompactActivity {
//region Override Methods
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityItemEntryBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_item_entry);
// Init all UI
initUI(binding);
}
@Override
protected void attachBaseContext(Context newBase) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(newBase);
String CURRENT_LANG_CODE = preferences.getString(Constants.LANGUAGE_CODE, Config.DEFAULT_LANGUAGE);
String CURRENT_LANG_COUNTRY_CODE = preferences.getString(Constants.LANGUAGE_COUNTRY_CODE, Config.DEFAULT_LANGUAGE_COUNTRY_CODE);
super.attachBaseContext(MyContextWrapper.wrap(newBase, CURRENT_LANG_CODE, CURRENT_LANG_COUNTRY_CODE, true));
}
//endregion
//region Private Methods
private void initUI(ActivityItemEntryBinding binding) {
// Toolbar
initToolbar(binding.toolbar, getString(R.string.item_entry_toolbar));
// setup Fragment
setupFragment(new ItemEntryFragment());
// Or you can call like this
//setupFragment(new NewsListFragment(), R.id.content_frame);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.content_frame);
if (fragment != null) {
fragment.onActivityResult(requestCode, resultCode, data);
}
}
}
| [
"[email protected]"
] | |
792a680ad5346df9114ecfc5d84f23468dca1f98 | 77a76c2a0fcf6f658fb77455a97124fbc74cb527 | /src/com/coolPatternGroup/Main.java | 353804b5a8a062da1071215b233786ee3537b9d5 | [] | no_license | Cincle/Abstract-Factory-PoC | 5d33ded0191c35cd43719e0f193cb836edaef3a0 | 6b45894a9af75031fafa6d12ad8c6849ea523b67 | refs/heads/master | 2023-01-28T19:50:03.836795 | 2020-12-08T13:09:18 | 2020-12-08T13:09:18 | 317,513,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 230 | java | package com.coolPatternGroup;
import com.coolPatternGroup.view.MainView;
import javax.swing.*;
public class Main extends JFrame {
public static void main(String[] args) {
MainView mainView = new MainView();
}
}
| [
"[email protected]"
] | |
7a19456b504c99ab5de3d322ab32105369c85d29 | 52184d4dd2f072b6c680d67d496e0fb02f58f9b8 | /src/org/usfirst/frc/team1747/robot/commands/Setpoint1Preset.java | dfc7d507a4c2ebb73f4ec0528586f50cc9457777 | [] | no_license | frc1747/Robot2015 | 911d926c768284849dae68938ba434a762e75583 | 35899369fefee02ed35f1e946e23a17a3ed48b06 | refs/heads/master | 2021-01-15T13:43:13.225728 | 2016-01-14T00:27:15 | 2016-01-14T00:27:15 | 29,637,073 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 757 | java | package org.usfirst.frc.team1747.robot.commands;
import org.usfirst.frc.team1747.robot.Robot;
import org.usfirst.frc.team1747.robot.subsystems.Elevator;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.command.Command;
public class Setpoint1Preset extends Command {
Elevator elevator;
public Setpoint1Preset() {
elevator = Robot.getElevator();
requires(elevator);
}
protected void initialize() {
if(elevator.getCurrentPosition() > 4){
elevator.setCurrentPos(4);
elevator.moveToLevel();
Timer.delay(0.2);
}
elevator.setCurrentPos(2);
elevator.moveToLevel();
}
protected void execute() {
}
protected boolean isFinished() {
return true;
}
protected void end() {
}
protected void interrupted() {
}
} | [
"[email protected]"
] | |
ad15b40a76a9f8b21a0fc3b33047de8568d2bcc5 | d463e82f8f9c71213f95e8744d2316d0adfb9755 | /scan-mms-computing/plugin.src/sun/plugin/viewer/context/IExplorerAppletContext.java | 51ad9077073c3c733560f94ac6ad0fedc142f7e5 | [] | no_license | wahid-nwr/docArchive | b3a7d7ecf5d69a7483786fc9758e3c4d1520134d | 058e58bb45d91877719c8f9b560100ed78e6746d | refs/heads/master | 2020-03-14T07:06:09.629722 | 2018-05-01T18:23:55 | 2018-05-01T18:23:55 | 131,496,664 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,724 | java | package sun.plugin.viewer.context;
import java.net.URL;
import java.util.ArrayList;
import sun.plugin.AppletViewer;
public class IExplorerAppletContext extends DefaultPluginAppletContext
{
private int handle = 0;
private ArrayList locked = new ArrayList();
public void setAppletContextHandle(int paramInt)
{
this.handle = paramInt;
}
public int getAppletContextHandle()
{
return this.handle;
}
public void doShowDocument(URL paramURL, String paramString)
{
if (this.handle > 0)
{
Object localObject;
String str1;
if (paramURL.getProtocol().equals("javascript"))
{
localObject = new StringBuffer();
str1 = paramURL.toString();
for (int i = 0; i < str1.length(); i++)
{
char c = str1.charAt(i);
if ((c == '\'') || (c == '"') || (c == '\\'))
((StringBuffer)localObject).append('\\');
((StringBuffer)localObject).append(c);
}
String str2 = "javascript:window.open('" + localObject + "', '" + paramString + "')";
nativeInvokeScript(this.handle, 1, "execScript", new Object[] { str2 });
}
else
{
localObject = new Object[2];
str1 = paramURL.toString();
if ((str1.startsWith("file:/")) && (str1.length() > 6) && (str1.charAt(6) != '/'))
str1 = "file:///" + str1.substring(6);
localObject[0] = str1;
localObject[1] = paramString;
nativeInvokeScript(this.handle, 1, "open", (Object[])localObject);
}
}
}
public void doShowStatus(String paramString)
{
boolean bool = ((AppletViewer)this.appletPanel).isStopped();
if ((this.handle > 0) && (!bool))
{
Object[] arrayOfObject = new Object[1];
arrayOfObject[0] = paramString;
nativeInvokeScript(this.handle, 4, "status", arrayOfObject);
}
}
private native void nativeInvokeScript(int paramInt1, int paramInt2, String paramString, Object[] paramArrayOfObject);
public void onClose()
{
super.onClose();
this.handle = 0;
}
public synchronized netscape.javascript.JSObject getJSObject()
{
sun.plugin.javascript.ocx.JSObject localJSObject = getJSObject(this.handle);
localJSObject.setIExplorerAppletContext(this);
return localJSObject;
}
private native sun.plugin.javascript.ocx.JSObject getJSObject(int paramInt);
public void addJSObjectToLockedList(netscape.javascript.JSObject paramJSObject)
{
synchronized (this.locked)
{
this.locked.add(paramJSObject);
}
}
}
/* Location: /home/wahid/Downloads/webscanning/plugin.jar
* Qualified Name: sun.plugin.viewer.context.IExplorerAppletContext
* JD-Core Version: 0.6.2
*/ | [
"[email protected]"
] | |
7964d43f99c12cea4c15ed89e906eeec06805ee2 | 1d2dc7336b68592d51860a22b41c15fa3a7dc981 | /src/main/java/me/iblitzkriegi/vixio/expressions/embeds/ExprThumbnailOfEmbed.java | 0a409c8054d2d677bb954f8d7626270e08e449f3 | [] | no_license | JiveOff/Vixio | 08ed9a9963b6189f14b4eeceec593d12586cbe48 | 56e2a3c2c89b1ceb6be1c95ac69b8fd620bb48c0 | refs/heads/master | 2020-03-15T17:49:18.577549 | 2017-10-04T18:22:09 | 2017-10-04T18:22:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,881 | java | package me.iblitzkriegi.vixio.expressions.embeds;
import ch.njol.skript.lang.Expression;
import ch.njol.skript.lang.ExpressionType;
import ch.njol.skript.lang.SkriptParser;
import ch.njol.skript.lang.util.SimpleExpression;
import ch.njol.util.Kleenean;
import me.iblitzkriegi.vixio.effects.effembeds.EffCreateEmbed;
import me.iblitzkriegi.vixio.registration.ExprAnnotation;
import net.dv8tion.jda.core.EmbedBuilder;
import net.dv8tion.jda.core.entities.MessageEmbed;
import org.bukkit.event.Event;
/**
* Created by Blitz on 12/21/2016.
*/
@ExprAnnotation.Expression(
name = "ThumbnailOfEmbed",
title = "Thumbnail of Embed",
desc = "Get the Thumbnail of one of your Embeds",
syntax = "thumbnail of embed %string%",
returntype = String.class,
type = ExpressionType.SIMPLE,
example = "SUBMIT EXAMPLES TO Blitz#3273"
)
public class ExprThumbnailOfEmbed extends SimpleExpression<String>{
private Expression<String> vEmbed;
@Override
protected String[] get(Event e) {
return new String[]{getEmbed(e)};
}
@Override
public boolean isSingle() {
return true;
}
@Override
public Class<? extends String> getReturnType() {
return String.class;
}
@Override
public String toString(Event event, boolean b) {
return getClass().getName();
}
@Override
public boolean init(Expression<?>[] expr, int i, Kleenean kleenean, SkriptParser.ParseResult parseResult) {
vEmbed = (Expression<String>) expr[0];
return true;
}
private String getEmbed(Event e){
EmbedBuilder embedBuilder = EffCreateEmbed.embedBuilders.get(vEmbed.getSingle(e));
MessageEmbed embed = embedBuilder.build();
if(embed.getThumbnail()!=null){
return embed.getThumbnail().getUrl();
}
return null;
}
}
| [
"Blitz - Leave me alone"
] | Blitz - Leave me alone |
16bacb077083d05ad2b7891fe8884fcb8d91c552 | 49c5188700c617403a5178be54cc4be9db25aa1f | /ContaWeb/src/dao/RiepilogoDDTs.java | 7c20a638d64075d999b419f5cd62b8842991f068 | [] | no_license | fabiosantambrogio84/contaweb | 9de0653aef4ee39cc021dd881acda69a3685d37d | 8f3b2b679415f597ce699929a1def42f8ca8e2cf | refs/heads/master | 2021-06-05T03:46:09.524323 | 2018-03-27T11:59:33 | 2018-03-27T11:59:33 | 144,725,620 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,036 | java | package dao;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import vo.DDT;
import vo.Fattura;
import vo.VOElement;
public class RiepilogoDDTs extends VOElement
{
private static final long serialVersionUID = 2767346264394280662L;
private Date dataDal = null;
private Date dataAl = null;
private BigDecimal totale = null;
private List<DDT> listaDDTs = null;
private String tipo = null;
public Date getDataAl() {
return dataAl;
}
public void setDataAl(Date dataAl) {
this.dataAl = dataAl;
}
public Date getDataDal() {
return dataDal;
}
public void setDataDal(Date dataDal) {
this.dataDal = dataDal;
}
public void setListaDDTs(List<DDT> fatture)
{
this.listaDDTs = fatture;
}
public List<DDT> getListaDDTs() {
return listaDDTs;
}
public String getTipo() {
return tipo;
}
public void setTipo(String tipo) {
this.tipo = tipo;
}
public BigDecimal getTotale() {
return totale;
}
public void setTotale(BigDecimal totale) {
this.totale = totale;
}
}
| [
"[email protected]"
] | |
c29d139da45888c993e70b4708274c728cfb301d | baec60177f3a1ba3c44698b9c4a28312920844b8 | /src/test/java/steps/GlipEmailSignin.java | 3caeb84f90a57afecd1c005116f540f2e102253b | [] | no_license | zora1005/freda_demo_change | 03948807ea17a23dc80ee129e3b12a44c1fc2e61 | dfad3985e3f3453aa641b6f759c7a1d3867ef1af | refs/heads/master | 2021-05-13T20:36:27.422267 | 2018-01-09T08:09:37 | 2018-01-09T08:09:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,156 | java | package steps;
import GlipiOS.drivers.iOSAppiumDriverManagement;
//import GlipiOS.pages.EnvironmentScreen;
//import GlipiOS.pages.welcomeScreen;
//import GlipiOS.pages.signinScreen;
//import GlipiOS.pages.notificationScreen;
import GlipiOS.pages.*;
import cucumber.api.PendingException;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
import io.appium.java_client.AppiumDriver;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.PageFactory;
public class GlipEmailSignin {
public WebDriver startDriver = iOSAppiumDriverManagement.getInstance().getAppiumDriver();
//public AppiumDriver startDriver = iOSAppiumDriverManagement.getInstance().getAppiumDriver();
public welcomeScreen welcomeScreen;
public signinScreen signinScreen;
public EnvironmentScreen EnvironmentScreen;
public notificationScreen notificationScreen;
public UnifiedLogin UnifiedLoginScreen;
public DebugScreen DebugScreen;
@Given("^User has valid email and Password$")
public void userHasValidEmailAndPassword() {
// Write code here that turns the phrase above into concrete actions
System.out.println("User has valid Email and Password.");
System.out.println();
}
/* @Given("^User switch to correctly Env \"([^\"]*)\"$")
public void userSwitchToCorrectlyEnv(String Env) throws Throwable {
// Write code here that turns the phrase above into concrete actions
welcomeScreen = PageFactory.initElements(startDriver,welcomeScreen.class);
welcomeScreen.switchEnv();
//DebugScreen = PageFactory.initElements(startDriver,DebugScreen.class);
//DebugScreen.switchEnv2();
//EnvironmentScreen = PageFactory.initElements(startDriver,EnvironmentScreen.class);
//EnvironmentScreen.switchEnv3(Env);
//DebugScreen = PageFactory.initElements(startDriver,DebugScreen.class);
//DebugScreen.back();
System.out.println("User switch Env successfully.");
System.out.println();
}
*/
@When("^User inputs email \"([^\"]*)\" and Password \"([^\"]*)\"$")
public void userInputsEmailAndPassword(String emailAddress, String password) throws Throwable {
// Write code here that turns the phrase above into concrete actions
welcomeScreen = PageFactory.initElements(startDriver,welcomeScreen.class);
welcomeScreen.tapSignInButton();
System.out.println("Enter Sign in screen");
UnifiedLoginScreen = PageFactory.initElements(startDriver,UnifiedLogin.class);
UnifiedLoginScreen.UnifiedLogin(emailAddress,password);
System.out.println("Sign in");
}
@Then("^User can sign in app$")
public void userCanSignInApp() throws Throwable {
// Write code here that turns the phrase above into concrete actions
//notificationScreen = PageFactory.initElements(startDriver,notificationScreen.class);
//notificationScreen.TurnOnNotification();
System.out.println("User signs in successfully.");
System.out.println();
}
}
| [
"[email protected]"
] | |
a0e29cb5ec53b3d19214ac8fa17be006762a8c6d | 5ecd15baa833422572480fad3946e0e16a389000 | /framework/Synergetics-Open/subsystems/repository/main/api/java/com/volantis/mcs/repository/lock/Lock.java | 9d8afff9f69c96780144def06a9a95a060d991c7 | [] | no_license | jabley/volmobserverce | 4c5db36ef72c3bb7ef20fb81855e18e9b53823b9 | 6d760f27ac5917533eca6708f389ed9347c7016d | refs/heads/master | 2021-01-01T05:31:21.902535 | 2009-02-04T02:29:06 | 2009-02-04T02:29:06 | 38,675,289 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,669 | java | /*
This file is part of Volantis Mobility Server.
Volantis Mobility Server is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Volantis Mobility Server 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 Volantis Mobility Server. If not, see <http://www.gnu.org/licenses/>.
*/
/* ----------------------------------------------------------------------------
* (c) Volantis Systems Ltd 2005.
* ----------------------------------------------------------------------------
*/
package com.volantis.mcs.repository.lock;
import java.security.Principal;
/**
* A lock in the JDBC repository.
*
* <p>A lock is used to protect access to a particular resource within a JDBC
* repository. It can be in one of two states, locked or unlocked. When it is
* locked there is a row in a lock table that contains the identifier of the
* resource that is locked and the name of the principal that owns the lock. If
* no such row exists then the lock is not locked.</p>
*
* <p>A lock can be created in an unlocked state using
* {@link LockManager#getLock(String)}. When it is locked a row is created in
* the lock table and when it is unlocked the entry is removed. If concurrent
* requests are made to lock the same lock then one request will succeed and
* the rest will fail.</p>
*/
public interface Lock {
/**
* Get the identifier of the resource that is locked.
*
* @return The identifier of the resource that is locked.
*/
String getResourceIdentifier();
/**
* The owner of the lock.
*
* @return The owner of the lock, or null if the lock is not locked.
*/
Principal getOwner();
/**
* Get the time at which the lock was acquired.
*
* <p>This is the time on the server.</p>
*
* @return The time the lock was acquired.
*/
long getAcquisitionTime();
/**
* Check the state of the lock.
*
* @return True if the lock is locked and false if it is not.
*/
boolean isLocked();
/**
* Acquire the lock.
*
* <p>This will attempt to acquire the lock on behalf of the specified
* principal. One of three things will occur.</p>
*
* <ul>
* <li>The lock was successfully acquired for the principal in which case
* this method returns true and the owner is set to this principal.</li>
* <li>The lock was acquired by another principal in which case this
* method returns false and the owner is set to the other principal.</li>
* <li>An error occurred while attempting to access the database. In this
* case an exception is thrown and the state of the lock is not
* changed.</li>
* </ul>
*
* @param principal The principal that wants to own the lock.
* @return True if the lock was acquired for the specified principal, false
* if it was not.
* @throws IllegalStateException if the lock is already locked.
*/
boolean acquire(Principal principal) throws LockException;
/**
* Release the lock.
*
* @param principal The principal that owns the lock.
*
* @throws IllegalStateException if the lock is not locked by the specified
* principal.
*/
void release(Principal principal);
}
| [
"iwilloug@b642a0b7-b348-0410-9912-e4a34d632523"
] | iwilloug@b642a0b7-b348-0410-9912-e4a34d632523 |
0b3c910c239e8119778a35b81ab53fb02141d910 | 33fbead5bf09164290de5e1731b1a92e60693cd7 | /src/main/java/com/spittr/mapper/master/MomentMapper.java | 0e203095e7221a3f70a998008d0ac1829c03c6f3 | [] | no_license | CodeTheft/spring-boot-demo | c2dc6ab211a29da812b8eeb036e9de73cb6a9535 | 58cea5d6b53ac360f9c1d163acc7df188e95d239 | refs/heads/master | 2021-01-11T19:04:10.262322 | 2018-08-18T17:05:12 | 2018-08-18T17:05:12 | 79,307,478 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,309 | java | package com.spittr.mapper.master;
import java.util.Map;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;
import com.spittr.model.Moment;
/**
* 动态相关数据操作
*
* @author chufei
* @date 2017年7月4日
*/
@Mapper
public interface MomentMapper {
/**
* 添加动态
*
* @param params 入参集合,具体如下
* <p>userId: 发布人id</p>
* <p>content: 发布文本内容</p>
* <p>is_display: 是否对外显示,0-不显示,1-显示</p>
* <p>createdTime: 发布时间</p>
* <p>updatedTime: 最后操作时间</p>
* @return 返回动态id
*/
@Insert(value = "insert into `moments` (`user_id`, `content`, `is_display`, `created_time`, `updated_time`) "
+ "values (#{userId}, #{content}, #{isDisplay}, #{createdTime}, #{updatedTime})")
@SelectKey(before = false, keyProperty = "id", resultType = Long.class, statement = { "SELECT LAST_INSERT_ID()" })
public void addMoment(Map<String, Object> params);
/**
* 设置动态对外显示状态
*
* @param params 入参集合,具体如下
* <p>isDisplay: 设置是否对外显示,0-不显示,1-显示</p>
* <p>updatedTime: 最后操作时间</p>
* <p>id: 动态id</p>
* @return 返回操作行数
*/
@Update(value = "update `moments` set `is_display` = #{isDisplay}, `updated_time` = #{updatedTime} where `id` = #{id}")
public int displayMoment(Map<String, Object> params);
/**
* 逻辑删除动态
*
* @param id
* 动态id
* @return 返回操作行数
*/
@Update(value = "update `moments` set `is_delete` = 1, `updated_time` = now() where `id` = #{id}")
public int deleteMoment(long id);
/**
* 根据动态id获取动态信息
*
* @param id
* 动态id
* @return 返回动态对象
*/
@Select(value = "select " + "`id` as id, " + "`user_id` as userId, " + "`content` as content, "
+ "`reply_count` as replyCount, " + "`is_display` as isDisplay, " + "`is_delete` as isDelete, "
+ "`memo` as memo, " + "`created_time` as createdTime, " + "`updated_time` as updatedTime "
+ "from `moments` where `id` = #{id}")
public Moment getMomentById(long id);
}
| [
"[email protected]"
] | |
75672497474fb0c8e5588c08742847fa5df54fda | 514ba9102d19e97629435f9357603dcc35236bc1 | /Viviane_ProjetoCompiladores/src/compiler/SyntaxCheckerTokenManager.java | 56854e7cefbe33e5de812c9805559b232c31959d | [] | no_license | honoratovivis/compiladoresJAVACC | 6a8b2c4df276541f6cefa07b0681ceb659cd2438 | e6aa0080cda3f1ee8a094f90d5deb8d412a66e79 | refs/heads/main | 2023-04-23T22:51:47.694604 | 2021-04-28T02:04:17 | 2021-04-28T02:04:17 | 362,308,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 63,255 | java | /* Generated By:JavaCC: Do not edit this line. SyntaxCheckerTokenManager.java */
package compiler;
/** Token Manager. */
public class SyntaxCheckerTokenManager implements SyntaxCheckerConstants
{
/** Debug output. */
public static java.io.PrintStream debugStream = System.out;
/** Set debug output. */
public static void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
private static final int jjStopStringLiteralDfa_0(int pos, long active0, long active1)
{
switch (pos)
{
case 0:
if ((active0 & 0x280000000000L) != 0L)
return 3;
if ((active0 & 0xffffff800L) != 0L || (active1 & 0x2000L) != 0L)
{
jjmatchedKind = 68;
return 1;
}
return -1;
case 1:
if ((active0 & 0xffffdf800L) != 0L || (active1 & 0x2000L) != 0L)
{
jjmatchedKind = 68;
jjmatchedPos = 1;
return 1;
}
if ((active0 & 0x20000L) != 0L)
return 1;
return -1;
case 2:
if ((active0 & 0xfbfbdf800L) != 0L || (active1 & 0x2000L) != 0L)
{
jjmatchedKind = 68;
jjmatchedPos = 2;
return 1;
}
if ((active0 & 0x40400000L) != 0L)
return 1;
return -1;
case 3:
if ((active0 & 0x5bea9f000L) != 0L || (active1 & 0x2000L) != 0L)
{
jjmatchedKind = 68;
jjmatchedPos = 3;
return 1;
}
if ((active0 & 0xa01140800L) != 0L)
return 1;
return -1;
case 4:
if ((active0 & 0x53a81b000L) != 0L || (active1 & 0x2000L) != 0L)
{
jjmatchedKind = 68;
jjmatchedPos = 4;
return 1;
}
if ((active0 & 0x84284000L) != 0L)
return 1;
return -1;
case 5:
if ((active0 & 0x418012000L) != 0L)
{
if (jjmatchedPos != 5)
{
jjmatchedKind = 68;
jjmatchedPos = 5;
}
return 1;
}
if ((active0 & 0x122809000L) != 0L || (active1 & 0x2000L) != 0L)
return 1;
return -1;
case 6:
if ((active0 & 0x10000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 68;
jjmatchedPos = 5;
}
return -1;
}
if ((active0 & 0x10000000L) != 0L)
{
jjmatchedKind = 68;
jjmatchedPos = 6;
return 1;
}
if ((active0 & 0x408002000L) != 0L)
return 1;
return -1;
case 7:
if ((active0 & 0x10000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 68;
jjmatchedPos = 5;
}
return -1;
}
if ((active0 & 0x10000000L) != 0L)
{
jjmatchedKind = 68;
jjmatchedPos = 7;
return 1;
}
return -1;
case 8:
if ((active0 & 0x10000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 68;
jjmatchedPos = 5;
}
return -1;
}
if ((active0 & 0x10000000L) != 0L)
return 1;
return -1;
case 9:
if ((active0 & 0x10000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 68;
jjmatchedPos = 5;
}
return -1;
}
return -1;
case 10:
if ((active0 & 0x10000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 68;
jjmatchedPos = 5;
}
return -1;
}
return -1;
case 11:
if ((active0 & 0x10000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 68;
jjmatchedPos = 5;
}
return -1;
}
return -1;
case 12:
if ((active0 & 0x10000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 68;
jjmatchedPos = 5;
}
return -1;
}
return -1;
case 13:
if ((active0 & 0x10000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 68;
jjmatchedPos = 5;
}
return -1;
}
return -1;
case 14:
if ((active0 & 0x10000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 68;
jjmatchedPos = 5;
}
return -1;
}
return -1;
case 15:
if ((active0 & 0x10000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 68;
jjmatchedPos = 5;
}
return -1;
}
return -1;
case 16:
if ((active0 & 0x10000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 68;
jjmatchedPos = 5;
}
return -1;
}
return -1;
case 17:
if ((active0 & 0x10000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 68;
jjmatchedPos = 5;
}
return -1;
}
return -1;
default :
return -1;
}
}
private static final int jjStartNfa_0(int pos, long active0, long active1)
{
return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0, active1), pos + 1);
}
static private int jjStopAtPos(int pos, int kind)
{
jjmatchedKind = kind;
jjmatchedPos = pos;
return pos + 1;
}
static private int jjMoveStringLiteralDfa0_0()
{
switch(curChar)
{
case 33:
jjmatchedKind = 67;
return jjMoveStringLiteralDfa1_0(0x1000000000000000L, 0x0L);
case 37:
jjmatchedKind = 50;
return jjMoveStringLiteralDfa1_0(0x80000000000000L, 0x0L);
case 38:
return jjMoveStringLiteralDfa1_0(0x0L, 0x2L);
case 40:
return jjStopAtPos(0, 38);
case 41:
return jjStopAtPos(0, 39);
case 42:
jjmatchedKind = 48;
return jjMoveStringLiteralDfa1_0(0x20000000000000L, 0x0L);
case 43:
jjmatchedKind = 46;
return jjMoveStringLiteralDfa1_0(0x208000000000000L, 0x0L);
case 44:
return jjStopAtPos(0, 42);
case 45:
jjmatchedKind = 47;
return jjMoveStringLiteralDfa1_0(0x410000000000000L, 0x0L);
case 46:
jjmatchedKind = 43;
return jjMoveStringLiteralDfa1_0(0x200000000000L, 0x0L);
case 47:
jjmatchedKind = 49;
return jjMoveStringLiteralDfa1_0(0x40000000000060L, 0x0L);
case 59:
return jjStopAtPos(0, 44);
case 60:
jjmatchedKind = 61;
return jjMoveStringLiteralDfa1_0(0x8000000000000000L, 0x0L);
case 61:
jjmatchedKind = 56;
return jjMoveStringLiteralDfa1_0(0x800000000000000L, 0x0L);
case 62:
jjmatchedKind = 62;
return jjMoveStringLiteralDfa1_0(0x0L, 0x1L);
case 83:
return jjMoveStringLiteralDfa1_0(0x100010000L, 0x0L);
case 91:
return jjStopAtPos(0, 40);
case 93:
return jjStopAtPos(0, 41);
case 98:
return jjMoveStringLiteralDfa1_0(0x400000000L, 0x0L);
case 99:
return jjMoveStringLiteralDfa1_0(0x201004000L, 0x0L);
case 101:
return jjMoveStringLiteralDfa1_0(0x440000L, 0x0L);
case 102:
return jjMoveStringLiteralDfa1_0(0x84200000L, 0x0L);
case 105:
return jjMoveStringLiteralDfa1_0(0x40021000L, 0x0L);
case 110:
return jjMoveStringLiteralDfa1_0(0x800L, 0x0L);
case 112:
return jjMoveStringLiteralDfa1_0(0x38002000L, 0x2000L);
case 114:
return jjMoveStringLiteralDfa1_0(0x8000L, 0x0L);
case 115:
return jjMoveStringLiteralDfa1_0(0x2800000L, 0x0L);
case 116:
return jjMoveStringLiteralDfa1_0(0x100000L, 0x0L);
case 118:
return jjMoveStringLiteralDfa1_0(0x800000000L, 0x0L);
case 119:
return jjMoveStringLiteralDfa1_0(0x80000L, 0x0L);
case 123:
return jjStopAtPos(0, 36);
case 124:
return jjMoveStringLiteralDfa1_0(0x0L, 0x4L);
case 125:
return jjStopAtPos(0, 37);
default :
return jjMoveNfa_0(0, 0);
}
}
static private int jjMoveStringLiteralDfa1_0(long active0, long active1)
{
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(0, active0, active1);
return 1;
}
switch(curChar)
{
case 38:
if ((active1 & 0x2L) != 0L)
return jjStopAtPos(1, 65);
break;
case 42:
if ((active0 & 0x40L) != 0L)
return jjStopAtPos(1, 6);
else if ((active0 & 0x200000000000L) != 0L)
return jjStopAtPos(1, 45);
break;
case 43:
if ((active0 & 0x200000000000000L) != 0L)
return jjStopAtPos(1, 57);
break;
case 45:
if ((active0 & 0x400000000000000L) != 0L)
return jjStopAtPos(1, 58);
break;
case 47:
if ((active0 & 0x20L) != 0L)
return jjStopAtPos(1, 5);
break;
case 61:
if ((active0 & 0x8000000000000L) != 0L)
return jjStopAtPos(1, 51);
else if ((active0 & 0x10000000000000L) != 0L)
return jjStopAtPos(1, 52);
else if ((active0 & 0x20000000000000L) != 0L)
return jjStopAtPos(1, 53);
else if ((active0 & 0x40000000000000L) != 0L)
return jjStopAtPos(1, 54);
else if ((active0 & 0x80000000000000L) != 0L)
return jjStopAtPos(1, 55);
else if ((active0 & 0x800000000000000L) != 0L)
return jjStopAtPos(1, 59);
else if ((active0 & 0x1000000000000000L) != 0L)
return jjStopAtPos(1, 60);
else if ((active0 & 0x8000000000000000L) != 0L)
return jjStopAtPos(1, 63);
else if ((active1 & 0x1L) != 0L)
return jjStopAtPos(1, 64);
break;
case 97:
return jjMoveStringLiteralDfa2_0(active0, 0x1202000L, active1, 0L);
case 101:
return jjMoveStringLiteralDfa2_0(active0, 0x8000L, active1, 0L);
case 102:
if ((active0 & 0x20000L) != 0L)
return jjStartNfaWithStates_0(1, 17, 1);
break;
case 104:
return jjMoveStringLiteralDfa2_0(active0, 0x200080000L, active1, 0L);
case 105:
return jjMoveStringLiteralDfa2_0(active0, 0x4000000L, active1, 0L);
case 108:
return jjMoveStringLiteralDfa2_0(active0, 0x80044000L, active1, 0L);
case 109:
return jjMoveStringLiteralDfa2_0(active0, 0x1000L, active1, 0L);
case 110:
return jjMoveStringLiteralDfa2_0(active0, 0x40000000L, active1, 0L);
case 111:
return jjMoveStringLiteralDfa2_0(active0, 0xc00000000L, active1, 0L);
case 114:
return jjMoveStringLiteralDfa2_0(active0, 0x18500000L, active1, 0L);
case 116:
return jjMoveStringLiteralDfa2_0(active0, 0x102000000L, active1, 0L);
case 117:
return jjMoveStringLiteralDfa2_0(active0, 0x20000800L, active1, 0x2000L);
case 119:
return jjMoveStringLiteralDfa2_0(active0, 0x800000L, active1, 0L);
case 121:
return jjMoveStringLiteralDfa2_0(active0, 0x10000L, active1, 0L);
case 124:
if ((active1 & 0x4L) != 0L)
return jjStopAtPos(1, 66);
break;
default :
break;
}
return jjStartNfa_0(0, active0, active1);
}
static private int jjMoveStringLiteralDfa2_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(0, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(1, active0, active1);
return 2;
}
switch(curChar)
{
case 97:
return jjMoveStringLiteralDfa3_0(active0, 0x202004000L, active1, 0L);
case 98:
return jjMoveStringLiteralDfa3_0(active0, 0x20000000L, active1, 0x2000L);
case 99:
return jjMoveStringLiteralDfa3_0(active0, 0x2000L, active1, 0L);
case 105:
return jjMoveStringLiteralDfa3_0(active0, 0x808880000L, active1, 0L);
case 108:
return jjMoveStringLiteralDfa3_0(active0, 0x200800L, active1, 0L);
case 110:
return jjMoveStringLiteralDfa3_0(active0, 0x4000000L, active1, 0L);
case 111:
return jjMoveStringLiteralDfa3_0(active0, 0x490000000L, active1, 0L);
case 112:
return jjMoveStringLiteralDfa3_0(active0, 0x1000L, active1, 0L);
case 114:
if ((active0 & 0x400000L) != 0L)
return jjStartNfaWithStates_0(2, 22, 1);
return jjMoveStringLiteralDfa3_0(active0, 0x100000000L, active1, 0L);
case 115:
return jjMoveStringLiteralDfa3_0(active0, 0x1050000L, active1, 0L);
case 116:
if ((active0 & 0x40000000L) != 0L)
return jjStartNfaWithStates_0(2, 30, 1);
return jjMoveStringLiteralDfa3_0(active0, 0x8000L, active1, 0L);
case 117:
return jjMoveStringLiteralDfa3_0(active0, 0x100000L, active1, 0L);
default :
break;
}
return jjStartNfa_0(1, active0, active1);
}
static private int jjMoveStringLiteralDfa3_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(1, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(2, active0, active1);
return 3;
}
switch(curChar)
{
case 97:
return jjMoveStringLiteralDfa4_0(active0, 0x84000000L, active1, 0L);
case 100:
if ((active0 & 0x800000000L) != 0L)
return jjStartNfaWithStates_0(3, 35, 1);
break;
case 101:
if ((active0 & 0x40000L) != 0L)
return jjStartNfaWithStates_0(3, 18, 1);
else if ((active0 & 0x100000L) != 0L)
return jjStartNfaWithStates_0(3, 20, 1);
else if ((active0 & 0x1000000L) != 0L)
return jjStartNfaWithStates_0(3, 24, 1);
break;
case 105:
return jjMoveStringLiteralDfa4_0(active0, 0x100000000L, active1, 0L);
case 107:
return jjMoveStringLiteralDfa4_0(active0, 0x2000L, active1, 0L);
case 108:
if ((active0 & 0x800L) != 0L)
return jjStartNfaWithStates_0(3, 11, 1);
return jjMoveStringLiteralDfa4_0(active0, 0x420080000L, active1, 0x2000L);
case 111:
return jjMoveStringLiteralDfa4_0(active0, 0x1000L, active1, 0L);
case 114:
if ((active0 & 0x200000000L) != 0L)
return jjStartNfaWithStates_0(3, 33, 1);
break;
case 115:
return jjMoveStringLiteralDfa4_0(active0, 0x204000L, active1, 0L);
case 116:
return jjMoveStringLiteralDfa4_0(active0, 0x12810000L, active1, 0L);
case 117:
return jjMoveStringLiteralDfa4_0(active0, 0x8000L, active1, 0L);
case 118:
return jjMoveStringLiteralDfa4_0(active0, 0x8000000L, active1, 0L);
default :
break;
}
return jjStartNfa_0(2, active0, active1);
}
static private int jjMoveStringLiteralDfa4_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(2, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(3, active0, active1);
return 4;
}
switch(curChar)
{
case 97:
return jjMoveStringLiteralDfa5_0(active0, 0x8002000L, active1, 0L);
case 99:
return jjMoveStringLiteralDfa5_0(active0, 0x800000L, active1, 0L);
case 101:
if ((active0 & 0x80000L) != 0L)
return jjStartNfaWithStates_0(4, 19, 1);
else if ((active0 & 0x200000L) != 0L)
return jjStartNfaWithStates_0(4, 21, 1);
return jjMoveStringLiteralDfa5_0(active0, 0x410010000L, active1, 0L);
case 105:
return jjMoveStringLiteralDfa5_0(active0, 0x22000000L, active1, 0x2000L);
case 108:
if ((active0 & 0x4000000L) != 0L)
return jjStartNfaWithStates_0(4, 26, 1);
break;
case 110:
return jjMoveStringLiteralDfa5_0(active0, 0x100000000L, active1, 0L);
case 114:
return jjMoveStringLiteralDfa5_0(active0, 0x9000L, active1, 0L);
case 115:
if ((active0 & 0x4000L) != 0L)
return jjStartNfaWithStates_0(4, 14, 1);
break;
case 116:
if ((active0 & 0x80000000L) != 0L)
return jjStartNfaWithStates_0(4, 31, 1);
break;
default :
break;
}
return jjStartNfa_0(3, active0, active1);
}
static private int jjMoveStringLiteralDfa5_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(3, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(4, active0, active1);
return 5;
}
switch(curChar)
{
case 97:
return jjMoveStringLiteralDfa6_0(active0, 0x400000000L, active1, 0L);
case 99:
if ((active0 & 0x2000000L) != 0L)
return jjStartNfaWithStates_0(5, 25, 1);
else if ((active0 & 0x20000000L) != 0L)
{
jjmatchedKind = 29;
jjmatchedPos = 5;
}
return jjMoveStringLiteralDfa6_0(active0, 0x10000000L, active1, 0x2000L);
case 103:
if ((active0 & 0x100000000L) != 0L)
return jjStartNfaWithStates_0(5, 32, 1);
return jjMoveStringLiteralDfa6_0(active0, 0x2000L, active1, 0L);
case 104:
if ((active0 & 0x800000L) != 0L)
return jjStartNfaWithStates_0(5, 23, 1);
break;
case 109:
return jjMoveStringLiteralDfa6_0(active0, 0x10000L, active1, 0L);
case 110:
if ((active0 & 0x8000L) != 0L)
return jjStartNfaWithStates_0(5, 15, 1);
break;
case 116:
if ((active0 & 0x1000L) != 0L)
return jjStartNfaWithStates_0(5, 12, 1);
return jjMoveStringLiteralDfa6_0(active0, 0x8000000L, active1, 0L);
default :
break;
}
return jjStartNfa_0(4, active0, active1);
}
static private int jjMoveStringLiteralDfa6_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(4, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(5, active0, active1);
return 6;
}
switch(curChar)
{
case 32:
return jjMoveStringLiteralDfa7_0(active0, 0L, active1, 0x2000L);
case 46:
return jjMoveStringLiteralDfa7_0(active0, 0x10000L, active1, 0L);
case 101:
if ((active0 & 0x2000L) != 0L)
return jjStartNfaWithStates_0(6, 13, 1);
else if ((active0 & 0x8000000L) != 0L)
return jjStartNfaWithStates_0(6, 27, 1);
break;
case 110:
if ((active0 & 0x400000000L) != 0L)
return jjStartNfaWithStates_0(6, 34, 1);
break;
case 116:
return jjMoveStringLiteralDfa7_0(active0, 0x10000000L, active1, 0L);
default :
break;
}
return jjStartNfa_0(5, active0, active1);
}
static private int jjMoveStringLiteralDfa7_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(5, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(6, active0, active1);
return 7;
}
switch(curChar)
{
case 101:
return jjMoveStringLiteralDfa8_0(active0, 0x10000000L, active1, 0L);
case 111:
return jjMoveStringLiteralDfa8_0(active0, 0x10000L, active1, 0L);
case 115:
return jjMoveStringLiteralDfa8_0(active0, 0L, active1, 0x2000L);
default :
break;
}
return jjStartNfa_0(6, active0, active1);
}
static private int jjMoveStringLiteralDfa8_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(6, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(7, active0, active1);
return 8;
}
switch(curChar)
{
case 100:
if ((active0 & 0x10000000L) != 0L)
return jjStartNfaWithStates_0(8, 28, 1);
break;
case 116:
return jjMoveStringLiteralDfa9_0(active0, 0L, active1, 0x2000L);
case 117:
return jjMoveStringLiteralDfa9_0(active0, 0x10000L, active1, 0L);
default :
break;
}
return jjStartNfa_0(7, active0, active1);
}
static private int jjMoveStringLiteralDfa9_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(7, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(8, active0, active1);
return 9;
}
switch(curChar)
{
case 97:
return jjMoveStringLiteralDfa10_0(active0, 0L, active1, 0x2000L);
case 116:
return jjMoveStringLiteralDfa10_0(active0, 0x10000L, active1, 0L);
default :
break;
}
return jjStartNfa_0(8, active0, active1);
}
static private int jjMoveStringLiteralDfa10_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(8, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(9, active0, active1);
return 10;
}
switch(curChar)
{
case 46:
return jjMoveStringLiteralDfa11_0(active0, 0x10000L, active1, 0L);
case 116:
return jjMoveStringLiteralDfa11_0(active0, 0L, active1, 0x2000L);
default :
break;
}
return jjStartNfa_0(9, active0, active1);
}
static private int jjMoveStringLiteralDfa11_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(9, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(10, active0, active1);
return 11;
}
switch(curChar)
{
case 105:
return jjMoveStringLiteralDfa12_0(active0, 0L, active1, 0x2000L);
case 112:
return jjMoveStringLiteralDfa12_0(active0, 0x10000L, active1, 0L);
default :
break;
}
return jjStartNfa_0(10, active0, active1);
}
static private int jjMoveStringLiteralDfa12_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(10, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(11, active0, active1);
return 12;
}
switch(curChar)
{
case 99:
return jjMoveStringLiteralDfa13_0(active0, 0L, active1, 0x2000L);
case 114:
return jjMoveStringLiteralDfa13_0(active0, 0x10000L, active1, 0L);
default :
break;
}
return jjStartNfa_0(11, active0, active1);
}
static private int jjMoveStringLiteralDfa13_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(11, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(12, active0, active1);
return 13;
}
switch(curChar)
{
case 32:
return jjMoveStringLiteralDfa14_0(active0, 0L, active1, 0x2000L);
case 105:
return jjMoveStringLiteralDfa14_0(active0, 0x10000L, active1, 0L);
default :
break;
}
return jjStartNfa_0(12, active0, active1);
}
static private int jjMoveStringLiteralDfa14_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(12, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(13, active0, active1);
return 14;
}
switch(curChar)
{
case 110:
return jjMoveStringLiteralDfa15_0(active0, 0x10000L, active1, 0L);
case 118:
return jjMoveStringLiteralDfa15_0(active0, 0L, active1, 0x2000L);
default :
break;
}
return jjStartNfa_0(13, active0, active1);
}
static private int jjMoveStringLiteralDfa15_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(13, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(14, active0, active1);
return 15;
}
switch(curChar)
{
case 111:
return jjMoveStringLiteralDfa16_0(active0, 0L, active1, 0x2000L);
case 116:
return jjMoveStringLiteralDfa16_0(active0, 0x10000L, active1, 0L);
default :
break;
}
return jjStartNfa_0(14, active0, active1);
}
static private int jjMoveStringLiteralDfa16_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(14, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(15, active0, active1);
return 16;
}
switch(curChar)
{
case 105:
return jjMoveStringLiteralDfa17_0(active0, 0L, active1, 0x2000L);
case 108:
return jjMoveStringLiteralDfa17_0(active0, 0x10000L, active1, 0L);
default :
break;
}
return jjStartNfa_0(15, active0, active1);
}
static private int jjMoveStringLiteralDfa17_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(15, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(16, active0, active1);
return 17;
}
switch(curChar)
{
case 100:
return jjMoveStringLiteralDfa18_0(active0, 0L, active1, 0x2000L);
case 110:
if ((active0 & 0x10000L) != 0L)
return jjStopAtPos(17, 16);
break;
default :
break;
}
return jjStartNfa_0(16, active0, active1);
}
static private int jjMoveStringLiteralDfa18_0(long old0, long active0, long old1, long active1)
{
if (((active0 &= old0) | (active1 &= old1)) == 0L)
return jjStartNfa_0(16, old0, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(17, 0L, active1);
return 18;
}
switch(curChar)
{
case 32:
return jjMoveStringLiteralDfa19_0(active1, 0x2000L);
default :
break;
}
return jjStartNfa_0(17, 0L, active1);
}
static private int jjMoveStringLiteralDfa19_0(long old1, long active1)
{
if (((active1 &= old1)) == 0L)
return jjStartNfa_0(17, 0L, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(18, 0L, active1);
return 19;
}
switch(curChar)
{
case 109:
return jjMoveStringLiteralDfa20_0(active1, 0x2000L);
default :
break;
}
return jjStartNfa_0(18, 0L, active1);
}
static private int jjMoveStringLiteralDfa20_0(long old1, long active1)
{
if (((active1 &= old1)) == 0L)
return jjStartNfa_0(18, 0L, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(19, 0L, active1);
return 20;
}
switch(curChar)
{
case 97:
return jjMoveStringLiteralDfa21_0(active1, 0x2000L);
default :
break;
}
return jjStartNfa_0(19, 0L, active1);
}
static private int jjMoveStringLiteralDfa21_0(long old1, long active1)
{
if (((active1 &= old1)) == 0L)
return jjStartNfa_0(19, 0L, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(20, 0L, active1);
return 21;
}
switch(curChar)
{
case 105:
return jjMoveStringLiteralDfa22_0(active1, 0x2000L);
default :
break;
}
return jjStartNfa_0(20, 0L, active1);
}
static private int jjMoveStringLiteralDfa22_0(long old1, long active1)
{
if (((active1 &= old1)) == 0L)
return jjStartNfa_0(20, 0L, old1);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(21, 0L, active1);
return 22;
}
switch(curChar)
{
case 110:
if ((active1 & 0x2000L) != 0L)
return jjStopAtPos(22, 77);
break;
default :
break;
}
return jjStartNfa_0(21, 0L, active1);
}
static private int jjStartNfaWithStates_0(int pos, int kind, int state)
{
jjmatchedKind = kind;
jjmatchedPos = pos;
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) { return pos + 1; }
return jjMoveNfa_0(state, pos + 1);
}
static final long[] jjbitVec0 = {
0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
};
static private int jjMoveNfa_0(int startState, int curPos)
{
int startsAt = 0;
jjnewStateCnt = 43;
int i = 1;
jjstateSet[0] = startState;
int kind = 0x7fffffff;
for (;;)
{
if (++jjround == 0x7fffffff)
ReInitRounds();
if (curChar < 64)
{
long l = 1L << curChar;
do
{
switch(jjstateSet[--i])
{
case 0:
if ((0x3ff000000000000L & l) != 0L)
{
if (kind > 71)
kind = 71;
jjCheckNAddStates(0, 8);
}
else if (curChar == 34)
jjCheckNAddStates(9, 11);
else if (curChar == 39)
jjAddStates(12, 13);
else if (curChar == 46)
jjCheckNAdd(3);
break;
case 1:
if ((0x3ff001000000000L & l) == 0L)
break;
if (kind > 68)
kind = 68;
jjstateSet[jjnewStateCnt++] = 1;
break;
case 2:
if (curChar == 46)
jjCheckNAdd(3);
break;
case 3:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 73)
kind = 73;
jjCheckNAddStates(14, 16);
break;
case 5:
if ((0x280000000000L & l) != 0L)
jjCheckNAdd(6);
break;
case 6:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 73)
kind = 73;
jjCheckNAddTwoStates(6, 7);
break;
case 8:
if (curChar == 39)
jjAddStates(12, 13);
break;
case 9:
if ((0xffffff7fffffdbffL & l) != 0L)
jjCheckNAdd(10);
break;
case 10:
if (curChar == 39 && kind > 75)
kind = 75;
break;
case 12:
if ((0x8400000000L & l) != 0L)
jjCheckNAdd(10);
break;
case 13:
if ((0xff000000000000L & l) != 0L)
jjCheckNAddTwoStates(14, 10);
break;
case 14:
if ((0xff000000000000L & l) != 0L)
jjCheckNAdd(10);
break;
case 15:
if ((0xf000000000000L & l) != 0L)
jjstateSet[jjnewStateCnt++] = 16;
break;
case 16:
if ((0xff000000000000L & l) != 0L)
jjCheckNAdd(14);
break;
case 17:
if (curChar == 34)
jjCheckNAddStates(9, 11);
break;
case 18:
if ((0xfffffffbffffdbffL & l) != 0L)
jjCheckNAddStates(9, 11);
break;
case 20:
if ((0x8400000000L & l) != 0L)
jjCheckNAddStates(9, 11);
break;
case 21:
if (curChar == 34 && kind > 76)
kind = 76;
break;
case 22:
if ((0xff000000000000L & l) != 0L)
jjCheckNAddStates(17, 20);
break;
case 23:
if ((0xff000000000000L & l) != 0L)
jjCheckNAddStates(9, 11);
break;
case 24:
if ((0xf000000000000L & l) != 0L)
jjstateSet[jjnewStateCnt++] = 25;
break;
case 25:
if ((0xff000000000000L & l) != 0L)
jjCheckNAdd(23);
break;
case 26:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 71)
kind = 71;
jjCheckNAddStates(0, 8);
break;
case 27:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 71)
kind = 71;
jjCheckNAddTwoStates(27, 28);
break;
case 29:
if ((0x3ff000000000000L & l) != 0L)
jjCheckNAddTwoStates(29, 30);
break;
case 30:
if (curChar != 46)
break;
if (kind > 73)
kind = 73;
jjCheckNAddStates(21, 23);
break;
case 31:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 73)
kind = 73;
jjCheckNAddStates(21, 23);
break;
case 33:
if ((0x280000000000L & l) != 0L)
jjCheckNAdd(34);
break;
case 34:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 73)
kind = 73;
jjCheckNAddTwoStates(34, 7);
break;
case 35:
if ((0x3ff000000000000L & l) != 0L)
jjCheckNAddTwoStates(35, 36);
break;
case 37:
if ((0x280000000000L & l) != 0L)
jjCheckNAdd(38);
break;
case 38:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 73)
kind = 73;
jjCheckNAddTwoStates(38, 7);
break;
case 39:
if ((0x3ff000000000000L & l) != 0L)
jjCheckNAddStates(24, 26);
break;
case 41:
if ((0x280000000000L & l) != 0L)
jjCheckNAdd(42);
break;
case 42:
if ((0x3ff000000000000L & l) != 0L)
jjCheckNAddTwoStates(42, 7);
break;
default : break;
}
} while(i != startsAt);
}
else if (curChar < 128)
{
long l = 1L << (curChar & 077);
do
{
switch(jjstateSet[--i])
{
case 0:
if ((0x7fffffe07fffffeL & l) == 0L)
break;
if (kind > 68)
kind = 68;
jjCheckNAdd(1);
break;
case 1:
if ((0x7fffffe87fffffeL & l) == 0L)
break;
if (kind > 68)
kind = 68;
jjCheckNAdd(1);
break;
case 4:
if ((0x2000000020L & l) != 0L)
jjAddStates(27, 28);
break;
case 7:
if ((0x5000000050L & l) != 0L && kind > 73)
kind = 73;
break;
case 9:
if ((0xffffffffefffffffL & l) != 0L)
jjCheckNAdd(10);
break;
case 11:
if (curChar == 92)
jjAddStates(29, 31);
break;
case 12:
if ((0x14404410000000L & l) != 0L)
jjCheckNAdd(10);
break;
case 18:
if ((0xffffffffefffffffL & l) != 0L)
jjCheckNAddStates(9, 11);
break;
case 19:
if (curChar == 92)
jjAddStates(32, 34);
break;
case 20:
if ((0x14404410000000L & l) != 0L)
jjCheckNAddStates(9, 11);
break;
case 28:
if ((0x100000001000L & l) != 0L && kind > 71)
kind = 71;
break;
case 32:
if ((0x2000000020L & l) != 0L)
jjAddStates(35, 36);
break;
case 36:
if ((0x2000000020L & l) != 0L)
jjAddStates(37, 38);
break;
case 40:
if ((0x2000000020L & l) != 0L)
jjAddStates(39, 40);
break;
default : break;
}
} while(i != startsAt);
}
else
{
int i2 = (curChar & 0xff) >> 6;
long l2 = 1L << (curChar & 077);
do
{
switch(jjstateSet[--i])
{
case 9:
if ((jjbitVec0[i2] & l2) != 0L)
jjstateSet[jjnewStateCnt++] = 10;
break;
case 18:
if ((jjbitVec0[i2] & l2) != 0L)
jjAddStates(9, 11);
break;
default : break;
}
} while(i != startsAt);
}
if (kind != 0x7fffffff)
{
jjmatchedKind = kind;
jjmatchedPos = curPos;
kind = 0x7fffffff;
}
++curPos;
if ((i = jjnewStateCnt) == (startsAt = 43 - (jjnewStateCnt = startsAt)))
return curPos;
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) { return curPos; }
}
}
static private int jjMoveStringLiteralDfa0_2()
{
switch(curChar)
{
case 42:
return jjMoveStringLiteralDfa1_2(0x200L);
default :
return 1;
}
}
static private int jjMoveStringLiteralDfa1_2(long active0)
{
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return 1;
}
switch(curChar)
{
case 47:
if ((active0 & 0x200L) != 0L)
return jjStopAtPos(1, 9);
break;
default :
return 2;
}
return 2;
}
static private int jjMoveStringLiteralDfa0_1()
{
switch(curChar)
{
case 10:
return jjStopAtPos(0, 7);
default :
return 1;
}
}
static final int[] jjnextStates = {
27, 28, 29, 30, 35, 36, 39, 40, 7, 18, 19, 21, 9, 11, 3, 4,
7, 18, 19, 23, 21, 31, 32, 7, 39, 40, 7, 5, 6, 12, 13, 15,
20, 22, 24, 33, 34, 37, 38, 41, 42,
};
/** Token literal values. */
public static final String[] jjstrLiteralImages = {
"", null, null, null, null, null, null, null, null, null, null,
"\156\165\154\154", "\151\155\160\157\162\164", "\160\141\143\153\141\147\145",
"\143\154\141\163\163", "\162\145\164\165\162\156",
"\123\171\163\164\145\155\56\157\165\164\56\160\162\151\156\164\154\156", "\151\146", "\145\154\163\145", "\167\150\151\154\145", "\164\162\165\145",
"\146\141\154\163\145", "\145\162\162", "\163\167\151\164\143\150", "\143\141\163\145",
"\163\164\141\164\151\143", "\146\151\156\141\154", "\160\162\151\166\141\164\145",
"\160\162\157\164\145\143\164\145\144", "\160\165\142\154\151\143", "\151\156\164", "\146\154\157\141\164",
"\123\164\162\151\156\147", "\143\150\141\162", "\142\157\157\154\145\141\156", "\166\157\151\144",
"\173", "\175", "\50", "\51", "\133", "\135", "\54", "\56", "\73", "\56\52", "\53",
"\55", "\52", "\57", "\45", "\53\75", "\55\75", "\52\75", "\57\75", "\45\75", "\75",
"\53\53", "\55\55", "\75\75", "\41\75", "\74", "\76", "\74\75", "\76\75", "\46\46",
"\174\174", "\41", null, null, null, null, null, null, null, null, null,
"\160\165\142\154\151\143\40\163\164\141\164\151\143\40\166\157\151\144\40\155\141\151\156", };
/** Lexer state names. */
public static final String[] lexStateNames = {
"DEFAULT",
"comentarioSimples",
"comentarioLongo",
};
/** Lex State array. */
public static final int[] jjnewLexState = {
-1, -1, -1, -1, -1, 1, 2, 0, -1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1,
};
static final long[] jjtoToken = {
0xfffffffffffff801L, 0x3a9fL,
};
static final long[] jjtoSkip = {
0x7feL, 0x0L,
};
static protected SimpleCharStream input_stream;
static private final int[] jjrounds = new int[43];
static private final int[] jjstateSet = new int[86];
private static final StringBuilder jjimage = new StringBuilder();
private static StringBuilder image = jjimage;
private static int jjimageLen;
private static int lengthOfMatch;
static protected char curChar;
/** Constructor. */
public SyntaxCheckerTokenManager(SimpleCharStream stream){
if (input_stream != null)
throw new TokenMgrError("ERROR: Second call to constructor of static lexer. You must use ReInit() to initialize the static variables.", TokenMgrError.STATIC_LEXER_ERROR);
input_stream = stream;
}
/** Constructor. */
public SyntaxCheckerTokenManager(SimpleCharStream stream, int lexState){
this(stream);
SwitchTo(lexState);
}
/** Reinitialise parser. */
static public void ReInit(SimpleCharStream stream)
{
jjmatchedPos = jjnewStateCnt = 0;
curLexState = defaultLexState;
input_stream = stream;
ReInitRounds();
}
static private void ReInitRounds()
{
int i;
jjround = 0x80000001;
for (i = 43; i-- > 0;)
jjrounds[i] = 0x80000000;
}
/** Reinitialise parser. */
static public void ReInit(SimpleCharStream stream, int lexState)
{
ReInit(stream);
SwitchTo(lexState);
}
/** Switch to specified lex state. */
static public void SwitchTo(int lexState)
{
if (lexState >= 3 || lexState < 0)
throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
else
curLexState = lexState;
}
static protected Token jjFillToken()
{
final Token t;
final String curTokenImage;
final int beginLine;
final int endLine;
final int beginColumn;
final int endColumn;
String im = jjstrLiteralImages[jjmatchedKind];
curTokenImage = (im == null) ? input_stream.GetImage() : im;
beginLine = input_stream.getBeginLine();
beginColumn = input_stream.getBeginColumn();
endLine = input_stream.getEndLine();
endColumn = input_stream.getEndColumn();
t = Token.newToken(jjmatchedKind, curTokenImage);
t.beginLine = beginLine;
t.endLine = endLine;
t.beginColumn = beginColumn;
t.endColumn = endColumn;
return t;
}
static int curLexState = 0;
static int defaultLexState = 0;
static int jjnewStateCnt;
static int jjround;
static int jjmatchedPos;
static int jjmatchedKind;
/** Get the next Token. */
public static Token getNextToken()
{
Token matchedToken;
int curPos = 0;
EOFLoop :
for (;;)
{
try
{
curChar = input_stream.BeginToken();
}
catch(java.io.IOException e)
{
jjmatchedKind = 0;
matchedToken = jjFillToken();
return matchedToken;
}
image = jjimage;
image.setLength(0);
jjimageLen = 0;
switch(curLexState)
{
case 0:
try { input_stream.backup(0);
while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
curChar = input_stream.BeginToken();
}
catch (java.io.IOException e1) { continue EOFLoop; }
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_0();
break;
case 1:
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_1();
if (jjmatchedPos == 0 && jjmatchedKind > 8)
{
jjmatchedKind = 8;
}
break;
case 2:
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_2();
if (jjmatchedPos == 0 && jjmatchedKind > 10)
{
jjmatchedKind = 10;
}
break;
}
if (jjmatchedKind != 0x7fffffff)
{
if (jjmatchedPos + 1 < curPos)
input_stream.backup(curPos - jjmatchedPos - 1);
if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
{
matchedToken = jjFillToken();
TokenLexicalActions(matchedToken);
if (jjnewLexState[jjmatchedKind] != -1)
curLexState = jjnewLexState[jjmatchedKind];
return matchedToken;
}
else
{
if (jjnewLexState[jjmatchedKind] != -1)
curLexState = jjnewLexState[jjmatchedKind];
continue EOFLoop;
}
}
int error_line = input_stream.getEndLine();
int error_column = input_stream.getEndColumn();
String error_after = null;
boolean EOFSeen = false;
try { input_stream.readChar(); input_stream.backup(1); }
catch (java.io.IOException e1) {
EOFSeen = true;
error_after = curPos <= 1 ? "" : input_stream.GetImage();
if (curChar == '\n' || curChar == '\r') {
error_line++;
error_column = 0;
}
else
error_column++;
}
if (!EOFSeen) {
input_stream.backup(1);
error_after = curPos <= 1 ? "" : input_stream.GetImage();
}
throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
}
}
static void TokenLexicalActions(Token matchedToken)
{
switch(jjmatchedKind)
{
case 11 :
image.append(jjstrLiteralImages[11]);
lengthOfMatch = jjstrLiteralImages[11].length();
System.out.println("\u005cnPalavra Reservada: " +image);
break;
case 12 :
image.append(jjstrLiteralImages[12]);
lengthOfMatch = jjstrLiteralImages[12].length();
System.out.println("\u005cnPalavra Reservada: " +image);
break;
case 13 :
image.append(jjstrLiteralImages[13]);
lengthOfMatch = jjstrLiteralImages[13].length();
System.out.println("\u005cnPalavra Reservada: " +image);
break;
case 14 :
image.append(jjstrLiteralImages[14]);
lengthOfMatch = jjstrLiteralImages[14].length();
System.out.println("\u005cnPalavra Reservada: " +image);
break;
case 15 :
image.append(jjstrLiteralImages[15]);
lengthOfMatch = jjstrLiteralImages[15].length();
System.out.println("\u005cnPalavra Reservada: " +image);
break;
case 16 :
image.append(jjstrLiteralImages[16]);
lengthOfMatch = jjstrLiteralImages[16].length();
System.out.println("\u005cnPalavra Reservada: " +image);
break;
case 17 :
image.append(jjstrLiteralImages[17]);
lengthOfMatch = jjstrLiteralImages[17].length();
System.out.println("\u005cnPalavra Reservada: " +image);
break;
case 18 :
image.append(jjstrLiteralImages[18]);
lengthOfMatch = jjstrLiteralImages[18].length();
System.out.println("\u005cnPalavra Reservada: " +image);
break;
case 19 :
image.append(jjstrLiteralImages[19]);
lengthOfMatch = jjstrLiteralImages[19].length();
System.out.println("\u005cnPalavra Reservada: " +image);
break;
case 20 :
image.append(jjstrLiteralImages[20]);
lengthOfMatch = jjstrLiteralImages[20].length();
System.out.println("\u005cnPalavra Reservada: " +image);
break;
case 21 :
image.append(jjstrLiteralImages[21]);
lengthOfMatch = jjstrLiteralImages[21].length();
System.out.println("\u005cnPalavra Reservada: " +image);
break;
case 22 :
image.append(jjstrLiteralImages[22]);
lengthOfMatch = jjstrLiteralImages[22].length();
System.out.println("\u005cnPalavra Reservada: " +image);
break;
case 23 :
image.append(jjstrLiteralImages[23]);
lengthOfMatch = jjstrLiteralImages[23].length();
System.out.println ("\u005cnPalavra Reservada: "+image);
break;
case 24 :
image.append(jjstrLiteralImages[24]);
lengthOfMatch = jjstrLiteralImages[24].length();
System.out.println ("\u005cnPalavra Reservada: "+image);
break;
case 25 :
image.append(jjstrLiteralImages[25]);
lengthOfMatch = jjstrLiteralImages[25].length();
System.out.println("Modificador Static: " +image);
break;
case 26 :
image.append(jjstrLiteralImages[26]);
lengthOfMatch = jjstrLiteralImages[26].length();
System.out.println("Modificador Final: " +image);
break;
case 27 :
image.append(jjstrLiteralImages[27]);
lengthOfMatch = jjstrLiteralImages[27].length();
System.out.println("Modificador Private: " +image);
break;
case 28 :
image.append(jjstrLiteralImages[28]);
lengthOfMatch = jjstrLiteralImages[28].length();
System.out.println("Modificador Protected: " +image);
break;
case 29 :
image.append(jjstrLiteralImages[29]);
lengthOfMatch = jjstrLiteralImages[29].length();
System.out.println("Modificador Public: " +image);
break;
case 30 :
image.append(jjstrLiteralImages[30]);
lengthOfMatch = jjstrLiteralImages[30].length();
System.out.println("Tipo do Dado: " +image);
break;
case 31 :
image.append(jjstrLiteralImages[31]);
lengthOfMatch = jjstrLiteralImages[31].length();
System.out.println("Tipo do Dado: " +image);
break;
case 32 :
image.append(jjstrLiteralImages[32]);
lengthOfMatch = jjstrLiteralImages[32].length();
System.out.println("Tipo do Dado: " +image);
break;
case 33 :
image.append(jjstrLiteralImages[33]);
lengthOfMatch = jjstrLiteralImages[33].length();
System.out.println("Tipo do Dado: " +image);
break;
case 34 :
image.append(jjstrLiteralImages[34]);
lengthOfMatch = jjstrLiteralImages[34].length();
System.out.println("Tipo do Dado: " +image);
break;
case 35 :
image.append(jjstrLiteralImages[35]);
lengthOfMatch = jjstrLiteralImages[35].length();
System.out.println("Tipo do Dado: " +image);
break;
case 36 :
image.append(jjstrLiteralImages[36]);
lengthOfMatch = jjstrLiteralImages[36].length();
System.out.println("Delimitador: " +image);
break;
case 37 :
image.append(jjstrLiteralImages[37]);
lengthOfMatch = jjstrLiteralImages[37].length();
System.out.println("Delimitador: " +image);
break;
case 38 :
image.append(jjstrLiteralImages[38]);
lengthOfMatch = jjstrLiteralImages[38].length();
System.out.println("Delimitador: " +image);
break;
case 39 :
image.append(jjstrLiteralImages[39]);
lengthOfMatch = jjstrLiteralImages[39].length();
System.out.println("Delimitador: " +image);
break;
case 40 :
image.append(jjstrLiteralImages[40]);
lengthOfMatch = jjstrLiteralImages[40].length();
System.out.println("Delimitador: " +image);
break;
case 41 :
image.append(jjstrLiteralImages[41]);
lengthOfMatch = jjstrLiteralImages[41].length();
System.out.println("Delimitador: " +image);
break;
case 42 :
image.append(jjstrLiteralImages[42]);
lengthOfMatch = jjstrLiteralImages[42].length();
System.out.println("Delimitador: " +image);
break;
case 43 :
image.append(jjstrLiteralImages[43]);
lengthOfMatch = jjstrLiteralImages[43].length();
System.out.println("Delimitador: " +image);
break;
case 44 :
image.append(jjstrLiteralImages[44]);
lengthOfMatch = jjstrLiteralImages[44].length();
System.out.println("Delimitador: " +image);
break;
case 45 :
image.append(jjstrLiteralImages[45]);
lengthOfMatch = jjstrLiteralImages[45].length();
System.out.println("Delimitador: " +image);
break;
case 46 :
image.append(jjstrLiteralImages[46]);
lengthOfMatch = jjstrLiteralImages[46].length();
System.out.println("Operador Aritm\u00e9tico: " +image);
break;
case 47 :
image.append(jjstrLiteralImages[47]);
lengthOfMatch = jjstrLiteralImages[47].length();
System.out.println("Operador Aritm\u00e9tico: " +image);
break;
case 48 :
image.append(jjstrLiteralImages[48]);
lengthOfMatch = jjstrLiteralImages[48].length();
System.out.println("Operador Aritm\u00e9tico: " +image);
break;
case 49 :
image.append(jjstrLiteralImages[49]);
lengthOfMatch = jjstrLiteralImages[49].length();
System.out.println("Operador Aritm\u00e9tico: " +image);
break;
case 50 :
image.append(jjstrLiteralImages[50]);
lengthOfMatch = jjstrLiteralImages[50].length();
System.out.println("Operador Aritm\u00e9tico: " +image);
break;
case 51 :
image.append(jjstrLiteralImages[51]);
lengthOfMatch = jjstrLiteralImages[51].length();
System.out.println("Operador Aritm\u00e9tico: " +image);
break;
case 52 :
image.append(jjstrLiteralImages[52]);
lengthOfMatch = jjstrLiteralImages[52].length();
System.out.println("Operador Aritm\u00e9tico: " +image);
break;
case 53 :
image.append(jjstrLiteralImages[53]);
lengthOfMatch = jjstrLiteralImages[53].length();
System.out.println("Operador Aritm\u00e9tico: " +image);
break;
case 54 :
image.append(jjstrLiteralImages[54]);
lengthOfMatch = jjstrLiteralImages[54].length();
System.out.println("Operador Aritm\u00e9tico: " +image);
break;
case 55 :
image.append(jjstrLiteralImages[55]);
lengthOfMatch = jjstrLiteralImages[55].length();
System.out.println("Operador Aritm\u00e9tico: " +image);
break;
case 56 :
image.append(jjstrLiteralImages[56]);
lengthOfMatch = jjstrLiteralImages[56].length();
System.out.println("Operador de Atribui\u00e7\u00e3o: " +image);
break;
case 57 :
image.append(jjstrLiteralImages[57]);
lengthOfMatch = jjstrLiteralImages[57].length();
System.out.println("Operador de Incremento: " +image);
break;
case 58 :
image.append(jjstrLiteralImages[58]);
lengthOfMatch = jjstrLiteralImages[58].length();
System.out.println("Operador de Decremento: " +image);
break;
case 59 :
image.append(jjstrLiteralImages[59]);
lengthOfMatch = jjstrLiteralImages[59].length();
System.out.println("Operador de Igualdade: " +image);
break;
case 60 :
image.append(jjstrLiteralImages[60]);
lengthOfMatch = jjstrLiteralImages[60].length();
System.out.println("Operador de Diferen\u00e7a: " +image);
break;
case 61 :
image.append(jjstrLiteralImages[61]);
lengthOfMatch = jjstrLiteralImages[61].length();
System.out.println("Operador Relacional: " +image);
break;
case 62 :
image.append(jjstrLiteralImages[62]);
lengthOfMatch = jjstrLiteralImages[62].length();
System.out.println("Operador Relacional: " +image);
break;
case 63 :
image.append(jjstrLiteralImages[63]);
lengthOfMatch = jjstrLiteralImages[63].length();
System.out.println("Operador Relacional: " +image);
break;
case 64 :
image.append(jjstrLiteralImages[64]);
lengthOfMatch = jjstrLiteralImages[64].length();
System.out.println("Operador Relacional: " +image);
break;
case 65 :
image.append(jjstrLiteralImages[65]);
lengthOfMatch = jjstrLiteralImages[65].length();
System.out.println("Operador L\u00f3gico: " +image);
break;
case 66 :
image.append(jjstrLiteralImages[66]);
lengthOfMatch = jjstrLiteralImages[66].length();
System.out.println("Operador L\u00f3gico: " +image);
break;
case 67 :
image.append(jjstrLiteralImages[67]);
lengthOfMatch = jjstrLiteralImages[67].length();
System.out.println("Operador L\u00f3gico: " +image);
break;
case 68 :
image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
System.out.println("Identificador: " +image);
break;
case 71 :
image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
System.out.println("Literal Int: " + image);
break;
case 73 :
image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
System.out.println("Literal Ponto Flutuante: " + image);
break;
case 75 :
image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
System.out.println("Literal Char: " + image);
break;
case 76 :
image.append(input_stream.GetSuffix(jjimageLen + (lengthOfMatch = jjmatchedPos + 1)));
System.out.println("Literal String: " + image);
break;
default :
break;
}
}
static private void jjCheckNAdd(int state)
{
if (jjrounds[state] != jjround)
{
jjstateSet[jjnewStateCnt++] = state;
jjrounds[state] = jjround;
}
}
static private void jjAddStates(int start, int end)
{
do {
jjstateSet[jjnewStateCnt++] = jjnextStates[start];
} while (start++ != end);
}
static private void jjCheckNAddTwoStates(int state1, int state2)
{
jjCheckNAdd(state1);
jjCheckNAdd(state2);
}
static private void jjCheckNAddStates(int start, int end)
{
do {
jjCheckNAdd(jjnextStates[start]);
} while (start++ != end);
}
}
| [
"[email protected]"
] | |
555ece6244f3a1e98bc3835b1fa0d3335e367029 | f13dd7a545ea50f714fb09752d5f7c8822efd307 | /src/main/java/com/coduck/pond/schedule/controller/ScheduleDeleteController.java | 568d1d5d8c39054c569a51ae4f7210fc4377d4f8 | [] | no_license | finalcoduck/Pond | 4054e9fd3d1941bb13cd6d176881d5e536b6bf8d | 378642b7339aa0f78f405b9550d66624f8137dcd | refs/heads/master | 2022-12-23T21:33:25.589714 | 2019-07-08T11:12:52 | 2019-07-08T11:12:52 | 152,926,324 | 3 | 0 | null | 2022-12-16T10:36:01 | 2018-10-14T00:39:10 | Java | UTF-8 | Java | false | false | 1,201 | java | package com.coduck.pond.schedule.controller;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.coduck.pond.core.utils.DateUtility;
import com.coduck.pond.schedule.service.ScheduleServiceImpl;
@Controller
public class ScheduleDeleteController {
@Autowired
private ScheduleServiceImpl scheduleService;
DateUtility du = new DateUtility();
@RequestMapping(value="/schedule/delete", method=RequestMethod.POST)
@ResponseBody
public Map<String, String> deleteSchedule(String scheduleNum, String scheduleStartDate) {
String yymm = du.splitDate(scheduleStartDate);
int n = scheduleService.deleteSchedule(scheduleNum);
Map<String, String> map = new HashMap<>();
map.put("year", yymm.substring(0, 2));
map.put("month", yymm.substring(2, 4));
if(n>0) {
map.put("msg", "true");
}else {
map.put("msg", "false");
}
return map;
}
}
| [
"[email protected]"
] | |
8a5b979ee9672fbace4165e60121e640be163baa | 8583886aef23ff8b2b611a6c6bd70e691b845ad0 | /indexServer/cmsFramework/com/apply/b2b/cms/base/VelocityParser.java | 4eacdc2bd87fba61fb418c753671ad3788556f0e | [] | no_license | hejackey/heproject | 9f596c7e5f4d57d4f7aa1661a3314a313c965fd3 | 3efad5550a9d7500b808d0d8cc7d384267ef2785 | refs/heads/master | 2016-09-05T09:16:55.396484 | 2012-09-06T16:13:45 | 2012-09-06T16:13:45 | 41,244,232 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,831 | java | package com.apply.b2b.cms.base;
import java.io.StringWriter;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.exception.MethodInvocationException;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
/**
*
* @author luoweifeng
*
*/
public abstract class VelocityParser extends BaseParser implements IVelocityParser {
private Template getTemplate(){
return this.getTemplate(this.getTemplateName());
}
protected VelocityContext getVelocityContext(VelocityContext context) {
return context;
}
abstract protected void beforePutTemplateParseValue(VelocityContext context);
abstract protected void putVelocityTemplateParseValue(VelocityContext context);
abstract protected void afterPutTemplateParseValue(VelocityContext context);
public String getParserContent() {
try {
return parserContent();
} catch (ResourceNotFoundException e) {
e.printStackTrace();
} catch (ParseErrorException e) {
e.printStackTrace();
} catch (MethodInvocationException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private String parserContent() throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, Exception {
StringBuffer sf = new StringBuffer();
StringWriter writer = new StringWriter();
Template t = getTemplate();
VelocityContext context = new VelocityContext();
beforePutTemplateParseValue(context);
context = this.getVelocityContext(context);
putVelocityTemplateParseValue(context);
afterPutTemplateParseValue(context);
t.merge(context, writer);
sf.append(writer);
return sf.toString();
}
} | [
"[email protected]"
] | |
db24a581177676271513e44844ae47561986f65d | bd0c6b645ac1823ec8d7001026eab8b502b8a6c8 | /spark_stock_analysis/src/main/java/preti/spark/stock/system/TradeSystemExecution.java | 16e20261d3e9e6dc7c0a21dcd18957338c0db671 | [] | no_license | bopopescu/stock_analysis | bb8f264c4fcbe5048437eb0bcdf34994108f75a3 | 1f971407bd832344964977f6bd3c5fae2372c7ca | refs/heads/master | 2022-11-23T18:52:49.175947 | 2017-02-08T03:18:44 | 2017-02-08T03:18:44 | 282,035,956 | 0 | 0 | null | 2020-07-23T19:16:43 | 2020-07-23T19:16:43 | null | UTF-8 | Java | false | false | 4,384 | java | package preti.spark.stock.system;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import preti.stock.coremodel.Stock;
import preti.stock.coremodel.Trade;
import preti.stock.system.TradeSystem;
import preti.stock.system.TradingStrategy;
@SuppressWarnings("serial")
public class TradeSystemExecution implements Serializable {
@SuppressWarnings("unused")
private static final Log log = LogFactory.getLog(TradeSystemExecution.class);
private Collection<StockContext> wallet;
private double accountInitialPosition;
private double accountBalance;
private Map<Date, Double> balanceHistory;
private Map<Long, TradingStrategy> tradingStrategies;
public TradeSystemExecution(Stock stock, double accountInitialPosition, TradingStrategy strategy) {
this(Arrays.asList(stock), accountInitialPosition, accountInitialPosition, null);
this.tradingStrategies = new HashMap<>();
tradingStrategies.put(stock.getId(), strategy);
}
public TradeSystemExecution(Collection<Stock> stocks, double accountInitialPosition, double accountBalance,
Map<Long, TradingStrategy> tradingStrategies) {
this.accountInitialPosition = accountInitialPosition;
this.accountBalance = accountBalance;
if (stocks == null || stocks.isEmpty()) {
throw new IllegalArgumentException("No stocks to analyze.");
}
wallet = new ArrayList<>();
for (Stock s : stocks) {
wallet.add(new StockContext(s));
}
balanceHistory = new TreeMap<>();
this.tradingStrategies = tradingStrategies;
}
public Map<Date, Double> getBalanceHistory() {
return balanceHistory;
}
public Collection<StockContext> getWallet() {
return wallet;
}
public List<Stock> getStocks() {
List<Stock> stocks = new ArrayList<>();
for (StockContext st : wallet) {
stocks.add(st.getStock());
}
return stocks;
}
public void setTradingStrategies(Map<Long, TradingStrategy> strategies) {
this.tradingStrategies = strategies;
}
public void applyTradingStrategy(Long stockId, TradingStrategy strategy) {
this.tradingStrategies.put(stockId, strategy);
}
public double getAccountInitialPosition() {
return accountInitialPosition;
}
public double getAccountBalance() {
return accountBalance;
}
private Collection<Trade> identifyOpenTrades() {
Set<Trade> openTrades = new HashSet<>();
for (StockContext sc : wallet) {
if (sc.isInOpenPosition()) {
openTrades.add(sc.getLastTrade());
}
}
return openTrades;
}
private void updateWallet(Map<Long, Trade> openTrades, Map<Long, Trade> closedTrades) {
for (StockContext sc : wallet) {
Long stockId = sc.getStock().getId();
if (!sc.isInOpenPosition() && openTrades.containsKey(stockId)) {
sc.addTrade(openTrades.get(stockId));
}
}
}
public void analyzeStocks(Date initialDate, Date finalDate) {
// Identifica todas as datas, de forma unica e ordenada
TreeSet<Date> allDates = new TreeSet<>();
for (StockContext st : this.wallet) {
allDates.addAll(st.getStock().getAllHistoryDates());
}
// Identifica todas as a��es
Collection<Stock> stocks = getStocks();
// Verifica se foi especificado uma data inicial
if (initialDate != null) {
allDates = new TreeSet<Date>(allDates.tailSet(initialDate));
}
// Verifica se foi especificado uma data final
if (finalDate != null) {
allDates = new TreeSet<Date>(allDates.headSet(finalDate, true));
}
for (Date date : allDates) {
TradeSystem tradeSystem = new TradeSystem(identifyOpenTrades(), stocks, tradingStrategies, accountBalance, 1l);
tradeSystem.analyzeStocks(date);
updateWallet(tradeSystem.getOpenTrades(), tradeSystem.getClosedTrades());
this.accountBalance = tradeSystem.getAccountBalance();
balanceHistory.put(date, this.accountBalance);
}
}
public void closeAllOpenTrades(Date d) {
TradeSystem system = new TradeSystem(identifyOpenTrades(), getStocks(), this.tradingStrategies,
this.accountBalance, 1l);
system.closeAllOpenTrades(d);
this.accountBalance = system.getAccountBalance();
balanceHistory.put(d, this.accountBalance);
}
}
| [
"[email protected]"
] | |
3c6f72ec22c6d855587e11ae1e836cb89350885d | 02fcd1ef8a7bafc6f62ec8593bd47132f1153fae | /app0901/app/src/androidTest/java/kr/ezcode/app0901/ExampleInstrumentedTest.java | 64196a62fc5caa74224b640d70b1f1979331c5b3 | [] | no_license | moosin76/bnb-android | bf4f9ea33ec87b98e18a52e7b74bb24d7ca03a54 | f1690dae36f36d58c1a9a51b65d302f806c87f21 | refs/heads/main | 2023-05-04T01:14:14.969543 | 2021-05-12T11:35:00 | 2021-05-12T11:35:00 | 343,943,146 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 748 | java | package kr.ezcode.app0901;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("kr.ezcode.app0901", appContext.getPackageName());
}
} | [
"[email protected]"
] | |
d7d5c41476793090ef327379532a4e6810a9d870 | 3fc67983f465c1f2f58125716eaf3113a10d2347 | /src/main/java/com/example/demo/ExampleRestApplication.java | 71c350b2ea1fc2e9302c2978f1af305f7633d15a | [] | no_license | tranquanghuy097/Spring_Rest_Greeting | b82e620ad65ad2d7a4f15af65e830e669a0029ff | 6a07d53a086b440edc1f5681d17cc273b0427cf9 | refs/heads/master | 2022-04-16T10:51:21.565091 | 2020-04-14T02:30:15 | 2020-04-14T02:30:15 | 254,874,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 319 | java | package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ExampleRestApplication {
public static void main(String[] args) {
SpringApplication.run(ExampleRestApplication.class, args);
}
}
| [
"[email protected]"
] | |
ac6841522f512c4fef446c04d6c80545adff011f | 926fefb45918a4cb6aef0688084b45d8eac19700 | /netty-chat-master/chat-core/src/main/java/io/ganguo/chat/core/protocol/Commands.java | 1672d90d388c2621958da31f8bfe6441d7f13697 | [] | no_license | hanxirui/for_java | 1534d19828b4e30056deb4340d5ce0b9fd819f1a | 14df7f9cb635da16a0ee283bf016dc77ad3cecec | refs/heads/master | 2022-12-25T02:06:30.568892 | 2019-09-06T06:45:36 | 2019-09-06T06:45:36 | 14,199,294 | 1 | 0 | null | 2022-12-16T06:29:53 | 2013-11-07T09:17:09 | JavaScript | UTF-8 | Java | false | false | 1,079 | java | package io.ganguo.chat.core.protocol;
/**
* @author Tony
* @createAt Feb 17, 2015
*/
public class Commands {
/**
* 路由转发
*/
public static final short ROUTE_REGISTER = 0x0001;
public static final short ROUTE_REGISTER_SUCCESS = 0x1001;
/**
* 登录
*/
public static final short LOGIN_REQUEST = 0x0001;
public static final short LOGIN_SUCCESS = 0x1001;
public static final short LOGIN_FAIL = 0x1000;
/**
* 登录 Channel
*/
public static final short LOGIN_CHANNEL_REQUEST = 0x0002;
public static final short LOGIN_CHANNEL_SUCCESS = 0x2002;
public static final short LOGIN_CHANNEL_FAIL = 0x2000;
public static final short LOGIN_CHANNEL_KICKED = 0x2001;
/**
* 消息
*/
public static final short USER_PRESENCE_CHANGED = 0x0100;
public static final short USER_MESSAGE_REQUEST = 0x0001;
public static final short USER_MESSAGE_SUCCESS = 0x1001;
public static final short USER_MESSAGE_FAIL = 0x1000;
public static final short ERROR_USER_NOT_EXISTS = 0x1002;
}
| [
"[email protected]"
] | |
17350f711a96dd100a6d774db4e94ffbc320987a | 73d000646c21501c8966ee7e08e7f67b2727203c | /lib/impl/src/main/java/net/openhft/koloboke/collect/impl/hash/ObjHash.java | 333b6ec3be74a111d742ba4cf1aeeb2f2bbf8584 | [
"Apache-2.0"
] | permissive | phishman3579/Koloboke | e74a104720a09ff6645c82ee9fa71de0494829c7 | ed20a94a918a057daaada3a5989dc864a536612b | refs/heads/master | 2020-12-25T11:20:54.195192 | 2015-02-13T05:16:18 | 2015-02-13T05:16:18 | 30,830,911 | 1 | 0 | null | 2015-02-15T15:15:17 | 2015-02-15T15:15:17 | null | UTF-8 | Java | false | false | 770 | java | /*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.openhft.koloboke.collect.impl.hash;
interface ObjHash extends Hash {
static final Object REMOVED = new Object(), FREE = new Object();
}
| [
"[email protected]"
] | |
6a7b9cf093cce1c8204e79591d299bd57d6217b9 | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-drs/src/main/java/com/amazonaws/services/drs/model/transform/AccessDeniedExceptionUnmarshaller.java | f5f83e0830f21fd9c4d46cd3dc7df9ad7671e0cc | [
"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 | 3,027 | 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.drs.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.drs.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* AccessDeniedException JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AccessDeniedExceptionUnmarshaller extends EnhancedJsonErrorUnmarshaller {
private AccessDeniedExceptionUnmarshaller() {
super(com.amazonaws.services.drs.model.AccessDeniedException.class, "AccessDeniedException");
}
@Override
public com.amazonaws.services.drs.model.AccessDeniedException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {
com.amazonaws.services.drs.model.AccessDeniedException accessDeniedException = new com.amazonaws.services.drs.model.AccessDeniedException(null);
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return null;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("code", targetDepth)) {
context.nextToken();
accessDeniedException.setCode(context.getUnmarshaller(String.class).unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return accessDeniedException;
}
private static AccessDeniedExceptionUnmarshaller instance;
public static AccessDeniedExceptionUnmarshaller getInstance() {
if (instance == null)
instance = new AccessDeniedExceptionUnmarshaller();
return instance;
}
}
| [
""
] | |
e01138a3a0bbefd2f3c58578c08d6e3765621777 | b80d0c61317dd1934d53ce7eb3e4b105c98d9ffa | /05_array/src/com/array/controller/ArrayTest.java | fe3ab1404a42527bed0ce7b7a1ecc469e528f70d | [] | no_license | sukyeonghan/studycode | 85ce81d6ee10eb89ae708f54e9175f2cb7d98cad | 8de8000514082ec35b3af3ea3cc5446e004ba686 | refs/heads/master | 2022-11-21T20:52:02.934068 | 2020-07-30T14:18:03 | 2020-07-30T14:18:03 | 271,281,917 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 11,764 | java | package com.array.controller;
import java.util.Arrays;
import java.util.Scanner;
public class ArrayTest {
public void basicArray() {
//기본 배열 선언과 할당하기
int[] intArr = new int[3];
//참조형 변수임. 주소값이 생겼으니까 할당을 해야한다.
//기본형 변수는 int,double...직접 선언한 것
double[] doubleArr=new double[3];
String[] strArr=new String[3];
char[] chArr=new char[3];
//디폴프값 확인
System.out.println(doubleArr[0]); //0.0
System.out.println(strArr[0]); //null
System.out.println(chArr[0]); //(공백)
//값을 대입/출력하기 - 자료형 맞추기
intArr[0] = 20;
//intArr[1] = "저녁"; 다른 타입은 안 됨
System.out.println(intArr[0]);
System.out.println(intArr[1]);
//선언안했는데 0이 출력됨. 힙 영역에 들어갈 때 자동으로 기본값(default) 0 생성됨.
//String 은 null; double은 0.0 ...
//int a;
//System.out.println(a); //이건 값 안넣어서 출력안됨.
//String 5개를 저장할 수 있는 공간을 확보하고
//자신이 좋아하는 과일을 5개 변수에 저장하고 출력하기
String[] strArr2 = new String[5];
strArr2[0] = "사과"; //strArr2[0] 이것 자체가 변수명
strArr2[1] = "복숭아";
strArr2[2] = "딸기";
strArr2[3] = "수박";
strArr2[4] = "포도";
System.out.println(strArr2[0]);
System.out.println(strArr2[1]);
System.out.println(strArr2[2]);
System.out.println(strArr2[3]);
System.out.println(strArr2[4]);
//for문을 이용하여 출력하기
for(int i=0;i<5;i++) {
//System.out.println(i); 0,1,2,3,4
System.out.println(strArr2[i]);
}
strArr2=new String[3];
System.out.println("[3]"+strArr2.length); //3이 나옴
strArr2=new String[100];
System.out.println("[100]"+strArr2.length); //100이 나옴
//재할당됨. 이전건 접속할 수 없어 쓰레기 됨.gc(가비지 컬렉터)가 지움
//ArryIndexOutOfBoundsException:3 오류뜸 !!중요!!!!
//저장 범위를 넘어섬. 더 많은(가지고 있지 않은) 인덱스 번호를 입력했을 때
//for문을 이용한 초기화 관련
//for문을 이용하여 값 대입하기
//for(int i=0;i<5; i++) {
for(int i=0;i<strArr2.length; i++) {
//선언할 때 길이가 여기 들어감.
strArr2[i] = "수박";
}
//for(int i =0; i<5; i++) {
for(int i=0;i<strArr2.length; i++) {
System.out.println(strArr2[i]);
}//한 번에 동일한 값을 넣을 수 있음
//정수 5개를 저장할 수 있는 공간을 확보하고
//각 공간에 1~5까지 값을 대입하기
int[] a =new int[5];
for(int i =0; i<a.length; i++) {
a[i]=i+1;
}
for(int i =0;i<a.length;i++) {
System.out.println(a[i]);
}
//이름을 입력받고 출력 프로그램 만들기
//1.몇명 이름을 입력할지 입력받고
//2.그 수 만큼 배열을 만들어 이름을 입력받아 저장하고
//3.배열을 출력하기
Scanner sc = new Scanner(System.in);
System.out.print("인원 수 :");
int pe = sc.nextInt();
String[] pe2 = new String[pe];
//이름을 저장할 수 있는 배열로 만들기
//pe2[0]=이름..
for(int i=0; i<pe2.length; i++) {
System.out.print("이름 입력 : ");
pe2[i]=sc.next();
}
for(int i=0; i<pe2.length; i++) {
System.out.println(pe2[i]);
}
//배열을 선언할 때
//선언과 동시에 초기화
int age = 19;
int[] numbers= {1,2,3,4,5};
//0번 인덱스에 1,1번 인덱스에 2, 2번 인덱스에 3..
System.out.println(numbers[2]); //3이 나옴
String[] nn= {"김대욱","인하준","이하영","오수완"};
System.out.println(nn[0]); //김대욱이 나옴
//nn = {"원빈","송중기","공유","홍석천"};
//이렇게 하면 이미 선언된 거 다시 할당이 안 됨
nn=new String[] {"원빈","송중기","공유","홍석천"};
System.out.println(nn[0]);
//이렇게 재할당 가능
}
public void arrayCopy() {
//얕은 복사==주소값을 복사해서 heap영역에 생성된 배열변수를 같이 쓰는 것!
char[] chs= {'A','B','C','D'};
char[] copyCh=chs;
chs[0]='나'; //수정하면 둘 다 바뀜
copyCh[copyCh.length-1]='다';
//이렇게 하면 'D'자리를 바꿈.길이는4니까.
System.out.println("==== chs 원본값 ===");
for(int i=0; i<chs.length;i++) {
System.out.print(chs[i]);
}
System.out.println();
System.out.println("=== 복사된 값 ===");
for(int i=0; i<copyCh.length;i++) {
System.out.print(copyCh[i]);
}
System.out.println();
System.out.println(chs+" : "+copyCh);
//똑같은 위치에 가서 참조한다.같은 주소를 가지고 있음
//깊은 복사(4가지방법)
//heap영역에 배열공간을 추가적으로 만들어서 값을 복사하는 것!
//주소값도 각자. 수정한 곳만 수정됨.
//원본, 사본 두고 작업하고 싶을 때/수정사항 확인하고 싶을 때
String[] str= {"집","에","가","자"};
String[] str2 = new String[str.length];
//1. for문 이용 복사(전체복사)
for(int i =0 ; i<str.length; i++) {
str2[i]=str[i]; //복사해서 넣는 것
}
str[0]="공부"; //str => 공부 에 가 자
str2[str2.length-1]="지말자"; //str2=>집 에 가 지말자
for(int i =0 ; i<str.length; i++) {
System.out.print(str[i]);
}
System.out.println();
for(int i =0 ; i<str.length; i++) {
System.out.print(str2[i]);
}
System.out.println();
//2. System.arraycopy메소드 이용 복사하기
//원하는 위치의 값을 원하는 위치에 복사 가능(이미 공간만들어놓고 값만 복사)
String[] str3=new String[str.length];
//System.arraycopy(str,0,str3,0,str.length);//전체 복사
System.arraycopy(str, 2, str3, 2, 2);
//str(배열)(복사할 곳)의 2번째 인덱스 값을 str3(배열)(복사될 곳)의 2번째 인덱스 값부터 길이 2만큼 복사
//글자니까 공백은 null값으로 나타남
//복사할 길이 개수 쓸 때 길이 계산 잘해야 함->ArrayIndex~~ 오류 난다
//위2개는 배열을 직접 할당해서 할당한 배열 변수에 값을 복사하는 것
//for(int i=0; i<str.length...) 어려우니까
//for each문을 사용해보자
//전체 출력할 때 주로 씀.인덱스 따로 구분해서 처리할 수 없음
//배열이나 collection객체의 값에 접근할 때 사용
//for(배열자료형의 변수 : 배열 또는 collection객체) {로직}
System.out.println();
for(String v : str) { //변수 : 배열(여러 값을 가지고 있는 것)//공부 에 가 자
System.out.print(v);
}
System.out.println();
for(String v : str3) {
System.out.print(v);
}
System.out.println();
//Arrays.copyof(), clone()은 배열변수만 선언하고 대입해주면 됨. *할당이 필요없음!(new~로 생성하는 거)
//Arrays.copyof()메소드 이용해서 복사
//배열을 할당하지 않고 변수만 선언한 후 복사함
String[] str4; //선언만 함.지금 아무것도 없는 상태
str4 = Arrays.copyOf(str,str.length);//Arrays.copyOf가 주소값 생성해서 배열 넣어준다.
str4[0]="곧 퇴근!"; //얘도 따로따로 수정.
for(String temp : str4) {
System.out.print(temp);
}
System.out.println();
//무전 0번부터 대입. 받는 위치를 조정할 수 없음.
String[] str5;
str5 = Arrays.copyOf(str,2);
System.out.println(str5);
for(String v : str5) {
System.out.print(v);
}
//clone() -> 객체(배열도 하나의 객체)를 복사하는 기능을 하는 메소드
//배열변수명.clone();
//조정할 수 없이 무조건 통채로 다 저장
str5=str.clone();
for(String v : str5) {
System.out.println(v);
}
}
//배열에 값을 넣는 기능
//원래 기능별로 나눠져있지만(또는 다른 클래스에)
//우린 배우는 거니까 이어서 쓸 뿐임.
public void inputArray(String[] temp) {
Scanner sc = new Scanner(System.in);
for(int i=0; i<temp.length; i++) {
System.out.print("입력 :");
temp[i] = sc.nextLine();
}
}
public void printArray(String[] t) {
for(int i=0; i<t.length; i++) {
System.out.print(t[i]);
}
}
public void arrayTest() {
int[] nums= {1,2,3,4,5};
//nums=new int[5];
//nums[0]=1;
//nums[1]=2;
//nums[2]=3;
//nums[3]=4;
//nums[4]=5;
//이 작업들을 한 줄로 처리함.
//들어갈 데이터가 정해져 있으면 이렇게 하면 편함
nums=new int[]{4,5,6,7,8};
//하면 재할당됨
}
//이차원 배열 사용하기
public void doubleArray() {
//2차원 배열
//2개 이상의 배열이 묶여있는 변수
//한 칸,한 칸이 변수임.
//자료형[행][열] 배열명
//마찬가지로 할당하면 힙 영역에 생성
//배열 할당 : 자료형[][] 배열명 = new자료형[행크기][열크기];
// int[][] arr = new자료형[2][4];
// 주소값이...?
//배열이 3개 - 주소값을 가지고 있는 배열, , .
//이차원 배열 선언하기
int[][] numbers=new int[3][3];
//이차원 배열 값 대입하기
numbers[0][0]=300;
numbers[0][1]=100;
numbers[0][2]=200;
numbers[1][0]=30;
numbers[1][1]=20;
numbers[1][2]=50;
//이차원 배열 출력하기
System.out.print(numbers[1][1]); //1번
System.out.println(numbers[0]); //0번에 연결되어 있는 인덱스의 주소
System.out.println(numbers[1]); //1번에 연결되어 있는 인덱스의 주소
System.out.println(numbers);
//이차원 배열의 선언과 동시에 초기화!
int[] a= {1,2,3,4};
int[][] num2= {{1,2,3,4},{5,6,7,8}};
//new int[2][4];가 된다
//numbers=new int[][]{{10,20,30,40},{50,60,70,80}};
//위에서[3][3]이었음. 이제 [2][4]가 되었음
//for문을 이용하여 이차원배열 처리하기!
numbers=new int[][]{{10,20},{50,60}};
numbers=new int[5][];
numbers[0]=new int[10];
numbers[1]=new int[2];
//이렇게 각각 다른 길이로 설정할 수 있다.
//이렇게 바꿔서 출력하면 오류남. 그래서 length를 씀
//numbers 출력하기
//for(int i=0; i<3; i++) {
//for(int j=0;j<3;j++) {
for(int i=0; i<numbers.length; i++) { //외곽에 있는 길이
for(int j=0; j<numbers[i].length; j++) {
//행마다 길이 바뀔 수도 있으니까 열길이로 받는다..
//System.out.println(i+" :"+j);
//0:0 0:1 0:2 1:0 ...출력
System.out.print(numbers[i][j]+" ");
}
System.out.println();
}
}
public void doubleArray22() {
//행의 길이가 15, 열의 길이가 11인 2차원 배열을 선언하기
//1~165까지 인덱스 순서대로 값을 초기화하고 그 값을 출력하기
int a =0;
int[][] arr = new int[15][11];
for(int i=0; i<arr.length; i++) {
for(int j=0; j<arr[i].length; j++) {
arr[i][j]=a++;
System.out.println(a);
}
}
//12명의 학생들을 출석부 순으로 2열 6행으로 자리배치하여 분단을 나누고,
//1분단 왼쪽부터 오른쪽, 1행에서 아래 행으로 번호순으로 자리를 배치하는 프로그램을 작성하기
//1차원 배열을 2차원 배열로 옮기기
//
// aa=new String[12];
// aa[1]="홍길동";
// aa[2]="이순신";
// aa[3]="유관순";
// aa[4]="윤봉길";
String [] aa = {"홍길동","이순신","유관순","윤봉길","장영실",
"임꺽정","장보고","이태백","김정희","대조영","김유신","이사부"};
for(int i=0; i<aa.length; i++) {
System.out.println((i+1)+"."+aa[i]+
(i+7)+"."+aa[i+7]);
}
// String [][] bb = new String[6][2];
//
// for(int i=1; i<=bb.length; i++) {
// System.out.println();
//
//
// String aa[];
}
}
| [
"[email protected]"
] | |
838b29c96f1d5d66f5281a1bd467e74ab80b1875 | 9843282b0f2c072e0969175e5720203c1c6ee326 | /app/src/test/java/in/smarttechnologies/currencyconvertor/ExampleUnitTest.java | 96183d17299d19d6bd500d3285793616dea5ce4c | [] | no_license | ShadabAzamFarooqui/currency_converter | 418da9f2b20555644760d59d71995369da9dbbeb | 6ae2b75c4015d59a085a11b9f90ed9b745b6a45b | refs/heads/master | 2020-04-02T13:17:22.388176 | 2018-10-24T09:33:23 | 2018-10-24T09:33:23 | 154,472,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 416 | java | package in.smarttechnologies.currencyconvertor;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
38a893cd42512cd3ef0909566160459e9c5af883 | a3721ce96a4158d59e9946b16590355a26efd500 | /src/main/java/com/example/oracle_grabber6/OracleGrabber6Application.java | a6d9f01f2f28ed78927213050e926f53ba23942b | [] | no_license | vladik7go/oracle_grabber | 6f01191f7f8eb6a1a5d415d14e2e031d99472346 | 7ca348494c893b810b53e9163dd6778faef00514 | refs/heads/master | 2020-03-11T14:27:54.771013 | 2018-04-18T12:30:46 | 2018-04-18T12:30:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 335 | java | package com.example.oracle_grabber6;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class OracleGrabber6Application {
public static void main(String[] args) {
SpringApplication.run(OracleGrabber6Application.class, args);
}
}
| [
"[email protected]"
] | |
2a5cb145ffe255de44ea5910afa125a231d133a0 | ee8c5fd0377eba0ec682446a03c5be227e1dfdae | /src/main/java/com/javawro27/demo/solid/strategie/StrategiaWalkiMieczem.java | 37f81a58033a278931a0d337ae482953afb51846 | [] | no_license | SaintAmeN/javawro27_powtorzenie | 59b289b226ff0c7274942702bfffe7caee76f1bf | d96302a33e249655c582fa86cc9c507426618e4c | refs/heads/master | 2022-08-16T04:48:41.212768 | 2020-05-23T09:13:35 | 2020-05-23T09:13:35 | 264,396,228 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 203 | java | package com.javawro27.demo.solid.strategie;
public class StrategiaWalkiMieczem implements IStrategiaWalki{
public void walcz() {
System.out.println("Walczę mieczem! Ciach Ciach!");
}
}
| [
"[email protected]"
] | |
543ce934c5c600969a7a04ec48cb6291befcf889 | d00bf7819a1a3baa5cda0262863d2b649ef335e6 | /mongo/src/main/java/fr/sttc/mongo/MongoApplication.java | 7fb80918856364996bc1cc0799c2f55bea28c603 | [] | no_license | SebastienCoste/spring-flow | b5936ccf0eb44f94b2756fad49e4280b0a4c192a | dcd95e67a5729f9d554fd5589298b1edcd299109 | refs/heads/master | 2021-08-22T06:11:42.705958 | 2017-11-29T13:19:34 | 2017-11-29T13:19:34 | 112,196,840 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package fr.sttc.mongo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MongoApplication {
public static void main(String[] args) {
SpringApplication.run(MongoApplication.class, args);
}
}
| [
"[email protected]"
] | |
5b8a664f56851d33aef6fc74656adf40c26e83a8 | a279cb42da2afa0efd97c630113ea8e2db45a04e | /location/java/android/location/GpsClock.java | 22ac1a98f4b8372059d75e6b932ecbe394b43f00 | [
"LicenseRef-scancode-unicode",
"Apache-2.0"
] | permissive | cm12-amami/android_frameworks_base | 50657149a2636116eddf9dda553d348ed00128db | f452371c833166c1b2b62be855da9775d0324178 | refs/heads/cm-12.1 | 2021-06-01T16:16:36.859431 | 2020-04-23T17:45:55 | 2020-09-12T16:03:46 | 105,204,462 | 0 | 3 | NOASSERTION | 2019-11-22T15:33:28 | 2017-09-28T22:17:53 | Java | UTF-8 | Java | false | false | 15,972 | java | /*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package android.location;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;
/**
* A class containing a GPS clock timestamp.
* It represents a measurement of the GPS receiver's clock.
*
* @hide
*/
@SystemApi
public class GpsClock implements Parcelable {
private static final String TAG = "GpsClock";
// The following enumerations must be in sync with the values declared in gps.h
/**
* The type of the time stored is not available or it is unknown.
*/
public static final byte TYPE_UNKNOWN = 0;
/**
* The source of the time value reported by this class is the 'Local Hardware Clock'.
*/
public static final byte TYPE_LOCAL_HW_TIME = 1;
/**
* The source of the time value reported by this class is the 'GPS time' derived from
* satellites (epoch = Jan 6, 1980).
*/
public static final byte TYPE_GPS_TIME = 2;
private static final short HAS_NO_FLAGS = 0;
private static final short HAS_LEAP_SECOND = (1<<0);
private static final short HAS_TIME_UNCERTAINTY = (1<<1);
private static final short HAS_FULL_BIAS = (1<<2);
private static final short HAS_BIAS = (1<<3);
private static final short HAS_BIAS_UNCERTAINTY = (1<<4);
private static final short HAS_DRIFT = (1<<5);
private static final short HAS_DRIFT_UNCERTAINTY = (1<<6);
// End enumerations in sync with gps.h
private short mFlags;
private short mLeapSecond;
private byte mType;
private long mTimeInNs;
private double mTimeUncertaintyInNs;
private long mFullBiasInNs;
private double mBiasInNs;
private double mBiasUncertaintyInNs;
private double mDriftInNsPerSec;
private double mDriftUncertaintyInNsPerSec;
GpsClock() {
initialize();
}
/**
* Sets all contents to the values stored in the provided object.
*/
public void set(GpsClock clock) {
mFlags = clock.mFlags;
mLeapSecond = clock.mLeapSecond;
mType = clock.mType;
mTimeInNs = clock.mTimeInNs;
mTimeUncertaintyInNs = clock.mTimeUncertaintyInNs;
mFullBiasInNs = clock.mFullBiasInNs;
mBiasInNs = clock.mBiasInNs;
mBiasUncertaintyInNs = clock.mBiasUncertaintyInNs;
mDriftInNsPerSec = clock.mDriftInNsPerSec;
mDriftUncertaintyInNsPerSec = clock.mDriftUncertaintyInNsPerSec;
}
/**
* Resets all the contents to its original state.
*/
public void reset() {
initialize();
}
/**
* Gets the type of time reported by {@link #getTimeInNs()}.
*/
public byte getType() {
return mType;
}
/**
* Sets the type of time reported.
*/
public void setType(byte value) {
switch (value) {
case TYPE_UNKNOWN:
case TYPE_GPS_TIME:
case TYPE_LOCAL_HW_TIME:
mType = value;
break;
default:
Log.d(TAG, "Sanitizing invalid 'type': " + value);
mType = TYPE_UNKNOWN;
break;
}
}
/**
* Gets a string representation of the 'type'.
* For internal and logging use only.
*/
private String getTypeString() {
switch (mType) {
case TYPE_UNKNOWN:
return "Unknown";
case TYPE_GPS_TIME:
return "GpsTime";
case TYPE_LOCAL_HW_TIME:
return "LocalHwClock";
default:
return "<Invalid>";
}
}
/**
* Returns true if {@link #getLeapSecond()} is available, false otherwise.
*/
public boolean hasLeapSecond() {
return isFlagSet(HAS_LEAP_SECOND);
}
/**
* Gets the leap second associated with the clock's time.
* The sign of the value is defined by the following equation:
* utc_time_ns = time_ns + (full_bias_ns + bias_ns) - leap_second * 1,000,000,000
*
* The value is only available if {@link #hasLeapSecond()} is true.
*/
public short getLeapSecond() {
return mLeapSecond;
}
/**
* Sets the leap second associated with the clock's time.
*/
public void setLeapSecond(short leapSecond) {
setFlag(HAS_LEAP_SECOND);
mLeapSecond = leapSecond;
}
/**
* Resets the leap second associated with the clock's time.
*/
public void resetLeapSecond() {
resetFlag(HAS_LEAP_SECOND);
mLeapSecond = Short.MIN_VALUE;
}
/**
* Gets the GPS receiver internal clock value in nanoseconds.
* This can be either the 'local hardware clock' value ({@link #TYPE_LOCAL_HW_TIME}), or the
* current GPS time derived inside GPS receiver ({@link #TYPE_GPS_TIME}).
* {@link #getType()} defines the time reported.
*
* For 'local hardware clock' this value is expected to be monotonically increasing during the
* reporting session. The real GPS time can be derived by compensating
* {@link #getFullBiasInNs()} (when it is available) from this value.
*
* For 'GPS time' this value is expected to be the best estimation of current GPS time that GPS
* receiver can achieve. {@link #getTimeUncertaintyInNs()} should be available when GPS time is
* specified.
*
* Sub-nanosecond accuracy can be provided by means of {@link #getBiasInNs()}.
* The reported time includes {@link #getTimeUncertaintyInNs()}.
*/
public long getTimeInNs() {
return mTimeInNs;
}
/**
* Sets the GPS receiver internal clock in nanoseconds.
*/
public void setTimeInNs(long timeInNs) {
mTimeInNs = timeInNs;
}
/**
* Returns true if {@link #getTimeUncertaintyInNs()} is available, false otherwise.
*/
public boolean hasTimeUncertaintyInNs() {
return isFlagSet(HAS_TIME_UNCERTAINTY);
}
/**
* Gets the clock's time Uncertainty (1-Sigma) in nanoseconds.
* The uncertainty is represented as an absolute (single sided) value.
*
* The value is only available if {@link #hasTimeUncertaintyInNs()} is true.
*/
public double getTimeUncertaintyInNs() {
return mTimeUncertaintyInNs;
}
/**
* Sets the clock's Time Uncertainty (1-Sigma) in nanoseconds.
*/
public void setTimeUncertaintyInNs(double timeUncertaintyInNs) {
setFlag(HAS_TIME_UNCERTAINTY);
mTimeUncertaintyInNs = timeUncertaintyInNs;
}
/**
* Resets the clock's Time Uncertainty (1-Sigma) in nanoseconds.
*/
public void resetTimeUncertaintyInNs() {
resetFlag(HAS_TIME_UNCERTAINTY);
mTimeUncertaintyInNs = Double.NaN;
}
/**
* Returns true if {@link @getFullBiasInNs()} is available, false otherwise.
*/
public boolean hasFullBiasInNs() {
return isFlagSet(HAS_FULL_BIAS);
}
/**
* Gets the difference between hardware clock ({@link #getTimeInNs()}) inside GPS receiver and
* the true GPS time since 0000Z, January 6, 1980, in nanoseconds.
*
* This value is available if {@link #TYPE_LOCAL_HW_TIME} is set, and GPS receiver has solved
* the clock for GPS time.
* {@link #getBiasUncertaintyInNs()} should be used for quality check.
*
* The sign of the value is defined by the following equation:
* true time (GPS time) = time_ns + (full_bias_ns + bias_ns)
*
* The reported full bias includes {@link #getBiasUncertaintyInNs()}.
* The value is onl available if {@link #hasFullBiasInNs()} is true.
*/
public long getFullBiasInNs() {
return mFullBiasInNs;
}
/**
* Sets the full bias in nanoseconds.
*/
public void setFullBiasInNs(long value) {
setFlag(HAS_FULL_BIAS);
mFullBiasInNs = value;
}
/**
* Resets the full bias in nanoseconds.
*/
public void resetFullBiasInNs() {
resetFlag(HAS_FULL_BIAS);
mFullBiasInNs = Long.MIN_VALUE;
}
/**
* Returns true if {@link #getBiasInNs()} is available, false otherwise.
*/
public boolean hasBiasInNs() {
return isFlagSet(HAS_BIAS);
}
/**
* Gets the clock's sub-nanosecond bias.
* The reported bias includes {@link #getBiasUncertaintyInNs()}.
*
* The value is only available if {@link #hasBiasInNs()} is true.
*/
public double getBiasInNs() {
return mBiasInNs;
}
/**
* Sets the sub-nanosecond bias.
*/
public void setBiasInNs(double biasInNs) {
setFlag(HAS_BIAS);
mBiasInNs = biasInNs;
}
/**
* Resets the clock's Bias in nanoseconds.
*/
public void resetBiasInNs() {
resetFlag(HAS_BIAS);
mBiasInNs = Double.NaN;
}
/**
* Returns true if {@link #getBiasUncertaintyInNs()} is available, false otherwise.
*/
public boolean hasBiasUncertaintyInNs() {
return isFlagSet(HAS_BIAS_UNCERTAINTY);
}
/**
* Gets the clock's Bias Uncertainty (1-Sigma) in nanoseconds.
*
* The value is only available if {@link #hasBiasUncertaintyInNs()} is true.
*/
public double getBiasUncertaintyInNs() {
return mBiasUncertaintyInNs;
}
/**
* Sets the clock's Bias Uncertainty (1-Sigma) in nanoseconds.
*/
public void setBiasUncertaintyInNs(double biasUncertaintyInNs) {
setFlag(HAS_BIAS_UNCERTAINTY);
mBiasUncertaintyInNs = biasUncertaintyInNs;
}
/**
* Resets the clock's Bias Uncertainty (1-Sigma) in nanoseconds.
*/
public void resetBiasUncertaintyInNs() {
resetFlag(HAS_BIAS_UNCERTAINTY);
mBiasUncertaintyInNs = Double.NaN;
}
/**
* Returns true if {@link #getDriftInNsPerSec()} is available, false otherwise.
*/
public boolean hasDriftInNsPerSec() {
return isFlagSet(HAS_DRIFT);
}
/**
* Gets the clock's Drift in nanoseconds per second.
* A positive value indicates that the frequency is higher than the nominal frequency.
* The reported drift includes {@link #getDriftUncertaintyInNsPerSec()}.
*
* The value is only available if {@link #hasDriftInNsPerSec()} is true.
*/
public double getDriftInNsPerSec() {
return mDriftInNsPerSec;
}
/**
* Sets the clock's Drift in nanoseconds per second.
*/
public void setDriftInNsPerSec(double driftInNsPerSec) {
setFlag(HAS_DRIFT);
mDriftInNsPerSec = driftInNsPerSec;
}
/**
* Resets the clock's Drift in nanoseconds per second.
*/
public void resetDriftInNsPerSec() {
resetFlag(HAS_DRIFT);
mDriftInNsPerSec = Double.NaN;
}
/**
* Returns true if {@link #getDriftUncertaintyInNsPerSec()} is available, false otherwise.
*/
public boolean hasDriftUncertaintyInNsPerSec() {
return isFlagSet(HAS_DRIFT_UNCERTAINTY);
}
/**
* Gets the clock's Drift Uncertainty (1-Sigma) in nanoseconds per second.
*
* The value is only available if {@link #hasDriftUncertaintyInNsPerSec()} is true.
*/
public double getDriftUncertaintyInNsPerSec() {
return mDriftUncertaintyInNsPerSec;
}
/**
* Sets the clock's Drift Uncertainty (1-Sigma) in nanoseconds per second.
*/
public void setDriftUncertaintyInNsPerSec(double driftUncertaintyInNsPerSec) {
setFlag(HAS_DRIFT_UNCERTAINTY);
mDriftUncertaintyInNsPerSec = driftUncertaintyInNsPerSec;
}
/**
* Resets the clock's Drift Uncertainty (1-Sigma) in nanoseconds per second.
*/
public void resetDriftUncertaintyInNsPerSec() {
resetFlag(HAS_DRIFT_UNCERTAINTY);
mDriftUncertaintyInNsPerSec = Double.NaN;
}
public static final Creator<GpsClock> CREATOR = new Creator<GpsClock>() {
@Override
public GpsClock createFromParcel(Parcel parcel) {
GpsClock gpsClock = new GpsClock();
gpsClock.mFlags = (short) parcel.readInt();
gpsClock.mLeapSecond = (short) parcel.readInt();
gpsClock.mType = parcel.readByte();
gpsClock.mTimeInNs = parcel.readLong();
gpsClock.mTimeUncertaintyInNs = parcel.readDouble();
gpsClock.mFullBiasInNs = parcel.readLong();
gpsClock.mBiasInNs = parcel.readDouble();
gpsClock.mBiasUncertaintyInNs = parcel.readDouble();
gpsClock.mDriftInNsPerSec = parcel.readDouble();
gpsClock.mDriftUncertaintyInNsPerSec = parcel.readDouble();
return gpsClock;
}
@Override
public GpsClock[] newArray(int size) {
return new GpsClock[size];
}
};
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeInt(mFlags);
parcel.writeInt(mLeapSecond);
parcel.writeByte(mType);
parcel.writeLong(mTimeInNs);
parcel.writeDouble(mTimeUncertaintyInNs);
parcel.writeLong(mFullBiasInNs);
parcel.writeDouble(mBiasInNs);
parcel.writeDouble(mBiasUncertaintyInNs);
parcel.writeDouble(mDriftInNsPerSec);
parcel.writeDouble(mDriftUncertaintyInNsPerSec);
}
@Override
public int describeContents() {
return 0;
}
@Override
public String toString() {
final String format = " %-15s = %s\n";
final String formatWithUncertainty = " %-15s = %-25s %-26s = %s\n";
StringBuilder builder = new StringBuilder("GpsClock:\n");
builder.append(String.format(format, "Type", getTypeString()));
builder.append(String.format(format, "LeapSecond", hasLeapSecond() ? mLeapSecond : null));
builder.append(String.format(
formatWithUncertainty,
"TimeInNs",
mTimeInNs,
"TimeUncertaintyInNs",
hasTimeUncertaintyInNs() ? mTimeUncertaintyInNs : null));
builder.append(String.format(
format,
"FullBiasInNs",
hasFullBiasInNs() ? mFullBiasInNs : null));
builder.append(String.format(
formatWithUncertainty,
"BiasInNs",
hasBiasInNs() ? mBiasInNs : null,
"BiasUncertaintyInNs",
hasBiasUncertaintyInNs() ? mBiasUncertaintyInNs : null));
builder.append(String.format(
formatWithUncertainty,
"DriftInNsPerSec",
hasDriftInNsPerSec() ? mDriftInNsPerSec : null,
"DriftUncertaintyInNsPerSec",
hasDriftUncertaintyInNsPerSec() ? mDriftUncertaintyInNsPerSec : null));
return builder.toString();
}
private void initialize() {
mFlags = HAS_NO_FLAGS;
resetLeapSecond();
setType(TYPE_UNKNOWN);
setTimeInNs(Long.MIN_VALUE);
resetTimeUncertaintyInNs();
resetFullBiasInNs();
resetBiasInNs();
resetBiasUncertaintyInNs();
resetDriftInNsPerSec();
resetDriftUncertaintyInNsPerSec();
}
private void setFlag(short flag) {
mFlags |= flag;
}
private void resetFlag(short flag) {
mFlags &= ~flag;
}
private boolean isFlagSet(short flag) {
return (mFlags & flag) == flag;
}
}
| [
"[email protected]"
] | |
8bb6b3ba9568c001ff61e4c281c635b744f2c2b9 | ae6b6de24b7735e8b04fab63db083896ceb0fee4 | /adfs-hdfs-project/adfs-hdfs/src/test/java/org/apache/hadoop/hdfs/TestMNPread.java | 8fa4d46c654356fe05be6aec6876f3a520806403 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | jiangyu/ADFS-1 | 0ad14f56a02677d6d2e1b89841b9b80712f10412 | c41f463f7236dbbb05cd12ef513dee0c5baff3eb | refs/heads/master | 2021-01-16T20:33:22.616946 | 2012-04-17T01:34:50 | 2012-04-17T01:34:50 | 4,354,368 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,111 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hdfs;
import junit.framework.TestCase;
import java.io.*;
import java.util.Random;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset;
/**
* This class tests the DFS positional read functionality in a single node
* mini-cluster.
*/
public class TestMNPread extends TestCase {
static final long seed = 0xDEADBEEFL;
static final int blockSize = 4096;
boolean simulatedStorage = false;
private void writeFile(FileSystem fileSys, Path name) throws IOException {
// create and write a file that contains three blocks of data
DataOutputStream stm = fileSys.create(name, true, 4096, (short)1,
(long)blockSize);
// test empty file open and read
stm.close();
FSDataInputStream in = fileSys.open(name);
byte[] buffer = new byte[(int)(12*blockSize)];
in.readFully(0, buffer, 0, 0);
IOException res = null;
try { // read beyond the end of the file
in.readFully(0, buffer, 0, 1);
} catch (IOException e) {
// should throw an exception
res = e;
}
assertTrue("Error reading beyond file boundary.", res != null);
in.close();
if (!fileSys.delete(name, true))
assertTrue("Cannot delete file", false);
// now create the real file
stm = fileSys.create(name, true, 4096, (short)1, (long)blockSize);
Random rand = new Random(seed);
rand.nextBytes(buffer);
stm.write(buffer);
stm.close();
}
private void checkAndEraseData(byte[] actual, int from, byte[] expected, String message) {
for (int idx = 0; idx < actual.length; idx++) {
assertEquals(message+" byte "+(from+idx)+" differs. expected "+
expected[from+idx]+" actual "+actual[idx],
actual[idx], expected[from+idx]);
actual[idx] = 0;
}
}
private void doPread(FSDataInputStream stm, long position, byte[] buffer,
int offset, int length) throws IOException {
int nread = 0;
while (nread < length) {
int nbytes = stm.read(position+nread, buffer, offset+nread, length-nread);
assertTrue("Error in pread", nbytes > 0);
nread += nbytes;
}
}
private void pReadFile(FileSystem fileSys, Path name) throws IOException {
FSDataInputStream stm = fileSys.open(name);
byte[] expected = new byte[(int)(12*blockSize)];
if (simulatedStorage) {
for (int i= 0; i < expected.length; i++) {
expected[i] = SimulatedFSDataset.DEFAULT_DATABYTE;
}
} else {
Random rand = new Random(seed);
rand.nextBytes(expected);
}
// do a sanity check. Read first 4K bytes
byte[] actual = new byte[4096];
stm.readFully(actual);
checkAndEraseData(actual, 0, expected, "Read Sanity Test");
// now do a pread for the first 8K bytes
actual = new byte[8192];
doPread(stm, 0L, actual, 0, 8192);
checkAndEraseData(actual, 0, expected, "Pread Test 1");
// Now check to see if the normal read returns 4K-8K byte range
actual = new byte[4096];
stm.readFully(actual);
checkAndEraseData(actual, 4096, expected, "Pread Test 2");
// Now see if we can cross a single block boundary successfully
// read 4K bytes from blockSize - 2K offset
stm.readFully(blockSize - 2048, actual, 0, 4096);
checkAndEraseData(actual, (int)(blockSize-2048), expected, "Pread Test 3");
// now see if we can cross two block boundaries successfully
// read blockSize + 4K bytes from blockSize - 2K offset
actual = new byte[(int)(blockSize+4096)];
stm.readFully(blockSize - 2048, actual);
checkAndEraseData(actual, (int)(blockSize-2048), expected, "Pread Test 4");
// now see if we can cross two block boundaries that are not cached
// read blockSize + 4K bytes from 10*blockSize - 2K offset
actual = new byte[(int)(blockSize+4096)];
stm.readFully(10*blockSize - 2048, actual);
checkAndEraseData(actual, (int)(10*blockSize-2048), expected, "Pread Test 5");
// now check that even after all these preads, we can still read
// bytes 8K-12K
actual = new byte[4096];
stm.readFully(actual);
checkAndEraseData(actual, 8192, expected, "Pread Test 6");
// done
stm.close();
// check block location caching
stm = fileSys.open(name);
stm.readFully(1, actual, 0, 4096);
stm.readFully(4*blockSize, actual, 0, 4096);
stm.readFully(7*blockSize, actual, 0, 4096);
actual = new byte[3*4096];
stm.readFully(0*blockSize, actual, 0, 3*4096);
checkAndEraseData(actual, 0, expected, "Pread Test 7");
actual = new byte[8*4096];
stm.readFully(3*blockSize, actual, 0, 8*4096);
checkAndEraseData(actual, 3*blockSize, expected, "Pread Test 8");
// read the tail
stm.readFully(11*blockSize+blockSize/2, actual, 0, blockSize/2);
IOException res = null;
try { // read beyond the end of the file
stm.readFully(11*blockSize+blockSize/2, actual, 0, blockSize);
} catch (IOException e) {
// should throw an exception
res = e;
}
assertTrue("Error reading beyond file boundary.", res != null);
stm.close();
}
// test pread can survive datanode restarts
private void datanodeRestartTest(MiniMNDFSCluster cluster, FileSystem fileSys,
Path name) throws IOException {
// skip this test if using simulated storage since simulated blocks
// don't survive datanode restarts.
if (simulatedStorage) {
return;
}
int numBlocks = 1;
assertTrue(numBlocks <= DFSClient.MAX_BLOCK_ACQUIRE_FAILURES);
byte[] expected = new byte[numBlocks * blockSize];
Random rand = new Random(seed);
rand.nextBytes(expected);
byte[] actual = new byte[numBlocks * blockSize];
FSDataInputStream stm = fileSys.open(name);
// read a block and get block locations cached as a result
stm.readFully(0, actual);
checkAndEraseData(actual, 0, expected, "Pread Datanode Restart Setup");
// restart all datanodes. it is expected that they will
// restart on different ports, hence, cached block locations
// will no longer work.
assertTrue(cluster.restartDataNodes());
cluster.waitActive();
// verify the block can be read again using the same InputStream
// (via re-fetching of block locations from namenode). there is a
// 3 sec sleep in chooseDataNode(), which can be shortened for
// this test if configurable.
stm.readFully(0, actual);
checkAndEraseData(actual, 0, expected, "Pread Datanode Restart Test");
}
private void cleanupFile(FileSystem fileSys, Path name) throws IOException {
assertTrue(fileSys.exists(name));
assertTrue(fileSys.delete(name, true));
assertTrue(!fileSys.exists(name));
}
/**
* Tests positional read in DFS.
*/
public void testPreadDFS1() throws IOException {
dfsPreadTest(false, 1); //normal pread
dfsPreadTest(true, 1); //trigger read code path without transferTo.
}
public void testPreadDFS2() throws IOException {
dfsPreadTest(false, 2); //normal pread
dfsPreadTest(true, 2); //trigger read code path without transferTo.
}
private void dfsPreadTest(boolean disableTransferTo, int type) throws IOException {
Configuration conf = new Configuration();
conf.setLong("dfs.block.size", 4096);
conf.setLong("dfs.read.prefetch.size", 4096);
if (simulatedStorage) {
conf.setBoolean("dfs.datanode.simulateddatastorage", true);
}
if (disableTransferTo) {
conf.setBoolean("dfs.datanode.transferTo.allowed", false);
}
conf.setStrings("dfs.namenode.port.list", "0,0");
FileSystem fileSys;
MiniMNDFSCluster cluster;
if(1==type) {
cluster = new MiniMNDFSCluster(conf, 3, 1, true, null);
fileSys = cluster.getFileSystem(0);
}
else
{
cluster = new MiniMNDFSCluster(conf, 1, 1, true, null);
cluster.startDataNodes(conf, 2, 1, true, null, null, null);
fileSys = cluster.getFileSystem(0);
}
cluster.waitDatanodeDie();
try {
Path file1 = new Path("preadtest.dat");
writeFile(fileSys, file1);
pReadFile(fileSys, file1);
datanodeRestartTest(cluster, fileSys, file1);
cleanupFile(fileSys, file1);
} finally {
fileSys.close();
cluster.shutdown();
}
}
public void testPreadDFSSimulated1() throws IOException {
simulatedStorage = true;
testPreadDFS1();
simulatedStorage = false;
}
public void testPreadDFSSimulated2() throws IOException {
simulatedStorage = true;
testPreadDFS2();
simulatedStorage = false;
}
/**
* Tests positional read in LocalFS.
*/
public void testPreadLocalFS() throws IOException {
Configuration conf = new Configuration();
FileSystem fileSys = FileSystem.getLocal(conf);
try {
Path file1 = new Path("build/test/data", "preadtest.dat");
writeFile(fileSys, file1);
pReadFile(fileSys, file1);
cleanupFile(fileSys, file1);
} finally {
fileSys.close();
}
}
public static void main(String[] args) throws Exception {
new TestMNPread().testPreadDFS1();
}
}
| [
"[email protected]"
] | |
190f8f8138f040805dce822a276bd6aa8f7c0a68 | 4c8e4fe675281e0d51e66d27117127d90ad793d9 | /src/dawn/core/Core.java | c6fb586addb7bb3034e1b312aeecefeaa7159a52 | [] | no_license | Erls-Corporation/Dawn | 8773528617e34d675493f473f9896de4a8fe7f5a | 3ca451a914e35508a7e6d06850e5afaf7096c2e2 | refs/heads/master | 2020-12-24T15:04:48.776757 | 2010-12-27T22:22:33 | 2010-12-27T22:22:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 573 | java | package dawn.core;
import java.util.concurrent.TimeUnit;
import dawn.core.services.ServiceManager;
import dawn.core.subscriber.SubscriberService;
public class Core {
public static void main(String[] args) {
SubscriberService
.newSubscriber("dawn.user.subscriber.window.core.WindowCore");
ServiceManager.startServices();
try {
Thread.sleep(TimeUnit.SECONDS.toMillis(6));
} catch (InterruptedException e) {
e.printStackTrace();
}
ServiceManager.stopServices();
}
}
| [
"[email protected]"
] | |
3455ca04e46144874dd9a2c989434a1307c66110 | c2a14d4d20d6558dea2232073928847c65ef8490 | /src/Controlador/Automata_False.java | 0d6d305e55cfda84118aa513339fab5ae204f4ab | [] | no_license | ingesofteam/repositorioanalizadorlexico | 07655defb418cae8dca77f2a663ab45f566d8617 | c1854144aaadd1e465b061efbec3e7db5eec0492 | refs/heads/master | 2020-07-15T15:09:54.354844 | 2019-08-31T16:56:39 | 2019-08-31T16:56:39 | 205,590,786 | 0 | 0 | null | 2019-08-31T20:01:59 | 2019-08-31T20:01:59 | null | UTF-8 | Java | false | false | 2,107 | 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 Controlador;
import Modelo.Caracteres;
import Modelo.Lexema;
/**
*
* @author Mauricio
*/
public class Automata_False {
int cont;
boolean aceptada;
char[] car;
public Lexema inicio(Caracteres flujo) {
cont = flujo.getPosActual();
car = flujo.getCaracteres();
aceptada = false;
q0();
if (aceptada) {
Analizador_Lexico.flujo.setPosActual(cont);
return new Lexema("false", "Palabra reservada");
} else {
return null;
}
}
public void q0() {
if (cont < car.length) {
if (car[cont] == 'f') {
cont++;
q1();
} else {
aceptada = false;
}
}
}
public void q1() {
if (cont < car.length) {
if (car[cont] == 'a') {
cont++;
q2();
} else {
aceptada = false;
}
}
}
public void q2() {
if (cont < car.length) {
if (car[cont] == 'l') {
cont++;
q3();
} else {
aceptada = false;
}
}
}
public void q3() {
if (cont < car.length) {
if (car[cont] == 's') {
cont++;
qF();
} else {
aceptada = false;
}
}
}
public void qF() {
if (cont < car.length) {
if (car[cont] == 'e') {
aceptada = true;
cont++;
qF();
} else if (Character.isLetter(car[cont]) || Character.isDigit(car[cont])) {
aceptada = false;
cont--;
}else if (car[cont] == ' ') {
cont++;
aceptada = true;
}
}
}
}
| [
"[email protected]"
] | |
dc0361d56135e9373e895adb58497bdb2631d02c | bc661b3ee662193c50b0f9f95b0ec3d51587337f | /src/main/java/code88/oscar/bcm/request/SaveUserRequest.java | f8eb989854ef2c6dee7647ab865fdb9eb46525e7 | [] | no_license | oscar20041998/bcm-api-v1 | 5cfa34d85d2b7c02153759ee60ed82bb3c430d0d | 8127fab3b8ae2a8ad85a86bc742a392560594e1e | refs/heads/master | 2023-04-16T02:18:31.732903 | 2021-04-11T05:19:14 | 2021-04-11T05:19:14 | 318,952,139 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,535 | java | package code88.oscar.bcm.request;
import java.sql.Date;
/**
* @FileName: CreateUserRequest.java
* @since: 10/10/2020
*/
public class SaveUserRequest {
private String accountIdValid;
private String userId;
private String fristName;
private String midleName;
private String lastName;
private String role;
private Date dateOfBirth;
private String idCard;
private String address;
private String phoneNumber;
private String email;
private String createBy;
private Date createDate;
public SaveUserRequest() {
super();
// TODO Auto-generated constructor stub
}
public SaveUserRequest(String userId, String fristName, String midleName, String lastName, Date dateOfBirth,
String idCard, String address, String phoneNumber, String email, String userIdValid, String createBy,
Date createDate, String role) {
super();
this.userId = userId;
this.fristName = fristName;
this.midleName = midleName;
this.lastName = lastName;
this.dateOfBirth = dateOfBirth;
this.idCard = idCard;
this.address = address;
this.role = role;
this.phoneNumber = phoneNumber;
this.email = email;
this.accountIdValid = userIdValid;
this.createBy = createBy;
this.createDate = createDate;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getFristName() {
return fristName;
}
public void setFristName(String fristName) {
this.fristName = fristName;
}
public String getMidleName() {
return midleName;
}
public void setMidleName(String midleName) {
this.midleName = midleName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public Date getDateOfBirth() {
return dateOfBirth;
}
public void setDateOfBirth(Date dateOfBirth) {
this.dateOfBirth = dateOfBirth;
}
public String getIdCard() {
return idCard;
}
public void setIdCard(String idCard) {
this.idCard = idCard;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getAccountIdValid() {
return accountIdValid;
}
public void setAccountIdValid(String accountIdValid) {
this.accountIdValid = accountIdValid;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
@Override
public String toString() {
return "SaveUserRequest [accountIdValid=" + accountIdValid + ", userId=" + userId + ", fristName=" + fristName
+ ", midleName=" + midleName + ", lastName=" + lastName + ", dateOfBirth=" + dateOfBirth + ", idCard="
+ idCard + ", address=" + address + ", phoneNumber=" + phoneNumber + ", email=" + email + ", createBy="
+ createBy + ", createDate=" + createDate + "]";
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
}
| [
"[email protected]"
] | |
c229267d189b270d1d2441bd310c0d096faf8e52 | 0dda335c981a9c215507f42efa7de4c2bb3f0836 | /app/src/test/java/com/sms/demo/piedatachart/ExampleUnitTest.java | 94e8a1943afe5ad9c86aa86ccad73963761c83ed | [] | no_license | MahmudMoon/PieDataChart | db67365cbcb820ce3a5e417eabb94e345851d8a2 | ad713ffe0f79a9ba64acfbd95a6263d30722ac91 | refs/heads/master | 2020-03-25T09:09:22.370132 | 2018-08-05T21:58:08 | 2018-08-05T21:58:08 | 143,650,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package com.sms.demo.piedatachart;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
bf3fe4e4eaf3df019bce89866dcd2fba729fdec6 | ba93c6bc277bc8faca6db7be593fe579598a7bfe | /Uzumzki-project/2018/eke/src/main/java/com/xiaoyi/ssm/coreFunction/UfangUtil.java | 6032ee4f0b2e3c08ce31780eba2642441d57af04 | [
"MIT"
] | permissive | senghor-song/Naruto-Uzumaki | abbf101ae763aff33dcbae0eb035ed7ad288b9c1 | 24879ae0688efc7ff0ec22fbb9210158834df7e2 | refs/heads/master | 2023-05-11T07:51:55.254986 | 2023-05-05T03:24:57 | 2023-05-05T03:24:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,211 | java | package com.xiaoyi.ssm.coreFunction;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.CookieHandler;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.net.CookieStore;
import java.net.HttpCookie;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.xiaoyi.ssm.util.HTTPSTrustManager;
import com.xiaoyi.ssm.util.HttpUtils;
/**
* @Description: U房网接口功能代码
* @author 宋高俊
* @date 2018年7月16日 上午9:36:27
*/
public class UfangUtil {
public static void main(String[] args) {
HTTPSTrustManager.allowAllSSL();//信任所有证书
//登录前先访问页面获取Cookie,建立连接
Map<String, String> map = HttpUtils.sendGetHtml("http://esf.ufang.com/login?refer=%2F", "utf-8");
//建立连接后去登录
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("LoginForm[username]", "13360063236");
parameters.put("LoginForm[password]", "123456");
parameters.put("LoginForm[rememberMe]", "0");
parameters.put("yt0", "");
Map<String, String> loginmap = login("http://esf.ufang.com/login?refer=%2F", parameters, map.get("cookie"));
System.out.println(loginmap.get("html"));
// //获取登录成功后的cookie去发布房源
// Map<String, String> parameters2 = new HashMap<String, String>();
// parameters2.put("HouseForm[title]", "深圳龙华民治地铁口两房一厅2");
// parameters2.put("HouseForm[name]", "新怡美丽家园");
// parameters2.put("HouseForm[address]", "博罗县博罗工业大道与远望大道交汇处");
// parameters2.put("HouseForm[price]", "500");
// parameters2.put("HouseForm[mright]", "个人产权");
// parameters2.put("HouseForm[room]", "2");
// parameters2.put("HouseForm[hall]", "1");
// parameters2.put("HouseForm[toilet]", "1");
// parameters2.put("HouseForm[kitchen]", "1");
// parameters2.put("HouseForm[balcony]", "1");
// parameters2.put("HouseForm[building_area]", "100");
// parameters2.put("HouseForm[living_area]", "");
// parameters2.put("HouseForm[floor]", "10");
// parameters2.put("HouseForm[total_floor]", "11");
// parameters2.put("HouseForm[forward]", "南北");
// parameters2.put("HouseForm[purpose]", "");
// parameters2.put("HouseForm[purpose]", "住宅");
// parameters2.put("HouseForm[create_time]", "");
// parameters2.put("HouseForm[purpose_class]", "");
// parameters2.put("HouseForm[purpose_class]", "普通住宅");
// parameters2.put("HouseForm[build_class]", "");
// parameters2.put("HouseForm[build_class]", "板楼");
// parameters2.put("HouseForm[house_way]", "");
// parameters2.put("HouseForm[house_way]", "平层");
// parameters2.put("HouseForm[valid_date]", "60");
// parameters2.put("HouseForm[fitment]", "");
// parameters2.put("HouseForm[fitment]", "豪华装修");
// parameters2.put("HouseForm[look_house_info]", "");
// parameters2.put("HouseForm[look_house_info]", "随时看房");
// parameters2.put("HouseForm[base_service]", "");
// parameters2.put("HouseForm[traffic_info]", "");
// parameters2.put("HouseForm[around_condition]", "");
// parameters2.put("HouseForm[description]", "");
// parameters2.put("HouseForm[phone]", "");
// parameters2.put("HouseForm[paid]", "5");
// parameters2.put("HouseForm[aid]", "48");
// parameters2.put("HouseForm[pic]", "");
// String result = enter("http://esf.ufang.com/ajax/houseAdd", parameters2, loginmap.get("cookie"));
// System.out.println(result);
}
/**
* @Description: U房网登录
* @author 宋高俊
* @date 2018年7月16日 上午11:16:26
*/
public static Map<String, String> login(String url, Map<String, String> parameters, String cookie) {
Map<String, String> map = new HashMap<String, String>();
CookieManager manager = new CookieManager();
// 设置cookie策略,只接受与你对话服务器的cookie,而不接收Internet上其它服务器发送的cookie
// manager.setCookiePolicy(CookiePolicy.ACCEPT_ORIGINAL_SERVER);
manager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
CookieHandler.setDefault(manager);
String result = "";// 返回的结果
BufferedReader in = null;// 读取响应输入流
PrintWriter out = null;
StringBuffer sb = new StringBuffer();// 处理请求参数
String params = "";// 编码之后的参数
try {
// 编码请求参数
if (parameters.size() > 0) {
if (parameters.size() == 1) {
for (String name : parameters.keySet()) {
sb.append(name).append("=").append(URLEncoder.encode(parameters.get(name),"UTF-8"));
}
params = sb.toString();
} else {
for (String name : parameters.keySet()) {
sb.append(name).append("=").append(URLEncoder.encode(parameters.get(name),"UTF-8")).append("&");
}
String temp_params = sb.toString();
params = temp_params.substring(0, temp_params.length() - 1);
}
}
String full_url = url + "&" + params;
// 创建URL对象
URL connURL = new URL(url);
// 打开URL连接
HttpURLConnection httpConn = (HttpURLConnection) connURL.openConnection();
// 设置通用属性
// httpConn.setRequestProperty("Connection", "keep-alive");
// httpConn.setRequestProperty("Content-Length", "144");
// httpConn.setRequestProperty("Cache-Control", "max-age=0");
// httpConn.setRequestProperty("Origin", "http://www.baixing.com");
// httpConn.setRequestProperty("Upgrade-Insecure-Requests", "1");
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
httpConn.setRequestProperty("Cookie", cookie);
// 设置POST方式
httpConn.setDoInput(true);
httpConn.setDoOutput(true);
// 获取HttpURLConnection对象对应的输出流
out = new PrintWriter(httpConn.getOutputStream());
// 发送请求参数
out.write(params);
// flush输出流的缓冲
out.flush();
// 定义BufferedReader输入流来读取URL的响应,设置编码方式
in = new BufferedReader(new InputStreamReader(
httpConn.getInputStream(), "UTF-8"));
String line;
// 读取返回的内容
while ((line = in.readLine()) != null) {
result += line;
}
map.put("html", result);
CookieStore store = manager.getCookieStore();
// 得到所有的 URI
List<URI> uris = store.getURIs();
for (URI ur : uris) {
// 筛选需要的 URI
// 得到属于这个 URI 的所有 Cookie
List<HttpCookie> cookies = store.get(ur);
for (HttpCookie coo : cookies) {
cookie += coo.toString() + ";";
}
}
map.put("cookie", cookie);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return map;
}
/**
* @Description: 发布房源
* @author 宋高俊
* @date 2018年7月16日 下午5:18:20
*/
public static String enter(String url, Map<String, String> parameters,
String cookie) {
String result = "";// 返回的结果
BufferedReader in = null;// 读取响应输入流
PrintWriter out = null;
StringBuffer sb = new StringBuffer();// 处理请求参数
String params = "";// 编码之后的参数
try {
// 编码请求参数
if (parameters.size() > 0) {
if (parameters.size() == 1) {
for (String name : parameters.keySet()) {
sb.append(name)
.append("=")
.append(URLEncoder.encode(parameters.get(name),
"UTF-8"));
}
params = sb.toString();
} else {
for (String name : parameters.keySet()) {
sb.append(name)
.append("=")
.append(URLEncoder.encode(parameters.get(name),
"UTF-8")).append("&");
}
String temp_params = sb.toString();
params = temp_params.substring(0, temp_params.length() - 1);
}
}
// String full_url = url + "?" + params;
// 创建URL对象
URL connURL = new URL(url);
// 打开URL连接
HttpURLConnection httpConn = (HttpURLConnection) connURL
.openConnection();
HttpURLConnection.setFollowRedirects(true);
// 设置通用属性
httpConn.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
httpConn.setRequestProperty("Cookie", cookie);
// 设置POST方式
httpConn.setDoInput(true);
httpConn.setDoOutput(true);
// 获取HttpURLConnection对象对应的输出流
out = new PrintWriter(httpConn.getOutputStream());
// 发送请求参数
out.write(params);
// flush输出流的缓冲
out.flush();
// 定义BufferedReader输入流来读取URL的响应,设置编码方式
in = new BufferedReader(new InputStreamReader(
httpConn.getInputStream(), "UTF-8"));
String line;
// 读取返回的内容
while ((line = in.readLine()) != null) {
result += line;
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result;
}
}
| [
"[email protected]"
] | |
25a7f013e432606e274ab82278aa36eb0133bc00 | c9036b9337768e6bc505103df5bc63656ac32f29 | /study7/src/test/java/com/zyc/study7/Study7ApplicationTests.java | 55291e9cff02ea029cff1f19f9c9d9b1e8dc00f8 | [] | no_license | Ccxlp/springboot-study | 6354cbd3b30783599fa0d45de95c89332bc06088 | 577b5f7e5c4462d536e74d57edb89c64d4559f6c | refs/heads/master | 2020-08-01T00:53:50.268367 | 2019-04-10T02:49:42 | 2019-04-10T02:49:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package com.zyc.study7;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class Study7ApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
] | |
8ae1351dc661b2c64525dd571859dda6fef92290 | 782bcf9376c91485ba8332a9aa626d5d6e917900 | /适配器模式/Voltage220V.java | bdfec84cf0b15d411911c5a54490a7a06c9e4b2f | [] | no_license | SongFGH/javaDesignModel | aa969f07680bcea30e64e6f2f77d3551851d3805 | ac025d0a7291e7caba1f567640ebf5d401b3d036 | refs/heads/master | 2022-04-12T23:07:12.774212 | 2020-04-11T05:24:06 | 2020-04-11T05:24:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 185 | java | package funcfactory.voltage;
public class Voltage220V {
public int output220V(){
int src = 220;
System.out.println("电压"+src+"伏");
return src;
}
}
| [
"[email protected]"
] | |
853b9e105e114734c6a0348f77fb7c4f9e0ecc9b | 1f57fe63a87b8304caea247e747ad0dd163e320e | /src/main/java/com/metro/shuttle/advisory/configuration/ShuttleAdvisoryApplication.java | 5c0403258878f1fec8ce39084f5a31388b376abd | [] | no_license | prasantharunachalam/ShuttleAdvisory | 76e5e10ff7bcaa4f6eb163202d1f14f3e61f3a6a | bdc67a6e2fcebeca0d1204c3ac0519834760d258 | refs/heads/master | 2021-06-20T23:33:52.066702 | 2019-08-26T17:44:00 | 2019-08-26T17:44:00 | 201,790,566 | 1 | 0 | null | 2021-03-31T21:30:02 | 2019-08-11T16:46:00 | Java | UTF-8 | Java | false | false | 2,445 | java | package com.metro.shuttle.advisory.configuration;
import java.util.Arrays;
import javax.sql.DataSource;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
import org.springframework.web.client.RestTemplate;
import com.metro.shuttle.advisory.security.entity.Role;
import com.metro.shuttle.advisory.security.entity.User;
import com.metro.shuttle.advisory.security.service.UserService;
@SpringBootApplication
@ComponentScan(basePackages = "com.metro.shuttle")
@EnableJpaRepositories("com.metro.shuttle.advisory.security.jpa.repository")
@EntityScan("com.metro.shuttle.advisory.security.entity")
@EnableCircuitBreaker
@EnableHystrixDashboard
public class ShuttleAdvisoryApplication {
public static void main(String[] args) {
SpringApplication.run(ShuttleAdvisoryApplication.class, args);
}
@Bean
public RestTemplate restTemplate(RestTemplateBuilder builder) {
return builder.build();
}
@Bean
public MethodValidationPostProcessor methodValidationPostProcessor() {
return new MethodValidationPostProcessor();
}
@Bean
public CommandLineRunner setupDefaultUser(UserService service) {
return args -> {
service.save(new User("user", // username
"user", // password
Arrays.asList(new Role("USER"), new Role("ACTUATOR")), // roles
true// Active
));
};
}
@Bean
public PasswordEncoder getPasswordEncoder() {
return new BCryptPasswordEncoder();
}
@Bean
public DataSource dataSource(DataSourceProperties dataSourceProperties) {
return dataSourceProperties.initializeDataSourceBuilder().build();
}
}
| [
"[email protected]"
] | |
593cf0448f006c8f4f76f95dddc3a1b38ad88d72 | 1df021401a35baf1590aa2e1b7d76dfcd3974285 | /spritz/src/main/java/com/malice/spritzglass/SpritzGlass.java | 55c16bf86f326186a5811cc4b117805510b6eea2 | [] | no_license | Aenterhy/SpritzGlass | db366676d04f3b6cac8d95926ba9cecd5f19af4c | 11b85e359bc734b3b85204c000dc6ce47e7944d9 | refs/heads/master | 2021-01-13T02:19:15.538950 | 2014-03-24T22:22:17 | 2014-03-24T22:22:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 469 | java | package com.malice.spritzglass;
import android.app.Application;
import com.bugsnag.android.Bugsnag;
/**
* @author Aenterhy.
*/
public class SpritzGlass extends Application {
private static SpritzGlass instance;
@Override
public void onCreate() {
super.onCreate();
instance = this;
Bugsnag.register(this, "4ffe22aacb5a689629d09ba1060a8132");
}
public static SpritzGlass getInstance() {
return instance;
}
}
| [
"[email protected]"
] | |
ade81d2391158093ce8645a8fc7f76ea7ada2174 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_8a3cff7d1ada9849798e5fd00acb3a196e890cde/YourFilesFileRunner/2_8a3cff7d1ada9849798e5fd00acb3a196e890cde_YourFilesFileRunner_t.java | fc6df2b6a6bd8dd687f5bfad3bc442dacf5e8976 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 4,615 | java | package cz.vity.freerapid.plugins.services.yourfiles;
import cz.vity.freerapid.plugins.exceptions.ErrorDuringDownloadingException;
import cz.vity.freerapid.plugins.exceptions.PluginImplementationException;
import cz.vity.freerapid.plugins.exceptions.ServiceConnectionProblemException;
import cz.vity.freerapid.plugins.exceptions.URLNotAvailableAnymoreException;
import cz.vity.freerapid.plugins.webclient.AbstractRunner;
import cz.vity.freerapid.plugins.webclient.FileState;
import cz.vity.freerapid.plugins.webclient.utils.PlugUtils;
import org.apache.commons.httpclient.methods.GetMethod;
import java.util.logging.Logger;
import java.util.regex.Matcher;
/**
* Class which contains main code
*
* @author Vity
*/
class YourFilesFileRunner extends AbstractRunner {
private final static Logger logger = Logger.getLogger(YourFilesFileRunner.class.getName());
@Override
public void runCheck() throws Exception { //this method validates file
super.runCheck();
final GetMethod getMethod = getGetMethod(fileURL);//make first request
if (makeRedirectedRequest(getMethod)) {
checkNameAndSize(getContentAsString());//ok let's extract file name and size from the page
} else
throw new PluginImplementationException();
}
private void checkNameAndSize(String content) throws ErrorDuringDownloadingException {
Matcher matcher = PlugUtils.matcher("width=80%>(.+?)<", content);
if (matcher.find()) {
final String fileName = matcher.group(1).trim(); //method trim removes white characters from both sides of string
logger.info("File name " + fileName);
httpFile.setFileName(fileName);
//: <strong>204800</strong>KB<br>
matcher = PlugUtils.matcher("Dateigr..e:</b></td>\\s*<td align=left>(.+?)<", content);
if (matcher.find()) {
final long size = PlugUtils.getFileSizeFromString(matcher.group(1));
httpFile.setFileSize(size);
} else {
checkProblems();
logger.warning("File size was not found\n:");
throw new PluginImplementationException();
}
} else {
checkProblems();
logger.warning("File name was not found");
throw new PluginImplementationException();
}
httpFile.setFileState(FileState.CHECKED_AND_EXISTING);
}
@Override
public void run() throws Exception {
super.run();
logger.info("Starting download in TASK " + fileURL);
final GetMethod method = getGetMethod(fileURL); //create GET request
if (makeRedirectedRequest(method)) { //we make the main request
final String contentAsString = getContentAsString();//check for response
checkProblems();//check problems
checkNameAndSize(contentAsString);//extract file name and size from the page
client.setReferer(fileURL);//prevention - some services checks referers
//here is the download link extraction
final Matcher matcher = getMatcherAgainstContent("onclick='[^']*document.location=\"(http[^\"]+)\"");
if (matcher.find()) {
final GetMethod getMethod = getGetMethod(matcher.group(1));//we make POST request for file
if (!tryDownloadAndSaveFile(getMethod)) {
checkProblems();//if downloading failed
logger.warning(getContentAsString());//log the info
throw new PluginImplementationException();//some unknown problem
}
} else throw new PluginImplementationException("Plugin error: Download link not found");
} else {
checkProblems();
throw new ServiceConnectionProblemException();
}
}
private void checkProblems() throws ErrorDuringDownloadingException {
final String contentAsString = getContentAsString();
if (contentAsString.contains("Die angefragte Datei wurde nicht gefunden")) {
throw new URLNotAvailableAnymoreException("Die angefragte Datei wurde nicht gefunden"); //let to know user in FRD
}
if (contentAsString.contains("Connection to database server failed")) {
throw new ServiceConnectionProblemException("Connection to database server failed"); //let to know user in FRD
}
}
}
| [
"[email protected]"
] | |
c97f5b1dda957b4feb4b12beeedef31acfdd6c54 | 15527811afe5021f5334675f9d30363af8df0fda | /src/com/javarush/test/level14/lesson08/home05/Keyboard.java | 06352795a51d853e02acc2ce539c8f18ddba0be2 | [] | no_license | barrannov/JavaRushHomeWork | f65235fe4e41cc2cc2be47db9abcd13293665c35 | 704e951099c44ea81400fda6a2a31fc43d7e27d3 | refs/heads/master | 2021-01-24T17:53:42.858954 | 2016-09-08T21:37:33 | 2016-09-08T21:37:33 | 67,285,716 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 203 | java | package com.javarush.test.level14.lesson08.home05;
/**
* Created by Sasha on 06.07.2016.
*/
public class Keyboard implements CompItem{
public String getName(){
return "Keyboard";
}
}
| [
"[email protected]"
] | |
a4a2db3cca2ac85aa87b8c8f9b8ac45f0ff14966 | 04256e70f9e0fb119cd84521c2f01a97e2742720 | /backend/AUTH_SERVER/project/src/main/java/com/smilegate/auth/exceptions/TimeoutException.java | 4c978d1e14e857e772c5071ce4487bf2b7e4b778 | [] | no_license | serverdevcamp/camp4_hghss | 69b8cdf6ddb3a5da20d98417f50103c78da4b6ad | ceb38cd52e151b98c2647d24c6d12776d0fc7e0a | refs/heads/master | 2021-06-28T23:53:47.907967 | 2020-06-03T00:28:33 | 2020-06-03T00:28:33 | 232,459,886 | 1 | 4 | null | 2021-05-11T10:27:33 | 2020-01-08T02:26:45 | Java | UTF-8 | Java | false | false | 196 | java | package com.smilegate.auth.exceptions;
public class TimeoutException extends RuntimeException {
public TimeoutException() {
super("인증 시간이 만료되었습니다.");
}
}
| [
"[email protected]"
] | |
712695f252e1d6876209ff978562f925cf1ffd61 | 954fb21c7ff72aa385797ee752a983bab24f5a35 | /workspace_sts3/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/mvc/org/apache/jsp/index_jsp.java | 7efe541ecd0c10a2eea0a03fac9b6ff1d2047b34 | [] | no_license | kimjoy70/lab2019_52 | 0df281da2bbd1740c2972436e923415bae2f4e5e | 66907742b81016a9eb5bef2a87c6ebe20a2b07a8 | refs/heads/master | 2022-12-24T04:08:16.680739 | 2020-03-04T02:26:42 | 2020-03-04T02:26:42 | 187,563,572 | 0 | 0 | null | 2022-12-16T00:42:13 | 2019-05-20T03:45:07 | CSS | UTF-8 | Java | false | false | 5,211 | java | /*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/9.0.19
* Generated at: 2019-08-24 13:13:33 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent,
org.apache.jasper.runtime.JspSourceImports {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
private static final java.util.Set<java.lang.String> _jspx_imports_packages;
private static final java.util.Set<java.lang.String> _jspx_imports_classes;
static {
_jspx_imports_packages = new java.util.HashSet<>();
_jspx_imports_packages.add("javax.servlet");
_jspx_imports_packages.add("javax.servlet.http");
_jspx_imports_packages.add("javax.servlet.jsp");
_jspx_imports_classes = null;
}
private volatile javax.el.ExpressionFactory _el_expressionfactory;
private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public java.util.Set<java.lang.String> getPackageImports() {
return _jspx_imports_packages;
}
public java.util.Set<java.lang.String> getClassImports() {
return _jspx_imports_classes;
}
public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
if (_el_expressionfactory == null) {
synchronized (this) {
if (_el_expressionfactory == null) {
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
}
}
}
return _el_expressionfactory;
}
public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
if (_jsp_instancemanager == null) {
synchronized (this) {
if (_jsp_instancemanager == null) {
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
}
}
return _jsp_instancemanager;
}
public void _jspInit() {
}
public void _jspDestroy() {
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
if (!javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
final java.lang.String _jspx_method = request.getMethod();
if ("OPTIONS".equals(_jspx_method)) {
response.setHeader("Allow","GET, HEAD, POST, OPTIONS");
return;
}
if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method)) {
response.setHeader("Allow","GET, HEAD, POST, OPTIONS");
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSP들은 오직 GET, POST 또는 HEAD 메소드만을 허용합니다. Jasper는 OPTIONS 메소드 또한 허용합니다.");
return;
}
}
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html; charset=UTF-8");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("<!DOCTYPE html>\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta charset=\"UTF-8\">\r\n");
out.write("<title>Insert title here</title>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("spring5 server start!!\r\n");
out.write("</body>\r\n");
out.write("</html>");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try {
if (response.isCommitted()) {
out.flush();
} else {
out.clearBuffer();
}
} catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
| [
"[email protected]"
] | |
90a285c7df6a06e4ef9057404886dd64083b74f9 | 9438ebf096cf006643c20a97cabe5aab5972ea6f | /src/main/java/com/giwook/study/functional/stream/collector/GetPrimeWithCustomCollector.java | 14b6ced23cd195a33bc36101528b4f2e6d24d770 | [] | no_license | 93Hong/Funtional-programming | 70a767f258964a94cdf0170620c655ce9590cf0a | 7b85486976a5eee558c1bcac5e2495f87db32947 | refs/heads/master | 2021-06-21T08:35:30.913781 | 2019-10-05T06:33:20 | 2019-10-05T06:33:20 | 205,278,856 | 0 | 0 | null | 2021-03-31T21:26:50 | 2019-08-30T01:13:01 | Java | UTF-8 | Java | false | false | 2,171 | java | package com.giwook.study.functional.stream.collector;
import com.giwook.study.functional.stream.TestObject;
import java.util.*;
import java.util.function.*;
import java.util.stream.Collector;
/**
*
* @author 93Hong on 2019-10-01
*
*/
public class GetPrimeWithCustomCollector implements Collector<Integer, Map<Boolean, List<Integer>>, Map<Boolean, List<Integer>>> {
@Override
public Supplier<Map<Boolean, List<Integer>>> supplier() {
return () -> new HashMap<>() {{
put(true, new ArrayList<>());
put(false, new ArrayList<>());
}};
}
@Override
public BiConsumer<Map<Boolean, List<Integer>>, Integer> accumulator() {
return (Map<Boolean, List<Integer>> acc, Integer candidate) -> {
// prime 으로 prime 을 체크 (이전에 구해논 prime 을 재사용)
acc.get(isPrime(acc.get(true), candidate))
.add(candidate);
};
}
// A function that accepts two partial results and merges them.
@Override
public BinaryOperator<Map<Boolean, List<Integer>>> combiner() {
return (Map<Boolean, List<Integer>> map1, Map<Boolean, List<Integer>> map2) -> {
map1.get(true).addAll(map2.get(true));
map1.get(false).addAll(map2.get(false));
return map1;
};
}
@Override
public Function<Map<Boolean, List<Integer>>, Map<Boolean, List<Integer>>> finisher() {
return Function.identity();
}
@Override
public Set<Characteristics> characteristics() {
return Collections.unmodifiableSet(EnumSet.of(Collector.Characteristics.IDENTITY_FINISH));
}
public boolean isPrime(List<Integer> primes, int candidate) {
Optional<TestObject> testObject = Optional.empty();
final Optional<String> s = testObject.map(TestObject::getName);
final String s1 = s.orElse("");
Optional.empty();
final Optional<Integer> integer = testObject.flatMap(TestObject::getOptionalInteger);
int candidateRoot = (int)Math.sqrt(candidate);
return takeWhile(primes, i -> i <= candidateRoot)
.stream()
.noneMatch(p -> candidate % p == 0);
}
public static <A> List<A> takeWhile(List<A> list, Predicate<A> p) {
int i = 0;
for (A item : list) {
if (!p.test(item)) {
return list.subList(0, i);
}
i++;
}
return list;
}
}
| [
"[email protected]"
] | |
b43b2fc6e55e9c8487f9563147c4a8f6dc20fd58 | 35baa2827ff9b4fbd787a02495f2c18df3c6e9e4 | /ProjetAppliWeb/src/main/java/dao/TicketDAO.java | 6fc80549ea5d23aa6f910efa62c5f2b618fb05dd | [] | no_license | biletnam/ApplicationWebEcommerce | 49e3b0c94fb3898f46799f7034bb5159a0bda037 | 41aca4652605464dd9a4fdac93b4eb1fd57b50d3 | refs/heads/master | 2021-01-20T03:54:18.753837 | 2016-11-13T19:35:33 | 2016-11-13T19:35:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,123 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package dao;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.sql.*;
import java.util.List;
import javax.sql.DataSource;
import modele.Spectacle;
import modele.Ticket;
/**
*
* @author kithr
*/
public class TicketDAO extends AbstractDataBaseDAO {
public TicketDAO(DataSource ds) {
super(ds);
}
/**
* Renvoie la liste des tickets disponibles
*/
public List<Ticket> getListeTicket() throws DAOException {
List<Ticket> result = new ArrayList<Ticket>();
ResultSet rs = null;
String requeteSQL = "";
Connection conn = null;
try {
conn = getConnection();
Statement st = conn.createStatement();
requeteSQL = "select * from ticket";
rs = st.executeQuery(requeteSQL);
while (rs.next()) {
Ticket ticket = new Ticket(rs.getInt("idticket"), rs.getInt("idspec"),
rs.getTimestamp("dateheure"), rs.getString("login"), rs.getInt("idsalle"),
rs.getInt("idrang"), rs.getInt("idplace"));
System.err.println(ticket);
result.add(ticket);
}
} catch (SQLException e) {
throw new DAOException("Erreur BD " + e.getMessage(), e);
} finally {
closeConnection(conn);
}
return result;
}
/**
* Ajoute le ticket dans les réservés et le retire des tickets possibles
*/
public void ajouterTicket(int idticket, int idspec, Timestamp dateheure, String login,
int idsalle, int idrang, int idplace) throws DAOException {
Connection conn = null;
ResultSet rs = null;
String requeteSQL = "";
try {
conn = getConnection();
Statement st = conn.createStatement();
requeteSQL = "insert into ticket values (" + idticket + "," + idspec
+ "," + dateheure + ",'" + login + "'," + idsalle + ","
+ idrang + "," + idplace + ")";
rs = st.executeQuery(requeteSQL);
} catch (SQLException e) {
throw new DAOException("Erreur BD " + e.getMessage(), e);
} finally {
closeConnection(conn);
}
}
/**
* Récupère le ticket reservé de la base de donnée.
*/
public Ticket getTicket(int idticket) throws DAOException {
Connection conn = null;
ResultSet rs = null;
Ticket ticket = null;
String requeteSQL = "";
try {
conn = getConnection();
Statement st = conn.createStatement();
requeteSQL = "select * from ticket where idticket =" + idticket;
rs = st.executeQuery(requeteSQL);
rs.next();
ticket = new Ticket(rs.getInt("idticket"), rs.getInt("idspec"),
rs.getTimestamp("dateheure"), rs.getString("login"),
rs.getInt("idsalle"), rs.getInt("idrang"), rs.getInt("idplace"));
return ticket;
} catch (SQLException e) {
throw new DAOException("Erreur BD" + e.getMessage(), e);
} finally {
closeConnection(conn);
}
}
/**
* Supprime le ticket d'identifiant id dans la table ticket.
*/
public void supprimerTicket(int idticket) throws DAOException {
Connection conn = null;
ResultSet rs = null;
String requeteSQL = "";
try {
conn = getConnection();
Statement st = conn.createStatement();
requeteSQL = "delete * from ticket where idticket = " + idticket;
st.executeQuery(requeteSQL);
} catch (SQLException e) {
throw new DAOException("Erreur BD" + e.getMessage(), e);
} finally {
closeConnection(conn);
}
}
}
| [
"[email protected]"
] | |
c9b52aebb926157b98b5a2aa63bb11c284f559e6 | 87344d5938ff9006d3dc1302ee5cad87920ffda0 | /theSenseless/src/main/java/theSenseless/cards/CardSwitcheroo.java | a3536f1d4881771bc288dac11bcccc919a1b2566 | [
"MIT"
] | permissive | PhoenixStroh/TheSenseless | 7de7bd132d28e62ee5e5f5c756b719272490c56e | c3438960841ef6307661724571b7c3a0161c1561 | refs/heads/master | 2023-08-01T00:44:42.815687 | 2021-09-23T18:33:29 | 2021-09-23T18:33:29 | 399,181,336 | 0 | 1 | MIT | 2021-09-23T01:10:59 | 2021-08-23T16:52:38 | Java | UTF-8 | Java | false | false | 2,269 | java | package theSenseless.cards;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import theSenseless.SenselessMod;
import theSenseless.characters.TheSenseless;
import theSenseless.actions.SwitchDiscardAndDrawAction;
import static com.megacrit.cardcrawl.core.CardCrawlGame.languagePack;
import static theSenseless.SenselessMod.makeCardPath;
// public class ${NAME} extends AbstractDynamicCard
public class CardSwitcheroo extends AbstractDynamicCard {
// TEXT DECLARATION
// public static final String ID = DefaultMod.makeID(${NAME}.class.getSimpleName()); // USE THIS ONE FOR THE TEMPLATE;
public static final String ID = SenselessMod.makeID("CardSwitcheroo"); // DELETE THIS ONE.
public static final String IMG = makeCardPath("Attack.png");// "public static final String IMG = makeCardPath("${NAME}.png");
// This does mean that you will need to have an image with the same NAME as the card in your image folder for it to run correctly.
// /TEXT DECLARATION/
// STAT DECLARATION
private static final CardRarity RARITY = CardRarity.RARE; // Up to you, I like auto-complete on these
private static final CardTarget TARGET = CardTarget.SELF; // since they don't change much.
private static final CardType TYPE = CardType.SKILL; //
public static final CardColor COLOR = TheSenseless.Enums.COLOR_GRAY;
private static final int COST = 2; // COST = ${COST}
// /STAT DECLARATION/
public CardSwitcheroo() { // public ${NAME}() - This one and the one right under the imports are the most important ones, don't forget them
super(ID, IMG, COST, TYPE, COLOR, RARITY, TARGET);
}
// Actions the card should do.
@Override
public void use(AbstractPlayer p, AbstractMonster m) {
AbstractDungeon.actionManager.addToBottom(new SwitchDiscardAndDrawAction());
}
// Upgraded stats.
@Override
public void upgrade() {
if (!upgraded) {
upgradeName();
this.retain = true;
this.rawDescription = languagePack.getCardStrings(ID).UPGRADE_DESCRIPTION;
initializeDescription();
}
}
} | [
"[email protected]"
] | |
1ccfa2705992ef2b4845aa6e2e728b179a70fd84 | e2ea82a83ecd61bce96ef5f2cfb5623f242ac050 | /app/src/main/java/com/stbam/allnews/image/MemoryCache.java | f39e9b08151c407227f518213ced88caee573943 | [] | no_license | stbamb/AllNews | 7994ac93b885afb5a0e1ee1549ccac862da29b71 | 4c2056ec9a0dc2b8510bb5176734df0d86f83e6c | refs/heads/master | 2021-01-19T03:11:37.622569 | 2015-07-01T08:16:24 | 2015-07-01T08:16:24 | 37,898,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,583 | java | package com.stbam.allnews.image;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import android.graphics.Bitmap;
import android.util.Log;
public class MemoryCache {
private static final String TAG = "MemoryCache";
private Map<String, Bitmap> cache = Collections
.synchronizedMap(new LinkedHashMap<String, Bitmap>(10, 1.5f, true));// Last
// argument
// true
// for
// LRU
// ordering
private long size = 0;// current allocated size
private long limit = 1000000;// max memory in bytes
public MemoryCache() {
// use 25% of available heap size
setLimit(Runtime.getRuntime().maxMemory() / 4);
}
public void setLimit(long new_limit) {
limit = new_limit;
Log.i(TAG, "MemoryCache will use up to " + limit / 1024. / 1024. + "MB");
}
public Bitmap get(String id) {
try {
if (!cache.containsKey(id))
return null;
// NullPointerException sometimes happen here
// http://code.google.com/p/osmdroid/issues/detail?id=78
return cache.get(id);
} catch (NullPointerException ex) {
ex.printStackTrace();
return null;
}
}
public void put(String id, Bitmap bitmap) {
try {
if (cache.containsKey(id))
size -= getSizeInBytes(cache.get(id));
cache.put(id, bitmap);
size += getSizeInBytes(bitmap);
checkSize();
} catch (Throwable th) {
th.printStackTrace();
}
}
private void checkSize() {
Log.i(TAG, "cache size=" + size + " length=" + cache.size());
if (size > limit) {
Iterator<Entry<String, Bitmap>> iter = cache.entrySet().iterator();// least
// recently
// accessed
// item
// will
// be
// the
// first
// one
// iterated
while (iter.hasNext()) {
Entry<String, Bitmap> entry = iter.next();
size -= getSizeInBytes(entry.getValue());
iter.remove();
if (size <= limit)
break;
}
Log.i(TAG, "Clean cache. New size " + cache.size());
}
}
public void clear() {
try {
// NullPointerException sometimes happen here
// http://code.google.com/p/osmdroid/issues/detail?id=78
cache.clear();
size = 0;
} catch (NullPointerException ex) {
ex.printStackTrace();
}
}
long getSizeInBytes(Bitmap bitmap) {
if (bitmap == null)
return 0;
return bitmap.getRowBytes() * bitmap.getHeight();
}
} | [
"[email protected]"
] | |
21a42d76f17b37b6dbb7d98812ccee973a074fbc | 3aa8ef76bc9d47fec9909e3dec66481592809cd7 | /backend/src/main/java/com/devsuperior/dslearnbds/services/UserService.java | 41b2aece098396b538dcc0561636815dc560915a | [] | no_license | grubio1995/dslearn | 568cfeea4f5f3071055a888b2caee09fe1fcb53f | 9fb336de79671f33257e7fb66bdcd1b211c16ceb | refs/heads/master | 2023-05-31T12:28:40.588038 | 2021-06-26T22:04:37 | 2021-06-26T22:04:37 | 375,533,315 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,642 | java | package com.devsuperior.dslearnbds.services;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.devsuperior.dslearnbds.dto.UserDTO;
import com.devsuperior.dslearnbds.entities.User;
import com.devsuperior.dslearnbds.repositories.UserRepository;
import com.devsuperior.dslearnbds.services.exceptions.ResourceNotFoundException;
@Service
public class UserService implements UserDetailsService {
private static Logger logger = LoggerFactory.getLogger(UserService.class);
@Autowired
private AuthService authService;
@Autowired
private UserRepository repository;
@Transactional(readOnly = true)
public UserDTO findById(Long id) {
authService.validateSelfOrAdmin(id);
Optional<User> obj = repository.findById(id);
User entity = obj.orElseThrow(() -> new ResourceNotFoundException("Entity not found"));
return new UserDTO(entity);
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
User user = repository.findByEmail(username);
if (user == null) {
logger.error("User not found: " + username);
throw new UsernameNotFoundException("Email not found");
}
logger.info("User found: " + username);
return user;
}
}
| [
"[email protected]"
] | |
46371f293b2e2c301c66c023be39b003c7417031 | e4450d3f9ddd648ec48f62536b3ebdce30ef1a9e | /Assignment4/President.java | 440de07a59665ff3432a512695878f13c39851f2 | [] | no_license | renata-a/CSE_205_git | d368d5ad5ce8cce9d614bdb8ea0243661e0d7f7a | 39259af8dcc660b1f68876491bdc0a8b8b85db0b | refs/heads/master | 2022-11-14T18:33:21.558051 | 2020-07-14T16:06:12 | 2020-07-14T16:06:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,199 | java | // Assignment #: 4
// Name: Madhav Arun Sharma
// StudentID: 1216873476
// Lecture: 4:35 pm M W
public class President
{
//declaring variables
private String firstName, lastName, academicLevel;
//zero-argument constructor
public President()
{
firstName = "?";
lastName = "?";
academicLevel = "?";
}
//first name accessor
public String getFirstName()
{
return firstName;
}
//last name accessor
public String getLastName()
{
return lastName;
}
//academic level accessor
public String getAcademicLevel()
{
return academicLevel;
}
//first name mutator
public void setFirstName(String someFirstName)
{
firstName = someFirstName;
}
//last name mutator
public void setLastName(String someLastName)
{
lastName = someLastName;
}
//academic level mutator
public void setAcademicLevel(String someLevel)
{
academicLevel = someLevel;
}
//toString method
public String toString()
{
return lastName + "," + firstName + "(" + academicLevel + ")";
}
} | [
"[email protected]"
] | |
ee5278845dc61a4e3294312cf42b10a240ef3d9b | 36e314ab68988c7571e31dfddf5100610240931e | /redis/dao/impl/ProvinceDaoImpl.java | 49f5d7f1327617a7ffcd459d27f7127f4f6c0d26 | [] | no_license | dongkunchen/Java | aa9956170e8256dd906356a6daf8ddea3b0f2834 | c9cd5f940ab2d2e1decf6ae4221dab7cd41eb320 | refs/heads/main | 2023-07-11T04:00:21.321180 | 2021-08-15T00:29:23 | 2021-08-15T00:29:23 | 377,652,641 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 723 | java | package tw.dongkun.dao.impl;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import tw.dongkun.dao.ProvinceDao;
import tw.dongkun.domin.Province;
import tw.dongkun.util.JDBCUtils;
import java.util.List;
public class ProvinceDaoImpl implements ProvinceDao {
//1.聲明成員變量 jdbctemplate
private JdbcTemplate template = new JdbcTemplate(JDBCUtils.getDataSource());
@Override
public List<Province> findAll() {
//1.定義sql
String sql = "select * from redisdemo";
//2.執行sql
List<Province> list = template.query(sql, new BeanPropertyRowMapper<Province>(Province.class));
return list;
}
}
| [
"[email protected]"
] | |
71b5145c00e2032cde45d1408e430f64a8476072 | a41dda37ba3eaacf56096e3d1b6e6fad99544128 | /app/src/main/java/com/safety/android/safety/PhotoGallery/PhotoGalleryFragment.java | 42951b0a5d04291731606bb52eb989aedbe874d6 | [] | no_license | wangjiabc/Safety | 9d07cfee8581cc6d24d19e3d949f5f6942bde463 | 066f516586c2879c7787da106f5afee507dae423 | refs/heads/master | 2022-04-20T22:03:48.703990 | 2020-04-07T13:50:52 | 2020-04-07T13:50:52 | 105,535,073 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,636 | java | package com.safety.android.safety.PhotoGallery;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.ImageView;
import com.safety.android.safety.R;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.List;
public class PhotoGalleryFragment extends Fragment {
private static final String TAG = "PhotoGalleryFragment";
private RecyclerView mPhotoRecyclerView;
private List<GalleryItem> mItems = new ArrayList<>();
public static PhotoGalleryFragment newInstance() {
return new PhotoGalleryFragment();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
new FetchItemsTask().execute();
Log.i(TAG,"Background thread started");
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_photo_gallery, container, false);
mPhotoRecyclerView = (RecyclerView) v
.findViewById(R.id.fragment_photo_gallery_recycler_view);
updatePhotoView();
return v;
}
@Override
public void onDestroyView(){
super.onDestroyView();
}
@Override
public void onDestroy(){
super.onDestroy();
}
private void setupAdapter() {
if (isAdded()) {
mPhotoRecyclerView.setAdapter(new PhotoAdapter(mItems));
}
}
private class PhotoHolder extends RecyclerView.ViewHolder {
private ImageView mItemImageView;
public PhotoHolder(View itemView) {
super(itemView);
mItemImageView = (ImageView) itemView.findViewById(R.id.fragment_photo_gallery_image_view);
}
public void bindDrawable(Drawable drawable){
mItemImageView.setImageDrawable(drawable);
}
}
private class PhotoAdapter extends RecyclerView.Adapter<PhotoHolder> {
private List<GalleryItem> mGalleryItems;
public PhotoAdapter(List<GalleryItem> galleryItems) {
mGalleryItems = galleryItems;
}
@Override
public PhotoHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
LayoutInflater inflater= LayoutInflater.from(getActivity());
View view=inflater.inflate(R.layout.gallery_item,viewGroup,false);
return new PhotoHolder(view);
}
@Override
public void onBindViewHolder(PhotoHolder photoHolder, int position) {
GalleryItem galleryItem = mGalleryItems.get(position);
Drawable placeholder=getResources().getDrawable(R.drawable.ic_menu_gallery);
photoHolder.bindDrawable(placeholder);
Picasso.with(getActivity()).load(galleryItem.getUrl()).placeholder(placeholder).error(R.mipmap.ic_launcher).into(photoHolder.mItemImageView);
}
@Override
public int getItemCount() {
return mGalleryItems.size();
}
}
private void updatePhotoView(){
ViewTreeObserver observer=mPhotoRecyclerView.getViewTreeObserver();
observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
int w,h;
@Override
public void onGlobalLayout() {
mPhotoRecyclerView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
w=mPhotoRecyclerView.getMeasuredWidth();
h=mPhotoRecyclerView.getMeasuredHeight();
if(w/h>=2){
mPhotoRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(),5));
}else {
mPhotoRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 3));
}
}
});
}
private class FetchItemsTask extends AsyncTask<Void,Void,List<GalleryItem>> {
@Override
protected List<GalleryItem> doInBackground(Void... params) {
return new FlickrFetchr().fetchItems();
}
@Override
protected void onPostExecute(List<GalleryItem> items) {
mItems = items;
setupAdapter();
}
}
}
| [
"[email protected]"
] | |
49f6ab50886a438dde2a2ba3862d6e4b139a24c2 | 83e6bca02a563bff312f06ccfab4973681ad4dd1 | /ProyectoMovil/app/src/main/java/com/example/android/proyectomovil/WordListAdapter.java | 7879836d7f0ad48d2111012c173986d0734ce575 | [] | no_license | arkaland/ProyectoAndroidStudio | c9d0da01907ffc49cb0d56c89942b3ed852bfe85 | 6882bd4920e08142b5f6ba98a06ab1555134b392 | refs/heads/master | 2020-05-26T05:07:17.259862 | 2019-05-31T21:39:26 | 2019-05-31T21:39:26 | 188,116,710 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,752 | java | package com.example.android.proyectomovil;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
public class WordListAdapter extends RecyclerView.Adapter<WordListAdapter.WordViewHolder> {
class WordViewHolder extends RecyclerView.ViewHolder {
private final TextView wordItemView;
private WordViewHolder(View itemView) {
super(itemView);
wordItemView = itemView.findViewById(R.id.textView);
}
}
private final LayoutInflater mInflater;
private List<Word> mWords;
WordListAdapter(Context context) {
mInflater = LayoutInflater.from(context);
}
@Override
public WordViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = mInflater.inflate(R.layout.recyclerview_item, parent, false);
return new WordViewHolder(itemView);
}
@Override
public void onBindViewHolder(WordViewHolder holder, int position) {
Word current = mWords.get(position);
holder.wordItemView.setText(current.getWord());
}
void setWords(List<Word> words) {
mWords = words;
notifyDataSetChanged();
}
@Override
public int getItemCount() {
if (mWords != null)
return mWords.size();
else return 0;
}
//IMPLANTACION DEL SWIPE PARA BORRAR ARTICULOS
public Word getWordAtPosition (int position) {
return mWords.get(position);
}
}
| [
"[email protected]"
] | |
fd171732aa0e5581253fc5d7d871d01627109eeb | dcfa87bffa8cc75e7b08fc884984c3d5d6924bcb | /src/test/java/br/mp/mpf/simpletests/testes/aceitacao/LoginPage.java | 820e31fc54c2cbbc02759f0d479a1001643496bd | [] | no_license | Adilza/simple-tests-modified | 2b456b9854c34fb96bf6d083efd945a85668dff1 | 7ca6a86d4391d682c65fbbd575952d14f9064d1c | refs/heads/master | 2020-04-28T12:54:31.450796 | 2016-08-25T04:06:30 | 2016-08-25T04:06:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 634 | java | package br.mp.mpf.simpletests.testes.aceitacao;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class LoginPage {
private WebDriver driver;
public LoginPage(WebDriver driver) {
this.driver = driver;
}
public LoginPage visita(String url) {
driver.get(url);
return this;
}
public ListaProjetosPage autentica(String usuario, String senha) {
driver.findElement(By.name("username")).sendKeys(usuario);
driver.findElement(By.name("password")).sendKeys(senha);
driver.findElement(By.cssSelector("input[type='submit'")).click();
return new ListaProjetosPage(driver);
}
}
| [
"[email protected]"
] | |
9c31977c12e1a2ee4fdeebe90253651d233187c1 | 5657c45bc746e7252fa1dab5bbd7c5e29c227fd8 | /mGAP/src/org/labkey/mgap/mGapUpgradeCode.java | 9e635493d19c29135cf0f705ab8197422ab50075 | [] | no_license | bimberlabinternal/BimberLabKeyModules | e1cef7f2e77cfa331a96ba353bef47d682fccf74 | 28c6bdc863529ff904a339052f77d4ae7b9d2f31 | refs/heads/discvr-23.7 | 2023-08-17T02:38:42.535524 | 2023-08-16T18:19:27 | 2023-08-16T18:19:27 | 176,779,407 | 0 | 3 | null | 2023-09-05T10:10:21 | 2019-03-20T16:59:15 | CSS | UTF-8 | Java | false | false | 4,211 | java | package org.labkey.mgap;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.labkey.api.data.Container;
import org.labkey.api.data.DeferredUpgrade;
import org.labkey.api.data.TableSelector;
import org.labkey.api.data.UpgradeCode;
import org.labkey.api.exp.api.ExpData;
import org.labkey.api.exp.api.ExperimentService;
import org.labkey.api.module.ModuleContext;
import org.labkey.api.pipeline.PipeRoot;
import org.labkey.api.pipeline.PipelineService;
import org.labkey.api.query.FieldKey;
import org.labkey.api.query.QueryService;
import org.labkey.api.security.User;
import org.labkey.api.util.PageFlowUtil;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.List;
public class mGapUpgradeCode implements UpgradeCode
{
private static final Logger _log = LogManager.getLogger(mGapUpgradeCode.class);
/** called at 16.60-16.61*/
@SuppressWarnings({"UnusedDeclaration"})
@DeferredUpgrade
public void migrateReleaseDirs(final ModuleContext moduleContext)
{
if (moduleContext.isNewInstall())
return;
Container c = mGAPManager.get().getMGapContainer();
if (c == null)
{
return;
}
final PipeRoot pr = PipelineService.get().getPipelineRootSetting(c);
if (!pr.getRootPath().exists())
{
return;
}
final File baseDir = new File(pr.getRootPath(), mGAPManager.DATA_DIR_NAME);
if (!baseDir.exists())
{
return;
}
User u = moduleContext.getUpgradeUser();
new TableSelector(QueryService.get().getUserSchema(u, c, mGAPSchema.NAME).getTable(mGAPSchema.TABLE_VARIANT_CATALOG_RELEASES), PageFlowUtil.set("objectid")).forEachResults(rs -> {
migrateRelease(c, u, rs.getString(FieldKey.fromString("objectid")), pr, baseDir);
});
}
private void migrateRelease(Container c, User u, String releaseId, PipeRoot pr, File baseDir)
{
_log.info("Migrating release: " + releaseId);
File previousDir = new File(pr.getRootPath(), releaseId);
File newLocation = new File(baseDir, releaseId);
if (!previousDir.exists())
{
_log.error("Missing release folder, cannot move directory: " + previousDir.getPath());
}
else if (newLocation.exists())
{
_log.error("Destination exists, cannot move mGAP release to: " + newLocation.getPath());
return;
}
else
{
_log.info("Moving folder: " + previousDir.getPath());
try
{
Files.move(previousDir.toPath(), newLocation.toPath());
}
catch (IOException e)
{
_log.error("Unable to move directory: " + previousDir.getPath(), e);
return;
}
}
// Now update any ExpDatas:
List<? extends ExpData> datas = ExperimentService.get().getExpDatasUnderPath(previousDir, c);
_log.info("Updating " + datas.size() + " expDatas for folder: " + previousDir.getPath());
for (ExpData d : datas)
{
File oldFile = d.getFile();
if (oldFile == null)
{
continue;
}
// Already pointing to the expected location:
if (oldFile.getPath().contains("/" + mGAPManager.DATA_DIR_NAME + "/"))
{
_log.info("has already been migrated, skipping: " + oldFile.getPath());
continue;
}
if (oldFile.exists())
{
_log.error("Expected old file to have been moved, but it exists: " + oldFile.getPath());
}
File newFile = new File(oldFile.getPath().replace("@files/", "@files/" + mGAPManager.DATA_DIR_NAME + "/"));
if (!newFile.exists())
{
_log.error("Unable to find moved mGAP file: " + d.getRowId() + ", " + newFile.getPath());
}
else
{
d.setDataFileURI(newFile.toURI());
d.save(u);
}
}
}
}
| [
"[email protected]"
] | |
53fc8098a6ab4d0d4fe8c4eb73da1f25a8a8771f | fa0c32e18262897f5ba558950c2a7d33665ae97c | /driver-ignite/src/main/java/io/sbk/Ignite/Ignite.java | bb57ced73a79ed82f9f0c1c1f70b9d427d8e1c63 | [
"Apache-2.0"
] | permissive | sanjaynv/SBK | 8634d35fe6268030af8f6b062152468133801041 | 64655cd18e999f6274d738f8e421a66473d490f2 | refs/heads/master | 2023-07-06T00:09:27.984821 | 2023-06-19T13:52:02 | 2023-06-19T13:52:02 | 247,745,359 | 2 | 0 | Apache-2.0 | 2020-03-16T15:25:08 | 2020-03-16T15:25:08 | null | UTF-8 | Java | false | false | 6,032 | java | /**
* Copyright (c) KMG. 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
*/
package io.sbk.Ignite;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.javaprop.JavaPropsFactory;
import io.sbk.api.DataReader;
import io.sbk.api.DataWriter;
import io.sbk.params.ParameterOptions;
import io.sbk.api.Storage;
import io.sbk.params.InputOptions;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.Ignition;
import org.apache.ignite.client.ClientCache;
import org.apache.ignite.client.IgniteClient;
import org.apache.ignite.configuration.ClientConfiguration;
import java.io.IOException;
import java.util.Objects;
/**
* Class for Ignite Benchmarking.
*/
public class Ignite implements Storage<byte[]> {
private final static String CONFIGFILE = "sbk-ignite.properties";
private IgniteConfig config;
private IgniteCache<Long, byte[]> cache;
private ClientCache<Long, byte[]> clientCache;
private IgniteClient igniteClient;
private org.apache.ignite.Ignite ignite;
public static long generateStartKey(int id) {
return (long) id * (long) Integer.MAX_VALUE;
}
@Override
public void addArgs(final InputOptions params) throws IllegalArgumentException {
final ObjectMapper mapper = new ObjectMapper(new JavaPropsFactory())
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
try {
config = mapper.readValue(Objects.requireNonNull(Ignite.class.getClassLoader().getResourceAsStream(CONFIGFILE)),
IgniteConfig.class);
} catch (Exception ex) {
ex.printStackTrace();
throw new IllegalArgumentException(ex);
}
params.addOption("url", true, "server address, default : " + config.url);
params.addOption("cfile", true, "cluster file");
params.addOption("cache", true, "cache name, default : " + config.cacheName);
params.addOption("client", true, "client mode, default: " + config.isClient);
}
@Override
public void parseArgs(final ParameterOptions params) throws IllegalArgumentException {
config.url = params.getOptionValue("url", config.url);
config.cacheName = params.getOptionValue("cache", config.cacheName);
if (params.hasOptionValue("cfile")) {
config.cFile = params.getOptionValue("cfile", config.cFile);
} else {
config.cFile = null;
}
config.isClient = Boolean.parseBoolean(params.getOptionValue("client", Boolean.toString(config.isClient)));
}
@Override
public void openStorage(final ParameterOptions params) throws IOException {
if (config.isClient) {
ClientConfiguration cfg = new ClientConfiguration().setAddresses(config.url);
igniteClient = Ignition.startClient(cfg);
clientCache = igniteClient.getOrCreateCache(config.cacheName);
ignite = null;
cache = null;
if (params.getWritersCount() > 0) {
clientCache.clear();
}
} else {
if (config.cFile != null) {
ignite = Ignition.start(config.cFile);
} else {
ignite = Ignition.start();
}
igniteClient = null;
clientCache = null;
if (params.getWritersCount() > 0) {
cache = ignite.getOrCreateCache(config.cacheName);
cache.destroy();
cache.close();
}
}
}
@Override
public void closeStorage(final ParameterOptions params) throws IOException {
if (ignite != null) {
ignite.close();
}
if (igniteClient != null) {
try {
igniteClient.close();
} catch (Exception ex) {
throw new IOException(ex);
}
}
}
@Override
public DataWriter<byte[]> createWriter(final int id, final ParameterOptions params) {
try {
if (config.isClient) {
if (params.getRecordsPerSync() < Integer.MAX_VALUE && params.getRecordsPerSync() > 1) {
return new IgniteClientTransactionWriter(id, params, clientCache, igniteClient);
} else {
return new IgniteClientWriter(id, params, clientCache);
}
} else {
if (params.getRecordsPerSync() < Integer.MAX_VALUE && params.getRecordsPerSync() > 1) {
return new IgniteTransactionWriter(id, params, cache, ignite);
} else {
return new IgniteWriter(id, params, ignite, config);
}
}
} catch (IOException ex) {
ex.printStackTrace();
return null;
}
}
@Override
public DataReader<byte[]> createReader(final int id, final ParameterOptions params) {
try {
if (config.isClient) {
if (params.getRecordsPerSync() < Integer.MAX_VALUE && params.getRecordsPerSync() > 1) {
return new IgniteClientTransactionReader(id, params, clientCache, igniteClient);
} else {
return new IgniteClientReader(id, params, clientCache);
}
} else {
if (params.getRecordsPerSync() < Integer.MAX_VALUE && params.getRecordsPerSync() > 1) {
return new IgniteTransactionReader(id, params, cache, ignite);
} else {
return new IgniteReader(id, params, ignite, config);
}
}
} catch (IOException ex) {
ex.printStackTrace();
return null;
}
}
}
| [
"[email protected]"
] | |
7ca874296948ec67b67aff1a88e429693eb22519 | 41d18182dcb0ef209aeb5ec12f42c7ffda068f77 | /IntentPutExtra/app/src/test/java/com/application/intentputextra/ExampleUnitTest.java | bc7516cea1280683373b5614c649f2a68b413c98 | [] | no_license | MFadlulHafiizh/pwpb | 81fe17ce7259156e96a62afccce927d93f49b36f | 076f8376ea309701d042765444ecdb42e0dcdec2 | refs/heads/master | 2023-03-18T08:07:59.384849 | 2021-03-09T13:44:18 | 2021-03-09T13:44:18 | 285,713,401 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package com.application.intentputextra;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
3d8f116a86f04ce1f231d67f297ecbe3c62dc040 | 77c68976f8af22f5edbff942c007198d7dd295d0 | /try_catch_practice/src/try_catch_practice/Bonus8.java | 358f4554fedffd2fd369fbde6ef82ab1dc9a3547 | [] | no_license | Dennis055/JavaHW | 92b655e4077182abd37ce4d71ad1bcba50756f6a | 904bdd226dded3d9341fed11390793327dc1cd65 | refs/heads/master | 2020-04-03T14:34:43.704064 | 2019-01-09T14:45:22 | 2019-01-09T14:45:22 | 155,326,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,788 | java | package try_catch_practice;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;
import javax.print.attribute.standard.Sides;
public class Bonus8 {
private static ArrayList<ArrayList<Integer>> totalStudents = new ArrayList<>();
public static void main(String[]args) {
Scanner scanner = new Scanner(System.in);
System.out.println("請輸入有幾位同學");
while(scanner.hasNextLine()) {
System.out.println("請輸入小考次數");
int students = scanner.nextInt();
int quiz_times = scanner.nextInt();
statStudent(students, quiz_times);
showResult(totalStudents);
break;
}
scanner.close();
}
public static void statStudent(int students , int quiz_times) {
for(int i =1;i<students+1;i++) {
ArrayList<Integer>gradelist = new ArrayList<>();
for(int j =1;j<quiz_times+1;j++) {
System.out.println("請輸入第" + i + "位同學第" +j +"次小考成績。");
Scanner scanner = new Scanner(System.in);
int each_grade = scanner.nextInt();
gradelist.add(each_grade);
}
totalStudents.add(gradelist);
}
}
public static double calculateNeeded(ArrayList<Integer>gradelist) {
int sum =0;
for(int i =0;i<gradelist.size();i++) {
int grade = gradelist.get(i);
sum += grade;
}
double average = sum / gradelist.size();
return average;
}
public static void showResult(ArrayList<ArrayList<Integer>>total) {
for(int i =1;i<total.size() + 1;i++) {
String grade = "";
ArrayList<Integer> gradelist = total.get(i-1);
for(int j = 0;j<gradelist.size();j++) {
grade += gradelist.get(j) + " "; //collect grade
}
String message = "第"+i+"位 " +grade + "AVG=" + calculateNeeded(gradelist);
System.out.println(message);
}
}
}
| [
"[email protected]"
] | |
8d504de41715e4000ddbc3b05effdfa9af61ada5 | 94f59761aae8a465a4eccd3577416e26a518fe24 | /DeviceManagement/src/java/khangtl/controllers/ChangeRoomController.java | 3107f962c0cd03b8b036b44d63b3e668d7a85ddf | [] | no_license | kang-de-conqueror/PRJ321 | 3c07396de7db188d6dbf3e8a9a0286af10ddf23a | 99ab0bcd1ecd7d9a8f1dcbb96323f34affc1c004 | refs/heads/master | 2023-02-16T19:04:39.990676 | 2021-01-09T04:17:18 | 2021-01-09T04:17:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,303 | 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 khangtl.controllers;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import khangtl.daos.DevicesRoomsDAO;
/**
*
* @author Peter
*/
public class ChangeRoomController extends HttpServlet {
private static final String ERROR = "SearchController";
private static final String SUCCESS = "addChangeDeviceRoom.jsp";
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
String url = ERROR;
try {
String id = request.getParameter("DeviceID");
DevicesRoomsDAO dao = new DevicesRoomsDAO();
int currentRoom = dao.getCurrentRoom(Integer.parseInt(id));
if (currentRoom == -1) {
String role = (String) request.getSession().getAttribute("UserRole");
if (role.equals("staff")) {
request.setAttribute("ERROR", "This device haven't had room yet, you cannot change");
} else if (role.equals("admin")) {
url = SUCCESS;
request.setAttribute("DeviceID", id);
request.setAttribute("CurrentRoom", currentRoom);
}
} else {
url = SUCCESS;
request.setAttribute("DeviceID", id);
request.setAttribute("CurrentRoom", currentRoom);
}
} catch (Exception e) {
log("Error at HistoryDeviceController: " + e.getMessage());
} finally {
request.getRequestDispatcher(url).forward(request, response);
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"[email protected]"
] | |
f65a7c9a6bc4a085948decc1ee14656e3ae050ea | 96c5b9de60adb63902c711bfec50d8b15be9f562 | /src/main/java/com/attendanceapp/activities/ShowLocationOnMapActivity.java | 8c1bfd640bfb086eb3b368dae34f0bfbd437da22 | [] | no_license | virendrakachhi/RemiderApp | 4479dd7e9db20b62b683460992047974db9e5816 | 13db492e1c70a91b8428b38bd2361f56354f8118 | refs/heads/master | 2021-08-31T17:32:38.279643 | 2017-12-22T07:35:52 | 2017-12-22T07:35:52 | 115,089,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,670 | java | package com.attendanceapp.activities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Toast;
import com.attendanceapp.R;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class ShowLocationOnMapActivity extends FragmentActivity implements OnMapReadyCallback {
public static final String EXTRA_LAT = "EXTRA_LAT";
public static final String EXTRA_LNG = "EXTRA_LNG";
public static final String EXTRA_TITLE = "EXTRA_TITLE";
private double latitude, longitude;
private String title = "";
// private static final String PLACES_API_BASE = "https://maps.googleapis.com/maps/api/place";
// private static final String TYPE_AUTOCOMPLETE = "/autocomplete";
// private static final String OUT_JSON = "/json";
// private static final String API_KEY = "AIzaSyCo-jx1ybX5ZqNzwYht2BNROJDhQu27P5I";
// Google Map
private GoogleMap googleMap;
MarkerOptions markerOptions;
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show_location_on_map);
Intent intent = getIntent();
latitude = intent.getDoubleExtra(EXTRA_LAT, 0);
longitude = intent.getDoubleExtra(EXTRA_LNG, 0);
title = intent.getStringExtra(EXTRA_TITLE);
}
@Override
public void onMapReady(GoogleMap map) {
// Add a marker in Sydney, Australia, and move the camera.
LatLng sydney = new LatLng(latitude, longitude);
map.addMarker(new MarkerOptions().position(sydney).title(title));
map.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
/**
* function to load map. If map is not created it will create it for you
*/
private void initializeMap() {
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
// check if map is created successfully or not
if (googleMap == null) {
Toast.makeText(getApplicationContext(), "Sorry! unable to create maps", Toast.LENGTH_SHORT).show();
return;
}
googleMap.setMyLocationEnabled(true);
googleMap.getUiSettings().setZoomControlsEnabled(true);
googleMap.getUiSettings().setZoomGesturesEnabled(true);
googleMap.getUiSettings().setMyLocationButtonEnabled(false);
googleMap.getUiSettings().setCompassEnabled(false);
// CameraUpdate center= CameraUpdateFactory.newLatLng(coordinate);
// CameraUpdate zoom=CameraUpdateFactory.zoomTo(15);
// googleMap.moveCamera(center);
// googleMap.animateCamera(zoom);
LatLng markerLoc = new LatLng(latitude, longitude);
final CameraPosition cameraPosition = new CameraPosition.Builder().target(markerLoc).zoom(16).bearing(0).tilt(30).build();
googleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
}
}
| [
"[email protected]"
] | |
77a86ad63d5b1de15ce178b762324f7ac9881654 | 838809404be77b875a450e3df56f0385e3316a94 | /source code/java-pattern/src/main/java/com.testeverything.pattern/singleton/Singleton.java | ba671153f334a85ecf4bd93f421855b925010e56 | [
"Apache-2.0"
] | permissive | ljssoftware/TestEverything | ea0a3d173d7ea67a2e2e7a496ee8151d20d1782d | c529092323c1fb84f275c8927ddc8a00cbd59e5d | refs/heads/master | 2020-12-24T13:35:47.916756 | 2014-08-12T08:31:32 | 2014-08-12T08:31:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 399 | java | package com.testeverything.pattern.singleton;
/**
* 单例 的类
* Created by lijinsheng on 14-8-12.
*/
public class Singleton {
private static Singleton instance;
public Singleton() {
}
public static Singleton getInstance() {
if (instance != null) {
return instance;
}
instance = new Singleton();
return instance;
}
}
| [
"[email protected]"
] | |
0796bfd80f6096e184002858455639de2dac5171 | c2c82f17c45cc2a9f77e36d5f72bb83cd90c4b60 | /heritrix2/commons/src/main/java/org/archive/util/Transform.java | 99f8c91c9756f3a439943079f7aa3dca375441b6 | [] | no_license | yuanfayang/heritrix | 12a69cd29ba3229cce9522b58eaaa30ea1ea3b75 | c9bdcc7df617431ca7a40ee2ad9891d55856728e | refs/heads/master | 2021-05-10T15:21:54.639985 | 2012-01-11T22:46:33 | 2012-01-11T22:46:33 | 118,537,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,035 | java | /* Transform
*
* $Id$
*
* Created on September 26, 2006
*
* Copyright (C) 2006 Internet Archive.
*
* This file is part of the Heritrix web crawler (crawler.archive.org).
*
* Heritrix is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* any later version.
*
* Heritrix is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser Public License for more details.
*
* You should have received a copy of the GNU Lesser Public License
* along with Heritrix; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.archive.util;
import java.util.AbstractCollection;
import java.util.Collection;
import java.util.Iterator;
/**
* A transformation of a collection. The elements in the transform are based
* on the elements of some other collection; the original collection's
* elements are transformed using a specified transformer. Changes to the
* original collection are automatically reflected in the transform and
* vice-versa.
*
* <p>If the transformer returns null for a given original object, then that
* object will not be included in the transform. Thus the transform might
* be smaller than the original collection. Note that Transform instances
* can never contain the null element.
*
* <p>This collection implementation does not support the optional add
* operation.
*
* @author pjack
*
* @param <Original> the type of the original elements in the collection
* @param <Transformed> the type of the tranformed elements
*/
public class Transform<Original,Transformed>
extends AbstractCollection<Transformed> {
/** The original collection. */
final private Collection<? extends Original> delegate;
/** Transforms the original objects. */
final private Transformer<Original,Transformed> transformer;
/**
* Constructor.
*
* @param delegate The collection whose elements to transform.
* @param transformer Transforms the elements
*/
public Transform(Collection<? extends Original> delegate,
Transformer<Original,Transformed> transformer) {
this.delegate = delegate;
this.transformer = transformer;
}
public int size() {
int count = 0;
Iterator<Transformed> iter = iterator();
while (iter.hasNext()) {
iter.next();
count++;
}
return count;
}
public Iterator<Transformed> iterator() {
return new TransformIterator<Original,Transformed>(
delegate.iterator(), transformer);
}
/**
* Returns a transform containing only objects of a given class.
*
* @param <Target> the target class
* @param c the collection to transform
* @param cls the class of objects to return
* @return a collection containing only objects of class cls
*/
public static <Target> Collection<Target> subclasses(
Collection<? extends Object> c,
final Class<Target> cls) {
Transformer<Object,Target> t = new Transformer<Object,Target>() {
public Target transform(Object s) {
if (cls.isInstance(s)) {
return cls.cast(s);
} else {
return null;
}
}
};
return new Transform<Object,Target>(c, t);
}
}
class TransformIterator<Original,Transformed> implements Iterator<Transformed> {
final private Iterator<? extends Original> iterator;
final private Transformer<Original,Transformed> transformer;
private Transformed next;
public TransformIterator(Iterator<? extends Original> iterator,
Transformer<Original,Transformed> transformer) {
this.iterator = iterator;
this.transformer = transformer;
}
public boolean hasNext() {
if (next != null) {
return true;
}
while (iterator.hasNext()) {
Original o = iterator.next();
next = transformer.transform(o);
if (next != null) {
return true;
}
}
return false;
}
public Transformed next() {
if (!hasNext()) {
throw new IllegalStateException();
}
Transformed r = next;
next = null;
return r;
}
// FIXME: this can break standard Iterator contract, for example
// transformIterator.next();
// if(transformIterator.hasNext()) {
// transformIterator.remove();
// }
// usual iterator contract is to remove the last object returned
// by next; in this case the subsequent
public void remove() {
iterator.remove();
}
}
| [
"Gojomo@daa5b2f2-a927-0410-8b2d-f5f262fa301a"
] | Gojomo@daa5b2f2-a927-0410-8b2d-f5f262fa301a |
40f572989afa48b47516f65d0be6cd89649fc033 | ac94ac4e2dca6cbb698043cef6759e328c2fe620 | /apis/cloudstack/src/test/java/org/jclouds/cloudstack/parse/DeleteNetworkResponseTest.java | 5c2c50b0c09bf2582f139962abc3057d4684e242 | [
"Apache-2.0"
] | permissive | andreisavu/jclouds | 25c528426c8144d330b07f4b646aa3b47d0b3d17 | 34d9d05eca1ed9ea86a6977c132665d092835364 | refs/heads/master | 2021-01-21T00:04:41.914525 | 2012-11-13T18:11:04 | 2012-11-13T18:11:04 | 2,503,585 | 2 | 0 | null | 2012-10-16T21:03:12 | 2011-10-03T09:11:27 | Java | UTF-8 | Java | false | false | 1,324 | java | /**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds 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.jclouds.cloudstack.parse;
import org.jclouds.json.BaseItemParserTest;
import org.jclouds.rest.annotations.SelectJson;
import org.testng.annotations.Test;
/**
*
* @author Adrian Cole
*/
@Test(groups = "unit", testName = "DeleteNetworkResponseTest")
public class DeleteNetworkResponseTest extends BaseItemParserTest<Long> {
@Override
public String resource() {
return "/deletenetworkresponse.json";
}
@Override
@SelectJson("jobid")
public Long expected() {
return 45612l;
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.