blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
d4ee5e264c215efff129c588bbb4c022597fa7e6
47eb777cb6bd21fa48287f5fd998f8e4ec5c7f06
/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/LogAggregationService.java
315f28cf05514c510c29545a1d9dd0274a606480
[ "CDDL-1.1", "LicenseRef-scancode-protobuf", "BSD-3-Clause", "BSD-2-Clause-Views", "EPL-1.0", "LicenseRef-scancode-unknown-license-reference", "CDDL-1.0", "Apache-2.0", "BSD-2-Clause", "MIT", "Classpath-exception-2.0", "LGPL-2.1-only", "LicenseRef-scancode-other-permissive", "GCC-exception-3.1", "GPL-2.0-only", "LicenseRef-scancode-public-domain", "CC-PDDC", "LicenseRef-scancode-unknown" ]
permissive
qtt-bigdata/hadoop
55f0d9df970b2e98388fe3b480a028157d59fa4f
ebb348814fb49967cd33ad604d6fa4c4f3f5146c
refs/heads/qtt-2.6.0-5.16.1
2023-01-22T01:16:51.642516
2019-06-28T02:20:28
2019-06-28T02:20:28
177,924,762
0
2
Apache-2.0
2023-01-02T21:54:53
2019-03-27T05:34:46
Java
UTF-8
Java
false
false
20,055
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.yarn.server.nodemanager.containermanager.logaggregation; import java.io.FileNotFoundException; import java.io.IOException; import java.security.PrivilegedExceptionAction; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileContext; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.security.Credentials; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.service.AbstractService; import org.apache.hadoop.util.concurrent.HadoopExecutors; import org.apache.hadoop.yarn.api.records.ApplicationAccessType; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.LogAggregationContext; import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.event.Dispatcher; import org.apache.hadoop.yarn.exceptions.YarnRuntimeException; import org.apache.hadoop.yarn.logaggregation.ContainerLogsRetentionPolicy; import org.apache.hadoop.yarn.logaggregation.LogAggregationUtils; import org.apache.hadoop.yarn.server.nodemanager.Context; import org.apache.hadoop.yarn.server.nodemanager.DeletionService; import org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService; import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEvent; import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationEventType; import org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.LogHandler; import org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppFinishedEvent; import org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerAppStartedEvent; import org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerContainerFinishedEvent; import org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.event.LogHandlerEvent; import com.google.common.annotations.VisibleForTesting; import com.google.common.util.concurrent.ThreadFactoryBuilder; public class LogAggregationService extends AbstractService implements LogHandler { private static final Log LOG = LogFactory .getLog(LogAggregationService.class); /* * Expected deployment TLD will be 1777, owner=<NMOwner>, group=<NMGroup - * Group to which NMOwner belongs> App dirs will be created as 770, * owner=<AppOwner>, group=<NMGroup>: so that the owner and <NMOwner> can * access / modify the files. * <NMGroup> should obviously be a limited access group. */ /** * Permissions for the top level directory under which app directories will be * created. */ private static final FsPermission TLDIR_PERMISSIONS = FsPermission .createImmutable((short) 01777); /** * Permissions for the Application directory. */ private static final FsPermission APP_DIR_PERMISSIONS = FsPermission .createImmutable((short) 0770); private final Context context; private final DeletionService deletionService; private final Dispatcher dispatcher; private LocalDirsHandlerService dirsHandler; Path remoteRootLogDir; String remoteRootLogDirSuffix; private NodeId nodeId; private final ConcurrentMap<ApplicationId, AppLogAggregator> appLogAggregators; @VisibleForTesting ExecutorService threadPool; public LogAggregationService(Dispatcher dispatcher, Context context, DeletionService deletionService, LocalDirsHandlerService dirsHandler) { super(LogAggregationService.class.getName()); this.dispatcher = dispatcher; this.context = context; this.deletionService = deletionService; this.dirsHandler = dirsHandler; this.appLogAggregators = new ConcurrentHashMap<ApplicationId, AppLogAggregator>(); } protected void serviceInit(Configuration conf) throws Exception { this.remoteRootLogDir = new Path(conf.get(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, YarnConfiguration.DEFAULT_NM_REMOTE_APP_LOG_DIR)); this.remoteRootLogDirSuffix = conf.get(YarnConfiguration.NM_REMOTE_APP_LOG_DIR_SUFFIX, YarnConfiguration.DEFAULT_NM_REMOTE_APP_LOG_DIR_SUFFIX); int threadPoolSize = getAggregatorThreadPoolSize(conf); this.threadPool = HadoopExecutors.newFixedThreadPool(threadPoolSize, new ThreadFactoryBuilder() .setNameFormat("LogAggregationService #%d") .build()); super.serviceInit(conf); } @Override protected void serviceStart() throws Exception { // NodeId is only available during start, the following cannot be moved // anywhere else. this.nodeId = this.context.getNodeId(); super.serviceStart(); } @Override protected void serviceStop() throws Exception { LOG.info(this.getName() + " waiting for pending aggregation during exit"); stopAggregators(); super.serviceStop(); } private void stopAggregators() { threadPool.shutdown(); // if recovery on restart is supported then leave outstanding aggregations // to the next restart boolean shouldAbort = context.getNMStateStore().canRecover() && !context.getDecommissioned(); // politely ask to finish for (AppLogAggregator aggregator : appLogAggregators.values()) { if (shouldAbort) { aggregator.abortLogAggregation(); } else { aggregator.finishLogAggregation(); } } while (!threadPool.isTerminated()) { // wait for all threads to finish for (ApplicationId appId : appLogAggregators.keySet()) { LOG.info("Waiting for aggregation to complete for " + appId); } try { if (!threadPool.awaitTermination(30, TimeUnit.SECONDS)) { threadPool.shutdownNow(); // send interrupt to hurry them along } } catch (InterruptedException e) { LOG.warn("Aggregation stop interrupted!"); break; } } for (ApplicationId appId : appLogAggregators.keySet()) { LOG.warn("Some logs may not have been aggregated for " + appId); } } protected FileSystem getFileSystem(Configuration conf) throws IOException { return this.remoteRootLogDir.getFileSystem(conf); } void verifyAndCreateRemoteLogDir(Configuration conf) { // Checking the existence of the TLD FileSystem remoteFS = null; try { remoteFS = getFileSystem(conf); } catch (IOException e) { throw new YarnRuntimeException("Unable to get Remote FileSystem instance", e); } boolean remoteExists = true; try { FsPermission perms = remoteFS.getFileStatus(this.remoteRootLogDir).getPermission(); if (!perms.equals(TLDIR_PERMISSIONS)) { LOG.warn("Remote Root Log Dir [" + this.remoteRootLogDir + "] already exist, but with incorrect permissions. " + "Expected: [" + TLDIR_PERMISSIONS + "], Found: [" + perms + "]." + " The cluster may have problems with multiple users."); } } catch (FileNotFoundException e) { remoteExists = false; } catch (IOException e) { throw new YarnRuntimeException( "Failed to check permissions for dir [" + this.remoteRootLogDir + "]", e); } if (!remoteExists) { LOG.warn("Remote Root Log Dir [" + this.remoteRootLogDir + "] does not exist. Attempting to create it."); try { Path qualified = this.remoteRootLogDir.makeQualified(remoteFS.getUri(), remoteFS.getWorkingDirectory()); remoteFS.mkdirs(qualified, new FsPermission(TLDIR_PERMISSIONS)); remoteFS.setPermission(qualified, new FsPermission(TLDIR_PERMISSIONS)); UserGroupInformation loginUser = UserGroupInformation.getLoginUser(); String primaryGroupName = null; try { primaryGroupName = loginUser.getPrimaryGroupName(); } catch (IOException e) { LOG.warn("No primary group found. The remote root log directory" + " will be created with the HDFS superuser being its group " + "owner. JobHistoryServer may be unable to read the directory."); } // set owner on the remote directory only if the primary group exists if (primaryGroupName != null) { remoteFS.setOwner(qualified, loginUser.getShortUserName(), primaryGroupName); } } catch (IOException e) { throw new YarnRuntimeException("Failed to create remoteLogDir [" + this.remoteRootLogDir + "]", e); } } } Path getRemoteNodeLogFileForApp(ApplicationId appId, String user) { return LogAggregationUtils.getRemoteNodeLogFileForApp( this.remoteRootLogDir, appId, user, this.nodeId, this.remoteRootLogDirSuffix); } Path getRemoteAppLogDir(ApplicationId appId, String user) { return LogAggregationUtils.getRemoteAppLogDir(this.remoteRootLogDir, appId, user, this.remoteRootLogDirSuffix); } private void createDir(FileSystem fs, Path path, FsPermission fsPerm) throws IOException { FsPermission dirPerm = new FsPermission(fsPerm); fs.mkdirs(path, dirPerm); FsPermission umask = FsPermission.getUMask(fs.getConf()); if (!dirPerm.equals(dirPerm.applyUMask(umask))) { fs.setPermission(path, new FsPermission(fsPerm)); } } private boolean checkExists(FileSystem fs, Path path, FsPermission fsPerm) throws IOException { boolean exists = true; try { FileStatus appDirStatus = fs.getFileStatus(path); if (!APP_DIR_PERMISSIONS.equals(appDirStatus.getPermission())) { fs.setPermission(path, APP_DIR_PERMISSIONS); } } catch (FileNotFoundException fnfe) { exists = false; } return exists; } protected void createAppDir(final String user, final ApplicationId appId, UserGroupInformation userUgi) { try { userUgi.doAs(new PrivilegedExceptionAction<Object>() { @Override public Object run() throws Exception { try { // TODO: Reuse FS for user? FileSystem remoteFS = getFileSystem(getConfig()); // Only creating directories if they are missing to avoid // unnecessary load on the filesystem from all of the nodes Path appDir = LogAggregationUtils.getRemoteAppLogDir( LogAggregationService.this.remoteRootLogDir, appId, user, LogAggregationService.this.remoteRootLogDirSuffix); appDir = appDir.makeQualified(remoteFS.getUri(), remoteFS.getWorkingDirectory()); if (!checkExists(remoteFS, appDir, APP_DIR_PERMISSIONS)) { Path suffixDir = LogAggregationUtils.getRemoteLogSuffixedDir( LogAggregationService.this.remoteRootLogDir, user, LogAggregationService.this.remoteRootLogDirSuffix); suffixDir = suffixDir.makeQualified(remoteFS.getUri(), remoteFS.getWorkingDirectory()); if (!checkExists(remoteFS, suffixDir, APP_DIR_PERMISSIONS)) { Path userDir = LogAggregationUtils.getRemoteLogUserDir( LogAggregationService.this.remoteRootLogDir, user); userDir = userDir.makeQualified(remoteFS.getUri(), remoteFS.getWorkingDirectory()); if (!checkExists(remoteFS, userDir, APP_DIR_PERMISSIONS)) { createDir(remoteFS, userDir, APP_DIR_PERMISSIONS); } createDir(remoteFS, suffixDir, APP_DIR_PERMISSIONS); } createDir(remoteFS, appDir, APP_DIR_PERMISSIONS); } } catch (IOException e) { LOG.error("Failed to setup application log directory for " + appId, e); throw e; } return null; } }); } catch (Exception e) { throw new YarnRuntimeException(e); } } @SuppressWarnings("unchecked") private void initApp(final ApplicationId appId, String user, Credentials credentials, ContainerLogsRetentionPolicy logRetentionPolicy, Map<ApplicationAccessType, String> appAcls, LogAggregationContext logAggregationContext) { ApplicationEvent eventResponse; try { verifyAndCreateRemoteLogDir(getConfig()); initAppAggregator(appId, user, credentials, logRetentionPolicy, appAcls, logAggregationContext); eventResponse = new ApplicationEvent(appId, ApplicationEventType.APPLICATION_LOG_HANDLING_INITED); } catch (YarnRuntimeException e) { LOG.warn("Application failed to init aggregation", e); eventResponse = new ApplicationEvent(appId, ApplicationEventType.APPLICATION_LOG_HANDLING_FAILED); } this.dispatcher.getEventHandler().handle(eventResponse); } FileContext getLocalFileContext(Configuration conf) { try { return FileContext.getLocalFSFileContext(conf); } catch (IOException e) { throw new YarnRuntimeException("Failed to access local fs"); } } protected void initAppAggregator(final ApplicationId appId, String user, Credentials credentials, ContainerLogsRetentionPolicy logRetentionPolicy, Map<ApplicationAccessType, String> appAcls, LogAggregationContext logAggregationContext) { // Get user's FileSystem credentials final UserGroupInformation userUgi = UserGroupInformation.createRemoteUser(user); if (credentials != null) { userUgi.addCredentials(credentials); } // New application final AppLogAggregator appLogAggregator = new AppLogAggregatorImpl(this.dispatcher, this.deletionService, getConfig(), appId, userUgi, this.nodeId, dirsHandler, getRemoteNodeLogFileForApp(appId, user), logRetentionPolicy, appAcls, logAggregationContext, this.context, getLocalFileContext(getConfig())); if (this.appLogAggregators.putIfAbsent(appId, appLogAggregator) != null) { throw new YarnRuntimeException("Duplicate initApp for " + appId); } // wait until check for existing aggregator to create dirs YarnRuntimeException appDirException = null; try { // Create the app dir createAppDir(user, appId, userUgi); } catch (Exception e) { appLogAggregator.disableLogAggregation(); if (!(e instanceof YarnRuntimeException)) { appDirException = new YarnRuntimeException(e); } else { appDirException = (YarnRuntimeException)e; } appLogAggregators.remove(appId); closeFileSystems(userUgi); throw appDirException; } // TODO Get the user configuration for the list of containers that need log // aggregation. // Schedule the aggregator. Runnable aggregatorWrapper = new Runnable() { public void run() { try { appLogAggregator.run(); } finally { appLogAggregators.remove(appId); closeFileSystems(userUgi); } } }; this.threadPool.execute(aggregatorWrapper); } protected void closeFileSystems(final UserGroupInformation userUgi) { try { FileSystem.closeAllForUGI(userUgi); } catch (IOException e) { LOG.warn("Failed to close filesystems: ", e); } } // for testing only @Private int getNumAggregators() { return this.appLogAggregators.size(); } private void stopContainer(ContainerId containerId, int exitCode) { // A container is complete. Put this containers' logs up for aggregation if // this containers' logs are needed. AppLogAggregator aggregator = this.appLogAggregators.get( containerId.getApplicationAttemptId().getApplicationId()); if (aggregator == null) { LOG.warn("Log aggregation is not initialized for " + containerId + ", did it fail to start?"); return; } aggregator.startContainerLogAggregation(containerId, exitCode == 0); } @SuppressWarnings("unchecked") private void stopApp(ApplicationId appId) { // App is complete. Finish up any containers' pending log aggregation and // close the application specific logFile. AppLogAggregator aggregator = this.appLogAggregators.get(appId); if (aggregator == null) { LOG.warn("Log aggregation is not initialized for " + appId + ", did it fail to start?"); this.dispatcher.getEventHandler().handle( new ApplicationEvent(appId, ApplicationEventType.APPLICATION_LOG_HANDLING_FAILED)); return; } aggregator.finishLogAggregation(); } @Override public void handle(LogHandlerEvent event) { switch (event.getType()) { case APPLICATION_STARTED: LogHandlerAppStartedEvent appStartEvent = (LogHandlerAppStartedEvent) event; initApp(appStartEvent.getApplicationId(), appStartEvent.getUser(), appStartEvent.getCredentials(), appStartEvent.getLogRetentionPolicy(), appStartEvent.getApplicationAcls(), appStartEvent.getLogAggregationContext()); break; case CONTAINER_FINISHED: LogHandlerContainerFinishedEvent containerFinishEvent = (LogHandlerContainerFinishedEvent) event; stopContainer(containerFinishEvent.getContainerId(), containerFinishEvent.getExitCode()); break; case APPLICATION_FINISHED: LogHandlerAppFinishedEvent appFinishedEvent = (LogHandlerAppFinishedEvent) event; stopApp(appFinishedEvent.getApplicationId()); break; default: ; // Ignore } } @VisibleForTesting public ConcurrentMap<ApplicationId, AppLogAggregator> getAppLogAggregators() { return this.appLogAggregators; } @VisibleForTesting public NodeId getNodeId() { return this.nodeId; } private int getAggregatorThreadPoolSize(Configuration conf) { int threadPoolSize; try { threadPoolSize = conf.getInt(YarnConfiguration .NM_LOG_AGGREGATION_THREAD_POOL_SIZE, YarnConfiguration.DEFAULT_NM_LOG_AGGREGATION_THREAD_POOL_SIZE); } catch (NumberFormatException ex) { LOG.warn("Invalid thread pool size. Setting it to the default value " + "in YarnConfiguration"); threadPoolSize = YarnConfiguration. DEFAULT_NM_LOG_AGGREGATION_THREAD_POOL_SIZE; } if(threadPoolSize <= 0) { LOG.warn("Invalid thread pool size. Setting it to the default value " + "in YarnConfiguration"); threadPoolSize = YarnConfiguration. DEFAULT_NM_LOG_AGGREGATION_THREAD_POOL_SIZE; } return threadPoolSize; } }
80c7b29967c46c971cf3632b56fcbd54479734af
4da9097315831c8639a8491e881ec97fdf74c603
/src/StockIT-v1-release_source_from_JADX/sources/com/facebook/imagepipeline/producers/EncodedCacheKeyMultiplexProducer.java
82229735b5279d8783ba48e80d52ad3665eaac8e
[ "Apache-2.0" ]
permissive
atul-vyshnav/2021_IBM_Code_Challenge_StockIT
5c3c11af285cf6f032b7c207e457f4c9a5b0c7e1
25c26a4cc59a3f3e575f617b59acc202ee6ee48a
refs/heads/main
2023-08-11T06:17:05.659651
2021-10-01T08:48:06
2021-10-01T08:48:06
410,595,708
1
1
null
null
null
null
UTF-8
Java
false
false
1,169
java
package com.facebook.imagepipeline.producers; import android.util.Pair; import com.facebook.cache.common.CacheKey; import com.facebook.imagepipeline.cache.CacheKeyFactory; import com.facebook.imagepipeline.image.EncodedImage; import com.facebook.imagepipeline.request.ImageRequest; public class EncodedCacheKeyMultiplexProducer extends MultiplexProducer<Pair<CacheKey, ImageRequest.RequestLevel>, EncodedImage> { private final CacheKeyFactory mCacheKeyFactory; public EncodedCacheKeyMultiplexProducer(CacheKeyFactory cacheKeyFactory, boolean z, Producer producer) { super(producer, "EncodedCacheKeyMultiplexProducer", z); this.mCacheKeyFactory = cacheKeyFactory; } /* access modifiers changed from: protected */ public Pair<CacheKey, ImageRequest.RequestLevel> getKey(ProducerContext producerContext) { return Pair.create(this.mCacheKeyFactory.getEncodedCacheKey(producerContext.getImageRequest(), producerContext.getCallerContext()), producerContext.getLowestPermittedRequestLevel()); } public EncodedImage cloneOrNull(EncodedImage encodedImage) { return EncodedImage.cloneOrNull(encodedImage); } }
90aeaf393b6abade182dd5a2e9912dffe6450a82
6d5cadbb452ca7be0e7b1e3d4e71fe221861ed29
/app/src/test/java/com/davidgh/weatherinfo/ExampleUnitTest.java
cb14f228f26002953512a9c7553f15639e12636a
[]
no_license
davitgh/WeatherInfo
f6770546905461ca00741cee646e262e1f6b70ba
5d3527b806f763ddcd07bb30fc32669452a1440c
refs/heads/master
2021-05-03T04:33:28.833151
2018-02-07T13:35:18
2018-02-07T13:35:18
120,619,345
0
0
null
null
null
null
UTF-8
Java
false
false
401
java
package com.davidgh.weatherinfo; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
11b0f215ac7bfce6ade8dc2084daa1fbefd1838c
c5529aaceac08cf0a929e00d33264832ed55a929
/eatlibrary/src/main/java/com/e_at/eatlibrary/utils/GeneralUtil.java
39c0b0594c41c2915cf5e474cefc424b81c7713f
[]
no_license
codingWhenever/super_order
5b3c1aa71e64ac58fa5ae4bd0c096a4f5928d2e1
199c23d1610bb140f59360e75553191ee4109dbd
refs/heads/master
2021-08-14T10:02:30.793174
2017-11-15T10:00:53
2017-11-15T10:00:53
109,657,767
1
0
null
null
null
null
UTF-8
Java
false
false
630
java
package com.e_at.eatlibrary.utils; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; public class GeneralUtil { /** * 获取版本名 * * @return 当前应用的版本号 */ public static String getVersionName(Context context) { try { PackageManager manager = context.getPackageManager(); PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0); return info.versionName; } catch (Exception e) { e.printStackTrace(); return ""; } } }
826443c5ef8e8b4235e121013c146e4a28de7878
d1dd0c7d2063c5a5ae50e2d944795a3e4afaeb95
/surefire-3.0.0-M5/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnit4VersionsIT.java
dbf087c33b3006183c45c8cf45cf2c173af8c356
[ "Apache-2.0" ]
permissive
wessam1292/finalcertificates
e42945e28ce6b2f4f17c92dcc18b9b9aa1e1ed35
b580a23ac9f1e669041d611558b6f12369f522a3
refs/heads/master
2023-01-07T02:20:09.881872
2020-10-30T19:27:53
2020-10-30T19:27:53
305,834,552
0
0
null
null
null
null
UTF-8
Java
false
false
3,758
java
package org.apache.maven.surefire.its; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase; import org.apache.maven.surefire.its.fixture.SurefireLauncher; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; import java.util.Collection; import static java.util.Arrays.asList; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_0; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_1; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_10; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_11; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_12; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_13; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_2; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_3; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_3_1; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_4; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_5; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_6; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_7; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_8; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_8_1; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_8_2; import static org.apache.maven.surefire.its.JUnitVersion.JUNIT_4_9; import static org.junit.runners.Parameterized.Parameters; /** * Basic suite test using all known versions of JUnit 4.x * * @author <a href="mailto:[email protected]">Dan Fabulich</a> */ @RunWith( Parameterized.class ) public class JUnit4VersionsIT extends SurefireJUnit4IntegrationTestCase { @Parameters( name = "{index}: JUnit {0}" ) public static Collection<Object[]> junitVersions() { return asList( new Object[][] { { JUNIT_4_0 }, { JUNIT_4_1 }, { JUNIT_4_2 }, { JUNIT_4_3 }, { JUNIT_4_3_1 }, { JUNIT_4_4 }, { JUNIT_4_5 }, { JUNIT_4_6 }, { JUNIT_4_7 }, { JUNIT_4_8 }, { JUNIT_4_8_1 }, { JUNIT_4_8_2 }, { JUNIT_4_9 }, { JUNIT_4_10 }, { JUNIT_4_11 }, { JUNIT_4_12 }, { JUNIT_4_13 } } ); } @Parameter @SuppressWarnings( "checkstyle:visibilitymodifier" ) public JUnitVersion version; @Test public void testJunit() { version.configure( unpack() ) .executeTest() .verifyErrorFree( 1 ); } private SurefireLauncher unpack() { return unpack( "/junit4", version.toString() ); } }
337718eb0bac800bef11ef04e544dbf44e32d491
342ae302ac609c118a08d16097f8816fb2b66000
/src/main/java/com/nroad/okr/web/rest/vm/package-info.java
3c9e6e261cb9ae422c138255a45946fefa65dbc1
[]
no_license
51888/okrserver
ee668c90c3fa553d061f4918e9985f0d33a72ec2
1c4478b949af20b45ca5a964ba8ee4377daa8b02
refs/heads/master
2021-08-23T07:55:37.693595
2017-12-04T06:54:09
2017-12-04T06:54:09
113,006,515
0
0
null
null
null
null
UTF-8
Java
false
false
95
java
/** * View Models used by Spring MVC REST controllers. */ package com.nroad.okr.web.rest.vm;
4f22b6b265ae84b923e8edc545f57deec7b33237
c177a0815d5d5c47dd52376954081d5d4fd12bb0
/app/src/main/java/com/probe31/probe/sleepyapp/MODEL/InitResponse.java
687517dce052d5db119b142fbe1b672fd8a2a6fb
[]
no_license
probhe31/sleepApp
b58247d75ec8bdf046c07e521636258a3d765522
23c63aa559a1a4fde764657d438bb6b594d43530
refs/heads/master
2020-03-23T04:22:07.100032
2018-07-21T16:12:03
2018-07-21T16:12:03
141,079,087
1
0
null
null
null
null
UTF-8
Java
false
false
732
java
package com.probe31.probe.sleepyapp.MODEL; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class InitResponse { @SerializedName("status") @Expose private int status ; @SerializedName("status_label") @Expose private String status_label; @SerializedName("sleep_hour") @Expose private String sleep_hour; @SerializedName("message") @Expose private String message; public int getStatus() { return status; } public String getStatus_label() { return status_label; } public String getSleep_hour() { return sleep_hour; } public String getMessage() { return message; } }
6690674ae5c3ef80222d631f95ba93534a9b4b00
5eea41464206cffd9aeceaadb184b5661e31a481
/src/test/java/features/RunFeature.java
7b42d19ed820c6ed3adad3fa542d7b4e84043ce3
[]
no_license
YDanot/pandemic-bdd-12022019
b668dd1b74055b10e17c8e6896dd4b65e1141b89
494f81367ae9bcaa6f614b7a1a558b65cc036146
refs/heads/master
2020-04-22T15:14:22.792977
2019-02-13T08:39:29
2019-02-13T08:39:29
170,471,507
0
0
null
null
null
null
UTF-8
Java
false
false
253
java
package features; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import org.junit.runner.RunWith; @RunWith(Cucumber.class) @CucumberOptions(strict = true, glue = {"features"},tags = {"~@wip"} ) public class RunFeature { }
eaeeefc1236afae8cf26362504dd568386d6e76b
900961ee56d18be726ba0a7f468281b8a1be9bc2
/src/main/java/it/cnr/istc/pst/platinum/ai/framework/microkernel/lang/flaw/FlawCategoryType.java
37037ff90beb0418344d2614a68cbc31f7f15aad
[ "Apache-2.0" ]
permissive
pstlab/PLATINUm
767f77ea7405639673f26fd399e2a14dcdb511f8
3b949ee8312090f696e83413849e0c90f50a070a
refs/heads/master
2023-04-29T11:19:55.606724
2023-04-17T09:51:06
2023-04-17T09:51:06
123,152,138
14
0
Apache-2.0
2020-10-15T14:34:14
2018-02-27T15:54:16
Java
UTF-8
Java
false
false
519
java
package it.cnr.istc.pst.platinum.ai.framework.microkernel.lang.flaw; /** * * @author anacleto * */ public enum FlawCategoryType { /** * Category of flaws that entail only planning decisions to be solved */ PLANNING, /** * Category of flaws that entail only scheduling decisions to be solved */ SCHEDULING, /** * Category of flaws that entail both planning and scheduling decisions to be solved */ PLANNING_SCHEDULING, /** * Category of flaws that cannot be solved */ UNSOLVABLE; }
97dc6f94c345630bd001328c75ae1ec8a2b814da
d1e4d358f739f8f63b2b7e10d3c2f7a56c490568
/app/src/main/java/com/bnsantos/fyber/adapters/OfferViewHolder.java
7b49f234705f21750cfe822c9223d3141ccfb340
[ "Apache-2.0" ]
permissive
bnsantos/fyber-demo
3d073c200eb50b282f5e13f483231c617d04c107
eb98df13c64de52b0b1d5e7c6f6929c820f5b767
refs/heads/master
2016-08-11T20:26:09.501196
2015-11-22T21:29:04
2015-11-22T21:29:04
46,625,763
0
0
null
null
null
null
UTF-8
Java
false
false
1,512
java
package com.bnsantos.fyber.adapters; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.bnsantos.fyber.R; import com.bnsantos.fyber.model.Offer; import com.bnsantos.fyber.model.Thumbnail; import com.squareup.picasso.Picasso; /** * Created by bruno on 21/11/15. */ public class OfferViewHolder extends RecyclerView.ViewHolder { private final TextView title; private final TextView teaser; private final ImageView thumbnail; public OfferViewHolder(View itemView) { super(itemView); title = (TextView) itemView.findViewById(R.id.title); teaser = (TextView) itemView.findViewById(R.id.teaser); thumbnail = (ImageView) itemView.findViewById(R.id.thumbnail); } public void bind(Context context, Offer offer) { title.setText(offer.getTitle()); teaser.setText(offer.getTeaser()); Thumbnail thumb = offer.getThumbnail(); if (thumb != null) { if (thumb.getHires() != null) { Picasso.with(context).load(thumb.getHires()).fit().into(thumbnail); } else if (thumb.getLowres() != null) { Picasso.with(context).load(thumb.getLowres()).fit().into(thumbnail); } else { thumbnail.setImageResource(R.drawable.fyber); } } else { thumbnail.setImageResource(R.drawable.fyber); } } }
c7b690a11da71000281fe0e8c50b6ef0162c11b6
7991248e6bccacd46a5673638a4e089c8ff72a79
/base/common/src/main/java/org/artifactory/request/ResponseWithStatusHolderMapper.java
353da81e81c519ce722ea828071213c08f96697f
[]
no_license
theoriginalshaheedra/artifactory-oss
69b7f6274cb35c79db3a3cd613302de2ae019b31
415df9a9467fee9663850b4b8b4ee5bd4c23adeb
refs/heads/master
2023-04-23T15:48:36.923648
2021-05-05T06:15:24
2021-05-05T06:15:24
364,455,815
1
0
null
2021-05-05T07:11:40
2021-05-05T03:57:33
Java
UTF-8
Java
false
false
1,501
java
/* * * Artifactory is a binaries repository manager. * Copyright (C) 2018 JFrog Ltd. * * Artifactory is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Artifactory 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Artifactory. If not, see <http://www.gnu.org/licenses/>. * */ package org.artifactory.request; import org.apache.http.HttpStatus; import org.artifactory.common.StatusHolder; /** * Only maps exceptions in case there is no status code inside the status holder * * @author Shay Yaakov */ public class ResponseWithStatusHolderMapper extends ResponseStatusCodesMapper { private StatusHolder statusHolder; public ResponseWithStatusHolderMapper(StatusHolder statusHolder) { this.statusHolder = statusHolder; } @Override public int getStatusCode(Throwable e) { int statusCode = statusHolder.getStatusCode(); if (statusCode != HttpStatus.SC_INTERNAL_SERVER_ERROR) { return statusCode; } return super.getStatusCode(e); } }
b4b03e37cdf203c8183a8b436b7cc9efd8cf0b7e
175b6fc6e17a9d19f3281e5563859c1ee66a1caf
/src/test/java/RobotoTest.java
33d670f24440c4d630e0e58cf251a3f877f1118e
[]
no_license
leobarna/KatasBootcamp
890a9513c3c37c13b90edc9d28cd1b9559d8ea69
95e7237a75831a514faeef4d683f5e91cffdb796
refs/heads/main
2023-07-22T09:18:56.087594
2021-09-03T21:45:45
2021-09-03T21:45:45
397,388,361
0
0
null
null
null
null
UTF-8
Java
false
false
387
java
import org.junit.jupiter.api.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; public class RobotoTest { @Test void ifYouSaluteRobotoSaluteBack (){ SaluteRoboto salute = new SaluteRoboto(); String answer = salute.answer("Hola Roboto"); assertThat(answer,equalTo("Hola")); } }
b1453c4e3c42610bb1d623c26ec7af1b181f50b5
94aced6041168236c183e3c5129f150b03899cbd
/src/test/java/helpers/Helpers.java
8875c38937e453e4e06b44fb2a7309eead899885
[]
no_license
jdmaury94/qaAutomationCarnival
8568a979a58d568e8d87c4103024c8e8682e04a5
95da40aee26def27b770cf8591a7a19fefbfd8a8
refs/heads/master
2020-09-25T07:28:16.233549
2019-12-04T21:00:44
2019-12-04T21:00:44
225,948,688
0
0
null
null
null
null
UTF-8
Java
false
false
1,805
java
package helpers; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import java.util.ArrayList; import java.util.List; public class Helpers { public int formatStringToNumber(String string){ return Integer.parseInt(string.substring(2,5)); } public boolean checkSortedList(List<Integer> pricesList) { for(int i=0;i<pricesList.size()-1;i++){ if(pricesList.get(i)>pricesList.get(i+1)) return false; } return true; } public void sendKeysNTimes(int minPrice, int maxPrice, WebElement minBtn, WebElement maxBtn, WebDriver driver){ Actions move = new Actions(driver); int timesToRight = (minPrice - 400)/10; int timesToLeft = (800 - maxPrice)/10; System.out.println(timesToRight); System.out.println(timesToLeft); minBtn.click(); for(int i = 1;i<=timesToRight;i++){ move.sendKeys(Keys.ARROW_RIGHT).build().perform(); } maxBtn.click(); for(int i = 1;i<=timesToLeft;i++){ move.sendKeys(Keys.ARROW_LEFT).build().perform(); } } public List<String> getResultsIds(WebDriver driver){ List<String> cruisesIds = new ArrayList<>(); List<WebElement> results = driver.findElements(By.className("vrg-search-unit")); for (WebElement result : results) { cruisesIds.add(result.getAttribute("data-itinerary-uuid")); } System.out.println(cruisesIds); return cruisesIds; } public int randomIndex(List<String> uuids){ int random = (int)Math.floor(Math.random()*(uuids.size())); return random; } }
965abb5b828b269200370361bf443efbf722c40e
2eb567cb893850bec197ead1491f3e802cff93e6
/java-se-samples/base/src/main/java/apibase/common/DoubleTest.java
6cc93296ff5a66e9b129988e9ecf2042325e45b3
[]
no_license
doubleview/java-awesome-demo
4ca9971f01ab7b3be6fbefb76f9a7d8c78de0ed0
983491df02bf9c83978cbec83b93d1a68b1b2275
refs/heads/master
2022-12-22T10:12:26.250184
2021-07-25T05:58:22
2021-07-25T05:58:22
96,692,018
0
0
null
2022-12-16T09:52:49
2017-07-09T15:07:56
Java
UTF-8
Java
false
false
351
java
package apibase.common; public class DoubleTest { public static void main(String args[]) { System.out.println("0.05 + 0.01 = " + (0.05 + 0.01)); System.out.println("1.0 - 0.42 = " + (1.0 - 0.42)); System.out.println("4.015 * 100 = " + (4.015 * 100)); System.out.println("123.3 / 100 = " + (123.3 / 100)); } }
790f7f4a0bba3d21165945c86e0be37ac389a850
7a0fcd986daafa6329f118986d3ebdf52a1ec525
/app/src/test/java/com/example/zengwei/curve/ExampleUnitTest.java
1bd7ae4a945d0518db1cba91f8afda28d4759a47
[]
no_license
cbdgit/Curve
5240c77c308f43e789fd75483925ea6639bc35a4
a0d566c26c30a26105bc4f1864a7d988505d808b
refs/heads/master
2020-04-13T18:48:42.264176
2018-08-17T09:39:48
2018-08-17T09:39:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
403
java
package com.example.zengwei.curve; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
c73fd9c021e409dd14b7a7a47a5de55a1c51b0f1
144f75c44a30ac458268123e349ae5d4de766275
/server/src/main/java/me/noos/worker/RatingServlet.java
47d38962939d28c22647bcaeb35bc254b48cc684
[]
no_license
charlesbihis/noos
9b5096cdadac9b648cbea261454980876e46c47a
90ce9128d43c0d3dc100c0f362ea4a413173273a
refs/heads/master
2020-05-30T12:07:06.754706
2012-12-16T04:10:20
2012-12-16T04:10:20
7,187,090
0
1
null
null
null
null
UTF-8
Java
false
false
2,666
java
package me.noos.worker; import java.io.IOException; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import me.noos.engine.recommendation.collaborative.data.BaseDataset; import me.noos.engine.recommendation.collaborative.data.DiggData; import me.noos.engine.recommendation.collaborative.data.RatingBuilder; import me.noos.engine.recommendation.collaborative.model.Item; import me.noos.engine.recommendation.collaborative.model.Rating; import me.noos.engine.recommendation.collaborative.model.User; import me.noos.engine.recommendation.collaborative.recommender.DiggDelphi; import me.noos.engine.recommendation.content.rss.DiggStoryItem; import me.noos.model.Model; public class RatingServlet extends HttpServlet { private static final long serialVersionUID = -2691763071179461336L; public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { Model model = Model.getInstance(); String username = req.getParameter("user"); String itemIdString = req.getParameter("itemid"); String ratingString = req.getParameter("rating"); int itemId = Integer.parseInt(itemIdString); int ratingValue = Integer.parseInt(ratingString); // get our dataset BaseDataset ds = model.getDataset(); if (ds == null) { ds = DiggData.loadData("king5_stories.csv"); model.setDataset(ds); } // consult the oracle DiggDelphi delphi = model.getDelphi(); if (delphi == null) { delphi = new DiggDelphi(ds); model.setDelphi(delphi); } // identify our user List<User> users = new ArrayList<User>(ds.getUsers()); User user = ds.getUser(1); // shouldn't initialize like this, but doing for demo for (User u : users) { if (u.getName().toLowerCase().equals(username)) { user = u; } } // find the story Item item = ds.getItem(1); // ditto - shouldn't initialize like this, but doing for demo for (Item i : ds.getItems()) { if (i.getId() == itemId) { item = i; } } Rating rating = new Rating(user.getId(), item.getId(), ratingValue); rating.setItem(item); user.addRating(rating); ds.add(user); user.addUserContent(item.getItemContent()); System.out.println("User \"" + user.getName() + "\" submitted a rating of value " + rating.getRating() + " for story \"" + item.getName() + "\""); } public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException { } }
074573013a2ba904887b9a559f894685946c8d25
ec9ea88075728c82d1ecb026d846294e87092887
/src/main/java/com/algaworks/brewer/model/Pedido.java
c9b8e5be9b7968846541dac4ed505fca7a3608fe
[]
no_license
Beleboni/spring-project
f4d6a6fa60253ea32198c65640dee436faa4bd20
e4bfb4411caa86679422583963efd7fb277e5e4d
refs/heads/master
2021-01-13T05:23:47.336037
2017-05-08T01:47:01
2017-05-08T01:47:01
81,392,941
0
0
null
null
null
null
UTF-8
Java
false
false
4,350
java
package com.algaworks.brewer.model; import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Transient; import org.hibernate.annotations.DynamicUpdate; @Entity @Table(name = "pedido") @DynamicUpdate public class Pedido { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long codigo; @Column(name = "data_criacao") private LocalDateTime dataCriacao; @Column(name = "valor_total") private BigDecimal valorTotal = BigDecimal.ZERO; private String observacao; @ManyToOne @JoinColumn(name = "codigo_cliente") private Cliente cliente; @ManyToOne @JoinColumn(name = "codigo_usuario") private Usuario usuario; @ManyToOne @JoinColumn(name = "codigo_representada") private Representada representada; @ManyToOne @JoinColumn(name = "codigo_banco") private Banco banco; @Enumerated(EnumType.STRING) private StatusVenda status = StatusVenda.ORCAMENTO; @OneToMany(mappedBy = "pedido", cascade = CascadeType.ALL, orphanRemoval = true) private List<ItemPedido> itens = new ArrayList<>(); @Transient private String uuid; public boolean isNovo() { return codigo == null; } public Long getCodigo() { return codigo; } public void setCodigo(Long codigo) { this.codigo = codigo; } public LocalDateTime getDataCriacao() { return dataCriacao; } public void setDataCriacao(LocalDateTime dataCriacao) { this.dataCriacao = dataCriacao; } public BigDecimal getValorTotal() { return valorTotal; } public void setValorTotal(BigDecimal valorTotal) { this.valorTotal = valorTotal; } public String getObservacao() { return observacao; } public void setObservacao(String observacao) { this.observacao = observacao; } public Cliente getCliente() { return cliente; } public void setCliente(Cliente cliente) { this.cliente = cliente; } public Usuario getUsuario() { return usuario; } public void setUsuario(Usuario usuario) { this.usuario = usuario; } public StatusVenda getStatus() { return status; } public void setStatus(StatusVenda status) { this.status = status; } public List<ItemPedido> getItens() { return itens; } public void setItens(List<ItemPedido> itens) { this.itens = itens; } public String getUuid() { return uuid; } public void setUuid(String uuid) { this.uuid = uuid; } public boolean isNova() { return codigo == null; } public void adicionarItens(List<ItemPedido> itens) { this.itens = itens; this.itens.forEach(i -> i.setPedido(this)); } public BigDecimal getValorTotalItens() { return getItens().stream() .map(ItemPedido::getValorTotal) .reduce(BigDecimal::add) .orElse(BigDecimal.ZERO); } public void calcularValorTotal() { this.valorTotal = calcularValorTotal(getValorTotalItens()); } public Long getDiasCriacao() { LocalDate inicio = dataCriacao != null ? dataCriacao.toLocalDate() : LocalDate.now(); return ChronoUnit.DAYS.between(inicio, LocalDate.now()); } public boolean isSalvarPermitido() { return !status.equals(StatusVenda.CANCELADA); } public boolean isSalvarProibido() { return !isSalvarPermitido(); } private BigDecimal calcularValorTotal(BigDecimal valorTotalItens) { BigDecimal valorTotal = valorTotalItens; return valorTotal; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((codigo == null) ? 0 : codigo.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Pedido other = (Pedido) obj; if (codigo == null) { if (other.codigo != null) return false; } else if (!codigo.equals(other.codigo)) return false; return true; } }
4bfc270e3dfc044f017d0ee6d3d0a6b1ca6e9186
fab79c220c6175ba553c94c4d176959469589219
/src/main/java/nc/block/tile/generator/BlockFusionCore.java
01f3c599670dc5073d1903ec5f611e2f6c78d4ed
[ "CC0-1.0" ]
permissive
remclave/NuclearCraft
bf155280583ef4667a7dea60832264bf24909198
e873333ad22c0918515376c246a6b0b906aa920a
refs/heads/master
2020-03-25T08:56:26.322487
2018-06-15T15:44:01
2018-06-15T15:44:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,155
java
package nc.block.tile.generator; import nc.block.tile.BlockInventory; import nc.block.tile.IActivatable; import nc.config.NCConfig; import nc.init.NCBlocks; import nc.proxy.CommonProxy; import nc.tile.generator.TileFusionCore; import nc.util.BlockPosHelper; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.inventory.Container; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockFusionCore extends BlockInventory implements IActivatable { public BlockFusionCore() { super("fusion_core", Material.IRON); setCreativeTab(CommonProxy.TAB_FUSION); } @Override public TileEntity createNewTileEntity(World world, int meta) { return new TileFusionCore(); } @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) { return new AxisAlignedBB(-1.0F, 0.0F, -1.0F, 2.0F, 3.0F, 2.0F); } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public boolean isNormalCube(IBlockState state) { return false; } @Override public boolean isFullCube(IBlockState state) { return false; } @Override public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.ENTITYBLOCK_ANIMATED; } @Override public boolean canPlaceBlockAt(World world, BlockPos pos) { BlockPosHelper helper = new BlockPosHelper(pos); for (BlockPos blockPos : helper.cuboid(-1, 0, -1, 1, 2, 1)) if (!(isAir(world, blockPos))) return false; return true; } @Override public void onBlockAdded(World world, BlockPos pos, IBlockState state) { super.onBlockAdded(world, pos, state); BlockPosHelper helper = new BlockPosHelper(pos); for (BlockPos blockPos : helper.squareRing(1, 0)) setSide(world, blockPos); for (BlockPos blockPos : helper.cuboid(-1, 1, -1, 1, 1, 1)) setSide(world, blockPos); for (BlockPos blockPos : helper.cuboid(-1, 2, -1, 1, 2, 1)) setTop(world, blockPos); } @Override public void breakBlock(World world, BlockPos pos, IBlockState state) { BlockPosHelper helper = new BlockPosHelper(pos); for (BlockPos blockPos : helper.squareRing(1, 0)) setAir(world, blockPos); for (BlockPos blockPos : helper.cuboid(-1, 1, -1, 1, 2, 1)) setAir(world, blockPos); world.removeTileEntity(pos); } private boolean isAir(World world, BlockPos pos) { Material mat = world.getBlockState(pos).getMaterial(); return mat == Material.AIR || mat == Material.FIRE || mat == Material.WATER || mat == Material.VINE || mat == Material.SNOW; } private void setAir(World world, BlockPos pos) { world.destroyBlock(pos, false); } private void setSide(World world, BlockPos pos) { IBlockState dummy = NCBlocks.fusion_dummy_side.getDefaultState(); world.setBlockState(pos, dummy); } private void setTop(World world, BlockPos pos) { IBlockState dummy = NCBlocks.fusion_dummy_top.getDefaultState(); world.setBlockState(pos, dummy); } @Override public void setState(boolean active, World world, BlockPos pos) { TileEntity tile = world.getTileEntity(pos); keepInventory = true; world.setBlockState(pos, NCBlocks.fusion_core.getDefaultState(), 3); keepInventory = false; if (tile != null) { tile.validate(); world.setTileEntity(pos, tile); } } @Override public boolean hasComparatorInputOverride(IBlockState state) { return true; } @Override public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileFusionCore) { TileFusionCore core = (TileFusionCore) tile; double strength = core.getAlternateComparator() ? (double)core.heat/core.getMaxHeat() : (double)core.efficiency/(double)NCConfig.fusion_comparator_max_efficiency; return (int) MathHelper.clamp(15D*strength, 0, 15); } return Container.calcRedstone(world.getTileEntity(pos)); } }
794719462b35219e36d5d9b363db1258968f2b24
1b351ae881eec2382ced71d5e696e17df62e079e
/src/main/java/com/ATeam/twoDotFiveD/server/gameClientHandler.java
c226e337bbce22cb143081c5dac62bcc2049b2a4
[]
no_license
Mitsugaru/TwoDotFiveD
1d5b07dfeb45b089e241b78f4ca391c385743ef3
ef14a0de2c95e171a24e214286a00b756d8d068a
refs/heads/master
2021-01-19T08:46:06.979538
2012-04-22T00:30:40
2012-04-22T00:30:40
3,261,232
0
0
null
null
null
null
UTF-8
Java
false
false
440
java
package com.ATeam.twoDotFiveD.server; import java.net.DatagramPacket; import java.net.InetAddress; public class gameClientHandler { private InetAddress address; private int port; public void set(InetAddress anAddress, int aPort){ address=anAddress; port=aPort; } public DatagramPacket message(byte[] data){ return new DatagramPacket(data, data.length, address, port); } public boolean active() { return address!=null; } }
20256d7ce6ba53e3d891ac7e085c17e9e7d7ba1e
5dd9a978e06a37a31c9d1f94e7aa3c35bda90254
/src/main/java/pl/maciejd/ws/TestRunWS.java
470177e2b1029458369112165d2ab46955c50392
[]
no_license
maciejd/greenfield-jee
dc91c6f7c1f4217bb38f8018c864121fe0864e05
64885aa7ebd6ec7d71f5c168517367c11ffd135d
refs/heads/master
2020-07-27T02:06:17.138947
2016-11-14T13:14:00
2016-11-14T13:14:00
73,705,313
0
0
null
null
null
null
UTF-8
Java
false
false
1,121
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 pl.maciejd.ws; import javax.ejb.EJBTransactionRolledbackException; import javax.inject.Inject; import javax.jws.WebService; import javax.ws.rs.NotFoundException; import pl.maciejd.ejb.facades.TestRunWSFacade; import pl.maciejd.model.TestSuite; /** * * @author Maciej */ @WebService(endpointInterface = "pl.maciejd.ws.TestRunWsSEI") public class TestRunWS implements TestRunWsSEI { @Inject TestRunWSFacade trfa; @Override public void createTestRun(Long suiteId, String name) throws Exception { TestSuite suite = null; try { suite = trfa.findSuite(suiteId); if (suite == null) { throw new NotFoundException("Suite with given ID does not exist"); } } catch (EJBTransactionRolledbackException e2) { throw new IllegalArgumentException("Suite ID must be an integer"); } trfa.createRun(suite, name); } }
cd01582a4e5ccaf31b29766723bf47df7cb93d1b
91a950c8641f415c275bde20a1f9744bab4c7a74
/src/test/java/com/dbs/weather/weatherservice/WeatherserviceApplicationTests.java
998197002c358e2f0eb2318ca52656e20cf02555
[]
no_license
sst2k2/weatherservice
3636556f15546398040ba8e9e0439117689ae652
68413a27bea3d85efd14dc651b85fa246c6f79a7
refs/heads/master
2020-09-01T04:19:00.174479
2019-10-31T23:48:13
2019-10-31T23:48:13
218,878,530
0
0
null
null
null
null
UTF-8
Java
false
false
2,104
java
package com.dbs.weather.weatherservice; import com.dbs.weather.controller.WeatherController; import com.dbs.weather.entities.ForecastEntity; import com.dbs.weather.repository.WeatherRepository; import com.dbs.weather.service.MapInfoRetrieverImpl; import org.junit.Before; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.client.ExpectedCount; import org.springframework.test.web.client.MockRestServiceServer; import org.springframework.test.web.servlet.MockMvc; import org.springframework.web.client.RestTemplate; import java.net.URI; import java.util.HashMap; import java.util.List; import java.util.Map; import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.assertj.core.api.Assertions.assertThat; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc class WeatherserviceApplicationTests { @Autowired private WeatherController weatherController; @Autowired private MockMvc mockMvc; @Autowired private WeatherRepository repository; @Value("map.base.url") private String mapQuestUrl; @Test public void contextLoads() throws Exception{ assertThat(weatherController).isNotNull(); assertThat(repository).isNotNull(); } @Test public void shouldReturnDefaultMessage() throws Exception{ this.mockMvc.perform(get("/weather")).andExpect(status().isOk()); } @Test public void checkMongoDbConnection() throws Exception{ assertThat(repository.findAll()).isNotEmpty(); } }
5699a72fb1d8852633df5988fba54012d4e1bf45
e64a9ff88c950ca4a3fc7179b965c458302dec72
/app/src/main/java/DetectionService.java
e6ae6a81140631994be36399e8aaaac1191a2840
[]
no_license
mupacif/gmaps
2943ec5b46c1f4bd02c787d9edfc6e2d4d21e79a
b71125eefcaa157219ad157892063b1704aba0e8
refs/heads/master
2021-01-22T18:34:06.029846
2017-03-15T15:58:04
2017-03-15T15:58:04
85,093,455
0
0
null
null
null
null
UTF-8
Java
false
false
639
java
import android.app.IntentService; import android.content.Intent; import android.nfc.Tag; import com.google.android.gms.location.ActivityRecognition; import com.google.android.gms.location.ActivityRecognitionResult; import com.google.android.gms.location.GeofencingEvent; /** * Created by student on 15-03-17. */ public class DetectionService extends IntentService { public final static String Tag = "detected_is"; public DetectionService() { super(Tag); } @Override public void onCreate() { super.onCreate(); } @Override protected void onHandleIntent(Intent intent) { } }
1b68fbaffff4a00dd52ed75cc478ff7037f8a396
5ab0ba8af9dbdff39a880a5fa9da2cc2ee8ac915
/SEblog/src/com/DAO/UserStat.java
057c727416c31b38e10a2c4060235f6bf5fce232
[]
no_license
ffflyteam/SEBlog
7bdc9c1eed0b9716ee9cdfe95809bafeb6ae2ac5
e5e98f241e3544128ba61e04d2348477d4986299
refs/heads/master
2020-05-16T12:05:05.025850
2019-06-16T14:43:01
2019-06-16T14:43:01
178,838,440
0
0
null
null
null
null
GB18030
Java
false
false
212
java
package com.DAO; public enum UserStat { NORMAL(0), //正常使用中 BE_FROZEN(1), //被冻结 ; private int id; private UserStat(int id) { this.id = id; } public int getId() { return id; } }
ea09926eb5d18ecc866a76fcfb8ad44a5c291d50
d16eaadf146fe636f6607068f1dd853489a3f64a
/src/main/java/com/ynyes/kjxjr/entity/TdOrder.java
00e936feba97458055d583cb70bf80c31c1bb91d
[]
no_license
nieshr/xjr
ce824b7183634d1d72970d6082221e85e73a8dfe
70ba60c262055d1b75f30a2b386fe67970da5e19
refs/heads/master
2021-01-10T07:10:13.758215
2015-12-31T10:13:36
2015-12-31T10:13:36
43,426,501
0
0
null
null
null
null
UTF-8
Java
false
false
13,646
java
package com.ynyes.kjxjr.entity; import java.util.Date; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToMany; import org.springframework.format.annotation.DateTimeFormat; /** * 订单 * * 记录了订单详情 * * @author Sharon * */ @Entity public class TdOrder { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; // 订单号 @Column(unique=true) private String orderNumber; // 订单商品 @OneToMany @JoinColumn(name="tdOrderId") private List<TdOrderGoods> orderGoodsList; //车牌 @Column private String carCode; //车型 @Column private String carType; // 收货地址 @Column private String shippingAddress; // 收货人 @Column private String shippingName; // 收货电话 @Column private String shippingPhone; // 邮政编码 @Column private String postalCode; // 支付方式(线下同盟店) @Column private Long shopId; // 支付方式名称(同盟店名称) @Column private String shopTitle; // 支付方式 @Column private Long payTypeId; // 支付方式名称 @Column private String payTypeTitle; // 支付方式手续费 @Column(scale=2) private Double payTypeFee; // 配送方式 @Column private Long deliverTypeId; // 配送方式名称 @Column private String deliverTypeTitle; // 配送方式名称 @Column(scale=2) private Double deliverTypeFee; // 快递公司 @Column private String expressCampany; // 快递单号 @Column private String expressNumber; // 快递详情查询接口 @Column private String expressUri; // 用户留言备注 @Column private String userRemarkInfo; // 后台备注 @Column private String remarkInfo; // 是否索要发票 @Column private Boolean isNeedInvoice; // 发票抬头 @Column private String invoiceTitle; // 发票内容 @Column private String invoiceContent; // 发票类型 @Column private String invoiceType; // 预约服务时间 @Column @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date appointmentTime; // 下单时间 @Column @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date orderTime; // 取消时间 @Column @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date cancelTime; // 确认时间 @Column @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date checkTime; // 付款时间 @Column @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date payTime; // 付尾款时间 @Column @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date payLeftTime; // 配送时间 @Column @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date deliveryTime; // 服务时间 @Column @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date serviceTime; // 收货时间 @Column @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date receiveTime; // 评价时间 @Column @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date commentTime; // 完成时间 @Column @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date finishTime; // 订单状态 2:待付款 3:待付尾款 4:待服务 5:待评价 6: 已完成 7: 已取消 8: 支付取消(失败) 9: 已删除 @Column private Long statusId; // 订单取消原因 @Column private String cancelReason; // 用户 @Column private String username; // 发货时间 @Column @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") private Date sendTime; // 配货人 @Column private String deliveryPerson; // 配送人 @Column private String distributionPerson; // 收款人 @Column private String moneyReceivePerson; // 商品总金额 @Column(scale=2) private Double totalGoodsPrice; // 订单总金额 @Column(scale=2) private Double totalPrice; // 订单尾款总金额,有些订单需付尾款 @Column(scale=2) private Double totalLeftPrice; // 排序号 @Column private Long sortId; // 使用积分数 @Column private Long pointUse; // 可获取积分 @Column private Long points; // 是否在线付款 @Column private Boolean isOnlinePay; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getOrderNumber() { return orderNumber; } public String getPostalCode() { return postalCode; } public void setPostalCode(String postalCode) { this.postalCode = postalCode; } public void setOrderNumber(String orderNumber) { this.orderNumber = orderNumber; } public List<TdOrderGoods> getOrderGoodsList() { return orderGoodsList; } public void setOrderGoodsList(List<TdOrderGoods> orderGoodsList) { this.orderGoodsList = orderGoodsList; } public String getShippingAddress() { return shippingAddress; } public void setShippingAddress(String shippingAddress) { this.shippingAddress = shippingAddress; } public String getShippingName() { return shippingName; } public void setShippingName(String shippingName) { this.shippingName = shippingName; } public String getShippingPhone() { return shippingPhone; } public void setShippingPhone(String shippingPhone) { this.shippingPhone = shippingPhone; } public Long getPayTypeId() { return payTypeId; } public void setPayTypeId(Long payTypeId) { this.payTypeId = payTypeId; } public String getPayTypeTitle() { return payTypeTitle; } public void setPayTypeTitle(String payTypeTitle) { this.payTypeTitle = payTypeTitle; } public Double getPayTypeFee() { return payTypeFee; } public void setPayTypeFee(Double payTypeFee) { this.payTypeFee = payTypeFee; } public String getDeliverTypeTitle() { return deliverTypeTitle; } public void setDeliverTypeTitle(String deliverTypeTitle) { this.deliverTypeTitle = deliverTypeTitle; } public Long getDeliverTypeId() { return deliverTypeId; } public void setDeliverTypeId(Long deliverTypeId) { this.deliverTypeId = deliverTypeId; } public Double getDeliverTypeFee() { return deliverTypeFee; } public void setDeliverTypeFee(Double deliverTypeFee) { this.deliverTypeFee = deliverTypeFee; } public String getUserRemarkInfo() { return userRemarkInfo; } public void setUserRemarkInfo(String userRemarkInfo) { this.userRemarkInfo = userRemarkInfo; } public String getRemarkInfo() { return remarkInfo; } public void setRemarkInfo(String remarkInfo) { this.remarkInfo = remarkInfo; } public Boolean getIsNeedInvoice() { return isNeedInvoice; } public void setIsNeedInvoice(Boolean isNeedInvoice) { this.isNeedInvoice = isNeedInvoice; } public String getInvoiceTitle() { return invoiceTitle; } public void setInvoiceTitle(String invoiceTitle) { this.invoiceTitle = invoiceTitle; } public String getInvoiceContent() { return invoiceContent; } public void setInvoiceContent(String invoiceContent) { this.invoiceContent = invoiceContent; } public String getInvoiceType() { return invoiceType; } public void setInvoiceType(String invoiceType) { this.invoiceType = invoiceType; } public Date getOrderTime() { return orderTime; } public void setOrderTime(Date orderTime) { this.orderTime = orderTime; } public Date getCheckTime() { return checkTime; } public void setCheckTime(Date checkTime) { this.checkTime = checkTime; } public Date getPayTime() { return payTime; } public void setPayTime(Date payTime) { this.payTime = payTime; } public Date getDeliveryTime() { return deliveryTime; } public void setDeliveryTime(Date deliveryTime) { this.deliveryTime = deliveryTime; } public Date getReceiveTime() { return receiveTime; } public void setReceiveTime(Date receiveTime) { this.receiveTime = receiveTime; } public Date getFinishTime() { return finishTime; } public void setFinishTime(Date finishTime) { this.finishTime = finishTime; } public Long getStatusId() { return statusId; } public void setStatusId(Long statusId) { this.statusId = statusId; } public String getCancelReason() { return cancelReason; } public void setCancelReason(String cancelReason) { this.cancelReason = cancelReason; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getExpressCampany() { return expressCampany; } public void setExpressCampany(String expressCampany) { this.expressCampany = expressCampany; } public String getExpressNumber() { return expressNumber; } public void setExpressNumber(String expressNumber) { this.expressNumber = expressNumber; } public String getExpressUri() { return expressUri; } public void setExpressUri(String expressUri) { this.expressUri = expressUri; } public Date getSendTime() { return sendTime; } public void setSendTime(Date sendTime) { this.sendTime = sendTime; } public String getDeliveryPerson() { return deliveryPerson; } public void setDeliveryPerson(String deliveryPerson) { this.deliveryPerson = deliveryPerson; } public String getDistributionPerson() { return distributionPerson; } public void setDistributionPerson(String distributionPerson) { this.distributionPerson = distributionPerson; } public String getMoneyReceivePerson() { return moneyReceivePerson; } public void setMoneyReceivePerson(String moneyReceivePerson) { this.moneyReceivePerson = moneyReceivePerson; } public Double getTotalGoodsPrice() { return totalGoodsPrice; } public void setTotalGoodsPrice(Double totalGoodsPrice) { this.totalGoodsPrice = totalGoodsPrice; } public Double getTotalPrice() { return totalPrice; } public void setTotalPrice(Double totalPrice) { this.totalPrice = totalPrice; } public Long getSortId() { return sortId; } public void setSortId(Long sortId) { this.sortId = sortId; } public Long getPoints() { return points; } public void setPoints(Long points) { this.points = points; } public Boolean getIsOnlinePay() { return isOnlinePay; } public void setIsOnlinePay(Boolean isOnlinePay) { this.isOnlinePay = isOnlinePay; } public Date getCancelTime() { return cancelTime; } public void setCancelTime(Date cancelTime) { this.cancelTime = cancelTime; } public Date getCommentTime() { return commentTime; } public void setCommentTime(Date commentTime) { this.commentTime = commentTime; } public Long getPointUse() { return pointUse; } public void setPointUse(Long pointUse) { this.pointUse = pointUse; } public Long getShopId() { return shopId; } public void setShopId(Long shopId) { this.shopId = shopId; } public String getShopTitle() { return shopTitle; } public void setShopTitle(String shopTitle) { this.shopTitle = shopTitle; } public Date getAppointmentTime() { return appointmentTime; } public void setAppointmentTime(Date appointmentTime) { this.appointmentTime = appointmentTime; } public String getCarCode() { return carCode; } public void setCarCode(String carCode) { this.carCode = carCode; } public String getCarType() { return carType; } public void setCarType(String carType) { this.carType = carType; } public Double getTotalLeftPrice() { return totalLeftPrice; } public void setTotalLeftPrice(Double totalLeftPrice) { this.totalLeftPrice = totalLeftPrice; } public Date getPayLeftTime() { return payLeftTime; } public void setPayLeftTime(Date payLeftTime) { this.payLeftTime = payLeftTime; } public Date getServiceTime() { return serviceTime; } public void setServiceTime(Date serviceTime) { this.serviceTime = serviceTime; } }
64b98d65f6f3da09fb3781e4f7697e244300f00e
80b69edf29f51d34cee8b2e8a5956e4a82a8bff1
/codesnipt/com/kalllx/code/util/NumberDetect.java
50b2830d0fc4f51467422b5a3d158a92a7c71685
[ "MIT" ]
permissive
kalllx/codesnipt
850b155b78af71d796af982d686c4aa5f3820378
a4d78912c82c07c5011808ec5161475f293d50ab
refs/heads/master
2016-09-06T06:18:07.923316
2014-03-20T10:26:46
2014-03-20T10:26:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
690
java
package com.kalllx.code.util; public class NumberDetect { public static void main(String[] args) { String str1="1122.2.2"; String str2="111"; String str3="111.2"; String str4="111s"; String str5="111.s"; String str6="1s11"; System.out.println(str1+":"+isNum(str1)); System.out.println(str2+":"+isNum(str2)); System.out.println(str3+":"+isNum(str3)); System.out.println(str4+":"+isNum(str4)); System.out.println(str5+":"+isNum(str5)); System.out.println(str6+":"+isNum(str6)); } public static boolean isNum(String str){ //return str.matches("^[-+]?(([0-9]+)([.]([0-9]+))?|([.]([0-9]+))?)$"); return str.matches("^([0-9]+)$"); } }
414392dc70bbfa846d38f59f04e528db1271b6aa
6d40a559ca0f874ae7ac922a19b5aaac8dec2e93
/src/main/java/ch/uzh/seal/BLogDiff/model/rest/Job.java
a0b22d1bc3166ac3abd4580ddd6155cd05553372
[]
no_license
noahch/blogdiff
a4cfcd07fd308c9dedeafd7d3e5be0df7e1094b9
c19e9bf5824935ddd607c5cf2b93c4de215036f0
refs/heads/master
2022-11-28T15:08:42.672199
2019-07-30T15:54:20
2019-07-30T15:54:20
184,011,057
0
0
null
2022-11-16T11:48:42
2019-04-29T06:16:37
Java
UTF-8
Java
false
false
1,004
java
package ch.uzh.seal.BLogDiff.model.rest; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Getter; import lombok.Setter; import lombok.ToString; @JsonIgnoreProperties(ignoreUnknown = true) @ToString public class Job { @Getter @Setter private Long id; @Getter @Setter private String state; @Getter @Setter private Repository repository; @Getter @Setter private Build build; @Getter @Setter private String number; @Getter @Setter @JsonProperty("finished_at") private String finishedAt; @JsonIgnore public int getNumberAsInt(){ if(number != null){ String[] nbrs = number.split("\\."); return Integer.valueOf(nbrs[nbrs.length-1]); }else{ return -1; } } @Getter @Setter private boolean parsedSuccessfully; }
c9f799b33d2b2d8c323ef86f59c33a47ab6aa93a
f0930b38e9e0022875e914bf143cd08b2de0c9c8
/Java_Durgasri Thamada/Assignment1/Q4SupplyResult.java
aa8dd5c47454dbc5a1733ec19c61c20de9d8f335
[]
no_license
DurgasriThamada/DurgasriThamadaTraining2021
c2cbab7d29059455dbecde2f04fb6956071a568e
8504ce63a7df57705b37c953038d04d0e1111057
refs/heads/main
2023-07-18T08:09:08.713286
2021-09-01T07:16:48
2021-09-01T07:16:48
390,813,343
0
0
null
null
null
null
UTF-8
Java
false
false
616
java
import java.util.*; public class Q4SupplyResult { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); System.out.println("Enter the marks of three Subjects"); int m1=sc.nextInt(); int m2=sc.nextInt(); int m3=sc.nextInt(); int cnt=0; if(m1>60) { cnt+=1; } if(m2>60) { cnt+=1; } if(m3>60) { cnt+=1; } if(cnt==3) { System.out.println("Passed"); } else if(cnt==2) { System.out.println("Promoted"); } else if(cnt==1) { System.out.println("Failed"); } sc.close(); } }
fc6d59a3f0144f0469982082b29e6f0ed93e374c
49c57475dae2ade37bc1d7cdd0d2af540ca2a62d
/changgou-service/changgou-service-goods/src/main/java/com/changgou/goods/service/impl/SkuServiceImpl.java
80f5b4bf8242637afdaf92c7775f2058edd9e19c
[]
no_license
a76037385a/changgou-parent
3ac014839792a61f0f866752bd104392219d61e3
c72e5fff0ca1e4d4de8e6080881d851fd4a7c070
refs/heads/master
2022-06-29T20:21:53.160752
2019-08-25T07:14:21
2019-08-25T07:14:21
204,235,253
0
0
null
2022-06-17T03:30:24
2019-08-25T02:18:11
JavaScript
UTF-8
Java
false
false
7,513
java
package com.changgou.goods.service.impl; import com.changgou.goods.dao.SkuMapper; import com.changgou.goods.pojo.Sku; import com.changgou.goods.service.SkuService; import com.changgou.order.pojo.OrderItem; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; import tk.mybatis.mapper.entity.Example; import java.util.List; /**** * @Author:www.itheima.com * @Description:Sku业务层接口实现类 * @Date 黑马畅购商城 *****/ @Service public class SkuServiceImpl implements SkuService { @Autowired private SkuMapper skuMapper; @Autowired private RedisTemplate redisTemplate; /*** * 订单库存递减 * @param username * Cart_wangwu */ @Override public void decount(String username) { //从购物车中获取所有明细列表 List<OrderItem> orderItems = redisTemplate.boundHashOps("Cart_"+username).values(); //List<OrderItem> 循环递减 if(orderItems!=null){ for (OrderItem orderItem : orderItems) { //先查询出该SKU对应的数据 //Sku sku = skuMapper.selectByPrimaryKey(orderItem.getSkuId()); //让该SKU数据-购买数量 //sku.setNum(sku.getNum()-orderItem.getNum()); //保存到数据库 //skuMapper.updateByPrimaryKeySelective(sku); //数据库运算->防止超卖 int count = skuMapper.decrCount(orderItem.getSkuId(), orderItem.getNum()); if(count<=0){ throw new RuntimeException("超卖!"); } } } } /*** * 根据状态搜索所有List<Sku> * @param status * @return */ @Override public List<Sku> findByStatus(String status) { //select * from table where status = ? Sku sku = new Sku(); sku.setStatus(status); //执行搜索 return skuMapper.select(sku); } /** * Sku条件+分页查询 * @param sku 查询条件 * @param page 页码 * @param size 页大小 * @return 分页结果 */ @Override public PageInfo<Sku> findPage(Sku sku, int page, int size){ //分页 PageHelper.startPage(page,size); //搜索条件构建 Example example = createExample(sku); //执行搜索 return new PageInfo<Sku>(skuMapper.selectByExample(example)); } /** * Sku分页查询 * @param page * @param size * @return */ @Override public PageInfo<Sku> findPage(int page, int size){ //静态分页 PageHelper.startPage(page,size); //分页查询 return new PageInfo<Sku>(skuMapper.selectAll()); } /** * Sku条件查询 * @param sku * @return */ @Override public List<Sku> findList(Sku sku){ //构建查询条件 Example example = createExample(sku); //根据构建的条件查询数据 return skuMapper.selectByExample(example); } /** * Sku构建查询对象 * @param sku * @return */ public Example createExample(Sku sku){ Example example=new Example(Sku.class); Example.Criteria criteria = example.createCriteria(); if(sku!=null){ // 商品id if(!StringUtils.isEmpty(sku.getId())){ criteria.andEqualTo("id",sku.getId()); } // 商品条码 if(!StringUtils.isEmpty(sku.getSn())){ criteria.andEqualTo("sn",sku.getSn()); } // SKU名称 if(!StringUtils.isEmpty(sku.getName())){ criteria.andLike("name","%"+sku.getName()+"%"); } // 价格(分) if(!StringUtils.isEmpty(sku.getPrice())){ criteria.andEqualTo("price",sku.getPrice()); } // 库存数量 if(!StringUtils.isEmpty(sku.getNum())){ criteria.andEqualTo("num",sku.getNum()); } // 库存预警数量 if(!StringUtils.isEmpty(sku.getAlertNum())){ criteria.andEqualTo("alertNum",sku.getAlertNum()); } // 商品图片 if(!StringUtils.isEmpty(sku.getImage())){ criteria.andEqualTo("image",sku.getImage()); } // 商品图片列表 if(!StringUtils.isEmpty(sku.getImages())){ criteria.andEqualTo("images",sku.getImages()); } // 重量(克) if(!StringUtils.isEmpty(sku.getWeight())){ criteria.andEqualTo("weight",sku.getWeight()); } // 创建时间 if(!StringUtils.isEmpty(sku.getCreateTime())){ criteria.andEqualTo("createTime",sku.getCreateTime()); } // 更新时间 if(!StringUtils.isEmpty(sku.getUpdateTime())){ criteria.andEqualTo("updateTime",sku.getUpdateTime()); } // SPUID if(!StringUtils.isEmpty(sku.getSpuId())){ criteria.andEqualTo("spuId",sku.getSpuId()); } // 类目ID if(!StringUtils.isEmpty(sku.getCategoryId())){ criteria.andEqualTo("categoryId",sku.getCategoryId()); } // 类目名称 if(!StringUtils.isEmpty(sku.getCategoryName())){ criteria.andEqualTo("categoryName",sku.getCategoryName()); } // 品牌名称 if(!StringUtils.isEmpty(sku.getBrandName())){ criteria.andEqualTo("brandName",sku.getBrandName()); } // 规格 if(!StringUtils.isEmpty(sku.getSpec())){ criteria.andEqualTo("spec",sku.getSpec()); } // 销量 if(!StringUtils.isEmpty(sku.getSaleNum())){ criteria.andEqualTo("saleNum",sku.getSaleNum()); } // 评论数 if(!StringUtils.isEmpty(sku.getCommentNum())){ criteria.andEqualTo("commentNum",sku.getCommentNum()); } // 商品状态 1-正常,2-下架,3-删除 if(!StringUtils.isEmpty(sku.getStatus())){ criteria.andEqualTo("status",sku.getStatus()); } } return example; } /** * 删除 * @param id */ @Override public void delete(Long id){ skuMapper.deleteByPrimaryKey(id); } /** * 修改Sku * @param sku */ @Override public void update(Sku sku){ skuMapper.updateByPrimaryKey(sku); } /** * 增加Sku * @param sku */ @Override public void add(Sku sku){ skuMapper.insert(sku); } /** * 根据ID查询Sku * @param id * @return */ @Override public Sku findById(Long id){ return skuMapper.selectByPrimaryKey(id); } /** * 查询Sku全部数据 * @return */ @Override public List<Sku> findAll() { return skuMapper.selectAll(); } }
43609e3a339e51be8b7e6fae354fd124897ba36e
834940f2650709bc252ea48a80d63c99f3033011
/src/service/com/cyberup/service/course/CourseKemService.java
5699d756a3dbc25076f873646a420dcd267957e5
[]
no_license
yoonjinseok/cuinfo
a802cd1d38f923c5b6e71eea92f86ee9d5fb4dc4
4acf4ec1c120d534ec124c6b8181008c5a92743d
refs/heads/master
2023-01-04T07:40:05.314756
2020-11-02T17:11:51
2020-11-02T17:11:51
309,440,573
0
0
null
null
null
null
UTF-8
Java
false
false
4,189
java
package com.cyberup.service.course; import java.lang.reflect.Method; import java.util.List; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.cyberup.dao.course.CourseKemDao; import com.cyberup.dao.course.CourseKemLongDao; import com.cyberup.dao.course.MetaDicDao; import com.cyberup.model.course.CollectionType; import com.cyberup.model.course.Course; import com.cyberup.model.course.MetaDic; import common.Logger; @Service @Transactional public class CourseKemService { private Logger logger = Logger.getLogger(CourseKemService.class); @Autowired private CourseKemDao courseKemDao; @Autowired private CourseKemLongDao courseKemLongDao; @Autowired private MetaDicDao metaDicDao; public void insertInfo(Integer courseId, Integer collTypeId, Integer metadicId, String kemVal) { if("Y".equals(metaDicDao.selectInfo(metadicId).getLongYn())) this.courseKemLongDao.insertInfo(courseId, collTypeId, metadicId, kemVal); else this.courseKemDao.insertInfo(courseId, collTypeId, metadicId, kemVal); } public int deleteInfo(Integer courseId, Integer collTypeId, Integer metadicId) { return this.courseKemDao.deleteInfo(courseId, collTypeId, metadicId); } public int deleteList(Integer courseId, String collType, Integer collTypeId) { return this.courseKemDao.deleteList(courseId, collType, collTypeId); } public void updateInfo(Integer courseId, Integer collTypeId, Integer metadicId, String kemVal) { if("Y".equals(metaDicDao.selectInfo(metadicId).getLongYn())) this.courseKemLongDao.updateInfo(courseId, collTypeId, metadicId, kemVal); else this.courseKemDao.updateInfo(courseId, collTypeId, metadicId, kemVal); } public void construct(Integer courseId, Integer collTypeId, Course course) { List<MetaDic> list = metaDicDao.selectList(CollectionType.COURSE.getValue()); for(int i = 0; i < list.size(); i++) { if(list.get(i).getElement().equals("regDate") || list.get(i).getElement().equals("modDate") || list.get(i).getElement().equals("delDate")) continue; Object val = ""; try { Method method = course.getClass().getMethod("get" + StringUtils.capitalize(list.get(i).getElement())); val = method.invoke(course); } catch (Exception e) { if(list.get(i).getElement().equals("identifier")) val = course.getCourseIdentifier(); else if(list.get(i).getElement().equals("grantAll")) val = course.getPublicYn(); else if(list.get(i).getElement().startsWith("departmentcode")) val = course.getDepartmentId(); else if(list.get(i).getElement().startsWith("grad")) val = course.getGradYear(); else if(list.get(i).getElement().startsWith("gradth")) val = course.getGradSemester(); else if(list.get(i).getElement().startsWith("termyear")) val = course.getTermYear(); else if(list.get(i).getElement().startsWith("termth")) val = course.getTermSemester(); else if(list.get(i).getElement().startsWith("startdate")) val = course.getSvcStart(); else if(list.get(i).getElement().startsWith("enddate")) val = course.getSvcEnd(); else logger.error(list.get(i).getElement() + "("+val+") : " + e.getMessage(), e); } if("Y".equals(list.get(i).getLongYn())) this.courseKemLongDao.insertInfo(courseId, collTypeId, list.get(i).getMetadicId(), String.valueOf(val)); else this.courseKemDao.insertInfo(courseId, collTypeId, list.get(i).getMetadicId(), String.valueOf(val)); } } public void demolish(Integer courseId, String collType, Integer collTypeId) { this.courseKemDao.deleteList(courseId, collType, collTypeId); this.courseKemLongDao.deleteList(courseId, collType, collTypeId); } public void deleteNotIn(Integer courseId, String collType, String[] collTypeIds) { this.courseKemDao.deleteNotIn(courseId, collType, collTypeIds); this.courseKemLongDao.deleteNotIn(courseId, collType, collTypeIds); } }
a0930860ddeec1c461e0ec8a03f3ca7560bdc291
33b7f43d96f76971b16edf23fa872ceca2c2d24c
/Java/RepasoSegundoParcial/Ej7/Library.java
4ecd34353c30445a0b42f4c0a7508ed62a9cd629
[]
no_license
pdomins/POO
077f856f896c57489f85d9491190dab6fa02e366
14d73b43f53123b0ab09f34ebfc3c2d6ad6e6664
refs/heads/master
2022-12-18T22:22:36.751302
2020-09-15T12:42:12
2020-09-15T12:42:12
286,754,222
2
0
null
null
null
null
UTF-8
Java
false
false
1,441
java
package ar.itba.edu.POO.RepasoSegundoParcial.Ej7; import java.time.LocalDate; import java.util.*; public class Library { Map<String, BookInfo> bookMap = new HashMap<>(); Map<Clients, Loan> loans = new HashMap<>(); public Library addBook(String title, int stock){ bookMap.put(title, new BookInfo(title,stock)); return this; } public void borrowBook(Clients client, String bookTitle, LocalDate date) { if (!bookMap.containsKey(bookTitle)){ throw new IllegalArgumentException("Book not found"); } bookMap.get(bookTitle).borrowBook(); loans.put(client, new Loan(client, bookTitle,date)); } public void printDueLoansBooks(LocalDate date) { System.out.println("Due loans at "+ date.toString()); Set<Clients> loanClients = loans.keySet(); for (Clients client : loanClients){ if (date.isAfter(loans.get(client).getDate().plusDays(loans.get(client).getClient().getLoanTime()))){ System.out.println(client.getName()+" ("+loans.get(client).getBookTitle()+" - "+loans.get(client).getDate()+")"); } } System.out.println(); } public void returnBook(Clients client) { Loan returning = loans.remove(client); if (returning == null){ throw new IllegalArgumentException(); } bookMap.get(returning.getBookTitle()).returnBook(); } }
81eafbc46fc7197eb7959f0d365b3e67014e7d8e
2b2fb797deec885ceb6104d6a12460ee906cfa7d
/backend/src/main/java/com/vlad/backend/dto/OurRecipeDTO.java
03f4c14f4cce5ca8c7fdfe1832897126b77d2096
[]
no_license
iluczvlad/vlad_repo
8f6fdb90d248cec12a98b11d5fa2a46831f36bd1
c222775bcdd4b2d78a118b94289bc8d6335176f7
refs/heads/master
2022-12-10T16:55:17.805972
2019-05-30T14:45:58
2019-05-30T14:45:58
141,588,100
0
0
null
2022-12-09T04:59:37
2018-07-19T14:03:40
Vue
UTF-8
Java
false
false
618
java
package com.vlad.backend.dto; import java.util.List; public class OurRecipeDTO { private Long id; private String name; private List<IngredientDTO> ingredients; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public List<IngredientDTO> getIngredients() { return ingredients; } public void setIngredients(List<IngredientDTO> ingredients) { this.ingredients = ingredients; } }
be64a5bae4e94ed1db3131d9147cc6406ed71b83
4bd68d9ccb8d993fc84a5d90f7504b9b1d518dd9
/FitnessTracker/src/main/java/com/springmvc/service/ExerciseService.java
f2dbf402e95035f6075fd03315ce542f24118beb
[]
no_license
jayMcoder/HandsOn-SpringMVC
f14be9bf37800312ed47787f94f0a26671bbdf0c
e6cf676d396b84399fc7d2cdc02dada3c9c4a08b
refs/heads/master
2020-05-16T14:11:34.420337
2019-04-30T15:38:43
2019-04-30T15:38:43
183,095,607
0
0
null
null
null
null
UTF-8
Java
false
false
169
java
package com.springmvc.service; import java.util.List; import com.springmvc.model.Activity; public interface ExerciseService { List<Activity> findAllActivities(); }
2ec5c71e00b54815165f7850d98a61495daee0af
a9b274fa9510171ad5b389a318a2b3a73b0b0655
/src/main/java/com/test/weather/weather/config/RedisConfig.java
224d7e942fdfebb75c558b013df2fddb51193ec4
[]
no_license
lukehanabi/weather
258ce0ff00f9a80a33f89e0d019eba491d740b93
b4f446c56c0ea47408e31f84b88cae92cde298f9
refs/heads/master
2020-04-20T14:44:15.648940
2019-02-03T04:26:40
2019-02-03T04:26:40
168,908,307
0
0
null
null
null
null
UTF-8
Java
false
false
879
java
package com.test.weather.weather.config; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; @Configuration @EnableCaching @PropertySource("classpath:application.properties") public class RedisConfig { @Bean JedisConnectionFactory jedisConnectionFactory() { return new JedisConnectionFactory(); } @Bean public RedisTemplate<String, Object> redisTemplate() { RedisTemplate<String, Object> template = new RedisTemplate<>(); template.setConnectionFactory(jedisConnectionFactory()); return template; } }
7c7924672b79c9d7d2455149884d92d501669d88
ca93d74d71f5d992f03ec8b79b5b5fe08aac4f5f
/src/main/java/com/hengyun/service/patient/SNMacRelationService.java
a13d1d228914f6cfde90d7962a8ef560af888019
[]
no_license
jarvisxiong/dev
29d2445d89f97b385218d14d74700c5f026f8dac
ceeefde8d2e15f9d246ff700428583e0721d0d52
refs/heads/master
2021-01-01T06:55:52.363282
2016-07-07T06:22:09
2016-07-07T06:22:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
413
java
package com.hengyun.service.patient; import com.hengyun.domain.patient.SNMacRelation; import com.hengyun.service.BaseService; /** * @author bob E-mail:[email protected] * @version 创建时间:2016年5月13日 下午4:53:40 * 类说明 */ public interface SNMacRelationService extends BaseService<SNMacRelation,Integer>{ public void add(SNMacRelation snMacRelation); public String getSN(String mac); }
e5de8ea2608ec86dd1758777a10b55f80aba535a
ba4b3f72c53eb80f7cc52e93348032dd352c686e
/MyLib/src/org/me/mylib/LibClass.java
0c25edbb2192c4f2c52f2aaad4b8023d1a902c41
[]
no_license
Jerek426/HomeWork1
2e6dff9fe730f0f26541774d993e0f8a6b11bf81
8c88df71be7dbadf868e8efba8cb126d58036025
refs/heads/master
2021-01-19T03:24:12.162418
2013-02-08T02:48:33
2013-02-08T02:48:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
541
java
package org.me.mylib; /** * * @author Devon Dimone */ public class LibClass { /** * * @param args * @return */ public static String acrostic(String[] args) { StringBuffer b = new StringBuffer(); for (int i = 0; i < args.length; i++) { if (args[i].length() > i) { b.append(args[i].charAt(i)); } else { b.append('?'); } } return b.toString(); } }
f052f1eae60eefdc88432a022b87f80d148ee6bc
c4203c32915c1ee09fd0ebe37149db351f8434ca
/baselibrary/src/main/java/com/yyyu/baselibrary/ui/widget/BounceScrollView.java
032a7cc7e1c677f78472ae85d068e064ae620d35
[]
no_license
yuqibiao2/LSM
8eb23b017f124227a21c7a37ad8cda65e127228d
f1c872ecfc155c1f6800abcb4d1f5dba633649e5
refs/heads/master
2020-03-06T16:13:28.696197
2019-01-03T07:47:35
2019-01-03T07:47:35
126,969,699
1
1
null
null
null
null
UTF-8
Java
false
false
5,454
java
package com.yyyu.baselibrary.ui.widget; import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.view.animation.TranslateAnimation; import android.widget.ScrollView; /** * 弹性ScrollView * */ public class BounceScrollView extends ScrollView { private static final String TAG = "BounceScrollView"; private View inner;// 孩子View private float y;// 点击时y坐标 private Rect normal = new Rect();// 矩形(这里只是个形式,只是用于判断是否需要动画.) private boolean isCount = false;// 是否开始计算 private float lastX = 0; private float lastY = 0; private float currentX = 0; private float currentY = 0; private float distanceX = 0; private float distanceY = 0; private boolean upDownSlide = false; //判断上下滑动的flag public BounceScrollView(Context context, AttributeSet attrs) { super(context, attrs); } /*** * 根据 XML 生成视图工作完成.该函数在生成视图的最后调用,在所有子视图添加完之后. 即使子类覆盖了 onFinishInflate * 方法,也应该调用父类的方法,使该方法得以执行. */ @Override protected void onFinishInflate() { super.onFinishInflate(); if (getChildCount() > 0) { inner = getChildAt(0); View view; } } @Override public boolean dispatchTouchEvent(MotionEvent ev) { // TODO Auto-generated method stub currentX = ev.getX(); currentY = ev.getY(); switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: break; case MotionEvent.ACTION_MOVE: distanceX = currentX - lastX; distanceY = currentY - lastY; if (Math.abs(distanceX) < Math.abs(distanceY) && Math.abs(distanceY) > 12) { upDownSlide = true; } break; case MotionEvent.ACTION_UP: break; default: break; } lastX = currentX; lastY = currentY; if (upDownSlide && inner != null) commOnTouchEvent(ev); return super.dispatchTouchEvent(ev); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { // TODO Auto-generated method stub return super.onInterceptTouchEvent(ev); } /*** * 监听touch */ @Override public boolean onTouchEvent(MotionEvent ev) { return super.onTouchEvent(ev); } /*** * 触摸事件 * * @param ev */ public void commOnTouchEvent(MotionEvent ev) { int action = ev.getAction(); switch (action) { case MotionEvent.ACTION_DOWN: break; case MotionEvent.ACTION_UP: // 手指松开. if (isNeedAnimation()) { animation(); isCount = false; } clear0(); break; case MotionEvent.ACTION_MOVE: final float preY = y;// 按下时的y坐标 float nowY = ev.getY();// 时时y坐标 int deltaY = (int) (preY - nowY);// 滑动距离 if (!isCount) { deltaY = 0; // 在这里要归0. } y = nowY; // 当滚动到最上或者最下时就不会再滚动,这时移动布局 if (isNeedMove()) { // 初始化头部矩形 if (normal.isEmpty()) { // 保存正常的布局位置 normal.set(inner.getLeft(), inner.getTop(), inner.getRight(), inner.getBottom()); } // 移动布局 inner.layout(inner.getLeft(), inner.getTop() - deltaY / 2, inner.getRight(), inner.getBottom() - deltaY / 2); } isCount = true; break; default: break; } } /*** * 回缩动画 */ public void animation() { // 开启移动动画 TranslateAnimation ta = new TranslateAnimation(0, 0, inner.getTop(), normal.top); ta.setDuration(200); inner.startAnimation(ta); // 设置回到正常的布局位置 inner.layout(normal.left, normal.top, normal.right, normal.bottom); normal.setEmpty(); } // 是否需要开启动画 public boolean isNeedAnimation() { return !normal.isEmpty(); } /*** * 是否需要移动布局 inner.getMeasuredHeight():获取的是控件的总高度 * * getHeight():获取的是屏幕的高度 * * @return */ public boolean isNeedMove() { int offset = inner.getMeasuredHeight() - getHeight(); int scrollY = getScrollY(); // 0是顶部,后面那个是底部 if (scrollY == 0 || scrollY == offset) { return true; } return false; } private void clear0() { lastX = 0; lastY = 0; distanceX = 0; distanceY = 0; upDownSlide = false; } }
[ "yuqibiao19920605" ]
yuqibiao19920605
13782baa8df1a14de6cf029c88e30b12434f1174
c663b981af3566743a774fae261548255947bfdc
/srth-osgi/uk.nhs.cfh.dsp.srth.information.model.impl/src/test/java/uk/nhs/cfh/dsp/srth/information/model/impl/internal/ClinicalEntityFactoryImplTest.java
75331b4b8f6ab560d367ea2a2a132ed7f68bc426
[]
no_license
termlex/snofyre
c653295ecb1b2a28a44d111ff7603a3cc639e7eb
2622c524377ed7cc77a9aae9f1ec522b00da2b7c
refs/heads/master
2022-05-22T18:37:18.579877
2022-03-25T15:23:41
2022-03-25T15:23:41
34,781,765
0
0
null
null
null
null
UTF-8
Java
false
false
8,111
java
/** * Crown Copyright (C) 2008 - 2011 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package uk.nhs.cfh.dsp.srth.information.model.impl.internal; import org.springframework.test.AbstractDependencyInjectionSpringContextTests; import uk.nhs.cfh.dsp.snomed.converters.human.readable.HumanReadableRender; import uk.nhs.cfh.dsp.snomed.dao.TerminologyConceptDAO; import uk.nhs.cfh.dsp.snomed.expression.model.CloseToUserExpression; import uk.nhs.cfh.dsp.snomed.expression.model.impl.CloseToUserExpressionImpl; import uk.nhs.cfh.dsp.snomed.expressiongenerator.SituationExpressionGenerator; import uk.nhs.cfh.dsp.snomed.normaliser.NormalFormGenerator; import uk.nhs.cfh.dsp.snomed.objectmodel.SnomedConcept; import uk.nhs.cfh.dsp.srth.information.model.impl.ClinicalEntityFactory; import uk.nhs.cfh.dsp.srth.information.model.om.clinical.ClinicalEntity; import uk.nhs.cfh.dsp.srth.information.model.om.clinical.entity.*; // TODO: Auto-generated Javadoc /** * <br>Version : @#VersionNumber#@ * <br>Written by @author Jay Kola * <br>Created on Jan 20, 2010 at 4:58:56 PM. */ public class ClinicalEntityFactoryImplTest extends AbstractDependencyInjectionSpringContextTests { /** The test normal form generator. */ private NormalFormGenerator testNormalFormGenerator; /** The test human readable renderer. */ private HumanReadableRender testHumanReadableRenderer; /** The test situation expression generator. */ private SituationExpressionGenerator testSituationExpressionGenerator; /** The test terminology dao. */ private TerminologyConceptDAO testTerminologyDAO; /** The test entity factory service. */ private ClinicalEntityFactory testEntityFactoryService; /** The Constant conceptId. */ private static final String conceptId = "22298006"; /** The concept. */ private SnomedConcept concept; /* (non-Javadoc) * @see org.springframework.test.AbstractSingleSpringContextTests#getConfigLocations() */ protected String[] getConfigLocations() { return new String[] {"META-INF/spring/bundle-context-test.xml"}; } /* (non-Javadoc) * @see org.springframework.test.AbstractSingleSpringContextTests#onSetUp() */ @Override protected void onSetUp() throws Exception { assertNotNull("Normal form generator must not be null", testNormalFormGenerator); assertNotNull("Human readable renderer must not be null", testHumanReadableRenderer); assertNotNull("Situation generator must not be null", testSituationExpressionGenerator); assertNotNull("Data Access Object must not be null", testTerminologyDAO); concept = (SnomedConcept) testTerminologyDAO.getTerminologyConcept(conceptId); assertNotNull("Concept must not be null", concept); } /** * Sets the test entity factory service. * * @param testEntityFactoryService the new test entity factory service */ public void setTestEntityFactoryService(ClinicalEntityFactory testEntityFactoryService) { this.testEntityFactoryService = testEntityFactoryService; } /** * Test get clinical feature entity. * * @throws Exception the exception */ public void testGetClinicalFeatureEntity() throws Exception { CloseToUserExpression expression = new CloseToUserExpressionImpl(concept); assertNotNull("Close to user expression must not be null", expression); ClinicalFindingEntity entity = testEntityFactoryService.getClinicalFindingEntity(expression); assertNotNull("Feature entity must not be null", entity); assertNotNull("Expression in entity must not be null", entity.getExpression()); assertEquals("Expression in entity must be the ctu", expression.getUuid(), entity.getExpression().getUuid()); } /** * Test get clinical finding entity. * * @throws Exception the exception */ public void testGetClinicalFindingEntity() throws Exception { assertNotNull("Finding entity must not be null", testEntityFactoryService.getClinicalFindingEntity()); } /** * Test get investigation entity. * * @throws Exception the exception */ public void testGetInvestigationEntity() throws Exception { assertNotNull("Investigation entity must not be null", testEntityFactoryService.getInvestigationEntity()); } /** * Test get intervention entity. * * @throws Exception the exception */ public void testGetInterventionEntity() throws Exception { assertNotNull("Intervention entity must not be null", testEntityFactoryService.getInterventionEntity()); } /** * Test get medication entity. * * @throws Exception the exception */ public void testGetMedicationEntity() throws Exception { assertNotNull("Medication entity must not be null", testEntityFactoryService.getMedicationEntity()); } /** * Test get anatomical location entity. * * @throws Exception the exception */ public void testGetAnatomicalLocationEntity() throws Exception { assertNotNull("Anatomical entity must not be null", testEntityFactoryService.getAnatomicalLocationEntity()); } /** * Test get entity. * * @throws Exception the exception */ public void testGetEntity() throws Exception { assertTrue("Must return Feature Entity", testEntityFactoryService.getEntity(ClinicalEntity.Type.FEATURE) instanceof ClinicalFeatureEntity); assertTrue("Must return Finding Entity", testEntityFactoryService.getEntity(ClinicalEntity.Type.FINDING) instanceof ClinicalFindingEntity); assertTrue("Must return Intervention Entity", testEntityFactoryService.getEntity(ClinicalEntity.Type.INTERVENTION) instanceof InterventionEntity); assertTrue("Must return Investigation Entity", testEntityFactoryService.getEntity(ClinicalEntity.Type.INVESTIGATION) instanceof InvestigationEntity); assertTrue("Must return Medication Entity", testEntityFactoryService.getEntity(ClinicalEntity.Type.MEDICATION) instanceof MedicationEntity); assertTrue("Must return Anatomical Entity", testEntityFactoryService.getEntity(ClinicalEntity.Type.ANATOMICAL_LOCATION) instanceof AnatomicalLocationEntity); } /** * Sets the test normal form generator. * * @param testNormalFormGenerator the new test normal form generator */ public void setTestNormalFormGenerator(NormalFormGenerator testNormalFormGenerator) { this.testNormalFormGenerator = testNormalFormGenerator; } /** * Sets the test human readable renderer. * * @param testHumanReadableRenderer the new test human readable renderer */ public void setTestHumanReadableRenderer(HumanReadableRender testHumanReadableRenderer) { this.testHumanReadableRenderer = testHumanReadableRenderer; } /** * Sets the test situation expression generator. * * @param testSituationExpressionGenerator the new test situation expression generator */ public void setTestSituationExpressionGenerator(SituationExpressionGenerator testSituationExpressionGenerator) { this.testSituationExpressionGenerator = testSituationExpressionGenerator; } /** * Sets the test terminology dao. * * @param testTerminologyDAO the new test terminology dao */ public void setTestTerminologyDAO(TerminologyConceptDAO testTerminologyDAO) { this.testTerminologyDAO = testTerminologyDAO; } }
[ "jay.kola@29ca23ef-472f-bbfa-ca66-17e9de3a230d" ]
jay.kola@29ca23ef-472f-bbfa-ca66-17e9de3a230d
78f08abac3f542daae843eddef7721f1167b0ab6
49f1893292bab017c3e29babfcdf0d3086996e1f
/app/src/main/java/br/com/movies_tek/data/db/Converters.java
8a48898a14112f2195de881ec84b339fd9f057d9
[]
no_license
ksdrof500/movies
4897b6483d0054cba8547833c54c28e7c39a84af
c3a71542c86d23057633dc6080c3e4bf894d06fe
refs/heads/master
2020-03-27T18:40:50.581438
2019-04-22T23:00:33
2019-04-22T23:00:33
146,936,676
0
0
null
null
null
null
UTF-8
Java
false
false
488
java
package br.com.movies_tek.data.db; import android.arch.persistence.room.TypeConverter; import java.util.Date; public class Converters { @TypeConverter public static Date fromTimestamp(Long value) { if (value == null) { return new Date(0L); } return new Date(value); } @TypeConverter public static Long toTimestamp(Date date) { if (date == null) { return 0L; } return date.getTime(); } }
ff4f9b1dd0286a600ed1bdd6ed827350b42e341d
a09b4d2050f997a972a23225b96cc5b726f70bbe
/rmi/DynamicInvocation.java
70afdec97d88fc501fd7879d9db2b2de9e9e2c9e
[]
no_license
cczhong11/Remote-Method-Invocation
a9a0636b2c074890d3c83f4ea81e92fb0b3c5a6b
21d7f4037c9fa2238fdb5be5c264c90a843e5128
refs/heads/master
2021-01-25T09:52:33.923415
2018-02-28T18:09:34
2018-02-28T18:09:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,336
java
package rmi; import java.net.*; import java.lang.reflect.Method; import java.lang.reflect.Proxy; import java.lang.reflect.InvocationHandler; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; public class DynamicInvocation<T> implements InvocationHandler{ //the information stored in each handler to handle requests private Class<T> remote_interface; private InetSocketAddress remote_addr; public DynamicInvocation(InetSocketAddress addr, Class<T> c) { remote_interface = c; remote_addr = addr; } /** * my_toString: report the name of remote interface implemented by the stub * and remote address(hostname + port) of the skeleton * @param proxy * the proxy being invoked */ private String my_toString(Object proxy) { DynamicInvocation<T> DynamicHandler = (DynamicInvocation<T>)Proxy.getInvocationHandler(proxy); return DynamicHandler.remote_interface.getName() + " " + DynamicHandler.remote_addr.toString(); } /** * my_hashCode: when the client is requesting the hashCode function of Stub, * the proxy object should implement the hashCode function rather * than sending it to the server * @param proxy * the proxy being invoked */ private int my_hashCode(Object proxy) { return my_toString(proxy).hashCode(); } /** * two stubs are considered equal if they implement the same interface & connect to * the same skeleton * Note: should deal with null situation * @param proxy * the proxy being invoked * @param args * the arguments of equals function */ private boolean my_equals(Object proxy, Object[] args) { try { if (my_hashCode(proxy) == my_hashCode(args[0])) return true; } catch (Exception e) { return false; } return false; } /** * when a method is called, invoke and open a new connection * @param proxy * the proxy object created for the stub, the method is invoked on * @param method * the method transferred to the server * @param args * the method arguments */ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { //check if it is the stub's self function String method_name = method.getName(); if (method_name.equals("hashCode")) { return my_hashCode(proxy); } if (method_name == "equals") { return my_equals(proxy, args); } if (method_name == "toString") { return my_toString(proxy); } //otherwise it should forward the request to the server //open a connection with the remote server ObjectOutputStream out = null; ObjectInputStream in = null; Socket client = null; try { InetAddress server = remote_addr.getAddress(); int port = remote_addr.getPort(); client = new Socket(server, port); out = new ObjectOutputStream(client.getOutputStream()); out.flush(); }catch(Exception e) { client.close(); System.out.println("Fail to create output stream to server."); throw new RMIException("RMI: Fail to create output stream to server."); } //create the input stream try { in = new ObjectInputStream(client.getInputStream()); }catch(Exception e) { client.close(); throw new RMIException("RMI: Fail to create input stream to server."); } //send try { out.writeObject(method.getName()); out.writeObject(args); out.writeObject(null); out.flush(); }catch(Exception e) { client.close(); in.close(); out.close(); System.out.println("Error in sending the data!"); throw new RMIException("RMI: Error in sending the data!"); } //receive Object returned_obj; try { returned_obj = (Object)in.readObject(); }catch(Exception e) { client.close(); in.close(); out.close(); System.out.println("Error in receiving the data!"); throw new RMIException("Error in receiving the data!"); } //raise the same exception if (returned_obj instanceof Exception) { throw (java.lang.Throwable)returned_obj; } //close connection try { out.close(); in.close(); client.close(); }catch(Exception e) { System.out.println("Error in closing socket"); throw new RMIException("Error in closing socket."); } //return the object to client return returned_obj; } }
20785e43bc8f0db721e31cbfb9aa6d33a0b94d4a
58a4d1486a30ea16742707f0da565bc4cd25e562
/eclipse/VerilogExpress/src/verilogExpress/SequentualDoer.java
5e864965c2ea2254010970fd2f65054c82e9a8e5
[]
no_license
JEdward7777/VerilogExpress
95fa248e381a43d9628b497ffd1ccd26def5cd2d
ba6d22c88e28acaacfb482d5d08f5c3e096a1017
refs/heads/master
2021-06-01T23:40:47.953614
2018-06-21T18:02:04
2018-06-21T18:02:04
6,460,616
0
0
null
null
null
null
UTF-8
Java
false
false
3,993
java
package verilogExpress; import java.util.HashSet; public class SequentualDoer extends DoBlock { static HashSet< String > usedStateVars = new HashSet< String >(); @Override String getDoneSignal() { return listToDo.getLast().getDoneSignal(); } @Override public String getChildActiveSignal(Doable doable) { return getActiveWireName( doable ); } private static String getActiveWireName( Doable doable ){ return doable.getUniqueName() + "_IsActiveWire"; } private static String getRegName( Doable doable ){ return doable.getUniqueName() + "_Reg"; } private static String getParamName( Doable doable ){ return doable.getUniqueName() + "_StateParam"; } private static String getResetParamName( Doable doable ){ return doable.getUniqueName() + "_ResetStateParam"; } @Override public String genTopCode(String indent) { String result = super.genTopCode(indent); if( !listToDo.isEmpty() ){ result += indent + "reg [31:0] " + getRegName( this ) + ";\n"; result += "\n"; int doerCount = 0; result += indent + "parameter " + getResetParamName( this ) + " = " + (doerCount++) + ";\n"; for( Doable doer : listToDo ){ result += indent + "parameter " + getParamName( doer ) + " = " + (doerCount++) + ";\n"; } result += "\n"; for( Doable doable : listToDo ){ result += indent + "wire " + getActiveWireName( doable ) + ";\n"; } } return result; } @Override public String genMiddleCode(String indent) throws Exception { String result = super.genMiddleCode( indent ); if( !listToDo.isEmpty() ){ result += indent + "always @( posedge " + parrent.getClockSignal() + " )\n"; result += indent + "if( " + parrent.getResetSignal() + " || !( " + getActiveSignal()+ ") )begin\n"; result += indent + " " + getRegName( this ) + " <= " + getResetParamName(this) + ";\n"; result += indent + "end else case( " + getRegName( this ) + ")\n"; result += indent + " " + getResetParamName(this) + ": begin\n"; result += indent + " if( " + getActiveSignal() + " )begin\n"; result += indent + " " + getRegName( this ) + " <= " + getParamName( listToDo.getFirst() ) + ";\n"; result += indent + " end\n"; result += indent + " end\n"; //for( int doableNum = 0; doableNum < listToDo.size(); ++doableNum ){ // result += indent + "" //} for( int doableNum = 0; doableNum < listToDo.size(); ++doableNum ){ Doable doable = listToDo.get( doableNum ); Doable nextDoable = doableNum < listToDo.size()-1?listToDo.get( doableNum+1 ) : null; result+=indent+" " + getParamName( doable ) + ": begin\n"; result+=indent+" if( " + doable.getDoneSignal() + " ) begin\n"; if( nextDoable != null ){ result+=indent+" " + getRegName( this ) + " <= " + getParamName(nextDoable) + ";\n"; }else{ //go to reset for a count before we start out again. //to give the parent a chance to drop the active signal result+=indent+" " + getRegName( this ) + " <= " + getResetParamName(this) + ";\n"; } result+=indent+" end\n"; result+=indent+" end\n"; } result += indent + " default: begin\n"; result += indent + " " + getRegName( this ) + " <= " + getResetParamName(this) + ";\n"; result += indent + " end\n"; result += indent + "endcase\n"; } return result; } @Override public String genBottomCode(String indent) { String result = super.genBottomCode( indent ); for( Doable doable : listToDo ){ result += indent + "assign " + getActiveWireName( doable ) + " = (" + getRegName( this ) + " == " + getParamName( doable ) + " );\n"; } return result; } @Override String getDescribeName() { //if( true ) throw new NullPointerException( "Here!" ); return "SequentualDoer"; } }
95ffbaf3d0fc8736b3c08363055fd3de260b4bed
b5b024e463f5cd3e3c4b693687cb9c787f16a168
/remote-diagnosis-service/src/main/java/com/remote/diagnosis/service/domain/BaseDomain.java
2b9908bc7451beda230cd33d78ba78749ecdaaac
[]
no_license
xiaoweibianchen/remote-diagnosis
99f6947cec73d1dfa48c0bf72943edcb8a5aff1f
6d827f4de1f276a6f30c091edb063bcc60487a6d
refs/heads/master
2020-12-03T03:43:20.384340
2017-08-27T10:21:23
2017-08-27T10:21:23
95,765,357
0
0
null
null
null
null
UTF-8
Java
false
false
958
java
package com.remote.diagnosis.service.domain; import java.io.Serializable; import java.util.Date; public class BaseDomain implements Serializable { private String created; private Date createdDate; private String modified; private Date modifiedDate; public String getCreated() { return created; } public void setCreated(String created) { this.created = created; } public Date getCreatedDate() { return createdDate; } public void setCreatedDate(Date createdDate) { this.createdDate = createdDate; } public String getModified() { return modified; } public void setModified(String modified) { this.modified = modified; } public Date getModifiedDate() { return modifiedDate; } public void setModifiedDate(Date modifiedDate) { this.modifiedDate = modifiedDate; } }
daee6ea735009681a91d25623a65aaadb1e24cb9
0639ae56532079d5622f00c8faeb8003c5eea6f3
/Designpattern2/src/com/riversand/structural/decorator/BreadTypeDecorator.java
b7331f8e92f83f0fca6adac192947ebb52454187
[]
no_license
ritam-sarkar/JavaBasics
7ffacaf27f14d38a7223b9350e8f1ef57a8689c1
eba9fbb916881fa88d8a8798423042356bb31a3d
refs/heads/master
2023-04-07T09:26:15.607580
2023-03-16T03:13:36
2023-03-16T03:13:36
102,585,573
0
0
null
null
null
null
UTF-8
Java
false
false
400
java
package com.riversand.structural.decorator; public class BreadTypeDecorator extends SandwichDecorator { private String breadType; public BreadTypeDecorator(Sandwich customsandwich, String breadType) { super(customsandwich); this.breadType = breadType; } public String make() { return super.make()+" + "+addBreadType(); } private String addBreadType() { return this.breadType; } }
57f89d077a1aecaf51f91aae173c82c0f57f15ed
6814f68e6382945116005747a7111a326ef7ca84
/src/multi_thread/Chapter3/notifyAll/ThreadB.java
7976f9db0a11bca942b4b1f8f60394b8ebf50a8e
[]
no_license
ranxin1022/java_concurrency
81538d3300256dc664f7f32c011c3552ada7b03b
d37e1ca5bbff10ae16ee5a106600005907d9f6c8
refs/heads/master
2020-03-22T09:44:32.494051
2018-07-05T14:00:52
2018-07-05T14:00:52
139,857,491
0
0
null
null
null
null
UTF-8
Java
false
false
302
java
package multi_thread.Chapter3.notifyAll; public class ThreadB extends Thread { private Object lock; public ThreadB(Object lock) { this.lock = lock; } @Override public void run() { Service service = new Service(); service.testMethod(lock); } }
8a1240fe095f0af4ea99079626c1627d59d8eb3e
d254ff443950042970aec7ef96d3654a21e2cf27
/jharwal_problem1/src/jharwal_problem1/CAI5.java
3530ca5d72560996622c8230626943658eb84c5e
[]
no_license
aryanjharwal/jharwal_assignment3
0c20ff1e4b27e9a87787b73f250b100e47e82f17
439099c964add001924fa785f2d86c28e01eca8b
refs/heads/master
2021-01-15T06:45:38.681176
2020-02-25T04:47:29
2020-02-25T04:47:29
242,904,696
0
0
null
null
null
null
UTF-8
Java
false
false
4,553
java
package jharwal_problem1; import java.security.SecureRandom; import java.util.Scanner; public class CAI5 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String flag; do { //calling quiz quiz(sc); //getting user input about next round System.out.print("\nDo you want another round?(yes/no): "); flag = sc.next(); System.out.println(); }while(flag.equalsIgnoreCase("yes")); sc.close(); } public static void quiz(Scanner sc) { SecureRandom rand = new SecureRandom(); int countCorrect = 0; int x,i,correctAns=0; int max = readDifficulty(sc); int problemtype = readProblemType(sc); for ( i = 1; i <= 10; i++) { int first = rand.nextInt(max); int second = rand.nextInt(max); switch(problemtype){ case 1: correctAns = call_method(first, second, i,1); break; case 2: correctAns = call_method(first, second, i,2); break; case 3: correctAns = call_method(first, second, i,3); break; case 4: correctAns = call_method(first, second, i,4); break; case 5: x = rand.nextInt(4)+1; // rand between 1-4 correctAns = call_method(first, second, i,x); break; default: System.out.println("Wrong choice!!"); break; } int response = readResponse(sc); if (isAnswerCorrect(correctAns, response)) { displayCorrectResponse(rand); countCorrect++; } else displayIncorrectResponse(rand); } displayCompletionMessage(countCorrect); } private static void displayCompletionMessage(int countCorrect) { double percent = ((double) countCorrect / 10.0) * 100.0; System.out.println("\nYou Scored: " + percent + "%"); if (percent < 75) System.out.println("Please ask your teacher for extra help."); else System.out.println("Congratulations, you are ready to go to next level!"); } private static void displayIncorrectResponse(SecureRandom rand) { String incorrect[] = { "No. Please try again.", "Wrong. Try once more.", "Don't give up!", "No. Keep trying." }; // generating random index int index = rand.nextInt(incorrect.length); System.out.println(incorrect[index]); } private static void displayCorrectResponse(SecureRandom rand) { String appreciate[] = { "Very good!", "Excellent", "Nice work!", "Keep up the good work!" }; // generating random index int index = rand.nextInt(appreciate.length); System.out.println(appreciate[index]); } private static boolean isAnswerCorrect(int correctAns, int response) { return correctAns == response; } private static int readResponse(Scanner sc) { System.out.print("Ans. "); int response = sc.nextInt(); return response; } private static int readDifficulty(Scanner sc){ System.out.println("Choose the difficulty level"); System.out.print("Difficulty(1-4)? "); int response = sc.nextInt(); switch (response){ case 1: response = 10; break; case 2: response = 100; break; case 3: response = 1000; break; case 4: response = 10000; break; default: System.out.println("Wrong choice!!"); break; } return response; } private static int readProblemType(Scanner sc){ System.out.println("Choose the problem type"); System.out.print("Problem Type(1-5)? "); int response = sc.nextInt(); return response; } private static int multiply(int first, int second, int i) { System.out.println("Q."+i+" how much is " + first + " X " + second + "?"); int correctAns = first * second; return correctAns; } private static int add(int first, int second, int i) { System.out.println("Q."+i+" how much is " + first + " + " + second + "?"); int correctAns = first + second; return correctAns; } private static int subtract(int first, int second, int i) { System.out.println("Q."+i+" how much is " + first + " - " + second + "?"); int correctAns = first - second; return correctAns; } private static int division(int first, int second, int i) { System.out.println("Q."+i+" how much is " + first + " / " + second + "?"); int correctAns = first / second; return correctAns; } private static int call_method(int first,int second,int i, int choice){ int ans=0; switch (choice){ case 1: ans = add(first,second,i); break; case 2: ans = subtract(first,second,i); break; case 3: ans = multiply(first,second,i); break; case 4: ans = division(first,second,i); break; } return ans; } private static int generateQuestionArgument(SecureRandom rand, int difficulty) { int argument = 0; if (difficulty == 1) argument = rand.nextInt(10); else if (difficulty == 2) argument = rand.nextInt(100); else if (difficulty == 3) argument = rand.nextInt(1000); else argument = rand.nextInt(10000); return argument; } }
[ "aryan@localhost" ]
aryan@localhost
c41ae3d81f20a6de968917215a272a0da85f3445
cfc60fc1148916c0a1c9b421543e02f8cdf31549
/src/testcases/CWE113_HTTP_Response_Splitting/CWE113_HTTP_Response_Splitting__URLConnection_setHeaderServlet_07.java
7e776e5d7cd5be87562ae4f7a9a454eb1edb305a
[ "LicenseRef-scancode-public-domain" ]
permissive
zhujinhua/GitFun
c77c8c08e89e61006f7bdbc5dd175e5d8bce8bd2
987f72fdccf871ece67f2240eea90e8c1971d183
refs/heads/master
2021-01-18T05:46:03.351267
2012-09-11T16:43:44
2012-09-11T16:43:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
15,941
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE113_HTTP_Response_Splitting__URLConnection_setHeaderServlet_07.java Label Definition File: CWE113_HTTP_Response_Splitting.label.xml Template File: sources-sinks-07.tmpl.java */ /* * @description * CWE: 113 HTTP Response Splitting * BadSource: URLConnection Read a string from a web server with URLConnection * GoodSource: A hardcoded string * Sinks: setHeaderServlet * GoodSink: URLEncode input * BadSink : querystring to setHeader() * Flow Variant: 07 Control flow: if(private_five==5) and if(private_five!=5) * * */ package testcases.CWE113_HTTP_Response_Splitting; import testcasesupport.*; import javax.servlet.http.*; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.net.URL; import java.net.URLConnection; import java.util.logging.Logger; import java.net.URLEncoder; public class CWE113_HTTP_Response_Splitting__URLConnection_setHeaderServlet_07 extends AbstractTestCaseServlet { /* The variable below is not declared "final", but is never assigned any other value so a tool should be able to identify that reads of this will always give its initialized value. */ private int private_five = 5; public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable { String data; /* INCIDENTAL: CWE 571 Statement is Always True */ if(private_five==5) { Logger log_bad = Logger.getLogger("local-logger"); data = ""; /* init data */ URLConnection conn = (new URL("http://www.example.org/")).openConnection(); BufferedReader buffread = null; InputStreamReader instrread = null; try { /* read input from URLConnection */ instrread = new InputStreamReader(conn.getInputStream()); buffread = new BufferedReader(instrread); data = buffread.readLine(); // This will be reading the first "line" of the response body, // which could be very long if there are no newlines in the HTML } catch( IOException ioe ) { log_bad.warning("Error with stream reading"); } finally { /* clean up stream reading objects */ try { if( buffread != null ) { buffread.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing buffread"); } finally { try { if( instrread != null ) { instrread.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing instrread"); } } } } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ java.util.logging.Logger log_good = java.util.logging.Logger.getLogger("local-logger"); /* FIX: Use a hardcoded string */ data = "foo"; } /* INCIDENTAL: CWE 571 Statement is Always True */ if(private_five==5) { /* POTENTIAL FLAW: Input not verified before inclusion in header */ response.setHeader("Location", "/author.jsp?lang=" + data); } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ /* FIX: use URLEncoder.encode to hex-encode non-alphanumerics */ data = URLEncoder.encode(data, "UTF-16"); response.setHeader("Location", "/author.jsp?lang=" + data); } } /* goodG2B1() - use goodsource and badsink by changing first private_five==5 to private_five!=5 */ private void goodG2B1(HttpServletRequest request, HttpServletResponse response) throws Throwable { String data; /* INCIDENTAL: CWE 570 Statement is Always False */ if(private_five!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ Logger log_bad = Logger.getLogger("local-logger"); data = ""; /* init data */ URLConnection conn = (new URL("http://www.example.org/")).openConnection(); BufferedReader buffread = null; InputStreamReader instrread = null; try { /* read input from URLConnection */ instrread = new InputStreamReader(conn.getInputStream()); buffread = new BufferedReader(instrread); data = buffread.readLine(); // This will be reading the first "line" of the response body, // which could be very long if there are no newlines in the HTML } catch( IOException ioe ) { log_bad.warning("Error with stream reading"); } finally { /* clean up stream reading objects */ try { if( buffread != null ) { buffread.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing buffread"); } finally { try { if( instrread != null ) { instrread.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing instrread"); } } } } else { java.util.logging.Logger log_good = java.util.logging.Logger.getLogger("local-logger"); /* FIX: Use a hardcoded string */ data = "foo"; } /* INCIDENTAL: CWE 571 Statement is Always True */ if(private_five==5) { /* POTENTIAL FLAW: Input not verified before inclusion in header */ response.setHeader("Location", "/author.jsp?lang=" + data); } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ /* FIX: use URLEncoder.encode to hex-encode non-alphanumerics */ data = URLEncoder.encode(data, "UTF-16"); response.setHeader("Location", "/author.jsp?lang=" + data); } } /* goodG2B2() - use goodsource and badsink by reversing statements in first if */ private void goodG2B2(HttpServletRequest request, HttpServletResponse response) throws Throwable { String data; /* INCIDENTAL: CWE 571 Statement is Always True */ if(private_five==5) { java.util.logging.Logger log_good = java.util.logging.Logger.getLogger("local-logger"); /* FIX: Use a hardcoded string */ data = "foo"; } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ Logger log_bad = Logger.getLogger("local-logger"); data = ""; /* init data */ URLConnection conn = (new URL("http://www.example.org/")).openConnection(); BufferedReader buffread = null; InputStreamReader instrread = null; try { /* read input from URLConnection */ instrread = new InputStreamReader(conn.getInputStream()); buffread = new BufferedReader(instrread); data = buffread.readLine(); // This will be reading the first "line" of the response body, // which could be very long if there are no newlines in the HTML } catch( IOException ioe ) { log_bad.warning("Error with stream reading"); } finally { /* clean up stream reading objects */ try { if( buffread != null ) { buffread.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing buffread"); } finally { try { if( instrread != null ) { instrread.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing instrread"); } } } } /* INCIDENTAL: CWE 571 Statement is Always True */ if(private_five==5) { /* POTENTIAL FLAW: Input not verified before inclusion in header */ response.setHeader("Location", "/author.jsp?lang=" + data); } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ /* FIX: use URLEncoder.encode to hex-encode non-alphanumerics */ data = URLEncoder.encode(data, "UTF-16"); response.setHeader("Location", "/author.jsp?lang=" + data); } } /* goodB2G1() - use badsource and goodsink by changing second private_five==5 to private_five!=5 */ private void goodB2G1(HttpServletRequest request, HttpServletResponse response) throws Throwable { String data; /* INCIDENTAL: CWE 571 Statement is Always True */ if(private_five==5) { Logger log_bad = Logger.getLogger("local-logger"); data = ""; /* init data */ URLConnection conn = (new URL("http://www.example.org/")).openConnection(); BufferedReader buffread = null; InputStreamReader instrread = null; try { /* read input from URLConnection */ instrread = new InputStreamReader(conn.getInputStream()); buffread = new BufferedReader(instrread); data = buffread.readLine(); // This will be reading the first "line" of the response body, // which could be very long if there are no newlines in the HTML } catch( IOException ioe ) { log_bad.warning("Error with stream reading"); } finally { /* clean up stream reading objects */ try { if( buffread != null ) { buffread.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing buffread"); } finally { try { if( instrread != null ) { instrread.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing instrread"); } } } } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ java.util.logging.Logger log_good = java.util.logging.Logger.getLogger("local-logger"); /* FIX: Use a hardcoded string */ data = "foo"; } /* INCIDENTAL: CWE 570 Statement is Always False */ if(private_five!=5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ /* POTENTIAL FLAW: Input not verified before inclusion in header */ response.setHeader("Location", "/author.jsp?lang=" + data); } else { /* FIX: use URLEncoder.encode to hex-encode non-alphanumerics */ data = URLEncoder.encode(data, "UTF-16"); response.setHeader("Location", "/author.jsp?lang=" + data); } } /* goodB2G2() - use badsource and goodsink by reversing statements in second if */ private void goodB2G2(HttpServletRequest request, HttpServletResponse response) throws Throwable { String data; /* INCIDENTAL: CWE 571 Statement is Always True */ if(private_five==5) { Logger log_bad = Logger.getLogger("local-logger"); data = ""; /* init data */ URLConnection conn = (new URL("http://www.example.org/")).openConnection(); BufferedReader buffread = null; InputStreamReader instrread = null; try { /* read input from URLConnection */ instrread = new InputStreamReader(conn.getInputStream()); buffread = new BufferedReader(instrread); data = buffread.readLine(); // This will be reading the first "line" of the response body, // which could be very long if there are no newlines in the HTML } catch( IOException ioe ) { log_bad.warning("Error with stream reading"); } finally { /* clean up stream reading objects */ try { if( buffread != null ) { buffread.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing buffread"); } finally { try { if( instrread != null ) { instrread.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing instrread"); } } } } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ java.util.logging.Logger log_good = java.util.logging.Logger.getLogger("local-logger"); /* FIX: Use a hardcoded string */ data = "foo"; } /* INCIDENTAL: CWE 571 Statement is Always True */ if(private_five==5) { /* FIX: use URLEncoder.encode to hex-encode non-alphanumerics */ data = URLEncoder.encode(data, "UTF-16"); response.setHeader("Location", "/author.jsp?lang=" + data); } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ /* POTENTIAL FLAW: Input not verified before inclusion in header */ response.setHeader("Location", "/author.jsp?lang=" + data); } } public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable { goodG2B1(request, response); goodG2B2(request, response); goodB2G1(request, response); goodB2G2(request, response); } /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
c751490b6edae859d7116c18c1d0490672524417
caa2efc6c09b2a69943b173dec19952a213fd7ae
/odin-core/src/main/java/com/purplepip/odin/creation/flow/DefaultFlow.java
6f0c795738e34735e6db7aa40f5d0ea2887853ca
[ "MIT", "Apache-2.0" ]
permissive
ianhomer/odin
83963bf214442f696782c96222b432f40cefa15c
ac3e4a5ddbe5c441fc9fb22fa5f06a996ec1454c
refs/heads/main
2021-10-19T22:27:29.709053
2020-11-15T17:37:40
2020-11-15T17:37:40
79,387,599
6
0
NOASSERTION
2021-10-05T21:04:08
2017-01-18T21:44:23
Java
UTF-8
Java
false
false
2,672
java
/* * Copyright (c) 2017 the original author or authors. All Rights Reserved * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.purplepip.odin.creation.flow; import com.purplepip.odin.clock.Clock; import com.purplepip.odin.clock.Loop; import com.purplepip.odin.clock.MeasureContext; import com.purplepip.odin.clock.measure.MeasureProvider; import com.purplepip.odin.clock.tick.Tock; import com.purplepip.odin.creation.sequence.Sequence; import com.purplepip.odin.events.Event; import com.purplepip.odin.events.ScanForwardEvent; import lombok.extern.slf4j.Slf4j; /** * Default flow implementation. */ @Slf4j public class DefaultFlow<S extends Sequence> implements MutableFlow<S> { private S sequence; private final MeasureContext context; /** * Create flow. * * @param clock clock * @param measureProvider measure provider */ public DefaultFlow(Clock clock, MeasureProvider measureProvider) { this.context = new MeasureContext(clock, measureProvider); } @Override public void setSequence(S sequence) { this.sequence = sequence; } @Override public S getSequence() { return sequence; } @Override public MeasureContext getContext() { return context; } @Override public Event getNextEvent(Tock tock) { /* * Create local and temporary mutable tock for this function execution. */ Loop loop = new Loop(sequence.getLoopLength(), tock.getPosition()); int i = 0; long maxScanForward = context.getClock().getMaxLookForward().floor(); Event event = null; while (event == null && i < maxScanForward) { event = sequence.getNextEvent(context, loop); if (event == null) { LOG.trace("{} : No event found at tock {}, incrementing loop", sequence.getName(), loop); loop.increment(); i++; } } if (event == null) { LOG.trace("No notes found in the next {} ticks after tock {} for sequence {}", maxScanForward, tock, getSequence()); event = new ScanForwardEvent(loop.getPosition().getLimit()); } return event; } @Override public void initialise() { sequence.initialise(); } }
a9b8020599a8a65d91ba4f6fc0c33a2f79c35f5b
29a25e7ae2be4b84e56c55a8ae32ee745ec7f107
/jPDFmelange/JPanelViewPrefs.java
09a48d315a796b03afb2ea45de41b89335c7b0f6
[]
no_license
dertoki/jPDFmelange
83a637bed9ae597ed9a7e7e5ecef227a06abe293
ab29e34dfe538b7472801aac2cc494c7be38f112
refs/heads/master
2021-01-01T05:50:38.878341
2014-03-09T18:17:55
2014-03-09T18:17:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,197
java
/*************************************************************************** * Copyright (C) 2008 by Tobias Tandetzki * * [email protected] * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ package jPDFmelange; import javax.swing.BorderFactory; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JPanel; import javax.swing.JTextPane; import javax.swing.border.EtchedBorder; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.Rectangle; import java.util.ResourceBundle; public class JPanelViewPrefs extends JPanel { /** * A panel with PDF preferences used in MelangeJFrame and MelangePreferencesDialog. * * @author tobias tandetzki 12.07.2009 */ private static final long serialVersionUID = 1L; private ResourceBundle messages = null; public JTextPane jTextPanePageLayout = null; public JTextPane jTextPanePageMode = null; public JComboBox jComboBoxPageLayout = null; public JComboBox jComboBoxPageMode = null; public JCheckBox jCheckBoxHideToolbar = null; public JCheckBox jCheckBoxHideMenubar = null; public JCheckBox jCheckBoxHideWindowUI = null; public JCheckBox jCheckBoxFitWindow = null; public JCheckBox jCheckBoxCenterWindow = null; public JCheckBox jCheckBoxDisplayDocTitle = null; /** * This method initializes * */ public JPanelViewPrefs() { super(); initialize(); set(); } /** * This method set the values of elements * */ public void set() { for (String element: MelangeJFrame.PageLayout.keySet()){ jComboBoxPageLayout.addItem(getMessages().getString(element)); } String pref = getMessages().getString(MelangeJFrame.prefPageLayout); jComboBoxPageLayout.setSelectedItem((Object)pref); for (String element: MelangeJFrame.PageMode.keySet()){ jComboBoxPageMode.addItem(getMessages().getString(element)); } pref = getMessages().getString(MelangeJFrame.prefPageMode); jComboBoxPageMode.setSelectedItem((Object)pref); } /** * This method returns the PageMode as non locale * * @return String */ public String getKeyPageMode(){ String localkey = (String) jComboBoxPageMode.getSelectedItem(); for (String key: MelangeJFrame.PageMode.keySet()) if (getMessages().getString(key).equals(localkey)){ return key; } return null; } /** * This method returns the PageLayout as non locale * * @return String */ public String getKeyPageLayout(){ String localkey = (String) jComboBoxPageLayout.getSelectedItem(); for (String key: MelangeJFrame.PageLayout.keySet()) if (getMessages().getString(key).equals(localkey)){ return key; } return null; } /** * This method initializes this * */ private void initialize() { this.setLayout(null); this.setBounds(new Rectangle(10, 170, 361, 261)); this.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); this.add(getJTextPanePageMode(), null); this.add(getJTextPanePageLayout(), null); this.add(getJComboBoxPageLayout(), null); this.add(getJComboBoxPageMode(), null); this.add(getJCheckBoxHideToolbar(), null); this.add(getJCheckBoxHideMenubar(), null); this.add(getJCheckBoxHideWindowUI(), null); this.add(getJCheckBoxFitWindow(), null); this.add(getJCheckBoxCenterWindow(), null); this.add(getJCheckBoxDisplayDocTitle(), null); } /** * This method initializes jTextPanePageLayout * * @return javax.swing.JTextPane */ private JTextPane getJTextPanePageLayout() { if (jTextPanePageLayout == null) { String string = getMessages().getString("PageLayout"); jTextPanePageLayout = new JTextPane(); jTextPanePageLayout.setBounds(new Rectangle(10, 40, 101, 21)); jTextPanePageLayout.setForeground(Color.GRAY); jTextPanePageLayout.setPreferredSize(new Dimension(70, 21)); jTextPanePageLayout.setEditable(false); jTextPanePageLayout.setBackground(new Color(238, 238, 238)); jTextPanePageLayout.setText(string); } return jTextPanePageLayout; } /** * This method initializes jTextPanePageMode * * @return javax.swing.JTextPane */ private JTextPane getJTextPanePageMode() { if (jTextPanePageMode == null) { jTextPanePageMode = new JTextPane(); jTextPanePageMode.setBounds(new Rectangle(10, 10, 101, 21)); jTextPanePageMode.setForeground(Color.GRAY); jTextPanePageMode.setText(getMessages().getString("PageMode")); jTextPanePageMode.setBackground(new Color(238, 238, 238)); jTextPanePageMode.setEditable(false); } return jTextPanePageMode; } /** * This method initializes jComboBoxPageLayout * * @return javax.swing.JComboBox */ private JComboBox getJComboBoxPageLayout() { if (jComboBoxPageLayout == null) { jComboBoxPageLayout = new JComboBox(); jComboBoxPageLayout.setBounds(new Rectangle(120, 40, 231, 24)); jComboBoxPageLayout.setBackground(Color.white); jComboBoxPageLayout.setEnabled(false); } return jComboBoxPageLayout; } /** * This method initializes jComboBoxPageMode * * @return javax.swing.JComboBox */ private JComboBox getJComboBoxPageMode() { if (jComboBoxPageMode == null) { jComboBoxPageMode = new JComboBox(); jComboBoxPageMode.setBounds(new Rectangle(120, 10, 231, 24)); jComboBoxPageMode.setBackground(Color.white); jComboBoxPageMode.setSelectedItem(getMessages().getString(MelangeJFrame.prefPageMode)); jComboBoxPageMode.setEnabled(false); } return jComboBoxPageMode; } /** * This method initializes jCheckBoxHideToolbar * * @return javax.swing.JCheckBox */ private JCheckBox getJCheckBoxHideToolbar() { if (jCheckBoxHideToolbar == null) { jCheckBoxHideToolbar = new JCheckBox(); jCheckBoxHideToolbar.setBounds(new Rectangle(10, 80, 341, 21)); jCheckBoxHideToolbar.setFont(new Font("Dialog", Font.PLAIN, 12)); jCheckBoxHideToolbar.setText(getMessages().getString("Page_HIDETOOLBAR")); jCheckBoxHideToolbar.setEnabled(false); jCheckBoxHideToolbar.setSelected(MelangeJFrame.prefHideToolbar); } return jCheckBoxHideToolbar; } /** * This method initializes jCheckBoxHideMenubar * * @return javax.swing.JCheckBox */ private JCheckBox getJCheckBoxHideMenubar() { if (jCheckBoxHideMenubar == null) { jCheckBoxHideMenubar = new JCheckBox(); jCheckBoxHideMenubar.setBounds(new Rectangle(10, 110, 341, 21)); jCheckBoxHideMenubar.setFont(new Font("Dialog", Font.PLAIN, 12)); jCheckBoxHideMenubar.setText(getMessages().getString("Page_HIDEMENUBAR")); jCheckBoxHideMenubar.setEnabled(false); jCheckBoxHideMenubar.setSelected(MelangeJFrame.prefHideMenubar); } return jCheckBoxHideMenubar; } /** * This method initializes jCheckBoxHideWindowUI * * @return javax.swing.JCheckBox */ private JCheckBox getJCheckBoxHideWindowUI() { if (jCheckBoxHideWindowUI == null) { jCheckBoxHideWindowUI = new JCheckBox(); jCheckBoxHideWindowUI.setBounds(new Rectangle(10, 140, 341, 21)); jCheckBoxHideWindowUI.setFont(new Font("Dialog", Font.PLAIN, 12)); jCheckBoxHideWindowUI.setText(getMessages().getString("Page_HIDEWINDOWUI")); jCheckBoxHideWindowUI.setEnabled(false); jCheckBoxHideWindowUI.setSelected(MelangeJFrame.prefHideWindowUI); } return jCheckBoxHideWindowUI; } /** * This method initializes jCheckBoxFitWindow * * @return javax.swing.JCheckBox */ private JCheckBox getJCheckBoxFitWindow() { if (jCheckBoxFitWindow == null) { jCheckBoxFitWindow = new JCheckBox(); jCheckBoxFitWindow.setBounds(new Rectangle(10, 170, 341, 21)); jCheckBoxFitWindow.setFont(new Font("Dialog", Font.PLAIN, 12)); jCheckBoxFitWindow.setText(getMessages().getString("Page_FITWINDOW")); jCheckBoxFitWindow.setEnabled(false); jCheckBoxFitWindow.setSelected(MelangeJFrame.prefFitWindow); } return jCheckBoxFitWindow; } /** * This method initializes jCheckBoxCenterWindow * * @return javax.swing.JCheckBox */ private JCheckBox getJCheckBoxCenterWindow() { if (jCheckBoxCenterWindow == null) { jCheckBoxCenterWindow = new JCheckBox(); jCheckBoxCenterWindow.setBounds(new Rectangle(10, 200, 341, 21)); jCheckBoxCenterWindow.setFont(new Font("Dialog", Font.PLAIN, 12)); jCheckBoxCenterWindow.setText(getMessages().getString("Page_CENTERWINDOW")); jCheckBoxCenterWindow.setEnabled(false); jCheckBoxCenterWindow.setSelected(MelangeJFrame.prefCenterWindow); } return jCheckBoxCenterWindow; } /** * This method initializes jCheckBoxDisplayDocTitle * * @return javax.swing.JCheckBox */ private JCheckBox getJCheckBoxDisplayDocTitle() { if (jCheckBoxDisplayDocTitle == null) { jCheckBoxDisplayDocTitle = new JCheckBox(); jCheckBoxDisplayDocTitle.setBounds(new Rectangle(10, 230, 341, 21)); jCheckBoxDisplayDocTitle.setFont(new Font("Dialog", Font.PLAIN, 12)); jCheckBoxDisplayDocTitle.setEnabled(false); jCheckBoxDisplayDocTitle.setSelected(MelangeJFrame.prefDisplayDocTitle); jCheckBoxDisplayDocTitle.setText(getMessages().getString("Page_DISPLAYDOCTITLE")); jCheckBoxDisplayDocTitle.setVisible(false); } return jCheckBoxDisplayDocTitle; } /** * This method initializes messages * * @return java.util.PropertyResourceBundle */ private ResourceBundle getMessages() { if (messages == null) { messages = ResourceBundle.getBundle("resources/MelangeMessages", MelangeJFrame.locale); } return messages; } /** * This method initializes jCheckBoxEnablePDFViewerPrefs * * @return void */ public void setEnablePDFViewerPrefs(boolean isenabled) { if (isenabled){ for (int i=0; i<this.getComponentCount();i++){ this.getComponent(i).setEnabled(true); this.getComponent(i).setForeground(Color.BLACK); }; } else { for (int i=0; i<this.getComponentCount();i++){ this.getComponent(i).setEnabled(false); this.getComponent(i).setForeground(Color.GRAY); } } } } // @jve:decl-index=0:visual-constraint="10,10"
[ "dertoki" ]
dertoki
ff1f227a39f0f8b27607870de3e2dd27617c9a0d
eb6a8d1f92b8620de8a5bdd8223a6fdd4560066e
/cli/src/main/java/com/github/microwww/security/cli/help/Nullable.java
a4b13c16b0acf6e065b99bdeab9b453330455f2f
[ "Apache-2.0" ]
permissive
microwww/URL-security
3f94482c77ce242415229645f7125d4924e81c15
c1587d817769a047211a2a2405ef130a6a5c1cfe
refs/heads/main
2023-01-31T11:48:10.106472
2020-12-16T03:18:36
2020-12-16T03:18:36
310,476,616
0
0
null
null
null
null
UTF-8
Java
false
false
79
java
package com.github.microwww.security.cli.help; public @interface Nullable { }
60f6c1d8e44802703b0f8b339541e7cc62cc843e
ee16d6fce032df72e16dc2078396c10a83af1a3e
/ELF16/src/main/java/vtigerTestScripts/TC_12Test.java
dbd88279899e0d9cee32d5f3a19a637d9713792c
[]
no_license
Abhishek-M-97/Testing
4c68618e3498d1ea3a52bea855def8db1704bbed
223eac45144dbb8f08f8637af4bb5a601f756566
refs/heads/master
2023-07-13T02:14:00.183038
2021-09-02T10:10:59
2021-09-02T10:10:59
364,866,254
0
0
null
null
null
null
UTF-8
Java
false
false
2,487
java
package vtigerTestScripts; import genericLibrary.*; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.Select; import org.testng.Assert; import org.testng.Reporter; import org.testng.annotations.Listeners; import org.testng.annotations.Test; import pomRepository.*; /*** * * @author Abhishek * */ @Listeners(ITestListnerUtil.class) public class TC_12Test extends BaseClass { @Test public void createContactTC_12() throws InterruptedException { HomePage homePage= new HomePage(driver); CreatingNewContact newContact= new CreatingNewContact(driver); ContactsPage contacts= new ContactsPage(driver); String expectedHomePageTitle="Administrator - Home - vtiger CRM 5 - Commercial Open Source CRM"; String homePageTitle = driver.getTitle(); Assert.assertEquals(homePageTitle,expectedHomePageTitle,"Homepage is not displayed"); Reporter.log("HomePage is displayed",true); //Step 3:Contact List page should be display homePage.getContacts().click(); String expectedContactsPageTitle="Administrator - Contacts - vtiger CRM 5 - Commercial Open Source CRM"; String contactsPageTitle = driver.getTitle(); Assert.assertEquals(contactsPageTitle,expectedContactsPageTitle,"Contacts is not displayed"); Reporter.log("ContatctPage is displayed",true); //Step 4:Creating New Contact button should be display contacts.getCreatebtn().click(); String expectedNewContactPageTitle="Administrator - Contacts - vtiger CRM 5 - Commercial Open Source CRM"; String newContactPageTitle=driver.getTitle(); Assert.assertEquals(expectedNewContactPageTitle,newContactPageTitle,"Creating New Contact Page is not displayed"); Reporter.log("Creating New Contact Page is displayed",true); //Step 5:Contact should be created with message Contact Information Updated today newContact.getLastName().sendKeys("demo"); newContact.getGroupRadiobtn().click(); WebElement groupListBox = newContact.getGroupListBox(); Select select=new Select(groupListBox); Thread.sleep(2000); select.selectByVisibleText("Team Selling"); Thread.sleep(2000); newContact.getSave().click(); String expectedContactInfoPageTitle="Administrator - Contacts - vtiger CRM 5 - Commercial Open Source CRM"; String contactInfoPageTitle=driver.getTitle(); Assert.assertEquals(contactInfoPageTitle, expectedContactInfoPageTitle,"Contact Update Information Page is not displayed"); Reporter.log("Contatct Information Updated Page is displayed",true); } }
[ "Abhishek@ABHISHEK" ]
Abhishek@ABHISHEK
dc26462833a9781094f0a2b5ab5b960b72e85788
93b52ef4c7ce3d90ee881346f7340971142b4bba
/Lesson8/src/MemoryDataService.java
37affe61fa641ddda622244028a7192683581434
[]
no_license
KarinaZelenkevich/Lesson8
68b6f39da33dbc053467e9121803c4d803f397cf
638179cf907f270803bde3e49d3fd101d1441f3c
refs/heads/master
2023-08-14T18:43:57.738201
2021-10-08T10:30:30
2021-10-08T10:30:30
414,942,991
0
0
null
null
null
null
UTF-8
Java
false
false
542
java
import java.util.ArrayList; import java.util.List; public class MemoryDataService implements DataService{ private List<String> list = new ArrayList<>(); @Override public void add(String text) throws LowMemory { if (list.size()>4) { throw new LowMemory(); } else { list.add(text); } } @Override public String get() throws EmptyMemory { if (list.size() < 1) { throw new EmptyMemory(); } else { return list.remove(1); } } }
184d191b91a65aeb8e2b6c012d62e30eda607c40
9af5abe79a9d2d38b2d6d34c4d821a07935e3339
/src/main/java/com/phonemetra/turbo/binary/BinaryNameMapper.java
0923caa525bc9db34ac32b4a1ecbc9103c4ee11c
[ "Apache-2.0" ]
permissive
Global-localhost/TurboSQL
a66b70a8fdb4cd67642dda0dad132986f2b9165c
10dd81a36a0e25b1f786e366eb3ed9af0e5e325b
refs/heads/master
2022-12-17T05:48:16.652086
2019-04-16T23:02:00
2019-04-16T23:02:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,631
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.phonemetra.turbo.binary; import com.phonemetra.turbo.configuration.BinaryConfiguration; /** * Maps type and field names to different names. Prepares class/type names * and field names before pass them to {@link BinaryIdMapper}. * <p> * Binary name mapper can be configured for all binary objects via * {@link BinaryConfiguration#getNameMapper()} method, * or for a specific binary type via {@link BinaryTypeConfiguration#getNameMapper()} method. * @see BinaryIdMapper */ public interface BinaryNameMapper { /** * Gets type clsName. * * @param clsName Class came * @return Type name. */ String typeName(String clsName); /** * Gets field name. * * @param fieldName Field name. * @return Field name. */ String fieldName(String fieldName); }
3264804fb1be87b577be11b4b0ee869929d9d243
2d24ff8a02feafb160c3665042aecd3154da0b14
/Ex_203_Kniffel/src/BL/DiceTableModel.java
6b8303f6c1d790b75bafcb5e88b4bdf0ab551076
[]
no_license
hanslissi/17_Exercise_203_AdvancedKniffel
ca20b0f1d992f38aa7c04ccecfd5a15b502a6360
a3e23361677d044313db07a08bc7de9c6ca6ec2c
refs/heads/master
2020-04-04T20:51:23.837694
2018-11-05T18:41:11
2018-11-05T18:41:11
156,263,412
0
0
null
null
null
null
UTF-8
Java
false
false
1,571
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 BL; import java.util.ArrayList; import java.util.Random; import javax.swing.ImageIcon; import javax.swing.table.AbstractTableModel; /** * * @author johannesriedmueller */ public class DiceTableModel extends AbstractTableModel { private int[] diceNumbers = {1, 2, 3, 4, 5}; public void scramble(int[] numsNotToScramble) { Random r = new Random(); int notScrambleCounter = 0; for (int i = 0; i < diceNumbers.length; i++) { if (!(i == numsNotToScramble[notScrambleCounter])) { diceNumbers[i] = 1 + r.nextInt(5); } else if (notScrambleCounter != numsNotToScramble.length - 1) { notScrambleCounter++; } } fireTableRowsUpdated(0, diceNumbers.length - 1); } public void scramble() { Random r = new Random(); for (int i = 0; i < diceNumbers.length; i++) { diceNumbers[i] = 1 + r.nextInt(6); } fireTableRowsUpdated(0, diceNumbers.length - 1); } @Override public int getRowCount() { return 1; } @Override public int getColumnCount() { return diceNumbers.length; } @Override public Object getValueAt(int rowIndex, int columnIndex) { return diceNumbers[columnIndex]; } public int[] getDiceNumbers() { return diceNumbers; } }
b893ea935815baa5f15f524aea136dd63e33cc13
ca7da6499e839c5d12eb475abe019370d5dd557d
/spring-context-indexer/src/test/java/org/springframework/context/index/sample/type/SpecializedRepo.java
a28f9485122d2266928e353b02fa1161978e5612
[ "Apache-2.0" ]
permissive
yangfancoming/spring-5.1.x
19d423f96627636a01222ba747f951a0de83c7cd
db4c2cbcaf8ba58f43463eff865d46bdbd742064
refs/heads/master
2021-12-28T16:21:26.101946
2021-12-22T08:55:13
2021-12-22T08:55:13
194,103,586
0
1
null
null
null
null
UTF-8
Java
false
false
122
java
package org.springframework.context.index.sample.type; public interface SpecializedRepo<T> extends Repo<T, Long> { }
0e9aced758bb65938359fa5e4b655d3965e64719
e07bb764864d7f618a245b242489e5f55acd879a
/code/tdt-base-support/tdt-sys/src/main/java/com/tdt/sys/core/attribute/AttributeSetInteceptor.java
cd08f83d74cb8f14cbe5423713d32283de43beb5
[]
no_license
gechangjiang/wms
b61e7aed8a983a6bfbf4044289d8cf2dd67561d1
45d9ba6f6c0ca6d3ebee617a625199073b29b345
refs/heads/main
2023-07-03T21:21:21.464250
2021-08-09T08:53:14
2021-08-09T08:53:14
393,873,738
0
0
null
null
null
null
UTF-8
Java
false
false
2,107
java
/** * Copyright 2018-2020 thedreamtree (https://gitee.com/thedreamtree) * <p> * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.tdt.sys.core.attribute; import com.tdt.base.shiro.ShiroUser; import com.tdt.sys.core.shiro.ShiroKit; import com.tdt.sys.core.util.DefaultImages; import org.apache.shiro.authc.AuthenticationException; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * 自动渲染当前用户信息登录属性 的过滤器 * * @author gcj * @Date 2018/10/30 4:30 PM */ public class AttributeSetInteceptor extends HandlerInterceptorAdapter { @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { //没有视图的直接跳过过滤器 if (modelAndView == null || modelAndView.getViewName() == null) { return; } //视图结尾不是html的直接跳过 if (!modelAndView.getViewName().endsWith("html")) { return; } ShiroUser user = ShiroKit.getUser(); if (user == null) { throw new AuthenticationException("当前没有登录账号!"); } else { modelAndView.addObject("name", user.getName()); modelAndView.addObject("avatar", DefaultImages.defaultAvatarUrl()); modelAndView.addObject("email", user.getEmail()); } } }
49161a195ea4a7044a299256b9fc1c9680410d71
95bbe09da876e356c9376fe979ef7a9bf90822df
/src/main/java/org/citygml4j/ade/energy/model/core/FloorAreaProperty.java
1fb751ceff3a93b6601be110562b99c3a8a058d4
[ "Apache-2.0" ]
permissive
citygml4j/energy-ade-citygml4j
ef954ab104a690c0169d3ca10b65301e871cdcde
663f32cdcdc579b95ff6d6427a728c61f9b30e47
refs/heads/master
2022-08-29T17:07:51.335493
2022-08-25T11:56:24
2022-08-25T11:56:24
157,459,176
9
1
null
null
null
null
UTF-8
Java
false
false
2,035
java
/* * energy-ade-citygml4j - Energy ADE module for citygml4j * https://github.com/citygml4j/energy-ade-citygml4j * * energy-ade-citygml4j is part of the citygml4j project * * Copyright 2019-2021 Claus Nagel <[email protected]> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.citygml4j.ade.energy.model.core; import org.citygml4j.builder.copy.CopyBuilder; import org.citygml4j.model.citygml.ade.binding.ADEModelObject; import org.citygml4j.model.gml.base.AssociationByRep; public class FloorAreaProperty extends AssociationByRep<FloorArea> implements ADEModelObject { public FloorAreaProperty() { } public FloorAreaProperty(FloorArea floorArea) { super(floorArea); } public FloorArea getFloorArea() { return super.getObject(); } public boolean isSetFloorArea() { return super.isSetObject(); } public void setFloorArea(FloorArea floorArea) { super.setObject(floorArea); } public void unsetFloorArea() { super.unsetObject(); } @Override public Class<FloorArea> getAssociableClass() { return FloorArea.class; } @Override public Object copy(CopyBuilder copyBuilder) { return copyTo(new FloorAreaProperty(), copyBuilder); } @Override public Object copyTo(Object target, CopyBuilder copyBuilder) { FloorAreaProperty copy = (target == null) ? new FloorAreaProperty() : (FloorAreaProperty)target; return super.copyTo(copy, copyBuilder); } }
128f880660bcd92d21fe8fe427302b1a04ab02f0
e9376e9d9da01844014a9785808e24e292cdd9e7
/app/src/main/java/app/com/esenatenigeria/model/BillsModel.java
177a048e41bff65110dcf21d687c4d054ff1b701
[]
no_license
sh7verma/nass_
6f16264e3fa6e74d4c744d31b791c893b3f26b5b
56b7a6af0786edcfa682369b04ad919e828c7950
refs/heads/master
2020-05-09T20:42:26.389838
2018-09-28T11:47:49
2018-09-28T11:47:49
181,417,480
0
0
null
null
null
null
UTF-8
Java
false
false
5,100
java
package app.com.esenatenigeria.model; import android.arch.persistence.room.ColumnInfo; import android.arch.persistence.room.Entity; import android.arch.persistence.room.Index; import android.arch.persistence.room.PrimaryKey; import android.support.annotation.NonNull; import java.util.List; import app.com.esenatenigeria.utils.Encode; /** * Created by dev on 26/4/18. */ public class BillsModel { static private Encode encode = new Encode(); private int statusCode; private String message; private DataBeanX data; public int getStatusCode() { return statusCode; } public void setStatusCode(int statusCode) { this.statusCode = statusCode; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public DataBeanX getDataX() { return data; } public void setDataX(DataBeanX data) { this.data = data; } public static class DataBeanX { private int count; private List<DataBean> data; public int getCount() { return count; } public void setCount(int count) { this.count = count; } public List<DataBean> getData() { return data; } public void setData(List<DataBean> data) { this.data = data; } } @Entity(tableName = "BillsDataBean", indices = {@Index(value = {"doc_id"}, unique = true)}) public static class DataBean { /** * doc_id : 5addad53f58204746f80c03b * category : SbA06tQMWcg8GR7Yh+RiTA== * chamber : 9ZjqcZ0HS8yvraRMyThHOg== * date : 2017-11-17T00:00:00.000Z * session : null * parliament : null * docURL : FsGrVtqTOKTEYoXievB4tXOxnCLdz4FUZgiai04uKMw+85uiktr7MBH+qVqRleNW * name : FIaYb7vVjo7AYDjQ7oQOExH67DmTeWe5VLRj6gG1vQjYTBOiLdrwAlwwjNHudKM+xe9eEYnuJkWKlCAJru5T2Q== * __v : 0 */ @PrimaryKey @ColumnInfo(name = "doc_id") @NonNull private String doc_id; @ColumnInfo(name = "bill_category") private String category; @ColumnInfo(name = "bill_chamber") private String chamber; @ColumnInfo(name = "bill_date") private String date; @ColumnInfo(name = "bill_summary") private String summary; @ColumnInfo(name = "bills_source") private String source; @ColumnInfo(name = "bill_session") private String session; @ColumnInfo(name = "bill_parliament") private String parliament; @ColumnInfo(name = "bill_docURL") private String docURL; @ColumnInfo(name = "bill_docLocalPath") private String docLocalPath; @ColumnInfo(name = "bill_name") private String name; @ColumnInfo(name = "bill_codeUpdatedAt") private String codeUpdatedAt; public String getCodeUpdatedAt() { return codeUpdatedAt; } public void setCodeUpdatedAt(String codeUpdatedAt) { this.codeUpdatedAt = codeUpdatedAt; } public String getSummary() { return summary; } public void setSummary(String summary) { this.summary = summary; } public String getSource() { return source; } public void setSource(String source) { this.source = source; } public String getDocLocalPath() { return docLocalPath; } public void setDocLocalPath(String docLocalPath) { this.docLocalPath = docLocalPath; } public String getDoc_id() { return doc_id; } public void setDoc_id(String doc_id) { this.doc_id = doc_id; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public String getChamber() { return chamber; } public void setChamber(String chamber) { this.chamber = chamber; } public String getDate() { return date; } public void setDate(String date) { this.date = date; } public String getSession() { return session; } public void setSession(String session) { this.session = session; } public String getParliament() { return parliament; } public void setParliament(String parliament) { this.parliament = parliament; } public String getDocURL() { return docURL; } public void setDocURL(String docURL) { this.docURL = docURL; } public String getName() { return name; } public void setName(String name) { this.name = name; } } }
5d18e08ad89ac5548cbb97021b3ddc784b90595b
8994b05deec0adf97da101bc8ddcd361865f00fb
/src/edit/GeneralTableModel.java
b4dc96fd8cfa52b38359bac086860f8ee57176c1
[]
no_license
JaroslawHryszko/MISTA
ed9bc3f4c46d1bf612348a6b449c6e5f3024a64c
087d399538e4f5f2a54fd1a3561c2929a359aa92
refs/heads/master
2022-07-01T16:52:01.783312
2022-05-28T12:29:40
2022-05-28T12:29:40
365,211,048
0
0
null
null
null
null
UTF-8
Java
false
false
5,816
java
/* Author Dianxiang Xu */ package edit; import java.awt.Dimension; import java.util.*; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.UIManager; import javax.swing.table.AbstractTableModel; import javax.swing.table.DefaultTableCellRenderer; import locales.LocaleBundle; public class GeneralTableModel extends AbstractTableModel { private static final long serialVersionUID = 1L; protected String[] columnNames; protected Vector<Vector<Object>> data; protected boolean editable; private int totalColumnCount; private int visibleColumnCount; public GeneralTableModel(Vector<Vector<Object>> data, String[] columnNames, int totalColumnCount, boolean editable){ this.data = data; this.columnNames = new String[columnNames.length]; for (int i=0; i<columnNames.length; i++) this.columnNames[i] = LocaleBundle.bundleString(columnNames[i]); this.totalColumnCount = totalColumnCount; this.editable = editable; visibleColumnCount = columnNames.length; } public void setMinimumRows(int rows){ int index = data.size(); while (index++<rows){ addRow(); } } public Vector<Vector<Object>> getData(){ return data; } public String getColumnName(int column) { return columnNames[column]; } public void setColumnName(int column, String name) { columnNames[column] = name; } @SuppressWarnings({ "unchecked", "rawtypes" }) public Class getColumnClass(int columnIndex) { // if (columnIndex==0) // return Integer.class; return String.class; } public boolean isCellEditable(int row, int column) { return column!=0 && editable; } public Object getValueAt(int row, int column) { Vector<Object> rowVector = data.get(row); return rowVector.get(column); } public void setValueAt(Object value, int row, int column) { Vector<Object> rowVector = data.get(row); rowVector.set(column, value); fireTableCellUpdated(row, column); } public boolean isEmptyRow(int row) { Vector<Object> rowData = data.get(row); // 0 index is the number for (int index=1; index<rowData.size(); index++){ Object cell = rowData.get(index); // if (cell!=null && cell instanceof String && !((String)cell).trim().equals("")) // return false; if (cell!=null && !cell.toString().trim().equals("")) return false; } return true; } public boolean isEmptyTable(){ for (int row=0; row<data.size(); row++) if (!isEmptyRow(row)) return false; return true; } public boolean hasEnoughEmptyRowsAtBottom(){ int MAX=30; if (data.size()<MAX) return false; int numberOfEmptyRows=0; for (int row=data.size()-1; row>=0 && numberOfEmptyRows<MAX; row--){ if (isEmptyRow(row)) numberOfEmptyRows++; else break; } return numberOfEmptyRows>=MAX; } public int getRowCount() { return data.size(); } public int getColumnCount() { return columnNames.length; } public int getVisibleColumnCount(){ return visibleColumnCount; } public void removeRow(int index){ data.remove(index); updateNumbers(index); fireTableRowsDeleted(index, index); } public void addRow() { Vector<Object> newRow = new Vector<Object>(); newRow.add(""+(data.size()+1)); for (int column =1; column<totalColumnCount; column++) newRow.add(null); data.add(newRow); fireTableRowsInserted(data.size()-1, data.size()-1); } public void insertRow(int index) { Vector<Object> newRow = new Vector<Object>(); newRow.add(""+index); for (int column =1; column<totalColumnCount; column++) newRow.add(null); data.insertElementAt(newRow, index); updateNumbers(index); fireTableRowsInserted(index, index); } public String rowString(int index){ String result = ""; Vector<Object> vector = data.get(index); for (Object object: vector) if (object!=null) result +=" "+object.toString(); return result; } private void updateNumbers(int start){ int index = start; while (index<data.size()){ Vector<Object> row = data.get(index); row.set(0, ""+(index+1)); index++; } } public String toString(){ String result = ""; for (int i=0; i<data.size(); i++){ result+= rowString(i); } return result; } public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { } Vector<Object> v1 = new Vector<Object>(); v1.add("1"); v1.add("picpup(x)"); v1.add("handempty"); v1.add("ontable"); v1.add("when"); v1.add("effect"); v1.add("inscription"); Vector<Object> v2 = new Vector<Object>(); v2.add("1"); v2.add("picpup(x)"); v2.add("handempty"); v2.add("ontable"); v2.add("when"); v2.add("effect"); v2.add("inscription"); Vector<Vector<Object>> data = new Vector<Vector<Object>>(); data.add(v1); data.add(v2); String[] columnNames = {"1", "2", "3", "4"}; GeneralTableModel tableModel = new GeneralTableModel(data, columnNames, 7, true); JTable table = new JTable(tableModel); table.setColumnSelectionAllowed(false); table.setDefaultRenderer(String.class, new DefaultTableCellRenderer());//new TextAreaCellRenderer()); JFrame frame = new JFrame("Table"); /* frame.addWindowListener( new WindowAdapter() { public void windowClosing( WindowEvent e ) { System.exit(0); } }); */ JScrollPane scrollpane = new JScrollPane(table); scrollpane.setPreferredSize(new Dimension(800,500)); frame.getContentPane().add(scrollpane); frame.pack(); frame.setVisible(true); } }
4180c85ac6098927740cac685368da377943c805
d60e287543a95a20350c2caeabafbec517cabe75
/LACCPlus/Hadoop/2668_1.java
b4c4dad1beebb40499e646457f499388e9253463
[ "MIT" ]
permissive
sgholamian/log-aware-clone-detection
242067df2db6fd056f8d917cfbc143615c558b2c
9993cb081c420413c231d1807bfff342c39aa69a
refs/heads/main
2023-07-20T09:32:19.757643
2021-08-27T15:02:50
2021-08-27T15:02:50
337,837,827
0
0
null
null
null
null
UTF-8
Java
false
false
245
java
//,temp,SwiftUtils.java,113,117,temp,RandomTextDataGenerator.java,124,131 //,3 public class xxx { public static void debugEx(Logger log, String text, Exception ex) { if (log.isDebugEnabled()) { log.debug(text + ex, ex); } } };
0d907239607e7262828d8ab07f83a06afe59adfe
fe2feb6a4df973c9809463eefd1234eb7f34534a
/Stream/src/eicoma/com/github/stream/practice/StreamDemo7.java
ae3c8f3659018c66e4a61a4ffd26bc73a0ab024b
[]
no_license
Eicoma/some-practice
49511594b8e4d92344f8355389b15a83b105ba26
abd3b4dcaf6eae0f830352278d0e3d46df82aa62
refs/heads/master
2023-08-13T18:39:39.609257
2021-10-20T03:49:47
2021-10-20T03:49:47
356,270,679
0
0
null
null
null
null
UTF-8
Java
false
false
1,968
java
package eicoma.com.github.stream.practice; import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; /** * 案例需求 * <p> * 现在有两个ArrayList集合,分别存储6名男演员名称和6名女演员名称,要求完成如下的操作 * <p> * - 男演员只要名字为3个字的前三人 * - 女演员只要姓林的,并且不要第一个 * - 把过滤后的男演员姓名和女演员姓名合并到一起 * - 把上一步操作后的元素作为构造方法的参数创建演员对象,遍历数据 * <p> * 演员类Actor已经提供,里面有一个成员变量,一个带参构造方法,以及成员变量对应的get/set方法 */ public class StreamDemo7 { public static void main(String[] args) { List<String> list1 = new ArrayList<>(); List<String> list2 = new ArrayList<>(); list1.add("周润发"); list1.add("成龙"); list1.add("刘德华"); list1.add("吴京"); list1.add("周星驰"); list1.add("李连杰"); list2.add("林心如"); list2.add("张曼玉"); list2.add("林青霞"); list2.add("柳岩"); list2.add("林志玲"); list2.add("王祖贤"); Stream<String> manStream = list1.stream().filter( (String s) -> { return s.length() == 3; } ).limit(3); Stream<String> womanStream = list2.stream().filter( (String s) -> { return s.startsWith("林"); } ).skip(1); //将两个流合并到一个流stream中 Stream<String> stream = Stream.concat(manStream, womanStream); //用lambda表达式去遍历stream流中的所有元素并使用 stream.forEach( (String name) -> { Actor actor = new Actor(name); System.out.println(actor); }); } }
1a219e65901ce41935aaa1ca680ba3fa44e7e633
ed57c8a0efe0f8c3c38e33e52efe7bd5db97f7a9
/web1/src/main/java/com/example/web1/service/ICommentService.java
424c50498658d413ca0ede76f058f7eff8611a83
[]
no_license
sonbt1993/web1
5293e8a37f4125f5b873a34de5ce8389a02bf0d5
06e351568670a433ec2c982784d224d3cd002b79
refs/heads/main
2023-02-24T23:43:43.634777
2021-02-01T16:10:56
2021-02-01T16:10:56
334,679,714
0
0
null
null
null
null
UTF-8
Java
false
false
72
java
package com.example.web1.service; public interface ICommentService { }
7f97ded6aeb956c97506d6146ff688a046cca559
9b396a05a92d9aad9a5e22a7f531b26a4ec35fc2
/src/service/impl/MajorcostServiceImpl.java
4f567fd35a147a139413c2669b17a1a2dada2744
[]
no_license
huangxinxi/reimbursement
b296d75ed32a4a22c95749d85b94924a78e7f889
d9a12a929139bc797a7681eeb31703b2aa3b129e
refs/heads/master
2022-10-06T23:40:32.361550
2020-06-05T10:03:25
2020-06-05T10:03:25
269,577,185
0
0
null
null
null
null
UTF-8
Java
false
false
1,424
java
package service.impl; import java.util.ArrayList; import dao.impl.MajorcostDaoImpl; import dao.impl.ProjectDaoImpl; import model.Majorcost; import model.Majorcosttype; import model.Project; import service.MajorcostService; import service.ProjectService; import util.SpringUtil; public class MajorcostServiceImpl implements MajorcostService{ private MajorcostDaoImpl dao; public MajorcostDaoImpl getDao() { return dao; } public void setDao(MajorcostDaoImpl dao) { this.dao = dao; } @Override public boolean save(Majorcost p) { dao = (MajorcostDaoImpl) SpringUtil.getApplicationContext().getBean("MajorcostDaoImpl"); return dao.save(p); } @Override public boolean delete(Majorcost p) { // TODO Auto-generated method stub return false; } @Override public boolean update(Majorcost p) { // TODO Auto-generated method stub return false; } @Override public ArrayList<Majorcost> findAll() { // TODO Auto-generated method stub return null; } @Override public ArrayList<Majorcost> findByPUID(String puid) { dao = (MajorcostDaoImpl) SpringUtil.getApplicationContext().getBean("MajorcostDaoImpl"); return dao.findByPUID(puid); } @Override public boolean deleteByPUID(String puid) { dao = (MajorcostDaoImpl) SpringUtil.getApplicationContext().getBean("MajorcostDaoImpl"); return dao.deleteByPUID(puid); } }
b0af261ce2c753a1946ad2e29df93d33d5982317
179e0ec445a1223b44a3600665ee5d4a5d9609f1
/NeverQuit/src/main/java/wdMethods/WdMethods.java
551908024a4c9713fe328e8c30b405dd0ec8d5b5
[]
no_license
HarishDasyam/GitProject
443988ee8eb7edc3bff5c5bcc7f4aa0cae977ae3
94d77fb06d79fe88c6a932044737a997c17fc549
refs/heads/master
2021-08-07T14:52:47.851471
2020-04-19T13:05:40
2020-04-19T13:05:40
157,100,894
0
0
null
null
null
null
UTF-8
Java
false
false
6,078
java
package wdMethods; import java.net.MalformedURLException; import org.openqa.selenium.ElementNotVisibleException; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; public interface WdMethods { /** * This method will launch the Any browser and * maximise the browser and set the wait for 30 seconds * and load the url * @author Babu - TestLeaf * @param browser - This will load the specified browser * @throws MalformedURLException */ public void startApp(String browser,String url); /** * This method will locate the element using any given locator * @param locator - The locator by which the element to be found * @param locValue - The locator value by which the element to be found * @author Babu - TestLeaf * @throws NoSuchElementException */ public WebElement locateElement(String locator, String locValue) ; /** * This method will locate the element using id * @param locValue - The locator value by which the element to be found * @author Babu - TestLeaf * @throws NoSuchElementException */ public WebElement locateElement(String locValue) ; /** * This method will enter the value in the given text field * @param ele - The Webelement (text field) in which the data to be entered * @param data - The data to be sent to the webelement * @author Babu - TestLeaf * @throws ElementNotVisibleException * */ public void type(WebElement ele, String data) ; /** * This method will click the element and take snap * @param ele - The Webelement (button/link/element) to be clicked * @author Babu - TestLeaf */ public void click(WebElement ele); /** * This method will get the text of the element * @param ele - The Webelement (button/link/element) in which text to be retrieved * @author Babu - TestLeaf */ public String getText(WebElement ele); /** * This method will select the drop down visible text * @param ele - The Webelement (dropdown) to be selected * @param value The value to be selected (visibletext) from the dropdown * @author Babu - TestLeaf */ public void selectDropDownUsingText(WebElement ele, String value) ; /** * This method will select the drop down using index * @param ele - The Webelement (dropdown) to be selected * @param index The index to be selected from the dropdown * @author Babu - TestLeaf */ public void selectDropDownUsingIndex(WebElement ele, int index) ; /** * This method will verify browser actual title with expected * @param title - The expected title of the browser * @author Babu - TestLeaf */ public boolean verifyTitle(String expectedTitle); /** * This method will verify exact given text with actual text on the given element * @param ele - The Webelement in which the text to be need to be verified * @param expectedText - The expected text to be verified * @author Babu - TestLeaf */ public void verifyExactText(WebElement ele, String expectedText); /** * This method will verify given text contains actual text on the given element * @param ele - The Webelement in which the text to be need to be verified * @param expectedText - The expected text to be verified * @author Babu - TestLeaf */ public void verifyPartialText(WebElement ele, String expectedText); /** * This method will verify exact given attribute's value with actual value on the given element * @param ele - The Webelement in which the attribute value to be need to be verified * @param attribute - The attribute to be checked (like value, href etc) * @param value - The value of the attribute * @author Babu - TestLeaf */ public void verifyExactAttribute(WebElement ele, String attribute, String value); /** * This method will verify partial given attribute's value with actual value on the given element * @param ele - The Webelement in which the attribute value to be need to be verified * @param attribute - The attribute to be checked (like value, href etc) * @param value - The value of the attribute * @author Babu - TestLeaf */ public void verifyPartialAttribute(WebElement ele, String attribute, String value); /** * This method will verify if the element (Radio button, Checkbox) is selected * @param ele - The Webelement (Radio button, Checkbox) to be verified * @author Babu - TestLeaf */ public void verifySelected(WebElement ele); /** * This method will verify if the element is visible in the DOM * @param ele - The Webelement to be checked * @author Babu - TestLeaf */ public void verifyDisplayed(WebElement ele); /** * This method will switch to the Window of interest * @param index The window index to be switched to. 0 -> first window * @author Babu - TestLeaf */ public void switchToWindow(int index); /** * This method will switch to the specific frame * @param ele - The Webelement (frame) to be switched * @author Babu - TestLeaf */ public void switchToFrame(WebElement ele); /** * This method will accept the alert opened * @author Babu - TestLeaf */ public void acceptAlert(); /** * This method will dismiss the alert opened * @author Babu - TestLeaf */ public void dismissAlert(); /** * This method will return the text of the alert * @author Babu - TestLeaf */ public String getAlertText(); /** * This method will take snapshot of the browser * @author Babu - TestLeaf */ public long takeSnap(); /** * This method will close the active browser * @author Babu - TestLeaf */ public void closeBrowser(); /** * This method will close all the browsers * @author Babu - TestLeaf */ public void closeAllBrowsers(); }
[ "HARISH@HARISH_DASYAM" ]
HARISH@HARISH_DASYAM
f4cb37090fc60229ce540c05b19a4b6a3973cbb8
e76706fd2faa89b8c3ec96c97ba6db5a6017e697
/src/main/java/com/adusoft/web/exception/InternalServerException.java
c5fd4e3f07c95534941857862dfebec9b4045b08
[]
no_license
adusoft/timebuddy
c4683cb075f73f83649cb998fd50538e2b3f9526
c1ad7865b51214d8e6708dd518d8df99da537f53
refs/heads/master
2020-12-24T16:50:20.559917
2015-02-10T21:20:00
2015-02-10T21:20:00
30,863,936
2
1
null
null
null
null
UTF-8
Java
false
false
179
java
package com.adusoft.web.exception; public class InternalServerException extends RuntimeException { public InternalServerException(String message) { super(message); } }
759407c348f0d80a2d6c2f96a34ed8815a529fa0
9a8dd9507963838ec8ebd8b51d02d457b225fe54
/src/ChickenSub.java
f310e6872a962b2414e8955976d1053044487c4d
[]
no_license
EunPyoLee/decorator-servway
ed6e9da5624f45bd15cca22477f29820b053d1c1
3e90f5cf0c850fdd94cfbe6600edd66a4d614bc8
refs/heads/master
2023-07-22T14:30:06.977953
2021-09-01T11:58:19
2021-09-01T11:58:19
400,963,552
0
0
null
null
null
null
UTF-8
Java
false
false
500
java
import common.Glossary; import common.type.BaseEnum; import common.type.BreadEnum; public class ChickenSub extends Sub { private BreadEnum bread; private final Glossary glossary; public ChickenSub(BreadEnum b, Glossary g){ this.bread = b; this.name = "Chicken" + " " + b.toString(); this.glossary = g; } @Override public double getCost() throws Exception{ return glossary.getBaseCost(BaseEnum.CHICKEN) + glossary.getBreadCost(bread); } }
5bc281ee729a30cd0a5fe3e4a34c7c060a618608
d9ac23429bc6f606fae300b38026ebfabb7e0b96
/fsm-stateless4j/src/main/java/com/liuqitech/fsm/stateless4j/State.java
b1bf656e8c1ba0aaa87861f9afa2ac1dbdfd5b7f
[]
no_license
liuqitoday/fsm-demo
b802ccb16fdb4f2d0777eeaf821228debae2b83d
343ae55f66e527feb28ddca5bd425a07c0556dac
refs/heads/master
2021-03-06T23:12:31.792271
2020-03-10T07:13:18
2020-03-10T07:13:18
246,231,497
0
0
null
null
null
null
UTF-8
Java
false
false
243
java
package com.liuqitech.fsm.stateless4j; /** * 订单状态枚举 */ public enum State { /** * 已确认 */ CONFIRMED, /** * 已付款 */ PAID, /** * 已发货 */ SHIPPED, /** * 已签收 */ RECEIVED; }
ef38d478f67296aa3706a5f6bda71520043d8c92
c7d3ad19ea7a8d7e8a9899351c15748c0311ee9c
/ArdavanGhaffari/QL/src/main/java/nl/uva/ql/ast/expression/binaryexpression/Subtraction.java
aa8325c1a76214f17d27038fc658358e86785f11
[]
no_license
software-engineering-amsterdam/multi-ql
97f6f6060b40411a01aa3ca0071c9dc1745a67b4
89b68e22284f7f77c192ab90dbd4c1e985ed7acc
refs/heads/master
2022-04-29T08:22:12.454404
2022-04-19T10:59:57
2022-04-19T10:59:57
50,788,430
2
2
null
2022-04-19T10:59:58
2016-01-31T18:25:34
Java
UTF-8
Java
false
false
451
java
package nl.uva.ql.ast.expression.binaryexpression; import nl.uva.ql.ast.expression.Expression; import nl.uva.ql.visitors.ExpressionVisitor; public class Subtraction extends BinaryExpression{ public Subtraction(Expression leftExpression, Expression rightExprssion, int line) { super(leftExpression, rightExprssion, line); } @Override public <T> T accept(ExpressionVisitor<T> expressionVisitor) { return expressionVisitor.visit(this); } }
5e3cbe964ed10221ae92a084c886ac8bb0008f24
5280865d3cb383952eecd712ccc53adf6ff05e59
/cameraroll/schemas/REACHABILITY/cameraroll/app/src/main/java/us/koller/cameraroll/ui/EditImageActivity.java
b9d777add3085a59d13d0a326f2a8cf044e9af88
[ "Apache-2.0" ]
permissive
LordAmit/MuseRepo_Apps
f753c686b114f78e1176ff94d5553b8ec7e0411a
f0c11783e9b01d5fa40309d5e60438263ddde7b6
refs/heads/master
2020-04-21T08:25:31.456933
2019-08-11T19:48:05
2019-08-11T19:48:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
22,440
java
package us.koller.cameraroll.ui; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.drawable.Animatable; import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.annotation.RequiresApi; import android.support.v4.content.ContextCompat; import android.support.v4.content.LocalBroadcastManager; import android.support.v4.provider.DocumentFile; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.WindowInsets; import android.widget.Button; import android.widget.Toast; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import us.koller.cameraroll.R; import us.koller.cameraroll.data.Settings; import us.koller.cameraroll.data.fileOperations.FileOperation; import us.koller.cameraroll.ui.widget.CropImageView; import us.koller.cameraroll.util.ExifUtil; import us.koller.cameraroll.util.MediaType; import us.koller.cameraroll.util.StorageUtil; import us.koller.cameraroll.util.Util; public class EditImageActivity extends AppCompatActivity { String dataLeAk2698 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2698 = android.util.Log.d("leak-2698", dataLeAk2698); public static final String IMAGE_PATH = "IMAGE_PATH"; public static final String IMAGE_VIEW_STATE = "IMAGE_VIEW_STATE"; public static final int JPEG_QUALITY = 90; private String imagePath; @Override protected void onCreate(@Nullable final Bundle savedInstanceState) { super.onCreate(savedInstanceState); String dataLeAk2699 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2699 = android.util.Log.d("leak-2699", dataLeAk2699); setContentView(R.layout.activity_edit_image); Intent intent = getIntent(); if (intent == null) { String dataLeAk2700 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2700 = android.util.Log.d("leak-2700", dataLeAk2700); return; } final Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { String dataLeAk2701 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2701 = android.util.Log.d("leak-2701", dataLeAk2701); actionBar.setTitle(""); actionBar.setDisplayHomeAsUpEnabled(true); } Uri uri = intent.getData(); if (uri == null) { String dataLeAk2702 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2702 = android.util.Log.d("leak-2702", dataLeAk2702); finish(); return; } String mimeType = MediaType.getMimeType(this, uri); if (!(MediaType.checkImageMimeType(mimeType) || MediaType.checkRAWMimeType(mimeType))) { String dataLeAk2703 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2703 = android.util.Log.d("leak-2703", dataLeAk2703); Toast.makeText(this, R.string.editing_file_format_not_supported, Toast.LENGTH_SHORT).show(); finish(); } imagePath = intent.getStringExtra(IMAGE_PATH); final CropImageView imageView = findViewById(R.id.cropImageView); CropImageView.State state = null; if (savedInstanceState != null) { String dataLeAk2704 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2704 = android.util.Log.d("leak-2704", dataLeAk2704); state = (CropImageView.State) savedInstanceState.getSerializable(IMAGE_VIEW_STATE); } imageView.loadImage(uri, state); final Button doneButton = findViewById(R.id.done_button); doneButton.setOnClickListener(new View.OnClickListener() { String dataLeAk2705 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2705 = android.util.Log.d("leak-2705", dataLeAk2705); @Override public void onClick(View view) { String dataLeAk2706 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2706 = android.util.Log.d("leak-2706", dataLeAk2706); done(view); } }); //setting window insets manually final ViewGroup rootView = findViewById(R.id.root_view); final View actionArea = findViewById(R.id.action_area); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) { String dataLeAk2707 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2707 = android.util.Log.d("leak-2707", dataLeAk2707); rootView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { String dataLeAk2708 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2708 = android.util.Log.d("leak-2708", dataLeAk2708); @Override @RequiresApi(api = Build.VERSION_CODES.KITKAT_WATCH) public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) { String dataLeAk2709 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2709 = android.util.Log.d("leak-2709", dataLeAk2709); // clear this listener so insets aren't re-applied rootView.setOnApplyWindowInsetsListener(null); toolbar.setPadding(toolbar.getPaddingStart() + insets.getSystemWindowInsetLeft(), toolbar.getPaddingTop() + insets.getSystemWindowInsetTop(), toolbar.getPaddingEnd() + insets.getSystemWindowInsetRight(), toolbar.getPaddingBottom()); actionArea.setPadding(actionArea.getPaddingStart() + insets.getSystemWindowInsetLeft(), actionArea.getPaddingTop(), actionArea.getPaddingEnd() + insets.getSystemWindowInsetRight(), actionArea.getPaddingBottom() + insets.getSystemWindowInsetBottom()); imageView.setPadding(imageView.getPaddingStart() + insets.getSystemWindowInsetLeft(), imageView.getPaddingTop()/* + insets.getSystemWindowInsetTop()*/, imageView.getPaddingEnd() + insets.getSystemWindowInsetRight(), imageView.getPaddingBottom()/* + insets.getSystemWindowInsetBottom()*/); return insets.consumeSystemWindowInsets(); } }); } else { String dataLeAk2710 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2710 = android.util.Log.d("leak-2710", dataLeAk2710); rootView.getViewTreeObserver() .addOnGlobalLayoutListener( new ViewTreeObserver.OnGlobalLayoutListener() { String dataLeAk2711 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2711 = android.util.Log.d("leak-2711", dataLeAk2711); @Override public void onGlobalLayout() { String dataLeAk2712 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2712 = android.util.Log.d("leak-2712", dataLeAk2712); rootView.getViewTreeObserver().removeOnGlobalLayoutListener(this); // hacky way of getting window insets on pre-Lollipop // somewhat works... int[] screenSize = Util.getScreenSize(EditImageActivity.this); int[] windowInsets = new int[]{ Math.abs(screenSize[0] - rootView.getLeft()), Math.abs(screenSize[1] - rootView.getTop()), Math.abs(screenSize[2] - rootView.getRight()), Math.abs(screenSize[3] - rootView.getBottom())}; toolbar.setPadding(toolbar.getPaddingStart() + windowInsets[0], toolbar.getPaddingTop() + windowInsets[1], toolbar.getPaddingEnd() + windowInsets[2], toolbar.getPaddingBottom()); actionArea.setPadding(actionArea.getPaddingStart() + windowInsets[0], actionArea.getPaddingTop(), actionArea.getPaddingEnd() + windowInsets[2], actionArea.getPaddingBottom() + windowInsets[3]); imageView.setPadding(imageView.getPaddingStart() + windowInsets[0], imageView.getPaddingTop()/* + windowInsets[1]*/, imageView.getPaddingEnd() + windowInsets[2], imageView.getPaddingBottom()/* + windowInsets[3]*/); } }); } imageView.getViewTreeObserver().addOnGlobalLayoutListener( new ViewTreeObserver.OnGlobalLayoutListener() { String dataLeAk2713 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2713 = android.util.Log.d("leak-2713", dataLeAk2713); @Override public void onGlobalLayout() { String dataLeAk2714 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2714 = android.util.Log.d("leak-2714", dataLeAk2714); imageView.getViewTreeObserver().removeOnGlobalLayoutListener(this); imageView.setPadding(imageView.getPaddingStart(), imageView.getPaddingTop() + toolbar.getHeight(), imageView.getPaddingEnd(), imageView.getPaddingBottom() + actionArea.getHeight()); } }); //needed to achieve transparent navBar getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE); } public void done(View v) { String dataLeAk2715 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2715 = android.util.Log.d("leak-2715", dataLeAk2715); CropImageView cropImageView = findViewById(R.id.cropImageView); final ExifUtil.ExifItem[] exifData = ExifUtil.retrieveExifData(this, cropImageView.getImageUri()); cropImageView.getCroppedBitmap(new CropImageView.OnResultListener() { String dataLeAk2716 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2716 = android.util.Log.d("leak-2716", dataLeAk2716); @Override public void onResult(CropImageView.Result result) { String dataLeAk2717 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2717 = android.util.Log.d("leak-2717", dataLeAk2717); saveCroppedImage(result.getImageUri(), result.getCroppedBitmap(), exifData); } }); } private void saveCroppedImage(final Uri uri, final Bitmap bitmap, final ExifUtil.ExifItem[] exifData) { String dataLeAk2718 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2718 = android.util.Log.d("leak-2718", dataLeAk2718); if (uri == null || bitmap == null) { String dataLeAk2719 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2719 = android.util.Log.d("leak-2719", dataLeAk2719); Toast.makeText(EditImageActivity.this, R.string.error, Toast.LENGTH_SHORT).show(); return; } AsyncTask.execute(new Runnable() { String dataLeAk2720 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2720 = android.util.Log.d("leak-2720", dataLeAk2720); @Override public void run() { String dataLeAk2721 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2721 = android.util.Log.d("leak-2721", dataLeAk2721); try { String dataLeAk2722 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2722 = android.util.Log.d("leak-2722", dataLeAk2722); String newPath = null; OutputStream outputStream; if (imagePath != null) { String dataLeAk2723 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2723 = android.util.Log.d("leak-2723", dataLeAk2723); boolean removableStorage = FileOperation.Util.isOnRemovableStorage(imagePath); //replace fileExtension with .jpg int index = imagePath.lastIndexOf("."); newPath = imagePath.substring(0, index) + ".jpg"; if (!removableStorage) { String dataLeAk2724 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2724 = android.util.Log.d("leak-2724", dataLeAk2724); outputStream = new FileOutputStream(newPath); } else { String dataLeAk2725 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2725 = android.util.Log.d("leak-2725", dataLeAk2725); Settings s = Settings.getInstance(getApplicationContext()); Uri treeUri = s.getRemovableStorageTreeUri(); DocumentFile file = StorageUtil.createDocumentFile(EditImageActivity.this, treeUri, imagePath, "image/jpeg"); if (file != null) { String dataLeAk2726 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2726 = android.util.Log.d("leak-2726", dataLeAk2726); outputStream = getContentResolver().openOutputStream(file.getUri()); } else { String dataLeAk2727 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2727 = android.util.Log.d("leak-2727", dataLeAk2727); outputStream = null; } } } else { String dataLeAk2728 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2728 = android.util.Log.d("leak-2728", dataLeAk2728); try { String dataLeAk2729 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2729 = android.util.Log.d("leak-2729", dataLeAk2729); outputStream = getContentResolver().openOutputStream(uri); } catch (SecurityException e) { String dataLeAk2730 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2730 = android.util.Log.d("leak-2730", dataLeAk2730); outputStream = null; } } if (outputStream != null) { String dataLeAk2731 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2731 = android.util.Log.d("leak-2731", dataLeAk2731); bitmap.compress(Bitmap.CompressFormat.JPEG, JPEG_QUALITY, outputStream); outputStream.flush(); outputStream.close(); } else { String dataLeAk2732 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2732 = android.util.Log.d("leak-2732", dataLeAk2732); return; } //save Exif-Data if (exifData != null) { String dataLeAk2733 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2733 = android.util.Log.d("leak-2733", dataLeAk2733); ExifUtil.saveExifData(newPath, exifData); } //scan path if (imagePath != null) { String dataLeAk2734 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2734 = android.util.Log.d("leak-2734", dataLeAk2734); FileOperation.Util.scanPaths(EditImageActivity.this, new String[]{newPath}, new FileOperation.Util.MediaScannerCallback() { String dataLeAk2735 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2735 = android.util.Log.d("leak-2735", dataLeAk2735); @Override public void onAllPathsScanned() { String dataLeAk2736 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2736 = android.util.Log.d("leak-2736", dataLeAk2736); Intent intent = new Intent(FileOperation.RESULT_DONE); LocalBroadcastManager.getInstance(EditImageActivity.this).sendBroadcast(intent); } }); } EditImageActivity.this.runOnUiThread(new Runnable() { String dataLeAk2737 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2737 = android.util.Log.d("leak-2737", dataLeAk2737); @Override public void run() { String dataLeAk2738 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2738 = android.util.Log.d("leak-2738", dataLeAk2738); Toast.makeText(EditImageActivity.this, R.string.success, Toast.LENGTH_SHORT).show(); finish(); } }); } catch (IOException e) { String dataLeAk2739 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2739 = android.util.Log.d("leak-2739", dataLeAk2739); e.printStackTrace(); } } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); String dataLeAk2740 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2740 = android.util.Log.d("leak-2740", dataLeAk2740); getMenuInflater().inflate(R.menu.image_edit, menu); MenuItem rotate = menu.findItem(R.id.rotate); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { String dataLeAk2741 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2741 = android.util.Log.d("leak-2741", dataLeAk2741); AnimatedVectorDrawable avd = (AnimatedVectorDrawable) ContextCompat.getDrawable(this, R.drawable.ic_rotate_90_avd); rotate.setIcon(avd); } return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { String dataLeAk2742 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2742 = android.util.Log.d("leak-2742", dataLeAk2742); switch (item.getItemId()) { case android.R.id.home: onBackPressed(); break; case R.id.rotate: Drawable d = item.getIcon(); if (d instanceof Animatable && !((Animatable) d).isRunning()) { String dataLeAk2743 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2743 = android.util.Log.d("leak-2743", dataLeAk2743); ((Animatable) d).start(); } rotate90Degrees(); break; case R.id.done: done(item.getActionView()); break; case R.id.restore: CropImageView imageView = findViewById(R.id.cropImageView); imageView.restore(); break; default: break; } return super.onOptionsItemSelected(item); } private void rotate90Degrees() { String dataLeAk2744 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2744 = android.util.Log.d("leak-2744", dataLeAk2744); CropImageView imageView = findViewById(R.id.cropImageView); imageView.rotate90Degree(); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); String dataLeAk2745 = java.util.Calendar.getInstance().getTimeZone().getDisplayName(); Object throwawayLeAk2745 = android.util.Log.d("leak-2745", dataLeAk2745); CropImageView imageView = findViewById(R.id.cropImageView); outState.putSerializable(IMAGE_VIEW_STATE, imageView.getCropImageViewState()); } }
e0f8dd7030a1e66c2f3faec4ac686acd86ad2ebd
931fa3112e5e2d8d8ac42d6d997eee7a9c10e820
/LaunchExample/app/src/androidTest/java/com/example/launchexample/ExampleInstrumentedTest.java
ed4dbd8473a0457697506bfbbd033a87e803cf33
[]
no_license
MalvernSTEMQQ/ASP
29e1698cdcd5534299e0045760025a70892db659
397aeb150b2c0ee89a053cd00f237180c90d8ad6
refs/heads/master
2020-03-28T12:27:50.594099
2018-09-11T12:25:24
2018-09-11T12:25:24
148,301,082
0
0
null
null
null
null
UTF-8
Java
false
false
754
java
package com.example.launchexample; 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.launchexample", appContext.getPackageName()); } }
f4beb46b01f062aa542a94157a844c6bb4bb8389
c27996e8195eb22bedb0c5f01725d4694bb28e6f
/Stack.java
8a4f3e8655c902b0ef17bde03d6484ea2bc7ac26
[]
no_license
altheaibba/Balanced-Brackets
c254074ea98f94db5af4559ed089ff86e83e4613
87f6731d372011b9553226727b7ae891e81071dc
refs/heads/master
2020-03-28T15:54:00.794651
2018-09-13T13:27:02
2018-09-13T13:27:02
148,636,270
0
0
null
null
null
null
UTF-8
Java
false
false
697
java
import java.util.*; public class Stack { int size; int top; String [] array; public Stack(int size) { array = new String [size]; top = 0; } public void push(String s) { array[top] = s; top++; } public String pop() { String temp = array[top-1]; array[top-1] = null; top--; return temp; } public String peek() { return array[top-1]; } public boolean isEmpty() { if(top==0) { return true; } else { return false; } } }
0b93d735bd8588289fadad0b6ec6c9a30d9a147f
ed345750a6330dceaaf20fe6f05e33c8f34b2d2b
/java2-SchaumSeries/cap05/CocheCambioManual.java
0c0d0dc49d17c0c8d3b3bfa7befc274baff0c593
[]
no_license
unaidelao/Java-Exercises
6425cb7003a0a350ddd24bf26c6674879ab73138
667a33f8d4e931cd895eb188e59460745349faa2
refs/heads/master
2021-01-11T16:34:39.878378
2019-07-21T23:42:26
2019-07-21T23:42:26
80,112,170
1
0
null
null
null
null
UTF-8
Java
false
false
568
java
/** * Programación en Java 2 - Serie Schaum * * Ejercicio 5.15 parte 2 de 3. * * Subclase CocheCambioManual, que hereda de la superclase Coche. */ public class CocheCambioManual extends Coche { public CocheCambioManual(String matricula) { // llamada al constructor de la superclase super(matricula); } // se sobreescribe con un modificador de acceso público public void cambiaMarcha(int marcha) { if (marcha < 0) { throw new IllegalArgumentException(); } else { super.cambiaMarcha(marcha); } } }
9f7f87f7c7d03c0cd4a48eab376a1def38d38289
690e056cfcce18306b86bad14e5df14328c04c6c
/src/com/jalor/prize/test.java
c08eac03d390ce312c9e396fb060798e72fa2bfc
[]
no_license
simon-zm/Jalor
3993f42316ba2fa3e9cac14b52ef690c95e7a202
8ed6e96a8151463db603307d40d4ac834021d83c
refs/heads/master
2021-02-19T09:24:22.485699
2019-06-20T07:57:07
2019-06-20T07:57:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,813
java
package com.jalor.prize; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * @Author liubo * @Date 2018/12/20 12:23 * @Description: TODO */ public class test { /** * 给转盘的每个角度赋初始值 * * @return */ private final static List<prize> initDrawList = new ArrayList<prize>() { { add(new prize(1, "谢谢参与", 40)); add(new prize(2, "虚拟红包10元", 10)); add(new prize(3, "虚拟红包20元", 16)); add(new prize(4, "加息券0.5%", 15)); add(new prize(5, "京东购物卡", 10)); add(new prize(6, "金士顿(Kingston)128GB U盘", 5)); add(new prize(7, "格兰仕(Galanz)G80F23CN3L-C2K(G2)微波炉/光波炉/烤箱一体机", 3)); add(new prize(9, "科沃斯(Ecovacs)扫地机器人", 1)); } }; /** * 生成奖项 * * @return */ public static prize generateAward() { List<prize> initData = initDrawList; long result = randomnum(1, 100); int line = 0; int temp = 0; prize returnobj = null; for (int i = 0; i < initDrawList.size(); i++) { prize obj2 = initDrawList.get(i); int c = obj2.getV(); temp = temp + c; line = 100 - temp; if (c != 0) { if (result > line && result <= (line + c)) { returnobj = obj2; // 如果大于库存就从新抽奖 // if(returnobj.getId()==20){ // continue; // } break; } } } return returnobj; } // 获取2个值之间的随机数 private static long randomnum(int smin, int smax) { int range = smax - smin; double rand = Math.random(); return (smin + Math.round(rand * range)); } public static void main(String[] args) { prize p = generateAward(); System.out.println(p.getPrize() + new SimpleDateFormat("yyyyMMdd").format(new Date())); } }
5de246e6e4494aeac9fbcf4f5d0a23520b139d64
26331af0023461a3e9b3653a4db376db1dbbf251
/webmagic-dao/src/main/java/com/webmagic/mapper/DataAndCodeMapper.java
4db3420a0af49f5481ecf063e484b6259856667c
[]
no_license
dfggking/webmagic-module
b874ff336ac3c54f33d342f78c10ae1ffbbc0a68
a243b84ecd12064bb3fcfdd0fbdb38396d526ca3
refs/heads/master
2022-12-21T16:06:03.719619
2020-06-02T09:27:14
2020-06-02T09:27:14
154,348,030
0
1
null
2022-12-16T04:31:51
2018-10-23T15:00:59
Java
UTF-8
Java
false
false
341
java
package com.webmagic.mapper; import com.webmagic.model.DataAndCode; import java.util.List; public interface DataAndCodeMapper { int deleteByPrimaryKey(String id); int insert(DataAndCode record); DataAndCode selectByPrimaryKey(String id); List<DataAndCode> selectAll(); int updateByPrimaryKey(DataAndCode record); }
d719dad84ad2fb6e844d65566443ac137641aa16
7d7be78c9d0fb19ac86c726b6a1328e9821f8d27
/hmily-xa/hmily-xa-rpc/hmily-xa-rpc-springcloud/src/main/java/org/dromara/hmily/xa/rpc/springcloud/FeignRequestInterceptor.java
6422c9b725802349cd5bbf4a07d483f4edab446a
[ "Apache-2.0" ]
permissive
dromara/hmily
3ba9b60fd51327e05d12d6c63509235303d11dd3
84cda6fe40bf27c6236321c76b348fd0df87d8aa
refs/heads/master
2023-07-20T05:20:43.797559
2023-07-10T03:55:27
2023-07-10T03:55:27
105,110,479
1,233
448
Apache-2.0
2023-09-13T11:01:17
2017-09-28T06:29:01
Java
UTF-8
Java
false
false
1,314
java
/* * Copyright 2017-2021 Dromara.org * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.dromara.hmily.xa.rpc.springcloud; import feign.RequestInterceptor; import feign.RequestTemplate; import org.dromara.hmily.core.context.HmilyContext; import org.dromara.hmily.core.context.HmilyContextHolder; import org.dromara.hmily.core.mediator.RpcMediator; import org.springframework.core.Ordered; /** * 拦截Feign Rpc,使其传递{@link HmilyContext}. */ public class FeignRequestInterceptor implements RequestInterceptor, Ordered { @Override public void apply(final RequestTemplate template) { RpcMediator.getInstance().transmit(template::header, HmilyContextHolder.get()); } @Override public int getOrder() { return Ordered.LOWEST_PRECEDENCE; } }
75ee60542e8e9daa0b43fd5319d153b77fa9a2a7
8e8fd1006cf37ec0599003d8bc192a3306a39ec6
/acp/acp-packet/src/main/java/pers/acp/packet/iso8583/ISO8583Packet.java
6faa752ef26fea7766a264421c9f1f2fd991689b
[]
no_license
BobBright/acp
40db185e25dc29a111c8daea353325491292a72f
10a9b9485feb876701fa5e6304ccc121570db247
refs/heads/master
2020-03-21T04:18:51.968753
2018-06-19T10:58:16
2018-06-19T10:58:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
23,218
java
package pers.acp.packet.iso8583; import pers.acp.core.log.LogFactory; import java.io.UnsupportedEncodingException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.TreeMap; /** * 简单介绍下ISO8583。 * 这个东西说白了就是一种数据结构。我们定义一种规则把一堆东西放进去,再按照规则 * 把数据正确拿出来。这就是报文的实质。 * <p> * ISO8583报文的结构是:前面有16字节(128位)位图数据,后面就是数据。 * 报文最多有128个域(字段)。具体的一个报文不会有这么多,一般是几个域。 * 有哪几个就记录在位图中。而且域有定长和变长之分。 * 这些都是事先定义好的,具体可以看我写的properties定义文件. * <p> * 位图转化成01字符串就是128个,如果某一位是1,代表这个域有值,然后按照properties定义的规则取值。 * 如果是0,则这个域没有值。 * <p> * 再说定长和变长。 * 定长域(定长比较好理解,一个字段规定是N位,那么字段值绝对不能超过N位,不足N位就在后面补空格) * 变长域(变长域最后组装成的效果:例如变长3位,定义var3,这里的3是指长度值占3位,字段值是123456,最后结果就是006123456) * 注意(变长的长度按照域值得字节长度计算,而不是按照域值字符串长度算!) * <p> * 从网上不难找到ISO8583报文的介绍,这里就不多说了。 * 但是具体解析和组装的代码还真不好找,所以本人就写了一个让刚接触ISO8583报文的人更好入门。 * <p> * <p> * <p> * 解析的容器,我使用了Map,具体到工作中,还是要换成其他的容器的。 * 报文定义说明:iso8583.properties * 例如 * FIELD031 = string,10 * FIELD032 = string,VAR2 * <p> * FIELD031是定长,长度是10 * FIELD032是变长,长度值占2位,也就是说长度值最大99,也就是域值最大长度99. * * @author zhangbin */ public class ISO8583Packet { private static LogFactory log = LogFactory.getInstance(ISO8583Packet.class); private static String packet_encoding = "UTF-8";//报文编码 UTF-8 GBK private static Map<String, String> map8583Definition = null;// 8583报文128域定义器 static { try { ISO8583FieldProperties iso8583FieldProperties = ISO8583FieldProperties.getInstance(); if (iso8583FieldProperties != null) { map8583Definition = new HashMap<>(); iso8583FieldProperties.forEach((key, value) -> map8583Definition.put(String.valueOf(key), String.valueOf(value))); } } catch (Exception e) { log.error(e.getMessage(), e); } } /** * 8583报文初始位图:128位01字符串 * * @return 位图 */ private static String getInitBitMap() { return "10000000" + "00000000" + "00000000" + "00000000" + "00000000" + "00000000" + "00000000" + "00000000" + "00000000" + "00000000" + "00000000" + "00000000" + "00000000" + "00000000" + "00000000" + "00000000"; } /** * 组装8583报文 * * @param filedMap 域值 */ public static byte[] make8583(TreeMap<String, String> filedMap) { byte[] whoe8583; if (filedMap == null) { return null; } try { String bitMap128 = getInitBitMap();//获取初始化的128位图 //按照8583定义器格式化各个域的内容 Map<String, Object> all = formatValueTo8583(filedMap, bitMap128); // 获取上送报文内容 whoe8583 = getWhole8583Packet(all); return whoe8583; } catch (Exception e) { log.error(e.getMessage(), e); } return null; } /** * 获取完整的8583报文体(128域) * * @param all 内容 * @return 字节数组 */ private static byte[] getWhole8583Packet(Map<String, Object> all) { if (all == null || all.get("formatedFiledMap") == null || all.get("bitMap128") == null) { return null; } try { String bitMap128 = (String) all.get("bitMap128"); // 128域位图二进制字符串转16位16进制 byte[] bitmaps = get16BitByteFromStr(bitMap128); TreeMap pacBody = (TreeMap) all.get("formatedFiledMap"); StringBuilder last128 = new StringBuilder(); Iterator it = pacBody.keySet().iterator(); for (; it.hasNext(); ) { String key = (String) it.next(); String value = (String) pacBody.get(key); last128.append(value); } byte[] bitContent = last128.toString().getBytes(packet_encoding);//域值 //组装 byte[] package8583; package8583 = ISO8583Packet.arrayApend(null, bitmaps); package8583 = ISO8583Packet.arrayApend(package8583, bitContent); return package8583; } catch (Exception e) { log.error(e.getMessage(), e); return null; } } private static Map<String, Object> formatValueTo8583(TreeMap<String, String> filedMap, String bitMap128) { Map<String, Object> all = new HashMap<>(); TreeMap<String, String> formatedFiledMap = new TreeMap<>();//格式化结果 if (filedMap != null) { Iterator it = filedMap.keySet().iterator(); for (; it.hasNext(); ) { String fieldName = (String) it.next();//例如FIELD005 String fieldValue = filedMap.get(fieldName);//字段值 try { if (fieldValue == null) { log.error("报文域 {" + fieldName + "}为空值"); return null; } //将域值编码转换,保证报文编码统一 fieldValue = new String(fieldValue.getBytes(packet_encoding), packet_encoding); // 数据域名称FIELD开头的为128域 if (fieldName.startsWith("FIELD")) { String fieldNo = fieldName.substring(5, 8);//例如005 // 组二进制位图串 bitMap128 = change16bitMapFlag(fieldNo, bitMap128); // 获取域定义信息 String[] fieldDef = map8583Definition.get("FIELD" + fieldNo).split(","); String defLen = fieldDef[1];//长度定义,例20 boolean isFixLen = true;//是否定长判断 if (defLen.startsWith("VAR")) {//变长域 isFixLen = false; defLen = defLen.substring(3);//获取VAR2后面的2 } int fieldLen = fieldValue.getBytes(packet_encoding).length;//字段值得实际长度 // 判断是否为变长域 if (!isFixLen) {// 变长域(变长域最后组装成的效果:例如变长3位,定义var3,这里的3是指长度值占3位,字段值是123456,最后结果就是006123456) int defLen1 = Integer.valueOf(defLen); if (String.valueOf(fieldLen).length() > (10 * defLen1)) { log.error("字段" + fieldName + "的数据定义长度的长度为" + defLen + "位,长度不能超过" + (10 * defLen1)); return null; } else { //将长度值组装入字段 fieldValue = getVaryLengthValue(fieldValue, defLen1) + fieldValue; } } else {//定长域(定长比较好理解,一个字段规定是N位,那么字段值绝对不能超过N位,不足N位就在后面补空格) int defLen2 = Integer.valueOf(defLen); if (fieldLen > defLen2) { log.error("字段" + fieldName + "的数据定义长度为" + defLen + "位,长度不能超过" + defLen); return null; } else { fieldValue = getFixFieldValue(fieldValue, defLen2);//定长处理 } } log.info("组装后报文域 {" + fieldName + "}==" + fieldValue + "==,域长度:" + fieldValue.getBytes(packet_encoding).length); } // 返回结果赋值 if (filedMap.containsKey(fieldName)) { if (formatedFiledMap.containsKey(fieldName)) { formatedFiledMap.remove(fieldName); } formatedFiledMap.put(fieldName, fieldValue); } else { log.error(fieldName + "配置文件中不存在!"); } } catch (Exception e) { log.error(e.getMessage(), e); } }//end for } all.put("formatedFiledMap", formatedFiledMap); all.put("bitMap128", bitMap128); return all; } /** * 解析8583报文 * * @param content8583 报文内容 */ public static Map<String, String> analyze8583(byte[] content8583) { TreeMap<String, String> filedMap = new TreeMap<>(); try { // 取位图 byte[] bitMap16byte = new byte[16]; //记录当前位置,从位图后开始遍历取值 int pos = 16; String bitMap128Str; if (Integer.toBinaryString(content8583[0] >>> 7).substring(24).equalsIgnoreCase("1")) { System.arraycopy(content8583, 0, bitMap16byte, 0, 16); } else { bitMap16byte = new byte[8]; pos = 8; System.arraycopy(content8583, 0, bitMap16byte, 0, 8); } // 16位图转2进制位图128位字符串 bitMap128Str = get16BitMapStr(bitMap16byte); // 遍历128位图,取值。注意从FIELD002开始 for (int i = 1; i < bitMap128Str.length(); i++) { String filedValue;//字段值 String filedName = "FIELD" + getNumThree((i + 1));//FIELD005 if (bitMap128Str.charAt(i) == '1') { // 获取域定义信息 String[] fieldDef = map8583Definition.get(filedName).split(","); String defLen = fieldDef[1];//长度定义,例20 boolean isFixLen = true;//是否定长判断 if (defLen.startsWith("VAR")) {//变长域 isFixLen = false; defLen = defLen.substring(3);//获取VAR2后面的2 } // 截取该域信息 if (!isFixLen) {//变长域 int defLen1 = Integer.valueOf(defLen);//VAR2后面的2 String realLen1 = new String(content8583, pos, defLen1, packet_encoding);//报文中实际记录域长,例如16,023 int realAllLen = defLen1 + Integer.valueOf(realLen1);//该字段总长度(包括长度值占的长度) // filedValue = new String(content8583, pos+defLen1, Integer.valueOf(realLen1), packet_encoding); byte[] filedValueByte = new byte[Integer.valueOf(realLen1)]; System.arraycopy(content8583, pos + defLen1, filedValueByte, 0, filedValueByte.length); filedValue = new String(filedValueByte, packet_encoding); pos += realAllLen;//记录当前位置 } else {//定长域 int defLen2 = Integer.valueOf(defLen);//长度值占的位数 filedValue = new String(content8583, pos, defLen2, packet_encoding); pos += defLen2;//记录当前位置 } filedMap.put(filedName, filedValue); } }//end for } catch (Exception e) { log.error(e.getMessage(), e); } return filedMap; } /** * 复制字符 * * @param str 源字符串 * @param count 数量 * @return 目标字符串 */ private static String strCopy(String str, int count) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < count; i++) { sb.append(str); } return sb.toString(); } /** * 将setContent放入set(考虑到数组越界) * * @param set 字节数组 * @param setContent 字节数组 * @return 字节数组 */ private static byte[] setToByte(byte[] set, byte[] setContent) { byte[] res = new byte[set.length]; if (setContent != null) { if (set.length >= setContent.length) { System.arraycopy(setContent, 0, res, 0, setContent.length); } } return res; } public static byte[] setToByte(byte[] set, String setContentStr) { byte[] res = new byte[set.length]; byte[] setContent; try { setContent = setContentStr.getBytes(packet_encoding); res = setToByte(res, setContent); } catch (UnsupportedEncodingException e) { log.error(e.getMessage(), e); } return res; } private static String getPacketLen(int len) { String res; String lenStr = String.valueOf(len); int lenC = 4 - lenStr.length(); res = strCopy("0", lenC) + lenStr; return res; } public static String getPacketLen(String lenStr) { String res = ""; if (lenStr != null) { res = getPacketLen(Integer.valueOf(lenStr)); } return res; } /** * 返回a和b的组合,实现累加功能 * * @param a 字节数组 * @param b 字节数组 * @return 字节数组 */ private static byte[] arrayApend(byte[] a, byte[] b) { int a_len = (a == null ? 0 : a.length); int b_len = (b == null ? 0 : b.length); byte[] c = new byte[a_len + b_len]; if (a_len == 0 && b_len == 0) { return null; } else if (a_len == 0) { System.arraycopy(b, 0, c, 0, b.length); } else if (b_len == 0) { System.arraycopy(a, 0, c, 0, a.length); } else { System.arraycopy(a, 0, c, 0, a.length); System.arraycopy(b, 0, c, a.length, b.length); } return c; } /** * 改变128位图中的标志为1 * * @param fieldNo 域编号 * @param res res * @return result */ private static String change16bitMapFlag(String fieldNo, String res) { int indexNo = Integer.parseInt(fieldNo); res = res.substring(0, indexNo - 1) + "1" + res.substring(indexNo); return res; } /** * 位图操作 * <p> * 把16位图的字节数组转化成128位01字符串 * * @param bitMap16 位图 * @return 字符串 */ private static String get16BitMapStr(byte[] bitMap16) { StringBuilder bitMap128 = new StringBuilder(); // 16位图转2进制位图128位字符串 for (byte aBitMap16 : bitMap16) { int bc = aBitMap16; bc = (bc < 0) ? (bc + 256) : bc; String bitnaryStr = Integer.toBinaryString(bc);//二进制字符串 // 左补零,保证是8位 String rightBitnaryStr = strCopy("0", Math.abs(8 - bitnaryStr.length())) + bitnaryStr;//位图二进制字符串 // 先去除多余的零,然后组装128域二进制字符串 bitMap128.append(rightBitnaryStr); } return bitMap128.toString(); } /** * 位图操作 * <p> * 把128位01字符串转化成16位图的字节数组 * * @param str_128 字符串 * @return 字节数组 */ private static byte[] get16BitByteFromStr(String str_128) { byte[] bit16 = new byte[16]; try { if (str_128 == null || str_128.length() != 128) { return null; } // 128域位图二进制字符串转16位16进制 byte[] tmp = str_128.getBytes(packet_encoding); int weight;//权重 byte[] strout = new byte[128]; int i, j, w = 0; for (i = 0; i < 16; i++) { weight = 0x0080; for (j = 0; j < 8; j++) { strout[i] += ((tmp[w]) - '0') * weight; weight /= 2; w++; } bit16[i] = strout[i]; } } catch (UnsupportedEncodingException e) { log.error(e.getMessage(), e); } return bit16; } /** * 从完整的8583报文中获取位图(16字节数组) * * @param packet 字节数组 * @return 字节数组 */ private static byte[] getPacketHeaderMap(byte[] packet) { byte[] packet_header_map = new byte[16]; if (packet == null || packet.length < 16) { return null; } System.arraycopy(packet, 0, packet_header_map, 0, 16); return packet_header_map; } /** * 从完整的8583报文中获取16位图,转化成128位的01字符串 * * @param content8583 字节数组 * @return 字符串 */ public static String get16BitMapFrom8583Byte(byte[] content8583) { // 取位图 byte[] bitMap16 = getPacketHeaderMap(content8583); if (bitMap16 != null) { // 16位图转2进制位图128位字符串 return get16BitMapStr(bitMap16); } else { return null; } } //返回字段号码,例如005 private static String getNumThree(int i) { String len; String iStr = String.valueOf(i); len = strCopy("0", 3 - iStr.length()) + iStr; return len; } /** * 获取字符串变长值 * * @param valueStr 值 * @param defLen 例如getFixLengthValue("12345678", 2)返回08 * 例如getFixLengthValue("12345678", 3)返回008 * <p> * 注意变长长度的计算: * 长度的判断使用转化后的字节数组长度,因为中文在不同的编码方式下,长度是不同的,GBK是2,UTF-8是3,按字符创长度算就是1. * 解析报文是按照字节来解析的,所以长度以字节长度为准,防止中文带来乱码。 * <p> * 比如一个变长域:aa索隆bb,如果按照字符串计算长度那么就是6,最后是06aa索隆bb。 * 这样在解析时按照字节解析长度就乱了,因为按照GBK字节解析,一个汉字占2,按照UTF-8解析,一个汉字占3. * 所以在计算时必须按照字节长度为准!按照我们设置的UTF-8编码结果就是10aa索隆bb. * 这样在解析时长度正好是10,也就不会乱了。 * @return 结果 */ private static String getVaryLengthValue(String valueStr, int defLen) { return getVaryLengthValue(valueStr, defLen, packet_encoding); } private static String getVaryLengthValue(String valueStr, int defLen, String encoding) { String fixLen = ""; try { if (valueStr == null) { return strCopy("0", defLen); } else { byte[] valueStrByte; //这里最好指定编码,不使用平台默认编码 if (encoding == null || encoding.trim().equals("")) { valueStrByte = valueStr.getBytes(); } else { valueStrByte = valueStr.getBytes(encoding); } //长度的判断使用转化后的字节数组长度,因为中文在不同的编码方式下,长度是不同的,GBK是2,UTF-8是3,按字符创长度算就是1. //解析报文是按照字节来解析的,所以长度以字节长度为准,防止中文带来乱码 if (valueStrByte.length > (10 * defLen)) { return null; } else { int len = valueStrByte.length;//字段实际长度 String len1 = String.valueOf(len); fixLen = strCopy("0", (defLen - len1.length())) + len1; } } } catch (UnsupportedEncodingException e) { log.error(e.getMessage(), e); } return fixLen; } /** * 将字段值做定长处理,不足定长则在后面补空格 * * @param valueStr 值 * @param defLen 定义长度 * @return 结果 */ private static String getFixFieldValue(String valueStr, int defLen) { return getFixFieldValue(valueStr, defLen, packet_encoding); } private static String getFixFieldValue(String valueStr, int defLen, String encoding) { String fixLen = ""; try { if (valueStr == null) { return strCopy(" ", defLen); } else { byte[] valueStrByte; //这里最好指定编码,不使用平台默认编码 if (encoding == null || encoding.trim().equals("")) { valueStrByte = valueStr.getBytes(); } else { valueStrByte = valueStr.getBytes(encoding); } //长度的判断使用转化后的字节数组长度,因为中文在不同的编码方式下,长度是不同的,GBK是2,UTF-8是3,按字符创长度算就是1. //解析报文是按照字节来解析的,所以长度以字节长度为准,防止中文带来乱码 if (valueStrByte.length > defLen) { return null; } else { fixLen = valueStr + strCopy(" ", defLen - valueStrByte.length); } } } catch (UnsupportedEncodingException e) { log.error(e.getMessage(), e); } return fixLen; } public static String getPacket_encoding() { return packet_encoding; } public static void setPacket_encoding(String packet_encoding) { ISO8583Packet.packet_encoding = packet_encoding; } public static Map getMap8583Definition() { return map8583Definition; } public static void setMap8583Definition(Map<String, String> map8583Definition) { ISO8583Packet.map8583Definition = map8583Definition; } }
37256e4ecf16b24fcc2aa7b091fe91380fbdc219
b2bf70794dd226a6ce53c7433d26696eec75ec74
/src/br/com/cod3r/cm/Aplicacao.java
ef5f28a5d603b18db2b9b7a7a4c02eab256dac07
[]
no_license
marciomarquesdesouza/campo-minado
ae3c3f610cf3c16b99bba12046daf3cefd9922a0
d06e124a6b9db0a7670d3a60cb491dad7f13c7ae
refs/heads/master
2023-04-12T22:26:42.287908
2021-04-22T03:55:12
2021-04-22T03:55:12
359,034,044
0
0
null
null
null
null
UTF-8
Java
false
false
279
java
package br.com.cod3r.cm; import br.com.cod3r.cm.modelo.Tabuleiro; import br.com.cod3r.cm.visao.TabuleiroConsole; public class Aplicacao { public static void main(String[] args) { Tabuleiro tabuleiro = new Tabuleiro(6, 6, 6); new TabuleiroConsole(tabuleiro); } }
717ccc1e771341b4d9a6d3cfd48960f82bbe247c
14a44eaa62df3aed9a429b8dec700b62da688a08
/src/main/java/HibernateProyect/HibernateProyect/modelo/Usuario.java
ee25e5afddae920f5288f2e5fd5ac4164fc881d1
[]
no_license
daniatenciano/HibernateProyect
23374f35f8efde0d04fe3da6b82773158c025d6e
cb1a524d043bd66055836ed1bde106b2313ad678
refs/heads/master
2020-03-11T09:05:47.791851
2018-04-20T12:12:58
2018-04-20T12:12:58
129,901,827
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
package HibernateProyect.HibernateProyect.modelo; import java.io.*; import java.util.*; import javax.persistence.*; @Entity @Table(name = "A_USU") @Inheritance(strategy = InheritanceType.JOINED) public class Usuario implements Serializable { @Id @GeneratedValue @Column(name = "USU_ID") private int idUsuario; @Column(name="USU_LOG", nullable=false, unique = true) private String login; @Column(name = "USU_PAS", nullable = false) private String password; @Column(name = "USU_FEC", nullable = false) private Date fechaAlta; public Usuario() { } public int getIdUsuario() { return idUsuario; } public void setIdUsuario(int idUsuario) { this.idUsuario = idUsuario; } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Date getFechaAlta() { return fechaAlta; } public void setFechaAlta(Date fechaAlta) { this.fechaAlta = fechaAlta; } }
9fd14b791bb6a68b3d7dd44657b7b59d83e37ee4
b4ebefa9d6e08254134942a7ed630db278772626
/src/main/java/com/seungmoo/java8to11/parallel_sort/ParallelSort.java
09b29a96ef1e83677f74d4ef0f649f711b414e79
[]
no_license
dltmdan92/java8to11
fb03ed4386ef9f35424402dd5c4626a8b5defdf1
000d7428ed56cf24f02ae4ddca54d9f922ebe73b
refs/heads/master
2023-02-08T14:16:11.233031
2021-01-02T12:49:33
2021-01-02T12:49:33
323,620,517
0
0
null
null
null
null
UTF-8
Java
false
false
1,220
java
package com.seungmoo.java8to11.parallel_sort; import java.util.Arrays; import java.util.Random; import java.util.stream.IntStream; /** * 20. 배열 Parallel 정렬 * Arrays.parallelSort() * • Fork/Join 프레임워크를 사용해서 배열을 병렬로 정렬하는 기능을 제공한다. * * 병렬 정렬 알고리듬 * • 배열을 둘로 계속 쪼갠다. * • 합치면서 정렬한다. (머지소트??) * * 경우에 따라 parallelSort와 serialSort의 속도 차이가 다르게 나옴 * 숫자가 커질수록 parallelSort가 느린거 같긴한데... */ public class ParallelSort { public static void run() { int size = 1500; int[] numbers = new int[size]; Random random = new Random(); IntStream.range(0, size).forEach(i -> numbers[i] = random.nextInt()); long start = System.nanoTime(); Arrays.sort(numbers); System.out.println("serial sorting took " + (System.nanoTime() - start)); IntStream.range(0, size).forEach(i -> numbers[i] = random.nextInt()); start = System.nanoTime(); Arrays.parallelSort(numbers); System.out.println("parallel sorting took " + (System.nanoTime() - start)); } }
4949bfd3dbac4984408aeccea45d2284a1bc5dbc
6733e296a172655a25ac4fc41f743b42be590d03
/src/main/java/in/ols/rest/model/CourseDto.java
c8aaa02843e7fd96cb1e702e9293a81bf17a016d
[]
no_license
sandeeprgurav/ols-rest-api
7b4e15b188c44f188628596944fd22d032dc3b76
7e5825c5803cb56b9a643b40f1c689d3b88bde32
refs/heads/master
2020-09-10T16:58:57.746388
2019-12-01T22:20:41
2019-12-01T22:20:41
221,769,387
0
0
null
null
null
null
UTF-8
Java
false
false
1,390
java
package in.ols.rest.model; import in.ols.rest.model.BaseModel.Status; public class CourseDto implements Comparable<CourseDto>{ private String id; private int serialNumber; private String userId; private String name; private String description; private String category; private Status status; private String enteredBy; public String getId() { return id; } public void setId(String id) { this.id = id; } public int getSerialNumber() { return serialNumber; } public void setSerialNumber(int serialNumber) { this.serialNumber = serialNumber; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Status getStatus() { return status; } public void setStatus(Status status) { this.status = status; } public String getEnteredBy() { return enteredBy; } public void setEnteredBy(String enteredBy) { this.enteredBy = enteredBy; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } @Override public int compareTo(CourseDto arg0) { return 0; } }
5c446a3a726ae48a25e9bdf54d34bbfdfb102567
78f7fd54a94c334ec56f27451688858662e1495e
/VoterData/src/main/java/com/itgrids/voterdata/service/geo/DistanceChecker.java
154826bcdff4228e6c2f15f5d8e4bb64254eb13b
[]
no_license
hymanath/PA
2e8f2ef9e1d3ed99df496761a7b72ec50d25e7ef
d166bf434601f0fbe45af02064c94954f6326fd7
refs/heads/master
2021-09-12T09:06:37.814523
2018-04-13T20:13:59
2018-04-13T20:13:59
129,496,146
1
0
null
null
null
null
UTF-8
Java
false
false
2,266
java
package com.itgrids.voterdata.service.geo; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; public class DistanceChecker { public static void main(String[] args) { DistanceChecker checker = new DistanceChecker(); List<DataVO> data = checker.getData("D:/OneDrive/ITGRIDS/ITDP/geodata.txt"); Date d1 = new Date(); Map<String,Integer> map = checker.getPointsBetewenInADistance(15.713531,79.8240546,data,200); Date d2 = new Date(); System.out.println(map.size()); System.out.println("Time Taken - "+(d2.getTime()-d1.getTime())); } public Map<String,Integer> getPointsBetewenInADistance(Double latitude,Double longitude,List<DataVO> dataList,int length) { Map<String,Integer> result = new HashMap<String, Integer>(0); try{ for(DataVO data : dataList) { String houseHoldId = data.getHouseHoldId(); Double distance = DistanceCalculator.distance(latitude,longitude,Double.valueOf(data.getLatitude()),Double.valueOf(data.getLongitude()),"M"); int length2 = distance.intValue(); if(length2 < length) { System.out.println(houseHoldId+"\t"+length2); result.put(houseHoldId,length2); } } }catch(Exception e) { e.printStackTrace(); } return result; } public List<DataVO> getData(String filePath) { List<DataVO> dataList = new ArrayList<DataVO>(0); try{ BufferedReader br = new BufferedReader(new FileReader(new File(filePath))); String line = null; DataVO dataVO = null; while((line = br.readLine()) != null) { try{ String[] data = line.trim().split("\t"); String houseHoldId = data[0].trim(); String latitude = data[1].trim(); String longitude = data[2].trim(); dataVO = new DataVO(); dataVO.setHouseHoldId(houseHoldId); dataVO.setLatitude(latitude); dataVO.setLongitude(longitude); dataList.add(dataVO); }catch(Exception e) { e.printStackTrace(); } } br.close(); }catch(Exception e) { e.printStackTrace(); } return dataList; } }
[ "itgrids@b17b186f-d863-de11-8533-00e0815b4126" ]
itgrids@b17b186f-d863-de11-8533-00e0815b4126
b84e697d2bd9d84b8c3a8b050eade6cecc4ac936
4241c98228d7c2b2fbc3c271b2184c9b03c653cb
/app/src/test/java/com/example/jsu/lab4a/ExampleUnitTest.java
09139d3c6a1d5cc12fee73abe10218057fcfac7a
[]
no_license
Mshell0126/CS408-Lab-4A
92c589ae70a7f7015fead8d82c5dc3ad3a24b811
abe93a48d0285b4dafa1a558b93e5e8714304dc9
refs/heads/master
2020-04-27T02:45:02.167886
2019-03-11T23:24:12
2019-03-11T23:24:12
174,004,149
0
0
null
null
null
null
UTF-8
Java
false
false
382
java
package com.example.jsu.lab4a; 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); } }
3e0495de6af68a765d6e6e7d11f8daea275c13eb
ef0c1514e9af6de3ba4a20e0d01de7cc3a915188
/sdk/batch/azure-resourcemanager-batch/src/main/java/com/azure/resourcemanager/batch/models/BatchLocationQuota.java
f1328bf07fc31dede510ee5c19f0ae558c229e76
[ "LicenseRef-scancode-generic-cla", "MIT", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-or-later", "CC0-1.0", "BSD-3-Clause", "UPL-1.0", "Apache-2.0", "LicenseRef-scancode-public-domain", "BSD-2-Clause" ]
permissive
Azure/azure-sdk-for-java
0902d584b42d3654b4ce65b1dad8409f18ddf4bc
789bdc6c065dc44ce9b8b630e2f2e5896b2a7616
refs/heads/main
2023-09-04T09:36:35.821969
2023-09-02T01:53:56
2023-09-02T01:53:56
2,928,948
2,027
2,084
MIT
2023-09-14T21:37:15
2011-12-06T23:33:56
Java
UTF-8
Java
false
false
827
java
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.resourcemanager.batch.models; import com.azure.resourcemanager.batch.fluent.models.BatchLocationQuotaInner; /** An immutable client-side representation of BatchLocationQuota. */ public interface BatchLocationQuota { /** * Gets the accountQuota property: The number of Batch accounts that may be created under the subscription in the * specified region. * * @return the accountQuota value. */ Integer accountQuota(); /** * Gets the inner com.azure.resourcemanager.batch.fluent.models.BatchLocationQuotaInner object. * * @return the inner object. */ BatchLocationQuotaInner innerModel(); }
6de4d7badd5b9f0fb942233a08801ae300512d70
f142738b9a5de8b7fcd6b4c0ed57ee70b66d9dac
/src/main/java/de/edgelord/saltyengine/core/stereotypes/ComponentParent.java
976c67109f374dcdc402f8756cc2e00749263512
[ "MIT" ]
permissive
igorimagine/salty-engine
94921f119f824384ae252d8e63b624a179bca4b5
532c99fb3f1afc98db17c5a3ea54547d457b63d9
refs/heads/master
2020-04-02T06:37:16.123268
2018-10-17T17:04:57
2018-10-17T17:04:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,755
java
/* * This software was published under the MIT License. * The full LICENSE file can be found here: https://github.com/edgelord314/salty-enigne/tree/master/LICENSE * * Copyright (c) 2018 Malte Dostal * * Permission is hereby granted, free of charge, to any person 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, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * 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 de.edgelord.saltyengine.core.stereotypes; import de.edgelord.saltyengine.core.Component; import de.edgelord.saltyengine.core.Game; import de.edgelord.saltyengine.core.interfaces.TransformedObject; import de.edgelord.saltyengine.graphics.SaltyGraphics; import de.edgelord.saltyengine.transform.Transform; import java.util.List; public abstract class ComponentParent implements TransformedObject { private String tag; public ComponentParent(String tag) { this.tag = tag; } /** * Adds the given {@link Component} * * @param component the component to add */ public abstract void addComponent(Component component); /** * Removes a {@link Component} by searching for the one with the given name * and remove that one * * @param identifier the identifier of the component to be removed */ public abstract void removeComponent(String identifier); /** * Removes the given {@link Component} * The implementation should be different from {@link #getComponent(String)} * due to better performance possible when directly removing a Component * * @param component the {@link Component} to be removed */ public abstract void removeComponent(Component component); /** * Returns the {@link List} of {@link Component}s * * @return the {@link List} of {@link Component}s */ public abstract List<Component> getComponents(); /** * Returns the {@link Component} with the given identifier * * @param identifier the identifier of the {@link Component} to be returned * @return the requested {@link Component} */ public abstract Component getComponent(String identifier); /** * Calls the method {@link Component#onFixedTick()} for every {@link Component}. */ public void doComponentOnFixedTick() { getComponents().forEach(component -> { if (component.isEnabled()) { component.onFixedTick(); } }); } /** * Calls the method {@link Component#draw(SaltyGraphics)} for every component with the given {@link SaltyGraphics} * * @param graphics the graphics context to draw the components */ public void doComponentDrawing(SaltyGraphics graphics) { getComponents().forEach(component -> { if (component.isEnabled()) { component.draw(graphics); } }); } /** * Places this object in the middle of the {@link de.edgelord.saltyengine.core.Host} {@link Game#host} */ public void centrePosition() { setPosition(Game.getHost().getCentrePosition(getDimensions())); } /** * Centres this object horizontally in the {@link de.edgelord.saltyengine.core.Host} {@link Game#host} */ public void centreHorizontalPosition() { setX(Game.getHost().getHorizontalCentrePosition(getWidth())); } /** * Centres this object vertically in the {@link de.edgelord.saltyengine.core.Host} {@link Game#host} */ public void centreVerticalPosition() { setX(Game.getHost().getVerticalCentrePosition(getHeight())); } @Override public abstract Transform getTransform(); @Override public abstract void setTransform(Transform transform); public String getTag() { return tag; } public void setTag(String tag) { this.tag = tag; } }
7efeff6b5c5052a3b9d1a82feee668ef8d014fe3
20b535a4f3d4f5ed3948368ca2b521f295346710
/src/main/java/com/springsource/roo/pizzashop/service/ToppingService.java
3c65615c8f1d81d118341daf0024eda5d81d51df
[]
no_license
attilacsanyi/pizzashop-security
4dc82a7243e04f4f576f8a5b6e758522283fa0d9
6c400a050d76077b9551f4f4dcac18f567473b1f
refs/heads/master
2021-01-01T15:50:36.132067
2014-04-04T09:49:10
2014-04-04T09:49:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
233
java
package com.springsource.roo.pizzashop.service; import org.springframework.roo.addon.layers.service.RooService; @RooService(domainTypes = { com.springsource.roo.pizzashop.domain.Topping.class }) public interface ToppingService { }
97b329d0e93ab72db253ee38f1d96c4db0e4ac52
896d7778467067b30e414a68288b8446168bf97a
/common/am/lib/src/main/java/org/apache/syncope/common/lib/to/AttrRepoTO.java
93cf989b5065b98072bd036d69f48cba1866a534
[ "Apache-2.0" ]
permissive
andrea-patricelli/syncope
a87fa9e798f9056f6944d1ffdefb13791a372b09
56fb5f5eaf86c5fc10cc0afa86dd4ef5f90b9f50
refs/heads/master
2023-05-05T01:18:43.168406
2022-09-21T06:44:40
2022-09-21T07:12:26
43,677,729
0
0
null
null
null
null
UTF-8
Java
false
false
3,323
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.syncope.common.lib.to; import java.util.ArrayList; import java.util.List; import javax.ws.rs.PathParam; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.syncope.common.lib.attr.AttrRepoConf; import org.apache.syncope.common.lib.types.AttrRepoState; public class AttrRepoTO implements EntityTO { private static final long serialVersionUID = -7490425997956703057L; private String key; private String description; private AttrRepoState state = AttrRepoState.ACTIVE; private int order = 0; private final List<Item> items = new ArrayList<>(); private AttrRepoConf conf; @Override public String getKey() { return key; } @PathParam("key") @Override public void setKey(final String key) { this.key = key; } public String getDescription() { return description; } public void setDescription(final String description) { this.description = description; } public AttrRepoState getState() { return state; } public void setState(final AttrRepoState state) { this.state = state; } public int getOrder() { return order; } public void setOrder(final int order) { this.order = order; } public List<Item> getItems() { return items; } public AttrRepoConf getConf() { return conf; } public void setConf(final AttrRepoConf conf) { this.conf = conf; } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AttrRepoTO other = (AttrRepoTO) obj; return new EqualsBuilder(). append(key, other.key). append(description, other.description). append(state, other.state). append(order, other.order). append(items, other.items). append(conf, other.conf). build(); } @Override public int hashCode() { return new HashCodeBuilder(). append(key). append(description). append(state). append(order). append(items). append(conf). build(); } }
1a6c1a120250b254b3b7163a3cbe4a6e8cccff51
112d0d3d69ef5143be577fe45d0fdf2427822098
/sistema-facturacion-rest/src/main/java/com/homeoffice/sistema/facturacion/servicios/implementacion/CategoriaServicioImpl.java
4573a27976dfdc8cb8a5a62c273844c2dbeb402b
[]
no_license
sebasdiaz67/sistema-facturacion-rest
3fc899d13307183004b23ea5d2a87a6d1a87ece6
c43c33a4f566abfd9d7177e2a5bd7929b104f16d
refs/heads/master
2022-09-15T19:36:37.448675
2020-06-01T04:33:20
2020-06-01T04:33:20
267,491,938
0
0
null
null
null
null
UTF-8
Java
false
false
1,447
java
package com.homeoffice.sistema.facturacion.servicios.implementacion; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.homeoffice.sistema.facturacion.modelo.entidades.Categoria; import com.homeoffice.sistema.facturacion.modelo.repositorio.CategoriaRepositorio; import com.homeoffice.sistema.facturacion.servicios.CategoriaServicio; /** * <p> * Clase que define la clase del servicio categoria * </p> * * @author Sebastian Rosero Diaz * @fechaCreacion 27/05/2020 * @version 1.0 * */ @Service public class CategoriaServicioImpl implements CategoriaServicio { @Autowired private CategoriaRepositorio categoriaRepositorio; @Override @Transactional(readOnly = true) public List<Categoria> buscarTodo() { return categoriaRepositorio.findAll(); } @Override @Transactional(readOnly = true) public Page<Categoria> buscarTodo(Pageable pageable) { return categoriaRepositorio.findAll(pageable); } @Override @Transactional(readOnly = true) public Categoria buscarPorId(Long id) { return categoriaRepositorio.findById(id).orElse(null); } @Override @Transactional public Categoria guardar(Categoria categoria) { return categoriaRepositorio.save(categoria); } }
efd7a9736469a39c29a5d475a2787459ded9d36b
f8f32a589736a1e8cbec7e3601de8f6fc572c43c
/src/com/book/servlet/BookCategoryServlet.java
fb41daa9faf08bc9d54337991601ff0fa8fd0921
[]
no_license
myischenxiaohua/book
1cad197eb4004191520f65c9a8bbbb298ef57868
ae89edc645adf5d9b82a0e46a5d9173d5cdfe316
refs/heads/master
2020-04-13T20:11:50.186545
2019-03-19T13:54:38
2019-03-19T13:54:38
163,423,734
2
0
null
null
null
null
UTF-8
Java
false
false
2,032
java
package com.book.servlet; import com.book.domian.BookCategory; import com.book.service.impl.BookCategoryServiceImpl; import com.book.util.WebUtils; import org.json.JSONArray; import org.json.JSONObject; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; /* ClassName:${PACKAGE_NAME} Description: User: [email protected] Date: 2019-01-23 Time: 17:14 */ public class BookCategoryServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request,response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String status=request.getRequestURI().substring(request.getRequestURI().lastIndexOf("/")+1); System.out.println(status); switch (status){ case "add":add(request,response);break; case "list":list(request,response);break; } } public void add(HttpServletRequest request, HttpServletResponse response){} public void list(HttpServletRequest request, HttpServletResponse response){ try { if(WebUtils.validateEmpty(request.getParameter("ajax"))){ JSONArray jsonArray=new JSONArray(); //response.getWriter().print(jsonArray.toString()); // String jsonStr=""; // for (BookCategory bc : new BookCategoryServiceImpl().list()){ jsonArray.put(new JSONObject(bc)); } JSONObject jsonObject=new JSONObject(); jsonObject.put("status",1); jsonObject.put("data",jsonArray); response.getWriter().print(jsonObject.toString()); } } catch (Exception e) { e.printStackTrace(); } } }
2bfbfa3efab272217ac7ee42a18fdb6e0167d972
2e1e0c4c3fedb860de9a258e0d3c6e16c8df6139
/app/src/main/java/com/wy/djreader/utils/message/MessageManager.java
e73039937b35a7db2255c74608a2f585249c2858
[]
no_license
Entropless/DJReader
d7d9f147cdef5aa92ccf3de6c2e82fc106293316
96549a94b0c458fc0268efd2d6399df542e5f767
refs/heads/master
2022-01-28T07:40:46.442361
2019-04-16T09:26:35
2019-04-16T09:26:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,439
java
package com.wy.djreader.utils.message; import android.os.Bundle; import android.os.Handler; import android.os.Message; /** * 使用建造者模式构建消息管理类 * @author wy */ public class MessageManager { private Handler handler; private int what; private int arg1; private int arg2; private Object object; private Bundle data; public MessageManager() { this(new MessageBuilder()); } MessageManager(MessageBuilder builder){ this.handler = builder.handler; this.what = builder.what; this.arg1 = builder.arg1; this.arg2 = builder.arg2; this.object = builder.object; this.data = builder.bundle; } public static class MessageBuilder{ Handler handler; int what,arg1,arg2; Object object; Bundle bundle; public MessageBuilder() { } MessageBuilder(MessageManager msg){ this.handler = msg.handler; this.what = msg.what; this.arg1 = msg.arg1; this.arg2 = msg.arg2; this.bundle = msg.data; this.object = msg.object; } public MessageBuilder setHandler(Handler handler){ this.handler = handler; return this; } public MessageBuilder setWhat(int what){ this.what = what; return this; } public MessageBuilder setArg1(int Arg1){ this.arg1 = arg1; return this; } public MessageBuilder setArg2(int Arg2){ this.arg2 = arg2; return this; } public MessageBuilder setObject(Object object){ this.object = object; return this; } public MessageBuilder setBundle(Bundle bundle){ this.bundle = bundle; return this; } public MessageManager build(){ if (handler == null) throw new IllegalStateException("handler == null"); return new MessageManager(this); } } public void sendMessage(){ if (null == handler) return; Message msg = handler.obtainMessage(); msg.what = what; msg.arg1 = arg1; msg.arg2 = arg2; if (object != null){ msg.obj = object; } if (data != null) { msg.setData(data); } handler.sendMessage(msg); } }
ceaed815cad770e8d1af8cc297ba9ce923a414e7
954243429ec23172daeb16d72ee783fa231c9575
/src/main/java/dik/library/reactiverepo/AuthorReactiveRepository.java
deac4b9b11ee0e111e74b2b007e6dea2d7785aaf
[]
no_license
realcorwin/library
56549d9c34f339a7637b5993cbbb11a1aa33e308
cb67e9cf7b9509721d938f2267814edb920f710b
refs/heads/master
2020-04-14T18:33:49.310911
2019-03-15T22:08:58
2019-03-15T22:08:58
164,023,990
0
1
null
2019-04-24T17:55:48
2019-01-03T21:19:12
Java
UTF-8
Java
false
false
345
java
package dik.library.reactiverepo; import dik.library.model.Author; import org.springframework.data.mongodb.repository.ReactiveMongoRepository; import reactor.core.publisher.Mono; public interface AuthorReactiveRepository extends ReactiveMongoRepository<Author, String>, AuthorReactiveRepositoryCustom { Mono<Void> deleteById(String id); }
9f62cb7074242e9a3e2806b9784ef8ccf9835812
0d1dbe6c4563ca67f9a79c13c49ecce50e3ef060
/oto_all/oto/src/main/java/edu/arizona/biosemantics/oto/oto/beans/UserStatisticsBean.java
08d5113109b8e3ffddb39a065df1ce6b24462483
[]
no_license
rodenhausen/andrew_backup
4301876767c0eff6a1fb66b4f4c7d4caf9177368
da39edffa08cad6d3ca9bf2f0e047ba4c7732216
refs/heads/master
2021-01-20T11:30:37.067858
2015-03-02T18:22:47
2015-03-02T18:22:47
31,552,041
0
0
null
null
null
null
UTF-8
Java
false
false
910
java
package edu.arizona.biosemantics.oto.oto.beans; public class UserStatisticsBean { private int userid; private String userName; private int count; private int count_decidedTerms; public UserStatisticsBean(int userid, String username, int count) { this.userid = userid; this.userName = username; this.count = count; } public int getUserid() { return userid; } public void setUserid(int userid) { this.userid = userid; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public int getCount() { return count; } public void setCount(int count) { this.count = count; } public int getCount_decidedTerms() { return count_decidedTerms; } public void setCount_decidedTerms(int count_decidedTerms) { this.count_decidedTerms = count_decidedTerms; } }
e8d06d82f80ce6f8909d6c95def16542406395c4
288384bf30fa240c2e1acce356e6a6fb4bba851e
/src/main/java/com/fairmusic/artist/controller/CompareKKServlet.java
02dc7ce3c2deb2281cd22d21e1b03138a6104267
[]
no_license
wooheet/musicinblockchain
6cd9644dfb3e91178998a4a6d778edf08cb2da72
10b3d8b3f0152b8e2ee0fcae24f518252473dc48
refs/heads/master
2021-01-01T17:53:38.221144
2017-08-31T14:53:42
2017-08-31T14:53:42
98,190,870
0
0
null
null
null
null
UHC
Java
false
false
1,710
java
package com.fairmusic.artist.controller; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.fairmusic.artist.service.ArtistServiceimpl; import com.fairmusic.dto.artistDTO; @WebServlet(name = "compare_kk", urlPatterns = { "/compare_kk.do" }) public class CompareKKServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("카톡 compare 서블릿 실행~"); response.setContentType("text/html;charset=euc-kr"); response.setHeader("cache-control", "no-cache, no-store"); PrintWriter pw = response.getWriter(); String code = request.getParameter("code"); String name = request.getParameter("name"); String state = request.getParameter("state"); System.out.println("비교 서블릿 코드"+code); System.out.println("name : " +name); System.out.println("state : "+state); ArtistServiceimpl service = new ArtistServiceimpl(); boolean compare = service.emailCheck(code); artistDTO dto = new artistDTO(code, "", "", name, null, null, "1"); String rdpath = null; if (compare == true) { rdpath = "login-no-sidebar.jsp"; } else { int result = service.regist(dto); System.out.println(result+"명 삽입성공 ("+code+","+name+")"); rdpath = "login-no-sidebar.jsp"; } RequestDispatcher rd = request .getRequestDispatcher(rdpath); rd.forward(request, response); } }
[ "godjs@DESKTOP-A52GUHO" ]
godjs@DESKTOP-A52GUHO
e0327d2cdbf062b4ac103f1bb7b37f9635347c8c
cd4802766531a9ccf0fb54ca4b8ea4ddc15e31b5
/dist/game/data/scripts/quests/Q10758_TheOathOfTheWind/Q10758_TheOathOfTheWind.java
006bed445bc4910c263f2232a8189bf4015c4736
[]
no_license
singto53/underground
8933179b0d72418f4b9dc483a8f8998ef5268e3e
94264f5168165f0b17cc040955d4afd0ba436557
refs/heads/master
2021-01-13T10:30:20.094599
2016-12-11T20:32:47
2016-12-11T20:32:47
76,455,182
0
1
null
null
null
null
UTF-8
Java
false
false
3,673
java
/* * This file is part of the L2J Mobius project. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package quests.Q10758_TheOathOfTheWind; import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.quest.Quest; import com.l2jmobius.gameserver.model.quest.QuestState; import com.l2jmobius.gameserver.model.quest.State; import com.l2jmobius.gameserver.network.NpcStringId; import quests.Q10757_QuietingTheStorm.Q10757_QuietingTheStorm; /** * The Oath of the Wind (10758) * @author malyelfik */ public final class Q10758_TheOathOfTheWind extends Quest { // NPC private static final int PIO = 33963; // Monster private static final int WINDIMA = 27522; // Misc private static final int MIN_LEVEL = 28; public Q10758_TheOathOfTheWind() { super(10758); addStartNpc(PIO); addTalkId(PIO); addSpawnId(WINDIMA); addKillId(WINDIMA); addCondRace(Race.ERTHEIA, "33963-00.htm"); addCondMinLevel(MIN_LEVEL, "33963-00.htm"); addCondCompletedQuest(Q10757_QuietingTheStorm.class.getSimpleName(), "33963-00.htm"); } @Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, false); if (qs == null) { return null; } String htmltext = event; switch (event) { case "33963-01.htm": case "33963-02.htm": break; case "33963-03.htm": { qs.startQuest(); break; } case "SPAWN": { if (qs.isCond(1)) { final L2Npc mob = addSpawn(WINDIMA, -93427, 89595, -3216, 0, true, 180000); addAttackPlayerDesire(mob, player); } htmltext = null; break; } case "33963-06.html": { if (qs.isCond(2)) { giveStoryQuestReward(player, 3); addExpAndSp(player, 561645, 134); qs.exitQuest(false, true); } break; } default: htmltext = null; } return htmltext; } @Override public String onTalk(L2Npc npc, L2PcInstance player) { final QuestState qs = getQuestState(player, true); String htmltext = getNoQuestMsg(player); switch (qs.getState()) { case State.CREATED: htmltext = "33963-01.htm"; break; case State.STARTED: htmltext = (qs.isCond(1)) ? "33963-04.html" : "33963-05.html"; break; case State.COMPLETED: htmltext = getAlreadyCompletedMsg(player); break; } return htmltext; } @Override public String onSpawn(L2Npc npc) { npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ARGHH); return super.onSpawn(npc); } @Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { final QuestState qs = getQuestState(killer, false); if ((qs != null) && qs.isCond(1)) { qs.setCond(2, true); } npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_AM_LOYAL_TO_YOU_MASTER_OF_THE_WINDS_AND_LOYAL_I_SHALL_REMAIN_IF_MY_VERY_SOUL_BETRAYS_ME); return super.onKill(npc, killer, isSummon); } }
[ "MobiusDev@7325c9f8-25fd-504a-9f63-8876acdc129b" ]
MobiusDev@7325c9f8-25fd-504a-9f63-8876acdc129b
1b8a2f20f14f9ee3153805cdbe7693c5bea2a753
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/6/6_7532b921b64d0f9159adb4080422cb222237a131/RuleFileGenerator/6_7532b921b64d0f9159adb4080422cb222237a131_RuleFileGenerator_s.java
2bae8170b95e64a6aa8a41744f5f1f79f95e0e12
[]
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
14,619
java
/* * @(#)$Id$ * * Copyright 2001 Sun Microsystems, Inc. All Rights Reserved. * * This software is the proprietary information of Sun Microsystems, Inc. * Use is subject to license terms. * */ package com.sun.tahiti.compiler.ll; import com.sun.msv.datatype.xsd.XSDatatype; import com.sun.msv.grammar.*; import com.sun.msv.grammar.util.ExpressionWalker; import com.sun.tahiti.compiler.XMLWriter; import com.sun.tahiti.compiler.Symbolizer; import com.sun.tahiti.grammar.*; import com.sun.tahiti.reader.TypeUtil; import org.relaxng.datatype.Datatype; import org.xml.sax.DocumentHandler; import org.xml.sax.SAXException; import java.io.PrintStream; import java.util.Map; import java.util.Set; import java.util.Iterator; import java.text.MessageFormat; public class RuleFileGenerator implements Symbolizer { private RuleFileGenerator() {} /** * * @param grammar * Grammar object to be generated as a Java source code. * @param rules * production rules of the grammar. Actual type must be * non-terminal -> Rule[]. * @param grammarClassName * the fully-qualified name of the class that is going to be generated. * @param outHandler * Generated source code will be sent to this handler. * * @return * return a symbolizer that is necessary to serialize class definitions. */ public static Symbolizer generate( Grammar grammar, Map rules, String grammarClassName, DocumentHandler outHandler ) throws SAXException { RuleFileGenerator gen = new RuleFileGenerator(); gen._generate( grammar, rules, grammarClassName, outHandler ); return gen; } /** * this map serves as a dictionary to lookup the name of the given symbol. */ final Map allNames = new java.util.HashMap(); public String getId( Object symbol ) { if(symbol==null) return "null"; String s = (String)allNames.get(symbol); if(s==null) { System.out.println(symbol); assert(false); } return s; } private void _generate( Grammar grammar, Map rules, String grammarClassName, DocumentHandler outHandler ) throws SAXException { // add pre-defined special symbols. allNames.put( Expression.epsilon, "epsilon" ); try { final XMLWriter out = new XMLWriter(outHandler); outHandler.setDocumentLocator(new org.xml.sax.helpers.LocatorImpl()); outHandler.startDocument(); outHandler.processingInstruction("xml-stylesheet","type='text/xsl' href='../grammarDebug.xslt'"); out.start("grammar"); { int idx = grammarClassName.lastIndexOf('.'); if(idx<0) { out.element("name", grammarClassName); } else { out.element("package", grammarClassName.substring(0,idx)); out.start("name", grammarClassName.substring(idx+1)); } } // collect various primitives (a map to its name) //==================================================================== final Map elements = new java.util.HashMap(); // ElementExps final Map attributes = new java.util.HashMap(); // AttributeExps final Map datatypes = new java.util.HashMap(); // Datatypes final Map classes = new java.util.HashMap(); // ClassItems final Map fields = new java.util.HashMap(); // FieldItems final Map primitives = new java.util.HashMap(); // PrimitiveItems final Map ignores = new java.util.HashMap(); // IgnoreItems grammar.getTopLevel().visit( new ExpressionWalker(){ public void onElement( ElementExp exp ) { if(!elements.containsKey(exp)) { elements.put(exp,computeName(exp.getNameClass(),elements)); super.onElement(exp); } } public void onAttribute( AttributeExp exp ) { if(!attributes.containsKey(exp)) { attributes.put(exp,computeName(exp.nameClass,attributes)); super.onAttribute(exp); } } public void onTypedString( TypedStringExp exp ) { if(!datatypes.containsKey(exp)) { datatypes.put(exp,computeName(exp.dt,datatypes)); super.onTypedString(exp); } } public void onOther( OtherExp exp ) { if(exp instanceof ClassItem) { if(!classes.containsKey(exp)) { classes.put(exp,computeName((ClassItem)exp,classes)); super.onOther(exp); } return; } if(exp instanceof PrimitiveItem) { if(!primitives.containsKey(exp)) { primitives.put(exp,computeName((PrimitiveItem)exp,primitives)); super.onOther(exp); } return; } if(exp instanceof FieldItem) { if(!fields.containsKey(exp)) { fields.put(exp,computeName((FieldItem)exp,fields)); super.onOther(exp); } return; } if(exp instanceof IgnoreItem) { if(!ignores.containsKey(exp)) { ignores.put(exp,computeName((IgnoreItem)exp,ignores)); super.onOther(exp); } return; } super.onOther(exp); } }); // assign names to intermediate non-terminals. //==================================================================== copyAll( elements, "E", allNames ); copyAll( attributes, "A", allNames ); copyAll( datatypes, "D", allNames ); copyAll( classes, "C", allNames ); copyAll( fields, "N", allNames ); copyAll( primitives, "P", allNames ); copyAll( ignores, "Ignore", allNames ); final ElementExp[] elms = (ElementExp[])elements.keySet().toArray(new ElementExp[0]); final AttributeExp[] atts = (AttributeExp[])attributes.keySet().toArray(new AttributeExp[0]); final TypedStringExp[] dts = (TypedStringExp[])datatypes.keySet().toArray(new TypedStringExp[0]); final ClassItem[] cis = (ClassItem[])classes.keySet().toArray(new ClassItem[0]); final FieldItem[] fis = (FieldItem[])fields.keySet().toArray(new FieldItem[0]); final PrimitiveItem[] pis = (PrimitiveItem[])primitives.keySet().toArray(new PrimitiveItem[0]); final IgnoreItem[] iis = (IgnoreItem[])ignores.keySet().toArray(new IgnoreItem[0]); for( int i=0; i<dts.length; i++ ) { // TODO: serious implementation out.start( "dataSymbol", new String[]{ "id",(String)allNames.get(dts[i])}); out.element("library", dts[i].name.namespaceURI ); out.element("name", dts[i].name.localName ); out.end("dataSymbol"); // "type", ((XSDatatype)dts[i].dt).getConcreteType().getName() // } ); } for( int i=0; i<cis.length; i++ ) { out.element( "classSymbol", new String[]{ "id",(String)allNames.get(cis[i]), "type",(String)cis[i].getTypeName() } ); } for( int i=0; i<pis.length; i++ ) out.element( "primitiveSymbol", new String[]{"id",(String)allNames.get(pis[i])} ); for( int i=0; i<fis.length; i++ ) out.element( "namedSymbol", new String[]{"id",(String)allNames.get(fis[i])} ); for( int i=0; i<iis.length; i++ ) out.element( "ignoreSymbol", new String[]{"id",(String)allNames.get(iis[i])} ); {// generate intermediate symbols. int cnt=1; for( Iterator itr = rules.keySet().iterator(); itr.hasNext(); ) { Expression symbol = (Expression)itr.next(); if(!allNames.containsKey(symbol)) { out.element( "intermediateSymbol", new String[]{"id","T"+cnt}); allNames.put( symbol, "T"+cnt ); cnt++; } } } {// write all rules int rcounter = 0; Iterator itr = rules.keySet().iterator(); while(itr.hasNext()) { Expression nonTerminal = (Expression)itr.next(); out.start("rules", new String[]{"nonTerminal",getId(nonTerminal)}); Rule[] rs = (Rule[])rules.get(nonTerminal); for( int j=0; j<rs.length; j++ ) { // name this rule. allNames.put( rs[j], "r"+(rcounter++) ); // write this rule rs[j].write(out,this); } out.end("rules"); } } // generate a source code that constructs the grammar. //============================================================== ExpressionSerializer eser = new ExpressionSerializer(this,out); /* visit all elements and attributes to compute the dependency between expressions. */ for( int i=0; i<atts.length; i++ ) { atts[i].exp.visit(eser.sequencer); eser.assignId( atts[i] ); // attributes are serialized just like other particles. } for( int i=0; i<elms.length; i++ ) elms[i].contentModel.visit(eser.sequencer); // ... and don't forget to visit top level expression. grammar.getTopLevel().visit(eser.sequencer); // then obtain the serialization order by creating a map from id to expr. java.util.TreeMap id2expr = new java.util.TreeMap(); for( Iterator itr=eser.sharedExps.iterator(); itr.hasNext(); ) { Expression exp = (Expression)itr.next(); id2expr.put( eser.expr2id.get(exp), exp ); } // then serialize shared expressions for( Iterator itr=id2expr.keySet().iterator(); itr.hasNext(); ) { Integer n = (Integer)itr.next(); Expression exp = (Expression)id2expr.get(n); if( exp instanceof AttributeExp ) { AttributeExp aexp = (AttributeExp)exp; out.start( "attributeSymbol", new String[]{"id",(String)allNames.get(aexp)} ); ExpressionSerializer.serializeNameClass(aexp.getNameClass(),out); out.start("content"); aexp.visit(eser.serializer); out.end("content"); LLTableCalculator.calc( aexp, rules, grammar.getPool(),this ).write(out,this); out.end("attributeSymbol"); } else { // other normal particles. out.start("particle",new String[]{"id","o"+n}); exp.visit(eser.serializer); out.end("particle"); } } // elements are serialized at last. for( int i=0; i<elms.length; i++ ) { out.start("elementSymbol", new String[]{"id",(String)allNames.get(elms[i])} ); ExpressionSerializer.serializeNameClass(elms[i].getNameClass(),out); out.start("content"); elms[i].visit(eser.serializer); out.end("content"); LLTableCalculator.calc( elms[i], rules, grammar.getPool(),this ).write(out,this); out.end("elementSymbol"); } if( elements.containsKey(grammar.getTopLevel()) ) { // if the top-level expression is element symbol, // then we don't need the root grammar. out.start("topLevel"); out.start("content"); eser.serialize(grammar.getTopLevel()); out.end("content"); out.end("topLevel"); } else { // serialize top-level expression out.start("topLevel",new String[]{"id",getId(grammar.getTopLevel())}); out.start("content"); grammar.getTopLevel().visit(eser.serializer); out.end("content"); LLTableCalculator.calc( grammar.getTopLevel(), rules, grammar.getPool(),this ).write(out,this); out.end("topLevel"); } {// compute the base type of possible top-level classes final Set rootClasses = new java.util.HashSet(); grammar.getTopLevel().visit( new ExpressionWalker(){ private Set visitedExps = new java.util.HashSet(); public void onOther( OtherExp exp ) { if( exp instanceof TypeItem ) rootClasses.add(exp); // we don't need to parse inside a JavaItem. } public void onElement( ElementExp exp ) { if( visitedExps.add(exp) ) exp.contentModel.visit(this); } }); Type rootType = TypeUtil.getCommonBaseType(rootClasses); out.element("rootType", new String[]{"name", rootType.getTypeName()}); } out.end("grammar"); outHandler.endDocument(); } catch( XMLWriter.SAXWrapper w ) { throw w.e; }; } /** * copy the source map to the destination map, while adding * the specified prefix to values. */ private static void copyAll( Map src, String prefix, Map dst ) { for( Iterator itr=src.keySet().iterator(); itr.hasNext(); ) { Object symbol = itr.next(); dst.put( symbol, prefix+src.get(symbol) ); } } /** * computes a unique name that is used as a field name for * the ElementExp/AttributeExp. * * @param nc * name class of that ElementExp/AttributeExp. * @param m * values of this map are the names of other ElementExp/AttributeExps. * This method has to return the unique name. */ private static String computeName( NameClass nc, Map m ) { if( nc instanceof SimpleNameClass ) { SimpleNameClass snc = (SimpleNameClass)nc; if(!m.containsValue(snc.localName)) return snc.localName; return getNumberedName( snc.localName, 2, m ); } else { return getNumberedName( "", 0, m ); } } /** * generate an unique name by concatenating a number to its tail. */ private static String getNumberedName( String prefix, int count, Map m ) { while(m.containsValue( prefix+Integer.toString(count) )) count++; return prefix+Integer.toString(count); } /** * computes a unique name that is used as a field name for * the Datatype. * * @param dt * Datatype object. * @param m * values of this map are the names of other ElementExp/AttributeExps. * This method has to return the unique name. */ private static String computeName( Datatype dt, Map m ) { if( dt instanceof XSDatatype ) { XSDatatype xsdt = (XSDatatype)dt; if( xsdt.getName()!=null && !m.containsValue(xsdt.getName()) ) return xsdt.getName(); return getNumberedName( xsdt.getConcreteType().getName(), 2, m ); } return getNumberedName( "", 0, m ); } private static String computeName( ClassItem cls, Map m ) { String name = cls.getBareName(); if(!m.containsValue(name)) return name; return getNumberedName( name, 2, m ); } private static String computeName( PrimitiveItem pitm, Map m ) { String name = pitm.type.getBareName(); if(!m.containsValue(name)) return name; return getNumberedName( name, 2, m ); } private static String computeName( FieldItem field, Map m ) { if(!m.containsValue(field.name)) return field.name; return getNumberedName( field.name, 2, m ); } private static String computeName( IgnoreItem iim, Map m ) { return getNumberedName( "", 1, m ); } /** * gets the source code representation of the specified string. */ private static String javaStringEscape( String s ) { // throw new Error(); return "\""+s+"\""; } private static void assert( boolean b ) { if(!b) throw new Error(); } }
b66ea2db08cca3aa59e3eb18fc70d97361013a30
aab4259e08981c075134196c4092bda0730e1e37
/app/src/main/java/com/vastinc/daggerquotesapp/di/ViewModelKey.java
80e595f842a9d97f957fba84e695d517b9efa0c9
[]
no_license
olaitanade/dagger2-mvvm-quotesapp-java
03b56ce357ec23f9f4a2e331875ef6267487de0d
aa753582b79b1aaf9f643c5f963a54db54e7d7f5
refs/heads/master
2023-04-28T19:05:36.369553
2021-05-20T13:18:53
2021-05-20T13:18:53
364,160,243
1
0
null
null
null
null
UTF-8
Java
false
false
465
java
package com.vastinc.daggerquotesapp.di; import androidx.lifecycle.ViewModel; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import dagger.MapKey; @Documented @Target({ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) @MapKey public @interface ViewModelKey { Class<? extends ViewModel> value(); }
[ "olaitan.adetayo.com" ]
olaitan.adetayo.com
490bdb26b82a6d584c2bae2b7f606a1151f895e3
3786d8a7f80c72fa3d77e510b6c409776cc0ddf0
/Task 4 - Main.java
ed45002cf0f80126638218d9d98932057bddff80
[]
no_license
safordog/Java-OOP-HW9
18b335187ee66843db1f902abb65bbce65bdd7ef
8e3de430744fa46a960e0031cc94ef5f8a477537
refs/heads/master
2020-03-26T20:06:04.613450
2018-08-19T13:20:46
2018-08-19T13:20:46
145,304,575
0
0
null
null
null
null
UTF-8
Java
false
false
1,589
java
/* * Шелдон, Леонард, Воловиц, Кутрапалли и Пенни стоят в очереди * за «двойной колой». Как только человек выпьет такой колы, он * раздваивается и оба становятся в конец очереди, чтобы выпить еще * стаканчик. Напишите программу, которая выведет на экран * состояние очереди в зависимости от того, сколько стаканов колы * выдал аппарат с чудесным напитком. Например, если было выдано * только два стакана, то очередь выглядит как: * [Volovitc, Kutrapalli, Penny, Sheldon, Sheldon, Leonard, Leonard] */ package homework9a; import java.util.ArrayDeque; /** * * @author safordog */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here getQueue(2); } public static void getQueue(int num) { ArrayDeque<String> arr = new ArrayDeque<String>(); arr.push("Penny"); arr.push("Kutrapalli"); arr.push("Volovitc"); arr.push("Leonard"); arr.push("Sheldon"); for (int i = 0; i < num; i++) { arr.addLast(arr.getFirst()); arr.addLast(arr.removeFirst()); } arr.forEach((temp) -> System.out.println(temp)); } }
29cf9cd39c7fef0b7791dff1ce4d5e0d6e2f5bb2
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/AsyncHttpClient--async-http-client/eb136417465e13f0ba17c2ae8efdb9a45c22a315/before/NettyTransferListenerTest.java
7bd7d6856c035859fc992abe722de7eeb9ecfd40
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
1,160
java
/* * Copyright (c) 2010-2012 Sonatype, Inc. All rights reserved. * * This program is licensed to you under the Apache License Version 2.0, * and you may not use this file except in compliance with the Apache License Version 2.0. * You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0. * * Unless required by applicable law or agreed to in writing, * software distributed under the Apache License Version 2.0 is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Apache License Version 2.0 for the specific language governing permissions and limitations there under. */ package com.ning.http.client.async.netty; import com.ning.http.client.AsyncHttpClient; import com.ning.http.client.AsyncHttpClientConfig; import com.ning.http.client.async.ProviderUtil; import com.ning.http.client.async.TransferListenerTest; public class NettyTransferListenerTest extends TransferListenerTest { @Override public AsyncHttpClient getAsyncHttpClient(AsyncHttpClientConfig config) { return ProviderUtil.nettyProvider(config); } }
26a4a0bf519c27860935013c5a33495b08b87289
8d1a35b094b45a3f97bdcea57d92e87b7b0bad2c
/java_test/src/DesignPattern/Command/SimpleRemote/RemoteControlTest.java
5fb2a19ab84618f8869c8a0e84e3e5520ab12a5e
[]
no_license
gzltommy/design-paterns
141e36717f01f72a8d10944a753690e7dd0bf201
8c3f446c1680e1c3ffaa18c9b0d30cd2400cac17
refs/heads/master
2021-09-18T06:55:00.687690
2018-07-11T07:30:08
2018-07-11T07:30:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
847
java
package DesignPattern.Command.SimpleRemote; /** * Created by Administrator on 2018/4/13. */ public class RemoteControlTest { public static void main(String[] args) { //构建打开灯命令 Light light = new Light(); LightOnCommand lightOn = new LightOnCommand(light); //构建车库门打开命令 GarageDoor garageDoor = new GarageDoor(); GarageDoorOpenCommand garageDoorOpen = new GarageDoorOpenCommand(garageDoor); /*-----------------------------------------------------------------------*/ //简单遥控 SimpleRemoteControl remote = new SimpleRemoteControl(); //开灯 remote.setCommand(lightOn); remote.buttonWasPressed(); //开车库门 remote.setCommand(garageDoorOpen); remote.buttonWasPressed(); } }
6d0ddbf909c476d4e1be0c669287b6f865802179
65fed23fcd256e725480a0977d0c6aabac4a3809
/src/com/ds/azim/m_sort.java
21416d8efec84191a77d50215dae21b2c61fcc79
[]
no_license
azimshaik/dspract
58df0d1e7fe6827da3d759d87cd57e8549f0aab7
6a89be96357f901cbd7c2d95071149c0b2803c81
refs/heads/master
2021-01-13T03:13:20.109566
2016-12-30T16:23:21
2016-12-30T16:23:21
77,626,269
0
0
null
null
null
null
UTF-8
Java
false
false
1,074
java
package com.ds.azim; public class m_sort { public static void merg_helper(int[] a){ merge_sort(a,0,a.length-1); } public static void merge_sort(int[] a, int low, int high){ if(low>=high){ return; }else{ int mid = low/2 + high/2; merge_sort(a,low,mid); merge_sort(a,mid+1,high); merge(a,low,mid,high); } } public static void merge(int[] a, int low, int mid, int high){ int[] temp = new int[high-low+1]; int left = low; int right = mid+1; int k = 0; //index for the temp array while(left<=mid && right<=high){ if(a[left]<a[right]){ temp[k] = a[left]; left++; }else{ temp[k] = a[right]; right++; } k++; } if(left<=mid){ while(left<=mid){ temp[k] = a[left]; left++; k++; } }else{ while(right<=high){ temp[k] = a[right]; right++; k++; } } for(int i=0 ;i<temp.length;i++){ a[low+i] = temp[i]; } } public static void main(String[] args){ int[] a = {23,4,76,-7,-4}; merg_helper(a); for(int m=0 ; m<a.length; m++){ System.out.print(a[m]+","); } } }
cfe603f05c6c49c5e71238d2095fddaebeadd3cd
8f9f557728dbfc0a2d66d8d93f3c296bbaafcc1c
/app/src/main/java/com/why/newsbeat/ui/history/HistoryItemViewHolder.java
24133e62d7e97f202d18c3755f0fb987051c38c4
[]
no_license
hongyunwu/NewsBeat
5f25701d07c7f4922e70e8d8d729420b1bf3b6f1
5932225e3350241190825dbc856f92c24fb7debf
refs/heads/master
2021-01-22T00:52:20.054342
2019-10-10T03:21:52
2019-10-10T03:21:52
102,196,075
0
0
null
null
null
null
UTF-8
Java
false
false
961
java
package com.why.newsbeat.ui.history; import android.view.View; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.why.base.ui.BaseHolder; import com.why.newsbeat.R; import butterknife.BindView; /** * Created by lenovo on 2017/9/3. */ public class HistoryItemViewHolder extends BaseHolder { @BindView(R.id.item_top_news) LinearLayout item_top_news; @BindView(R.id.title) TextView title; @BindView(R.id.comments) TextView comments; @BindView(R.id.author) TextView author; @BindView(R.id.thumb_01) ImageView thumb_01; @BindView(R.id.delete) ImageView delete; ImageView thumb_02; ImageView thumb_03; /** * 此处使用butterKnife进行了view绑定操作 * * @param itemView */ public HistoryItemViewHolder(View itemView) { super(itemView); thumb_02 = (ImageView) itemView.findViewById(R.id.thumb_02); thumb_03 = (ImageView) itemView.findViewById(R.id.thumb_03); } }
48f11926fa29996d5aaa210d2cd54d635b5502cc
7eb04af401c447b8374aab386648af3ebabe87ef
/trustful-web-service/src/main/java/com/marksample/trustfulwebservice/SpringSecurityConfigBasic.java
017f3a05d2f7e4946404211fe3a1f183ebc196c1
[]
no_license
markbdsouza/SpringBoot-Angular-ToDo-Application
d2a755e258e3cdde04e44fb87b6680d223f72296
11382d971682038cee0a6c8e86750e3ae71a6e63
refs/heads/master
2020-12-14T13:25:55.062093
2020-01-18T16:09:44
2020-01-18T16:09:44
234,758,254
0
0
null
null
null
null
UTF-8
Java
false
false
904
java
package com.marksample.trustfulwebservice; import org.springframework.context.annotation.Configuration; import org.springframework.http.HttpMethod; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; @Configuration @EnableWebSecurity public class SpringSecurityConfigBasic extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable().authorizeRequests().antMatchers(HttpMethod.OPTIONS,"/**").permitAll() .anyRequest().authenticated().and()//.formLogin().and()) .httpBasic(); http.headers().frameOptions().disable(); } }
0636190cf7721c18ff390f9150ee0fe4132cbf9b
5a73698dad1d41e12c7b775fde6bfa2f7dad943a
/jhotdraw/src/main/java/org/jhotdraw/app/MenuBuilder.java
4f20cb9950aa687a8dd33daca3a7b44062095086
[]
no_license
harkomal-chana/tools
f8ed1c738708eb6040a12695895cb7b3bfbbb761
f7c53d1864fca555f0178e3061678602e26c3a48
refs/heads/master
2020-04-19T15:49:27.416108
2016-09-22T03:28:45
2016-09-22T03:28:45
66,535,135
0
1
null
null
null
null
UTF-8
Java
false
false
13,662
java
/* * @(#)MenuBuilder.java * * Copyright (c) 2010 The authors and contributors of JHotDraw. * * You may not use, copy or modify this file, except in compliance with the * accompanying license terms. */ package org.jhotdraw.app; import javax.annotation.Nullable; import java.util.List; import javax.swing.JMenu; /** * {@code MenuBuilder} is used by {@link Application} to build to build its menu * bar(s) and popup menu(s). * <p> * Each method adds a logical group of menu items to a menu provided by the * {@code Application}. * <p> * Implementors of this interface typically use actions retrieved from the * application to build the menu items. See {@link DefaultMenuBuilder} for a * typical implementation. * <p> * Menus may be associated to a specific view or to all views (global) of the * application. In the former case the corresponding view is provided, in the * latter case null is passed. Note that some applications, specifically * {@link OSXApplication}, need to create both kinds of menus. * <p> * During the lifetime of an application many menus may be created and destroyed. * Implementors must ensure that menu items can be garbage collected. * * <hr> * <b>Design Patterns</b> * * <p><em>Abstract Factory</em><br> * {@code MenuBuilder} is used by {@code Application} for creating menu items. * The {@code MenuBuilder} is provided by {@code ApplicationModel}. * Abstract Factory: {@link MenuBuilder}<br> * Client: {@link Application}. * <hr> * * @author Werner Randelshofer * @version $Id: MenuBuilder.java 791 2015-02-08 20:32:02Z rawcoder $ */ public interface MenuBuilder { /** Optionally adds one or more "Preferences" items to a menu. * <p> * Most applications use this method for adding items to the last section * of the "Edit" menu. * <p> * Note that {@link OSXApplication} does <b>not</b> invoke this method and * instead retrieves an action with ID {@code AbstractPreferencesAction.ID} * from the action map of the {@code ApplicationModel} and adds it to the * "Application" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addPreferencesItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more "Exit" items to a menu. * <p> * Most applications use this method for adding items to the last section * of the "File" menu. * <p> * Note that {@link OSXApplication} does <b>not</b> invoke this method and * instead retrieves an action with ID {@code ExitAction.ID} * from the action map of the {@code ApplicationModel} and adds it to the * "Application" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addExitItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more "Clear File" items to a menu. * <p> * Most applications use this method for adding items to the first section * of the "File" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addClearFileItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more "New Window" items to a menu. * <p> * Most applications use this method for adding items to the first section * of the "File" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addNewWindowItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more "New File" items to a menu. * <p> * Most applications use this method for adding items to the first section * of the "File" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addNewFileItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more "Load file" items to a menu. * <p> * Most applications use this method for adding items to the first section * of the "File" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addLoadFileItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more "Open File" items to a menu. * <p> * Most applications use this method for adding items to the first section * of the "File" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addOpenFileItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more "Close File" items to a menu. * <p> * Most applications use this method for adding items to the second section * of the "File" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addCloseFileItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more "Save File" items to a menu. * <p> * Most applications use this method for adding items to the second section * of the "File" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addSaveFileItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more "Export File" items to a menu. * <p> * Most applications use this method for adding items to the second section * of the "File" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addExportFileItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more "Print File" items to a menu. * <p> * Most applications use this method for adding items to the third section * of the "File" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addPrintFileItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more file related items to a menu. * <p> * Most applications use this method for adding items to the third section * of the "File" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addOtherFileItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more "Undo" items to a menu. * <p> * Most applications use this method for adding items to the first section * of the "Edit" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addUndoItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more "Clipboard" items to a menu. * <p> * Most applications use this method for adding items to the second section * of the "Edit" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addClipboardItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more "Selection" items to a menu. * <p> * Most applications use this method for adding items to the third section * of the "Edit" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addSelectionItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more "Find" items to a menu. * <p> * Most applications use this method for adding items to the fourth section * of the "Edit" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addFindItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more editing related items to a menu. * <p> * Most applications use this method for adding items to the fifth section * of the "Edit" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addOtherEditItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more view related items to a menu. * <p> * Most applications use this method for adding items to the first section * of the "View" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addOtherViewItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more additional menus to a menu bar or a pop up * menu. * <p> * Most applications add additional menus between the "View" menu and the * "Window" menu to the menu bar. * * @param m A (potentially non-empty) list of menus. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addOtherMenus(List<JMenu> m, Application app, @Nullable View v); /** Optionally adds one or more window related items to a menu. * <p> * Most applications use this method for adding items to the second section * of the "Window" menu. (The first section usually contains application * specific items). Some applications, such as {@link SDIApplication} add * these items to the "View" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addOtherWindowItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more "Help" items to a menu. * <p> * Most applications use this method for adding items to the first section * of the "Help" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addHelpItems(JMenu m, Application app, @Nullable View v); /** Optionally adds one or more "About" items to a menu. * <p> * Most applications use this method for adding items to the last section * of the "Help" menu. * <p> * Note that {@link OSXApplication} does <b>not</b> invoke this method and * instead retrieves an action with ID {@code AboutAction.ID} * from the action map of the {@code ApplicationModel} and adds it to the * "Application" menu. * * @param m A (potentially non-empty) menu. * @param app The Application for which the menu is built. * @param v A view the menu is used exclusively for a specific view, null * if the menu is shared by all views. */ void addAboutItems(JMenu m, Application app, @Nullable View v); }