blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
efb36c12b864d10ee8fde58e147b8fb0e59acf9f
5e263da895bfd21e16d3326ff267e5746d4791b9
/core/src/main/java/com/github/zwg/core/command/handler/SearchMethodCommandHandler.java
43911e8153cbf3184bc30a96665f2df4c3dec36d
[ "Apache-2.0" ]
permissive
zhawengan/jvm-enhance-monitor
f793837624caa1db8eb2548e56272fd0d0fbf8f3
4dfe690ec13486ea7a76d6eb341696b7cca703e9
refs/heads/master
2023-08-11T01:09:41.279647
2021-09-28T12:05:32
2021-09-28T12:05:32
401,278,756
0
0
null
null
null
null
UTF-8
Java
false
false
4,664
java
package com.github.zwg.core.command.handler; import static com.github.zwg.core.util.ClassUtil.tranModifier; import static org.apache.commons.lang3.StringUtils.EMPTY; import com.github.zwg.core.annotation.Arg; import com.github.zwg.core.annotation.Cmd; import com.github.zwg.core.command.CommandHandler; import com.github.zwg.core.command.ParamConstant; import com.github.zwg.core.manager.JemMethod; import com.github.zwg.core.manager.MatchStrategy; import com.github.zwg.core.manager.MethodMatcher; import com.github.zwg.core.manager.ReflectClassManager; import com.github.zwg.core.manager.SearchMatcher; import com.github.zwg.core.netty.MessageUtil; import com.github.zwg.core.session.Session; import java.lang.annotation.Annotation; import java.lang.instrument.Instrumentation; import java.lang.reflect.Method; import java.util.Collection; import java.util.HashMap; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * @author zwg * @version 1.0 * @date 2021/8/31 */ @Cmd(name = ParamConstant.COMMAND_SEARCH_METHOD) public class SearchMethodCommandHandler implements CommandHandler { private final Logger logger = LoggerFactory.getLogger(SearchMethodCommandHandler.class); @Arg(name = ParamConstant.CLASS_KEY, description = "find class expression") private String classPattern; @Arg(name = ParamConstant.METHOD_KEY, description = "find method expression") private String methodPattern; @Arg(name = ParamConstant.METHOD_DESC, required = false, defaultValue = "*", description = "method description expression") private String methodDesc; @Arg(name = ParamConstant.REG_KEY, required = false, defaultValue = "WILDCARD", description = "expression matching rules: wildcard, regular, equal") private String strategy; @Override public void execute(Session session, Instrumentation inst) { SearchMatcher classMatcher = new SearchMatcher(MatchStrategy.valueOf(strategy), classPattern); JemMethod jemMethod = new JemMethod(methodPattern, methodDesc); MethodMatcher methodMatcher = new MethodMatcher(jemMethod); //2、查询匹配的类 Collection<Method> methods = ReflectClassManager.getInstance() .searchClassMethod(classMatcher, methodMatcher); //3、打印类信息 Map<String, Object> methodInfos = getMethodInfos(methods); logger.info("get method info by classPattern:{},methodPattern:{},:{}", classPattern, methodPattern, methodInfos); session.sendCompleteMessage(MessageUtil.buildResponse(methodInfos)); } public Map<String, Object> getMethodInfos(Collection<Method> methods) { Map<String, Object> methodInfos = new HashMap<>(); for (Method method : methods) { Map<String, Object> data = new HashMap<>(); data.put("method", method.getName()); data.put("declaring-class", method.getDeclaringClass()); data.put("modifier", tranModifier(method.getModifiers())); data.put("annotation", getAnnotations(method)); data.put("parameters", getParameters(method)); data.put("return", method.getReturnType().getName()); data.put("exceptions", getExceptions(method)); methodInfos.put(String.valueOf(method.hashCode()), data); } return methodInfos; } private String getAnnotations(Method method) { final StringBuilder annotationSB = new StringBuilder(); final Annotation[] annotationArray = method.getDeclaredAnnotations(); if (annotationArray.length > 0) { for (Annotation annotation : annotationArray) { annotationSB.append(annotation.annotationType().getName()).append(","); } annotationSB.deleteCharAt(annotationSB.length() - 1); } else { annotationSB.append(EMPTY); } return annotationSB.toString(); } private String getParameters(Method method) { final StringBuilder paramsSB = new StringBuilder(); final Class<?>[] paramTypes = method.getParameterTypes(); for (Class<?> clazz : paramTypes) { paramsSB.append(clazz.getName()).append(";"); } return paramsSB.toString(); } private String getExceptions(Method method) { final StringBuilder exceptionSB = new StringBuilder(); final Class<?>[] exceptionTypes = method.getExceptionTypes(); for (Class<?> clazz : exceptionTypes) { exceptionSB.append(clazz.getName()).append("\n"); } return exceptionSB.toString(); } }
[ "zhawengan@rcplatformhk.com" ]
zhawengan@rcplatformhk.com
8519b3fd035a09bbf99b65186467eb05306e58d7
394e2cb5da4bca8e896ca25d189a91dcb8f0488d
/src/main/java/net/betaengine/immutableunion/Sets.java
6a70f7ffab42927ac1e02d33889ce8967aeddd42
[]
no_license
george-hawkins/algoviewer
45db3c2a4fe40417a757717c5f3c3c0f29d0e1a8
c3e76895b76fbc9ab714e4311da4ee47c6b68019
refs/heads/master
2021-01-17T16:10:07.521697
2016-07-13T19:27:47
2016-07-13T19:27:47
63,271,734
0
0
null
null
null
null
UTF-8
Java
false
false
3,222
java
package net.betaengine.immutableunion; import java.util.List; import java.util.function.Supplier; import com.google.common.collect.ImmutableList; import net.betaengine.algoviewer.Pusher; public class Sets { public interface Set { Set union(Set that); Set incl(int elem); List<Set> getChildren(); String getName(); } public static Set createEmptySet() { return new EmptySet(); } private static class EmptySet implements Set { @Override public Set union(final Set that) { return push(this, () -> that, UNION_METHOD); } @Override public Set incl(final int elem) { return push(this, () -> new NonEmptySet(elem, new EmptySet(), new EmptySet()), INCL_METHOD); } @Override public List<Set> getChildren() { return ImmutableList.of(); } @Override public String toString() { return "."; } @Override public String getName() { return toString(); } } private static class NonEmptySet implements Set { private final int elem; private final Set left; private final Set right; // TODO: should be package private so only NonEmptySet and EmptySet can access it. public NonEmptySet(final int elem, final Set left, final Set right) { this.elem = elem; this.left = left; this.right = right; } @Override public Set union(final Set that) { return push(this, () -> { final Set leftUnion = left.union(that); final Set childrenUnion = right.union(leftUnion); final Set result = childrenUnion.incl(elem); return result; }, UNION_METHOD); } @Override public Set incl(final int x) { return push(this, () -> { final Set result; if (x < elem) { result = new NonEmptySet(elem, left.incl(x), right); } else if (x > elem) { result = new NonEmptySet(elem, left, right.incl(x)); } else { result = this; } return result; }, INCL_METHOD); } @Override public List<Set> getChildren() { return ImmutableList.of(left, right); } @Override public String toString() { return "{" + left + elem + right + "}"; } @Override public String getName() { return Integer.toString(elem); } } // ----------------------------------------------------------------- private final static String UNION_METHOD = "union"; private final static String INCL_METHOD = "incl"; private static Pusher pusher; private static <T> T push(Object source, Supplier<T> s, String methodName) { return pusher.push(source, s, methodName); } public static void setPusher(Pusher pusher) { Sets.pusher = pusher; } }
[ "george-hawkins@users.noreply.github.com" ]
george-hawkins@users.noreply.github.com
adda0683ee6cfdc2114e4c69301eec4ec7ac3607
524dcce0259b9a4c8c701a6e1cfcb56581d87f6d
/PracticeNewTopics/FineGPS/app/src/main/java/com/droidking/finegps/AppLocationService.java
4372c0fab079a534521233b8b1cb060f8eee251c
[]
no_license
thaziri/Projects2016
2a8fcadd8ad5110e0f38abc24558641e13a87e8a
3d99b3be52ae8e0001f1e9b0264ba58ff343f0c0
refs/heads/master
2020-03-25T12:00:27.332972
2017-10-21T05:31:08
2017-10-21T05:31:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,627
java
package com.droidking.finegps; /** * Created by nazmul on 6/3/16. */ import android.app.Service; import android.content.Context; import android.content.Intent; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.os.IBinder; public class AppLocationService extends Service implements LocationListener { protected LocationManager locationManager; Location location; private static final long MIN_DISTANCE_FOR_UPDATE = 10; private static final long MIN_TIME_FOR_UPDATE = 1000 * 60 * 2; public AppLocationService(Context context) { locationManager = (LocationManager) context .getSystemService(LOCATION_SERVICE); } public Location getLocation(String provider) { if (locationManager.isProviderEnabled(provider)) { locationManager.requestLocationUpdates(provider, MIN_TIME_FOR_UPDATE, MIN_DISTANCE_FOR_UPDATE, this); if (locationManager != null) { location = locationManager.getLastKnownLocation(provider); return location; } } return null; } @Override public void onLocationChanged(Location location) { } @Override public void onProviderDisabled(String provider) { } @Override public void onProviderEnabled(String provider) { } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } @Override public IBinder onBind(Intent arg0) { return null; } }
[ "nazmul.cste07@gmail.com" ]
nazmul.cste07@gmail.com
9e36562c7ad4f586a78292e5bc3e7437698d098e
02e9e585b38375cd783ad40eb60790e49473a7f2
/src/BeerSong.java
33d5b676a48323ff2a5ca92a1504884d5b3268ed
[]
no_license
Axel-ST/Head-First-Java-2nd-Edition-RU-Ch.1
b7656694cafb981deb6c701a301698267323311e
f1d2d788f9f5f9c1b0498f7acd09ad50c93d28b3
refs/heads/main
2023-03-16T19:12:12.413608
2021-03-18T07:34:44
2021-03-18T07:34:44
348,932,486
0
0
null
null
null
null
UTF-8
Java
false
false
871
java
/* * Created by Axel_ST on 18.03.2021 * * Head First Java, 2nd Edition (RU) p. 44 * * My version of this exercise */ public class BeerSong { public static void main(String[] args) { int beerNum = 99; String word = "бутылок (бутылки)"; System.out.println(beerNum + " " + word + " пива на столе"); while (beerNum > 0) { if (beerNum == 1) word = "бутылка"; // на последний прогон, одна бутылка System.out.println(beerNum + " " + word + " пива на столе"); System.out.println(beerNum + " " + word + " пива"); System.out.println("Возьми одну, пусти по кругу"); System.out.println(); beerNum--; } System.out.println("Закончилось.."); } }
[ "kozlov.axe@gmail.com" ]
kozlov.axe@gmail.com
69c52d91e7b11fb97712adde61fa807538a704d3
91297ffb10fb4a601cf1d261e32886e7c746c201
/openide.util/test/unit/src/org/openide/util/test/RestrictThreadCreation.java
c2ce9f754e0416c26df33932b401eacb5ae44d4a
[]
no_license
JavaQualitasCorpus/netbeans-7.3
0b0a49d8191393ef848241a4d0aa0ecc2a71ceba
60018fd982f9b0c9fa81702c49980db5a47f241e
refs/heads/master
2023-08-12T09:29:23.549956
2019-03-16T17:06:32
2019-03-16T17:06:32
167,005,013
0
0
null
null
null
null
UTF-8
Java
false
false
6,169
java
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved. * * Oracle and Java are registered trademarks of Oracle and/or its affiliates. * Other names may be trademarks of their respective owners. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common * Development and Distribution License("CDDL") (collectively, the * "License"). You may not use this file except in compliance with the * License. You can obtain a copy of the License at * http://www.netbeans.org/cddl-gplv2.html * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the * specific language governing permissions and limitations under the * License. When distributing the software, include this License Header * Notice in each file and include the License file at * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the GPL Version 2 section of the License file that * accompanied this code. If applicable, add the following below the * License Header, with the fields enclosed by brackets [] replaced by * your own identifying information: * "Portions Copyrighted [year] [name of copyright owner]" * * Contributor(s): * * Portions Copyrighted 2007 Sun Microsystems, Inc. */ package org.openide.util.test; import java.security.Permission; import java.util.Arrays; import java.util.HashSet; import java.util.Set; /** * Permits unit tests to limit creation of threads. * Unexpected thread creation can make tests fail randomly, which makes debugging difficult. * <p>Start off calling {@link #permitStandard} and {@link #forbidNewThreads}. * To determine which methods to permit, just try running the test; * if you see any {@link SecurityException}s which look like harmless thread creation * activities, just copy the appropriate part of the stack trace and pass to {@link #permit}. * <p>Use non-strict mode for {@link #forbidNewThreads} if you suspect some code * might be catching and not reporting {@link SecurityException}s; or you may prefer * to simply use non-strict mode while developing the test and then switch to strict * mode once it begins passing. * <p>Place calls to this class early in your test's initialization, e.g. in a static block. * (Not suitable for use from {@link junit.framework.TestCase#setUp}.) */ public class RestrictThreadCreation { private RestrictThreadCreation() {} private static Set<String> currentlyPermitted = new HashSet<String>(); /** * Explicitly permits one or more thread creation idioms. * Each entry is of the form <samp>fully.qualified.Clazz.methodName</samp> * and if such a method can be found on the call stack the thread creation * is permitted. * @param permitted one or more fully qualified method names to accept */ public static void permit(String... permitted) { currentlyPermitted.addAll(Arrays.asList(permitted)); } /** * Permits a standard set of thread creation idioms which are normally harmless to unit tests. * Feel free to add to this list if it seems appropriate. */ public static void permitStandard() { permit(// Found experimentally: "org.netbeans.junit.NbTestCase.runBare", "sun.java2d.Disposer.<clinit>", "java.awt.Toolkit.getDefaultToolkit", "java.util.logging.LogManager$Cleaner.<init>", "org.netbeans.ModuleManager$1.<init>", "org.netbeans.Stamps$Worker.<init>", "org.netbeans.core.startup.Splash$SplashComponent.setText", "org.netbeans.core.startup.preferences.NbPreferences.asyncInvocationOfFlushSpi", "org.openide.loaders.FolderInstance.waitFinished", "org.openide.loaders.FolderInstance.postCreationTask", "org.netbeans.modules.masterfs.filebasedfs.fileobjects.LockForFile.<clinit>", "org.netbeans.api.java.source.JavaSource.<clinit>", "org.netbeans.api.java.source.JavaSourceTaskFactory.fileObjectsChanged", "org.netbeans.modules.progress.spi.Controller.resetTimer", "org.netbeans.modules.timers.InstanceWatcher$FinalizingToken.finalize", "org.openide.util.NbBundle.getBundleFast", "org.openide.util.RequestProcessor$TickTac.run", "org.openide.util.Utilities$ActiveQueue.ping", "javax.swing.JComponent.revalidate", "javax.swing.ImageIcon.<init>"); } /** * Install a security manager which prevents new threads from being created * unless they were explicitly permitted. * @param strict if true, throw a security exception; if false, just print stack traces */ public static void forbidNewThreads(final boolean strict) { System.setSecurityManager(new SecurityManager() { public @Override void checkAccess(ThreadGroup g) { boolean inThreadInit = false; for (StackTraceElement line : Thread.currentThread().getStackTrace()) { String id = line.getClassName() + "." + line.getMethodName(); if (currentlyPermitted.contains(id)) { return; } else if (id.equals("java.lang.Thread.init") || id.equals("org.openide.util.RequestProcessor$Processor.checkAccess")) { inThreadInit = true; } } if (inThreadInit) { SecurityException x = new SecurityException("Unauthorized thread creation"); if (strict) { throw x; } else { x.printStackTrace(); } } } public @Override void checkPermission(Permission perm) {} public @Override void checkPermission(Permission perm, Object context) {} }); } }
[ "taibi@sonar-scheduler.rd.tut.fi" ]
taibi@sonar-scheduler.rd.tut.fi
4004f7df65f443aab1ac26b75bba00be3a46bae7
a249e77118bc0364db3ce1ab1209931cb02af6a6
/src/main/java/shortener/exceptions/auth/InvalidTokenHandler.java
f4d19ddb4a1b1076f70cbf320fc68ce71090e811
[]
no_license
NPashaO/url-shrtnr-guitarosexuals
ceca7a4e43b70e0d3a056a5164f936a52355be5f
58f3702e923edb4efe2b9a0a679a2de941302eda
refs/heads/master
2023-03-19T10:43:43.788457
2021-03-14T11:54:48
2021-03-14T11:54:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
649
java
package shortener.exceptions.auth; import io.micronaut.context.annotation.Requires; import io.micronaut.http.HttpRequest; import io.micronaut.http.HttpResponse; import io.micronaut.http.annotation.Produces; import io.micronaut.http.server.exceptions.ExceptionHandler; import javax.inject.Singleton; @Produces @Singleton @Requires(classes = {InvalidToken.class, ExceptionHandler.class}) class InvalidTokenHandler implements ExceptionHandler<InvalidToken, HttpResponse<String>> { @Override public HttpResponse<String> handle(HttpRequest request, InvalidToken exception) { return HttpResponse.unauthorized().body("Invalid token"); } }
[ "gsb06092000@gmail.com" ]
gsb06092000@gmail.com
9b88171417c76368a8b6c0f086dd917347d2666c
a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb
/ahas-20180901/src/main/java/com/aliyun/ahas20180901/models/QueryAppPanoramicGraphResponseBody.java
78d54847a0b752adea13e1c5b74aaa4d8b101b0e
[ "Apache-2.0" ]
permissive
aliyun/alibabacloud-java-sdk
83a6036a33c7278bca6f1bafccb0180940d58b0b
008923f156adf2e4f4785a0419f60640273854ec
refs/heads/master
2023-09-01T04:10:33.640756
2023-09-01T02:40:45
2023-09-01T02:40:45
288,968,318
40
45
null
2023-06-13T02:47:13
2020-08-20T09:51:08
Java
UTF-8
Java
false
false
7,994
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.ahas20180901.models; import com.aliyun.tea.*; public class QueryAppPanoramicGraphResponseBody extends TeaModel { @NameInMap("Code") public String code; @NameInMap("Data") public QueryAppPanoramicGraphResponseBodyData data; @NameInMap("Message") public String message; @NameInMap("RequestId") public String requestId; @NameInMap("Success") public Boolean success; public static QueryAppPanoramicGraphResponseBody build(java.util.Map<String, ?> map) throws Exception { QueryAppPanoramicGraphResponseBody self = new QueryAppPanoramicGraphResponseBody(); return TeaModel.build(map, self); } public QueryAppPanoramicGraphResponseBody setCode(String code) { this.code = code; return this; } public String getCode() { return this.code; } public QueryAppPanoramicGraphResponseBody setData(QueryAppPanoramicGraphResponseBodyData data) { this.data = data; return this; } public QueryAppPanoramicGraphResponseBodyData getData() { return this.data; } public QueryAppPanoramicGraphResponseBody setMessage(String message) { this.message = message; return this; } public String getMessage() { return this.message; } public QueryAppPanoramicGraphResponseBody setRequestId(String requestId) { this.requestId = requestId; return this; } public String getRequestId() { return this.requestId; } public QueryAppPanoramicGraphResponseBody setSuccess(Boolean success) { this.success = success; return this; } public Boolean getSuccess() { return this.success; } public static class QueryAppPanoramicGraphResponseBodyDataEdges extends TeaModel { @NameInMap("source") public String source; @NameInMap("target") public String target; public static QueryAppPanoramicGraphResponseBodyDataEdges build(java.util.Map<String, ?> map) throws Exception { QueryAppPanoramicGraphResponseBodyDataEdges self = new QueryAppPanoramicGraphResponseBodyDataEdges(); return TeaModel.build(map, self); } public QueryAppPanoramicGraphResponseBodyDataEdges setSource(String source) { this.source = source; return this; } public String getSource() { return this.source; } public QueryAppPanoramicGraphResponseBodyDataEdges setTarget(String target) { this.target = target; return this; } public String getTarget() { return this.target; } } public static class QueryAppPanoramicGraphResponseBodyDataNodes extends TeaModel { @NameInMap("comboId") public String comboId; @NameInMap("configurationId") public String configurationId; @NameInMap("deviceName") public String deviceName; @NameInMap("icon") public String icon; @NameInMap("id") public String id; public static QueryAppPanoramicGraphResponseBodyDataNodes build(java.util.Map<String, ?> map) throws Exception { QueryAppPanoramicGraphResponseBodyDataNodes self = new QueryAppPanoramicGraphResponseBodyDataNodes(); return TeaModel.build(map, self); } public QueryAppPanoramicGraphResponseBodyDataNodes setComboId(String comboId) { this.comboId = comboId; return this; } public String getComboId() { return this.comboId; } public QueryAppPanoramicGraphResponseBodyDataNodes setConfigurationId(String configurationId) { this.configurationId = configurationId; return this; } public String getConfigurationId() { return this.configurationId; } public QueryAppPanoramicGraphResponseBodyDataNodes setDeviceName(String deviceName) { this.deviceName = deviceName; return this; } public String getDeviceName() { return this.deviceName; } public QueryAppPanoramicGraphResponseBodyDataNodes setIcon(String icon) { this.icon = icon; return this; } public String getIcon() { return this.icon; } public QueryAppPanoramicGraphResponseBodyDataNodes setId(String id) { this.id = id; return this; } public String getId() { return this.id; } } public static class QueryAppPanoramicGraphResponseBodyDataTypes extends TeaModel { @NameInMap("extInfo") public java.util.Map<String, ?> extInfo; @NameInMap("nodeCount") public Integer nodeCount; @NameInMap("sort") public Integer sort; @NameInMap("type") public String type; public static QueryAppPanoramicGraphResponseBodyDataTypes build(java.util.Map<String, ?> map) throws Exception { QueryAppPanoramicGraphResponseBodyDataTypes self = new QueryAppPanoramicGraphResponseBodyDataTypes(); return TeaModel.build(map, self); } public QueryAppPanoramicGraphResponseBodyDataTypes setExtInfo(java.util.Map<String, ?> extInfo) { this.extInfo = extInfo; return this; } public java.util.Map<String, ?> getExtInfo() { return this.extInfo; } public QueryAppPanoramicGraphResponseBodyDataTypes setNodeCount(Integer nodeCount) { this.nodeCount = nodeCount; return this; } public Integer getNodeCount() { return this.nodeCount; } public QueryAppPanoramicGraphResponseBodyDataTypes setSort(Integer sort) { this.sort = sort; return this; } public Integer getSort() { return this.sort; } public QueryAppPanoramicGraphResponseBodyDataTypes setType(String type) { this.type = type; return this; } public String getType() { return this.type; } } public static class QueryAppPanoramicGraphResponseBodyData extends TeaModel { @NameInMap("edges") public java.util.List<QueryAppPanoramicGraphResponseBodyDataEdges> edges; @NameInMap("nodes") public java.util.List<QueryAppPanoramicGraphResponseBodyDataNodes> nodes; @NameInMap("types") public java.util.List<QueryAppPanoramicGraphResponseBodyDataTypes> types; public static QueryAppPanoramicGraphResponseBodyData build(java.util.Map<String, ?> map) throws Exception { QueryAppPanoramicGraphResponseBodyData self = new QueryAppPanoramicGraphResponseBodyData(); return TeaModel.build(map, self); } public QueryAppPanoramicGraphResponseBodyData setEdges(java.util.List<QueryAppPanoramicGraphResponseBodyDataEdges> edges) { this.edges = edges; return this; } public java.util.List<QueryAppPanoramicGraphResponseBodyDataEdges> getEdges() { return this.edges; } public QueryAppPanoramicGraphResponseBodyData setNodes(java.util.List<QueryAppPanoramicGraphResponseBodyDataNodes> nodes) { this.nodes = nodes; return this; } public java.util.List<QueryAppPanoramicGraphResponseBodyDataNodes> getNodes() { return this.nodes; } public QueryAppPanoramicGraphResponseBodyData setTypes(java.util.List<QueryAppPanoramicGraphResponseBodyDataTypes> types) { this.types = types; return this; } public java.util.List<QueryAppPanoramicGraphResponseBodyDataTypes> getTypes() { return this.types; } } }
[ "sdk-team@alibabacloud.com" ]
sdk-team@alibabacloud.com
768751f2f5ffbc056fe45f4d5e2ff9ab0b6482c2
d696000d224989ea8df7e38cdb52669fec3d0d4c
/src/java/com/pencil/StudentAttendance/StudentAttendance_Service_Impl.java
be5c5d450e1c766e367a0232ae43b14aa09be00f
[]
no_license
asadcse04/pencilims
b77d1d062b939ec1a87336e92526aa2f41e81a69
f8b0fccb44255ba2e133c75dbd8ba36a69ce2173
refs/heads/master
2016-09-06T10:22:23.721055
2014-09-01T12:35:20
2014-09-01T12:35:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
15,279
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.pencil.StudentAttendance; import com.pencil.Connection.DB_Connection; import com.pencil.Dummy.Student.Student_Registration; import com.pencil.InstituteSetup.InstituteSetup; import com.pencil.InstituteSetup.InstituteSetupService; import com.pencil.InstituteSetup.InstituteSetupServiceImpl; import com.pencil.SMS.SMS_Service; import com.pencil.SMS.SMS_ServiceImpl; import com.pencil.ScClassConfig.ScClassConfig; import java.io.Serializable; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; import javax.faces.context.FacesContext; /** * * @author Mahfuj */ public class StudentAttendance_Service_Impl implements Serializable,StudentAttendance_Service { @Override public List<StudentAttendanceReport> attendanceReport(Date from, Date to,StringBuilder scCnf) { DB_Connection o=new DB_Connection(); Connection con=o.getConnection(); CallableStatement cs = null; ResultSet rs = null; List<StudentAttendanceReport> attnd_rpt_list=new ArrayList<StudentAttendanceReport>(); try { cs = con.prepareCall("{call st_attendance_report(?,?,?)}"); cs.setString(1,scCnf.toString().replace(",","|")); cs.setDate(2,new java.sql.Date(from.getTime())); cs.setDate(3,new java.sql.Date(to.getTime())); cs.execute(); rs = cs.getResultSet(); while(rs.next()) { attnd_rpt_list.add(new StudentAttendanceReport(rs.getString(1),rs.getString(2),rs.getInt(3),rs.getInt(4),rs.getInt(5),rs.getInt(6),rs.getInt(7),rs.getInt(8))); } } catch(SQLException e) { System.out.println(e); } finally { try { if(rs!=null) { rs.close(); } if(cs!=null) { cs.close(); } if(con!=null) { con.close(); } } catch(SQLException e) { System.out.println(e); } from=null; to=null; scCnf=null; } return attnd_rpt_list; } @Override public boolean saveAttendance(StudentAttendance sa) { DB_Connection o=new DB_Connection(); Connection con=o.getConnection(); PreparedStatement prst = null; ResultSet rs; int i=0; try { prst=con.prepareStatement("select 1 from student_attendence where AttendanceDate=? and StudentID=?"); prst.setDate(1,new java.sql.Date(sa.getAttendance_date().getTime())); prst.setString(2,sa.getStudentID()); rs = prst.executeQuery(); while(rs.next()) { i++; } rs.close(); prst.close(); if(i<1) { prst = con.prepareStatement("insert into student_attendence values(?,?,?,?)"); prst.setDate(1,new java.sql.Date(sa.getAttendance_date().getTime())); prst.setBoolean(2,sa.isAbsent()); prst.setString(3,sa.getRemarks()); prst.setString(4,sa.getStudentID()); prst.execute(); return true; } else { prst = con.prepareStatement("update student_attendence set Absent=?, Note=? where AttendanceDate=? and StudentID=?"); prst.setBoolean(1,sa.isAbsent()); prst.setString(2,sa.getRemarks()); prst.setDate(3,new java.sql.Date(sa.getAttendance_date().getTime())); prst.setString(4,sa.getStudentID()); prst.execute(); return true; } } catch(SQLException e) { System.out.println(e); } finally { try { if(prst!=null) { prst.close(); } if(con!=null) { con.close(); } } catch(SQLException e) { System.out.println(e); } sa=null; } return false; } @Override public int completeAttendance(Date ad, List<Student_Registration> studentList,StringBuilder scCnf,int smsBalnc,boolean sms_with_attendance) { List<String> studentID=new ArrayList<String>(); DB_Connection o=new DB_Connection(); Connection con=o.getConnection(); PreparedStatement prst = null; Statement stmt = null; ResultSet rs = null; StringBuilder std_list_id=new StringBuilder(); int rc=0;//response code System.out.println(scCnf.toString()); try { prst=con.prepareStatement("select distinct sa.StudentID FROM student_attendence sa,student_identification si where si.StudentID=sa.StudentID " + "and si.ClassConfigID IN('"+scCnf.toString()+"') and sa.AttendanceDate=?"); //prst.setString(1,scCnf.toString()); prst.setDate(1,new java.sql.Date(ad.getTime())); rs = prst.executeQuery(); while(rs.next()) { studentID.add(rs.getString("StudentID")); } } catch(SQLException e) { System.out.println(e); System.out.println("I am not ok block-1......................"); } finally { try { if(rs!=null) { rs.close(); } if(prst!=null) { prst.close(); } } catch(SQLException e) { System.out.println(e); System.out.println("I am not ok block-2"); } } try { stmt=con.createStatement(); } catch(SQLException e) { System.out.println(e); System.out.println("I am not ok block-3"); } //if(!studentID.isEmpty()) //{ for (int i = 0; i < studentID.size(); i++) { for (int j = 0; j < studentList.size(); j++) { if (studentID.get(i).equals(studentList.get(j).getStudentID())) { studentList.remove(j); } }//End inner For //System.out.println("Absent Student:"+studentID.get(i)); std_list_id.append(studentID.get(i)); std_list_id.append(" "); }//End Outer For //} Iterator<Student_Registration> itr=studentList.iterator(); while(itr.hasNext()) { Student_Registration sr=itr.next(); try { stmt.addBatch("insert into student_attendence values('"+new java.sql.Date(ad.getTime())+"',"+false+","+null+",'"+sr.getStudentID()+"')"); } catch(SQLException e) { System.out.println(e); System.out.println("I am not ok block-4"); } } try { stmt.executeBatch(); if(!sms_with_attendance) { if (std_list_id.length() > 0) { std_list_id.setLength(std_list_id.length() - 1); rc = getStudentGuardianNumber(std_list_id, smsBalnc); } else { rc = 100; } } else { rc=150; } } catch(SQLException e) { System.out.println(e); } finally { try { if(stmt!=null) { stmt.close(); } } catch(SQLException ex) { System.out.println(ex); System.out.println("I am not ok block-5"); } studentID.clear(); studentList.clear(); scCnf.setLength(0); } return rc; } public int getStudentGuardianNumber(StringBuilder stdList,int smsBal) { System.out.println("smsbalance::"+smsBal); System.out.println(stdList.length()); DB_Connection o=new DB_Connection(); Connection con=o.getConnection(); Connection cn=o.getSms_db_Connection(); PreparedStatement prst = null; CallableStatement cs = null; ResultSet rs = null; String instituteID=""; FacesContext context=FacesContext.getCurrentInstance(); instituteID=context.getExternalContext().getSessionMap().get("SchoolID").toString(); int instituteId=Integer.valueOf(instituteID); // InstituteSetupService instituteService = new InstituteSetupServiceImpl(); // // InstituteSetup institute = new InstituteSetup(); // // institute = instituteService.instituteSetup(); // // int instituteId = Integer.valueOf(institute.getInstituteID()); SMS_Service smsService=new SMS_ServiceImpl(); int count=0; String[] std_arry=stdList.toString().split("\\s+"); int responseCode; //int std_arry_lenth=std_arry.length; try { if(smsBal!=0) { prst = con.prepareStatement("SELECT sg.ContactNo FROM student_guardian_info sg,student_basic_info sb where sg.StudentID=sb.STudentID and sb.StudentID=?"); for (String studentid : std_arry) { prst.setString(1, studentid); rs = prst.executeQuery(); if ((rs.next()) && (count <= smsBal)) { if (smsService.sendIndividual_Sms(rs.getString("sg.ContactNo"), "Dear parents,your child does not attend to the Institute today.Please take care.Student ID:-'" + studentid + "' ") == 200) { count++; } // count++; } }//end for cs = cn.prepareCall("{call smsCntManage(?,?)}"); cs.setInt(1, count); //cs.setInt(2, 1); //school id cs.setInt(2, instituteId); //school id cs.execute(); } } catch(SQLException ex) { System.out.println(ex); } finally { try { if (rs != null) { rs.close(); } if (prst != null) { prst.close(); } if (cs != null) { cs.close(); } if (con != null) { con.close(); } } catch(SQLException ex) { System.out.println(ex); } stdList.setLength(0); } System.out.println("Count attendence sms:"+count); System.out.println("Student:"+std_arry.length); if(smsBal!=0) { if (count == std_arry.length) { responseCode = 200; } else { responseCode = 111; } } else { responseCode = 150; } std_arry=null; count=0; return responseCode; } @Override public List<ScClassConfig> scClassConfiguration_List() { DB_Connection o=new DB_Connection(); Connection con=o.getConnection(); PreparedStatement prst = null; ResultSet rs = null; List<ScClassConfig> scCnfList=new ArrayList<ScClassConfig>(); try { prst = con.prepareStatement("SELECT scCnf.AcYrID,c.ClassName,s.ShiftName,sctn.SectionName,count(si.StudentID) as TotalStudentCount" +" FROM classconfig scCnf,class c,shift s,section sctn,student_identification si where scCnf.ClassID=c.ClassID" +" and scCnf.ShiftID=s.ShiftID and scCnf.SectionID=sctn.SectionID and scCnf.ScConfigID=si.ClassConfigID group by scCnf.AcYrID,c.ClassName,s.ShiftName,sctn.SectionName"); rs = prst.executeQuery(); while(rs.next()) { scCnfList.add(new ScClassConfig(rs.getInt("scCnf.AcYrID"),rs.getString("c.ClassName"),rs.getString("s.ShiftName"),rs.getString("sctn.SectionName"),rs.getInt("TotalStudentCount"))); } } catch(SQLException e) { System.out.println(e); } finally { try { if(rs!=null) { rs.close(); } if(prst!=null) { prst.close(); } } catch(SQLException e) { System.out.println(e); } } return scCnfList; } }
[ "mdriad415@gmail.com" ]
mdriad415@gmail.com
34b9a7d62a14bef6ad330b4bfacf349177a6670b
00c7f380ac2635b3d58fa95cee200b654ab1e7bf
/workspace2/day14/src/cn/tedu/listener/MyServletContextAttributeListener.java
d63ed9f442960709403214297a1540a1ceeec24c
[]
no_license
xyq0279/storage
34d11765a96d1b3ffa25cbc19e68ebbb170030dc
eb963b465a3c05e3ade03796ccf7e075ecff7a5c
refs/heads/master
2021-06-21T15:43:13.708708
2017-08-18T11:55:45
2017-08-18T11:55:45
95,219,387
0
0
null
null
null
null
UTF-8
Java
false
false
921
java
package cn.tedu.listener; import javax.servlet.ServletContextAttributeEvent; import javax.servlet.ServletContextAttributeListener; /** * 监听器 * @author Administrator * */ public class MyServletContextAttributeListener implements ServletContextAttributeListener { /** * 无参构造器 */ public MyServletContextAttributeListener() {} /** * ServletContext域中添加一个属性是调用该方法 */ public void attributeAdded(ServletContextAttributeEvent scab) { } /** * ServletContext域中替换一个属性是调用该方法 */ public void attributeReplaced(ServletContextAttributeEvent scab) { // TODO Auto-generated method stub } /** * ServletContext域中删除一个属性是调用该方法 */ public void attributeRemoved(ServletContextAttributeEvent scab) { // TODO Auto-generated method stub } }
[ "997672903@qq.com" ]
997672903@qq.com
f531072dec539ee77ac3013e30af9c2894753d1f
27e5a82c954e5da9b66ecc38fbeb7685ad5b4e48
/src/main/java/fr/openig/engine/OpenIgTimer.java
1162dfc2397bef9df2f9026976b6e3bc55feff8f
[]
no_license
mrrobeson/open-ig2
a30266c9a950d591392bcd9174a6a17ddd152087
c12fec0785768c7afd09e1691d9bcc54bea8c8f3
refs/heads/master
2021-01-10T06:11:54.112214
2009-10-22T15:26:01
2009-10-22T15:26:01
54,756,522
0
0
null
null
null
null
UTF-8
Java
false
false
2,058
java
package fr.openig.engine; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import fr.openig.model.Planet; import fr.openig.object.generic.ControlBarGameObject; public class OpenIgTimer extends Thread { /** Instance de l'objet **/ private static OpenIgTimer instance; private long sleep = 5000; private boolean interupted = false; private Calendar calendar; private boolean pause = false; public synchronized static OpenIgTimer getInstance(Date date) { if(instance == null) instance = new OpenIgTimer(date); return instance; } private OpenIgTimer(Date date) { calendar = new GregorianCalendar(); calendar.setTimeInMillis(date.getTime()); } @Override public void run() { while(!interupted) { try { Thread.sleep(sleep); } catch (InterruptedException e) { throw new RuntimeException(e); } if(!pause) { calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) + 1); // Gestion de l'argent calculateMoney(); } } } private void calculateMoney() { for(Planet planet : UniverseEngine.getInstance().getUniverse().getPlanets()) { long impot = (long) (planet.getImpot() * (planet.getPopulation() / 4) * planet.getSatisfaction()); OpenIgMoney.getInstance().addMoney(impot); } } public synchronized void setSpeed(int speed) { switch (speed) { case ControlBarGameObject.PLAY: sleep = 4000; break; case ControlBarGameObject.FORWARD: sleep = 900; break; case ControlBarGameObject.FAST_FORWARD: sleep = 100; break; } pause = false; } public int getDayOfMonth() { return calendar.get(Calendar.DAY_OF_MONTH); } public int getMonth() { return calendar.get(Calendar.MONTH); } public int getYear() { return calendar.get(Calendar.YEAR); } public void setInterupted(boolean interupted) { this.interupted = interupted; } public void pause() { pause = true; } }
[ "stephan.lascar@8250284e-bbe3-11de-ad49-1f49b0b801a7" ]
stephan.lascar@8250284e-bbe3-11de-ad49-1f49b0b801a7
bce3b41be21bc5820d7c358226bda3ef395be2f7
4ce439ac48a27c916a247cb02ddef42fa845247e
/src/com/Chapter_03_LambdaExpression/Lesson_02/MyInterface.java
40f5dddc9f2bc1c6edb24d2dc6d94ba251065c0f
[]
no_license
OlegGumush/Java-8
53f65d172beb7dad45fd6c1a2bf0c344374606d8
87b3823e7fa33c5bd57ed637a4f936951f80b19b
refs/heads/master
2020-04-05T16:02:29.809433
2018-11-30T20:53:41
2018-11-30T20:53:41
156,994,549
0
0
null
null
null
null
UTF-8
Java
false
false
147
java
package com.Chapter_03_LambdaExpression.Lesson_02; @FunctionalInterface public interface MyInterface { public abstract void method1(); }
[ "oleg@DESKTOP-4SIKP0G" ]
oleg@DESKTOP-4SIKP0G
6dbe1024577573f6fc9ae4f724b1207e3cb579bd
4068f896048c728bdec49b3f2b8b382a1e448147
/src/main/java/com/example/nayab/util/CustomGenerator.java
bab5ef875258f3231cb90f332b42235ea4819d89
[]
no_license
Nayab-Haider/Jwt-Authentication-and-Authorization
e1507d2e4660a48af472d1f28975e079c1e4a3c2
da5ff7ad9dfd684e84e2e9e4ea499a5951558bbf
refs/heads/master
2020-04-06T09:06:01.233782
2019-01-05T17:07:07
2019-01-05T17:07:07
157,329,154
1
0
null
null
null
null
UTF-8
Java
false
false
1,243
java
package com.example.nayab.util; import lombok.Data; import org.hibernate.HibernateException; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.id.IdentifierGenerator; import org.springframework.stereotype.Component; import java.io.Serializable; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; @Data @Component public class CustomGenerator implements IdentifierGenerator { String name="Nayab"; @Override public Serializable generate(SharedSessionContractImplementor sharedSessionContractImplementor, Object o) throws HibernateException { Connection connection = sharedSessionContractImplementor.connection(); // try { // Statement statement=connection.createStatement(); // // ResultSet rs=statement.executeQuery("select count(id) as Id from login_user"); // // if(rs.next()) // { // int id=rs.getInt(1)+101; // String generatedId = name + new Integer(id).toString(); // return generatedId; // } // } catch (SQLException e) { // e.printStackTrace(); // } return null; } }
[ "Nayab" ]
Nayab
58fc3e646eb08a89eeca941416994c214b9bd6ce
8b5cdda28454b0aab451a4b3216a58ca87517c41
/AL-Game/data/scripts/system/handlers/quest/brusthonin/_2094TheSecretofAdmaStronghold.java
07761ace51717d6b3402b0691726e92197944278
[]
no_license
flroexus/aelp
ac36cd96963bd12847e37118531b68953f9e8440
4f6cca6b462419accf53b58c454be0cf6abe39c0
refs/heads/master
2023-05-28T18:36:47.919387
2020-09-05T07:27:49
2020-09-05T07:27:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,915
java
package quest.brusthonin; import com.aionemu.gameserver.model.gameobjects.Npc; import com.aionemu.gameserver.model.gameobjects.player.Player; import com.aionemu.gameserver.network.aion.serverpackets.SM_DIALOG_WINDOW; import com.aionemu.gameserver.questEngine.handlers.QuestHandler; import com.aionemu.gameserver.questEngine.model.QuestEnv; import com.aionemu.gameserver.questEngine.model.QuestState; import com.aionemu.gameserver.questEngine.model.QuestStatus; import com.aionemu.gameserver.services.QuestService; import com.aionemu.gameserver.utils.PacketSendUtility; /** * @author Dune11 */ public class _2094TheSecretofAdmaStronghold extends QuestHandler { private final static int questId = 2094; private final static int[] npc_ids = { 205150, 205192, 205155, 730164, 205191, 204057 }; public _2094TheSecretofAdmaStronghold() { super(questId); } @Override public void register() { qe.registerOnEnterZoneMissionEnd(questId); qe.registerOnLevelUp(questId); qe.registerQuestNpc(214700).addOnKillEvent(questId); for (int npc_id : npc_ids) qe.registerQuestNpc(npc_id).addOnTalkEvent(questId); } @Override public boolean onZoneMissionEndEvent(QuestEnv env) { int[] quests = { 2092, 2093, 2054 }; return defaultOnZoneMissionEndEvent(env, quests); } @Override public boolean onLvlUpEvent(QuestEnv env) { int[] quests = { 2091, 2092, 2093, 2054 }; return defaultOnLvlUpEvent(env, quests, true); } @Override public boolean onDialogEvent(QuestEnv env) { final Player player = env.getPlayer(); final QuestState qs = player.getQuestStateList().getQuestState(questId); final Npc npc = (Npc) env.getVisibleObject(); if (qs == null) return false; int var = qs.getQuestVarById(0); int targetId = 0; if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId(); if (qs.getStatus() == QuestStatus.REWARD) { if (targetId == 204057) return sendQuestEndDialog(env); return false; } else if (qs.getStatus() != QuestStatus.START) { return false; } if (targetId == 205150) { switch (env.getDialog()) { case START_DIALOG: if (var == 0) return sendQuestDialog(env, 1011); return true; case STEP_TO_1: if (var == 0) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } } } else if (targetId == 205192) { switch (env.getDialog()) { case START_DIALOG: if (var == 1) return sendQuestDialog(env, 1352); else if (var == 2) return sendQuestDialog(env, 1693); else if (var == 3) return sendQuestDialog(env, 2034); return true; case STEP_TO_2: if (var == 1) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } case CHECK_COLLECTED_ITEMS: if (var == 2) { if (QuestService.collectItemCheck(env, true)) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); return sendQuestDialog(env, 10001); } else return sendQuestDialog(env, 10008); } case STEP_TO_4: if (var == 3) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); } } } else if (targetId == 205155) { switch (env.getDialog()) { case START_DIALOG: if (var == 5) return sendQuestDialog(env, 2716); case STEP_TO_6: if (var == 5) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10)); return true; } } } else if (targetId == 730164) { switch (env.getDialog()) { case USE_OBJECT: if (var == 6) { QuestService.addNewSpawn(220050000, 1, 205191, npc.getX(), npc.getY(), npc.getZ(), (byte) 0); npc.getController().scheduleRespawn(); npc.getController().onDelete(); return true; } } } else if (targetId == 205191) { switch (env.getDialog()) { case USE_OBJECT: if (var == 6) { qs.setStatus(QuestStatus.REWARD); updateQuestStatus(env); return true; } } } return false; } @Override public boolean onKillEvent(QuestEnv env) { Player player = env.getPlayer(); QuestState qs = player.getQuestStateList().getQuestState(questId); if (qs == null || qs.getStatus() != QuestStatus.START) return false; int var = qs.getQuestVarById(0); int targetId = 0; if (env.getVisibleObject() instanceof Npc) targetId = ((Npc) env.getVisibleObject()).getNpcId(); if (targetId == 214700) { if (var == 4) { qs.setQuestVarById(0, var + 1); updateQuestStatus(env); return true; } } return false; } }
[ "luiz.philip@amedigital.com" ]
luiz.philip@amedigital.com
31dfa6d518cfa41450aa4988f2186f2673c353ec
c4f03f785fd06b04fa92ff0d1e140cc43aa5f439
/demo/src/main/java/com/zydsj/shiro/demoshiro/DemoshiroApplication.java
236d51de2614f61dee8f35903a98efcfa739fd37
[]
no_license
balloonfish447/balloonfish
4bf67e6308082b0dedfd7be7ba66b19c66b3fb8a
73508af797860cd605b0d050457a7f9cc9ce0e58
refs/heads/master
2020-08-16T01:55:26.208940
2020-05-20T07:48:04
2020-05-20T07:48:04
215,439,600
0
0
null
null
null
null
UTF-8
Java
false
false
336
java
package com.zydsj.shiro.demoshiro; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoshiroApplication { public static void main(String[] args) { SpringApplication.run(DemoshiroApplication.class, args); } }
[ "youdu_yu@163.com" ]
youdu_yu@163.com
9a35d0b4eb2bba1db07d3df4eef641d9ce202243
e1f62bca14788bc9f5406fa3db5c4a9e883664b1
/src/modelo/personaje/transformacion/gohan/NormalGohan.java
06c795c8a5679e11f857f51ed5bf4ccc0221e932
[]
no_license
tomasmacia/TP2
f540dd8c1843c0e358f0d494191e6d3e00fe5c0b
b88bb5de0b774050a8d455b2c619d1b26beefe90
refs/heads/master
2021-01-02T08:45:17.261507
2017-06-26T21:17:20
2017-06-26T21:17:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
595
java
package modelo.personaje.transformacion.gohan; import modelo.personaje.transformacion.Transformacion; public class NormalGohan extends Transformacion { protected static final int poderDePelea = 15; protected static final int distanciaAtaque = 2; protected static final int velocidad = 2; protected static final Transformacion proximaTransformacion = new SuperSayajin1Gohan(); protected static final int kiNecesarioTransformar = 10; public NormalGohan() { super(poderDePelea, distanciaAtaque, velocidad, proximaTransformacion, kiNecesarioTransformar); } }
[ "jalt1996@gmail.com" ]
jalt1996@gmail.com
417e855f7d718544600ee998257d6116cfa86a3c
1a4684e5ba8bc6123178c9b1e3fb5ab92196bf79
/Store_app/app/src/main/java/com/example/bilalchips/store_app/contact.java
9d25d86b4d1959d2053ac7f80114e7b74e2a51ed
[]
no_license
CaptainHaider/android-Store
df1e2e1b80b3c0d8c06a435ce38487974d354543
a6152f72ade4f595d5821c24e40b991863e8cd46
refs/heads/master
2020-04-01T12:11:13.781862
2018-10-16T00:26:01
2018-10-16T00:26:01
153,195,419
2
0
null
null
null
null
UTF-8
Java
false
false
683
java
package com.example.bilalchips.store_app; /** * Created by bilalchips on 11/25/2017. */ public class contact { String name,email,uname,pass; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getUname() { return uname; } public void setUname(String uname) { this.uname = uname; } public String getPass() { return pass; } public void setPass(String pass) { this.pass = pass; } }
[ "m.hassanhaider@hotmail.com" ]
m.hassanhaider@hotmail.com
2e983e11a97b114cf2275543f86d74e2575f47ad
69150b1c4eb569e8add1b41821f010ea743b733e
/app/src/main/java/demo/com/userdata/realm/OnCompleteListener.java
b9573ae29a402b7197914e1b0b288ec339945ea2
[]
no_license
saidurcse/users
65be44f446f445e88661549a2f57005ddf8abb2a
bde20952a828aeeeae5348daa6626cee4847428e
refs/heads/master
2020-03-25T15:47:53.539387
2018-12-26T14:51:56
2018-12-26T14:51:56
143,901,855
0
0
null
null
null
null
UTF-8
Java
false
false
114
java
package demo.com.userdata.realm; public interface OnCompleteListener { void onComplete(boolean isSuccess); }
[ "saidursd@gmail.com" ]
saidursd@gmail.com
2adf7547f4651355474e9a5bf9e774cd80b4d204
722a4b591bde825e29f4f3dddba34dcca5b1a0b2
/JAVA300/testDate/src/cn/wsx/test/TestDate.java
aa5c99a920124c0217ec22e30d57f1ddc4edc9ef
[]
no_license
Eswsx/JAVAworkpace
0c03c51146ebfc6f0d89eca21cbbf36f159e95ef
c772ccd2e7b2b3c38cfd33f96211b2c75dd5e29b
refs/heads/master
2020-04-05T15:14:15.980123
2019-04-22T14:05:51
2019-04-22T14:05:51
156,960,076
0
0
null
null
null
null
GB18030
Java
false
false
501
java
package cn.wsx.test; import java.util.Date; /** * 测试时间类的用法 * @author Es无语中 * */ public class TestDate { public static void main(String[] args) { Date d = new Date(); long t = System.currentTimeMillis();//以毫秒返回当前系统时间 System.out.println(t); Date d2 = new Date(1000); System.out.println(d2.toGMTString());//不建议使用 d2.setTime(123456789); System.out.println(d2.getTime()); System.out.println(d2.getTime()<d.getTime()); } }
[ "957140834@qq.com" ]
957140834@qq.com
cf9329205e1b7e375cde04d8fc77e597aef234fc
1d8f9045942de8ee57d72e1d35ee954413fbae25
/docroot/WEB-INF/src/vn/gt/dao/danhmuc/service/persistence/DmRankRatingPersistenceImpl.java
2773bb75f5bef966e9b45a7663e65a92974ccc9c
[]
no_license
longdm10/TichHopGiaoThong-portlet
0a3dab1a876d8c2394ea59fcc810ec5561a5a3d0
e97d7663ca0ef4da19e9792c78fefd87104d2b54
refs/heads/master
2021-01-10T07:38:08.114614
2016-04-01T07:39:08
2016-04-01T07:39:08
54,985,263
0
0
null
null
null
null
UTF-8
Java
false
false
42,430
java
/** * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package vn.gt.dao.danhmuc.service.persistence; import com.liferay.portal.NoSuchModelException; import com.liferay.portal.kernel.bean.BeanReference; import com.liferay.portal.kernel.cache.CacheRegistryUtil; import com.liferay.portal.kernel.dao.orm.EntityCacheUtil; import com.liferay.portal.kernel.dao.orm.FinderCacheUtil; import com.liferay.portal.kernel.dao.orm.FinderPath; import com.liferay.portal.kernel.dao.orm.Query; import com.liferay.portal.kernel.dao.orm.QueryPos; import com.liferay.portal.kernel.dao.orm.QueryUtil; import com.liferay.portal.kernel.dao.orm.Session; import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.log.Log; import com.liferay.portal.kernel.log.LogFactoryUtil; import com.liferay.portal.kernel.util.GetterUtil; import com.liferay.portal.kernel.util.InstanceFactory; import com.liferay.portal.kernel.util.OrderByComparator; import com.liferay.portal.kernel.util.PropsKeys; import com.liferay.portal.kernel.util.PropsUtil; import com.liferay.portal.kernel.util.StringBundler; import com.liferay.portal.kernel.util.StringPool; import com.liferay.portal.kernel.util.StringUtil; import com.liferay.portal.model.CacheModel; import com.liferay.portal.model.ModelListener; import com.liferay.portal.service.persistence.BatchSessionUtil; import com.liferay.portal.service.persistence.ResourcePersistence; import com.liferay.portal.service.persistence.UserPersistence; import com.liferay.portal.service.persistence.impl.BasePersistenceImpl; import vn.gt.dao.danhmuc.NoSuchDmRankRatingException; import vn.gt.dao.danhmuc.model.DmRankRating; import vn.gt.dao.danhmuc.model.impl.DmRankRatingImpl; import vn.gt.dao.danhmuc.model.impl.DmRankRatingModelImpl; import java.io.Serializable; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * The persistence implementation for the dm rank rating service. * * <p> * Caching information and settings can be found in <code>portal.properties</code> * </p> * * @author win_64 * @see DmRankRatingPersistence * @see DmRankRatingUtil * @generated */ public class DmRankRatingPersistenceImpl extends BasePersistenceImpl<DmRankRating> implements DmRankRatingPersistence { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. Always use {@link DmRankRatingUtil} to access the dm rank rating persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class. */ public static final String FINDER_CLASS_NAME_ENTITY = DmRankRatingImpl.class.getName(); public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY + ".List1"; public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY + ".List2"; public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_RANKCODE = new FinderPath(DmRankRatingModelImpl.ENTITY_CACHE_ENABLED, DmRankRatingModelImpl.FINDER_CACHE_ENABLED, DmRankRatingImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByRankCode", new String[] { String.class.getName(), "java.lang.Integer", "java.lang.Integer", "com.liferay.portal.kernel.util.OrderByComparator" }); public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RANKCODE = new FinderPath(DmRankRatingModelImpl.ENTITY_CACHE_ENABLED, DmRankRatingModelImpl.FINDER_CACHE_ENABLED, DmRankRatingImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByRankCode", new String[] { String.class.getName() }, DmRankRatingModelImpl.RANKCODE_COLUMN_BITMASK); public static final FinderPath FINDER_PATH_COUNT_BY_RANKCODE = new FinderPath(DmRankRatingModelImpl.ENTITY_CACHE_ENABLED, DmRankRatingModelImpl.FINDER_CACHE_ENABLED, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByRankCode", new String[] { String.class.getName() }); public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(DmRankRatingModelImpl.ENTITY_CACHE_ENABLED, DmRankRatingModelImpl.FINDER_CACHE_ENABLED, DmRankRatingImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]); public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(DmRankRatingModelImpl.ENTITY_CACHE_ENABLED, DmRankRatingModelImpl.FINDER_CACHE_ENABLED, DmRankRatingImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]); public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(DmRankRatingModelImpl.ENTITY_CACHE_ENABLED, DmRankRatingModelImpl.FINDER_CACHE_ENABLED, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]); /** * Caches the dm rank rating in the entity cache if it is enabled. * * @param dmRankRating the dm rank rating */ public void cacheResult(DmRankRating dmRankRating) { EntityCacheUtil.putResult(DmRankRatingModelImpl.ENTITY_CACHE_ENABLED, DmRankRatingImpl.class, dmRankRating.getPrimaryKey(), dmRankRating); dmRankRating.resetOriginalValues(); } /** * Caches the dm rank ratings in the entity cache if it is enabled. * * @param dmRankRatings the dm rank ratings */ public void cacheResult(List<DmRankRating> dmRankRatings) { for (DmRankRating dmRankRating : dmRankRatings) { if (EntityCacheUtil.getResult( DmRankRatingModelImpl.ENTITY_CACHE_ENABLED, DmRankRatingImpl.class, dmRankRating.getPrimaryKey()) == null) { cacheResult(dmRankRating); } else { dmRankRating.resetOriginalValues(); } } } /** * Clears the cache for all dm rank ratings. * * <p> * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method. * </p> */ @Override public void clearCache() { if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) { CacheRegistryUtil.clear(DmRankRatingImpl.class.getName()); } EntityCacheUtil.clearCache(DmRankRatingImpl.class.getName()); FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY); FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); } /** * Clears the cache for the dm rank rating. * * <p> * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method. * </p> */ @Override public void clearCache(DmRankRating dmRankRating) { EntityCacheUtil.removeResult(DmRankRatingModelImpl.ENTITY_CACHE_ENABLED, DmRankRatingImpl.class, dmRankRating.getPrimaryKey()); FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); } @Override public void clearCache(List<DmRankRating> dmRankRatings) { FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); for (DmRankRating dmRankRating : dmRankRatings) { EntityCacheUtil.removeResult(DmRankRatingModelImpl.ENTITY_CACHE_ENABLED, DmRankRatingImpl.class, dmRankRating.getPrimaryKey()); } } /** * Creates a new dm rank rating with the primary key. Does not add the dm rank rating to the database. * * @param id the primary key for the new dm rank rating * @return the new dm rank rating */ public DmRankRating create(int id) { DmRankRating dmRankRating = new DmRankRatingImpl(); dmRankRating.setNew(true); dmRankRating.setPrimaryKey(id); return dmRankRating; } /** * Removes the dm rank rating with the primary key from the database. Also notifies the appropriate model listeners. * * @param id the primary key of the dm rank rating * @return the dm rank rating that was removed * @throws vn.gt.dao.danhmuc.NoSuchDmRankRatingException if a dm rank rating with the primary key could not be found * @throws SystemException if a system exception occurred */ public DmRankRating remove(int id) throws NoSuchDmRankRatingException, SystemException { return remove(Integer.valueOf(id)); } /** * Removes the dm rank rating with the primary key from the database. Also notifies the appropriate model listeners. * * @param primaryKey the primary key of the dm rank rating * @return the dm rank rating that was removed * @throws vn.gt.dao.danhmuc.NoSuchDmRankRatingException if a dm rank rating with the primary key could not be found * @throws SystemException if a system exception occurred */ @Override public DmRankRating remove(Serializable primaryKey) throws NoSuchDmRankRatingException, SystemException { Session session = null; try { session = openSession(); DmRankRating dmRankRating = (DmRankRating)session.get(DmRankRatingImpl.class, primaryKey); if (dmRankRating == null) { if (_log.isWarnEnabled()) { _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } throw new NoSuchDmRankRatingException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(dmRankRating); } catch (NoSuchDmRankRatingException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } @Override protected DmRankRating removeImpl(DmRankRating dmRankRating) throws SystemException { dmRankRating = toUnwrappedModel(dmRankRating); Session session = null; try { session = openSession(); BatchSessionUtil.delete(session, dmRankRating); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } clearCache(dmRankRating); return dmRankRating; } @Override public DmRankRating updateImpl( vn.gt.dao.danhmuc.model.DmRankRating dmRankRating, boolean merge) throws SystemException { dmRankRating = toUnwrappedModel(dmRankRating); boolean isNew = dmRankRating.isNew(); DmRankRatingModelImpl dmRankRatingModelImpl = (DmRankRatingModelImpl)dmRankRating; Session session = null; try { session = openSession(); BatchSessionUtil.update(session, dmRankRating, merge); dmRankRating.setNew(false); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); if (isNew || !DmRankRatingModelImpl.COLUMN_BITMASK_ENABLED) { FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); } else { if ((dmRankRatingModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RANKCODE.getColumnBitmask()) != 0) { Object[] args = new Object[] { dmRankRatingModelImpl.getOriginalRankCode() }; FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RANKCODE, args); FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RANKCODE, args); args = new Object[] { dmRankRatingModelImpl.getRankCode() }; FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_RANKCODE, args); FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RANKCODE, args); } } EntityCacheUtil.putResult(DmRankRatingModelImpl.ENTITY_CACHE_ENABLED, DmRankRatingImpl.class, dmRankRating.getPrimaryKey(), dmRankRating); return dmRankRating; } protected DmRankRating toUnwrappedModel(DmRankRating dmRankRating) { if (dmRankRating instanceof DmRankRatingImpl) { return dmRankRating; } DmRankRatingImpl dmRankRatingImpl = new DmRankRatingImpl(); dmRankRatingImpl.setNew(dmRankRating.isNew()); dmRankRatingImpl.setPrimaryKey(dmRankRating.getPrimaryKey()); dmRankRatingImpl.setId(dmRankRating.getId()); dmRankRatingImpl.setRankCode(dmRankRating.getRankCode()); dmRankRatingImpl.setRankName(dmRankRating.getRankName()); dmRankRatingImpl.setRankNameVN(dmRankRating.getRankNameVN()); dmRankRatingImpl.setRankOrder(dmRankRating.getRankOrder()); dmRankRatingImpl.setIsDelete(dmRankRating.getIsDelete()); dmRankRatingImpl.setMarkedAsDelete(dmRankRating.getMarkedAsDelete()); dmRankRatingImpl.setModifiedDate(dmRankRating.getModifiedDate()); dmRankRatingImpl.setRequestedDate(dmRankRating.getRequestedDate()); dmRankRatingImpl.setSyncVersion(dmRankRating.getSyncVersion()); return dmRankRatingImpl; } /** * Returns the dm rank rating with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found. * * @param primaryKey the primary key of the dm rank rating * @return the dm rank rating * @throws com.liferay.portal.NoSuchModelException if a dm rank rating with the primary key could not be found * @throws SystemException if a system exception occurred */ @Override public DmRankRating findByPrimaryKey(Serializable primaryKey) throws NoSuchModelException, SystemException { return findByPrimaryKey(((Integer)primaryKey).intValue()); } /** * Returns the dm rank rating with the primary key or throws a {@link vn.gt.dao.danhmuc.NoSuchDmRankRatingException} if it could not be found. * * @param id the primary key of the dm rank rating * @return the dm rank rating * @throws vn.gt.dao.danhmuc.NoSuchDmRankRatingException if a dm rank rating with the primary key could not be found * @throws SystemException if a system exception occurred */ public DmRankRating findByPrimaryKey(int id) throws NoSuchDmRankRatingException, SystemException { DmRankRating dmRankRating = fetchByPrimaryKey(id); if (dmRankRating == null) { if (_log.isWarnEnabled()) { _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + id); } throw new NoSuchDmRankRatingException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + id); } return dmRankRating; } /** * Returns the dm rank rating with the primary key or returns <code>null</code> if it could not be found. * * @param primaryKey the primary key of the dm rank rating * @return the dm rank rating, or <code>null</code> if a dm rank rating with the primary key could not be found * @throws SystemException if a system exception occurred */ @Override public DmRankRating fetchByPrimaryKey(Serializable primaryKey) throws SystemException { return fetchByPrimaryKey(((Integer)primaryKey).intValue()); } /** * Returns the dm rank rating with the primary key or returns <code>null</code> if it could not be found. * * @param id the primary key of the dm rank rating * @return the dm rank rating, or <code>null</code> if a dm rank rating with the primary key could not be found * @throws SystemException if a system exception occurred */ public DmRankRating fetchByPrimaryKey(int id) throws SystemException { DmRankRating dmRankRating = (DmRankRating)EntityCacheUtil.getResult(DmRankRatingModelImpl.ENTITY_CACHE_ENABLED, DmRankRatingImpl.class, id); if (dmRankRating == _nullDmRankRating) { return null; } if (dmRankRating == null) { Session session = null; boolean hasException = false; try { session = openSession(); dmRankRating = (DmRankRating)session.get(DmRankRatingImpl.class, Integer.valueOf(id)); } catch (Exception e) { hasException = true; throw processException(e); } finally { if (dmRankRating != null) { cacheResult(dmRankRating); } else if (!hasException) { EntityCacheUtil.putResult(DmRankRatingModelImpl.ENTITY_CACHE_ENABLED, DmRankRatingImpl.class, id, _nullDmRankRating); } closeSession(session); } } return dmRankRating; } /** * Returns all the dm rank ratings where rankCode = &#63;. * * @param rankCode the rank code * @return the matching dm rank ratings * @throws SystemException if a system exception occurred */ public List<DmRankRating> findByRankCode(String rankCode) throws SystemException { return findByRankCode(rankCode, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the dm rank ratings where rankCode = &#63;. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param rankCode the rank code * @param start the lower bound of the range of dm rank ratings * @param end the upper bound of the range of dm rank ratings (not inclusive) * @return the range of matching dm rank ratings * @throws SystemException if a system exception occurred */ public List<DmRankRating> findByRankCode(String rankCode, int start, int end) throws SystemException { return findByRankCode(rankCode, start, end, null); } /** * Returns an ordered range of all the dm rank ratings where rankCode = &#63;. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param rankCode the rank code * @param start the lower bound of the range of dm rank ratings * @param end the upper bound of the range of dm rank ratings (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching dm rank ratings * @throws SystemException if a system exception occurred */ public List<DmRankRating> findByRankCode(String rankCode, int start, int end, OrderByComparator orderByComparator) throws SystemException { FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_RANKCODE; finderArgs = new Object[] { rankCode }; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_RANKCODE; finderArgs = new Object[] { rankCode, start, end, orderByComparator }; } List<DmRankRating> list = (List<DmRankRating>)FinderCacheUtil.getResult(finderPath, finderArgs, this); if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(3 + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_DMRANKRATING_WHERE); if (rankCode == null) { query.append(_FINDER_COLUMN_RANKCODE_RANKCODE_1); } else { if (rankCode.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_RANKCODE_RANKCODE_3); } else { query.append(_FINDER_COLUMN_RANKCODE_RANKCODE_2); } } if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { query.append(DmRankRatingModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (rankCode != null) { qPos.add(rankCode); } list = (List<DmRankRating>)QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { if (list == null) { FinderCacheUtil.removeResult(finderPath, finderArgs); } else { cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } closeSession(session); } } return list; } /** * Returns the first dm rank rating in the ordered set where rankCode = &#63;. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param rankCode the rank code * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the first matching dm rank rating * @throws vn.gt.dao.danhmuc.NoSuchDmRankRatingException if a matching dm rank rating could not be found * @throws SystemException if a system exception occurred */ public DmRankRating findByRankCode_First(String rankCode, OrderByComparator orderByComparator) throws NoSuchDmRankRatingException, SystemException { List<DmRankRating> list = findByRankCode(rankCode, 0, 1, orderByComparator); if (list.isEmpty()) { StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("rankCode="); msg.append(rankCode); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchDmRankRatingException(msg.toString()); } else { return list.get(0); } } /** * Returns the last dm rank rating in the ordered set where rankCode = &#63;. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param rankCode the rank code * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the last matching dm rank rating * @throws vn.gt.dao.danhmuc.NoSuchDmRankRatingException if a matching dm rank rating could not be found * @throws SystemException if a system exception occurred */ public DmRankRating findByRankCode_Last(String rankCode, OrderByComparator orderByComparator) throws NoSuchDmRankRatingException, SystemException { int count = countByRankCode(rankCode); List<DmRankRating> list = findByRankCode(rankCode, count - 1, count, orderByComparator); if (list.isEmpty()) { StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("rankCode="); msg.append(rankCode); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchDmRankRatingException(msg.toString()); } else { return list.get(0); } } /** * Returns the dm rank ratings before and after the current dm rank rating in the ordered set where rankCode = &#63;. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param id the primary key of the current dm rank rating * @param rankCode the rank code * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the previous, current, and next dm rank rating * @throws vn.gt.dao.danhmuc.NoSuchDmRankRatingException if a dm rank rating with the primary key could not be found * @throws SystemException if a system exception occurred */ public DmRankRating[] findByRankCode_PrevAndNext(int id, String rankCode, OrderByComparator orderByComparator) throws NoSuchDmRankRatingException, SystemException { DmRankRating dmRankRating = findByPrimaryKey(id); Session session = null; try { session = openSession(); DmRankRating[] array = new DmRankRatingImpl[3]; array[0] = getByRankCode_PrevAndNext(session, dmRankRating, rankCode, orderByComparator, true); array[1] = dmRankRating; array[2] = getByRankCode_PrevAndNext(session, dmRankRating, rankCode, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected DmRankRating getByRankCode_PrevAndNext(Session session, DmRankRating dmRankRating, String rankCode, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(6 + (orderByComparator.getOrderByFields().length * 6)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_DMRANKRATING_WHERE); if (rankCode == null) { query.append(_FINDER_COLUMN_RANKCODE_RANKCODE_1); } else { if (rankCode.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_RANKCODE_RANKCODE_3); } else { query.append(_FINDER_COLUMN_RANKCODE_RANKCODE_2); } } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(DmRankRatingModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); if (rankCode != null) { qPos.add(rankCode); } if (orderByComparator != null) { Object[] values = orderByComparator.getOrderByConditionValues(dmRankRating); for (Object value : values) { qPos.add(value); } } List<DmRankRating> list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the dm rank ratings. * * @return the dm rank ratings * @throws SystemException if a system exception occurred */ public List<DmRankRating> findAll() throws SystemException { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the dm rank ratings. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param start the lower bound of the range of dm rank ratings * @param end the upper bound of the range of dm rank ratings (not inclusive) * @return the range of dm rank ratings * @throws SystemException if a system exception occurred */ public List<DmRankRating> findAll(int start, int end) throws SystemException { return findAll(start, end, null); } /** * Returns an ordered range of all the dm rank ratings. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param start the lower bound of the range of dm rank ratings * @param end the upper bound of the range of dm rank ratings (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of dm rank ratings * @throws SystemException if a system exception occurred */ public List<DmRankRating> findAll(int start, int end, OrderByComparator orderByComparator) throws SystemException { FinderPath finderPath = null; Object[] finderArgs = new Object[] { start, end, orderByComparator }; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL; finderArgs = FINDER_ARGS_EMPTY; } else { finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL; finderArgs = new Object[] { start, end, orderByComparator }; } List<DmRankRating> list = (List<DmRankRating>)FinderCacheUtil.getResult(finderPath, finderArgs, this); if (list == null) { StringBundler query = null; String sql = null; if (orderByComparator != null) { query = new StringBundler(2 + (orderByComparator.getOrderByFields().length * 3)); query.append(_SQL_SELECT_DMRANKRATING); appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); sql = query.toString(); } else { sql = _SQL_SELECT_DMRANKRATING.concat(DmRankRatingModelImpl.ORDER_BY_JPQL); } Session session = null; try { session = openSession(); Query q = session.createQuery(sql); if (orderByComparator == null) { list = (List<DmRankRating>)QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); } else { list = (List<DmRankRating>)QueryUtil.list(q, getDialect(), start, end); } } catch (Exception e) { throw processException(e); } finally { if (list == null) { FinderCacheUtil.removeResult(finderPath, finderArgs); } else { cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } closeSession(session); } } return list; } /** * Removes all the dm rank ratings where rankCode = &#63; from the database. * * @param rankCode the rank code * @throws SystemException if a system exception occurred */ public void removeByRankCode(String rankCode) throws SystemException { for (DmRankRating dmRankRating : findByRankCode(rankCode)) { remove(dmRankRating); } } /** * Removes all the dm rank ratings from the database. * * @throws SystemException if a system exception occurred */ public void removeAll() throws SystemException { for (DmRankRating dmRankRating : findAll()) { remove(dmRankRating); } } /** * Returns the number of dm rank ratings where rankCode = &#63;. * * @param rankCode the rank code * @return the number of matching dm rank ratings * @throws SystemException if a system exception occurred */ public int countByRankCode(String rankCode) throws SystemException { Object[] finderArgs = new Object[] { rankCode }; Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_RANKCODE, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(2); query.append(_SQL_COUNT_DMRANKRATING_WHERE); if (rankCode == null) { query.append(_FINDER_COLUMN_RANKCODE_RANKCODE_1); } else { if (rankCode.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_RANKCODE_RANKCODE_3); } else { query.append(_FINDER_COLUMN_RANKCODE_RANKCODE_2); } } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (rankCode != null) { qPos.add(rankCode); } count = (Long)q.uniqueResult(); } catch (Exception e) { throw processException(e); } finally { if (count == null) { count = Long.valueOf(0); } FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_RANKCODE, finderArgs, count); closeSession(session); } } return count.intValue(); } /** * Returns the number of dm rank ratings. * * @return the number of dm rank ratings * @throws SystemException if a system exception occurred */ public int countAll() throws SystemException { Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY, this); if (count == null) { Session session = null; try { session = openSession(); Query q = session.createQuery(_SQL_COUNT_DMRANKRATING); count = (Long)q.uniqueResult(); } catch (Exception e) { throw processException(e); } finally { if (count == null) { count = Long.valueOf(0); } FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY, count); closeSession(session); } } return count.intValue(); } /** * Initializes the dm rank rating persistence. */ public void afterPropertiesSet() { String[] listenerClassNames = StringUtil.split(GetterUtil.getString( com.liferay.util.service.ServiceProps.get( "value.object.listener.vn.gt.dao.danhmuc.model.DmRankRating"))); if (listenerClassNames.length > 0) { try { List<ModelListener<DmRankRating>> listenersList = new ArrayList<ModelListener<DmRankRating>>(); for (String listenerClassName : listenerClassNames) { listenersList.add((ModelListener<DmRankRating>)InstanceFactory.newInstance( listenerClassName)); } listeners = listenersList.toArray(new ModelListener[listenersList.size()]); } catch (Exception e) { _log.error(e); } } } public void destroy() { EntityCacheUtil.removeCache(DmRankRatingImpl.class.getName()); FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY); FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); } @BeanReference(type = DmArrivalPurposePersistence.class) protected DmArrivalPurposePersistence dmArrivalPurposePersistence; @BeanReference(type = DmDocTypePersistence.class) protected DmDocTypePersistence dmDocTypePersistence; @BeanReference(type = DmEnterrisePersistence.class) protected DmEnterrisePersistence dmEnterrisePersistence; @BeanReference(type = DmGoodsPersistence.class) protected DmGoodsPersistence dmGoodsPersistence; @BeanReference(type = DmGoodsTypePersistence.class) protected DmGoodsTypePersistence dmGoodsTypePersistence; @BeanReference(type = DmHistoryArrivalPurposePersistence.class) protected DmHistoryArrivalPurposePersistence dmHistoryArrivalPurposePersistence; @BeanReference(type = DmHistoryDocTypePersistence.class) protected DmHistoryDocTypePersistence dmHistoryDocTypePersistence; @BeanReference(type = DmHistoryEnterrisePersistence.class) protected DmHistoryEnterrisePersistence dmHistoryEnterrisePersistence; @BeanReference(type = DmHistoryGoodsPersistence.class) protected DmHistoryGoodsPersistence dmHistoryGoodsPersistence; @BeanReference(type = DmHistoryGoodsTypePersistence.class) protected DmHistoryGoodsTypePersistence dmHistoryGoodsTypePersistence; @BeanReference(type = DmHistoryMaritimePersistence.class) protected DmHistoryMaritimePersistence dmHistoryMaritimePersistence; @BeanReference(type = DmHistoryPackagePersistence.class) protected DmHistoryPackagePersistence dmHistoryPackagePersistence; @BeanReference(type = DmHistoryPassportTypePersistence.class) protected DmHistoryPassportTypePersistence dmHistoryPassportTypePersistence; @BeanReference(type = DmHistoryPortPersistence.class) protected DmHistoryPortPersistence dmHistoryPortPersistence; @BeanReference(type = DmHistoryPortHarbourPersistence.class) protected DmHistoryPortHarbourPersistence dmHistoryPortHarbourPersistence; @BeanReference(type = DmHistoryPortRegionPersistence.class) protected DmHistoryPortRegionPersistence dmHistoryPortRegionPersistence; @BeanReference(type = DmHistoryPortWharfPersistence.class) protected DmHistoryPortWharfPersistence dmHistoryPortWharfPersistence; @BeanReference(type = DmHistoryRankRatingPersistence.class) protected DmHistoryRankRatingPersistence dmHistoryRankRatingPersistence; @BeanReference(type = DmHistoryRepresentativePersistence.class) protected DmHistoryRepresentativePersistence dmHistoryRepresentativePersistence; @BeanReference(type = DmHistorySecurityLevelPersistence.class) protected DmHistorySecurityLevelPersistence dmHistorySecurityLevelPersistence; @BeanReference(type = DmHistoryShipAgencyPersistence.class) protected DmHistoryShipAgencyPersistence dmHistoryShipAgencyPersistence; @BeanReference(type = DmHistoryShipTypePersistence.class) protected DmHistoryShipTypePersistence dmHistoryShipTypePersistence; @BeanReference(type = DmHistoryStatePersistence.class) protected DmHistoryStatePersistence dmHistoryStatePersistence; @BeanReference(type = DmHistoryUnitGeneralPersistence.class) protected DmHistoryUnitGeneralPersistence dmHistoryUnitGeneralPersistence; @BeanReference(type = DmMaritimePersistence.class) protected DmMaritimePersistence dmMaritimePersistence; @BeanReference(type = DmPackagePersistence.class) protected DmPackagePersistence dmPackagePersistence; @BeanReference(type = DmPassportTypePersistence.class) protected DmPassportTypePersistence dmPassportTypePersistence; @BeanReference(type = DmPortPersistence.class) protected DmPortPersistence dmPortPersistence; @BeanReference(type = DmPortHarbourPersistence.class) protected DmPortHarbourPersistence dmPortHarbourPersistence; @BeanReference(type = DmPortRegionPersistence.class) protected DmPortRegionPersistence dmPortRegionPersistence; @BeanReference(type = DmPortWharfPersistence.class) protected DmPortWharfPersistence dmPortWharfPersistence; @BeanReference(type = DmRankRatingPersistence.class) protected DmRankRatingPersistence dmRankRatingPersistence; @BeanReference(type = DmRepresentativePersistence.class) protected DmRepresentativePersistence dmRepresentativePersistence; @BeanReference(type = DmSecurityLevelPersistence.class) protected DmSecurityLevelPersistence dmSecurityLevelPersistence; @BeanReference(type = DmShipAgencyPersistence.class) protected DmShipAgencyPersistence dmShipAgencyPersistence; @BeanReference(type = DmShipTypePersistence.class) protected DmShipTypePersistence dmShipTypePersistence; @BeanReference(type = DmStatePersistence.class) protected DmStatePersistence dmStatePersistence; @BeanReference(type = DmSyncCategoryPersistence.class) protected DmSyncCategoryPersistence dmSyncCategoryPersistence; @BeanReference(type = DmTestN01RequestPersistence.class) protected DmTestN01RequestPersistence dmTestN01RequestPersistence; @BeanReference(type = DmUnitGeneralPersistence.class) protected DmUnitGeneralPersistence dmUnitGeneralPersistence; @BeanReference(type = HistoryRmdcShipPersistence.class) protected HistoryRmdcShipPersistence historyRmdcShipPersistence; @BeanReference(type = HistorySyncVersionPersistence.class) protected HistorySyncVersionPersistence historySyncVersionPersistence; @BeanReference(type = RmdcShipPersistence.class) protected RmdcShipPersistence rmdcShipPersistence; @BeanReference(type = ResourcePersistence.class) protected ResourcePersistence resourcePersistence; @BeanReference(type = UserPersistence.class) protected UserPersistence userPersistence; private static final String _SQL_SELECT_DMRANKRATING = "SELECT dmRankRating FROM DmRankRating dmRankRating"; private static final String _SQL_SELECT_DMRANKRATING_WHERE = "SELECT dmRankRating FROM DmRankRating dmRankRating WHERE "; private static final String _SQL_COUNT_DMRANKRATING = "SELECT COUNT(dmRankRating) FROM DmRankRating dmRankRating"; private static final String _SQL_COUNT_DMRANKRATING_WHERE = "SELECT COUNT(dmRankRating) FROM DmRankRating dmRankRating WHERE "; private static final String _FINDER_COLUMN_RANKCODE_RANKCODE_1 = "dmRankRating.rankCode IS NULL"; private static final String _FINDER_COLUMN_RANKCODE_RANKCODE_2 = "dmRankRating.rankCode = ?"; private static final String _FINDER_COLUMN_RANKCODE_RANKCODE_3 = "(dmRankRating.rankCode IS NULL OR dmRankRating.rankCode = ?)"; private static final String _ORDER_BY_ENTITY_ALIAS = "dmRankRating."; private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No DmRankRating exists with the primary key "; private static final String _NO_SUCH_ENTITY_WITH_KEY = "No DmRankRating exists with the key {"; private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = GetterUtil.getBoolean(PropsUtil.get( PropsKeys.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE)); private static Log _log = LogFactoryUtil.getLog(DmRankRatingPersistenceImpl.class); private static DmRankRating _nullDmRankRating = new DmRankRatingImpl() { @Override public Object clone() { return this; } @Override public CacheModel<DmRankRating> toCacheModel() { return _nullDmRankRatingCacheModel; } }; private static CacheModel<DmRankRating> _nullDmRankRatingCacheModel = new CacheModel<DmRankRating>() { public DmRankRating toEntityModel() { return _nullDmRankRating; } }; }
[ "longdm10@gmail.com" ]
longdm10@gmail.com
5fe235a544e81ffc1a171f1b0922363e78b9b64a
ad2d5bab381793ff1704fd9b9505d99c92311097
/app/src/androidTest/java/com/example/aryan/filehandlingdemo/ExampleInstrumentedTest.java
9883ca728a5a5df94d00450ca508ac44f6f76da2
[]
no_license
Abhijeet-pardeshi/fragmentAssignment
149920f2971321df19faeb919d6768b6f9a0a3ba
b2f0c25009d400686cf12a568cbcd831406ba057
refs/heads/master
2021-06-28T15:12:32.758718
2017-09-18T16:07:01
2017-09-18T16:07:01
103,489,235
0
0
null
null
null
null
UTF-8
Java
false
false
772
java
package com.example.aryan.filehandlingdemo; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation 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() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.aryan.filehandlingdemo", appContext.getPackageName()); } }
[ "pardeshimanjeet66666666@gmail.com" ]
pardeshimanjeet66666666@gmail.com
9c472ff6850967670e43719c3b55bc4288c46484
1e80f218ea6c0c9619d97be5d85fae76f544d1a4
/src/main/java/com/zhou/jvm/TestUseTLAB.java
cb6b683e63ce6e4e6fbf0fc50b5e41f6f88a7ac1
[]
no_license
gouyan123/jvm
038e76730be788765f24358659dcd3fe22285296
a8e0695d2e86f05cb2a793141d0c5959d25d9067
refs/heads/master
2020-04-25T08:51:12.369137
2019-05-06T09:03:24
2019-05-06T09:03:24
172,659,967
0
0
null
null
null
null
UTF-8
Java
false
false
411
java
package com.zhou.jvm; public class TestUseTLAB { public static void allocdemo(){ byte[] by = new byte[2]; by[0] = 1; } public static void main(String[] args){ long startTime = System.currentTimeMillis(); for(int i = 0;i<10000000;i++){ allocdemo(); } long endTime = System.currentTimeMillis(); System.out.println(endTime-startTime); } }
[ "2637178209@qq.com" ]
2637178209@qq.com
fd1a0ce0db39dc622b2ba8e35da49dbac88feb4c
f57886e09ee5f8990a6a686bc3d05ada14dbc569
/Day04_Inheritance_Ploymorphism/src/cn/edu/henau/Inheritancde/This/Demo_01_This.java
47afba2345d8264e80bec58b808bebf17e4fc30d
[]
no_license
Qihao97/basic_code
53c5a1821d18dff998c4302ece8ac221f4e853b6
9d704b2d8258b1645a29812c1e6636959892a4ff
refs/heads/master
2020-09-05T03:38:22.021702
2020-07-01T05:20:58
2020-07-01T05:20:58
219,970,464
0
0
null
null
null
null
UTF-8
Java
false
false
1,235
java
package cn.edu.henau.Inheritancde.This; /* * super关键字用以访问父类的内容,而this关键字用以访问本类的内容,用法也有三种: * 1.在本类的成员方法中,访问本类的成员变量(典型用法) * 2.在本类的成员方法中,访问本类的另一个成员方法 * 3.在本类的构造方法中,访问本类的另一个构造方法, * 但是 this()必须是构造方法的第一句 * this()和super()不能够同时存在于同一个构造方法中 * */ public class Demo_01_This { public static void main(String[] args) { This_Father_Class father = new This_Father_Class(); father.printNum(); System.out.println("-------------------------------"); This_Son_Class son = new This_Son_Class(); son.printNum(); son.printFatherNum(); System.out.println("-----------------------------"); son.methodSon(); System.out.println("------********************--------------"); System.out.println("创建一个无参的子类:"); This_Son_Class son1 = new This_Son_Class(); System.out.println("创建一个含参的子类:"); This_Son_Class son2 = new This_Son_Class(300); } }
[ "qihao_97@126.com" ]
qihao_97@126.com
8001acc8ce2174687add4559519943298255258e
dbef96a5d70593813fd72d7d3181553244697724
/src/main/java/com/arounders/web/dto/BufferMap.java
63a16c334d5ac737051b0a37b4d697a7eec53944
[]
no_license
rhacnddl/web
fd4aaaf397a30dcbb1fc74c189212ea7abb0ba36
4afb5413c043d036804c9832b94aac6905e76406
refs/heads/master
2023-06-19T22:19:54.156527
2021-07-16T15:58:55
2021-07-16T15:58:55
375,638,835
0
0
null
null
null
null
UTF-8
Java
false
false
175
java
package com.arounders.web.dto; import org.springframework.stereotype.Component; import java.util.HashMap; @Component public class BufferMap<K, V> extends HashMap<K, V> { }
[ "jiho519@naver.com" ]
jiho519@naver.com
c86552a7f36d5cbf7117b41194474265860de82b
5f3e4621878b9b4bb06d7e3b90d38ae304f672ab
/core/src/com/packtub/libgdx/westerm/Westerm.java
6eea8ea3e173c50a677e607c1b36df70d4f8c09e
[]
no_license
Elfino48/Westerm
797e113c9831e4f179a7ebc4797dd1cfca954096
044be51e10212bf838f43b340dceaac39fa0a5b9
refs/heads/master
2020-03-22T20:39:42.179756
2018-07-11T20:36:16
2018-07-11T20:36:16
140,619,651
0
0
null
null
null
null
UTF-8
Java
false
false
701
java
package com.packtub.libgdx.westerm; import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; public class Westerm extends ApplicationAdapter { SpriteBatch batch; Texture img; @Override public void create () { batch = new SpriteBatch(); img = new Texture("core/assets/badlogic.jpg"); } @Override public void render () { Gdx.gl.glClearColor(1, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); batch.draw(img, 0, 0); batch.end(); } @Override public void dispose () { batch.dispose(); img.dispose(); } }
[ "MilitaryCat48@gmail.com" ]
MilitaryCat48@gmail.com
fc351256c5d170640266b61ff555d3be71237d21
52b948436b826df8164565ffe69e73a92eb92cda
/Tests/RGTTests/bears/patches/SzFMV2018-Tavasz-AutomatedCar_351742666-351759763/Arja/144/patch/Dashboard.java
f2b593f5a57eef2fbbe67ad8ad13d741d488fbdb
[]
no_license
tdurieux/ODSExperiment
910365f1388bc684e9916f46f407d36226a2b70b
3881ef06d6b8d5efb751860811def973cb0220eb
refs/heads/main
2023-07-05T21:30:30.099605
2021-08-18T15:56:56
2021-08-18T15:56:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,886
java
package hu.oe.nik.szfmv.visualization; import hu.oe.nik.szfmv.automatedcar.bus.packets.input.ReadOnlyInputPacket; import javax.swing.*; import java.awt.*; /** * Dashboard shows the state of the ego car, thus helps in debugging. */ public class Dashboard extends JPanel { private final int width = 250; private final int height = 700; private final int dashboardBoundsX = 770; private final int dashboardBoundsY = 0; private final int backgroundColor = 0x888888; private final int progressBarsPanelX = 25; private final int progressBarsPanelY = 400; private final int progressBarsPanelWidth = 200; private final int progressBarsPanelHeight = 100; private final JPanel progressBarsPanel = new JPanel(); private final JLabel gasLabel = new JLabel(); private final JProgressBar gasProgressBar = new JProgressBar(); private final JLabel breakLabel = new JLabel(); private final JProgressBar breakProgressBar = new JProgressBar(); private final int speedMeterX = 10; private final int speedMeterY = 50; private final int tachoMeterX = 130; private final int tachoMeterY = 50; private final int meterHeight = 100; private final int meterWidth = 100; private int speedAngle; private int rpmAngle; /** * Initialize the dashboard */ public Dashboard() { initializeDashboard(); } /** * Update the displayed values * @param inputPacket Contains all the required values coming from input. */ public void updateDisplayedValues(ReadOnlyInputPacket inputPacket) { gasProgressBar.setValue(inputPacket.getGasPedalPosition()); breakProgressBar.setValue(inputPacket.getBreakPedalPosition()); speedAngle = calculateSpeedometer(0); rpmAngle = calculateTachometer(0); speedAngle = calculateSpeedometer(0); } /** * Initializes the dashboard components */ private void initializeDashboard() { // Not using any layout manager, but fixed coordinates setLayout(null); setBackground(new Color(backgroundColor)); setBounds(dashboardBoundsX, dashboardBoundsY, width, height); initializeProgressBars(); } /** * Initializes the progress bars on the dashboard */ private void initializeProgressBars() { progressBarsPanel.setBackground(new Color(backgroundColor)); progressBarsPanel.setBounds( progressBarsPanelX, progressBarsPanelY, progressBarsPanelWidth, progressBarsPanelHeight); gasLabel.setText("gas pedal"); breakLabel.setText("break pedal"); gasProgressBar.setStringPainted(true); breakProgressBar.setStringPainted(true); add(progressBarsPanel); progressBarsPanel.add(gasLabel); progressBarsPanel.add(gasProgressBar); progressBarsPanel.add(breakLabel); progressBarsPanel.add(breakProgressBar); } /** * Drawing the Speedometer and the Tachometer. * * @param g {@link Graphics} object that can draw to the canvas */ protected void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.BLACK); g.drawOval(speedMeterX, speedMeterY, meterWidth, meterHeight); g.drawOval(tachoMeterX, tachoMeterY, meterWidth, meterHeight); g.setColor(Color.RED); g.fillArc(speedMeterX, speedMeterY, meterWidth, meterHeight, speedAngle, 2); g.fillArc(tachoMeterX, tachoMeterY, meterWidth, meterHeight, rpmAngle, 2); } /** * Map the RPM to a displayable value for the gauge. * * @param rpm The unmapped input value of the Tachometer's visual display. * * @return The mapped value between [-75, 255] interval. */ private int calculateTachometer(int rpm) { final int minRpmValue = 0; final int maxRpmValue = 10000; final int minRpmMeter = -75; gasLabel.setText("gas pedal"); final int maxRpmMeter = 255; int newrpm = maxRpmValue - rpm; return (newrpm - minRpmValue) * (maxRpmMeter - minRpmMeter) / (maxRpmValue - minRpmValue) + minRpmMeter; } /** * Map the Speed to a displayable value for the gauge. * * @param speed The unmapped input value of the Speedometer's visual display. * * @return The mapped value between [-75, 255] interval. */ private int calculateSpeedometer(int speed) { final int minSpeedValue = 0; final int maxSpeedValue = 500; final int minSpeedMeter = -75; final int maxSpeedMeter = 255; int newspeed = maxSpeedValue - speed; return (newspeed - minSpeedValue) * (maxSpeedMeter - minSpeedMeter) / (maxSpeedValue - minSpeedValue) + minSpeedMeter; } }
[ "he_ye_90s@hotmail.com" ]
he_ye_90s@hotmail.com
5ccb06ec829ac1bd74209e9c23769f0903023ff7
9f34a4aa5e95393be83c67380aae3af8bf58916f
/src/main.java
838898c6c0848a21baafaee4bb98843a68deea1f
[]
no_license
MartiCorbalan/controlador-aeri-java
10cb44d220428816c4317a0d81cda96b05fe2a48
729fcb32f4265dac8cd8909bd1b857e7cddb5aef
refs/heads/master
2023-01-20T18:40:07.169605
2020-11-30T22:08:23
2020-11-30T22:08:23
313,049,388
0
0
null
null
null
null
UTF-8
Java
false
false
15,157
java
import javax.security.auth.callback.CallbackHandler; import java.util.ArrayList; import java.util.InputMismatchException; import java.util.Scanner; public class main { public static void main(String[] args) { main Start = new main(); Start.Principal(); } Scanner m = new Scanner(System.in); ArrayList<AvioGeneral> espaiAeri = new ArrayList<AvioGeneral>(); AvioGeneral AvioGeneral = new AvioGeneral(); String[][] arrayInfo = new String[10][10]; String guardarmodel; String guardarMarca; String guardarorigen; String guardardesti; String guardarcoordenadesX; String getGuardarcoordenadesY; public void Principal() { int opcio; boolean sortir = false; String esriure; while (!sortir) { menuPrincipal(); try { System.out.println("Escriu una de les opcions "); opcio = m.nextInt(); switch (opcio) { case 1 -> generarAvio(); case 2 -> GestionarAvions(); case 3 -> mostrarinfo(); case 4 -> xifrar(); case 5 -> desxifrar(); case 6 -> { sortir = true; System.out.println("El joc s'ha acabau."); return; } } } catch (InputMismatchException e) { } } } public void menuPrincipal() { System.out.println("1.Afegir un avió "); System.out.println("2.Gestionar un avió "); System.out.println("3.Mostrar info "); System.out.println("4.Xifrar els aviones de combat "); System.out.println("5.Desxifrar els avions de combat "); System.out.println("6.Sortir"); } //indiquem si podem crear un avio o no public boolean checkPista() { for (AvioGeneral check : espaiAeri) { if (check != null) { if (check.getCoordenadesX() == 100 && check.getCoordenadesY() == 100) { return false; } } } return true; } public void generarAvio() { if (checkPista()) { System.out.println("Introdueix la matricula del avió"); String matricula = m.next(); System.out.println("Introdueix la marca del avió: "); String model = m.next(); System.out.println("Introdueix el model del avió: "); String marca = m.next(); System.out.println("Introdueix el fabricant: "); String fabricant = m.next(); System.out.println("Introdueix la capacitat de emmagatzematge: "); int capacitat = m.nextInt(); System.out.println("Introdueix la quantitat de tripulants: "); int tripulants = m.nextInt(); System.out.println("Introdueix el origen: "); String origen = m.next(); System.out.println("Introdueix el destí: "); String desti = m.next(); System.out.println("Introdueix la autonomia del avió: "); int autonomia = m.nextInt(); System.out.println("COMERCIAL"); System.out.println("MILITAR"); String opcio = m.next(); //passem totes les dades necessaries per crear un avio. switch (opcio.toUpperCase()) { case "COMERCIAL" -> { AvioComercial Comercial = new AvioComercial(matricula, marca, model, fabricant, capacitat, tripulants, origen, desti, 100, 100, autonomia, 0, false, 0, 0, true); espaiAeri.add(Comercial); } case "MILITAR" -> { System.out.println("bandol del avio, ALIAT o ENEMIC? "); opcio = m.next(); switch (opcio.toUpperCase()) { case "ALIAT" -> { AvioMilitar AvionMilitar = new AvioMilitar(matricula, marca, model, fabricant, capacitat, tripulants, origen, desti, 100, 100, autonomia, 0, false, 0, 0, true, 0, true, false); espaiAeri.add(AvionMilitar); } case "ENEMIC" -> { AvioMilitar AvionMilitar = new AvioMilitar(matricula, marca, model, fabricant, capacitat, tripulants, origen, desti, 100, 100, autonomia, 0, false, 0, 0, true, 0, false, false); espaiAeri.add(AvionMilitar); } } } } //indiquem que com a maxim podem tenir 11 avions } else if (!checkPista()) { if (espaiAeri.size() == 11) { System.out.println("No pots crear més avions"); } System.out.println("No pots crear més avions, la pista esta plena "); } System.out.println("✈✈✈✈✈✈"); } //gestionem els avions, per poguer crear un avio primer has de gestionar el que has creat abans, un cop gestionat ja pots crear mes avions public void GestionarAvions() { if (espaiAeri.size() == 0) { System.out.println("no hi ha cap avio, no pots crear res"); } else { String matricula; System.out.println("Introdueix la matricula de l'avió: "); matricula = m.next(); for (int i = 0; i < espaiAeri.size(); i++) { AvioGeneral verify = espaiAeri.get(i); if (verify != null) { if (matricula.equals(verify.getMatricula())) { String opcion; boolean salir = false; while (!salir) { System.out.println("-------------------------------------"); System.out.println("Escolleix el mode: "); System.out.println("Motor"); System.out.println("velocitat"); System.out.println("Altura_i_Baixada"); System.out.println("TREN-ATERRATGE"); System.out.println("Rumb"); System.out.println("Posicionar"); System.out.println("Misils"); System.out.println("SORTIR"); System.out.println("-------------------------------------"); try { System.out.println("Escriu una de les opcions"); opcion = m.next(); switch (opcion.toUpperCase()) { case "MOTOR" -> { espaiAeri = espaiAeri.get(i).Gestionarmotor(espaiAeri, i); } case "VELOCITAT" -> { espaiAeri = espaiAeri.get(i).GestionarVelocitat(espaiAeri, i); } case "ALTURA" -> { espaiAeri = espaiAeri.get(i).GestionarPujarAlturaiBaixarAltura(espaiAeri, i); } case "TRENATERRATGE" -> { espaiAeri = espaiAeri.get(i).GestionarTrenAterratge(espaiAeri, i); } case "RUMB" -> { espaiAeri = espaiAeri.get(i).GestionarRumb(espaiAeri, i); } case "POSICIONAR" -> { espaiAeri = espaiAeri.get(i).GestionarCoordenades(espaiAeri, i); } case "MISILS" -> { espaiAeri = espaiAeri.get(i).DispararMissils(espaiAeri, i); } case "SORTIR" -> { salir = true; System.out.println("Has sortit del menú de gestió d'avions "); return; } default -> System.out.println("Error, torna a introduir el mode de nou. "); } } catch (InputMismatchException | InterruptedException e) { System.out.println("Has d'insertar una opció correcte ."); m.next(); } } } else { System.out.println("No s'ha trobat cap avió amb aquesta matricula"); } } } } } public void taulaInfo() { //mostrem la taula d'informació en l'ordre correcte System.out.println("matricula marca model origen desti coordenadesX coordenadesY motor velocitat alcada "); int contador = 0; int contador2 = 0; for (int i = 0; i < arrayInfo.length && contador < espaiAeri.size(); i++) { contador2 = 0; for (int j = 0; j < arrayInfo.length && contador < espaiAeri.size() && contador2 != 2; j++) { arrayInfo[i][j] = espaiAeri.get(contador).getMatricula(); arrayInfo[i][j + 1] = espaiAeri.get(contador).getMarca(); arrayInfo[i][j + 2] = espaiAeri.get(contador).getModel(); arrayInfo[i][j + 3] = espaiAeri.get(contador).getOrigen(); arrayInfo[i][j + 4] = espaiAeri.get(contador).getDesti(); arrayInfo[i][j + 5] = String.valueOf(espaiAeri.get(contador).getCoordenadesX()); arrayInfo[i][j + 6] = String.valueOf(espaiAeri.get(contador).getCoordenadesY()); if (espaiAeri.get(contador).getMotor() == false) { arrayInfo[i][j + 7] = "TANCAT"; } else { if (espaiAeri.get(contador).getMotor() == true) { arrayInfo[i][j + 7] = "OBERT"; } } arrayInfo[i][j + 8] = String.valueOf(espaiAeri.get(contador).getVelocitat()); arrayInfo[i][j + 9] = String.valueOf(espaiAeri.get(contador).getAlcada()); contador++; contador2 = 2; } System.out.println(); } } //mostrem la informacio dintre de la taula public void mostrarinfo(){ taulaInfo(); for (int t=0; t<espaiAeri.size(); t++){ System.out.print("numero avio " + t + "\t"); for (int c=0; c<arrayInfo.length; c++){ System.out.print(arrayInfo[t][c] + "\t\t"); } System.out.println(); } } public void xifrar() { int xifrar=0; String matricula; String guardarmodel2; String guardarMarca2; String guardarorigen2; String guardardesti2; System.out.println("Introdueix la matricula de l'avió: "); matricula = m.next(); //recorrem l'array per trobar l'avio correcte for (int m = 0; m < espaiAeri.size(); m++) { //comprovem la matricula if (espaiAeri.get(m).getMatricula().equalsIgnoreCase(matricula)) { xifrar = m; } else { System.out.println("no hi ha cap avio amb aquesta matricula"); AvioGeneral verify = espaiAeri.get(m); } } //posem el model dintre de l'array guardarmodel2 = espaiAeri.get(xifrar).getModel(); guardarMarca2 = espaiAeri.get(xifrar).getMarca(); guardarorigen2 = espaiAeri.get(xifrar).getOrigen(); guardardesti2 = espaiAeri.get(xifrar).getDesti(); //model dintre de array per xifrar char xifrarCoses[] = guardarmodel2.toCharArray(); char xifrarMarca[] = guardarMarca2.toCharArray(); char xifrarorigen[] = guardarorigen2.toCharArray(); char xifrardesti[] = guardardesti2.toCharArray(); for (int i = 0; i < 2; i++){ //si la posicio es correcte xifrem el model, i posem per cada lletre li sumem 5 xifrarMarca[i]=(char)(xifrarMarca[i] + (char)10); xifrarCoses[i]=(char)(xifrarCoses[i] + (char)10); xifrarorigen[i]=(char)(xifrarorigen[i] + (char)10); xifrardesti[i]=(char)(xifrardesti[i] + (char)10); } //enseñem que el model s'ha xifrat guardarmodel = String.valueOf(xifrarCoses); espaiAeri.get(xifrar).setModel(guardarmodel); guardarMarca = String.valueOf(xifrarMarca); espaiAeri.get(xifrar).setMarca(guardarMarca); guardarorigen = String.valueOf(xifrarorigen); espaiAeri.get(xifrar).setOrigen(guardarorigen); guardardesti = String.valueOf(xifrardesti); espaiAeri.get(xifrar).setDesti(guardardesti); } public void desxifrar(){ int desxifrar=0; String matricula; System.out.println("Introdueix la matricula de l'avió: "); matricula = m.next(); for (int i = 0; i < espaiAeri.size(); i++) { if (espaiAeri.get(i).getMatricula().equalsIgnoreCase(matricula)) { desxifrar = i; } else { System.out.println("no hi ha cap avio amb aquesta matricula"); AvioGeneral verify = espaiAeri.get(i); } } char desxifrarCoses[] = guardarmodel.toCharArray(); char desxifrarMarca[] = guardarMarca.toCharArray(); char desxifrarorigen[] = guardarorigen.toCharArray(); char desxifrardesti[] = guardardesti.toCharArray(); for (int i=0; i< 2; i++){ //restem les 5 lletres posades quan xifrem perque la paraula es quedi igual desxifrarMarca[i]=(char)(desxifrarMarca[i] - (char)10); desxifrarCoses[i]=(char)(desxifrarCoses[i] - (char)10); desxifrarorigen[i]=(char)(desxifrarorigen[i] - (char)10); desxifrardesti[i]=(char)(desxifrardesti[i] - (char)10); } guardarmodel = String.valueOf(desxifrarCoses); espaiAeri.get(desxifrar).setModel(guardarmodel); guardarMarca = String.valueOf(desxifrarMarca); espaiAeri.get(desxifrar).setMarca(guardarMarca); guardarorigen = String.valueOf(desxifrarorigen); espaiAeri.get(desxifrar).setOrigen(guardarorigen); guardardesti = String.valueOf(desxifrardesti); espaiAeri.get(desxifrar).setDesti(guardardesti); } }
[ "marti.corbalan@mataro.epiaedu.cat" ]
marti.corbalan@mataro.epiaedu.cat
ecfbcef7ba9ff9d27f198b634890a31cc858bf30
d106cbebe75280239cde2378c5f28a198df5cf6e
/polymer/GraphControl.java
148f66611db051bb3b5db664ae0437b4ce0a4969
[]
no_license
qvn/LivingPolymerJason
04d2e953b56a30d8eefdaca9304dcbb88473acdf
eb6ef1e20bb2d59b71a5bfa9a10611863701f140
refs/heads/master
2021-05-28T13:02:48.160319
2011-10-11T15:52:28
2011-10-11T15:52:28
2,509,747
1
0
null
null
null
null
UTF-8
Java
false
false
2,197
java
package polymer; public class GraphControl { static double Io = 1; static double Mo = 100; static double ki = 1; static double kp = 100; static double r = kp / ki; static double R = Math.abs(r-1); // Calculate Max time // Method provide function for Ri private static double Rm=0.001; static double Ri=Ri(); private static double ti=ti(); // Bisection method to find Ri - copied from http://www.physics.unlv.edu/~pang/cp2_j.html private static double Ri() { double del = 0.00001, a = 0, b = 1, x=0; double result; double dx = b-a; while (Math.abs(dx) > del) { x = (a+b)/2; if ((f(a)*f(x)) < 0) { b = x; dx = b-a; } else { a = x; dx = b-a; } } if(x==(a+b)/2) { x=0; //This is to prevent if no root exist at Rm=0.001, if that is the //case then all Ri has been gone a long time ago. } result =x; return result; } private static double f(double x) { return Mo/Io*(Rm-1)-(1-r)*(x-1)-r*Math.log(x); //return Math.exp(Mo/Io*(Rm-1))/Math.exp((1-r)*(x-1))-r*x; } //Calculate time private static double ti() { double result = -Math.log(Rm)/(ki*Io*Ri+kp*Io*(1-Ri)); return result; } //Calculate Degree of Polymerization Mean private static int xe(){ double L=((Mo-0)-(Io-Io*Ri)*(1-r))/(Io*r); int xe=(int) (r*L); if (xe==0 | xe==1) {xe=2;} return xe; } public static int xe=xe(); //This gives more time to see the curve level off static double sc=(ti)/100; public static double getSc(){ return sc; } public static double getIo() { return Io; } public static double getMo(){ return Mo; } public static double getki() { return ki; } public static double getkp(){ return kp; } public static double getr(){ return r; } public static double getR() { return R; } }
[ "ma65p2004@gmail.com" ]
ma65p2004@gmail.com
50392fb71fa13196665de6706c4d15484e69ac17
fdf34663e7c5f842d3e7b9cbf9e8da7e16e7c673
/java8-features/src/test/java/jbr/java8/AppTest.java
725e2bf60eff3f38fb6008890b18f201ee674fe7
[]
no_license
dalalsunil1986/java
7a52716e86f6cf7695ef49c68f28703d2a4f5423
d568ca0c534612c03c828699ac367133307eb6b6
refs/heads/master
2020-05-15T23:04:17.961528
2018-01-23T18:41:10
2018-01-23T18:41:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
637
java
package jbr.java8; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
[ "java2ranjith@gmail.com" ]
java2ranjith@gmail.com
45dfad15f10db2e7b802ac2eba1cd51628884ce4
c955d5020b870a42d94965e95336c77c629bd070
/topics/airbnb/AlienDictionary2.java
4664fb8d5fb911f1fbc3d6b2853bd32e5a6e98c1
[]
no_license
yongred/algorithm
ff597f533a9df82c9af12c41bf90b70df9e3cfdb
0e957b33bcc039d811e5e503a2c0729db887edf4
refs/heads/master
2022-10-15T22:21:00.049082
2022-09-21T22:51:08
2022-09-21T22:51:08
157,635,182
1
1
null
null
null
null
UTF-8
Java
false
false
4,771
java
/** Follow up: print all possible paths 892. Alien Dictionary There is a new alien language which uses the latin alphabet. However, the order among letters are unknown to you. You receive a list of non-empty words from the dictionary, where words are sorted lexicographically by the rules of this new language. Derive the order of letters in this language. 第一轮是给一堆按某种方式排序好的单词,让你猜字母顺序,返回任意方案,解法就是每个字母是图中的点,构建有向图,然后做拓扑排序,bfs或者dfs都行。follow up是给出所有可能的方案,这里就需要dfs来枚举拓扑排序中每次选哪个点,记得回溯的时候恢复之前的选择。 Example Given the following words in dictionary, [ "wrt", "wrf", "er", "ett", "rftt" ] The correct order is: "wertf" Given the following words in dictionary, [ "z", "x" ] The correct order is: "zx". Notice You may assume all letters are in lowercase. You may assume that if a is a prefix of b, then a must appear before b in the given dictionary. If the order is invalid, return an empty string. */ /* Solution: Backtracking, reset visited, list, and its adj indegrees. Ex: "caa", "daa", "bcc", "bee", "baa", "baag", "baaa" c -> d -> b -> e -> a g -> a How to Arrive: * Key: a unrelated node can intersect the other nodes not related at any time. * Becomes a permutation of the unrelated nodes problem while preserving the order of directly connected. * We know that 0 indegrees nodes (No Edge between) are not directly related, so they can order in diff combos. * Now with those 0 indegrees, as we visited(removed) them parents, we removed the edge of its adj direct children. * Which means their children are disconnected (parent edge removed). And there for they can order int diff combos. * And we can do that layer by layer just like BFS. Algorithm: * Build a graph with indegrees; * Backtrack Helper: graph, list of curOrder. * Loop through each vertices (keys): * Find indegree0 nodes, and Not visited: * add to visited * add to curOrderList * remove this node and edges to adjs, by all adj node indegrees-1; (created new indepent graphs) * Now we want to traverse all combos in the graph without curChoosedNode. * After done with curNode, we want to try another node for curPos, Backtracking. * reset curChar from visited, curOrderList, and reset its adj indegrees+1. (recover its paths unvisited); * When curOrderList/visited == vertices/keys; We find a order to Print out. * If never find a order, Cycle. * Time: O(n!); all permutations. * Space: O(n!); all permutations. */ import java.io.*; import java.util.*; public class AlienDictionary2 { /** * Solution: Backtracking, reset visited, list, and its adj indegrees. * Time: O(n!); all permutations. * Space: O(n!); all permutations. */ public void findOrders(String[] words) { Map<Character, Set<Character>> graph = new HashMap<>(); buildGraph(graph, words); helper(graph, new ArrayList<>()); } int[] indegrees = new int[26]; HashSet<Character> visited = new HashSet<>(); public void helper(Map<Character, Set<Character>> graph, ArrayList<Character> list) { for (char key : graph.keySet()) { if (!visited.contains(key) && indegrees[key - 'a'] == 0) { visited.add(key); list.add(key); for (char adj : graph.get(key)) { indegrees[adj - 'a']--; } helper(graph, list); // backtrack, remove curChar from visited, list, and reset its adj indegrees. visited.remove(key); list.remove(list.size() - 1); for (char adj : graph.get(key)) { indegrees[adj - 'a']++; } } } if (list.size() == graph.size()) { list.forEach(curChar -> { System.out.print(curChar); }); System.out.println(); } } public void buildGraph(Map<Character, Set<Character>> graph, String[] words) { // -1 indicates char not in graph. Arrays.fill(indegrees, -1); for (String word : words) { for (char c : word.toCharArray()) { graph.put(c, new HashSet<>()); indegrees[c - 'a'] = 0; } } // connect edges for (int i = 0; i < words.length - 1; i++) { String w1 = words[i]; String w2 = words[i + 1]; int len = Math.min(w1.length(), w2.length()); for (int j = 0; j < len; j++) { // 2 chars char larger = w1.charAt(j); char smaller = w2.charAt(j); if (larger != smaller) { // find a order, smaller->larger, dfs larger visit first. graph.get(larger).add(smaller); indegrees[smaller - 'a']++; break; } } } } public static void main(String[] args) { AlienDictionary2 obj = new AlienDictionary2(); String[] words = new String[] {"caa", "daa", "bcc", "bee", "baa", "baag", "baaa"}; obj.findOrders(words); } }
[ "yongding@live.com" ]
yongding@live.com
27e70e538b545abfc1e5787adeaddd89af1db8eb
60282a55340d75325bb96e95e86381a12d66c006
/src/main/java/io/webfolder/cdp/command/ServiceWorkerImpl.java
df54d244887c5c7a7a9128aa1fb944711fb393f5
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
Billesper/cdp4j
f7aee808f5d1833d83b113bd63f2ed61cbb3abb9
d94a69195b4e8874f42e30dc69b97b61dade4015
refs/heads/master
2022-11-25T16:23:51.822342
2020-08-03T18:34:41
2020-08-03T18:34:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,406
java
/** * cdp4j Commercial License * * Copyright 2017, 2020 WebFolder OÜ * * Permission is hereby granted, to "____" obtaining a copy of this software and * associated documentation files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, modify, merge, * publish, distribute and sublicense of the Software, and to permit persons to whom * the Software is furnished to do so, subject to the following conditions: * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package io.webfolder.cdp.command; import io.webfolder.cdp.session.SessionInvocationHandler; import io.webfolder.cdp.command.ServiceWorker; public class ServiceWorkerImpl implements ServiceWorker { private static final Object[] EMPTY_VALUES = new Object[]{}; private static final String[] EMPTY_ARGS = new String[]{}; private final SessionInvocationHandler handler; public ServiceWorkerImpl(SessionInvocationHandler handler) { this.handler = handler; } @Override public void deliverPushMessage(String origin, String registrationId, String data) { handler.invoke("ServiceWorker", "deliverPushMessage", "ServiceWorker.deliverPushMessage", null, void.class, null, true, false, false, new String[]{"origin", "registrationId", "data"}, new Object[]{origin, registrationId, data}); } @Override public void disable() { handler.invoke("ServiceWorker", "disable", "ServiceWorker.disable", null, void.class, null, true, false, true, EMPTY_ARGS, EMPTY_VALUES); } @Override public void dispatchSyncEvent(String origin, String registrationId, String tag, Boolean lastChance) { handler.invoke("ServiceWorker", "dispatchSyncEvent", "ServiceWorker.dispatchSyncEvent", null, void.class, null, true, false, false, new String[]{"origin", "registrationId", "tag", "lastChance"}, new Object[]{origin, registrationId, tag, lastChance}); } @Override public void dispatchPeriodicSyncEvent(String origin, String registrationId, String tag) { handler.invoke("ServiceWorker", "dispatchPeriodicSyncEvent", "ServiceWorker.dispatchPeriodicSyncEvent", null, void.class, null, true, false, false, new String[]{"origin", "registrationId", "tag"}, new Object[]{origin, registrationId, tag}); } @Override public void enable() { handler.invoke("ServiceWorker", "enable", "ServiceWorker.enable", null, void.class, null, true, true, false, EMPTY_ARGS, EMPTY_VALUES); } @Override public void inspectWorker(String versionId) { handler.invoke("ServiceWorker", "inspectWorker", "ServiceWorker.inspectWorker", null, void.class, null, true, false, false, new String[]{"versionId"}, new Object[]{versionId}); } @Override public void setForceUpdateOnPageLoad(Boolean forceUpdateOnPageLoad) { handler.invoke("ServiceWorker", "setForceUpdateOnPageLoad", "ServiceWorker.setForceUpdateOnPageLoad", null, void.class, null, true, false, false, new String[]{"forceUpdateOnPageLoad"}, new Object[]{forceUpdateOnPageLoad}); } @Override public void skipWaiting(String scopeURL) { handler.invoke("ServiceWorker", "skipWaiting", "ServiceWorker.skipWaiting", null, void.class, null, true, false, false, new String[]{"scopeURL"}, new Object[]{scopeURL}); } @Override public void startWorker(String scopeURL) { handler.invoke("ServiceWorker", "startWorker", "ServiceWorker.startWorker", null, void.class, null, true, false, false, new String[]{"scopeURL"}, new Object[]{scopeURL}); } @Override public void stopAllWorkers() { handler.invoke("ServiceWorker", "stopAllWorkers", "ServiceWorker.stopAllWorkers", null, void.class, null, true, false, false, EMPTY_ARGS, EMPTY_VALUES); } @Override public void stopWorker(String versionId) { handler.invoke("ServiceWorker", "stopWorker", "ServiceWorker.stopWorker", null, void.class, null, true, false, false, new String[]{"versionId"}, new Object[]{versionId}); } @Override public void unregister(String scopeURL) { handler.invoke("ServiceWorker", "unregister", "ServiceWorker.unregister", null, void.class, null, true, false, false, new String[]{"scopeURL"}, new Object[]{scopeURL}); } @Override public void updateRegistration(String scopeURL) { handler.invoke("ServiceWorker", "updateRegistration", "ServiceWorker.updateRegistration", null, void.class, null, true, false, false, new String[]{"scopeURL"}, new Object[]{scopeURL}); } }
[ "support@webfolder.io" ]
support@webfolder.io
5c9d973487ea4527ce339d25d9ea1b50e3267070
fafa122ce8d0c26e4d7d04df688375bc7038a268
/src/Basic_problems/Main.java
5534d2753c6c2dc40fe8d937899a683fb2f7c109
[]
no_license
vamseevk2001/java_programs
a8c0cd78ccfea49f4973ac2d29a38ca04f737fa3
d2a85710bf3b45ca7cec7d19cc61bfeea7e891e7
refs/heads/master
2023-04-27T02:07:47.089154
2021-05-22T12:23:41
2021-05-22T12:23:41
359,457,663
0
0
null
null
null
null
UTF-8
Java
false
false
546
java
package Basic_problems; import java.util.ArrayList; import java.util.Scanner; public class Main { public static void main (String[] args) throws java.lang.Exception { // your code goes here Scanner sc = new Scanner(System.in); int n = sc.nextInt(); ArrayList<Integer> arr = new ArrayList<>(); while(sc.hasNextInt()){ int a = sc.nextInt(); arr.add(a); } for (int i = 0; i<arr.size(); i++){ System.out.print(arr.get(i)+" "); } } }
[ "vamseevk2001@gmail.cmo" ]
vamseevk2001@gmail.cmo
b67cddd0833bf910b593951285501adad02140d0
135573410399ddf2036840a0b08f753c38353c3a
/service-consumer/src/main/java/org/example/remote/HelloRemoteHystrix.java
900e75fde00194b36186fc7da42f972c38160dde
[]
no_license
gitwds12/cloud-demo
90923b72d2a4b35f99e4f17b8d396a7e1c18ba1a
ac6f25594db05acc6622704c1f6716a088e7d9de
refs/heads/master
2023-01-12T08:26:13.680103
2020-11-09T01:54:03
2020-11-09T01:54:03
311,196,377
0
0
null
null
null
null
UTF-8
Java
false
false
361
java
package org.example.remote; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.RequestParam; @Component public class HelloRemoteHystrix implements HelloRemote { @Override public String hello(@RequestParam(value = "name") String name) { return "hello " +name+", this message send failed "; } }
[ "137436896@qq.com" ]
137436896@qq.com
ec647eaf151df350db5dc7784d04e22f49a6b004
4eb4c9e0e79377792d5987fe75007512b350cbf3
/MongoDB/src/sgdi/pr3/grupo03/situacion2/menus/episode/InsertEpisode.java
bd04938d8d2569636cd7496bf26252f0530a5b35
[ "MIT" ]
permissive
gorkinovich/SGDI
ad5e9490aa18cb2c5961023c33dc44b04dac413b
21f23c58be8a1996ceea59303a0a1663fcc1dacd
refs/heads/master
2022-06-10T21:41:18.887840
2022-06-08T14:13:51
2022-06-08T14:13:51
49,701,983
0
0
null
null
null
null
UTF-8
Java
false
false
2,788
java
//------------------------------------------------------------------------------------------ // SGDI, Práctica 3, Grupo 3 // Rotaru, Dan Cristian // Suárez García, Gorka // // Declaración de integridad: Ámbos dos declaramos que el código del proyecto // es fruto exclusivamente del trabajo de sus miembros. //------------------------------------------------------------------------------------------ package sgdi.pr3.grupo03.situacion2.menus.episode; import org.bson.types.ObjectId; import sgdi.pr3.grupo03.shared.ConsoleUtil; import sgdi.pr3.grupo03.shared.CustomReferenceFieldInput; import sgdi.pr3.grupo03.shared.ReferenceFieldType; import sgdi.pr3.grupo03.situacion2.DBHelper; import sgdi.pr3.grupo03.situacion2.menus.Menu; import sgdi.pr3.grupo03.situacion2.menus.control.ChooseAction; import sgdi.pr3.grupo03.situacion2.menus.control.MainMenu; import sgdi.pr3.grupo03.situacion2.model.Episode; import sgdi.pr3.grupo03.situacion2.model.Season; import sgdi.pr3.grupo03.situacion2.model.Series; public class InsertEpisode extends Menu<Void> { @Override public Void draw() { try { Episode episode = ConsoleUtil.getObject(Episode.class, new CustomReferenceFieldInput() { @Override public ObjectId getReference( ReferenceFieldType refFieldType, String offset) { System.out .println(offset + "Inserta el título de la serie en la que estará el episodio que vas a insertar."); String seriesTitle = ConsoleUtil.getString(); Series series = DBHelper .getOneSeriesByTitle(seriesTitle); if (series == null) { System.out .println(offset + "No se ha encontrado ninguna serie con título " + seriesTitle); return null; } System.out .println(offset + "Inserta el año de estreno de la temporada en la que estará el episodio."); int year = ConsoleUtil.getInt(); Season season = DBHelper.getSeasonByYear( series._id, year); if (season == null) { System.out .println(offset + "No se ha encontrado ninguna temporada con año de estreno " + year + " de la serie" + seriesTitle); return null; } return season._id; } }); if (episode.seasonIdRef == null || !DBHelper.insertEpisode(episode)) { System.out .println("El episodio no se ha añadido correctamente."); controller.setMenu(ChooseAction.class, Episode.class); return null; } else { System.out.println("El episodio se ha añadido correctamente."); } } catch (Exception e) { e.printStackTrace(); } controller.setMenu(MainMenu.class); return null; } @Override public void input(Void option) { } }
[ "gorkasg@yahoo.es" ]
gorkasg@yahoo.es
6e435161307cc1a5d63ffff1bed4a0ce05f138ae
a370ff524a6e317488970dac65d93a727039f061
/archive/unsorted/2020.06/2020.06.18 - Codeforces - Codeforces Global Round 8/DANDORAndSquareSum.java
950592e089a674df843a8c3f28995219bbc9bcaf
[]
no_license
taodaling/contest
235f4b2a033ecc30ec675a4526e3f031a27d8bbf
86824487c2e8d4fc405802fff237f710f4e73a5c
refs/heads/master
2023-04-14T12:41:41.718630
2023-04-10T14:12:47
2023-04-10T14:12:47
213,876,299
9
1
null
2021-06-12T06:33:05
2019-10-09T09:28:43
Java
UTF-8
Java
false
false
963
java
package contest; import template.binary.Bits; import template.io.FastInput; import template.io.FastOutput; public class DANDORAndSquareSum { public void solve(int testNumber, FastInput in, FastOutput out) { int n = in.readInt(); int[] a = new int[n]; in.populate(a); int[] cnts = new int[20]; for (int x : a) { for (int j = 0; j < 20; j++) { cnts[j] += Bits.get(x, j); } } long sum = 0; while (true) { long max = 0; for (int i = 0; i < 20; i++) { if (cnts[i] > 0) { max |= 1 << i; } } if(max == 0){ break; } sum += max * max; for (int i = 0; i < 20; i++) { if (cnts[i] > 0) { cnts[i]--; } } } out.println(sum); } }
[ "taodaling@gmail.com" ]
taodaling@gmail.com
c19708170d79926bb0c4c237efa5225493e929b6
1205317e549311e0dc3f5b206b2e749f0508aade
/src/main/java/pl/kowalczuk/springauth/security/CustomUserDetailsService.java
5308ca011f130d4fa2c4f0d6e445b7f85cc8dc4d
[]
no_license
Czad3r/spring-oauth
d60c8ca2e455c992b818686dfadab9ab60d10a53
e1f2587c5b1e9ab0e23f278264da64df5e93e342
refs/heads/master
2020-09-14T04:21:05.063245
2019-11-27T18:43:26
2019-11-27T18:43:26
223,016,207
0
0
null
null
null
null
UTF-8
Java
false
false
1,376
java
package pl.kowalczuk.springauth.security; import pl.kowalczuk.springauth.exception.ResourceNotFoundException; import pl.kowalczuk.springauth.model.User; import pl.kowalczuk.springauth.repository.UserRepository; 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; @Service public class CustomUserDetailsService implements UserDetailsService { @Autowired UserRepository userRepository; @Override @Transactional public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException { User user = userRepository.findByEmail(email) .orElseThrow(() -> new UsernameNotFoundException("User not found with email : " + email) ); return UserPrincipal.create(user); } @Transactional public UserDetails loadUserById(Long id) { User user = userRepository.findById(id).orElseThrow( () -> new ResourceNotFoundException("User", "id", id) ); return UserPrincipal.create(user); } }
[ "czader98@poczta.fm" ]
czader98@poczta.fm
fb19fd975b6c90e619cb963f76e033aa116f7d10
a1466c8b2b332f60d1c52983152b42233d154d2a
/part11-Part11_12.SensorsAndTemperature/src/main/java/application/AverageSensor.java
51b902c2e6867cb596edb1a7dada960e2a514a73
[]
no_license
todd-demone/java-prg-ii
3821ff2938dd8cad04e24144c330032244b7fbf2
507ea8fac7768987f75889a4b6eb32090cc58f4b
refs/heads/main
2023-02-10T10:28:50.808523
2021-01-08T14:47:58
2021-01-08T14:47:58
307,177,361
0
0
null
null
null
null
UTF-8
Java
false
false
1,248
java
package application; import java.util.List; import java.util.ArrayList; public class AverageSensor implements Sensor { private List<Sensor> sensors; private List<Integer> avgReadings; public AverageSensor() { sensors = new ArrayList<>(); avgReadings = new ArrayList<>(); } public void addSensor(Sensor toAdd) { sensors.add(toAdd); } public boolean isOn() { for (Sensor sensor : sensors) { if (!sensor.isOn()) { return false; } } return true; } public void setOn() { for (Sensor sensor : sensors) { sensor.setOn(); } } public void setOff() { for (Sensor sensor : sensors) { sensor.setOff(); } } public int read() { if (sensors.isEmpty() || !this.isOn()) { throw new IllegalStateException(); } int total = 0; for (Sensor sensor : sensors) { total += sensor.read(); } int average = total / sensors.size(); avgReadings.add(average); return average; } public List<Integer> readings() { return this.avgReadings; } }
[ "tdemone1@gmail.com" ]
tdemone1@gmail.com
c29a864ecb284d7732ddb3af5a2f81dce8acbc6f
93067edb7a4a10eee653cd974376ef1161ce7073
/src/main/java/br/com/agftec/entidades/ICMS50.java
14623330452c91cea2e23cf2cb2b76ac83812c6b
[]
no_license
renangtm/ERP_VAREJO
4ab2a063890a045c7123838f895a3364d352fb21
bda779adc414876bac76852e895166abf6ea961a
refs/heads/master
2020-09-07T21:03:13.677746
2019-11-11T06:06:13
2019-11-11T06:06:13
220,912,223
0
0
null
null
null
null
UTF-8
Java
false
false
1,583
java
package br.com.agftec.entidades; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; @Entity public class ICMS50 extends Icms { @Column private double valorIcmsDesonerado; @Column @Enumerated(EnumType.ORDINAL) private MotivoDesoneracao motivo; @OneToOne(fetch = FetchType.EAGER) @JoinColumn(name = "id_icms_original") private Icms icmsOriginal; public ICMS50() { super(); this.setCst("50"); } public Icms getIcmsOriginal() { return icmsOriginal; } public void setIcmsOriginal(Icms icmsOriginal) { this.icmsOriginal = icmsOriginal; } public MotivoDesoneracao getMotivo() { return motivo; } public void setMotivo(MotivoDesoneracao motivo) { this.motivo = motivo; } // ----------- @Override public double getValorIcmsDesonerado() { return valorIcmsDesonerado; } @Override public void calcularSobre(double valor) { this.valorIcmsDesonerado = 0; if (this.icmsOriginal != null) { this.icmsOriginal.calcularSobre(valor); this.valorIcmsDesonerado = this.icmsOriginal.getValorIcms() + this.icmsOriginal.getValorIcmsDesonerado(); } } @Override public Object clone() { ICMS50 i = new ICMS50(); i.setOrigem(this.getOrigem()); if(this.icmsOriginal != null) i.icmsOriginal = (Icms) this.icmsOriginal.clone(); i.motivo = this.motivo; i.valorIcmsDesonerado = this.valorIcmsDesonerado; return i; } }
[ "renan_goncalves@outlook.com.br" ]
renan_goncalves@outlook.com.br
9f5c20a7ba236e4c980b5d938d2c8e0249101129
359a496acdcf4fd3ca55ae3c181c3533841c8313
/src/cn/itheima/gjp/dao/LedgerDao.java
7cc1bdb573768349a9e9c7b15c239a9a6d3f4a17
[]
no_license
1944462162/curriculum-design-gjp
c64f49fc784cd65ccc83dfe3ad6327d363f1ce91
17b011d325d4a74f004207b0d2ec0807a91b989f
refs/heads/master
2020-06-07T13:59:32.086590
2019-06-21T09:19:09
2019-06-21T09:19:09
193,037,636
2
0
null
null
null
null
UTF-8
Java
false
false
6,868
java
package cn.itheima.gjp.dao; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.handlers.BeanListHandler; import com.mysql.jdbc.JDBC4LoadBalancedMySQLConnection; import cn.itheima.gjp.domain.Ledger; import cn.itheima.gjp.tools.JDBCUtils; /* * 操作 数据库gjp_ledger表的 dao层 数据访问层 * * */ public class LedgerDao { //依赖于 QueryRunner去访问数据库 //在成员位置 创建一个QueryRunner QueryRunner qr = new QueryRunner(JDBCUtils.getDataSource()); /** * 查询所有账务信息的方法 * List<Ledger> 返回值的意思是 查询所有的账务信息 并且每一个封装成Ledger对象 * @throws SQLException * */ public List<Ledger> queryAllLedger() throws SQLException{ // sql // String sql = "select * from gjp_ledger"; // 这种sql语句 查询出来的结果 没有 sname 没有分类名称 只有分类id // 有没有这种查法 // 我要的数据 /* * 需要显示的数据 与 对应的表 账务表 gjp_ledger 显示数据 ID 收/支 分类名 金额 账户 创建时间 说明 数据库字段 lid parent sid money account createtime ldesc 账务id 父分类 分类id 金额 账户 创建时间 描述 我们 要的 ID 收/支 金额 账户 创建时间 说明 从gjp_ledger表中获取 我们 要的分类名 从 gjp_sort表中获取 需要两张表 单独获取 可以 low 使用多表查询 能否完成呢? 答案是 可以 怎么做 来到数据库 操作这里 拼接一下 */ String sql = "SELECT l.lid,l.parent,s.sname,l.money,l.account,l.createtime,l.ldesc FROM gjp_sort AS s ,gjp_ledger AS l WHERE s.sid=l.sid"; Object[] params = {}; // 执行sql /* * 结果集选择什么 BeanListHandler */ List<Ledger> list = qr.query(sql, new BeanListHandler<Ledger>(Ledger.class), params); return list; } /** * 根据时间查询 数据库 * 这里面需要注意的是 * 除了时间以外的 其他条件 是 可以有可以没有的 * * 这里面 要执行sql 是需要拼接完成的 * * 四个参数 beginTime endTime parent sname * 返回值 List<Ledger> * * 小概念 集合转换成数组 toArray * @throws SQLException */ // public List<Ledger> queryLedger(String beginTime,String endTime,String parent,String sname) throws SQLException{ // // // // 1:初始化 sql语句 // // 因为在当前 时间 条件是必须写出来的 // // StringBuilder sb = new StringBuilder("select * from gjp_ledger where createTime between ? and ?"); // // //定义一个集合 用来接收参数列表 // ArrayList<Object> plist = new ArrayList<Object>(); // // // 先把 必选的两个? 的值 加到集合中 // plist.add(beginTime); // plist.add(endTime); // // // 根据后面两个条件 完成sql的拼接 // // // 父分类条件拼接 // if(parent.equals("收入")||parent.equals("支出")){ // sb.append("and parent = ?"); // plist.add(parent); // } // // //分类名称拼接 // if(!sname.equals("-请选择-")){ // // 根据sname获取sid // // SortDao sortDao = new SortDao(); // // int sid = sortDao.getIdBySname(sname); // // 这里只能拼接sid 因为 ledger表中没有sname // sb.append("and sid = ?"); // // plist.add(sid); // } // System.out.println("sql拼接后的结果"+sb); // // String sql = sb.toString(); // // Object[] params = plist.toArray(); // // List<Ledger> list = qr.query(sql, new BeanListHandler<>(Ledger.class), params); // // return list; // } // /** * 根据时间查询 数据库 第二种方式 多表方式 * 这里面需要注意的是 * 除了时间以外的 其他条件 是 可以有可以没有的 * * 这里面 要执行sql 是需要拼接完成的 * * 四个参数 beginTime endTime parent sname * 返回值 List<Ledger> * * 小概念 集合转换成数组 toArray * @throws SQLException */ public List<Ledger> queryLedger(String beginTime,String endTime,String parent,String sname) throws SQLException{ // 1:初始化 sql语句 // 因为在当前 时间 条件是必须写出来的 StringBuilder sb = new StringBuilder("select l.lid,l.parent,s.sname,l.money,l.account,l.createtime,l.ldesc FROM gjp_sort AS s ,gjp_ledger AS l WHERE s.sid=l.sid and l.createTime between ? and ?"); //定义一个集合 用来接收参数列表 ArrayList<Object> plist = new ArrayList<Object>(); // 先把 必选的两个? 的值 加到集合中 plist.add(beginTime); plist.add(endTime); // 根据后面两个条件 完成sql的拼接 // 父分类条件拼接 if(parent.equals("收入")||parent.equals("支出")){ sb.append("and l.parent = ?"); plist.add(parent); } //分类名称拼接 if(!sname.equals("-请选择-")){ sb.append("and s.sname = ?"); plist.add(sname); } System.out.println("sql拼接后的结果"+sb); String sql = sb.toString(); Object[] params = plist.toArray(); List<Ledger> list = qr.query(sql, new BeanListHandler<>(Ledger.class), params); return list; } /** * 根据Ledger对象 存储 到数据库表中 * 参数Ledger对象 * @throws SQLException */ public void addLedger(Ledger ledger) throws SQLException{ // sql语句 String sql = "insert into gjp_ledger(parent,money,sid,account,createtime,ldesc)values(?,?,?,?,?,?)"; Object[] params = {ledger.getParent(),ledger.getMoney(),ledger.getSid(),ledger.getAccount(),ledger.getCreatetime(),ledger.getLdesc()}; //执行 qr.update(sql, params); } /** * 定义方法 编辑账务 * 传递Ledger 对象 * @throws SQLException */ public void editLedger(Ledger ledger) throws SQLException{ String sql = "update gjp_ledger set parent=?,money=?,sid=?,account=?,createTime=?,ldesc=? where lid=?"; Object[] params = {ledger.getParent(),ledger.getMoney(),ledger.getSid(),ledger.getAccount(),ledger.getCreatetime(),ledger.getLdesc(),ledger.getLid()}; qr.update(sql, params); } public void deleteById(int lid) throws SQLException { String sql = "delete from gjp_ledger where lid = ?"; Object[] params = {lid}; qr.update(sql, params); } }
[ "1944462162@qq.com" ]
1944462162@qq.com
f1644de2c5bda892d17f05fffb6bc4f93c429e68
b90c400f9f1422d953f3e2b5c4b7a79b9654d653
/src/main/java/com/iaewtpi/ModeloRest/Reserva.java
97547a7e7e204f1fcb06510f15e29b96842bde1b
[]
no_license
FacuRossi/IAEW_TPI_ApiRestReservas
10e6618d2c7b7c5b76f14693d49a7f118ca7a0ba
2ddab4588524c13595494fd859e0693380e19f38
refs/heads/master
2021-01-22T03:54:48.026732
2017-07-06T22:04:58
2017-07-06T22:04:58
92,415,910
0
0
null
null
null
null
UTF-8
Java
false
false
2,316
java
package com.iaewtpi.ModeloRest; import com.fasterxml.jackson.annotation.JsonFormat; import javax.persistence.*; import java.util.Date; /** * Created by Facundo on 25/05/2017. */ @Entity public class Reserva { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @OneToOne @JoinColumn(name="idCliente") private Cliente cliente; @OneToOne @JoinColumn(name="idVendedor") private Vendedor vendedor; @JsonFormat(pattern = "yyyy-MM-dd") private Date fechaDeReserva; private int costo; private int precioVenta; private String estado; private int codigoDeReserva; public Reserva() { } public Reserva(int codigoDeReserva, Cliente cliente, Vendedor vendedor, Date fechaDeReserva, int costo, int precioVenta, String estado) { this.codigoDeReserva = codigoDeReserva; this.cliente = cliente; this.vendedor = vendedor; this.fechaDeReserva = fechaDeReserva; this.costo = costo; this.precioVenta = precioVenta; this.estado = estado; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getCodigoDeReserva() { return codigoDeReserva; } public void setCodigoDeReserva(int codigoDeReserva) { this.codigoDeReserva = codigoDeReserva; } public Cliente getCliente() { return cliente; } public void setCliente(Cliente cliente) { this.cliente = cliente; } public Vendedor getVendedor() { return vendedor; } public void setVendedor(Vendedor vendedor) { this.vendedor = vendedor; } public Date getFechaDeReserva() { return fechaDeReserva; } public void setFechaDeReserva(Date fechaDeReserva) { this.fechaDeReserva = fechaDeReserva; } public int getCosto() { return costo; } public void setCosto(int costo) { this.costo = costo; } public int getPrecioVenta() { return precioVenta; } public void setPrecioVenta(int precioVenta) { this.precioVenta = precioVenta; } public String getEstado() { return estado; } public void setEstado(String estado) { this.estado = estado; } }
[ "rossifacundo94@gmail.com" ]
rossifacundo94@gmail.com
011b58361f8034dc6aa9483df5fbbde5ad6ac3ae
81367ffc17fb5fe0ea599f128ecb403ac4def75f
/sheetmenu/src/test/java/ru/whalemare/sheetmenu/ExampleUnitTest.java
279731f289a29d21569a328565eddf4701243b7c
[ "Apache-2.0" ]
permissive
whalemare/sheetmenu
84085cd40b88ac16ba8587e5392d8b2eb69f8144
1accd21917c59f9b1d56b0c2b92f7cd6bc38bf30
refs/heads/master
2021-08-10T08:22:00.898273
2021-01-19T11:35:21
2021-01-19T11:35:21
92,733,150
136
28
null
2020-11-09T10:38:47
2017-05-29T11:22:18
Kotlin
UTF-8
Java
false
false
417
java
package ru.whalemare.sheetmenu; import org.junit.Test; import static junit.framework.Assert.assertEquals; /** * 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); } }
[ "nanostet@gmail.com" ]
nanostet@gmail.com
8d1f1a17fe1482e8dd72b8de95794525e07bfba7
937335cd31be064f2c77ae8c7a21b2238793d613
/src/leetcode/LRUCache.java
a716cb562dea1791715d18c493e3a512236fe761
[]
no_license
papayamomo/learning
c0d63715883f07d04bd81155633397642125122d
57c3e1338a13ede020754a7501e7172322b9c653
refs/heads/master
2021-06-05T04:15:28.668562
2020-05-13T04:42:08
2020-05-13T04:42:08
21,649,772
0
0
null
null
null
null
UTF-8
Java
false
false
931
java
package leetcode; import java.util.LinkedHashMap; public class LRUCache { LinkedHashMap<Integer, Integer> map = new LinkedHashMap<Integer, Integer>(); int capacity = 0; int counter = 0; public LRUCache(int capacity) { this.capacity = capacity; } public int get(int key) { if (map.containsKey(key)) { int value = map.get(key); map.remove(key); map.put(key, value); return map.get(key); } return -1; } public void set(int key, int value) { if (map.containsKey(key)) { map.remove(key); map.put(key, value); } else { if (counter < capacity) { map.put(key, value); counter++; } else { for (int key1 : map.keySet()) { map.remove(key1); break; } map.put(key, value); } } } public static void main(String[] args) { LRUCache cache = new LRUCache(2); cache.set(2, 6); cache.set(1, 5); cache.set(1, 2); System.out.println(cache.get(2)); } }
[ "papayamomo@gmail.com" ]
papayamomo@gmail.com
f4f0eadab2600217600a2bc7971a7e37a23fc45c
403c812ea97a9eae9b142017b1c9757d45ce6ea9
/src/main/java/com/practice/seleniumdesign/factory/GoogleEnglish.java
fb05c104bbe7f8c4d0e283a4804b0474076499f5
[]
no_license
KundurthiSantosh/Selenium-Design-Patterns
7f58c066ba4b0099b6d7237a3ee3a59265ca4608
24943cb835ea6b64868daeb8aac6163a237cc17e
refs/heads/main
2023-04-24T17:27:54.826622
2021-05-16T09:56:01
2021-05-16T09:56:01
367,090,510
0
0
null
null
null
null
UTF-8
Java
false
false
1,464
java
package com.practice.seleniumdesign.factory; import com.google.common.util.concurrent.Uninterruptibles; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.WebDriverWait; import java.util.List; import java.util.concurrent.TimeUnit; class GoogleEnglish extends GooglePage{ protected WebDriver driver; protected WebDriverWait wait; @FindBy(name = "q") private WebElement searchBox; @FindBy(name = "btnK") private WebElement searchButton; @FindBy(css = "div.g") private List<WebElement> results; public GoogleEnglish(final WebDriver driver){ this.driver = driver; this.wait = new WebDriverWait(driver, 30); PageFactory.initElements(driver, this); } @Override public void launchSite() { this.driver.get("https://www.google.com"); } @Override public void search(String keyWord) { for (char ch: keyWord.toCharArray()) { Uninterruptibles.sleepUninterruptibly(20, TimeUnit.MILLISECONDS); this.searchBox.sendKeys(ch + ""); } this.wait.until(d -> this.searchButton.isDisplayed()); this.searchButton.click(); } @Override public int getResultCount() { this.wait.until(d -> this.results.size() > 1); return this.results.size(); } }
[ "santoshsriram2@gmail.com" ]
santoshsriram2@gmail.com
665a063907991593f5d3d38ea60e599ce26ae2d9
e198a5dc59d2623602c037695f8e01b74ce7d613
/src/main/java/grafo/Trayecto.java
b46516952834caf3868869204de115e570c6d1eb
[]
no_license
giannoniagustin/RecorridoColectivos
c39fe82cba78e9af1889ec3b3a8677c55d8c36e8
412f15ac776b8275598849231e04091cdfab454e
refs/heads/master
2021-01-19T11:09:04.979726
2017-04-20T22:35:23
2017-04-20T22:35:23
87,861,930
0
0
null
null
null
null
UTF-8
Java
false
false
3,600
java
package grafo; import java.util.ArrayList; import java.util.Date; import java.util.Vector; import com.google.maps.DirectionsApi.RouteRestriction; import com.google.maps.DistanceMatrixApi; import com.google.maps.DistanceMatrixApiRequest; import com.google.maps.GeoApiContext; import com.google.maps.errors.ApiException; import com.google.maps.model.DistanceMatrix; import com.google.maps.model.TravelMode; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.LineString; import filtros.Filtro; import filtros.FiltroAlturaIgual; import filtros.FiltroAlturaMayor; import filtros.FiltroAlturaMenor; import filtros.FiltroAnd; import filtros.FiltroCalleIgual; import filtros.FiltroOr; import parser.Parser; import recorrido.Recorrido; public class Trayecto extends ElementoUbicacion { ArrayList<Punto> puntos; Double largo; Double duracion; Parser parser; public Trayecto() { super(); this.parser= new Parser(); } public ArrayList<Punto> getPuntos() { return puntos; } public void setPuntos(ArrayList<Punto> puntos) { this.puntos = puntos; } public Double getDuracion() { return duracion; } public void setDuracion(Double duracion) { this.duracion = duracion; } public Trayecto(ArrayList<Punto> puntos, Double largo, Double duracion) { super(); this.puntos = puntos; this.largo = largo; this.duracion = duracion; this.parser= new Parser(); } private long calcularLargo() { long largoParcial=0; for (int i=0;i < puntos.size()-1;i++) { largoParcial+=puntos.get(i).distancia(puntos.get(i+1)); } return largoParcial; } public Double getLargo() { return largo; } public void setLargo(Double largo) { this.largo = largo; } public void agregarPunto(Punto punto) { puntos.add(punto); } /* public boolean peretenece (Punto punto) { Punto pComienzo= puntos.get(0); Punto pFin = puntos.get(puntos.size()-1); ComparadorPuntoCalle comparadorCalle= new ComparadorPuntoCalle(); ComparadorPuntoAltura comparadorAltura= new ComparadorPuntoAltura(); int calle=comparadorCalle.compare(pComienzo, pFin); int alturMenor=comparadorAltura.compare(pComienzo, punto); int alturamayor=comparadorAltura.compare(pFin, punto); int alturaIgual1=comparadorAltura.compare(pComienzo, punto); int alturaIgual2=comparadorAltura.compare(pFin, punto); if ( (comparadorCalle.compare(pComienzo, pFin)== 0) && ((comparadorAltura.compare(pComienzo, punto)==-1 && comparadorAltura.compare(pFin, punto)==1)||( comparadorAltura.compare(pComienzo, punto)==0 ||comparadorAltura.compare(pFin, punto)==0 ))) { return true; } return false; }*/ @Override public boolean cumple(Filtro f) { // TODO Auto-generated method stub return false; } @Override public String toString() { return "Trayecto [puntos=" + puntos + ", largo=" + largo + ", duracion=" + duracion + "]"; } public boolean pertenece(Punto p) { ZonaPuntoCircular zonaPunto; zonaPunto = new ZonaPuntoCircular(p); Coordinate[] coordenadasRuta = parser.coordenadasRuta(puntos); Geometry g; GeometryFactory factory = new GeometryFactory(); LineString caminoNuevo = null; caminoNuevo = factory.createLineString(coordenadasRuta); g = zonaPunto.cortaRuta(caminoNuevo); return (g.getNumPoints() > 0); } }
[ "giannoniagustin@gmail.com" ]
giannoniagustin@gmail.com
f9086c22494932176096ae22b90e922434b975a2
1252d74bae07b21bc77b31a12946fe8039e9fd6e
/lolweb/src/main/java/com/etc/lol/entity/Information.java
057596bfa76772ff5212207a6c5627492eac555a
[]
no_license
974451975/lolweb
95702e54b26d37a33570cdad10d35129894fe29a
586f0c8b795390d4bea7c8cd5e75ef603fe5763f
refs/heads/master
2023-01-18T17:07:16.202553
2020-11-24T13:18:43
2020-11-24T13:18:43
315,630,954
0
1
null
null
null
null
UTF-8
Java
false
false
1,539
java
package com.etc.lol.entity; public class Information { private Integer information_id; private Integer information_hero; private String information_title; private String information_text; private Integer information_agree; private String information_motto; public Integer getInformation_id() { return information_id; } public void setInformation_id(Integer information_id) { this.information_id = information_id; } public Integer getInformation_hero() { return information_hero; } public void setInformation_hero(Integer information_hero) { this.information_hero = information_hero; } public String getInformation_title() { return information_title; } public void setInformation_title(String information_title) { this.information_title = information_title; } public String getInformation_text() { return information_text; } public void setInformation_text(String information_text) { this.information_text = information_text; } public Integer getInformation_agree() { return information_agree; } public void setInformation_agree(Integer information_agree) { this.information_agree = information_agree; } public String getInformation_motto() { return information_motto; } public void setInformation_motto(String information_motto) { this.information_motto = information_motto; } }
[ "974451975@qq.com" ]
974451975@qq.com
2c8fd2a1ea62e787cddfd4985ceb850f14bdbf28
78f082e1bb9e8378fe7e9e858ed5724ad65255dd
/src/main/java/pt/isel/ls/commands/methods/post/CinemasIdTheaters.java
5471e106f785b9952bf0151a59f58c08d09b97a8
[]
no_license
jpmatos/ISEL-LS-1718v
8c1e818dae678c0edb4a768f3565b5f64afacc14
3f4c6439b6ebcd49a11c50c5cc0b4a9f66189bbd
refs/heads/master
2020-04-20T16:41:35.341208
2019-02-07T23:17:15
2019-02-07T23:17:15
168,965,986
0
0
null
null
null
null
UTF-8
Java
false
false
908
java
package pt.isel.ls.commands.methods.post; import pt.isel.ls.commands.Command; import pt.isel.ls.commands.methods.AbstractPath; import pt.isel.ls.mappers.TheatersDataMapper; import pt.isel.ls.tables.Theaters; import pt.isel.ls.utils.annotations.PathInfo; import java.util.ArrayList; @PathInfo(pathMethod = "/cinemas/var/theaters") public class CinemasIdTheaters extends AbstractPath { @Override protected Command pathExecute(Command c) { TheatersDataMapper theatersDataMapper = new TheatersDataMapper(); Theaters theater = (Theaters) theatersDataMapper.Map(c.getPathValuesWithParametersValue(), getHighestID("Theaters", c.dataSource)); theatersDataMapper.Insert(theater, c.dataSource); ArrayList<Theaters> res = new ArrayList<>(); res.add(theater); c.iterableResult = res; c.replaceView("text/html/post/cinemasId"); return c; } }
[ "joao.matos.jm@gmail.com" ]
joao.matos.jm@gmail.com
0f63ff83da5dd8d5fbcc019c238dc3da38107057
a1ca4e5e6fe8952b77d1830736dbe89420f88285
/OntoUML.diagram/src/OntoUML/diagram/edit/helpers/ModeEditHelper.java
aa9fba664b7ab6781e2df9f23e7742fb9735c413
[]
no_license
kleopatra999/ontouml-editor-eclipse
46807fe571a60d33ff0f9c84c2bd564e58190e7a
b90531098e578cebaaf5404adc8dc8b3dbae8773
refs/heads/master
2021-01-16T00:27:40.594378
2011-09-23T03:22:59
2011-09-23T03:22:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
154
java
package OntoUML.diagram.edit.helpers; /** * @generated */ public class ModeEditHelper extends OntoUML.diagram.edit.helpers.OntoUMLBaseEditHelper { }
[ "alessanderbotti@b20185d1-684f-0410-8ba8-0d0db1538d36" ]
alessanderbotti@b20185d1-684f-0410-8ba8-0d0db1538d36
a43f36462c6600d5bbd63b8e56f5815c13f0834e
87d0fba638049c687969330a388d0bc8e238f450
/java/util/concurrent/Exchanger.java
9876f6305b2d653e9a99435692bdf34cd70ac2ed
[]
no_license
Luther6/Java-source
462384e671cfc898de33d2fcb0726985f297796f
2ef08232f87d1068eb9385cf3c7f576573d0ca73
refs/heads/master
2020-09-15T03:28:05.944886
2019-12-04T12:37:21
2019-12-04T12:37:21
223,337,423
0
0
null
null
null
null
UTF-8
Java
false
false
29,669
java
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * This file is available under and governed by the GNU General Public * License version 2 only, as published by the Free Software Foundation. * However, the following notice accompanied the original version of this * file: * * Written by Doug Lea, Bill Scherer, and Michael Scott with * assistance from members of JCP JSR-166 Expert Group and released to * the public domain, as explained at * http://creativecommons.org/publicdomain/zero/1.0/ */ package java.util.concurrent; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.locks.LockSupport; /** * A synchronization point at which threads can pair and swap elements * within pairs. Each thread presents some object on entry to the * {@link #exchange exchange} method, matches with a partner thread, * and receives its partner's object on return. An Exchanger may be * viewed as a bidirectional form of a {@link SynchronousQueue}. * Exchangers may be useful in applications such as genetic algorithms * and pipeline designs. * * <p><b>Sample Usage:</b> * Here are the highlights of a class that uses an {@code Exchanger} * to swap buffers between threads so that the thread filling the * buffer gets a freshly emptied one when it needs it, handing off the * filled one to the thread emptying the buffer. * <pre> {@code * class FillAndEmpty { * Exchanger<DataBuffer> exchanger = new Exchanger<DataBuffer>(); * DataBuffer initialEmptyBuffer = ... a made-up type * DataBuffer initialFullBuffer = ... * * class FillingLoop implements Runnable { * public void run() { * DataBuffer currentBuffer = initialEmptyBuffer; * try { * while (currentBuffer != null) { * addToBuffer(currentBuffer); * if (currentBuffer.isFull()) * currentBuffer = exchanger.exchange(currentBuffer); * } * } catch (InterruptedException ex) { ... handle ... } * } * } * * class EmptyingLoop implements Runnable { * public void run() { * DataBuffer currentBuffer = initialFullBuffer; * try { * while (currentBuffer != null) { * takeFromBuffer(currentBuffer); * if (currentBuffer.isEmpty()) * currentBuffer = exchanger.exchange(currentBuffer); * } * } catch (InterruptedException ex) { ... handle ...} * } * } * * void start() { * new Thread(new FillingLoop()).start(); * new Thread(new EmptyingLoop()).start(); * } * }}</pre> * * <p>Memory consistency effects: For each pair of threads that * successfully exchange objects via an {@code Exchanger}, actions * prior to the {@code exchange()} in each thread * <a href="package-summary.html#MemoryVisibility"><i>happen-before</i></a> * those subsequent to a return from the corresponding {@code exchange()} * in the other thread. * * @since 1.5 * @author Doug Lea and Bill Scherer and Michael Scott * @param <V> The type of objects that may be exchanged */ public class Exchanger<V> { /* * Overview: The core algorithm is, for an exchange "slot", * and a participant (caller) with an item: * * for (;;) { * if (slot is empty) { // offer * place item in a Node; * if (can CAS slot from empty to node) { * wait for release; * return matching item in node; * } * } * else if (can CAS slot from node to empty) { // release * get the item in node; * set matching item in node; * release waiting thread; * } * // else retry on CAS failure * } * * This is among the simplest forms of a "dual data structure" -- * see Scott and Scherer's DISC 04 paper and * http://www.cs.rochester.edu/research/synchronization/pseudocode/duals.html * * This works great in principle. But in practice, like many * algorithms centered on atomic updates to a single location, it * scales horribly when there are more than a few participants * using the same Exchanger. So the implementation instead uses a * form of elimination arena, that spreads out this contention by * arranging that some threads typically use different slots, * while still ensuring that eventually, any two parties will be * able to exchange items. That is, we cannot completely partition * across threads, but instead give threads arena indices that * will on average grow under contention and shrink under lack of * contention. We approach this by defining the Nodes that we need * anyway as ThreadLocals, and include in them per-thread index * and related bookkeeping state. (We can safely reuse per-thread * nodes rather than creating them fresh each time because slots * alternate between pointing to a node vs null, so cannot * encounter ABA problems. However, we do need some care in * resetting them between uses.) * * Implementing an effective arena requires allocating a bunch of * space, so we only do so upon detecting contention (except on * uniprocessors, where they wouldn't help, so aren't used). * Otherwise, exchanges use the single-slot slotExchange method. * On contention, not only must the slots be in different * locations, but the locations must not encounter memory * contention due to being on the same cache line (or more * generally, the same coherence unit). Because, as of this * writing, there is no way to determine cacheline size, we define * a value that is enough for common platforms. Additionally, * extra care elsewhere is taken to avoid other false/unintended * sharing and to enhance locality, including adding padding (via * sun.misc.Contended) to Nodes, embedding "bound" as an Exchanger * field, and reworking some park/unpark mechanics compared to * LockSupport versions. * * The arena starts out with only one used slot. We expand the * effective arena size by tracking collisions; i.e., failed CASes * while trying to exchange. By nature of the above algorithm, the * only kinds of collision that reliably indicate contention are * when two attempted releases collide -- one of two attempted * offers can legitimately fail to CAS without indicating * contention by more than one other thread. (Note: it is possible * but not worthwhile to more precisely detect contention by * reading slot values after CAS failures.) When a thread has * collided at each slot within the current arena bound, it tries * to expand the arena size by one. We track collisions within * bounds by using a version (sequence) number on the "bound" * field, and conservatively reset collision counts when a * participant notices that bound has been updated (in either * direction). * * The effective arena size is reduced (when there is more than * one slot) by giving up on waiting after a while and trying to * decrement the arena size on expiration. The value of "a while" * is an empirical matter. We implement by piggybacking on the * use of spin->yield->block that is essential for reasonable * waiting performance anyway -- in a busy exchanger, offers are * usually almost immediately released, in which case context * switching on multiprocessors is extremely slow/wasteful. Arena * waits just omit the blocking part, and instead cancel. The spin * count is empirically chosen to be a value that avoids blocking * 99% of the time under maximum sustained exchange rates on a * range of test machines. Spins and yields entail some limited * randomness (using a cheap xorshift) to avoid regular patterns * that can induce unproductive grow/shrink cycles. (Using a * pseudorandom also helps regularize spin cycle duration by * making branches unpredictable.) Also, during an offer, a * waiter can "know" that it will be released when its slot has * changed, but cannot yet proceed until match is set. In the * mean time it cannot cancel the offer, so instead spins/yields. * Note: It is possible to avoid this secondary check by changing * the linearization point to be a CAS of the match field (as done * in one case in the Scott & Scherer DISC paper), which also * increases asynchrony a bit, at the expense of poorer collision * detection and inability to always reuse per-thread nodes. So * the current scheme is typically a better tradeoff. * * On collisions, indices traverse the arena cyclically in reverse * order, restarting at the maximum index (which will tend to be * sparsest) when bounds change. (On expirations, indices instead * are halved until reaching 0.) It is possible (and has been * tried) to use randomized, prime-value-stepped, or double-hash * style traversal instead of simple cyclic traversal to reduce * bunching. But empirically, whatever benefits these may have * don't overcome their added overhead: We are managing operations * that occur very quickly unless there is sustained contention, * so simpler/faster control policies work better than more * accurate but slower ones. * * Because we use expiration for arena size control, we cannot * throw TimeoutExceptions in the timed version of the public * exchange method until the arena size has shrunken to zero (or * the arena isn't enabled). This may delay response to timeout * but is still within spec. * * Essentially all of the implementation is in methods * slotExchange and arenaExchange. These have similar overall * structure, but differ in too many details to combine. The * slotExchange method uses the single Exchanger field "slot" * rather than arena array elements. However, it still needs * minimal collision detection to trigger arena construction. * (The messiest part is making sure interrupt status and * InterruptedExceptions come out right during transitions when * both methods may be called. This is done by using null return * as a sentinel to recheck interrupt status.) * * As is too common in this sort of code, methods are monolithic * because most of the logic relies on reads of fields that are * maintained as local variables so can't be nicely factored -- * mainly, here, bulky spin->yield->block/cancel code), and * heavily dependent on intrinsics (Unsafe) to use inlined * embedded CAS and related memory access operations (that tend * not to be as readily inlined by dynamic compilers when they are * hidden behind other methods that would more nicely name and * encapsulate the intended effects). This includes the use of * putOrderedX to clear fields of the per-thread Nodes between * uses. Note that field Node.item is not declared as volatile * even though it is read by releasing threads, because they only * do so after CAS operations that must precede access, and all * uses by the owning thread are otherwise acceptably ordered by * other operations. (Because the actual points of atomicity are * slot CASes, it would also be legal for the write to Node.match * in a release to be weaker than a full volatile write. However, * this is not done because it could allow further postponement of * the write, delaying progress.) */ /** * The byte distance (as a shift value) between any two used slots * in the arena. 1 << ASHIFT should be at least cacheline size. */ private static final int ASHIFT = 7; /** * The maximum supported arena index. The maximum allocatable * arena size is MMASK + 1. Must be a power of two minus one, less * than (1<<(31-ASHIFT)). The cap of 255 (0xff) more than suffices * for the expected scaling limits of the main algorithms. */ private static final int MMASK = 0xff; /** * Unit for sequence/version bits of bound field. Each successful * change to the bound also adds SEQ. */ private static final int SEQ = MMASK + 1; /** The number of CPUs, for sizing and spin control */ private static final int NCPU = Runtime.getRuntime().availableProcessors(); /** * The maximum slot index of the arena: The number of slots that * can in principle hold all threads without contention, or at * most the maximum indexable value. */ static final int FULL = (NCPU >= (MMASK << 1)) ? MMASK : NCPU >>> 1; /** * The bound for spins while waiting for a match. The actual * number of iterations will on average be about twice this value * due to randomization. Note: Spinning is disabled when NCPU==1. */ private static final int SPINS = 1 << 10; /** * Value representing null arguments/returns from public * methods. Needed because the API originally didn't disallow null * arguments, which it should have. */ private static final Object NULL_ITEM = new Object(); /** * Sentinel value returned by internal exchange methods upon * timeout, to avoid need for separate timed versions of these * methods. */ private static final Object TIMED_OUT = new Object(); /** * Nodes hold partially exchanged data, plus other per-thread * bookkeeping. Padded via @sun.misc.Contended to reduce memory * contention. */ @sun.misc.Contended static final class Node { int index; // Arena index int bound; // Last recorded value of Exchanger.bound int collides; // Number of CAS failures at current bound int hash; // Pseudo-random for spins Object item; // This thread's current item volatile Object match; // Item provided by releasing thread volatile Thread parked; // Set to this thread when parked, else null } /** The corresponding thread local class */ static final class Participant extends ThreadLocal<Node> { public Node initialValue() { return new Node(); } } /** * Per-thread state */ private final Participant participant; /** * Elimination array; null until enabled (within slotExchange). * Element accesses use emulation of volatile gets and CAS. */ private volatile Node[] arena; /** * Slot used until contention detected. */ private volatile Node slot; /** * The index of the largest valid arena position, OR'ed with SEQ * number in high bits, incremented on each update. The initial * update from 0 to SEQ is used to ensure that the arena array is * constructed only once. */ private volatile int bound; /** * Exchange function when arenas enabled. See above for explanation. * * @param item the (non-null) item to exchange * @param timed true if the wait is timed * @param ns if timed, the maximum wait time, else 0L * @return the other thread's item; or null if interrupted; or * TIMED_OUT if timed and timed out */ private final Object arenaExchange(Object item, boolean timed, long ns) { Node[] a = arena; Node p = participant.get(); for (int i = p.index;;) { // access slot at i int b, m, c; long j; // j is raw array offset Node q = (Node)U.getObjectVolatile(a, j = (i << ASHIFT) + ABASE); if (q != null && U.compareAndSwapObject(a, j, q, null)) { Object v = q.item; // release q.match = item; Thread w = q.parked; if (w != null) U.unpark(w); return v; } else if (i <= (m = (b = bound) & MMASK) && q == null) { p.item = item; // offer if (U.compareAndSwapObject(a, j, null, p)) { long end = (timed && m == 0) ? System.nanoTime() + ns : 0L; Thread t = Thread.currentThread(); // wait for (int h = p.hash, spins = SPINS;;) { Object v = p.match; if (v != null) { U.putOrderedObject(p, MATCH, null); p.item = null; // clear for next use p.hash = h; return v; } else if (spins > 0) { h ^= h << 1; h ^= h >>> 3; h ^= h << 10; // xorshift if (h == 0) // initialize hash h = SPINS | (int)t.getId(); else if (h < 0 && // approx 50% true (--spins & ((SPINS >>> 1) - 1)) == 0) Thread.yield(); // two yields per wait } else if (U.getObjectVolatile(a, j) != p) spins = SPINS; // releaser hasn't set match yet else if (!t.isInterrupted() && m == 0 && (!timed || (ns = end - System.nanoTime()) > 0L)) { U.putObject(t, BLOCKER, this); // emulate LockSupport p.parked = t; // minimize window if (U.getObjectVolatile(a, j) == p) U.park(false, ns); p.parked = null; U.putObject(t, BLOCKER, null); } else if (U.getObjectVolatile(a, j) == p && U.compareAndSwapObject(a, j, p, null)) { if (m != 0) // try to shrink U.compareAndSwapInt(this, BOUND, b, b + SEQ - 1); p.item = null; p.hash = h; i = p.index >>>= 1; // descend if (Thread.interrupted()) return null; if (timed && m == 0 && ns <= 0L) return TIMED_OUT; break; // expired; restart } } } else p.item = null; // clear offer } else { if (p.bound != b) { // stale; reset p.bound = b; p.collides = 0; i = (i != m || m == 0) ? m : m - 1; } else if ((c = p.collides) < m || m == FULL || !U.compareAndSwapInt(this, BOUND, b, b + SEQ + 1)) { p.collides = c + 1; i = (i == 0) ? m : i - 1; // cyclically traverse } else i = m + 1; // grow p.index = i; } } } /** * Exchange function used until arenas enabled. See above for explanation. * * @param item the item to exchange * @param timed true if the wait is timed * @param ns if timed, the maximum wait time, else 0L * @return the other thread's item; or null if either the arena * was enabled or the thread was interrupted before completion; or * TIMED_OUT if timed and timed out */ private final Object slotExchange(Object item, boolean timed, long ns) { Node p = participant.get(); Thread t = Thread.currentThread(); if (t.isInterrupted()) // preserve interrupt status so caller can recheck return null; for (Node q;;) { if ((q = slot) != null) { if (U.compareAndSwapObject(this, SLOT, q, null)) { Object v = q.item; q.match = item; Thread w = q.parked; if (w != null) U.unpark(w); return v; } // create arena on contention, but continue until slot null if (NCPU > 1 && bound == 0 && U.compareAndSwapInt(this, BOUND, 0, SEQ)) arena = new Node[(FULL + 2) << ASHIFT]; } else if (arena != null) return null; // caller must reroute to arenaExchange else { p.item = item; if (U.compareAndSwapObject(this, SLOT, null, p)) break; p.item = null; } } // await release int h = p.hash; long end = timed ? System.nanoTime() + ns : 0L; int spins = (NCPU > 1) ? SPINS : 1; Object v; while ((v = p.match) == null) { if (spins > 0) { h ^= h << 1; h ^= h >>> 3; h ^= h << 10; if (h == 0) h = SPINS | (int)t.getId(); else if (h < 0 && (--spins & ((SPINS >>> 1) - 1)) == 0) Thread.yield(); } else if (slot != p) spins = SPINS; else if (!t.isInterrupted() && arena == null && (!timed || (ns = end - System.nanoTime()) > 0L)) { U.putObject(t, BLOCKER, this); p.parked = t; if (slot == p) U.park(false, ns); p.parked = null; U.putObject(t, BLOCKER, null); } else if (U.compareAndSwapObject(this, SLOT, p, null)) { v = timed && ns <= 0L && !t.isInterrupted() ? TIMED_OUT : null; break; } } U.putOrderedObject(p, MATCH, null); p.item = null; p.hash = h; return v; } /** * Creates a new Exchanger. */ public Exchanger() { participant = new Participant(); } /** * Waits for another thread to arrive at this exchange point (unless * the current thread is {@linkplain Thread#interrupt interrupted}), * and then transfers the given object to it, receiving its object * in return. * * <p>If another thread is already waiting at the exchange point then * it is resumed for thread scheduling purposes and receives the object * passed in by the current thread. The current thread returns immediately, * receiving the object passed to the exchange by that other thread. * * <p>If no other thread is already waiting at the exchange then the * current thread is disabled for thread scheduling purposes and lies * dormant until one of two things happens: * <ul> * <li>Some other thread enters the exchange; or * <li>Some other thread {@linkplain Thread#interrupt interrupts} * the current thread. * </ul> * <p>If the current thread: * <ul> * <li>has its interrupted status set on entry to this method; or * <li>is {@linkplain Thread#interrupt interrupted} while waiting * for the exchange, * </ul> * then {@link InterruptedException} is thrown and the current thread's * interrupted status is cleared. * * @param x the object to exchange * @return the object provided by the other thread * @throws InterruptedException if the current thread was * interrupted while waiting */ /** * 正常结束情况: * 1、有两个线程都达到了exchange() * 2、在一个线程进入了exchange()点,没有其他线程进入时打断这个线程 */ @SuppressWarnings("unchecked") public V exchange(V x) throws InterruptedException { Object v; Object item = (x == null) ? NULL_ITEM : x; // translate null args if ((arena != null || (v = slotExchange(item, false, 0L)) == null) && ((Thread.interrupted() || // disambiguates null return (v = arenaExchange(item, false, 0L)) == null))) throw new InterruptedException(); return (v == NULL_ITEM) ? null : (V)v; } /** * Waits for another thread to arrive at this exchange point (unless * the current thread is {@linkplain Thread#interrupt interrupted} or * the specified waiting time elapses), and then transfers the given * object to it, receiving its object in return. * * <p>If another thread is already waiting at the exchange point then * it is resumed for thread scheduling purposes and receives the object * passed in by the current thread. The current thread returns immediately, * receiving the object passed to the exchange by that other thread. * * <p>If no other thread is already waiting at the exchange then the * current thread is disabled for thread scheduling purposes and lies * dormant until one of three things happens: * <ul> * <li>Some other thread enters the exchange; or * <li>Some other thread {@linkplain Thread#interrupt interrupts} * the current thread; or * <li>The specified waiting time elapses. * </ul> * <p>If the current thread: * <ul> * <li>has its interrupted status set on entry to this method; or * <li>is {@linkplain Thread#interrupt interrupted} while waiting * for the exchange, * </ul> * then {@link InterruptedException} is thrown and the current thread's * interrupted status is cleared. * * <p>If the specified waiting time elapses then {@link * TimeoutException} is thrown. If the time is less than or equal * to zero, the method will not wait at all. * * @param x the object to exchange * @param timeout the maximum time to wait * @param unit the time unit of the {@code timeout} argument * @return the object provided by the other thread * @throws InterruptedException if the current thread was * interrupted while waiting * @throws TimeoutException if the specified waiting time elapses * before another thread enters the exchange */ @SuppressWarnings("unchecked") public V exchange(V x, long timeout, TimeUnit unit) throws InterruptedException, TimeoutException { Object v; Object item = (x == null) ? NULL_ITEM : x; long ns = unit.toNanos(timeout); if ((arena != null || (v = slotExchange(item, true, ns)) == null) && ((Thread.interrupted() || (v = arenaExchange(item, true, ns)) == null))) throw new InterruptedException(); if (v == TIMED_OUT) throw new TimeoutException(); return (v == NULL_ITEM) ? null : (V)v; } // Unsafe mechanics private static final sun.misc.Unsafe U; private static final long BOUND; private static final long SLOT; private static final long MATCH; private static final long BLOCKER; private static final int ABASE; static { int s; try { U = sun.misc.Unsafe.getUnsafe(); Class<?> ek = Exchanger.class; Class<?> nk = Node.class; Class<?> ak = Node[].class; Class<?> tk = Thread.class; BOUND = U.objectFieldOffset (ek.getDeclaredField("bound")); SLOT = U.objectFieldOffset (ek.getDeclaredField("slot")); MATCH = U.objectFieldOffset (nk.getDeclaredField("match")); BLOCKER = U.objectFieldOffset (tk.getDeclaredField("parkBlocker")); s = U.arrayIndexScale(ak); // ABASE absorbs padding in front of element 0 ABASE = U.arrayBaseOffset(ak) + (1 << ASHIFT); } catch (Exception e) { throw new Error(e); } if ((s & (s-1)) != 0 || s > (1 << ASHIFT)) throw new Error("Unsupported array scale"); } }
[ "1582835834@qq.com" ]
1582835834@qq.com
9809388c6e8de84444ca8cdcc80016118954734a
8c476c2bbf2e0ed05c1b290071a864dec0070f79
/beApi/src/main/java/com/example/beApi/BeApiApplication.java
dc0902671635c4d8fb02bd50c9e58a039cfcfb28
[]
no_license
akdl911215/betazon2
ca6772c9a75a2030fc3e35f7c5eb20fa65a7427c
233f93ac07b8ddb3e82b1561aa4c70a957f0d94e
refs/heads/master
2023-05-02T10:04:18.021766
2021-05-16T02:56:12
2021-05-16T02:56:12
359,476,636
0
0
null
null
null
null
UTF-8
Java
false
false
308
java
package com.example.beApi; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class BeApiApplication { public static void main(String[] args) { SpringApplication.run(BeApiApplication.class, args); } }
[ "akdl911215@naver.com" ]
akdl911215@naver.com
0a162fc840f63d9fd9ddb1b6dcfd90fad28219d8
6d7fb691f639cb773b378245fb64e80f526e743d
/src/deployment/reference/svnkitwc/Demo.java
017314a9c1f5d855b5d91da3c5d39ec6716817e7
[]
no_license
ainiaa/deploymentSvnForDS
98a1e429ffb31e9f49b9e6d273da24742083c5a9
156678c04e930d311a39bace2228f385ad85f272
refs/heads/master
2021-01-01T16:26:47.741583
2015-05-21T10:40:55
2015-05-21T10:40:55
23,698,765
0
2
null
null
null
null
UTF-8
Java
false
false
3,422
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 deployment.reference.svnkitwc; /*第一步: *导入可能用到的类 */ import java.io.*; import static org.apache.log4j.helpers.LogLog.error; import org.tmatesoft.svn.core.*; import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; import org.tmatesoft.svn.core.internal.io.fs.FSRepositoryFactory; import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl; import org.tmatesoft.svn.core.internal.util.SVNPathUtil; import org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions; import org.tmatesoft.svn.core.wc.*; public class Demo { /*第二步: *声明客户端管理类SVNClientManager。 */ private static SVNClientManager ourClientManager; public static void main(String[] args) throws SVNException { /*第三步: * 对版本库进行初始化操作 (在用版本库进行其他操作前必须进行初始化) * 对于通过使用 http:// 和 https:// 访问,执行DAVRepositoryFactory.setup(); * 对于通过使用svn:// 和 svn+xxx://访问,执行SVNRepositoryFactoryImpl.setup(); * 对于通过使用file:///访问,执行FSRepositoryFactory.setup(); * 本程序框架用svn://来访问 */ SVNRepositoryFactoryImpl.setup(); /*第四步: * 要访问版本库的相关变量设置 */ //版本库的URL地址 SVNURL repositoryURL = null; try { repositoryURL = SVNURL.parseURIEncoded("svn://localhost/testRep"); } catch (SVNException e) { // } //版本库的用户名 String name = "userName"; //版本库的用户名密码 String password = "userPassword"; //工作副本目录 String myWorkingCopyPath = "D:/MyWorkingCopy"; //驱动选项 ISVNOptions options = SVNWCUtil.createDefaultOptions(true); /*第五步: * 创建SVNClientManager的实例。提供认证信息(用户名,密码) * 和驱动选项。 */ ourClientManager = SVNClientManager.newInstance((DefaultSVNOptions) options, name, password); /*第六步: * 通过SVNClientManager的实例获取要进行操作的client实例(如 * SVNUpdateClient) * 通过client实例来执行相关的操作。 * 此框架以check out操作来进行说明,其他操作类似。 */ /*工作副本目录创建*/ File wcDir = new File(myWorkingCopyPath); if (wcDir.exists()) { error("the destination directory '" + wcDir.getAbsolutePath() + "' already exists!", null); } wcDir.mkdirs(); try { /* * 递归的把工作副本从repositoryURL check out 到 wcDir目录。 * SVNRevision.HEAD 意味着把最新的版本checked out出来。 */ SVNUpdateClient updateClient = ourClientManager.getUpdateClient(); updateClient.setIgnoreExternals(false); updateClient.doCheckout(repositoryURL, wcDir, SVNRevision.HEAD, SVNRevision.HEAD, true); } catch (SVNException svne) { // } } }
[ "liuwenyuan521888@163.com" ]
liuwenyuan521888@163.com
3afbb6474f8b865f1141d79fe3587b88224b4490
9c792bfe3fc3a192e04b39feacdc733ef233a86c
/src/test/java/pl/codeworld/customersappforkotrak/dtos/CustomerDtoTest.java
ab944185d003b0e892d290200947f04cd3f9c027
[]
no_license
frankowskipawel/Customers_Java_Spring_PUB
4a3b14104ec6a06e486f756c2b55666af2248cce
87c953178404dc2548e50116cb53458e08207330
refs/heads/master
2023-04-29T19:16:05.328580
2021-05-18T12:51:45
2021-05-18T12:51:45
368,528,266
0
0
null
null
null
null
UTF-8
Java
false
false
4,330
java
package pl.codeworld.customersappforkotrak.dtos; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import pl.codeworld.customersappforkotrak.entities.Address; import pl.codeworld.customersappforkotrak.entities.CustomerBusiness; import pl.codeworld.customersappforkotrak.entities.CustomerPerson; import pl.codeworld.customersappforkotrak.enums.CustomerType; import static org.junit.jupiter.api.Assertions.*; class CustomerDtoTest { private CustomerDto customerDtoPerson; private CustomerDto customerDtoCompany; private Address address; @BeforeEach void setUp() { customerDtoPerson = new CustomerDto(); customerDtoPerson.setId(1); customerDtoPerson.setPhoneNumber("500500500"); customerDtoPerson.setEmail("nowak@wp.pl"); customerDtoPerson.setWebSite("www.nowak.pl"); customerDtoPerson.setType(CustomerType.PERSON); customerDtoPerson.setFirstName("Jan"); customerDtoPerson.setLastName("Nowak"); customerDtoPerson.setPersonalIdNumber("12345678900"); customerDtoPerson.setIdCardNumber("AAA123456"); customerDtoPerson.setAddress(address); customerDtoCompany = new CustomerDto(); customerDtoCompany.setId(2); customerDtoCompany.setPhoneNumber("500500500"); customerDtoCompany.setEmail("nowak@wp.pl"); customerDtoCompany.setWebSite("www.nowak.pl"); customerDtoCompany.setType(CustomerType.COMPANY); customerDtoCompany.setCompanyName("ADAMEX"); customerDtoCompany.setTaxpayerIdentificationNumber("999-11-45-567"); customerDtoCompany.setNationalBusinessRegistryNumber("123456789"); customerDtoCompany.setAddress(address); address = new Address(); address.setId(1); address.setStreet("Nowa"); address.setBuildingNumber("1"); address.setApartmentNumber("2"); address.setPostCode("87-100"); address.setCity("Toruń"); address.setProvince("kujawsko-pomorskie"); } @Test void shouldCustomerDtoToCustomerMappingIsTrue() { //given CustomerPerson customer; //when customer = customerDtoPerson.toCustomerPerson(); //then assertTrue(customerDtoPerson.toCustomerPerson() instanceof CustomerPerson); assertTrue(customer.getName().equals(customerDtoPerson.getLastName()+" "+ customerDtoPerson.getFirstName())); assertTrue(customer.getPhoneNumber().equals(customerDtoPerson.getPhoneNumber())); assertTrue(customer.getEmail().equals(customerDtoPerson.getEmail())); assertTrue(customer.getWebSite().equals(customerDtoPerson.getWebSite())); assertTrue(customer.getType().equals(customerDtoPerson.getType())); assertTrue(customer.getFirstName().equals(customerDtoPerson.getFirstName())); assertTrue(customer.getLastName().equals(customerDtoPerson.getLastName())); assertTrue(customer.getPersonalIdNumber().equals(customerDtoPerson.getPersonalIdNumber())); assertTrue(customer.getIdCardNumber().equals(customerDtoPerson.getIdCardNumber())); assertTrue(customer.getAddress()== customerDtoPerson.getAddress()); } @Test void toCustomerBusiness() { //given CustomerBusiness customer; //when customer = customerDtoCompany.toCustomerBusiness(); //then assertTrue(customerDtoCompany.toCustomerBusiness() instanceof CustomerBusiness); assertTrue(customer.getName().equals(customerDtoCompany.getCompanyName())); assertTrue(customer.getPhoneNumber().equals(customerDtoCompany.getPhoneNumber())); assertTrue(customer.getEmail().equals(customerDtoCompany.getEmail())); assertTrue(customer.getWebSite().equals(customerDtoCompany.getWebSite())); assertTrue(customer.getType().equals(customerDtoCompany.getType())); assertTrue(customer.getCompanyName().equals(customerDtoCompany.getCompanyName())); assertTrue(customer.getTaxpayerIdentificationNumber().equals(customerDtoCompany.getTaxpayerIdentificationNumber())); assertTrue(customer.getNationalBusinessRegistryNumber().equals(customerDtoCompany.getNationalBusinessRegistryNumber())); assertTrue(customer.getAddress()== customerDtoCompany.getAddress()); } }
[ "frankowski.pawel@gmail.com" ]
frankowski.pawel@gmail.com
46bebb9af24f4508edb45bbf65acf79552b191fa
98e6e5f765712f6cdd067f20b2743512ef348796
/ExercisesOpenClosedandLiskovPrinciple/src/main/java/blobs/io/ConsoleInputReader.java
ea72d7bfb18554fda98a00635b17afe1b6ff80ae
[]
no_license
GeorgeK95/JavaOOPAdvanced
1cb0a47f0cbb61509995fcb2293a64e790238839
1566a84552114097924a850332081d4f1c144cb7
refs/heads/master
2021-09-03T11:22:48.944404
2018-01-08T17:31:37
2018-01-08T17:31:37
110,693,137
0
1
null
null
null
null
UTF-8
Java
false
false
494
java
package blobs.io; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class ConsoleInputReader { private BufferedReader reader; public ConsoleInputReader() { this.reader = new BufferedReader(new InputStreamReader(System.in)); } public String readLine() { String result = null; try{ result = this.reader.readLine(); } catch(IOException e) {} return result; } }
[ "george_it@abv.bg" ]
george_it@abv.bg
bb8c9008c955ba72c47a0fbd294acd6e4e4d73ab
3fe5c54f01247de014b686bfc79c0534c406323e
/src/main/java/com/force/aus/Loader.java
05ae0aa82902bba9a3231d281506b7851a8daa12
[]
no_license
troysellers/grLoader
aad83084be90ac97000557d701b362c10a3c6339
de6d84d1c76a653c7e643d62302701bdbcf16589
refs/heads/master
2021-05-26T12:26:29.162048
2013-04-30T07:15:35
2013-04-30T07:15:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,682
java
package com.force.aus; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Properties; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import com.sforce.soap.partner.PartnerConnection; import com.sforce.ws.ConnectionException; import com.sforce.ws.ConnectorConfig; /** * Hello world! * */ public class Loader { public static Properties appProps; public static void main( String[] args ) { Loader l = new Loader(); appProps = Helper.loadProperties(Constants.APP_PROPS_FILE); System.out.println("Here are the properties we are going to run with:"); System.out.println("Use Sandbox environment? - " + appProps.get(Constants.PROP_USE_SANDBOX)); System.out.println("Salesforce User - " + appProps.get(Constants.PROP_FORCE_USER)); System.out.println("Salesforce Pass - " + appProps.get(Constants.PROP_FORCE_PASS)); System.out.println("Salesforce Security Token - "+appProps.getProperty(Constants.PROP_FORCE_SECURITY_TOKEN)); System.out.println("Path to Data Files - " + appProps.get(Constants.PROP_DATA_LOCATION)); System.out.println("Constituent filename - " + appProps.get(Constants.PROP_CONSTITUENT_FILE_NAME)); System.out.println("Order Detail filename - " + appProps.get(Constants.PROP_ORDER_FILE_NAME)); System.out.println("Are these OK? (Yes or No)"); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); try { String response = reader.readLine(); if(response.startsWith("Y") || response.startsWith("y")) { l.run(); } else { System.out.println("Please adjust the properties file "+Constants.APP_PROPS_FILE+" and reload before running"); } } catch (IOException ioe) { ioe.printStackTrace(); throw new RuntimeException(); } } private void run() { System.out.println("We should now be running successfully."); ConnectorConfig config = new ConnectorConfig(); config.setAuthEndpoint(appProps.getProperty(Constants.PROP_AUTH_ENDPOINT)); config.setUsername(appProps.getProperty(Constants.PROP_FORCE_USER)); config.setPassword(appProps.getProperty(Constants.PROP_FORCE_PASS) + appProps.getProperty(Constants.PROP_FORCE_SECURITY_TOKEN)); config.setCompression(true); config.setPrettyPrintXml(true); config.setTraceMessage(false); try { // load XML mapping file Map<String, ObjectMapping> mappings = loadMappings(); // Connect to Salesforce PartnerConnection conn = new PartnerConnection(config); // Validate that mappings are correct to Salesforce Iterator<String> mappingIterator = mappings.keySet().iterator(); while(mappingIterator.hasNext()) { String objectName = mappingIterator.next(); ObjectMapping mapping = mappings.get(objectName); mapping.setDescribeResult(conn.describeSObject(objectName)); if(mapping.getObjectName().equalsIgnoreCase("account")) { mapping.loadCSVData(appProps.getProperty(Constants.PROP_DATA_LOCATION) + appProps.getProperty(Constants.PROP_CONSTITUENT_FILE_NAME)); } if(mapping.getObjectName().equalsIgnoreCase("order_details__c")) { mapping.loadCSVData(appProps.getProperty(Constants.PROP_DATA_LOCATION) + appProps.getProperty(Constants.PROP_ORDER_FILE_NAME)); } File errorFile = new File(appProps.getProperty(Constants.PROP_ERROR_FILE)); System.out.println("Loading "+mapping.getObjectName()); mapping.loadDataIntoSalesforce(conn, errorFile); } conn.logout(); } catch (ConnectionException ce) { ce.printStackTrace(); throw new RuntimeException(); } catch (MappingValidationException mve) { mve.printStackTrace(); throw new RuntimeException(); } catch (IOException ioe) { ioe.printStackTrace(); throw new RuntimeException(); } } private Map<String, ObjectMapping> loadMappings() { File xmlFile = new File(appProps.getProperty(Constants.PROP_MAPPING_LOCATION)+appProps.getProperty(Constants.PROP_MAPPING_FILE)); Map<String, ObjectMapping> objectMappings = new HashMap<String, ObjectMapping>(); try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = dbf.newDocumentBuilder(); Document doc = builder.parse(xmlFile); doc.getDocumentElement().normalize(); NodeList nodeList = doc.getElementsByTagName("objectMapping"); for(int i=0 ; i<nodeList.getLength(); i++) { Node n = nodeList.item(i); ObjectMapping mapping = new ObjectMapping(n.getAttributes().getNamedItem("name").getNodeValue()); processFieldMappings(mapping, n.getChildNodes()); objectMappings.put(mapping.getObjectName(), mapping); } } catch (ParserConfigurationException pce) { pce.printStackTrace(); throw new RuntimeException(); } catch (IOException ioe) { ioe.printStackTrace(); throw new RuntimeException(); } catch (SAXException saxe) { saxe.printStackTrace(); throw new RuntimeException(); } return objectMappings; } private void processFieldMappings(ObjectMapping mapping, NodeList nodes) { for(int i=0 ; i<nodes.getLength() ; i++) { Node n = nodes.item(i); if(n.getNodeName().equalsIgnoreCase("fieldMapping")) { mapping.addFieldMapping(n.getAttributes().getNamedItem("sfFieldName").getNodeValue(), n.getAttributes().getNamedItem("csvFieldName").getNodeValue()); } } } }
[ "tsellers@salesforce.com" ]
tsellers@salesforce.com
7ffd5435fea012c444400ed464c072b820cc7301
4594cf6a8469df5682689ba21030fec75445c826
/zlt-uaa/src/main/java/com/central/oauth/config/AuthorizationServerConfig.java
306a0581261ac84f1c2e6832bd38a56c8b43d0c1
[ "Apache-2.0" ]
permissive
cyf1215/microservices-platform-ifan
1bdec78962a5e1047beaf0cc8f299c14d2f6ad92
8b5597e5b5c9044ac07fd1a5790dddaac88a6fef
refs/heads/master
2023-08-06T01:36:56.949472
2021-10-03T03:14:02
2021-10-03T03:14:02
399,859,188
0
0
null
null
null
null
UTF-8
Java
false
false
7,702
java
package com.central.oauth.config; import com.central.common.constant.SecurityConstants; import com.central.common.model.SysUser; import com.central.oauth.model.Client; import com.central.oauth.service.IClientService; import com.central.oauth.service.impl.RedisClientDetailsService; import com.central.oauth.service.impl.UserDetailServiceFactory; import com.central.oauth.utils.OidcIdTokenBuilder; import com.central.oauth2.common.constants.IdTokenClaimNames; import com.central.oauth2.common.properties.TokenStoreProperties; import com.central.oauth2.common.util.AuthUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.cloud.bootstrap.encrypt.KeyProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.Order; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken; import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer; import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerSecurityConfigurer; import org.springframework.security.oauth2.provider.OAuth2Authentication; import org.springframework.security.oauth2.provider.TokenGranter; import org.springframework.security.oauth2.provider.code.RandomValueAuthorizationCodeServices; import org.springframework.security.oauth2.provider.error.WebResponseExceptionTranslator; import org.springframework.security.oauth2.provider.token.TokenEnhancer; import org.springframework.security.oauth2.provider.token.TokenStore; import javax.annotation.Resource; import java.util.HashMap; import java.util.Map; import java.util.Set; /** * OAuth2 授权服务器配置 * * @author zlt * @date 2018/10/24 * <p> * Blog: https://zlt2000.gitee.io * Github: https://github.com/zlt2000 */ @Configuration @EnableAuthorizationServer @AutoConfigureAfter(AuthorizationServerEndpointsConfigurer.class) public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter { /** * 注入authenticationManager 来支持 password grant type */ @Autowired private AuthenticationManager authenticationManager; @Resource private UserDetailServiceFactory userDetailsServiceFactory; @Autowired private TokenStore tokenStore; @Autowired private WebResponseExceptionTranslator webResponseExceptionTranslator; @Autowired private RedisClientDetailsService clientDetailsService; @Autowired private RandomValueAuthorizationCodeServices authorizationCodeServices; @Autowired private TokenGranter tokenGranter; /** * 配置身份认证器,配置认证方式,TokenStore,TokenGranter,OAuth2RequestFactory * @param endpoints */ @Override public void configure(AuthorizationServerEndpointsConfigurer endpoints) { endpoints.tokenStore(tokenStore) .authenticationManager(authenticationManager) //.userDetailsService(userDetailsServiceFactory.getService(SecurityConstants.DEF_ACCOUNT_TYPE)) .authorizationCodeServices(authorizationCodeServices) .exceptionTranslator(webResponseExceptionTranslator) .tokenGranter(tokenGranter); } /** * 配置应用名称 应用id * 配置OAuth2的客户端相关信息 * @param clients * @throws Exception */ @Override public void configure(ClientDetailsServiceConfigurer clients) throws Exception { clients.withClientDetails(clientDetailsService); clientDetailsService.loadAllClientToCache(); } /** * 对应于配置AuthorizationServer安全认证的相关信息,创建ClientCredentialsTokenEndpointFilter核心过滤器 * @param security */ @Override public void configure(AuthorizationServerSecurityConfigurer security) { security .tokenKeyAccess("isAuthenticated()") .checkTokenAccess("permitAll()") //让/oauth/token支持client_id以及client_secret作登录认证 .allowFormAuthenticationForClients(); } @Bean @Order(1) public TokenEnhancer tokenEnhancer(@Autowired(required = false) KeyProperties keyProperties , IClientService clientService , TokenStoreProperties tokenStoreProperties) { return (accessToken, authentication) -> { Set<String> responseTypes = authentication.getOAuth2Request().getResponseTypes(); Map<String, Object> additionalInfo = new HashMap<>(3); String accountType = AuthUtils.getAccountType(authentication.getUserAuthentication()); additionalInfo.put(SecurityConstants.ACCOUNT_TYPE_PARAM_NAME, accountType); if (responseTypes.contains(SecurityConstants.ID_TOKEN) || "authJwt".equals(tokenStoreProperties.getType())) { Object principal = authentication.getPrincipal(); //增加id参数 if (principal instanceof SysUser) { SysUser user = (SysUser)principal; if (responseTypes.contains(SecurityConstants.ID_TOKEN)) { //生成id_token setIdToken(additionalInfo, authentication, keyProperties, clientService, user); } if ("authJwt".equals(tokenStoreProperties.getType())) { additionalInfo.put("id", user.getId()); } } } ((DefaultOAuth2AccessToken) accessToken).setAdditionalInformation(additionalInfo); return accessToken; }; } /** * 生成id_token * @param additionalInfo 存储token附加信息对象 * @param authentication 授权对象 * @param keyProperties 密钥 * @param clientService 应用service */ private void setIdToken(Map<String, Object> additionalInfo, OAuth2Authentication authentication , KeyProperties keyProperties, IClientService clientService, SysUser user) { String clientId = authentication.getOAuth2Request().getClientId(); Client client = clientService.loadClientByClientId(clientId); if (client.getSupportIdToken()) { String nonce = authentication.getOAuth2Request().getRequestParameters().get(IdTokenClaimNames.NONCE); long now = System.currentTimeMillis(); long expiresAt = System.currentTimeMillis() + client.getIdTokenValiditySeconds() * 1000; String idToken = OidcIdTokenBuilder.builder(keyProperties) .issuer(SecurityConstants.ISS) .issuedAt(now) .expiresAt(expiresAt) .subject(String.valueOf(user.getId())) .name(user.getNickname()) .loginName(user.getUsername()) .picture(user.getHeadImgUrl()) .audience(clientId) .nonce(nonce) .build(); additionalInfo.put(SecurityConstants.ID_TOKEN, idToken); } } }
[ "359096198@qq.com" ]
359096198@qq.com
31ec004c5d21b6c0febea42e62fccdc3feef3e19
101f96965ac5e0249679677929ba588450f619e4
/app/src/main/java/com/example/imapp/frags/search/SearchUserFragment.java
5e476d5fd45d5ee17ac739e5df2c8d2b798f0751
[]
no_license
sunshinekao/ANDROID_IM
f8440f6d45fa573d7b56a056aaeeac6aa2c384af
9eda5b27a0aef4295706d5550f4c9470d45318e1
refs/heads/master
2020-07-26T05:57:16.124843
2020-07-23T06:36:38
2020-07-23T06:36:38
208,555,653
0
1
null
null
null
null
UTF-8
Java
false
false
5,591
java
package com.example.imapp.frags.search; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.TextView; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.example.common.common.app.PresenterFragment; import com.example.common.common.widget.EmptyView; import com.example.common.common.widget.PortraitView; import com.example.common.common.widget.recycler.RecyclerAdapter; import com.example.factory.model.card.UserCard; import com.example.factory.presenter.contact.FollowContact; import com.example.factory.presenter.contact.FollowPresenter; import com.example.factory.presenter.search.SearchContract; import com.example.factory.presenter.search.SearchUserPresenter; import com.example.imapp.R; import com.example.imapp.activities.SearchActivity; import java.util.List; import butterknife.BindView; import butterknife.OnClick; /** * 搜索人的界面实现 */ public class SearchUserFragment extends PresenterFragment<SearchContract.Presenter> implements SearchActivity.SearchFragment, SearchContract.UserView{ public static final String TAG="SearchUserFragment"; @BindView(R.id.empty) EmptyView mEmptyView; @BindView(R.id.recycler) RecyclerView mRecycler; private RecyclerAdapter<UserCard> mAdapter; public SearchUserFragment() { } @Override protected int getContentLayoutId() { return R.layout.fragment_search_user; } @Override protected void initWidget(View root) { super.initWidget(root); // 初始化Recycler mRecycler.setLayoutManager(new LinearLayoutManager(getContext())); mRecycler.setAdapter(mAdapter = new RecyclerAdapter<UserCard>() { @Override protected int getItemViewType(int position, UserCard userCard) { // 返回cell的布局id return R.layout.cell_search_list; } @Override protected ViewHolder<UserCard> onCreateViewHolder(View root, int viewType) { return new SearchUserFragment.ViewHolder(root); } }); // 初始化占位布局 mEmptyView.bind(mRecycler); setPlaceHolderView(mEmptyView); } @Override protected void initData() { super.initData(); // 发起首次搜索 search(""); } @Override public void search(String content) { // Activity->Fragment->Presenter->Net mPresenter.search(content); } @Override public void onSearchDone(List<UserCard> userCards) { // 数据成功的情况下返回数据 mAdapter.replace(userCards); // 如果有数据,则是OK,没有数据就显示空布局 mPlaceHolderView.triggerOkOrEmpty(mAdapter.getItemCount() > 0); } @Override protected SearchContract.Presenter initPresenter() { // 初始化Presenter return new SearchUserPresenter(this); } /** * 每一个Cell的布局操作 */ class ViewHolder extends RecyclerAdapter.ViewHolder<UserCard> implements FollowContact.View { @BindView(R.id.im_portrait) PortraitView mPortraitView; @BindView(R.id.txt_name) TextView mName; @BindView(R.id.add_contact) Button mFollow; @BindView(R.id.added_contact) Button mFollowed; @BindView(R.id.add_contact_error) Button mFollowError; private FollowContact.Presenter mPresenter; public ViewHolder(View itemView) { super(itemView); // 当前View和Presenter绑定 new FollowPresenter(this); } void refreshFollow(UserCard userCard){ if(userCard.isFollow()){ mFollow.setVisibility(View.GONE); mFollowed.setVisibility(View.VISIBLE); mFollowError.setVisibility(View.GONE); }else { mFollow.setVisibility(View.VISIBLE); mFollowed.setVisibility(View.GONE); mFollowError.setVisibility(View.GONE); } } @Override protected void onBind(UserCard userCard) { mPortraitView.setup(Glide.with(SearchUserFragment.this), userCard.getPortrait()); mName.setText(userCard.getName()); Log.d(TAG, "onBind: "+userCard.getName()+" isFollow:"+userCard.isFollow()); refreshFollow(userCard); } @OnClick(R.id.im_portrait) void onPortraitClick() { // 显示信息 // PersonalActivity.show(getContext(), mData.getId()); } @OnClick(R.id.add_contact) void onFollowClick() { // 发起关注 mPresenter.follow(mData.getId()); } @Override public void showError(int str) { mFollow.setVisibility(View.GONE); mFollowed.setVisibility(View.GONE); mFollowError.setVisibility(View.VISIBLE); } @Override public void showLoading() { mFollow.setEnabled(false); } @Override public void setPresenter(FollowContact.Presenter presenter) { mPresenter = presenter; } @Override public void onFollowSucceed(UserCard userCard) { Log.d(TAG, "onFollowSucceed: "); refreshFollow(userCard); // 发起更新 updateData(userCard); } } }
[ "sunshinekao@users.noreply.github.com" ]
sunshinekao@users.noreply.github.com
8a0bd8909eb8289801f3ec0cc47a6b567653a552
45ef9e391c17c1df857fbf4283caa714e8913453
/4.JavaCollections/src/com/javarush/task/task36/task3609/CarController.java
74d220858c953a653bf9ff9f0034ac8c236827d9
[]
no_license
V-element/JavaRushTasks
3bbcbf25230895c35ab5f688c6bf2785a051a6ec
ef76e99322243b12e0fb2357e54382acad8237be
refs/heads/master
2020-09-16T22:15:06.851135
2020-05-21T20:58:27
2020-05-21T20:58:27
223,648,379
1
0
null
null
null
null
UTF-8
Java
false
false
1,285
java
package com.javarush.task.task36.task3609; public class CarController { private CarModel model; private SpeedometerView view; public CarController(CarModel model, SpeedometerView view) { this.model = model; this.view = view; } public String getCarBrand() { return model.getBrand(); } public String getCarModel() { return model.getModel(); } public void setCarSpeed(int speed) { model.setSpeed(speed); } public int getCarSpeed() { return model.getSpeed(); } public int getCarMaxSpeed() { return model.getMaxSpeed(); } public void updateView() { view.printCarDetails(getCarBrand(), getCarModel(), getCarSpeed()); } public void increaseSpeed(int seconds) { if (model.getSpeed() < model.getMaxSpeed()) { model.setSpeed((int) (3.5 * seconds) + model.getSpeed()); } if (model.getSpeed() > model.getMaxSpeed()) { model.setSpeed(model.getMaxSpeed()); } } public void decreaseSpeed(int seconds) { if (model.getSpeed() > 0) { model.setSpeed(model.getSpeed() - 12 * seconds); } if (model.getSpeed() < 0) { model.setSpeed(0); } } }
[ "gnevanov.egor@gmail.com" ]
gnevanov.egor@gmail.com
315f1fdb8313dbb3b076acf1249edbef415f7aab
f404e0da964597f68e70e6b7adc273b39cf48c7f
/src/main/java/com/leetcode/linkedlist/RemoveDuplicatesFromSortList_II_82.java
a050c6eb292325e3ff5ea29dbb6249f6243568f8
[]
no_license
qiyei2015/Algorithms
93379ebdf1fb7f7d53e08a38bbf7b906a640ef7d
7288d86a1025764656d97108a1470a9f6957062d
refs/heads/master
2021-06-18T16:03:45.005133
2020-04-22T15:01:12
2020-04-22T15:01:12
123,296,084
1
1
null
null
null
null
UTF-8
Java
false
false
1,998
java
package com.leetcode.linkedlist; /** * @author Created by qiyei2015 on 2018/5/26. * @version: 1.0 * @email: 1273482124@qq.com * @description: 82 删除排序链表中的元素 重复元素全部删除 * https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list-ii/ */ public class RemoveDuplicatesFromSortList_II_82 { /** * 给定一个排序链表,删除所有含有重复数字的节点,只保留原始链表中 没有重复出现 的数字。 * * 示例 1: * * 输入: 1->2->3->3->4->4->5 * 输出: 1->2->5 * 示例 2: * * 输入: 1->1->1->2->3 * 输出: 2->3 * * 来源:力扣(LeetCode) * 链接:https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list-ii * 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 * @param head * @return */ public ListNode deleteDuplicates(ListNode head) { ListNode dummyHead = new ListNode(0); dummyHead.next = head; ListNode p = dummyHead.next; ListNode prev = dummyHead; while (p != null && p.next != null){ //1 if (p.val != p.next.val){ prev = p; p = p.next; } else { //相等,需要删除 p及p.next //2 更新p到最后一个等于前面值的结点 while (p != null && p.next != null && p.val == p.next.val){ p = p.next; } //3 if (p == null){ prev.next = null; } else { //4 删除p prev.next = p.next; ListNode del = p; p = p.next; del.next = null; } } } ListNode retNode = dummyHead.next; dummyHead.next = null; return retNode; } }
[ "1273482124@qq.com" ]
1273482124@qq.com
ce813f256de9fffa0d1cf852d3d44b589c68dd22
d05cc03c8acc1643d082b7c59d3e29e4048644ac
/src/main/java/com/active4j/hr/activiti/service/impl/WorkflowBaseServiceImpl.java
e9d7373d9cce8288e98c3f7f3058df6e7c742cd0
[]
permissive
chenxingxing6/active4j-flow
4bf6cd8f62e134dfff9a6132159962c75444537e
b4709fe136a0d52eb8c6e749afa2b32a7952b366
refs/heads/master
2022-10-08T08:12:08.023953
2020-06-10T09:28:00
2020-06-10T09:28:00
271,230,770
3
1
MIT
2020-06-10T09:08:36
2020-06-10T09:08:35
null
UTF-8
Java
false
false
1,622
java
package com.active4j.hr.activiti.service.impl; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.active4j.hr.activiti.dao.WorkflowBaseDao; import com.active4j.hr.activiti.entity.WorkflowBaseEntity; import com.active4j.hr.activiti.service.WorkflowBaseService; import com.active4j.hr.core.model.AjaxJson; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.extern.slf4j.Slf4j; /** * * @title WorkflowAuthService.java * @description 工作流 业务 * @time 2020年4月3日 下午2:24:38 * @author 麻木神 * @version 1.0 */ @Service("workflowBaseService") @Transactional @Slf4j public class WorkflowBaseServiceImpl extends ServiceImpl<WorkflowBaseDao, WorkflowBaseEntity> implements WorkflowBaseService { public AjaxJson validWorkflowBase(WorkflowBaseEntity workflowBaseEntity, AjaxJson j) { if(StringUtils.isBlank(workflowBaseEntity.getName())) { j.setSuccess(false); j.setMsg("流程名称不能为空"); return j; } if(StringUtils.isBlank(workflowBaseEntity.getProjectNo())) { j.setSuccess(false); j.setMsg("流程编号不能为空"); return j; } if(StringUtils.isBlank(workflowBaseEntity.getWorkflowId())) { j.setSuccess(false); j.setMsg("流程参数不能为空"); return j; } if(StringUtils.isBlank(workflowBaseEntity.getLevel())) { j.setSuccess(false); j.setMsg("流程紧急程度不能为空"); return j; } return j; } }
[ "teli_@xiaolei-chen" ]
teli_@xiaolei-chen
e18908d9dbed9162777e205954ce9b0fd36ef7c7
5fc3ef25798962ae6d0533b66d17dc7ebe8b77b9
/service/src/main/java/com/zlw/service/impl/OrderServiceImpl.java
c1e34f9a0e6ac563182777777a53b134f7ec3dc4
[]
no_license
ww95/zlw
5e724c4727b4ab9ca45323a6c35f0e93bf2e7294
7f41f87a217f72bf94c2a89b20143a0c63550e1e
refs/heads/master
2020-05-20T00:23:43.057091
2019-05-13T04:53:04
2019-05-13T04:53:04
185,284,975
0
0
null
null
null
null
UTF-8
Java
false
false
1,307
java
package com.zlw.service.impl; import com.zlw.bean.Collections; import com.zlw.bean.Order; import com.zlw.dao.CollectionDao; import com.zlw.dao.OrderDao; import com.zlw.service.CollectionService; import com.zlw.service.OrderService; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @Service("orderService") public class OrderServiceImpl implements OrderService { @Resource(name = "orderDao") private OrderDao orderDao; @Override public void addList(List<Order> list) { orderDao.insertList(list); } @Override public void addOne(Order order) { orderDao.insertOne(order); } @Override public List<Order> getAll() { return orderDao.selectAll(); } @Override public Order getById(Integer id) { return orderDao.selectOne(id); } @Override public void edit(Order order) { orderDao.update(order); } @Override public void removeById(Integer id) { orderDao.deleteById(id); } @Override public List<Order> getAllByGroup() { return orderDao.selectGroup(); } @Override public Integer selectSale() { return orderDao.selectSale(); } }
[ "18075715790@163.com" ]
18075715790@163.com
a71bd65107f9254213f643a61f05d7d52e9b7ee1
81b0248ec097c4d4a215197c0ab0d811f9861336
/src/es/uned/pfg/ae/web/RecursoAG.java
c51e7839ecd7c825c7328c013259f8885238ac35
[ "Apache-2.0" ]
permissive
fermin-silva/pfg
c64e939dd6004aee6a8d3a4a52db99a025819c34
f92e7d4dbba7ed4bcf8ff5f231fbc5f530d1474d
refs/heads/master
2020-04-01T23:53:38.158413
2015-07-02T14:19:00
2015-07-02T14:19:00
22,790,841
1
2
null
2014-08-11T18:38:47
2014-08-09T17:04:22
null
UTF-8
Java
false
false
1,217
java
package es.uned.pfg.ae.web; import es.uned.pfg.ae.Configuracion; import es.uned.pfg.ae.utils.MultiMap; import org.eclipse.jetty.util.ajax.JSON; import javax.xml.ws.WebEndpoint; import java.util.Map; /** * Recurso que ejecuta el Algoritmo Genetico via Web. * Devuelve el resultado en formato JSON * * @author Fermin Silva */ public class RecursoAG extends Recurso { private String tmpDir; private String webDir; private Configuracion config; public RecursoAG(Configuracion config, String tmpDir, String webDir) { this.config = config; this.tmpDir = tmpDir; this.webDir = webDir; } @Override public String get(MultiMap multiMap) { Configuracion conf = new ConfiguracionWeb(multiMap); //se delega la ejecucion a un controlador, ya que el recurso es //simplemente el punto de entrada Web, y no deberia contener mucha logica Map<String, Object> mapa = new ControladorAG(tmpDir, webDir).ejecutar(conf); //convertir el mapa con los resultados de la ejecucion a formato //json para que pueda ser interpretado por el navegador del cliente return JSON.toString(mapa); } }
[ "silvafermn@gmail.com" ]
silvafermn@gmail.com
2931f74c4e5b6c3d814da12cc57daed495f09098
dc797cea1fe1da08b5007aeba31756fb9e311e6b
/tools/src/androidTest/java/com/sola/github/kotlin/tools/ExampleInstrumentedTest.java
ad4b8616180f794feabe4b35c3c3786b30f5a96a
[]
no_license
CrazyClownSola/Kotlin_Test
627f099568e9a5add20cfe2f749c4beb62d5029a
8c173a7af4f0291e9369764718c89f3154f4e834
refs/heads/master
2021-01-25T06:29:56.704673
2017-06-19T09:20:37
2017-06-19T09:20:37
93,580,132
0
0
null
null
null
null
UTF-8
Java
false
false
765
java
package com.sola.github.kotlin.tools; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation 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() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.sola.github.kotlin.tools.test", appContext.getPackageName()); } }
[ "136他19407" ]
136他19407
ab9ac78337eebc1da9256d8265a292a896702b9a
44ae271be2d73eca174fd49e882e6a26f06433cc
/src/com/wingsinus/ep/AdminDateCount.java
520f3c262e474d89be0ed108d136d7e8074eb7da
[]
no_license
reasinPark/idolserver
94e15f705e78b6570876e0d186e335a95e108435
23c5594e542685d2c3a15d06098cda468727831c
refs/heads/master
2020-04-02T12:06:29.490125
2019-01-30T07:01:42
2019-01-30T07:01:42
154,419,682
0
0
null
null
null
null
UTF-8
Java
false
false
102
java
package com.wingsinus.ep; public class AdminDateCount { public String date; public String count; }
[ "raesin.park@wingsinus.com" ]
raesin.park@wingsinus.com
457b571b415342fa426acdeb67ff932a03bf5499
08449d901193b629acec1736e6d7ec884b4c2983
/src/test/java/com/fasterxml/jackson/failing/EnumCreator1699Test.java
a5c42fe068dc67ed3f747899d233abdcb9e613ea
[ "LicenseRef-scancode-generic-cla", "Apache-2.0" ]
permissive
xinzhg/jackson-databind
39546dc0db3d6fc2b1b943c53a15d384b5076400
b0972c7a645137cf69334ba0d4db53f9c479d1b1
refs/heads/master
2021-05-16T09:40:06.648727
2017-09-21T21:09:43
2017-09-21T21:09:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,272
java
package com.fasterxml.jackson.failing; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.databind.*; // Should be failing but isn't... keeping here for a bit, until underlying // problem is resolved (was active 21-Jul-2017) public class EnumCreator1699Test extends BaseMapTest { enum JacksonTest { TEST1(0), TEST2(1); private JacksonTest(int i) { } @JsonCreator public static JacksonTest fromInt(int i) { switch (i) { case 1: return TEST1; case 2: return TEST2; default: throw new IllegalArgumentException(); } } } public void testIssue1699() throws Exception { final ObjectMapper mapper = new ObjectMapper(); mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE); mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); mapper.setVisibility(PropertyAccessor.CREATOR, JsonAutoDetect.Visibility.ANY); JacksonTest result = mapper.readValue("1", JacksonTest.class); assertEquals(JacksonTest.TEST1, result); } }
[ "tatu.saloranta@iki.fi" ]
tatu.saloranta@iki.fi
48fc612070cd5add81fb46ac416fe4f77e68dff0
1721286fa3aab3158fc402070318eeae5fbde384
/src/Moves/Moves.java
e561d0e78a9dce993885bacc65eb26b283486d11
[]
no_license
navinramsaroop/PokemonTournament
af7eda0ba8263eda709bdd4915b6bd74f7948fb4
e9c744b34f8f584dd1aa309444d2c64e0bfd1c2f
refs/heads/master
2021-07-21T15:11:12.642115
2017-11-01T14:07:41
2017-11-01T14:07:41
108,793,752
0
0
null
null
null
null
UTF-8
Java
false
false
957
java
package Moves; public abstract class Moves { protected String name; protected int power; protected int accuracy; protected String type; /** * * @param name * @param power * @param accuracy * @param type */ public Moves(String name, int power, int accuracy, String type) { this.name = name; this.power = power; this.accuracy = accuracy; this.type = type; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getPower() { return power; } public void setPower(int power) { this.power = power; } public int getAccuracy() { return accuracy; } public void setAccuracy(int accuracy) { this.accuracy = accuracy; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String toString() { return name + " Type: " + type + "\n Power: " + power + " Accuracy: " + accuracy; } }
[ "navinr@dhcp-ccc-936.eduroam.cornell.edu" ]
navinr@dhcp-ccc-936.eduroam.cornell.edu
2f6d3dc6842d45665aed2bceaa1c62b85aa01614
88a46ddd59b21845fc4046900e70fa5e0ea53ae4
/src/main/java/com/eyelesson/dao/Mk_difficultyDao.java
501111257f0894b6cd95ed82c690ca559fe5c0f1
[]
no_license
3133035972/Eyelesson
505746fb120360b96f5642fe9f2351cc7ee564e7
8ca3a5045641fbeaf197e8416fa6ac56b615034c
refs/heads/master
2022-10-21T05:51:10.165837
2020-01-09T06:19:52
2020-01-09T06:19:52
228,186,702
0
0
null
2022-10-12T20:35:05
2019-12-15T13:13:54
Java
UTF-8
Java
false
false
407
java
package com.eyelesson.dao; import com.eyelesson.entity.Mk_difficulty; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; import java.util.List; @Mapper public interface Mk_difficultyDao extends tk.mybatis.mapper.common.Mapper<Mk_difficulty> { @Select("select * from mk_difficulty where mkdfid=#{mkdfid}") List<Mk_difficulty> findmkdfid(Integer mkdfid); }
[ "2387072301@qq.com" ]
2387072301@qq.com
0517a6a042c795482d2332f1585166e2adae40a5
a02ebaeed2756e0b9c238fe31355b5c86821e401
/Module_10/src/test/java/pages/google/CalculatorCloudGooglePage.java
de17f717c3e43a8eddb1ab82a1683496c676068d
[]
no_license
Vozzhaeva/at-mentoring
1a164f0e3c7055479949fb0695e725c93c41cbd1
ceff881a31435a3b6cb04f0dcbb68040f637fa2c
refs/heads/master
2023-02-13T01:00:59.693966
2021-01-17T19:56:52
2021-01-17T19:56:52
330,473,203
0
0
null
null
null
null
UTF-8
Java
false
false
8,626
java
package pages.google; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.testng.Assert; import pages.AbstractPage; import java.util.List; import java.util.Set; import java.util.stream.Collectors; import static utils.SeleniumUtils.findAndJsClick; import static utils.SeleniumUtils.highlighterMethod; public class CalculatorCloudGooglePage extends AbstractPage { private JavascriptExecutor javascriptExecutor; @FindBy(xpath = "//article[@class='devsite-article']/article[@class='devsite-article-inner']/div[2]/article/devsite-iframe/iframe") private WebElement firstFrame; @FindBy(xpath = "//iframe") private WebElement secondFrame; @FindBy(xpath = "//md-tab-item/div[@title='Compute Engine']") private WebElement computeEngineTab; @FindBy(xpath = "//input[@ng-model='listingCtrl.computeServer.quantity']") private WebElement numberOfInstancesInput; @FindBy(xpath = "//md-select[@ng-model='listingCtrl.computeServer.os']/md-select-value/span[1]/div") private WebElement operatingSystem; @FindBy(xpath = "//md-option/div[contains(text(), 'Free: Debian, CentOS, CoreOS, Ubuntu, or other User Provided OS')]") private WebElement operatingSystemOption; @FindBy(xpath = "//md-select[@ng-model='listingCtrl.computeServer.class']") private WebElement machineClass; @FindBy(xpath = "//md-option/div[contains(text(), 'Regular')]") private WebElement machineClassOption; @FindBy(xpath = "//md-select[@ng-model='listingCtrl.computeServer.instance']") private WebElement machineType; @FindBy(xpath = "//*[contains(text(),'n1-standard-8')]") private WebElement machineTypeOption; @FindBy(xpath = "//md-checkbox[@ng-model='listingCtrl.computeServer.addGPUs']") private WebElement addGPUsCheckBox; @FindBy(xpath = "//md-select[@ng-model='listingCtrl.computeServer.gpuCount']") private WebElement gpuCount; @FindBy(xpath = "//md-option[contains(@ng-repeat, 'item in listingCtrl.supportedGpuNumbers[listingCtrl.computeServer.gpuType]')]") private WebElement gpuCountOption; @FindBy(xpath = "//md-select[@ng-model='listingCtrl.computeServer.gpuType']") private WebElement gpuType; @FindBy(xpath = "//md-option[@value='NVIDIA_TESLA_V100']") private WebElement gpuTypeOption; @FindBy(xpath = "//md-select[@ng-model='listingCtrl.computeServer.ssd']") private WebElement ssd; @FindBy(xpath = "//md-option/div[contains(text(), '2x375 GB')]") private WebElement ssdOption; @FindBy(xpath = "//md-select[@placeholder='Datacenter location']") private WebElement location; @FindBy(xpath = "//md-option/div[contains(text(), 'Frankfurt (europe-west3)')]/parent::md-option") private WebElement locationOption; @FindBy(xpath = "//md-select[@ng-model='listingCtrl.computeServer.cud']") private WebElement cud; @FindBy(xpath = "//md-option[@id='select_option_90']") private WebElement cudOption; @FindBy(xpath = "//button[@ng-click='listingCtrl.addComputeServer(ComputeEngineForm);']") private WebElement addToEstimate; @FindBy(xpath = "//*[@id='compute']/md-list/md-list-item/div") private List<WebElement> result; @FindBy(xpath = "//*[@id='email_quote']") private WebElement emailEstimate; @FindBy(xpath = "//*[@id='input_401']") private WebElement fieldEmail; @FindBy(xpath = "//*[@id='dialogContent_407']/form/md-dialog-actions/button[@aria-label='Send Email']") private WebElement sendEmail; @FindBy(xpath = "//*[@id='resultBlock']/md-card/md-card-content/div/div/div/h2[@class='md-title']/b[@class='ng-binding']") private WebElement priceSelector; private boolean workaround = true; protected CalculatorCloudGooglePage(WebDriver driver) { super(driver); javascriptExecutor = (JavascriptExecutor) driver; if (workaround) { // перестал фрейм открываться корректно на странице калькулятора поэтому фрейм в новом окне открывается driver.get(firstFrame.getAttribute("src")); driver.get(secondFrame.getAttribute("src")); } else { driver.switchTo().frame(firstFrame); driver.switchTo().frame(secondFrame); } } public CalculatorCloudGooglePage clickComputeEngine() { highlighterMethod(computeEngineTab, driver); computeEngineTab.click(); return this; } public CalculatorCloudGooglePage enterNumberOfInstances(String countOfInstances) { highlighterMethod(numberOfInstancesInput, driver); numberOfInstancesInput.sendKeys(countOfInstances); return this; } public CalculatorCloudGooglePage enterOperatingSystem() { highlighterMethod(operatingSystem, driver); findAndJsClick(javascriptExecutor, operatingSystem); highlighterMethod(operatingSystemOption, driver); findAndJsClick(javascriptExecutor, operatingSystemOption); return this; } public CalculatorCloudGooglePage enterVMClass() { highlighterMethod(machineClass, driver); findAndJsClick(javascriptExecutor, machineClass); highlighterMethod(machineClassOption, driver); findAndJsClick(javascriptExecutor, machineClassOption); return this; } public CalculatorCloudGooglePage enterMachineType() { highlighterMethod(machineType, driver); findAndJsClick(javascriptExecutor, machineType); highlighterMethod(machineTypeOption, driver); findAndJsClick(javascriptExecutor, machineTypeOption); return this; } public CalculatorCloudGooglePage enterGPUs() { highlighterMethod(addGPUsCheckBox, driver); findAndJsClick(javascriptExecutor, addGPUsCheckBox); highlighterMethod(gpuCount, driver); findAndJsClick(javascriptExecutor, gpuCount); highlighterMethod(gpuCountOption, driver); findAndJsClick(javascriptExecutor, gpuCountOption); highlighterMethod(gpuType, driver); findAndJsClick(javascriptExecutor, gpuType); highlighterMethod(gpuTypeOption, driver); findAndJsClick(javascriptExecutor, gpuTypeOption); return this; } public CalculatorCloudGooglePage enterSSD() { highlighterMethod(ssd, driver); findAndJsClick(javascriptExecutor, ssd); highlighterMethod(ssdOption, driver); findAndJsClick(javascriptExecutor, ssdOption); return this; } public CalculatorCloudGooglePage enterDatecenterLocation() { highlighterMethod(location, driver); findAndJsClick(javascriptExecutor, location); highlighterMethod(locationOption, driver); findAndJsClick(javascriptExecutor, locationOption); return this; } public CalculatorCloudGooglePage enterCommitedUsage() { highlighterMethod(cud, driver); findAndJsClick(javascriptExecutor, cud); highlighterMethod(cudOption, driver); findAndJsClick(javascriptExecutor, cudOption); return this; } public CalculatorCloudGooglePage clickAddToEstimate() { highlighterMethod(addToEstimate, driver); findAndJsClick(javascriptExecutor, addToEstimate); return this; } public Set<String> getResult() { return result.stream() .map(WebElement::getText) .collect(Collectors.toSet()); } public boolean sendEmail() { highlighterMethod(priceSelector, driver); String price = priceSelector.getText(); highlighterMethod(emailEstimate, driver); findAndJsClick(javascriptExecutor, emailEstimate); highlighterMethod(fieldEmail, driver); findAndJsClick(javascriptExecutor, fieldEmail); GenerateEmailPage generateEmailPage = new GenerateEmailPage(driver); enterGenerateEmail(generateEmailPage); highlighterMethod(sendEmail, driver); findAndJsClick(javascriptExecutor, sendEmail); return generateEmailPage.checkEmailShouldContain(price); } public void enterGenerateEmail(GenerateEmailPage generateEmailPage) { String generateEmail = generateEmailPage.generateEmail(javascriptExecutor); Assert.assertNotNull(generateEmail); highlighterMethod(fieldEmail, driver); findAndJsClick(javascriptExecutor, fieldEmail); fieldEmail.sendKeys(generateEmail); } }
[ "Anastasiia_Vozzhaeva@epam.com" ]
Anastasiia_Vozzhaeva@epam.com
cca6f639993ed0d385726c4501182db0bd0abd6f
bd578a6f42dcd29b24fde5a9c694f5f228a5531f
/Work/kd-classroom/kd-classroom-service/src/main/java/com/booksroo/classroom/service/BizTeacherClassService.java
98da0ea944ab5de87ba2a23d7a1b69442de43dbb
[]
no_license
AfantyLS/Afanty
e79fe0e7a82dbe50482ae7fbfc335264626600ce
0e1667119651cf46ad87c7ee80577b91ebe26258
refs/heads/master
2020-03-22T01:55:41.194581
2018-08-01T12:34:14
2018-08-01T12:34:14
139,338,681
0
0
null
2018-08-01T12:34:15
2018-07-01T15:07:05
null
UTF-8
Java
false
false
4,988
java
package com.booksroo.classroom.service; import com.booksroo.classroom.common.dao.TeacherClassMapper; import com.booksroo.classroom.common.domain.Subject; import com.booksroo.classroom.common.domain.TeacherClass; import com.booksroo.classroom.common.exception.BizException; import com.booksroo.classroom.common.query.BaseQuery; import com.booksroo.classroom.common.query.ClassDomainQuery; import com.booksroo.classroom.common.util.BizUtil; import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; /** * @author liujianjian * @date 2018/6/4 17:33 */ @Service("bizTeacherClassService") public class BizTeacherClassService extends BaseService { @Autowired private TeacherClassMapper teacherClassMapper; public TeacherClass getByPK(long id) { return teacherClassMapper.selectByPrimaryKey(id); } public Set<Long> getClassIdsByIds(Set<Long> ids) { if (CollectionUtils.isEmpty(ids)) return null; ClassDomainQuery query = new ClassDomainQuery(); query.noLimit(); query.setIds(ids); List<TeacherClass> list = getList(query); if (CollectionUtils.isEmpty(list)) return new HashSet<>(); Set<Long> set = new HashSet<>(); for (TeacherClass o : list) { set.add(o.getClassId()); } return set; } public Set<Long> getSubjectIdsByClass(long classId) { ClassDomainQuery query = new ClassDomainQuery(); query.setClassId(classId); query.noLimit(); List<TeacherClass> list = getList(query); if (CollectionUtils.isEmpty(list)) return null; StringBuilder sb = new StringBuilder(); for (TeacherClass o : list) { sb.append(o.getSubjectId()).append(","); } return BizUtil.strToLongs(sb.toString()); } public Map<Long, TeacherClass> getMapByClass(long classId) { ClassDomainQuery query = new ClassDomainQuery(); query.setClassId(classId); query.noLimit(); List<TeacherClass> list = getList(query); if (CollectionUtils.isEmpty(list)) return null; Map<Long, TeacherClass> map = new HashMap<>(); for (TeacherClass o : list) { map.put(o.getId(), o); } return map; } public List<TeacherClass> getList(ClassDomainQuery query) { return teacherClassMapper.select(query); } public TeacherClass getTCByCidAndSid(long classId, String subjectId) { ClassDomainQuery query = new ClassDomainQuery(); query.setClassId(classId); query.setSubjectId(subjectId); query.limitOne(); List<TeacherClass> list = getList(query); return CollectionUtils.isNotEmpty(list) ? list.get(0) : null; } @Transactional(rollbackFor = Throwable.class) public Boolean addTeacherClassInfo(List<TeacherClass> teacherClasses) throws Exception{ for(TeacherClass tc: teacherClasses){ if(teacherClassMapper.insertSelective(tc)<= 0)throw new BizException("教师班级信息插入失败"); } return true; } @Transactional(rollbackFor = Throwable.class) public Boolean updateTeacherClassInfo(TeacherClass teacherClass) { if (teacherClassMapper.updateTeacherClassInfo(teacherClass) <= 0) return false; return true; } @Transactional(rollbackFor = Throwable.class) public Boolean deleteOriTeacherClassInfo(Long teacherId){ if(teacherClassMapper.deleteOriMappingInfo(teacherId)<0)return false; return true; } @Transactional(rollbackFor = Throwable.class) public Boolean deleteOriByRetain(Long teacherId,Set<Long> RetainIds){ BaseQuery baseQuery = new BaseQuery(); baseQuery.setId(teacherId); baseQuery.setIds(RetainIds); if(teacherClassMapper.deleteOriRetainInfo(baseQuery)<0)return false; return true; } public Set<Long> queryTeacherIdsByClass(Set<Long> classIds){ List<TeacherClass> teacherClasses = teacherClassMapper.queryTeacherIdsByClass(classIds); if(teacherClasses==null||teacherClasses.size()<=0){ return null; } Set<Long> teacherIds = new HashSet<>(); for(TeacherClass tc:teacherClasses){ teacherIds.add(tc.getTeacherId()); } return teacherIds; } //查询老师所带班级Id public Set<Long> queryClassIdsByTeacherId(Long teacherId){ return teacherClassMapper.queryClassIdsByTeacherId(teacherId); } public Long queryIdByclassIdAndTeacherId(Long classId,Long teacherId){ TeacherClass teacherClass = new TeacherClass(); teacherClass.setTeacherId(teacherId); teacherClass.setClassId(classId); return teacherClassMapper.queryIdByCidAndTid(teacherClass); } }
[ "liushuai@booksroo.com" ]
liushuai@booksroo.com
f13ede3f16a9d9d907c2bc8bf296a13ca2054fd7
179f45808823ea8c984ea55fd9c31ce4e35111ee
/app/src/main/java/com/jennie/eventreporter/EventMapFragment.java
115412f05563b954f57b81cd32fef1a11df4da07
[]
no_license
ljennie/Android-Application-Tourists
f4ff0e760ee02a1c8f22b8908a3b4f4eb9a384f6
e3e044b1cd745f32a2c409f05926408ec8749fcf
refs/heads/master
2020-03-27T14:15:44.993455
2018-08-29T20:17:43
2018-08-29T20:17:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,164
java
package com.jennie.eventreporter; import android.content.Intent; import android.graphics.Bitmap; import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapView; import com.google.android.gms.maps.MapsInitializer; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.CameraPosition; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import java.util.ArrayList; import java.util.List; /** * A simple {@link Fragment} subclass. */ //用自己的fragment,并把mapView加进来 原因1为了保留导航栏 public class EventMapFragment extends Fragment implements OnMapReadyCallback, GoogleMap.OnInfoWindowClickListener, GoogleMap.OnMarkerClickListener { private GoogleMap mGoogleMap; private MapView mMapView; private View mView; private DatabaseReference database;//去firebase去取数据 private List<Event> events;//所以event存到event fragment里 private Marker lastClicked; public EventMapFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mView = inflater.inflate(R.layout.fragment_event_map, container, false); database = FirebaseDatabase.getInstance().getReference();//初始化 events = new ArrayList<Event>(); return mView; } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mMapView = (MapView) mView.findViewById(R.id.event_map_view); if (mMapView != null) { mMapView.onCreate(null); mMapView.onResume();// needed to get the map to display immediately mMapView.getMapAsync(this); // 对当前mapView进行更新 //getMapAsync调用onMapReady这个方法 } } @Override public void onResume() { super.onResume(); mMapView.onResume(); } @Override public void onPause() { super.onPause(); mMapView.onPause(); } @Override public void onDestroy() { super.onDestroy(); mMapView.onDestroy(); } @Override public void onLowMemory() { super.onLowMemory(); mMapView.onLowMemory(); } @Override public void onMapReady(GoogleMap googleMap) { /* MapsInitializer.initialize(getContext()); double latitude = 17.385044; double longitude = 78.486671; // Create marker on google map MarkerOptions marker = new MarkerOptions().position( new LatLng(latitude, longitude)).title("This is your focus"); // Change marker Icon on google map //显示水滴的图标 marker.icon(BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_ROSE)); // Add marker to google map googleMap.addMarker(marker); // Set up camera configuration, set camera to latitude = 17.385044, longitude = 78.486671, and set Zoom to 12 CameraPosition cameraPosition = new CameraPosition.Builder() .target(new LatLng(latitude, longitude)).zoom(12).build(); // zoom(12):显示范围 // Animate the zoom process googleMap.animateCamera(CameraUpdateFactory .newCameraPosition(cameraPosition)); */ MapsInitializer.initialize(getContext()); mGoogleMap = googleMap; mGoogleMap.setOnInfoWindowClickListener(this);//给marker加上了click listener mGoogleMap.setOnMarkerClickListener(this); final LocationTracker locationTracker = new LocationTracker(getActivity());//得到当前位置 locationTracker.getLocation(); double curLatitude = locationTracker.getLatitude();//得到经度纬度 double curLongitude = locationTracker.getLongitude(); //创建camera的position,定位camera的中心就是我当前的位置 CameraPosition cameraPosition = new CameraPosition.Builder() .target(new LatLng(curLatitude, curLongitude)).zoom(12).build(); //将camera定义的中心定位到我当前的位置 googleMap.animateCamera(CameraUpdateFactory .newCameraPosition(cameraPosition)); setUpMarkersCloseToCurLocation(googleMap, curLatitude, curLongitude); //再将周围events显示到我们周围 } private void setUpMarkersCloseToCurLocation(final GoogleMap googleMap, final double curLatitude, final double curLongitude) { events.clear(); database.child("events").addListenerForSingleValueEvent(new ValueEventListener() { //对于events的表进行搜索 @Override public void onDataChange(DataSnapshot dataSnapshot) { // Get all available events for (DataSnapshot noteDataSnapshot : dataSnapshot.getChildren()) { Event event = noteDataSnapshot.getValue(Event.class);//对他进行遍历,把每个entry转换成event double destLatitude = event.getLatitude(); double destLongitude = event.getLongitude(); int distance = Utils.distanceBetweenTwoLocations(curLatitude, curLongitude, destLatitude, destLongitude);//得到你当前的位置和event所对应的距离 if (distance <= 10) { events.add(event);//小于10mile,event加到class里去 } } // Set up every events for (Event event : events) {//对于每个所创建的event,我们需要建立marker // create marker MarkerOptions marker = new MarkerOptions().position( new LatLng(event.getLatitude(), event.getLongitude())). title(event.getTitle()); // Changing marker icon marker.icon(BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_ROSE)); // adding marker Marker mker = googleMap.addMarker(marker); mker.setTag(event); //marker 和events联系起来,因为之后点击的时候我们需要找到对应的event } } @Override public void onCancelled(DatabaseError databaseError) { //TODO: do something } }); } @Override //onInfoWindowClick 这个是Google map自带的,点击水滴就能出现相关的信息 //点击marker的时候会触发这个call back,这个方法就会将我们点击的marker传进来 public void onInfoWindowClick(Marker marker) { Event event = (Event)marker.getTag();//从marker中得到对应的events Intent intent = new Intent(getContext(), CommentActivity.class); String eventId = event.getId();//得到event的ID,将它加入显现的intent里 intent.putExtra("EventID", eventId); getContext().startActivity(intent); } @Override public boolean onMarkerClick(final Marker marker) { final Event event = (Event)marker.getTag(); if (lastClicked != null && lastClicked.equals(marker)) { lastClicked = null; marker.hideInfoWindow(); marker.setIcon(null); return true; } else { lastClicked = marker; new AsyncTask<Void, Void, Bitmap>(){ @Override protected Bitmap doInBackground(Void... voids) { Bitmap bitmap = Utils.getBitmapFromURL(event.getImgUri()); return bitmap; } @Override protected void onPostExecute(Bitmap bitmap) { super.onPostExecute(bitmap); if (bitmap != null) { marker.setIcon(BitmapDescriptorFactory.fromBitmap(bitmap)); marker.setTitle(event.getTitle()); } } }.execute(); return false; } } }
[ "daodaomylove@gmail.com" ]
daodaomylove@gmail.com
fa6ef2ba7ea30400bc6c7f1e58478c827ef17500
3adddc59151b8bbdfd8f8c3904737db9e0dea900
/src/main/java/com/vn/osp/notarialservices/user/controller/UserLinksFactory.java
7cca29c583e53548838b3358283cbcadbff8936c
[]
no_license
TieuTruc14/uchi_v3_tccc_api
e3dca8fcdc88ee9ef37f6c4ca6d2e7037fc492af
27b88b78a72f6addf30bef911892d31d3a7dbf73
refs/heads/master
2020-03-31T13:19:29.952367
2018-10-09T12:56:40
2018-10-09T12:56:40
152,250,899
0
0
null
null
null
null
UTF-8
Java
false
false
774
java
package com.vn.osp.notarialservices.user.controller; import com.vn.osp.notarialservices.user.dto.User; import com.vn.osp.notarialservices.common.hateos.ExtendedLink; import com.vn.osp.notarialservices.user.exception.NoSuchUserException; import com.vn.osp.notarialservices.user.exception.UserAlreadyExistsException; import org.springframework.hateoas.Link; import org.springframework.stereotype.Component; import java.security.Principal; import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo; import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn; /** * Created by longtran on 20/10/2016. */ @Component public class UserLinksFactory { private static final UserController CONTROLLER = methodOn(UserController.class); }
[ "manh.phamtien142@gmail.com" ]
manh.phamtien142@gmail.com
2c1c0c529a8bd2b35ff2dd9eb1399f9c5fdef3cb
0f4002ee7fc84861b96e79955fe7a0e245636264
/src/cn/com/easy/xbuilder/element/SortcolStore.java
76c380a936b5f3975008dfa748c98a8fbc4450f4
[]
no_license
yy0827-mengjiang/easyframebase
aaaec37c2324c267fd16fd558fec6634a02c0e2b
89dfd9fe6fe5cc5fe59401bc03a7854f77254405
refs/heads/master
2021-01-11T10:06:11.141490
2016-12-29T06:25:42
2016-12-29T06:25:42
77,517,479
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package cn.com.easy.xbuilder.element; import java.util.List; import cn.com.easy.jaxb.annotation.Element; @Element(name = "sortcolstore") public class SortcolStore { @Element(name = "sortcol") List<Sortcol> sortcolList; public List<Sortcol> getSortcolList() { return sortcolList; } public void setSortcolList(List<Sortcol> sortcolList) { this.sortcolList = sortcolList; } }
[ "564190998@qq.com" ]
564190998@qq.com
3c3983aa311504ea1f1f887e36b21964f75a9f84
6a9b9ad608449e2942179be0627841787fb028d8
/src/com/axelby/podax/SubscriptionCursor.java
b96d72b55511144fa7e5f02f8b66b5819dd0ef00
[ "BSD-2-Clause" ]
permissive
jsimpson66/Podax
94bd5e6742500dc3fa74e8571705893672ed877c
2d3ac938789e6fbf872534049699546787c1fcfd
refs/heads/master
2020-05-01T04:01:07.946435
2014-05-04T23:48:54
2014-05-04T23:48:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,764
java
package com.axelby.podax; import android.content.ContentUris; import android.database.Cursor; import android.net.Uri; import java.util.Date; public class SubscriptionCursor { private Cursor _cursor; private Integer _idColumn = null; private Integer _titleColumn = null; private Integer _urlColumn = null; private Integer _lastModifiedColumn = null; private Integer _lastUpdateColumn = null; private Integer _etagColumn = null; private Integer _thumbnailColumn = null; private Integer _titleOverrideColumn = null; private Integer _queueNewColumn = null; private Integer _expirationDaysColumn = null; public SubscriptionCursor(Cursor cursor) { if (cursor.isAfterLast()) return; _cursor = cursor; } public boolean isNull() { return _cursor == null; } public Uri getContentUri() { if (getId() == null) return null; return ContentUris.withAppendedId(SubscriptionProvider.URI, getId()); } public Long getId() { if (_idColumn == null) _idColumn = _cursor.getColumnIndexOrThrow(SubscriptionProvider.COLUMN_ID); if (_cursor.isNull(_idColumn)) return null; return _cursor.getLong(_idColumn); } public String getTitle() { if (_titleOverrideColumn == null) _titleOverrideColumn = _cursor.getColumnIndex(SubscriptionProvider.COLUMN_TITLE_OVERRIDE); if (_titleOverrideColumn != -1 && !_cursor.isNull(_titleOverrideColumn)) return _cursor.getString(_titleOverrideColumn); if (_titleColumn == null) _titleColumn = _cursor.getColumnIndexOrThrow(SubscriptionProvider.COLUMN_TITLE); if (_cursor.isNull(_titleColumn)) return getUrl(); return _cursor.getString(_titleColumn); } public String getUrl() { if (_urlColumn == null) _urlColumn = _cursor.getColumnIndexOrThrow(SubscriptionProvider.COLUMN_URL); if (_cursor.isNull(_urlColumn)) return null; return _cursor.getString(_urlColumn); } public Date getLastModified() { if (_lastModifiedColumn == null) _lastModifiedColumn = _cursor.getColumnIndexOrThrow(SubscriptionProvider.COLUMN_LAST_MODIFIED); if (_cursor.isNull(_lastModifiedColumn)) return null; return new Date(_cursor.getLong(_lastModifiedColumn) * 1000); } public Date getLastUpdate() { if (_lastUpdateColumn == null) _lastUpdateColumn = _cursor.getColumnIndexOrThrow(SubscriptionProvider.COLUMN_LAST_UPDATE); if (_cursor.isNull(_lastUpdateColumn)) return null; return new Date(_cursor.getLong(_lastUpdateColumn) * 1000); } public String getETag() { if (_etagColumn == null) _etagColumn = _cursor.getColumnIndexOrThrow(SubscriptionProvider.COLUMN_ETAG); if (_cursor.isNull(_etagColumn)) return null; return _cursor.getString(_etagColumn); } public String getThumbnail() { if (_thumbnailColumn == null) _thumbnailColumn = _cursor.getColumnIndexOrThrow(SubscriptionProvider.COLUMN_THUMBNAIL); if (_cursor.isNull(_thumbnailColumn)) return null; return _cursor.getString(_thumbnailColumn); } public boolean getQueueNew() { if (_queueNewColumn == null) _queueNewColumn = _cursor.getColumnIndexOrThrow(SubscriptionProvider.COLUMN_QUEUE_NEW); if (_cursor.isNull(_queueNewColumn)) return true; return _cursor.getInt(_queueNewColumn) != 0; } public String getTitleOverride() { if (_titleOverrideColumn == null) _titleOverrideColumn = _cursor.getColumnIndexOrThrow(SubscriptionProvider.COLUMN_TITLE_OVERRIDE); if (_cursor.isNull(_titleOverrideColumn)) return null; return _cursor.getString(_titleOverrideColumn); } public Integer getExpirationDays() { if (_expirationDaysColumn == null) _expirationDaysColumn = _cursor.getColumnIndexOrThrow(SubscriptionProvider.COLUMN_EXPIRATION); if (_cursor.isNull(_thumbnailColumn)) return null; return _cursor.getInt(_expirationDaysColumn); } }
[ "dan@axelby.com" ]
dan@axelby.com
a9b1146965bcdd4f1fd42b290844854cbde560d8
f4b69a9516f53ec4f43bea9bc1530716ab44c709
/src/nez/main/Verbose.java
b7110b07331cc3a2aea0771a6ab28eb334b6fd15
[]
no_license
sekiguchi-nagisa/nez-1
b29c521da55b1db39b38aa33981815bc0c0b6341
c0cf94de3abbf6d12e33ba121df23f2d98cc6ebc
refs/heads/master
2021-01-22T18:38:40.806834
2015-09-18T13:47:22
2015-09-18T13:47:22
37,115,154
0
0
null
2015-06-09T06:44:20
2015-06-09T06:44:20
null
UTF-8
Java
false
false
2,838
java
package nez.main; import java.lang.reflect.InvocationTargetException; import nez.lang.Expression; import nez.util.ConsoleUtils; public class Verbose { public static final String BugsReport1 = "kimio@ynu.ac.jp"; public static boolean General = true; public static boolean Example = false; public static boolean BacktrackActivity = false; public static boolean PackratParsing = false; public static boolean VirtualMachine = false; public static boolean ParsingExpression = false; public static boolean Grammar = false; public static boolean Debug = false; public static boolean SelfTesting = true; public static boolean NFA = true; public static boolean TraceException = true; public static boolean Time = false; public static void setAll() { General = true; Example = true; Grammar = true; ParsingExpression = true; VirtualMachine = true; PackratParsing = true; BacktrackActivity = true; Time = true; } public final static void print(String msg) { if (General) { ConsoleUtils.println(msg); } } public final static void println(String msg) { if (General) { ConsoleUtils.println(msg); } } public static void todo(Object msg) { if (General) { ConsoleUtils.println("TODO " + msg); } } public final static void printElapsedTime(String msg, long t1, long t2) { if (Time) { double d = (t2 - t1) / 1000000; ConsoleUtils.println(msg + ": " + String.format("%f", d) + "[ms]"); } } public static void noticeOptimize(String key, Expression p) { if (ParsingExpression) { ConsoleUtils.println("optimizing " + key + "\n\t" + p); } } public static void noticeOptimize(String key, Expression p, Expression pp) { if (ParsingExpression) { ConsoleUtils.println("optimizing " + key + "\n\t" + p + "\n\t => " + pp); } } public final static void debug(Object s) { if (Command.ReleasePreview) { ConsoleUtils.println("debug: " + s); } } public final static void FIXME(Object s) { if (Command.ReleasePreview) { ConsoleUtils.println("FIXME: " + s); } } public final static void printSelfTesting(Object s) { if (SelfTesting) { ConsoleUtils.println(s); } } public final static void printSelfTestingIndent(Object s) { if (SelfTesting) { ConsoleUtils.println(" " + s); } } public final static void printNFA(Object s) { if (NFA) { ConsoleUtils.println("NFA: " + s); } } public static void traceException(Exception e) { if (TraceException) { if (e instanceof InvocationTargetException) { Throwable e2 = ((InvocationTargetException) e).getTargetException(); if (e2 instanceof RuntimeException) { throw (RuntimeException) e2; } } e.printStackTrace(); } } public static void printNoSuchMethodException(NoSuchMethodException e) { if (General) { ConsoleUtils.println(e); } } }
[ "kimio@konohascript.org" ]
kimio@konohascript.org
9c567e3f51c70f5b2a86181ad10bb686cb5d9c91
93f315fee18f8c97f6dad2a5d693778ca19691bf
/src/MyHashSet.java
01da23798df2d5be7636e6dd33f9258e1662af73
[]
no_license
AlexhahahaDrag/arithmetic
34f8e0b135a5f747e04546f81b6365a2a7208040
92232fd1758963bc964bea0759e8f0852b3cdaa0
refs/heads/master
2023-08-31T07:13:12.184136
2023-08-22T05:56:58
2023-08-22T05:56:58
170,278,495
2
0
null
null
null
null
UTF-8
Java
false
false
1,426
java
public class MyHashSet { static int[] arr; public static int size=0; /** Initialize your data structure here. */ public MyHashSet() { arr=new int[10]; } public void add(int key) { if(!contains(key)){ if(size>=arr.length) { int[] newArr = arr; arr = new int[arr.length * 2]; for (int i = 0; i < newArr.length; i++) { arr[i] = newArr[i]; } } arr[size++]=key; } } public void remove(int key) { if(contains(key)){ int index=0; for(int i=0;i<size;i++) { if(arr[i]==key) { index = i; } } for(int i=index;i<size;i++){ arr[i]=arr[i+1]; } size--; } } /** Returns true if this set contains the specified element */ public boolean contains(int key) { for(int i=0;i<size;i++) { if(arr[i]==key) { return true; } } return false; } } class Solutin{ public static void main(String[] args) { MyHashSet myHashSet=new MyHashSet(); myHashSet.add(1); myHashSet.remove(1); myHashSet.remove(2); System.out.println(myHashSet.size); System.out.println(myHashSet.contains(2)); } }
[ "734663446@qq.com" ]
734663446@qq.com
4d9bc2cb70e2580f21100af92b48808862622030
38b2e7722f4c3216af9ec106c59c3096fd7ac5b8
/app/src/main/java/com/example/maat/hello_daemon/DaemonBroadcastRecieve.java
cc3323eb5474ce1a8f1b566e31df6c7c615fea11
[]
no_license
supercoeus/Hello-Daemon
c897e7adf2524c8a1b35a6ff8c4859df572a6f89
edf3bbcfab4b9731e6ce81995579730b60793374
refs/heads/master
2021-05-03T21:42:07.767605
2016-10-12T05:44:44
2016-10-12T05:44:44
71,522,522
1
0
null
2016-10-21T02:32:09
2016-10-21T02:32:09
null
UTF-8
Java
false
false
841
java
package com.example.maat.hello_daemon; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; /** * Created by xinghongfei on 16/10/8. */ public class DaemonBroadcastRecieve extends BroadcastReceiver { private boolean isFirst = true; @Override public void onReceive(final Context context, Intent intent) { while (isFirst) { isFirst = false; while (true){ try { Thread.sleep(2000); Log.i("hehe", "DaemonBroadRecieve is onReceive"); context.startService(new Intent(context, RemoteService.class)); } catch (InterruptedException e) { e.printStackTrace(); } } } } }
[ "18911755084@163.com" ]
18911755084@163.com
0f2aab78e2b3e605fe4b90d749416019bd78fc49
9bdd5a9dd48efc03cc9988331e84af2a2e3d3379
/org.promasi.coredesigner/src/org/promasi/coredesigner/model/SdLookup.java
d17158cc442c669c0e7a38485567c9fc27570799
[]
no_license
antoxron/Promasi-V2
2fa4e936c428c2bfd01227610327103e566aab77
dd12edc9be64d13a3a5e0e4e63ffb5554f1b8b82
refs/heads/master
2021-01-18T11:34:09.331631
2013-07-01T19:03:02
2013-07-01T19:03:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
636
java
package org.promasi.coredesigner.model; import java.util.TreeMap; /** * Represents the Lookup Equation * * @author antoxron * */ public class SdLookup extends SdObject { /** * list of lookup equation (x,y) points */ private TreeMap<Double, Double> _lookupPoints; public SdLookup( ) { setType( LOOKUP_OBJECT ); } /** * * @param lookupPoints */ public void setLookupPoints( TreeMap<Double,Double> lookupPoints ) { _lookupPoints = lookupPoints; } /** * * @return lookupPoints */ public TreeMap<Double, Double> getLookupPoints( ) { return this._lookupPoints; } }
[ "antoxron@gmail.com" ]
antoxron@gmail.com
2f5323bf05f0955b71405480df427012238f4bc3
9a1b8f52f6b9ad728cb056d9069a67ffaac9a7a3
/app/src/main/java/com/example/recipiesbyingredients/models/Recipie.java
8e74479476b036470d7790ffde2b8e709f6a4c6e
[]
no_license
thompsonb908/RecipiesByIngredients
28230c46e2fc29660065b4318d7710e579158cac
614137b4738ab76d2bbffbc303ec05e53ced33a9
refs/heads/master
2022-11-19T11:55:51.630994
2020-07-21T20:50:57
2020-07-21T20:50:57
257,140,653
0
0
null
null
null
null
UTF-8
Java
false
false
1,192
java
package com.example.recipiesbyingredients.models; import java.io.Serializable; import java.util.List; public class Recipie implements Serializable { private String name; private List<Ingredient> ingredients; private List<String> instructions; private String imgURL; public Recipie(String name, List<Ingredient> ingredients, List<String> instructions, String imgURL) { this.name = name; this.ingredients = ingredients; this.instructions = instructions; this.imgURL = imgURL; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List<Ingredient> getIngredients() { return ingredients; } public void setIngredients(List<Ingredient> ingredients) { this.ingredients = ingredients; } public List<String> getInstructions() { return instructions; } public void setInstructions(List<String> instructions) { this.instructions = instructions; } public String getImgURL() { return imgURL; } public void setImgURL(String imgURL) { this.imgURL = imgURL; } }
[ "thompson.brandon908@gmail.com" ]
thompson.brandon908@gmail.com
4e709e70f32964550fc6dd7111c1d8a36a50bc40
7f4f24fc05294c9d27d83b4d0f5d6113aeb5f569
/app/src/main/java/com/example/waleed/uberclone/MainActivity.java
c68f49cd9d967c09028aa9cbb7a91392ee2416fe
[]
no_license
walidelmarassy/UberClone
c0401ef911cd35a86a4c6a68ff4bd56f6a6a2c40
cbcf8d30ede8b0c484068638d51af6be2d18d078
refs/heads/master
2020-06-22T18:30:09.403215
2018-12-05T14:20:47
2018-12-05T14:20:47
160,529,338
0
0
null
null
null
null
UTF-8
Java
false
false
2,810
java
package com.example.waleed.uberclone; import android.content.DialogInterface; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; import android.widget.RelativeLayout; import android.widget.SeekBar; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.rengwuxian.materialedittext.MaterialEditText; public class MainActivity extends AppCompatActivity { Button btnsignup,btnsignin; FirebaseAuth auth; FirebaseDatabase db; DatabaseReference users; RelativeLayout rootlayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); auth=FirebaseAuth.getInstance(); db=FirebaseDatabase.getInstance(); users=db.getReference("Users"); btnsignup=(Button)findViewById(R.id.signup); btnsignin=(Button)findViewById(R.id.signin); rootlayout=(RelativeLayout)findViewById(R.id.rootlayout); btnsignup.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showsignupDialog(); } }); } private void showsignupDialog() { final AlertDialog.Builder dialog=new AlertDialog.Builder(this); dialog.setTitle("REGISTER"); dialog.setMessage("PLEASE USE EMAIL TO REGISTER"); LayoutInflater inflater=LayoutInflater.from(this); View register_layout=inflater.inflate(R.layout.layout_register,null); final MaterialEditText edtEmail=register_layout.findViewById(R.id.edtEmail); MaterialEditText edtName=register_layout.findViewById(R.id.edtName); MaterialEditText edtpassword=register_layout.findViewById(R.id.edtpassword); MaterialEditText edtphone=register_layout.findViewById(R.id.edtphone); dialog.setView(register_layout); //set button dialog.setPositiveButton("REGISTER", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); if (TextUtils.isEmpty(edtEmail.getText().toString())) { } } }); dialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }); } }
[ "walidelmarassy@gmail.com" ]
walidelmarassy@gmail.com
2461148a652459eb1c421cd1728122e38853d73c
ae2e9c79a797263f1e9d0e0a71e24da2b2c64ee0
/org.eclipse.jt.core/src/org/eclipse/jt/core/impl/ORM_CoreAuthACL_ByActorAndOrg.java
29c2575d819f23f1181287f2be22c9a1b816fbb2
[]
no_license
JeffTang139/jtcore
6330762d6716a31a0c0f5e11b7a890949774470b
827c2267b7e39c5a6321f342e5916dfd00d51989
refs/heads/master
2021-01-18T14:36:41.142947
2012-03-27T03:16:34
2012-03-27T03:16:34
null
0
0
null
null
null
null
GB18030
Java
false
false
851
java
package org.eclipse.jt.core.impl; import org.eclipse.jt.core.def.arg.ArgumentDeclare; import org.eclipse.jt.core.def.query.ORMDeclarator; /** * 根据访问者字段、组织机构字段查找ACL项的语句定义 * * @author Jeff Tang 2009-12 */ final class ORM_CoreAuthACL_ByActorAndOrg extends ORMDeclarator<CoreAuthACLEntity> { public static final String NAME = "ORM_CoreAuthACL_ByActorAndOrg"; public ORM_CoreAuthACL_ByActorAndOrg(TD_CoreAuthACL td_CoreAuthACL) { super(NAME); this.orm.newReference(td_CoreAuthACL); final ArgumentDeclare arg1 = this.orm .newArgument(td_CoreAuthACL.f_actorID); final ArgumentDeclare arg2 = this.orm .newArgument(td_CoreAuthACL.f_orgID); this.orm.setCondition(this.orm.expOf(td_CoreAuthACL.f_actorID) .xEq(arg1) .and(this.orm.expOf(td_CoreAuthACL.f_orgID).xEq(arg2))); } }
[ "jefftang139@hotmail.com" ]
jefftang139@hotmail.com
985aec281c512ed61979673330383baba14e0fa1
559ea64c50ae629202d0a9a55e9a3d87e9ef2072
/cn/sharesdk/framework/authorize/C0033h.java
12b217a78c62f3b232541ed2dd1ae32099be7e2d
[]
no_license
CrazyWolf2014/VehicleBus
07872bf3ab60756e956c75a2b9d8f71cd84e2bc9
450150fc3f4c7d5d7230e8012786e426f3ff1149
refs/heads/master
2021-01-03T07:59:26.796624
2016-06-10T22:04:02
2016-06-10T22:04:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
389
java
package cn.sharesdk.framework.authorize; import android.view.View; import android.view.View.OnClickListener; /* renamed from: cn.sharesdk.framework.authorize.h */ class C0033h implements OnClickListener { final /* synthetic */ C1223g f27a; C0033h(C1223g c1223g) { this.f27a = c1223g; } public void onClick(View view) { new C0034i(this).start(); } }
[ "ahhmedd16@hotmail.com" ]
ahhmedd16@hotmail.com
cd30e2b848170ad0aa682b82fb07ef78c985009e
ec56c06b025978ccf91ae38447e9b3cdc6f34bab
/metamer/ftest/src/test/java/org/richfaces/tests/metamer/ftest/richInputNumberSpinner/InputNumberSpinnerAttributes.java
4ca13c6a0e4591fe97976b82c01acf19633eca60
[]
no_license
petrandreev/richfaces-qa
729d82be24aa27fbe0d14d52278914fdb6a51196
31d891c3902b50f0dc8065bf31d0c8533d09836e
refs/heads/master
2021-01-18T11:46:04.185873
2015-03-25T14:17:23
2015-03-25T14:17:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,295
java
/******************************************************************************* * JBoss, Home of Professional Open Source * Copyright 2010-2014, Red Hat, Inc. and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *******************************************************************************/ package org.richfaces.tests.metamer.ftest.richInputNumberSpinner; import org.richfaces.tests.metamer.ftest.attributes.AttributeEnum; /** * @author <a href="mailto:jstefek@redhat.com">Jiri Stefek</a> */ public enum InputNumberSpinnerAttributes implements AttributeEnum { accesskey, binding, converter, converterMessage, cycled, dir, disabled, enableManualInput, id, immediate, inputClass, inputSize, label, lang, maxValue, minValue, onblur, onchange, onclick, ondblclick, ondownclick, onfocus, oninputclick, oninputdblclick, oninputkeydown, oninputkeypress, oninputkeyup, oninputmousedown, oninputmousemove, oninputmouseout, oninputmouseover, oninputmouseup, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, onupclick, rendered, required, requiredMessage, step, style, styleClass, tabindex, title, validator, validatorMessage, value, valueChangeListener }
[ "jstefek@redhat.com" ]
jstefek@redhat.com
4b84d2b1be9eb43395cd8369783ad801537c7160
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/27/27_96667eb32ad2f0f13d3f44a81660feda5f540516/UserManager/27_96667eb32ad2f0f13d3f44a81660feda5f540516_UserManager_s.java
80d74c5b436e3f19ce502e068d5d9a62cfa9f723
[]
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
804
java
package it.sevenbits.space.service; import java.util.HashMap; import it.sevenbits.space.domain.User; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; @Service public class UserManager { private HashMap<String, User> users; public UserManager() { users = new HashMap<String, User>(); users.put("user", new User("user", "123", "ROLE_USER")); users.put("admin", new User("admin", "234", "ROLE_USER, ROLE_ADMIN")); } public User getUser(String username) throws UsernameNotFoundException { if(!users.containsKey(username)) { throw new UsernameNotFoundException(username + " not found"); } return users.get(username); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
b64be2fd991bb612f64aae3cddc5cdf6d7ddba8e
ab9436969d38fe8d01610f8c9a137c0d9db3dca9
/testnetworkapi/src/main/java/com/example/testnetworkapi/Model.java
3e65396b2e1a50e62d0992979500fe44e847e2b6
[]
no_license
wy198981/myParkingApp
8b9cbf9cbb996143c9f3df53158dd44fa1d08005
aaf4a2ab732b2865eb61b27ab397491a302b73e6
refs/heads/master
2021-01-18T03:29:36.129307
2017-03-22T11:21:01
2017-03-22T11:21:01
85,818,679
1
0
null
null
null
null
UTF-8
Java
false
false
435
java
package com.example.testnetworkapi; /** * Created by Administrator on 2017-02-17. */ public class Model { /** * 1, 服务器 IP 地址 */ public static String serverIP = "192.168.2.158"; /** * 2,服务器的端口号 */ public static String serverPort = "9000"; /// <summary> /// 3) token(用于访问服务器的唯一凭证) /// </summary> public static String token = ""; }
[ "13265539954@163.com" ]
13265539954@163.com
87aef360ce6e45f6d22b0254e34fce8388fe2fa8
ae45474eb6ce294074ee80bff4c4fac15d86ac4c
/arquillian.tutorial/src/test/java/arquillian/tutorial/functional/LoginPageIT.java
22cb0229f352f76fad05e02d74f835ee7b3cffa4
[]
no_license
LaviniaMasini/ArquillianTutorial
9319b76e731f4ec205c8c2e07b2ad074e1477e16
6998e426f43d1b1239e066f929ff13f1be56c9d4
refs/heads/master
2020-04-16T06:52:04.016048
2019-02-12T17:50:24
2019-02-12T17:50:24
165,364,052
1
0
null
2019-01-20T12:49:51
2019-01-12T08:19:55
Java
UTF-8
Java
false
false
4,306
java
package arquillian.tutorial.functional; import static org.junit.Assert.*; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.arquillian.junit.InSequence; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.Filters; import org.jboss.shrinkwrap.api.GenericArchive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.importer.ExplodedImporter; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; import org.openqa.selenium.By; import arquillian.tutorial.database.UsersDatabase; import arquillian.tutorial.entity.Users; import arquillian.tutorial.exception.DatabaseException; import arquillian.tutorial.helper.AbstractFunctionalTestHelper; import arquillian.tutorial.service.UsersService; @RunWith(Arquillian.class) public class LoginPageIT extends AbstractFunctionalTestHelper { @Deployment(testable = false) public static Archive<?> createDeployment() { return ShrinkWrap.create(WebArchive.class, "LoginPageIT.war").addPackage(Users.class.getPackage()) .addPackage(UsersService.class.getPackage()).addPackage(UsersDatabase.class.getPackage()) .addPackage(DatabaseException.class.getPackage()).addAsResource("scripts/import.sql") .merge(ShrinkWrap.create(GenericArchive.class).as(ExplodedImporter.class).importDirectory(WEBAPP_SRC) .as(GenericArchive.class), "/", Filters.include(".*\\.jsp$")) .addAsResource("test-persistence.xml", "META-INF/persistence.xml") .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); } @Test @InSequence(1) public void testUncorrectLogin() { buildURL("/LoginPageIT"); browser.findElement(By.id("loginBtn")).click(); browser.findElement(By.id("username")).sendKeys("prova"); browser.findElement(By.id("password")).sendKeys("prova"); browser.findElement(By.id("confirmBtn")).click(); assertEquals("Invalid username or password", browser.findElement(By.id("error")).getText()); } @Test @InSequence(2) public void testRightLogin() { buildURL("/LoginPageIT"); browser.findElement(By.id("loginBtn")).click(); browser.findElement(By.id("username")).sendKeys("username"); browser.findElement(By.id("password")).sendKeys("password"); browser.findElement(By.id("confirmBtn")).click(); assertUserSummaryPage(); } @Test @InSequence(3) public void testLogoutFromMenu() { buildURL("/LoginPageIT"); browser.findElement(By.id("welcomeBtn")).click(); browser.findElement(By.id("logout")).click(); assertEquals("Login Page", browser.getTitle()); } @Test public void testEmptyUsernameLoginPage() { buildURL("/LoginPageIT"); browser.findElement(By.id("loginBtn")).click(); assertEmptyFieldMessage("username", "title", "Please fill out this field"); } @Test public void testEmptyPasswordLoginPage() { buildURL("/LoginPageIT"); browser.findElement(By.id("loginBtn")).click(); assertEmptyFieldMessage("password", "title", "Please fill out this field"); } @Test public void testEmptyUsernameLoginPageAfterConfirm() { buildURL("/LoginPageIT"); browser.findElement(By.id("loginBtn")).click(); browser.findElement(By.id("confirmBtn")).click(); assertEmptyFieldMessage("username", "validationMessage", "Please insert valid Username"); } @Test public void testEmptyPasswordLoginPageAfterConfirm() { buildURL("/LoginPageIT"); browser.findElement(By.id("loginBtn")).click(); browser.findElement(By.id("confirmBtn")).click(); assertEmptyFieldMessage("password", "validationMessage", "Please insert valid Password"); } private void assertUserSummaryPage() { assertEquals("User Home", browser.getTitle()); assertEquals("Welcome username", browser.findElement(By.id("welcomeTitle")).getText()); assertEquals("Welcome username", browser.findElement(By.id("welcomeBtn")).getText()); browser.findElement(By.id("welcomeBtn")).click(); assertEquals("User Info", browser.findElement(By.id("userInfo")).getText()); assertEquals("Logout", browser.findElement(By.id("logout")).getText()); assertEquals("User Info", browser.findElement(By.id("userInfoBtn")).getText()); assertEquals("Logout", browser.findElement(By.id("logoutBtn")).getText()); } }
[ "masini.lavinia@gmail.com" ]
masini.lavinia@gmail.com
8ca11fda486dbf0e327d84266092b0b7f84c7714
20eb62855cb3962c2d36fda4377dfd47d82eb777
/IntroClassJava/dataset/smallest/818f8cf4e2e713753d02db9ee70a099b71f2a5a6bdc904191cf9ba68cfa5f64328464dccdd9b02fe0822e14a403dc196fe88b9964969409e60c93a776186a86a/002/mutations/374/smallest_818f8cf4_002.java
8e5b963c14c7250582fc418d9154796d40dcb2f2
[]
no_license
ozzydong/CapGen
356746618848065cce4e253e5d3c381baa85044a
0ba0321b6b1191443276021f1997833342f02515
refs/heads/master
2023-03-18T20:12:02.923428
2020-08-21T03:08:28
2020-08-21T03:08:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,625
java
package introclassJava; class IntObj { public int value; public IntObj () { } public IntObj (int i) { value = i; } } class FloatObj { public float value; public FloatObj () { } public FloatObj (float i) { value = i; } } class LongObj { public long value; public LongObj () { } public LongObj (long i) { value = i; } } class DoubleObj { public double value; public DoubleObj () { } public DoubleObj (double i) { value = i; } } class CharObj { public char value; public CharObj () { } public CharObj (char i) { value = i; } } public class smallest_818f8cf4_002 { public java.util.Scanner scanner; public String output = ""; public static void main (String[]args) throws Exception { smallest_818f8cf4_002 mainClass = new smallest_818f8cf4_002 (); String output; if (args.length > 0) { mainClass.scanner = new java.util.Scanner (args[0]); } else { mainClass.scanner = new java.util.Scanner (System.in); } mainClass.exec (); System.out.println (mainClass.output); } public void exec () throws Exception { IntObj num1 = new IntObj (), num2 = new IntObj (), num3 = new IntObj (), num4 = new IntObj (), num_smallest = new IntObj (); output += (String.format ("Please enter 4 numbers separated by spaces > ")); num1.value = scanner.nextInt (); num2.value = scanner.nextInt (); num3.value = scanner.nextInt (); num4.value = scanner.nextInt (); if ((num3.value) < (num2.value)) { num_smallest.value = num1.value; output += (String.format ("%d is the smallest\n", num_smallest.value)); } else if ((num2.value < num1.value) && (num2.value < num3.value) && (num2.value < num4.value)) { num_smallest.value = num2.value; output += (String.format ("%d is the smallest\n", num_smallest.value)); } else if ((num3.value < num1.value) && (num3.value < num2.value) && (num3.value < num4.value)) { num_smallest.value = num3.value; output += (String.format ("%d is the smallest\n", num_smallest.value)); } else if ((num4.value < num1.value) && (num4.value < num2.value) && (num4.value < num3.value)) { num_smallest.value = num1.value; output += (String.format ("%d is the smallest\n", num_smallest.value)); } if (true) return;; } }
[ "justinwm@163.com" ]
justinwm@163.com
e3986c3a2a588ca5f99453adf7fc6ce04fa1ee4b
4ea2a6950e2927c72db3c031c5398862bd86ab4c
/Programs/java_practise/KiloToMeter.java
5cd251c2981541f63c9d06faa103c6cca2fad2b4
[]
no_license
ZainaliSyed/Learning-Material
464ff472548bb8fd37676b481d17d0cc6687be8b
f898b3fa3694b27f054cd0dfb94e4dc4d8aa8a66
refs/heads/master
2021-07-19T08:40:48.079074
2018-12-22T06:07:47
2018-12-22T06:07:47
143,050,759
0
0
null
null
null
null
UTF-8
Java
false
false
259
java
import java.util.*; class KiloToMeter{ public static void main(String args[]){ Scanner ob=new Scanner(System.in); System.out.println("please enter the feet :"); double kilo=ob.nextDouble(); double meter=kilo*1000; System.out.println("meter are : "+meter); } }
[ "zainali.syed24@gmail.com" ]
zainali.syed24@gmail.com
100d063018e9730f1c4188ab14b4d591d957ab0a
ae130a99ebe80b5fba46817360d2cc71f93144e9
/src/main/java/com/bookstore/config/CORSFilter.java
d2dc7de0455d1243d545cab35d41e7585728578a
[]
no_license
isnyuan/bookstore
09e36b67461015a787e3fec768cc1c7c17223521
ea980ae9345de89ca30d03fecbe0e42f629cf51b
refs/heads/master
2023-01-06T14:13:27.314532
2020-11-04T12:46:57
2020-11-04T12:46:57
296,041,170
0
0
null
null
null
null
UTF-8
Java
false
false
1,763
java
package com.bookstore.config; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.context.annotation.Configuration; import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; /** * 功能描述: 处理跨域问题配置类 * @Author: lihuizong * @Date: 2020/10/21 19:22 */ @Order(Ordered.HIGHEST_PRECEDENCE) @Configuration public class CORSFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) servletRequest; HttpServletResponse response = (HttpServletResponse) servletResponse; response.setHeader("Access-Control-Allow-Origin","*"); response.setHeader("Access-Control-Allow-Credentials","true"); response.setHeader("Access-Control-Allow-Methods","POST,GET,OPTIONS,PUT,DELETE,PATCH,HEAD"); response.setHeader("Access-Control-Allow-Max-Age","3600"); response.setHeader("Access-Control-Allow-Headers","*"); if("OPTIONS".equalsIgnoreCase(request.getMethod())){ response.setStatus(HttpServletResponse.SC_OK); }else{ filterChain.doFilter(servletRequest,servletResponse); } } @Override public void destroy() { } }
[ "980775536@qq.com" ]
980775536@qq.com
f77f1cc76635e091ffd747de4c5e979e25d3a6d8
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XWIKI-12798-117-14-MOEAD-WeightedSum:TestLen:CallDiversity/com/xpn/xwiki/XWiki_ESTest_scaffolding.java
4732863cc73b2505d573dca8f2a418dae059ec9d
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
423
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Wed Apr 08 22:03:03 UTC 2020 */ package com.xpn.xwiki; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class XWiki_ESTest_scaffolding { // Empty scaffolding for empty test suite }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
a88482153d35c14a27aaaff0f05f3785b90d5942
2e6538461b6855e60c38025d4a6f4912db307472
/NA_Logic/src/Exceptions/InvalidNumberOfIDsException.java
b6dbe26f2ba783e069c5fba8ad9c351497fd023d
[]
no_license
avivAlfa/NA_web
cbf10b69a16753d27ad8447a91db75ce07108d58
8549f160e8c4d6943af5fbb70a7a87b57343b735
refs/heads/master
2021-01-17T15:59:57.293771
2017-03-04T10:14:41
2017-03-04T10:14:41
82,952,550
0
0
null
null
null
null
UTF-8
Java
false
false
220
java
package Exceptions; /** * Created by NofarD on 1/12/2017. */ public class InvalidNumberOfIDsException extends Exception { public String getMessage() { return "Not all players have a unique ID!"; } }
[ "Aviv" ]
Aviv
fb72673ac96e78049ca17005167435d0f1859f9a
7c59cb0aa0edc6a9a7ac7f23f7f9305e35c5ed3c
/app/src/main/java/com/recipes/dewordy/model/category/Category4.java
47ff72c16acf8e5fafb444850479ecbdc65d027e
[]
no_license
stanleysusanto/Schule
f4b2c97cfd256748899f4dc513f2d1cd89181dbb
250ce6f2988a6c7c9e40c2843b23acb783046536
refs/heads/master
2023-07-13T05:40:15.767522
2021-08-20T20:31:44
2021-08-20T20:31:44
398,392,226
1
0
null
null
null
null
UTF-8
Java
false
false
3,087
java
package com.recipes.dewordy.model.category; /** * Created by Paulstanley on 12/1/15. */ public class Category4 { private int topic_id; private String topic_ref; private int sub_next_id; private int next_id; private int category_id; private int sub_category_id; private String title; private String description; private String url; private String image; private String member_id; private String phone_number; private String email; private String created_date; private String modified_date; private String hits; public int getTopic_id() { return topic_id; } public void setTopic_id(int topic_id) { this.topic_id = topic_id; } public String getTopic_ref() { return topic_ref; } public void setTopic_ref(String topic_ref) { this.topic_ref = topic_ref; } public int getSub_next_id() { return sub_next_id; } public void setSub_next_id(int sub_next_id) { this.sub_next_id = sub_next_id; } public int getNext_id() { return next_id; } public void setNext_id(int next_id) { this.next_id = next_id; } public int getCategory_id() { return category_id; } public void setCategory_id(int category_id) { this.category_id = category_id; } public int getSub_category_id() { return sub_category_id; } public void setSub_category_id(int sub_category_id) { this.sub_category_id = sub_category_id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getMember_id() { return member_id; } public void setMember_id(String member_id) { this.member_id = member_id; } public String getPhone_number() { return phone_number; } public void setPhone_number(String phone_number) { this.phone_number = phone_number; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getCreated_date() { return created_date; } public void setCreated_date(String created_date) { this.created_date = created_date; } public String getModified_date() { return modified_date; } public void setModified_date(String modified_date) { this.modified_date = modified_date; } public String getHits() { return hits; } public void setHits(String hits) { this.hits = hits; } }
[ "stanleysusanto8@gmail.cpom" ]
stanleysusanto8@gmail.cpom
122fa49eca17b520bb051802e6230940c8b61912
2655102b86e9c009091a67cc0ac5918cef33ac21
/src/main/java/org/hse/robowar/repository/FightRepository.java
2d98fc8652df7d50a0944bd5a44c8c6b3dd22fce
[]
no_license
GreeMoz/robowar-java-server
5c0b9b414f467d28071a74d423f69f4c5ec578c4
20d03c2487827005dc5bf61934eb7cd675e035cb
refs/heads/master
2023-04-02T17:15:46.917509
2021-04-11T16:22:44
2021-04-11T16:22:44
356,911,582
0
0
null
null
null
null
UTF-8
Java
false
false
233
java
package org.hse.robowar.repository; import org.hse.robowar.model.Fight; import org.springframework.data.jpa.repository.JpaRepository; import java.util.UUID; public interface FightRepository extends JpaRepository<Fight, UUID> { }
[ "v.krasnov@lunawealth.com" ]
v.krasnov@lunawealth.com
d1a105dba5cc4e6aca3dc62fe75f34e017f866c6
b4ca4f744ceea8f882378d605241c3af60ae70e5
/BriteLite/src/britelite/BriteLite.java
d1f181c92b95303306368ddf69952af7992620c4
[]
no_license
raphaelbreuer/java
99192d993ad19683c94dfbed9915e297fa8fa4eb
d147880dacce524230f7a42bdd438b8da622c884
refs/heads/master
2021-01-23T08:48:44.793249
2017-09-07T16:47:07
2017-09-07T16:47:07
102,551,673
0
0
null
null
null
null
UTF-8
Java
false
false
710
java
package britelite; import java.awt.*; import javax.swing.*; /** * * @author Breuer */ public class BriteLite extends JFrame { int row =20; int column=20; int bulb=30; public BriteLite() { setLayout(new GridLayout(row,column)); for (int i = 0; i < row*column; i++) { add( new Bulb()); } setSize(row*bulb, column*bulb); setResizable(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); setLocationRelativeTo(null); setTitle("Brite Game"); } public static void main(String[] args) { new BriteLite(); } }
[ "rafibreuer@gmail.com" ]
rafibreuer@gmail.com
f74b9b4a9f754c2cfe4f783b607080bae5c151f4
1c5e8605c1a4821bc2a759da670add762d0a94a2
/src/dahua/fdc/contract/contractsplit/client/ContractPCSplitBillEditUI.java
f77d69a9627b56e2712b522cec9b2ddb6d8fc315
[]
no_license
shxr/NJG
8195cfebfbda1e000c30081399c5fbafc61bb7be
1b60a4a7458da48991de4c2d04407c26ccf2f277
refs/heads/master
2020-12-24T06:51:18.392426
2016-04-25T03:09:27
2016-04-25T03:09:27
19,804,797
0
3
null
null
null
null
GB18030
Java
false
false
33,967
java
/** * output package name */ package com.kingdee.eas.fdc.contract.contractsplit.client; import java.awt.event.ActionEvent; import java.math.BigDecimal; import java.sql.SQLException; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import javax.swing.Action; import org.apache.log4j.Logger; import com.kingdee.bos.BOSException; import com.kingdee.bos.ctrl.extendcontrols.IDataFormat; import com.kingdee.bos.ctrl.kdf.table.IRow; import com.kingdee.bos.ctrl.kdf.table.KDTDefaultCellEditor; import com.kingdee.bos.ctrl.kdf.table.KDTSelectBlock; import com.kingdee.bos.ctrl.kdf.table.KDTSelectManager; import com.kingdee.bos.ctrl.kdf.table.KDTable; import com.kingdee.bos.ctrl.kdf.table.event.KDTEditEvent; import com.kingdee.bos.ctrl.kdf.util.render.ObjectValueRender; import com.kingdee.bos.ctrl.kdf.util.style.Styles.HorizontalAlignment; import com.kingdee.bos.ctrl.swing.KDFormattedTextField; import com.kingdee.bos.ctrl.swing.KDTextField; import com.kingdee.bos.dao.IObjectPK; import com.kingdee.bos.dao.IObjectValue; import com.kingdee.bos.dao.ormapping.ObjectUuidPK; import com.kingdee.bos.metadata.entity.EntityViewInfo; import com.kingdee.bos.metadata.entity.FilterInfo; import com.kingdee.bos.metadata.entity.FilterItemInfo; import com.kingdee.bos.metadata.entity.SelectorItemCollection; import com.kingdee.bos.metadata.query.util.CompareType; import com.kingdee.bos.ui.face.CoreUIObject; import com.kingdee.bos.ui.face.IUIWindow; import com.kingdee.bos.ui.face.UIFactory; import com.kingdee.bos.util.BOSUuid; import com.kingdee.eas.common.EASBizException; import com.kingdee.eas.common.client.OprtState; import com.kingdee.eas.common.client.UIContext; import com.kingdee.eas.common.client.UIFactoryName; import com.kingdee.eas.fdc.basedata.CostSplitStateEnum; import com.kingdee.eas.fdc.basedata.FDCHelper; import com.kingdee.eas.fdc.basedata.FDCSQLBuilder; import com.kingdee.eas.fdc.basedata.client.FDCMsgBox; import com.kingdee.eas.fdc.basedata.client.FDCSplitClientHelper; import com.kingdee.eas.fdc.contract.ContractBillFactory; import com.kingdee.eas.fdc.contract.ContractBillInfo; import com.kingdee.eas.fdc.contract.ContractChangeBillFactory; import com.kingdee.eas.fdc.contract.ContractChangeBillInfo; import com.kingdee.eas.fdc.contract.ContractPropertyEnum; import com.kingdee.eas.fdc.contract.ContractSettlementBillFactory; import com.kingdee.eas.fdc.contract.ContractSettlementBillInfo; import com.kingdee.eas.fdc.contract.contractsplit.ContractPCSplitBillCollection; import com.kingdee.eas.fdc.contract.contractsplit.ContractPCSplitBillEntryFactory; import com.kingdee.eas.fdc.contract.contractsplit.ContractPCSplitBillEntryInfo; import com.kingdee.eas.fdc.contract.contractsplit.ContractPCSplitBillFactory; import com.kingdee.eas.fdc.contract.contractsplit.ContractPCSplitBillInfo; import com.kingdee.eas.fdc.contract.programming.ProgrammingContractCollection; import com.kingdee.eas.fdc.contract.programming.ProgrammingContractInfo; import com.kingdee.eas.framework.ICoreBase; import com.kingdee.eas.framework.client.FrameWorkClientUtils; import com.kingdee.eas.util.SysUtil; import com.kingdee.eas.util.client.EASResource; import com.kingdee.eas.util.client.MsgBox; import com.kingdee.jdbc.rowset.IRowSet; /** * output class name */ public class ContractPCSplitBillEditUI extends AbstractContractPCSplitBillEditUI { private static final Logger logger = CoreUIObject.getLogger(ContractPCSplitBillEditUI.class); private IUIWindow selectUI=null; private boolean hasRemove=false; private BigDecimal totalSupplyAmount=null; private String mainContractId=null; public ContractPCSplitBillEditUI() throws Exception{ super(); } protected void attachListeners() { } protected void detachListeners() { } protected ICoreBase getBizInterface() throws Exception { return ContractPCSplitBillFactory.getRemoteInstance(); } protected KDTable getDetailTable() { return this.kdtEntrys; } protected KDTextField getNumberCtrl() { return null; } protected void getMainContractId(String billId) throws BOSException, SQLException{ FDCSQLBuilder builder = new FDCSQLBuilder(); builder.appendSql(" select parent.fid id from t_con_contractbillentry entry inner join t_con_contractbill con on con.fid = entry.fparentid and con.fisAmtWithoutCost=1 and"); builder.appendSql(" con.fcontractPropert='SUPPLY' inner join T_Con_contractBill parent on parent.fnumber = con.fmainContractNumber and parent.fcurprojectid=con.fcurprojectid "); builder.appendSql(" where entry.FRowkey='am' and con.fstate='4AUDITTED' and con.fid='"+billId+"'"); IRowSet rowSet = builder.executeQuery(); while(rowSet.next()){ mainContractId=rowSet.getString("id"); } } protected void getSupplyAmount(String billId) throws BOSException, SQLException{ FDCSQLBuilder builder = new FDCSQLBuilder(); builder.appendSql(" select sum(entry.fcontent) as amount from t_con_contractbillentry entry inner join t_con_contractbill con on con.fid = entry.fparentid and con.fisAmtWithoutCost=1 and"); builder.appendSql(" con.fcontractPropert='SUPPLY' inner join T_Con_contractBill parent on parent.fnumber = con.fmainContractNumber and parent.fcurprojectid=con.fcurprojectid "); builder.appendSql(" where entry.FRowkey='am' and con.fstate='4AUDITTED' and parent.fid='"+billId+"'"); IRowSet rowSet = builder.executeQuery(); while(rowSet.next()){ totalSupplyAmount=rowSet.getBigDecimal("amount"); } } protected IObjectValue createNewData() { ContractPCSplitBillInfo info=new ContractPCSplitBillInfo(); String contractBillId = (String)getUIContext().get("contractBillId"); if(contractBillId!=null){ ContractBillInfo contractBillInfo=null; SelectorItemCollection sel = new SelectorItemCollection(); sel.add("id"); sel.add("number"); sel.add("name"); sel.add("amount"); sel.add("curProject.*"); sel.add("curProject.fullOrgUnit.*"); sel.add("contractPropert"); sel.add("contractType.id"); try { contractBillInfo = ContractBillFactory.getRemoteInstance().getContractBillInfo(new ObjectUuidPK(BOSUuid.read(contractBillId)),sel); } catch (Exception e) { handUIExceptionAndAbort(e); } info.setContractBill(contractBillInfo); info.setCurProject(contractBillInfo.getCurProject()); try { if(ContractPropertyEnum.SUPPLY.equals(contractBillInfo.getContractPropert())){ this.getMainContractId(contractBillId); if(mainContractId==null){ FDCMsgBox.showWarning(this,"主合同不存在!"); SysUtil.abort(); } EntityViewInfo view = new EntityViewInfo(); FilterInfo filter = new FilterInfo(); filter.getFilterItems().add(new FilterItemInfo("contractBill.id",mainContractId)); view.setFilter(filter); view.setSelector(this.getSelectors()); ContractPCSplitBillCollection spcol = ContractPCSplitBillFactory.getRemoteInstance().getContractPCSplitBillCollection(view); if(spcol.size()==0){ FDCMsgBox.showWarning(this,"请先先对主合同进行跨期合同合约规划拆分操作!"); SysUtil.abort(); } BigDecimal amount=contractBillInfo.getAmount(); for(int i=0;i<spcol.get(0).getEntry().size();i++){ ContractPCSplitBillEntryInfo entry=spcol.get(0).getEntry().get(i); entry.setId(null); if(entry.getScale()!=null&&amount!=null){ entry.setAmount(amount.multiply(entry.getScale()).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP)); } info.getEntry().add(entry); } info.setAmount(contractBillInfo.getAmount()); }else{ this.getSupplyAmount(contractBillId); info.setAmount(FDCHelper.subtract(contractBillInfo.getAmount(), totalSupplyAmount)); } } catch (BOSException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } } String contractChangeBillId = (String)getUIContext().get("contractChangeBillId"); if(contractChangeBillId!=null){ ContractChangeBillInfo contractChangeBillInfo=null; SelectorItemCollection sel = new SelectorItemCollection(); sel.add("id"); sel.add("contractBill.number"); sel.add("contractBill.name"); sel.add("amount"); sel.add("curProject.*"); sel.add("curProject.fullOrgUnit.*"); try { contractChangeBillInfo = ContractChangeBillFactory.getRemoteInstance().getContractChangeBillInfo(new ObjectUuidPK(BOSUuid.read(contractChangeBillId)),sel); } catch (Exception e) { handUIExceptionAndAbort(e); } info.setContractChangeBill(contractChangeBillInfo); info.setCurProject(contractChangeBillInfo.getCurProject()); info.setAmount(contractChangeBillInfo.getAmount()); EntityViewInfo view = new EntityViewInfo(); FilterInfo filter = new FilterInfo(); filter.getFilterItems().add(new FilterItemInfo("contractBill.id",contractChangeBillInfo.getContractBill().getId().toString())); view.setFilter(filter); view.setSelector(this.getSelectors()); try { ContractPCSplitBillCollection spcol = ContractPCSplitBillFactory.getRemoteInstance().getContractPCSplitBillCollection(view); if(spcol.size()==0){ FDCMsgBox.showWarning(this,"请先进行跨期合同合约规划拆分操作!"); SysUtil.abort(); } BigDecimal amount=contractChangeBillInfo.getAmount(); for(int i=0;i<spcol.get(0).getEntry().size();i++){ ContractPCSplitBillEntryInfo entry=spcol.get(0).getEntry().get(i); entry.setId(null); if(entry.getScale()!=null&&amount!=null){ entry.setAmount(amount.multiply(entry.getScale()).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP)); } info.getEntry().add(entry); } } catch (BOSException e) { e.printStackTrace(); } } // String contractChangeSettleBillId = (String)getUIContext().get("contractChangeSettleBillId"); // if(contractChangeSettleBillId!=null){ // ContractChangeSettleBillInfo contractChangeSettleBillInfo=null; // SelectorItemCollection sel = new SelectorItemCollection(); // sel.add("id"); // sel.add("contractBill.number"); // sel.add("contractBill.name"); // sel.add("allowAmount"); // sel.add("curProject.*"); // sel.add("curProject.fullOrgUnit.*"); // try { // contractChangeSettleBillInfo = ContractChangeSettleBillFactory.getRemoteInstance().getContractChangeSettleBillInfo(new ObjectUuidPK(BOSUuid.read(contractChangeSettleBillId)),sel); // } catch (Exception e) { // handUIExceptionAndAbort(e); // } // info.setContractChangeSettleBill(contractChangeSettleBillInfo); // info.setCurProject(contractChangeSettleBillInfo.getCurProject()); // info.setAmount(contractChangeSettleBillInfo.getAllowAmount()); // // EntityViewInfo view = new EntityViewInfo(); // FilterInfo filter = new FilterInfo(); // filter.getFilterItems().add(new FilterItemInfo("contractBill.id",contractChangeSettleBillInfo.getContractBill().getId().toString())); // view.setFilter(filter); // view.setSelector(this.getSelectors()); // try { // ContractPCSplitBillCollection spcol = ContractPCSplitBillFactory.getRemoteInstance().getContractPCSplitBillCollection(view); // if(spcol.size()==0){ // FDCMsgBox.showWarning(this,"请先进行跨期合同合约规划拆分操作!"); // SysUtil.abort(); // } // BigDecimal amount=contractChangeSettleBillInfo.getAllowAmount(); // for(int i=0;i<spcol.get(0).getEntry().size();i++){ // ContractPCSplitBillEntryInfo entry=spcol.get(0).getEntry().get(i); // entry.setId(null); // if(entry.getScale()!=null&&amount!=null){ // entry.setAmount(amount.multiply(entry.getScale()).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP)); // } // info.getEntry().add(entry); // } // } catch (BOSException e) { // e.printStackTrace(); // } // } String contractSettleBillId = (String)getUIContext().get("contractSettleBillId"); if(contractSettleBillId!=null){ ContractSettlementBillInfo contractSettleBillInfo=null; SelectorItemCollection sel = new SelectorItemCollection(); sel.add("id"); sel.add("contractBill.number"); sel.add("contractBill.name"); sel.add("curSettlePrice"); sel.add("curProject.*"); sel.add("curProject.fullOrgUnit.*"); try { contractSettleBillInfo = ContractSettlementBillFactory.getRemoteInstance().getContractSettlementBillInfo(new ObjectUuidPK(BOSUuid.read(contractSettleBillId)),sel); } catch (Exception e) { handUIExceptionAndAbort(e); } info.setContractSettleBill(contractSettleBillInfo); info.setCurProject(contractSettleBillInfo.getCurProject()); info.setAmount(contractSettleBillInfo.getCurSettlePrice()); EntityViewInfo view = new EntityViewInfo(); FilterInfo filter = new FilterInfo(); filter.getFilterItems().add(new FilterItemInfo("contractBill.id",contractSettleBillInfo.getContractBill().getId().toString())); view.setFilter(filter); view.setSelector(this.getSelectors()); try { ContractPCSplitBillCollection spcol = ContractPCSplitBillFactory.getRemoteInstance().getContractPCSplitBillCollection(view); if(spcol.size()==0){ FDCMsgBox.showWarning(this,"请先进行跨期合同合约规划拆分操作!"); SysUtil.abort(); } BigDecimal amount=contractSettleBillInfo.getCurSettlePrice(); for(int i=0;i<spcol.get(0).getEntry().size();i++){ ContractPCSplitBillEntryInfo entry=spcol.get(0).getEntry().get(i); entry.setId(null); if(entry.getScale()!=null&&amount!=null){ entry.setAmount(amount.multiply(entry.getScale()).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP)); } info.getEntry().add(entry); } } catch (BOSException e) { e.printStackTrace(); } } return info; } public void loadFields() { super.loadFields(); getTotal(); if(this.editData.getContractBill()!=null){ this.txtContractNumber.setText(this.editData.getContractBill().getNumber()); this.txtContractName.setText(this.editData.getContractBill().getName()); if(ContractPropertyEnum.SUPPLY.equals(this.editData.getContractBill().getContractPropert())){ this.txtAmount.setValue(this.editData.getContractBill().getAmount()); }else{ if(this.editData.getId()!=null){ try { this.getSupplyAmount(this.editData.getContractBill().getId().toString()); } catch (BOSException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } this.txtAmount.setValue(FDCHelper.subtract(this.editData.getContractBill().getAmount(), totalSupplyAmount)); } } }else if(this.editData.getContractChangeBill()!=null){ this.txtContractNumber.setText(this.editData.getContractChangeBill().getContractBill().getNumber()); this.txtContractName.setText(this.editData.getContractChangeBill().getContractBill().getName()); this.txtAmount.setValue(this.editData.getContractChangeBill().getAmount()); } // else if(this.editData.getContractChangeSettleBill()!=null){ // this.txtContractNumber.setText(this.editData.getContractChangeSettleBill().getContractBill().getNumber()); // this.txtContractName.setText(this.editData.getContractChangeSettleBill().getContractBill().getName()); // this.txtAmount.setValue(this.editData.getContractChangeSettleBill().getAllowAmount()); // } else if(this.editData.getContractSettleBill()!=null){ this.txtContractNumber.setText(this.editData.getContractSettleBill().getContractBill().getNumber()); this.txtContractName.setText(this.editData.getContractSettleBill().getContractBill().getName()); this.txtAmount.setValue(this.editData.getContractSettleBill().getCurSettlePrice()); } } protected void getTotal(){ BigDecimal splitedAmount=FDCHelper.ZERO; for(int i=0;i<this.getDetailTable().getRowCount();i++){ BigDecimal amount=(BigDecimal) this.getDetailTable().getRow(i).getCell("amount").getValue(); splitedAmount=FDCHelper.add(splitedAmount, amount); } this.txtSplitedAmount.setValue(splitedAmount); this.txtUnSplitAmount.setValue(FDCHelper.subtract(this.txtAmount.getBigDecimalValue(), splitedAmount)); } public void storeFields(){ BigDecimal unSplitAmount=this.txtUnSplitAmount.getBigDecimalValue(); BigDecimal splitAmount=this.txtSplitedAmount.getBigDecimalValue(); if(unSplitAmount.compareTo(FDCHelper.ZERO)>0){ if(splitAmount.compareTo(FDCHelper.ZERO)==0){ this.editData.setSplitState(CostSplitStateEnum.NOSPLIT); }else{ this.editData.setSplitState(CostSplitStateEnum.PARTSPLIT); } }else if(unSplitAmount.compareTo(FDCHelper.ZERO)==0){ this.editData.setSplitState(CostSplitStateEnum.ALLSPLIT); } super.storeFields(); } public void onLoad() throws Exception { super.onLoad(); this.actionAuditResult.setVisible(false); this.actionNextPerson.setVisible(false); this.actionMultiapprove.setVisible(false); this.actionAuditResult.setVisible(false); this.actionWorkFlowG.setVisible(false); this.actionWorkflowList.setVisible(false); this.actionCopyLine.setVisible(false); this.menuBiz.setVisible(false); this.actionPCSelect.putValue(Action.SMALL_ICON, EASResource.getIcon("imgTbtn_evaluatecortrol")); ObjectValueRender render_scale = new ObjectValueRender(); render_scale.setFormat(new IDataFormat() { public String format(Object o) { String str = o.toString(); if (!FDCHelper.isEmpty(str)) { return str + "%"; } return str; } }); this.getDetailTable().checkParsed(); this.getDetailTable().getColumn("scale").setRenderer(render_scale); this.getDetailTable().getColumn("scale").getStyleAttributes().setNumberFormat("#0.00"); this.getDetailTable().getColumn("scale").getStyleAttributes().setHorizontalAlign(HorizontalAlignment.RIGHT); KDFormattedTextField scale = new KDFormattedTextField(); scale.setDataType(KDFormattedTextField.BIGDECIMAL_TYPE); scale.setDataVerifierType(KDFormattedTextField.NO_VERIFIER); scale.setPrecision(2); scale.setMaximumValue(new BigDecimal(100)); if(this.editData.getContractChangeBill()!=null||this.editData.getContractChangeSettleBill()!=null){ scale.setNegatived(true); }else{ scale.setNegatived(false); } KDTDefaultCellEditor scaleEditor = new KDTDefaultCellEditor(scale); this.getDetailTable().getColumn("scale").setEditor(scaleEditor); KDFormattedTextField amount = new KDFormattedTextField(); amount.setDataType(KDFormattedTextField.BIGDECIMAL_TYPE); amount.setDataVerifierType(KDFormattedTextField.NO_VERIFIER); amount.setPrecision(2); if(this.editData.getContractChangeBill()!=null||this.editData.getContractChangeSettleBill()!=null){ amount.setNegatived(true); }else{ amount.setNegatived(false); } KDTDefaultCellEditor amountEditor = new KDTDefaultCellEditor(amount); this.getDetailTable().getColumn("amount").setEditor(amountEditor); this.getDetailTable().getColumn("amount").getStyleAttributes().setNumberFormat("#0.00"); this.getDetailTable().getColumn("amount").getStyleAttributes().setHorizontalAlign(HorizontalAlignment.RIGHT); this.getDetailTable().getColumn("pcAmount").setEditor(amountEditor); this.getDetailTable().getColumn("pcAmount").getStyleAttributes().setNumberFormat("#0.00"); this.getDetailTable().getColumn("pcAmount").getStyleAttributes().setHorizontalAlign(HorizontalAlignment.RIGHT); // if(this.editData.getContractBill()!=null&&!this.oprtState.equals(OprtState.VIEW)){ // FilterInfo filter=new FilterInfo(); // filter.getFilterItems().add(new FilterItemInfo("contractChangeSettleBill.contractBill.id",this.editData.getContractBill().getId().toString())); // // FilterInfo settleFilter=new FilterInfo(); // settleFilter.getFilterItems().add(new FilterItemInfo("contractSettleBill.contractBill.id",this.editData.getContractBill().getId().toString())); // if(this.getBillInterface().exists(filter)){ // this.actionRemoveLine.setEnabled(false); // this.actionPCSelect.setEnabled(false); // }else if(this.getBillInterface().exists(settleFilter)){ // this.actionRemoveLine.setEnabled(false); // this.actionPCSelect.setEnabled(false); // } // } } protected boolean isShowAttachmentAction(){ return false; } protected void setAuditButtonStatus(String oprtType) { super.setAuditButtonStatus(oprtType); if(this.oprtState.equals(OprtState.VIEW)){ this.actionRemoveLine.setEnabled(false); this.actionPCSelect.setEnabled(false); } if(this.editData!=null){ if(this.editData.getContractBill()!=null&&ContractPropertyEnum.SUPPLY.equals(this.editData.getContractBill().getContractPropert())){ this.actionRemoveLine.setVisible(false); this.actionPCSelect.setVisible(false); }else if(this.editData.getContractChangeBill()!=null){ this.contAmount.setBoundLabelText("预算金额"); this.setUITitle("跨期合同变更指令合约规划拆分"); this.actionRemoveLine.setVisible(false); this.actionPCSelect.setVisible(false); }else if(this.editData.getContractChangeSettleBill()!=null){ this.contAmount.setBoundLabelText("最终审定金额"); this.setUITitle("跨期合同变更确认合约规划拆分"); this.actionRemoveLine.setVisible(false); this.actionPCSelect.setVisible(false); }else if(this.editData.getContractSettleBill()!=null){ this.contAmount.setBoundLabelText("当前结算价"); this.setUITitle("跨期合同结算合约规划拆分"); this.actionRemoveLine.setVisible(false); this.actionPCSelect.setVisible(false); } } this.actionAudit.setVisible(false); this.actionUnAudit.setVisible(false); } public void afterActionPerformed(ActionEvent e) { super.afterActionPerformed(e); if(e.getSource()==btnRemove||e.getSource()==menuItemRemove){ if(hasRemove){ try { setOprtState(OprtState.VIEW); actionExitCurrent_actionPerformed(null); } catch (Exception e1) { handUIException(e1); } } } } public void actionRemove_actionPerformed(ActionEvent e) throws Exception { hasRemove=false; if(!confirmRemove()){ return; } String tempState = this.getOprtState(); this.setOprtState("REMOVE"); IObjectValue val = (IObjectValue)getUIContext().get("CURRENT.VO") ; getUIContext().put("CURRENT.VO",null) ; setDataObject(val) ; try { IObjectPK pk = new ObjectUuidPK(this.editData.getId()); this.getBizInterface().delete(pk); hasRemove=true; } finally { this.setOprtState(tempState); } setSave(true); setSaved(true); } protected void removeLine(KDTable table) { if (table == null) { return; } if ((table.getSelectManager().size() == 0)){ MsgBox.showInfo(this, EASResource.getString(FrameWorkClientUtils.strResource+ "Msg_NoneEntry")); return; } if (confirmRemove()) { KDTSelectManager selectManager = table.getSelectManager(); int size = selectManager.size(); KDTSelectBlock selectBlock = null; Set indexSet = new HashSet(); for (int blockIndex = 0; blockIndex < size; blockIndex++) { selectBlock = selectManager.get(blockIndex); int top = selectBlock.getBeginRow(); int bottom = selectBlock.getEndRow(); if (table.getRow(top) == null) { MsgBox.showInfo(this, EASResource.getString(FrameWorkClientUtils.strResource+ "Msg_NoneEntry")); return; } ContractPCSplitBillEntryInfo entry=(ContractPCSplitBillEntryInfo) table.getRow(top).getUserObject(); String pcId=entry.getProgrammingContract().getId().toString(); FilterInfo filter=new FilterInfo(); if(this.editData.getId()!=null){ filter.getFilterItems().add(new FilterItemInfo("head.id",editData.getId().toString(),CompareType.NOTEQUALS)); } filter.getFilterItems().add(new FilterItemInfo("programmingContract.id",pcId)); try { if(ContractPCSplitBillEntryFactory.getRemoteInstance().exists(filter)){ FDCMsgBox.showWarning(this,"第"+(top+1)+"行合约规划已经被关联,禁止删除!"); SysUtil.abort(); } } catch (EASBizException e) { e.printStackTrace(); } catch (BOSException e) { e.printStackTrace(); } for (int i = top; i <= bottom; i++) { indexSet.add(new Integer(i)); } } Integer[] indexArr = new Integer[indexSet.size()]; Object[] indexObj = indexSet.toArray(); System.arraycopy(indexObj, 0, indexArr, 0, indexArr.length); Arrays.sort(indexArr); if (indexArr == null){ return; } for (int i = indexArr.length - 1; i >= 0; i--) { int rowIndex = Integer.parseInt(String.valueOf(indexArr[i])); table.removeRow(rowIndex); } if (table.getRow(0) != null){ table.getSelectManager().select(0, 0); } } } public SelectorItemCollection getSelectors() { SelectorItemCollection sel=super.getSelectors(); sel.add("curProject.*"); sel.add("curProject.fullOrgUnit.*"); sel.add("splitState"); sel.add("entry.programmingContract.*"); sel.add("contractBill.number"); sel.add("contractBill.name"); sel.add("contractBill.amount"); sel.add("contractBill.contractPropert"); sel.add("contractBill.contractType.id"); sel.add("contractChangeBill.contractBill.number"); sel.add("contractChangeBill.contractBill.name"); sel.add("contractChangeBill.amount"); sel.add("contractChangeSettleBill.contractBill.number"); sel.add("contractChangeSettleBill.contractBill.name"); sel.add("contractChangeSettleBill.allowAmount"); sel.add("contractSettleBill.contractBill.number"); sel.add("contractSettleBill.contractBill.name"); sel.add("contractSettleBill.curSettlePrice"); return sel; } public void actionPCSelect_actionPerformed(ActionEvent e) throws Exception { ProgrammingContractCollection pcc=null; ProgrammingContractCollection addPcc=new ProgrammingContractCollection(); if(this.editData.getContractBill()==null&&this.editData.getContractChangeBill()==null&&this.editData.getContractChangeSettleBill()==null&&this.editData.getContractSettleBill()==null){ FDCMsgBox.showWarning(this,"关联单据不能为空!"); SysUtil.abort(); } if(selectUI==null){ UIContext uiContext = new UIContext(this); uiContext.put("curProject",this.editData.getCurProject()); uiContext.put("contractType",this.editData.getContractBill().getContractType()); selectUI=UIFactory.createUIFactory(UIFactoryName.MODEL).create(PCSelectUI.class.getName(),uiContext, null , null); }else{ ((PCSelectUI) selectUI.getUIObject()).actionNoneSelect_actionPerformed(null); } selectUI.show(); IUIWindow uiWin=selectUI; if (((PCSelectUI) uiWin.getUIObject()).isOk()) { pcc=((PCSelectUI) uiWin.getUIObject()).getData(); }else{ return; } if(pcc!=null){ for(int i=0;i<pcc.size();i++){ boolean isAdd=true; ProgrammingContractInfo pc=pcc.get(i); for(int j=0;j<this.getDetailTable().getRowCount();j++){ ContractPCSplitBillEntryInfo entry=(ContractPCSplitBillEntryInfo) this.getDetailTable().getRow(j).getUserObject(); if(entry.getProgrammingContract().getId().toString().equals(pc.getId().toString())){ isAdd=false; } } if(isAdd){ addPcc.add(pc); } } for(int i=0;i<addPcc.size();i++){ ProgrammingContractInfo pc=addPcc.get(i); ContractPCSplitBillEntryInfo entry=new ContractPCSplitBillEntryInfo(); entry.setProgrammingContract(pc); IRow addRow=this.getDetailTable().addRow(); addRow.setUserObject(entry); addRow.getCell("curProject").setValue(pc.getProgramming().getProject().getName()); addRow.getCell("pcNumber").setValue(pc.getLongNumber()); addRow.getCell("pcName").setValue(pc.getName()); addRow.getCell("pcAmount").setValue(pc.getAmount()); } } } protected void verifyInputForSave() throws Exception { if(this.editData.getContractBill()==null&&this.editData.getContractChangeBill()==null&&this.editData.getContractChangeSettleBill()==null&&this.editData.getContractSettleBill()==null){ FDCMsgBox.showWarning(this,"关联单据不能为空!"); SysUtil.abort(); } if(this.kdtEntrys.getRowCount()==0){ FDCMsgBox.showWarning(this,"分录不能为空!"); SysUtil.abort(); } // for(int i=0;i<this.kdtEntrys.getRowCount();i++){ // IRow row = this.kdtEntrys.getRow(i); // BigDecimal scale = (BigDecimal)row.getCell("scale").getValue(); // if (scale == null){ // FDCMsgBox.showWarning(this,"分录拆分比例不能为空!"); // this.kdtEntrys.getEditManager().editCellAt(row.getRowIndex(), this.kdtEntrys.getColumnIndex("scale")); // SysUtil.abort(); // } // if (scale.compareTo(FDCHelper.ZERO)==0){ // FDCMsgBox.showWarning(this,"分录拆分比例不能为0!"); // this.kdtEntrys.getEditManager().editCellAt(row.getRowIndex(), this.kdtEntrys.getColumnIndex("scale")); // SysUtil.abort(); // } // BigDecimal amount = (BigDecimal)row.getCell("amount").getValue(); // if (amount == null){ // FDCMsgBox.showWarning(this,"分录拆分金额不能为空!"); // this.kdtEntrys.getEditManager().editCellAt(row.getRowIndex(), this.kdtEntrys.getColumnIndex("amount")); // SysUtil.abort(); // } // if (amount.compareTo(FDCHelper.ZERO)==0){ // FDCMsgBox.showWarning(this,"分录拆分金额不能为0!"); // this.kdtEntrys.getEditManager().editCellAt(row.getRowIndex(), this.kdtEntrys.getColumnIndex("amount")); // SysUtil.abort(); // } // } BigDecimal unSplitAmount=this.txtUnSplitAmount.getBigDecimalValue(); BigDecimal amount=this.txtAmount.getBigDecimalValue(); if(amount!=null){ if(amount.compareTo(FDCHelper.ZERO)>=0){ if(unSplitAmount.compareTo(FDCHelper.ZERO)<0){ FDCMsgBox.showWarning(this, FDCSplitClientHelper.getRes("moreThan")); SysUtil.abort(); } }else{ if(unSplitAmount.compareTo(FDCHelper.ZERO)>0){ FDCMsgBox.showWarning(this, FDCSplitClientHelper.getRes("moreThan")); SysUtil.abort(); } } } if(this.editData.getContractBill()!=null&&!ContractPropertyEnum.SUPPLY.equals(this.editData.getContractBill().getContractPropert())){ for(int i=0;i<this.getDetailTable().getRowCount();i++){ ContractPCSplitBillEntryInfo entry=(ContractPCSplitBillEntryInfo) this.getDetailTable().getRow(i).getUserObject(); String pcId=entry.getProgrammingContract().getId().toString(); FilterInfo filter=new FilterInfo(); filter.getFilterItems().add(new FilterItemInfo("programmingContract.id",pcId)); if(ContractBillFactory.getRemoteInstance().exists(filter)){ FDCMsgBox.showWarning(this,"第"+(i+1)+"行合约规划已经被其他分期合同关联,请重新选择!"); SysUtil.abort(); } if(this.editData.getId()!=null){ filter.getFilterItems().add(new FilterItemInfo("head.id",editData.getId().toString(),CompareType.NOTEQUALS)); } filter.getFilterItems().add(new FilterItemInfo("head.contractBill.id",null,CompareType.NOTEQUALS)); filter.getFilterItems().add(new FilterItemInfo("head.contractBill.contractPropert",ContractPropertyEnum.SUPPLY_VALUE,CompareType.NOTEQUALS)); if(ContractPCSplitBillEntryFactory.getRemoteInstance().exists(filter)){ FDCMsgBox.showWarning(this,"第"+(i+1)+"行合约规划已经被其他跨期合同关联,请重新选择!"); SysUtil.abort(); } } } } protected void kdtEntrys_editStopped(KDTEditEvent e) throws Exception { IRow row=this.getDetailTable().getRow(e.getRowIndex()); BigDecimal contractAmount=this.txtAmount.getBigDecimalValue(); if (e.getColIndex()==this.getDetailTable().getColumnIndex("amount")){ BigDecimal amount=(BigDecimal) row.getCell("amount").getValue(); if(amount!=null){ row.getCell("scale").setValue(amount.multiply(new BigDecimal(100)).divide(contractAmount,2,BigDecimal.ROUND_HALF_UP)); }else{ row.getCell("scale").setValue(null); } }else if(e.getColIndex()==this.getDetailTable().getColumnIndex("scale")){ BigDecimal scale=(BigDecimal) row.getCell("scale").getValue(); if(scale!=null){ row.getCell("amount").setValue(contractAmount.multiply(scale).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP)); }else{ row.getCell("amount").setValue(null); } } getTotal(); } }
[ "shxr_code@126.com" ]
shxr_code@126.com
6b8c29987b8ad6f423941f9a229d39db806629c2
e3c9277bc2f5e8629872d4c3ffac4d9db4f28eb5
/week2&3/ProcessingFeeCalculator/src/com/sapient/processing_fee_calculator/MainApplication.java
512b7d06cc976dff7b481e8842d05e716a343af2
[]
no_license
sakshamnegi/PJP_2.0
d97858d9ca87861aeca2138c2101ec05ea8aa5fe
891acf1bf30fe1dd54165ce7eb3ecf1d37f5f002
refs/heads/master
2022-12-13T02:45:42.113263
2020-09-12T06:59:25
2020-09-12T06:59:25
288,662,539
0
0
null
null
null
null
UTF-8
Java
false
false
3,621
java
package com.sapient.processing_fee_calculator; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import com.sapient.processing_fee_calculator.models.PriorityFlag; import com.sapient.processing_fee_calculator.models.Transaction; import com.sapient.processing_fee_calculator.models.TransactionType; import com.sapient.processing_fee_calculator.services.CSVRecordsReader; import com.sapient.processing_fee_calculator.services.CSVReportGenerator; import com.sapient.processing_fee_calculator.services.RecordsReader; import com.sapient.processing_fee_calculator.services.ReportGenerator; public class MainApplication { // can be autowired with Spring private static RecordsReader recordsReader; private static ReportGenerator reportGenerator; static { recordsReader = new CSVRecordsReader(); reportGenerator = new CSVReportGenerator(); } // needs input and output file names as parameters from command line public static void main(String[] args) { String inputFilename = "SampleTransactions.csv"; String outputFilename = "Report.csv"; List<Transaction> transactions = readTransactions(inputFilename); List<Transaction> processedTransactions = processTransactions(transactions); generateTransactionReport(processedTransactions, outputFilename); } public static List<Transaction> readTransactions(String inputFilename) { return recordsReader.readRecords(inputFilename); } public static List<Transaction> processTransactions(List<Transaction> transactions) { List<Transaction> list = transactions.stream().collect(Collectors.toList()); // Normal Transactions for (Transaction t : list) { if (t.getPriorityFlag() == PriorityFlag.Y) { t.setProcessingFee(500); } else { TransactionType type = t.getTransactionType(); if (type == TransactionType.SELL || type == TransactionType.WITHDRAW) { t.setProcessingFee(100); } else if (type == TransactionType.BUY || type == TransactionType.DEPOSIT) { t.setProcessingFee(50); } } } Map<TransactionType, TransactionType> typeMap = new HashMap<TransactionType, TransactionType>(); typeMap.put(TransactionType.BUY, TransactionType.SELL); typeMap.put(TransactionType.SELL, TransactionType.BUY); typeMap.put(TransactionType.WITHDRAW, TransactionType.DEPOSIT); typeMap.put(TransactionType.DEPOSIT, TransactionType.WITHDRAW); // System.out.println("BEFORE+++++++++++++"); // System.out.println(transactions); // intra day transactions // checking if client id, security id and date are same // and transaction types are opposite Comparator<Transaction> intraDayComparater = (t1, t2) -> { if(t1.getClientID().equals(t2.getClientID()) && t1.getSecurityID().equals(t2.getSecurityID()) && t1.getTransactionDate().equals(t2.getTransactionDate()) && (t1.getTransactionType() == typeMap.get(t2.getTransactionType()))) { // System.out.println("intra-day spotted"); t1.setProcessingFee(t1.getProcessingFee()+10); t2.setProcessingFee(t2.getProcessingFee()+10); return (int) (t1.getProcessingFee()-t2.getProcessingFee()); } else { return t1.getClientID().compareTo(t2.getClientID()); } }; Collections.sort(list, intraDayComparater); // System.out.println("AFTER+++++++++++++"); // System.out.println(transactions); return list; } public static void generateTransactionReport(List<Transaction> transactions, String outputFilename) { reportGenerator.generateReport(transactions, outputFilename); } }
[ "sakshamnegi1@gmail.com" ]
sakshamnegi1@gmail.com
8fdf62f5fff3910c4d86db23c796289041e41735
9d54e9860deab14be8758e6caf74e3970988bbfc
/src/main/java/com/fixit/bo/utils/DataUtils.java
b02c1b64dde5840d7c837a8077d97ab9b6aaf7dc
[]
no_license
kostyantin2216/fix-it-backoffice
509c99d6912651ac1c59c6869cc930360b21c8a0
76a8b4916d857d0b905f26d10e08a66984c9b9d1
refs/heads/master
2021-03-27T08:40:40.973407
2018-01-24T09:37:52
2018-01-24T09:37:52
115,345,786
0
0
null
null
null
null
UTF-8
Java
false
false
635
java
/** * */ package com.fixit.bo.utils; import javax.faces.bean.ApplicationScoped; import javax.faces.bean.ManagedBean; import org.primefaces.model.map.LatLng; import org.springframework.stereotype.Component; /** * @author Kostyantin * @createdAt 2017/10/21 23:53:28 GMT+3 */ @Component @ManagedBean @ApplicationScoped public class DataUtils { public Integer[] boxArray(int[] array) { Integer[] result = new Integer[array.length]; for(int i = 0; i < array.length; i++) { result[i] = array[i]; } return result; } public String toString(LatLng latLng) { return latLng.getLat() + "," + latLng.getLng(); } }
[ "kostyantin2216@hotmail.com" ]
kostyantin2216@hotmail.com
2f60d9aafaed706a490e3980865a903dfaea358d
a7b868c8c81984dbcb17c1acc09c0f0ab8e36c59
/src/main/java/com/alipay/api/domain/GavinTestnew.java
f06856205ee3a1a7e767c70956cf028c7a3221f2
[ "Apache-2.0" ]
permissive
1755616537/alipay-sdk-java-all
a7ebd46213f22b866fa3ab20c738335fc42c4043
3ff52e7212c762f030302493aadf859a78e3ebf7
refs/heads/master
2023-02-26T01:46:16.159565
2021-02-02T01:54:36
2021-02-02T01:54:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
520
java
package com.alipay.api.domain; import com.alipay.api.AlipayObject; import com.alipay.api.internal.mapping.ApiField; /** * 测试 * * @author auto create * @since 1.0, 2019-06-05 19:46:49 */ public class GavinTestnew extends AlipayObject { private static final long serialVersionUID = 2421899321543946186L; /** * 测试 */ @ApiField("test") private String test; public String getTest() { return this.test; } public void setTest(String test) { this.test = test; } }
[ "ben.zy@antfin.com" ]
ben.zy@antfin.com
5556b7d225eeb48992c602191e787ea1e73cd8c3
f06be30154bdbf6f77f5107c0afef5b38f821404
/code/wxService/src/main/java/com/lws/domain/model/Page.java
9a9d6a21547139ebd29c03eaba3984edbb0b80d9
[]
no_license
lws364969870/wxService
b966647ffdb8e547428a6d3ab2a24e2aa78fbfa7
6a7cff6e5d2f3b3ecdf7a84f67d15d278c82c068
refs/heads/master
2021-07-13T01:08:31.458925
2017-10-12T16:40:57
2017-10-12T16:40:57
105,039,095
0
0
null
null
null
null
UTF-8
Java
false
false
1,432
java
package com.lws.domain.model; import java.util.List; /** * 分页数据 * @author WilsonLee * * @param <E> */ public class Page<E> { private List<E> list; private int totalRecords; private int pageSize; private int pageNo; private int totalPages; public int getTotalPages() { return ((this.totalRecords + this.pageSize - 1) / this.pageSize); } public void setTotalPages(int totalPages) { this.totalPages = totalPages; } public int countOffset(int currentPage, int pageSize) { int offset = pageSize * (currentPage - 1); return offset; } public int getTopPageNo() { return 1; } public int getPreviousPageNo() { if (this.pageNo <= 1) { return 1; } return (this.pageNo - 1); } public int getNextPageNo() { if (this.pageNo >= getBottomPageNo()) { return getBottomPageNo(); } return (this.pageNo + 1); } public int getBottomPageNo() { return getTotalPages(); } public List<E> getList() { return this.list; } public void setList(List<E> list) { this.list = list; } public int getTotalRecords() { return this.totalRecords; } public void setTotalRecords(int totalRecords) { this.totalRecords = totalRecords; } public int getPageSize() { return this.pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getPageNo() { return this.pageNo; } public void setPageNo(int pageNo) { this.pageNo = pageNo; } }
[ "364969870@qq.com" ]
364969870@qq.com
9f0189fa9bb5ab66c702b93af6b6c3f69775f3e3
5217e4f39c824f504166f2070e55e738f33671d3
/src/main/java/com/trade/app/exception/LowerVersionException.java
1486b2e5f3923fe230418410896e68e4f194ae35
[]
no_license
rameshsharma25/trade-store-app
2d5396f59d795987e4dec59bd03368775b6b92aa
5875223d2c67ac0638339a006af05d995005e524
refs/heads/master
2022-11-11T12:18:14.347412
2020-06-24T04:14:33
2020-06-24T04:14:33
274,566,270
0
0
null
null
null
null
UTF-8
Java
false
false
388
java
package com.trade.app.exception; public class LowerVersionException extends RuntimeException { /** * */ private static final long serialVersionUID = 1L; private int resourceId; public LowerVersionException(int resourceId, String message) { super(message); this.resourceId = resourceId; } public int getResourceId() { return resourceId; } }
[ "Ramesh Sharma@DESKTOP-U7BFO54" ]
Ramesh Sharma@DESKTOP-U7BFO54
05f6ff3f79f243c216d22bcd3fec34c2f8fc7f78
0edb766007a5f61c88ab6793f124d7041ca4bd6b
/app/src/test/java/com/something/zeeshanashraf/tictactoepro/ExampleUnitTest.java
ca8f7cc1e48da0477722f4fb60deac7209489715
[]
no_license
MuhammadZeeshanAshraf/TicTacToe
a48792f72aa882ae8a8ffbaca7876593c26198c7
1d42f1558c41f67503ab5b214edd703049246ab2
refs/heads/master
2020-05-05T03:15:32.558293
2019-04-05T11:20:05
2019-04-05T11:20:05
179,665,739
1
0
null
null
null
null
UTF-8
Java
false
false
401
java
package com.something.zeeshanashraf.tictactoepro; 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); } }
[ "43716301+MuhammadZeeshanAshraf@users.noreply.github.com" ]
43716301+MuhammadZeeshanAshraf@users.noreply.github.com
ddaa051e247854e7cd250e7eb8ab815fc8017517
958659ae80ec1642b4f458bfa9f423eafe87aff4
/MobileDataUsageClient/src/com/mobile/data/usage/GetMobileData.java
7d1a4fa99646488d57917391ecce7d41b1180af3
[]
no_license
amitesh007/Object_Oriented_Analysis_And_Design
c719c2715ebbd1c387946b8d3e19237508cc6fef
ffa73cfd9f40382b82318e70ce9033053ca4fbf9
refs/heads/master
2020-04-04T15:52:45.653332
2018-11-04T06:35:57
2018-11-04T06:35:57
156,055,681
0
0
null
null
null
null
UTF-8
Java
false
false
1,379
java
package com.mobile.data.usage; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for getMobileData complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="getMobileData"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="arg0" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "getMobileData", propOrder = { "arg0" }) public class GetMobileData { protected String arg0; /** * Gets the value of the arg0 property. * * @return * possible object is * {@link String } * */ public String getArg0() { return arg0; } /** * Sets the value of the arg0 property. * * @param value * allowed object is * {@link String } * */ public void setArg0(String value) { this.arg0 = value; } }
[ "noreply@github.com" ]
noreply@github.com
beff9e6fb53b57139132c013609aadda26386da2
90ee396c5d5d44be7bd980e931da68d336aa3245
/app/src/androidTest/java/com/examples/akshay/wififiletranserfer/ExampleInstrumentedTest.java
abfb5f234795217cac9ffd2db20d6675cad28e3b
[]
no_license
akshay-ap/WifiFileTransfer
6ee15e32b02ba889f397b8ea335e389442378495
60ac871d88011be78f92fa84ef509d73ea90e623
refs/heads/master
2021-01-24T20:12:58.195006
2018-03-14T13:26:07
2018-03-14T13:26:07
123,245,386
1
0
null
null
null
null
UTF-8
Java
false
false
777
java
package com.examples.akshay.wififiletranserfer; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.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() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.examples.akshay.wififiletranserfer", appContext.getPackageName()); } }
[ "akshay.ap95@gmail.com" ]
akshay.ap95@gmail.com
6c5390c052d8150b72eabe16654c91564a684da1
f404fc04e520457ef0ea3f5c99c6d53102d7fbce
/src/main/java/pl/shellchuck/charity/repository/RoleRepository.java
54efc9f22fd88b84670f0d85d03e22a5040f8093
[]
no_license
Shellchuck/4Charity
e71a57f56292483e9e4d2a7dbef5056ee6d941b3
98e393b38fe7ddcae741d9edb7e6e44dba04bfd9
refs/heads/master
2022-02-02T11:04:57.255595
2020-12-16T16:29:27
2020-12-16T16:29:27
241,538,781
2
0
null
2022-01-21T23:39:26
2020-02-19T05:14:55
Java
UTF-8
Java
false
false
254
java
package pl.shellchuck.charity.repository; import org.springframework.data.jpa.repository.JpaRepository; import pl.shellchuck.charity.entity.Role; public interface RoleRepository extends JpaRepository<Role, Long> { Role findByName(String name); }
[ "marek.grzelczak.99@gmail.com" ]
marek.grzelczak.99@gmail.com