blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
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
684M
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
132 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
28 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
352
e4fbb0a2c78335e72fd5100cdbff659f61ef167f
49897f43e5341a563d0a0952e6f9c3dbab7b0490
/app/src/main/java/com/example/secondlabandroid/organization/University.java
35e14562b7d1e068af4a7b5be58486f0114fd953
[]
no_license
Nastya-Lis/secondLabAndroid
3216f72bee3b560bd5fefc992765f7effa8d6abc
60109fb781e52ca048684a312189b1bf67b0f61c
refs/heads/master
2022-12-26T17:46:20.931619
2020-10-04T14:19:30
2020-10-04T14:19:30
299,843,028
0
0
null
null
null
null
UTF-8
Java
false
false
387
java
package com.example.secondlabandroid.organization; public enum University { BSTU("Here you can die"), BNTU("Chill"), BGU("There are successful people"), OTHER("Noname"); University(String shortDescribe){ describing = shortDescribe; } String describing; int count; public int getCount(){return count;} public void setCount(){count++;} }
b63585c13d750e7691a6b6588fb9c0e6406d2f15
b648206752b73eb20db7b9c3a0c403927237041b
/java/SyncCases/app/src/main/java/com/example/olivermensah/synccases/SplashActivity.java
24d3b62dc7fba03bf4b73bc14fab7aa3d4ce32d0
[]
no_license
OliverMensahDev/Android
e22cbdea32f43bcb190437001dc75289104cbf75
84062e4b8fc4d9cad0246f5fb159f9bdfb7b05f3
refs/heads/master
2021-10-22T08:26:39.923971
2019-03-09T10:01:50
2019-03-09T10:01:50
135,918,934
0
0
null
null
null
null
UTF-8
Java
false
false
1,382
java
package com.example.olivermensah.synccases; /** * Created by olivermensah on 12/3/17. */ import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; public class SplashActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { FirebaseUser currentUser = FirebaseAuth.getInstance().getCurrentUser(); if(currentUser != null){ Intent homeIntent = new Intent(SplashActivity.this, SignedInActivity.class); finish(); startActivity(homeIntent); }else{ Intent homeIntent = new Intent(SplashActivity.this, LoginActivity.class); finish(); startActivity(homeIntent); } } }, 3000); } // [START on_start_check_user] @Override public void onStart() { super.onStart(); } // [END on_start_check_user] }
5bbf9b3ebda5d3f9811426100094827aa63df2cf
4e3f175b329973f32d9a284219ea6343ea5b6b26
/src/main/java/org/example/exerciseOne/model/Truck.java
376104db6ac0905eb2fe3de0c254a655e2ed9cd8
[]
no_license
Benjamineboson/Inheritance_Exercises_Lexicon
1c77fdbded72895b975d240ee9a4342e074fdbe3
d4bf6420d3eef3d156fdfbddb0b50ccb070232f9
refs/heads/master
2023-01-02T12:18:02.824434
2020-04-17T09:39:08
2020-04-17T09:39:08
256,461,646
0
2
null
2020-10-13T21:16:22
2020-04-17T09:36:34
Java
UTF-8
Java
false
false
443
java
package org.example.exerciseOne.model; public class Truck extends Vehicle { private double maxWeight; private int maxSpeed; public Truck(int vehicleId, String brand, String regNum, double maxWeight, int maxSpeed){ super(vehicleId,brand,regNum); this.maxWeight = maxWeight; this.maxSpeed = maxSpeed; } @Override public void drive() { System.out.println("Truck is driving..."); } }
e1721b0b60e177f7c6abb56ae96d7ef2bbaa8db2
48eaf8db5c8a52ee746202b8e166bf3356554ff1
/Operations/nifi-ops/core/src/test/java/com/sequenceiq/cloudbreak/core/bootstrap/service/ClusterBootstrapperTest.java
dc4040589a1f15839df49627c26a9ff5e3f5e531
[ "Apache-2.0" ]
permissive
tspannhw/nifi-addons
4f87e41a5ee45d152c5c9d880695464032b07dd2
fd06d761e68baf207950730652d4a035e56278f4
refs/heads/master
2021-01-18T09:41:41.263741
2016-07-06T20:11:39
2016-07-06T20:11:39
62,816,041
1
0
null
2016-07-07T15:04:55
2016-07-07T15:04:54
null
UTF-8
Java
false
false
25,608
java
package com.sequenceiq.cloudbreak.core.bootstrap.service; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyLong; import static org.mockito.Matchers.anySet; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.HashSet; import java.util.Set; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; import com.sequenceiq.cloudbreak.TestUtil; import com.sequenceiq.cloudbreak.cloud.model.Platform; import com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException; import com.sequenceiq.cloudbreak.common.type.CloudConstants; import com.sequenceiq.cloudbreak.common.type.ScalingType; import com.sequenceiq.cloudbreak.core.CloudbreakException; import com.sequenceiq.cloudbreak.core.bootstrap.service.container.ContainerBootstrapApiCheckerTask; import com.sequenceiq.cloudbreak.core.bootstrap.service.container.ContainerClusterAvailabilityCheckerTask; import com.sequenceiq.cloudbreak.core.bootstrap.service.container.ContainerOrchestratorResolver; import com.sequenceiq.cloudbreak.core.bootstrap.service.host.HostBootstrapApiCheckerTask; import com.sequenceiq.cloudbreak.core.bootstrap.service.host.HostClusterAvailabilityCheckerTask; import com.sequenceiq.cloudbreak.core.bootstrap.service.host.HostOrchestratorResolver; import com.sequenceiq.cloudbreak.core.flow.context.ContainerBootstrapApiContext; import com.sequenceiq.cloudbreak.core.flow.context.ContainerOrchestratorClusterContext; import com.sequenceiq.cloudbreak.core.flow.context.HostBootstrapApiContext; import com.sequenceiq.cloudbreak.core.flow.context.HostOrchestratorClusterContext; import com.sequenceiq.cloudbreak.core.flow.context.StackScalingContext; import com.sequenceiq.cloudbreak.domain.InstanceMetaData; import com.sequenceiq.cloudbreak.domain.Orchestrator; import com.sequenceiq.cloudbreak.domain.Resource; import com.sequenceiq.cloudbreak.domain.Stack; import com.sequenceiq.cloudbreak.orchestrator.container.ContainerOrchestrator; import com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorCancelledException; import com.sequenceiq.cloudbreak.orchestrator.exception.CloudbreakOrchestratorFailedException; import com.sequenceiq.cloudbreak.orchestrator.host.HostOrchestrator; import com.sequenceiq.cloudbreak.orchestrator.model.ContainerConfig; import com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig; import com.sequenceiq.cloudbreak.orchestrator.model.Node; import com.sequenceiq.cloudbreak.orchestrator.state.ExitCriteriaModel; import com.sequenceiq.cloudbreak.repository.OrchestratorRepository; import com.sequenceiq.cloudbreak.repository.StackRepository; import com.sequenceiq.cloudbreak.service.PollingResult; import com.sequenceiq.cloudbreak.service.PollingService; import com.sequenceiq.cloudbreak.service.StatusCheckerTask; import com.sequenceiq.cloudbreak.service.TlsSecurityService; @RunWith(MockitoJUnitRunner.class) public class ClusterBootstrapperTest { private static final com.sequenceiq.cloudbreak.cloud.model.Platform GCP_PLATFORM = Platform.platform(CloudConstants.GCP); @Mock private StackRepository stackRepository; @Mock private OrchestratorRepository orchestratorRepository; @Mock private PollingService<ContainerBootstrapApiContext> containerBootstrapApiPollingService; @Mock private PollingService<HostBootstrapApiContext> hostBootstrapApiPollingService; @Mock private ContainerBootstrapApiCheckerTask containerBootstrapApiCheckerTask; @Mock private HostBootstrapApiCheckerTask hostBootstrapApiCheckerTask; @Mock private PollingService<ContainerOrchestratorClusterContext> containerClusterAvailabilityPollingService; @Mock private PollingService<HostOrchestratorClusterContext> hostClusterAvailabilityPollingService; @Mock private ContainerClusterAvailabilityCheckerTask containerClusterAvailabilityCheckerTask; @Mock private HostClusterAvailabilityCheckerTask hostClusterAvailabilityCheckerTask; @Mock private ClusterBootstrapperErrorHandler clusterBootstrapperErrorHandler; @Mock private ContainerOrchestratorResolver containerOrchestratorResolver; @Mock private HostOrchestratorResolver hostOrchestratorResolver; @Mock private TlsSecurityService tlsSecurityService; @Mock private ContainerConfigService containerConfigService; @Mock private HostServiceConfigService hostServiceConfigService; @Mock private OrchestratorTypeResolver orchestratorTypeResolver; @InjectMocks private ClusterBootstrapper underTest; @Before public void setUp() throws CloudbreakException { when(orchestratorTypeResolver.resolveType(anyString())).thenReturn(OrchestratorType.CONTAINER); ReflectionTestUtils.setField(containerConfigService, "munchausenImageName", "sequence/testcont:0.1.1"); } @Test public void bootstrapClusterWhenEverythingWorksNormally() throws CloudbreakException, CloudbreakOrchestratorFailedException { Stack stack = TestUtil.stack(); when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString())) .thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1")); when(containerOrchestratorResolver.get("SWARM")).thenReturn(new MockContainerOrchestrator()); when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.SUCCESS); when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.SUCCESS); doNothing().when(clusterBootstrapperErrorHandler) .terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), any(Set.class)); when(orchestratorRepository.save(any(Orchestrator.class))).thenReturn(new Orchestrator()); underTest.bootstrapContainers(stack); verify(tlsSecurityService, times(1)).buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString()); verify(clusterBootstrapperErrorHandler, times(0)) .terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), anySet()); verify(containerBootstrapApiPollingService, times(1)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(), anyInt()); verify(containerClusterAvailabilityPollingService, times(1)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt()); } @Test public void bootstrapClusterWhenTimeOutComesInClusterAvailabilityPoller() throws CloudbreakException, CloudbreakOrchestratorFailedException { Stack stack = TestUtil.stack(); when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString())) .thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1")); when(containerOrchestratorResolver.get("SWARM")).thenReturn(new MockContainerOrchestrator()); when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.SUCCESS); when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.TIMEOUT); doNothing().when(clusterBootstrapperErrorHandler) .terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), any(Set.class)); underTest.bootstrapContainers(stack); verify(tlsSecurityService, times(1)).buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString()); verify(clusterBootstrapperErrorHandler, times(1)) .terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), anySet()); verify(containerBootstrapApiPollingService, times(1)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(), anyInt()); verify(containerClusterAvailabilityPollingService, times(1)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt()); } @Test(expected = CancellationException.class) public void bootstrapClusterWhenOrchestratorDropCancelledException() throws CloudbreakException, CloudbreakOrchestratorFailedException { Stack stack = TestUtil.stack(); when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString())) .thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1")); when(containerOrchestratorResolver.get("SWARM")).thenReturn(new CancelledMockContainerOrchestrator()); when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.SUCCESS); when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.SUCCESS); doNothing().when(clusterBootstrapperErrorHandler) .terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), any(Set.class)); underTest.bootstrapContainers(stack); } @Test(expected = CloudbreakException.class) public void bootstrapClusterWhenOrchestratorDropFailedException() throws CloudbreakException, CloudbreakOrchestratorFailedException { Stack stack = TestUtil.stack(); when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString())) .thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1")); when(containerOrchestratorResolver.get("SWARM")).thenReturn(new FailedMockContainerOrchestrator()); when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.SUCCESS); when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.SUCCESS); doNothing().when(clusterBootstrapperErrorHandler) .terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), any(Set.class)); underTest.bootstrapContainers(stack); } @Test public void bootstrapClusterWhenEverythingWorksNormallyWithMoreBootstrapSegment() throws CloudbreakException, CloudbreakOrchestratorFailedException { Stack stack = TestUtil.stack(); when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString())) .thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1")); when(containerOrchestratorResolver.get("SWARM")).thenReturn(new TwoLengthMockContainerOrchestrator()); when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.SUCCESS); when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt())).thenReturn(PollingResult.SUCCESS); doNothing().when(clusterBootstrapperErrorHandler) .terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), any(Set.class)); underTest.bootstrapContainers(stack); verify(clusterBootstrapperErrorHandler, times(0)) .terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), anySet()); verify(tlsSecurityService, times(1)).buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString()); verify(containerBootstrapApiPollingService, times(1)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(), anyInt()); verify(containerClusterAvailabilityPollingService, times(3)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt()); } @Test public void bootstrapNewNodesInClusterWhenEverythingWorksNormally() throws CloudbreakException, CloudbreakOrchestratorFailedException { Stack stack = TestUtil.stack(); StackScalingContext context = new StackScalingContext(1L, GCP_PLATFORM, 2, "master1", new HashSet<Resource>(), ScalingType.UPSCALE_ONLY_STACK, getPrivateIps(stack)); when(stackRepository.findOneWithLists(anyLong())).thenReturn(stack); when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString())) .thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1")); when(containerOrchestratorResolver.get("SWARM")).thenReturn(new MockContainerOrchestrator()); when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.SUCCESS); when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.SUCCESS); doNothing().when(clusterBootstrapperErrorHandler) .terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), any(Set.class)); underTest.bootstrapNewNodes(context); verify(clusterBootstrapperErrorHandler, times(0)) .terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), anySet()); verify(tlsSecurityService, times(1)).buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString()); verify(containerClusterAvailabilityPollingService, times(2)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt()); } @Test public void bootstrapNewNodesInClusterWhenBootstrapHappeningInTwoSegments() throws CloudbreakException, CloudbreakOrchestratorFailedException { Stack stack = TestUtil.stack(); StackScalingContext context = new StackScalingContext(1L, GCP_PLATFORM, 2, "master1", new HashSet<Resource>(), ScalingType.UPSCALE_ONLY_STACK, getPrivateIps(stack)); when(stackRepository.findOneWithLists(anyLong())).thenReturn(stack); when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString())) .thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1")); when(containerOrchestratorResolver.get("SWARM")).thenReturn(new TwoLengthMockContainerOrchestrator()); when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.SUCCESS); when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.SUCCESS); doNothing().when(clusterBootstrapperErrorHandler) .terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), any(Set.class)); underTest.bootstrapNewNodes(context); verify(clusterBootstrapperErrorHandler, times(0)) .terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), anySet()); verify(tlsSecurityService, times(1)).buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString()); verify(containerClusterAvailabilityPollingService, times(3)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt()); } @Test public void bootstrapNewNodesInClusterWhenClusterAvailabilityDropTimeout() throws CloudbreakException, CloudbreakOrchestratorFailedException { Stack stack = TestUtil.stack(); StackScalingContext context = new StackScalingContext(1L, GCP_PLATFORM, 2, "master1", new HashSet<Resource>(), ScalingType.UPSCALE_ONLY_STACK, getPrivateIps(stack)); when(stackRepository.findOneWithLists(anyLong())).thenReturn(stack); when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString())) .thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1")); when(containerOrchestratorResolver.get("SWARM")).thenReturn(new MockContainerOrchestrator()); when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.SUCCESS); when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.TIMEOUT); doNothing().when(clusterBootstrapperErrorHandler) .terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), any(Set.class)); underTest.bootstrapNewNodes(context); verify(clusterBootstrapperErrorHandler, times(1)) .terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), anySet()); verify(tlsSecurityService, times(1)).buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString()); verify(containerClusterAvailabilityPollingService, times(2)).pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt()); } @Test(expected = CancellationException.class) public void bootstrapNewNodesInClusterWhenOrchestratorDropCancelledException() throws CloudbreakException, CloudbreakOrchestratorFailedException { Stack stack = TestUtil.stack(); StackScalingContext context = new StackScalingContext(1L, GCP_PLATFORM, 2, "master1", new HashSet<Resource>(), ScalingType.UPSCALE_ONLY_STACK, getPrivateIps(stack)); when(stackRepository.findOneWithLists(anyLong())).thenReturn(stack); when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString())) .thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1")); when(containerOrchestratorResolver.get("SWARM")).thenReturn(new CancelledNewNodesMockContainerOrchestrator()); when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.SUCCESS); when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.TIMEOUT); doNothing().when(clusterBootstrapperErrorHandler) .terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), any(Set.class)); underTest.bootstrapNewNodes(context); } @Test(expected = CloudbreakException.class) public void bootstrapNewNodesInClusterWhenOrchestratorDropFailedException() throws CloudbreakException, CloudbreakOrchestratorFailedException { Stack stack = TestUtil.stack(); StackScalingContext context = new StackScalingContext(1L, GCP_PLATFORM, 2, "master1", new HashSet<Resource>(), ScalingType.UPSCALE_ONLY_STACK, getPrivateIps(stack)); when(stackRepository.findOneWithLists(anyLong())).thenReturn(stack); when(tlsSecurityService.buildGatewayConfig(anyLong(), anyString(), anyInt(), anyString())) .thenReturn(new GatewayConfig("10.0.0.1", "10.0.0.1", 8443, "/cert/1")); when(containerOrchestratorResolver.get("SWARM")).thenReturn(new FailedNewNodesMockContainerOrchestrator()); when(containerBootstrapApiPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerBootstrapApiContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.SUCCESS); when(containerClusterAvailabilityPollingService.pollWithTimeoutSingleFailure(any(StatusCheckerTask.class), any(ContainerOrchestratorClusterContext.class), anyInt(), anyInt())) .thenReturn(PollingResult.TIMEOUT); doNothing().when(clusterBootstrapperErrorHandler) .terminateFailedNodes(any(HostOrchestrator.class), any(ContainerOrchestrator.class), any(Stack.class), any(GatewayConfig.class), any(Set.class)); underTest.bootstrapNewNodes(context); } private Set<String> getPrivateIps(Stack stack) { Set<String> ips = new HashSet<>(); for (InstanceMetaData instanceMetaData : stack.getRunningInstanceMetaData()) { ips.add(instanceMetaData.getPrivateIp()); } return ips; } class FailedNewNodesMockContainerOrchestrator extends MockContainerOrchestrator { @Override public void bootstrapNewNodes(GatewayConfig gatewayConfig, ContainerConfig containerConfig, Set<Node> nodes, ExitCriteriaModel exitCriteriaModel) throws CloudbreakOrchestratorFailedException { throw new CloudbreakOrchestratorFailedException("failed"); } } class CancelledMockContainerOrchestrator extends MockContainerOrchestrator { @Override public void bootstrap(GatewayConfig gatewayConfig, ContainerConfig config, Set<Node> nodes, int consulServerCount, ExitCriteriaModel exitCriteriaModel) throws CloudbreakOrchestratorCancelledException { throw new CloudbreakOrchestratorCancelledException("cancelled"); } } class CancelledNewNodesMockContainerOrchestrator extends MockContainerOrchestrator { @Override public void bootstrapNewNodes(GatewayConfig gatewayConfig, ContainerConfig containerConfig, Set<Node> nodes, ExitCriteriaModel exitCriteriaModel) throws CloudbreakOrchestratorCancelledException { throw new CloudbreakOrchestratorCancelledException("cancelled"); } } class TwoLengthMockContainerOrchestrator extends MockContainerOrchestrator { @Override public int getMaxBootstrapNodes() { return 2; } } class FailedMockContainerOrchestrator extends MockContainerOrchestrator { @Override public void bootstrap(GatewayConfig gatewayConfig, ContainerConfig config, Set<Node> nodes, int consulServerCount, ExitCriteriaModel exitCriteriaModel) throws CloudbreakOrchestratorFailedException { throw new CloudbreakOrchestratorFailedException("failed"); } } }
31f8dba3c15f52b7f7e41e94dcddb1317e6c9e0b
be9cdf2d59aa7a33e6dc09f70da07418ae8b05f0
/src/tryings/TipDonusum.java
6c4f8d56f45faeeee2fc068b37a4bcb459b5e9e5
[]
no_license
ZaferKok/MyProject
e9381adab8d102b724bc8be0ee076d1a6ea02e4a
bf13bc398f6fa9198731ffa842d29a6f46bac24d
refs/heads/master
2022-04-22T23:09:28.192595
2020-04-24T00:42:31
2020-04-24T00:42:31
258,226,786
0
0
null
null
null
null
UTF-8
Java
false
false
609
java
package tryings; public class TipDonusum { public static void main(String[] args) { // First way; int num1 = 32; int num2 = 18; System.out.println("Toplam integer olarak : " + (num1+num2)); String newNum1 = "" + num1; String newNum2 = "" + num2; System.out.println(newNum1); // It writes as String System.out.println(newNum2); System.out.println(newNum1 + newNum2); // result is concatinating. not adding. // Second way; String newNum3 = String.valueOf(num1); String newNum4 = String.valueOf(num2); } }
9aa93972992a599fcfe49d76018bcd90a3464ad6
167b30938b732781dbc418bbdc0b138b5d3f3b1d
/app/src/main/java/com/musicplayer/ccl/music_player/adapter/AudioListAdapter.java
57102084336fdf34dda7f9358a17e7cbf03b7757
[]
no_license
CCLCM/music_player
10b46a3d0670d62352ce553078d6e458af718869
50666c6ed96edd7c9b1931b0afc181c505af8b26
refs/heads/master
2021-05-05T00:25:23.625044
2018-02-05T10:29:13
2018-02-05T10:29:13
119,480,155
0
0
null
null
null
null
UTF-8
Java
false
false
1,819
java
package com.musicplayer.ccl.music_player.adapter; import android.content.Context; import android.database.Cursor; import android.support.v4.widget.CursorAdapter; import android.text.format.Formatter; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import com.musicplayer.ccl.music_player.R; import com.musicplayer.ccl.music_player.bean.AudioItem; import com.musicplayer.ccl.music_player.bean.VideoItem; import utils.StringUtils; /** * Created by ccl on 18-1-31. */ public class AudioListAdapter extends CursorAdapter { public AudioListAdapter(Context context, Cursor c) { super(context, c); } public AudioListAdapter(Context context, Cursor c, boolean autoRequery) { super(context, c, autoRequery); } public AudioListAdapter(Context context, Cursor c, int flags) { super(context, c, flags); } @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { //创建新的view View view = View.inflate(context, R.layout.main_audio_list_item,null); view.setTag(new ViewHolder(view)); return view; } @Override public void bindView(View view, Context context, Cursor cursor) { //填充view ViewHolder holder = (ViewHolder) view.getTag(); AudioItem audioItem = AudioItem.instanceFromCursor(cursor); holder.tv_title.setText(StringUtils.formatDisplyName(audioItem.getTitle())); holder.tv_arties.setText(audioItem.getArties()); } private class ViewHolder{ TextView tv_title,tv_arties; ViewHolder(View view) { tv_title = (TextView) view.findViewById(R.id.main_audio_item_tv_title); tv_arties = (TextView) view.findViewById(R.id.main_audio_item_tv_arties); } } }
1b8cc65fbd5fc669eb19aa755484a6e21e81b0c9
621bb1f04bd65faf94d62e56a035eff450b15b7a
/src/com/Main.java
867613bc93dcd430fb1b81132c0e9df2f1ffde15
[]
no_license
shevtsod/ENSE374LabProject
7cfdd028ff01ca5a685d178c76886ce7ab7793df
9c34c283f1c6755183e770423ee72b7c2faf8d8b
refs/heads/master
2021-01-12T14:40:48.403861
2017-03-16T00:29:42
2017-03-16T00:29:42
72,047,286
0
1
null
null
null
null
UTF-8
Java
false
false
3,988
java
package com; /* * FILENAME: Main.java * COURSE: ENSE 374 * AUTHOR: Daniel Shevtsov */ import com.shevtsod.Simulator.BoardManager; import java.util.InputMismatchException; import java.util.Scanner; /** * <p> * The primary entry point for the program * </p> * * @author Daniel Shevtsov */ public class Main { /** * The primary entry point for the program. * Currently, this method simply passes control of the program to a * BoardManager object after it is initialized with an x,y board size. * The current version does not use parameters passed by args. * @param args Arguments from command line */ public static void main(String args[]) { int sizeX = 0, sizeY = 0, min = 2, max = 10; boolean correctInput; //Print welcome screen. //Generated using http://patorjk.com/software/taag/ System.out.println( "\n" + "*****************************************************************\n" + " / \\ _ __ (_)_ __ ___ __ _| / ___|(_)_ __ ___ \n" + " / _ \\ | '_ \\| | '_ ` _ \\ / _` | \\___ \\| | '_ ` _ \\ \n" + " / ___ \\| | | | | | | | | | (_| | |___) | | | | | | |\n" + " /_/ \\_\\_| |_|_|_| |_| |_|\\__,_|_|____/|_|_| |_| |_|\n" + "Animal Habitat Simulator created by Daniel Shevtsov for ENSE 374" + "\n*****************************************************************\n" ); Scanner input = new Scanner(System.in, "UTF-8"); // Get number of horizontal cells from min to max from keyboard input System.out.println("Enter number of horizontal cells (" + min + " to " + max + "): "); correctInput = false; do { System.out.print("\tINPUT: "); try { sizeX = input.nextInt(); if(sizeX >= min && sizeX <= max) { correctInput = true; } else { System.out.println( "ERROR: The value given for number of horizontal cells " + "must be between 3 and 10" ); input.nextLine(); } } catch(InputMismatchException e) { System.out.println( "ERROR: The value given for number of horizontal cells " + "must be between 3 and 10" ); input.nextLine(); } } while(!correctInput); // Get number of vertical cells from min to max from keyboard input System.out.println("Enter number of vertical cells (" + min + " to " + max + "): "); correctInput = false; do { System.out.print("\tINPUT: "); try { sizeY = input.nextInt(); if(sizeY >= min && sizeY <= max) { correctInput = true; } else { System.out.println( "ERROR: The value given for number of vertical " + "cells must be between " + min + " and " + max ); input.nextLine(); } } catch(InputMismatchException e) { System.out.println( "ERROR: The value given for number of vertical cells " + "must be between " + min + " and " + max ); input.nextLine(); } } while(!correctInput); System.out.println( "Starting simulator with board of size (" + sizeX + " x " + sizeY + ")" ); BoardManager mainBM = new BoardManager(sizeX, sizeY); //Pass control of the program to the BoardManager mainBM.simulate(); input.close(); } }
d77fd99d2f7b3391f901b682ccdd1cd701a52495
8920cf1e82cfec6213f4b14cfecf19202f1001a0
/app/src/main/java/es/source/code/adapter/FoodDetailPagerAdapter.java
2434c305d13bb471d6dbaf919cf428d4535590c2
[]
no_license
togepro/SCOS
9951b471d4a56d66305b63a8117749d1a6badd4e
e8b4b39bc9e2c1ef0fbb05f21374be9e0268aec2
refs/heads/master
2020-04-01T01:03:59.775943
2018-11-18T13:28:24
2018-11-18T13:28:24
152,724,828
0
0
null
null
null
null
UTF-8
Java
false
false
3,359
java
package es.source.code.adapter; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v4.view.PagerAdapter; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.List; import es.source.code.activity.R; import es.source.code.model.Data; import es.source.code.model.Food; public class FoodDetailPagerAdapter extends PagerAdapter { private Context mContext; private List<Food> foodList; private int resId; private List<View> viewList; public FoodDetailPagerAdapter(Context context,List<Food> foodlist,int resId){ this.mContext=context; this.foodList=foodlist; this.resId=resId; initViewList(); } private void initViewList() { viewList = new ArrayList<>(); LayoutInflater inflater = ((Activity) mContext).getLayoutInflater(); for (Food food : foodList) { viewList.add(inflater.inflate(resId, null)); } } @Override public int getCount() { return viewList.size(); } @Override public boolean isViewFromObject(@NonNull View view, @NonNull Object o) { return view==o; } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView(viewList.get(position)); } @NonNull @Override public Object instantiateItem(@NonNull ViewGroup container, int position) { final View pageView = viewList.get(position); final Food food = foodList.get(position); final Data orderFoods= (Data)pageView.getContext().getApplicationContext(); TextView tvFoodName = pageView.findViewById(R.id.food_name_detail); TextView tvFoodPrice = pageView.findViewById(R.id.food_price_detail); ImageView ivFood = pageView.findViewById(R.id.food_image_detail); final Button mButton = pageView.findViewById(R.id.take_order_detail); if(orderFoods.isOrdered(food)) { mButton.setText("退点"); } tvFoodName.setText(food.getFoodName()); String price = String.valueOf(food.getPrice()) + "元"; tvFoodPrice.setText(price); ivFood.setImageResource(food.getImageId()); mButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(mButton.getText().equals("点菜")){ food.setOrderState(1); orderFoods.addFood(food); Toast.makeText(pageView.getContext(),"点菜成功", Toast.LENGTH_SHORT).show(); mButton.setText("退点"); } else if(mButton.getText().equals("退点")){ food.setOrderState(0); orderFoods.removeFood(food); Toast.makeText(pageView.getContext(),"退点成功", Toast.LENGTH_SHORT).show(); mButton.setText("点菜"); } } }); container.addView(pageView); return pageView; } }
021be9e5a87fb88f4826a2e2e43ecaedad90b01a
44d8aa309f709422f32d4815490a3eec05544489
/build/src/main/java/com/mypurecloud/sdk/v2/api/request/GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest.java
594560c7ecc4ada4a74cfbce42077e5729c25d28
[ "MIT" ]
permissive
MyPureCloud/platform-client-sdk-java
a25146f15a0ef96f5c0c4655af3dc8aa77e48843
250d47418a9642fce5c7d6697f87d978ec39a257
refs/heads/master
2023-08-17T01:42:17.287918
2023-08-15T07:03:28
2023-08-15T07:03:28
86,601,855
7
14
MIT
2023-02-27T14:26:49
2017-03-29T15:56:50
HTML
UTF-8
Java
false
false
17,098
java
package com.mypurecloud.sdk.v2.api.request; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; import com.mypurecloud.sdk.v2.ApiException; import com.mypurecloud.sdk.v2.ApiClient; import com.mypurecloud.sdk.v2.ApiRequest; import com.mypurecloud.sdk.v2.ApiRequestBuilder; import com.mypurecloud.sdk.v2.ApiResponse; import com.mypurecloud.sdk.v2.Configuration; import com.mypurecloud.sdk.v2.model.*; import com.mypurecloud.sdk.v2.Pair; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.Arrays; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.HashMap; import java.util.Map; import java.util.regex.Pattern; import com.mypurecloud.sdk.v2.model.ActivityCodeContainer; import com.mypurecloud.sdk.v2.model.AddAdherenceExplanationAdminRequest; import com.mypurecloud.sdk.v2.model.AddAdherenceExplanationAgentRequest; import com.mypurecloud.sdk.v2.model.AddShiftTradeRequest; import com.mypurecloud.sdk.v2.model.AddWorkPlanRotationRequest; import com.mypurecloud.sdk.v2.model.AdherenceExplanationAsyncResponse; import com.mypurecloud.sdk.v2.model.AdherenceExplanationJob; import com.mypurecloud.sdk.v2.model.AdherenceExplanationResponse; import com.mypurecloud.sdk.v2.model.AdminTimeOffRequestPatch; import com.mypurecloud.sdk.v2.model.AgentManagementUnitReference; import com.mypurecloud.sdk.v2.model.AgentPossibleWorkShiftsRequest; import com.mypurecloud.sdk.v2.model.AgentPossibleWorkShiftsResponse; import com.mypurecloud.sdk.v2.model.AgentQueryAdherenceExplanationsRequest; import com.mypurecloud.sdk.v2.model.AgentQueryAdherenceExplanationsResponse; import com.mypurecloud.sdk.v2.model.AgentTimeOffRequestPatch; import com.mypurecloud.sdk.v2.model.AsyncForecastOperationResult; import com.mypurecloud.sdk.v2.model.AsyncIntradayResponse; import com.mypurecloud.sdk.v2.model.AvailableTimeOffRequest; import com.mypurecloud.sdk.v2.model.AvailableTimeOffResponse; import com.mypurecloud.sdk.v2.model.BuAgentScheduleHistoryResponse; import com.mypurecloud.sdk.v2.model.BuAsyncAgentSchedulesQueryResponse; import com.mypurecloud.sdk.v2.model.BuAsyncAgentSchedulesSearchResponse; import com.mypurecloud.sdk.v2.model.BuAsyncScheduleResponse; import com.mypurecloud.sdk.v2.model.BuAsyncScheduleRunResponse; import com.mypurecloud.sdk.v2.model.BuCopyScheduleRequest; import com.mypurecloud.sdk.v2.model.BuCreateBlankScheduleRequest; import com.mypurecloud.sdk.v2.model.BuCurrentAgentScheduleSearchResponse; import com.mypurecloud.sdk.v2.model.BuForecastGenerationResult; import com.mypurecloud.sdk.v2.model.BuForecastResultResponse; import com.mypurecloud.sdk.v2.model.BuGenerateScheduleRequest; import com.mypurecloud.sdk.v2.model.BuGetCurrentAgentScheduleRequest; import com.mypurecloud.sdk.v2.model.BuHeadcountForecastResponse; import com.mypurecloud.sdk.v2.model.BuQueryAdherenceExplanationsRequest; import com.mypurecloud.sdk.v2.model.BuQueryAdherenceExplanationsResponse; import com.mypurecloud.sdk.v2.model.BuQueryAgentSchedulesRequest; import com.mypurecloud.sdk.v2.model.BuRescheduleRequest; import com.mypurecloud.sdk.v2.model.BuRescheduleResult; import com.mypurecloud.sdk.v2.model.BuScheduleListing; import com.mypurecloud.sdk.v2.model.BuScheduleMetadata; import com.mypurecloud.sdk.v2.model.BuScheduleRun; import com.mypurecloud.sdk.v2.model.BuScheduleRunListing; import com.mypurecloud.sdk.v2.model.BuSearchAgentSchedulesRequest; import com.mypurecloud.sdk.v2.model.BuShortTermForecast; import com.mypurecloud.sdk.v2.model.BuShortTermForecastListing; import com.mypurecloud.sdk.v2.model.BulkShiftTradeStateUpdateRequest; import com.mypurecloud.sdk.v2.model.BulkUpdateShiftTradeStateResponse; import com.mypurecloud.sdk.v2.model.BusinessUnitActivityCode; import com.mypurecloud.sdk.v2.model.BusinessUnitActivityCodeListing; import com.mypurecloud.sdk.v2.model.BusinessUnitListing; import com.mypurecloud.sdk.v2.model.BusinessUnitResponse; import com.mypurecloud.sdk.v2.model.CalendarUrlResponse; import com.mypurecloud.sdk.v2.model.CopyBuForecastRequest; import com.mypurecloud.sdk.v2.model.CopyWorkPlan; import com.mypurecloud.sdk.v2.model.CopyWorkPlanRotationRequest; import com.mypurecloud.sdk.v2.model.CreateActivityCodeRequest; import com.mypurecloud.sdk.v2.model.CreateAdminTimeOffRequest; import com.mypurecloud.sdk.v2.model.CreateAgentTimeOffRequest; import com.mypurecloud.sdk.v2.model.CreateBusinessUnitRequest; import com.mypurecloud.sdk.v2.model.CreateManagementUnitApiRequest; import com.mypurecloud.sdk.v2.model.CreatePlanningGroupRequest; import com.mypurecloud.sdk.v2.model.CreateServiceGoalTemplate; import com.mypurecloud.sdk.v2.model.CreateTimeOffLimitRequest; import com.mypurecloud.sdk.v2.model.CreateTimeOffPlanRequest; import com.mypurecloud.sdk.v2.model.CreateWorkPlan; import com.mypurecloud.sdk.v2.model.CurrentUserScheduleRequestBody; import com.mypurecloud.sdk.v2.model.ErrorBody; import com.mypurecloud.sdk.v2.model.ForecastPlanningGroupsResponse; import com.mypurecloud.sdk.v2.model.GenerateBuForecastRequest; import com.mypurecloud.sdk.v2.model.HistoricalImportDeleteJobResponse; import com.mypurecloud.sdk.v2.model.HistoricalImportStatusListing; import com.mypurecloud.sdk.v2.model.ImportForecastResponse; import com.mypurecloud.sdk.v2.model.ImportForecastUploadResponse; import com.mypurecloud.sdk.v2.model.ImportScheduleUploadResponse; import com.mypurecloud.sdk.v2.model.IntradayPlanningGroupRequest; import java.time.LocalDate; import com.mypurecloud.sdk.v2.model.LongTermForecastResultResponse; import com.mypurecloud.sdk.v2.model.ManagementUnit; import com.mypurecloud.sdk.v2.model.ManagementUnitListing; import com.mypurecloud.sdk.v2.model.MatchShiftTradeRequest; import com.mypurecloud.sdk.v2.model.MatchShiftTradeResponse; import com.mypurecloud.sdk.v2.model.ModelingStatusResponse; import com.mypurecloud.sdk.v2.model.MoveManagementUnitRequest; import com.mypurecloud.sdk.v2.model.MoveManagementUnitResponse; import com.mypurecloud.sdk.v2.model.NotificationsResponse; import com.mypurecloud.sdk.v2.model.PatchBuScheduleRunRequest; import com.mypurecloud.sdk.v2.model.PatchShiftTradeRequest; import com.mypurecloud.sdk.v2.model.PlanningGroup; import com.mypurecloud.sdk.v2.model.PlanningGroupList; import com.mypurecloud.sdk.v2.model.ProcessScheduleUpdateUploadRequest; import com.mypurecloud.sdk.v2.model.QueryAdherenceExplanationsResponse; import com.mypurecloud.sdk.v2.model.QueryTimeOffLimitValuesRequest; import com.mypurecloud.sdk.v2.model.QueryTimeOffLimitValuesResponse; import com.mypurecloud.sdk.v2.model.QueryWaitlistPositionsRequest; import com.mypurecloud.sdk.v2.model.ScheduleGenerationResult; import com.mypurecloud.sdk.v2.model.ScheduleUploadProcessingResponse; import com.mypurecloud.sdk.v2.model.SchedulingStatusResponse; import com.mypurecloud.sdk.v2.model.SearchShiftTradesRequest; import com.mypurecloud.sdk.v2.model.SearchShiftTradesResponse; import com.mypurecloud.sdk.v2.model.ServiceGoalTemplate; import com.mypurecloud.sdk.v2.model.ServiceGoalTemplateList; import com.mypurecloud.sdk.v2.model.SetTimeOffLimitValuesRequest; import com.mypurecloud.sdk.v2.model.ShiftTradeListResponse; import com.mypurecloud.sdk.v2.model.ShiftTradeMatchesSummaryResponse; import com.mypurecloud.sdk.v2.model.ShiftTradeResponse; import com.mypurecloud.sdk.v2.model.TimeOffBalanceRequest; import com.mypurecloud.sdk.v2.model.TimeOffBalancesResponse; import com.mypurecloud.sdk.v2.model.TimeOffLimit; import com.mypurecloud.sdk.v2.model.TimeOffLimitListing; import com.mypurecloud.sdk.v2.model.TimeOffPlan; import com.mypurecloud.sdk.v2.model.TimeOffPlanListing; import com.mypurecloud.sdk.v2.model.TimeOffRequestList; import com.mypurecloud.sdk.v2.model.TimeOffRequestListing; import com.mypurecloud.sdk.v2.model.TimeOffRequestQueryBody; import com.mypurecloud.sdk.v2.model.TimeOffRequestResponse; import com.mypurecloud.sdk.v2.model.UpdateActivityCodeRequest; import com.mypurecloud.sdk.v2.model.UpdateAdherenceExplanationStatusRequest; import com.mypurecloud.sdk.v2.model.UpdateBusinessUnitRequest; import com.mypurecloud.sdk.v2.model.UpdateManagementUnitRequest; import com.mypurecloud.sdk.v2.model.UpdateNotificationsRequest; import com.mypurecloud.sdk.v2.model.UpdateNotificationsResponse; import com.mypurecloud.sdk.v2.model.UpdatePlanningGroupRequest; import com.mypurecloud.sdk.v2.model.UpdateScheduleUploadResponse; import com.mypurecloud.sdk.v2.model.UpdateServiceGoalTemplate; import com.mypurecloud.sdk.v2.model.UpdateTimeOffLimitRequest; import com.mypurecloud.sdk.v2.model.UpdateTimeOffPlanRequest; import com.mypurecloud.sdk.v2.model.UpdateWorkPlanRotationRequest; import com.mypurecloud.sdk.v2.model.UploadUrlRequestBody; import com.mypurecloud.sdk.v2.model.UserListScheduleRequestBody; import com.mypurecloud.sdk.v2.model.UserScheduleAdherence; import com.mypurecloud.sdk.v2.model.UserScheduleAdherenceListing; import com.mypurecloud.sdk.v2.model.UserScheduleContainer; import com.mypurecloud.sdk.v2.model.ValidateWorkPlanResponse; import com.mypurecloud.sdk.v2.model.ValidationServiceRequest; import com.mypurecloud.sdk.v2.model.WaitlistPositionListing; import com.mypurecloud.sdk.v2.model.WeekScheduleListResponse; import com.mypurecloud.sdk.v2.model.WeekScheduleResponse; import com.mypurecloud.sdk.v2.model.WeekShiftTradeListResponse; import com.mypurecloud.sdk.v2.model.WfmAgent; import com.mypurecloud.sdk.v2.model.WfmHistoricalAdherenceBulkQuery; import com.mypurecloud.sdk.v2.model.WfmHistoricalAdherenceBulkResponse; import com.mypurecloud.sdk.v2.model.WfmHistoricalAdherenceQuery; import com.mypurecloud.sdk.v2.model.WfmHistoricalAdherenceQueryForTeams; import com.mypurecloud.sdk.v2.model.WfmHistoricalAdherenceQueryForUsers; import com.mypurecloud.sdk.v2.model.WfmHistoricalAdherenceResponse; import com.mypurecloud.sdk.v2.model.WfmHistoricalShrinkageRequest; import com.mypurecloud.sdk.v2.model.WfmHistoricalShrinkageResponse; import com.mypurecloud.sdk.v2.model.WfmHistoricalShrinkageTeamsRequest; import com.mypurecloud.sdk.v2.model.WfmIntradayPlanningGroupListing; import com.mypurecloud.sdk.v2.model.WfmProcessUploadRequest; import com.mypurecloud.sdk.v2.model.WfmUserEntityListing; import com.mypurecloud.sdk.v2.model.WorkPlan; import com.mypurecloud.sdk.v2.model.WorkPlanListResponse; import com.mypurecloud.sdk.v2.model.WorkPlanRotationListResponse; import com.mypurecloud.sdk.v2.model.WorkPlanRotationResponse; import com.mypurecloud.sdk.v2.model.WorkPlanValidationRequest; public class GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest { private String businessUnitId; public String getBusinessUnitId() { return this.businessUnitId; } public void setBusinessUnitId(String businessUnitId) { this.businessUnitId = businessUnitId; } public GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest withBusinessUnitId(String businessUnitId) { this.setBusinessUnitId(businessUnitId); return this; } private LocalDate weekDateId; public LocalDate getWeekDateId() { return this.weekDateId; } public void setWeekDateId(LocalDate weekDateId) { this.weekDateId = weekDateId; } public GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest withWeekDateId(LocalDate weekDateId) { this.setWeekDateId(weekDateId); return this; } private String forecastId; public String getForecastId() { return this.forecastId; } public void setForecastId(String forecastId) { this.forecastId = forecastId; } public GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest withForecastId(String forecastId) { this.setForecastId(forecastId); return this; } private Boolean forceDownloadService; public Boolean getForceDownloadService() { return this.forceDownloadService; } public void setForceDownloadService(Boolean forceDownloadService) { this.forceDownloadService = forceDownloadService; } public GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest withForceDownloadService(Boolean forceDownloadService) { this.setForceDownloadService(forceDownloadService); return this; } private final Map<String, String> customHeaders = new HashMap<>(); public Map<String, String> getCustomHeaders() { return this.customHeaders; } public void setCustomHeaders(Map<String, String> customHeaders) { this.customHeaders.clear(); this.customHeaders.putAll(customHeaders); } public void addCustomHeader(String name, String value) { this.customHeaders.put(name, value); } public GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest withCustomHeader(String name, String value) { this.addCustomHeader(name, value); return this; } public ApiRequest<Void> withHttpInfo() { // verify the required parameter 'businessUnitId' is set if (this.businessUnitId == null) { throw new IllegalStateException("Missing the required parameter 'businessUnitId' when building request for GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest."); } // verify the required parameter 'weekDateId' is set if (this.weekDateId == null) { throw new IllegalStateException("Missing the required parameter 'weekDateId' when building request for GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest."); } // verify the required parameter 'forecastId' is set if (this.forecastId == null) { throw new IllegalStateException("Missing the required parameter 'forecastId' when building request for GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest."); } return ApiRequestBuilder.create("GET", "/api/v2/workforcemanagement/businessunits/{businessUnitId}/weeks/{weekDateId}/shorttermforecasts/{forecastId}/longtermforecastdata") .withPathParameter("businessUnitId", businessUnitId) .withPathParameter("weekDateId", weekDateId) .withPathParameter("forecastId", forecastId) .withQueryParameters("forceDownloadService", "", forceDownloadService) .withCustomHeaders(customHeaders) .withContentTypes("application/json") .withAccepts("application/json") .withAuthNames("PureCloud OAuth") .build(); } public static Builder builder() { return new Builder(); } public static Builder builder(String businessUnitId, LocalDate weekDateId, String forecastId) { return new Builder() .withRequiredParams(businessUnitId, weekDateId, forecastId); } public static class Builder { private final GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest request; private Builder() { request = new GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest(); } public Builder withBusinessUnitId(String businessUnitId) { request.setBusinessUnitId(businessUnitId); return this; } public Builder withWeekDateId(LocalDate weekDateId) { request.setWeekDateId(weekDateId); return this; } public Builder withForecastId(String forecastId) { request.setForecastId(forecastId); return this; } public Builder withForceDownloadService(Boolean forceDownloadService) { request.setForceDownloadService(forceDownloadService); return this; } public Builder withRequiredParams(String businessUnitId, LocalDate weekDateId, String forecastId) { request.setBusinessUnitId(businessUnitId); request.setWeekDateId(weekDateId); request.setForecastId(forecastId); return this; } public GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest build() { // verify the required parameter 'businessUnitId' is set if (request.businessUnitId == null) { throw new IllegalStateException("Missing the required parameter 'businessUnitId' when building request for GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest."); } // verify the required parameter 'weekDateId' is set if (request.weekDateId == null) { throw new IllegalStateException("Missing the required parameter 'weekDateId' when building request for GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest."); } // verify the required parameter 'forecastId' is set if (request.forecastId == null) { throw new IllegalStateException("Missing the required parameter 'forecastId' when building request for GetWorkforcemanagementBusinessunitWeekShorttermforecastLongtermforecastdataRequest."); } return request; } } }
5af11f4ad51cdc533e361b71e943e7e240fd027a
68868ecc95c722534e2a72d369ba6ed991dcfc89
/src/geeks/search_array/ExponentialSearch.java
d19831a99635af8044f9b918c64f6d908d9c4e7f
[]
no_license
singhalrbl/practice_data_structure
af7598d01e564711ea9fcf7d13baef2db096ac26
e161d8cf4bc8adfad3827b3650902c4e22987c1a
refs/heads/master
2023-01-01T18:06:48.395645
2020-10-12T02:27:06
2020-10-12T02:27:06
291,530,277
0
0
null
null
null
null
UTF-8
Java
false
false
186
java
package geeks.search_array; /* https://www.geeksforgeeks.org/exponential-search/ */ /*https://en.wikipedia.org/wiki/Exponential_search */ public class ExponentialSearch { }
3e3ff97a65f2efa673efd95b87d852fe04e5bc53
407daf338c496df4978b8a459ee242177d622d6e
/mediumApp/domain/src/main/java/com/anlijiu/example/domain/interactor/GetCardDetails.java
85b008a8d4cf96bcedb00e3f82645f5689e03b55
[ "MIT" ]
permissive
anlijiu/android-boilerplates
afdce450ef3fd42ad9bcc27d1529df738705b2df
2c1533f1057ee24c3c8f044ee1e89f5bd5764514
refs/heads/master
2020-03-20T22:56:34.533771
2018-10-08T01:59:23
2018-10-08T01:59:23
137,821,970
1
0
null
null
null
null
UTF-8
Java
false
false
1,898
java
/** * Copyright (C) 2015 Fernando Cejas Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.anlijiu.example.domain.interactor; import com.anlijiu.example.domain.objects.Card; import com.anlijiu.example.domain.executor.PostExecutionThread; import com.anlijiu.example.domain.executor.ThreadExecutor; import com.anlijiu.example.domain.repository.CardRepository; import io.reactivex.Observable; import javax.inject.Inject; /** * This class is an implementation of {@link UseCase} that represents a use case for * retrieving data related to an specific {@link Card}. */ public class GetCardDetails extends UseCase<Card, GetCardDetails.Params> { private final CardRepository cardRepository; @Inject GetCardDetails(CardRepository cardRepository, ThreadExecutor threadExecutor, PostExecutionThread postExecutionThread) { super(threadExecutor, postExecutionThread); this.cardRepository = cardRepository; } @Override Observable<Card> buildUseCaseObservable(Params params) { if (params == null) { throw new NullPointerException(); } return this.cardRepository.card(params.cardId); } public static final class Params { private final int cardId; private Params(int cardId) { this.cardId = cardId; } public static Params forCard(int cardId) { return new Params(cardId); } } }
a7efc665e33d1f32b322ab827bf5306f7f8f1243
f487dd8332d397465071a392178d81876d9a668a
/Day01-15-语言基础/Day10集合代码/Lesson4Collections/src/com/cxk/demo06/Demo34HashTable.java
e00403cfac2a252f757f31fd2beb6e69640eb93f
[]
no_license
winderst/HarmonyOS-100-Days
44d73496020d212a9df19be6fe9513e0ae190702
d356b1790b27303ef2ece984784dd2ac43e0f1d0
refs/heads/main
2023-06-14T17:13:23.094544
2021-07-09T01:10:35
2021-07-09T01:10:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
803
java
package com.cxk.demo06; import java.util.HashMap; import java.util.Hashtable; public class Demo34HashTable { public static void main(String[] args) { /* * HashMap,支持null * * HashTable,不支持null,抛出异常:NullPointerException */ HashMap<String, String> map = new HashMap<>(); map.put("A", "程序咖"); map.put("B", "Ruby"); map.put("C", null);//null对象 map.put("D", null); System.out.println(map); map.put(null, "haha"); System.out.println(map); map.put(null, "hehe"); System.out.println(map); Hashtable<String, String> table = new Hashtable<>(); table.put("AA", "程序咖"); table.put("BB", "Ruby"); // table.put("CC", null); // table.put(null, "ddd"); System.out.println(table); } }
b207b5faf45e686a6e2e5e9a30687fbe284815ff
d20ef86674f54730187d53cf39a99a6fe316c8b3
/src/main/java/sample/model/User.java
c1b503d5b6c859bd453924dc034364071a3ae029
[]
no_license
LachowskiTomekPL/JavaFX_Database
3641534ce1f894e0611faf40ea2bbe59ddd63d12
b7927347779d62ef9f8626403ab04b8a6461f9ba
refs/heads/master
2023-01-02T05:20:42.840543
2020-10-24T22:51:21
2020-10-24T22:51:21
301,829,300
0
0
null
null
null
null
UTF-8
Java
false
false
682
java
package sample.model; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @AllArgsConstructor @NoArgsConstructor @Data public class User { private Integer id; private String firstName; private String lastName; public Integer getId() { return id; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } @Override public String toString() { return "User{" + "id=" + id + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + '}'; } }
5152e984b31a435a05de33855a541e45c89d2c41
9579c009c6ebbd446db23572b6feb71569ec3faf
/src/main/java/com/team09/dao/CommentDao.java
10ffa3974817e7f29b9aa125c28c650aa54beae9
[]
no_license
997Yi/team09_simpleBBS
7308ec0005a264184f455cbec9ef45c1c64f9162
8b31717d6dae57654766443c525cabf85a088daa
refs/heads/master
2023-02-14T21:10:52.002210
2021-01-18T00:39:41
2021-01-18T00:39:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,133
java
package com.team09.dao; import com.team09.bean.Blog; import com.team09.bean.Comment; import java.sql.SQLException; import java.util.List; /** * @author team09 */ public interface CommentDao { /** * 添加评论 * @param comment * @return * @throws SQLException */ public boolean addComment(Comment comment) throws SQLException; /** * 通过评论id获取评论 * @param commentId * @return * @throws SQLException */ public Comment getCommentById(String commentId) throws SQLException; /** * 通过用户id查询评论 * @param userId * @return * @throws SQLException */ public List<Comment> getCommentsByUserId(String userId) throws SQLException; /** * 通过博客id查询评论 * @param blogId * @return * @throws SQLException */ public List<Comment> getCommentsByBlogId(String blogId) throws SQLException; /** * 删除评论 * @param commentId * @return * @throws SQLException */ public boolean deleteComment(String commentId) throws SQLException; }
765d2e1a5cbb65b926878835d54f1087e3bdf778
d593ad37a82a6396effceaf11679e70fddcabc06
/unLock/ch12/android/src/com/msi/manning/UnlockingAndroid/ShowJob.java
8bce35c18c5165e84f27856fd792a84232cc8b78
[]
no_license
psh667/android
8a18ea22c8c977852ba2cd9361a8489586e06f05
8f7394de8e26ce5106d9828cf95eb1617afca757
refs/heads/master
2018-12-27T23:30:46.988404
2013-09-09T13:16:46
2013-09-09T13:16:46
12,700,292
3
5
null
null
null
null
UTF-8
Java
false
false
5,316
java
/* * showjob.java Unlocking Android http://manning.com/ableson Author: W. F. Ableson * [email protected] */ package com.msi.manning.UnlockingAndroid; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.TextView; public class ShowJob extends Activity { Prefs myprefs = null; JobEntry je = null; final int CLOSEJOBTASK = 1; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.showjob); this.myprefs = new Prefs(getApplicationContext()); StringBuilder sb = new StringBuilder(); String details = null; Intent startingIntent = getIntent(); if (startingIntent != null) { Log.i("CH12::ShowJob", "starting intent not null"); Bundle b = startingIntent.getExtras(); if (b == null) { Log.i("CH12::ShowJob", "bad bundle"); details = "bad bundle?"; } else { this.je = JobEntry.fromBundle(b); sb.append("Job Id: " + this.je.get_jobid() + " (" + this.je.get_status() + ")\n\n"); sb.append(this.je.get_customer() + "\n\n"); sb.append(this.je.get_address() + "\n" + this.je.get_city() + "," + this.je.get_state() + "\n"); sb.append("Product : " + this.je.get_product() + "\n\n"); sb.append("Comments: " + this.je.get_comments() + "\n\n"); details = sb.toString(); } } else { details = "Job Information Not Found."; TextView tv = (TextView) findViewById(R.id.details); tv.setText(details); return; } TextView tv = (TextView) findViewById(R.id.details); tv.setText(details); Button bmap = (Button) findViewById(R.id.mapjob); bmap.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { // clean up data for use in GEO query String address = ShowJob.this.je.get_address() + " " + ShowJob.this.je.get_city() + " " + ShowJob.this.je.get_zip(); String cleanAddress = address.replace(",", ""); cleanAddress = cleanAddress.replace(' ', '+'); try { Intent geoIntent = new Intent("android.intent.action.VIEW", android.net.Uri.parse("geo:0,0?q=" + cleanAddress)); startActivity(geoIntent); } catch (Exception ee) { Log.d("CH12", "error launching map? " + ee.getMessage()); } } }); Button bproductinfo = (Button) findViewById(R.id.productinfo); bproductinfo.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { try { Intent productInfoIntent = new Intent("android.intent.action.VIEW", android.net.Uri .parse(ShowJob.this.je.get_producturl())); startActivity(productInfoIntent); } catch (Exception ee) { Log.d("CH12", "error launching product info? " + ee.getMessage()); } } }); Button bclose = (Button) findViewById(R.id.closejob); if (this.je.get_status().equals("CLOSED")) { bclose.setText("Job is Closed. View Signature"); } bclose.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { if (ShowJob.this.je.get_status().equals("CLOSED")) { Intent signatureIntent = new Intent("android.intent.action.VIEW", android.net.Uri .parse(ShowJob.this.myprefs.getServer() + "sigs/" + ShowJob.this.je.get_jobid() + ".jpg")); startActivity(signatureIntent); } else { Intent closeJobIntent = new Intent(ShowJob.this, CloseJob.class); Bundle b = ShowJob.this.je.toBundle(); closeJobIntent.putExtras(b); // closeJobIntent.putExtra("android.intent.extra.INTENT", b); startActivityForResult(closeJobIntent, ShowJob.this.CLOSEJOBTASK); } } }); Log.d("CH12", "Job status is :" + this.je.get_status()); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case CLOSEJOBTASK: if (resultCode == 1) { Log.d("CH12", "Good Close!"); // propagate this up to the list activity Intent resultIntent = new Intent(); resultIntent.putExtras(data.getExtras()); this.setResult(1, resultIntent); // leave this activity finish(); } break; } } }
db11680fe1200ddedebef449a3886881ffc7a747
f97fe5ca8584ef3ee119abf5e76cd6ebf3ad87d5
/src/main/java/org/manojit/messenger/resource/ProfileResource.java
a102c449f9dd8306594c3a2bf3a4ea2e58d20ae5
[]
no_license
manojsoftware/restmessenger
cefae0a6770ec74b94560bd0c2495eebc7c475b4
4357aaacdab3b7c5fe6262305823be977e3875f3
refs/heads/master
2020-06-27T08:44:15.206570
2016-11-23T05:09:40
2016-11-23T05:09:40
74,529,702
0
0
null
null
null
null
UTF-8
Java
false
false
1,313
java
package org.manojit.messenger.resource; import java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.manojit.messenger.model.Profile; import org.manojit.messenger.service.ProfileService; @Path("/profiles") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public class ProfileResource { ProfileService service =new ProfileService(); @GET public List<Profile> getProfiles() { return service.getAllProfiles(); } @GET @Path("/{profileName}") public Profile getMessage(@PathParam("profileName")String ProfileName){ return service.getProfile(ProfileName); } @POST public Profile addProfile(Profile profile){ return service.addProfile(profile); } @PUT @Path("/{profileName}") public Profile updateProfile(@PathParam("profileName")String ProfileName,Profile profile){ profile.setProfileName(ProfileName); return service.updateProfile(profile); } @DELETE @Path("/{profileName}") public Profile deleteProfile(@PathParam("profileName")String ProfileName){ return service.removeProfile(ProfileName); } }
93852a0208659517cd8cc38625f7606b418aad33
9796464e0f85d7fa56e4e7a0169c616792eda2c4
/src/main/java/com/yuuko/modules/utility/commands/RolesCommand.java
adb3d67babca2faa49e2e2566d977e72fd0afeab
[ "Apache-2.0" ]
permissive
Yuwuko/Yuuko
8164912478d373de36333d01553a26ffd3d99733
c3e1f0fc47c7a593aa4c5599ab43ddf4b8c1eddb
refs/heads/master
2023-06-10T12:26:21.467012
2021-07-01T18:09:28
2021-07-01T18:09:28
131,979,618
2
1
Apache-2.0
2021-05-12T10:05:59
2018-05-03T10:28:50
Java
UTF-8
Java
false
false
1,509
java
package com.yuuko.modules.utility.commands; import com.yuuko.MessageDispatcher; import com.yuuko.Yuuko; import com.yuuko.events.entity.MessageEvent; import com.yuuko.modules.Command; import com.yuuko.utilities.TextUtilities; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Role; import java.util.Arrays; public class RolesCommand extends Command { public RolesCommand() { super("roles", Arrays.asList("-roles")); } @Override public void onCommand(MessageEvent context) { StringBuilder roles = new StringBuilder(); if(!context.getGuild().getRoleCache().isEmpty()) { int characterCount = 0; for(Role role : context.getGuild().getRoleCache()) { if(characterCount + role.getAsMention().length() + 2 < 2048) { roles.append(role.getAsMention()).append("\n"); characterCount += role.getAsMention().length() + 1; } } TextUtilities.removeLast(roles, "\n"); } else { roles.append(context.i18n("none")); } EmbedBuilder embed = new EmbedBuilder() .setTitle(context.i18n("title").formatted(context.getGuild().getName())) .setDescription(roles.toString()) .setFooter(Yuuko.STANDARD_STRINGS.get(1) + context.getAuthor().getAsTag(), context.getAuthor().getEffectiveAvatarUrl()); MessageDispatcher.reply(context, embed.build()); } }
14e9f956a9f8ab5a4474a4b04681f3ff88900639
fa61fd6573be8fb5bdb7413a9333555863016cec
/NoRecordsDatabase/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/work/Catalina/localhost/mydatabase/org/apache/jsp/select/selectMusician_jsp.java
c9bf2cf0d0067b1979b88362a60c2bd0e2c06934
[]
no_license
sagardhakal-photon/myDatabase
9a5b7c41cb4f14eb84aec106903ab37d7f19cb5c
9bfaa43d8fa5eba8c3f2b3f679a4a29e3589772f
refs/heads/master
2023-04-01T18:23:58.704317
2018-03-31T03:07:19
2018-03-31T03:07:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,990
java
/* * Generated by the Jasper component of Apache Tomcat * Version: Apache Tomcat/9.0.1 * Generated at: 2017-11-29 00:28:49 UTC * Note: The last modified time of this file was set to * the last modified time of the source file after * generation to assist with modification tracking. */ package org.apache.jsp.select; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; public final class selectMusician_jsp extends org.apache.jasper.runtime.HttpJspBase implements org.apache.jasper.runtime.JspSourceDependent, org.apache.jasper.runtime.JspSourceImports { private static final javax.servlet.jsp.JspFactory _jspxFactory = javax.servlet.jsp.JspFactory.getDefaultFactory(); private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants; static { _jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(2); _jspx_dependants.put("file:/C:/Program%20Files/apache-tomcat-9.0.1/lib/standard.jar", Long.valueOf(1511913603503L)); _jspx_dependants.put("jar:file:/C:/Program%20Files/apache-tomcat-9.0.1/lib/standard.jar!/META-INF/c.tld", Long.valueOf(1098736290000L)); } private static final java.util.Set<java.lang.String> _jspx_imports_packages; private static final java.util.Set<java.lang.String> _jspx_imports_classes; static { _jspx_imports_packages = new java.util.HashSet<>(); _jspx_imports_packages.add("javax.servlet"); _jspx_imports_packages.add("javax.servlet.http"); _jspx_imports_packages.add("javax.servlet.jsp"); _jspx_imports_classes = null; } private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems; private volatile javax.el.ExpressionFactory _el_expressionfactory; private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map<java.lang.String,java.lang.Long> getDependants() { return _jspx_dependants; } public java.util.Set<java.lang.String> getPackageImports() { return _jspx_imports_packages; } public java.util.Set<java.lang.String> getClassImports() { return _jspx_imports_classes; } public javax.el.ExpressionFactory _jsp_getExpressionFactory() { if (_el_expressionfactory == null) { synchronized (this) { if (_el_expressionfactory == null) { _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); } } } return _el_expressionfactory; } public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() { if (_jsp_instancemanager == null) { synchronized (this) { if (_jsp_instancemanager == null) { _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); } } } return _jsp_instancemanager; } public void _jspInit() { _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig()); } public void _jspDestroy() { _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.release(); } public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException { final java.lang.String _jspx_method = request.getMethod(); if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) { response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET POST or HEAD"); return; } final javax.servlet.jsp.PageContext pageContext; javax.servlet.http.HttpSession session = null; final javax.servlet.ServletContext application; final javax.servlet.ServletConfig config; javax.servlet.jsp.JspWriter out = null; final java.lang.Object page = this; javax.servlet.jsp.JspWriter _jspx_out = null; javax.servlet.jsp.PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=ISO-8859-1"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n"); out.write("\r\n"); out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n"); out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n"); out.write("<head>\r\n"); out.write("\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\r\n"); out.write(" <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\">\r\n"); out.write(" <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js\"></script>\r\n"); out.write(" <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js\"></script>\r\n"); out.write(" \t<title>Musician</title>\r\n"); out.write("</head>\r\n"); out.write("<body>\r\n"); out.write("<div class=\"container\">\r\n"); out.write(" <div class=\"jumbotron\">\r\n"); out.write(" <h1>Musicians</h1>\r\n"); out.write(" </div>\r\n"); out.write("\t<form action=\"select/SelectMusician\" method=\"post\">\r\n"); out.write("\t\t<table class=\"table\">\r\n"); out.write("\t\t\t<thead class=\"thead-light\">\r\n"); out.write("\t\t\t\t<tr>\r\n"); out.write("\t\t\t\t\t<th scope=\"col\">ID#</th>\r\n"); out.write("\t\t\t\t\t<th scope=\"col\">Musician SSN</th>\r\n"); out.write("\t\t\t\t\t<th scope=\"col\">Name</th>\r\n"); out.write("\t\t\t\t\t<th scope=\"col\">Phone Number</th>\r\n"); out.write("\t\t\t\t\t<th scope=\"col\"></th>\r\n"); out.write("\t\t\t\t</tr>\r\n"); out.write("\t\t\t</thead>\r\n"); out.write("\t\t\t<tbody>\r\n"); out.write("\t\t\t\t"); if (_jspx_meth_c_005fforEach_005f0(_jspx_page_context)) return; out.write("\r\n"); out.write("\t\t\t</tbody>\r\n"); out.write("\t\t</table>\r\n"); out.write("\t</form>\r\n"); out.write("</div>\r\n"); out.write("\t<a href=\"index.jsp\">back to home</a>\r\n"); out.write("</body>\r\n"); out.write("</html>\r\n"); } catch (java.lang.Throwable t) { if (!(t instanceof javax.servlet.jsp.SkipPageException)){ out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { if (response.isCommitted()) { out.flush(); } else { out.clearBuffer(); } } catch (java.io.IOException e) {} if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); else throw new ServletException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } } private boolean _jspx_meth_c_005fforEach_005f0(javax.servlet.jsp.PageContext _jspx_page_context) throws java.lang.Throwable { javax.servlet.jsp.PageContext pageContext = _jspx_page_context; javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut(); // c:forEach org.apache.taglibs.standard.tag.rt.core.ForEachTag _jspx_th_c_005fforEach_005f0 = (org.apache.taglibs.standard.tag.rt.core.ForEachTag) _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.get(org.apache.taglibs.standard.tag.rt.core.ForEachTag.class); boolean _jspx_th_c_005fforEach_005f0_reused = false; try { _jspx_th_c_005fforEach_005f0.setPageContext(_jspx_page_context); _jspx_th_c_005fforEach_005f0.setParent(null); // /select/selectMusician.jsp(30,4) name = items type = java.lang.Object reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_c_005fforEach_005f0.setItems((java.lang.Object) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${mus}", java.lang.Object.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null)); // /select/selectMusician.jsp(30,4) name = var type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_c_005fforEach_005f0.setVar("it"); int[] _jspx_push_body_count_c_005fforEach_005f0 = new int[] { 0 }; try { int _jspx_eval_c_005fforEach_005f0 = _jspx_th_c_005fforEach_005f0.doStartTag(); if (_jspx_eval_c_005fforEach_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\r\n"); out.write("\t\t\t\t\t<tr>\r\n"); out.write("\t\t\t\t\t\t<th scope=\"row\">"); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${it.mid}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null)); out.write("</th>\r\n"); out.write("\t\t\t\t\t\t<td>"); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${it.ssn}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null)); out.write("</td>\r\n"); out.write("\t\t\t\t\t\t<td>"); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${it.name}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null)); out.write("</td>\r\n"); out.write("\t\t\t\t\t\t<td>"); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${it.phone_no}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null)); out.write("</td>\r\n"); out.write("\t\t\t\t\t\t<td class=\"text-center\">\r\n"); out.write("\t\t\t\t\t\t\t<a href=\"DeleteMusician?id="); out.write((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${it.mid}", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null)); out.write("\" class=\"btn btn-danger btn-xs\">\r\n"); out.write("\t\t\t\t\t\t\t\t<span class=\"glyphicon glyphicon-trash\"></span>\r\n"); out.write("\t\t\t\t\t\t\t</a>\r\n"); out.write("\t\t\t\t\t\t</td>\r\n"); out.write("\t\t\t\t\t</tr>\r\n"); out.write("\t\t\t\t"); int evalDoAfterBody = _jspx_th_c_005fforEach_005f0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_c_005fforEach_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { return true; } } catch (java.lang.Throwable _jspx_exception) { while (_jspx_push_body_count_c_005fforEach_005f0[0]-- > 0) out = _jspx_page_context.popBody(); _jspx_th_c_005fforEach_005f0.doCatch(_jspx_exception); } finally { _jspx_th_c_005fforEach_005f0.doFinally(); } _005fjspx_005ftagPool_005fc_005fforEach_0026_005fvar_005fitems.reuse(_jspx_th_c_005fforEach_005f0); _jspx_th_c_005fforEach_005f0_reused = true; } finally { org.apache.jasper.runtime.JspRuntimeLibrary.releaseTag(_jspx_th_c_005fforEach_005f0, _jsp_getInstanceManager(), _jspx_th_c_005fforEach_005f0_reused); } return false; } }
c7191bf07cfc6a9db417be4c0db73464016cb492
fbeaff12239b0c7decd7553bbb0142dc0846e9eb
/src/main/java/com/projecttau/defaults/commands/GamemodeCommand.java
1eef8c79bf4ade701863b1606b7449a525b02743
[ "MIT" ]
permissive
ZombieStriker/ProjectTau
59c5bdb9b9cc5b77932f28a0f5205d95d9e0a678
9be1c8d3b485c1ca6f7625065c202516d4e13afe
refs/heads/main
2023-05-20T03:43:32.143902
2021-06-13T09:35:20
2021-06-13T09:35:20
375,923,931
0
0
null
null
null
null
UTF-8
Java
false
false
1,095
java
package com.projecttau.defaults.commands; import com.projecttau.bootstrap.Bootstrap; import net.minestom.server.command.builder.Command; import net.minestom.server.entity.GameMode; import net.minestom.server.entity.Player; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class GamemodeCommand extends Command { public GamemodeCommand() { super("gamemode","g"); // Executed if no other executor can be used setDefaultExecutor((sender, context) -> { if(sender.isPlayer()){ Player player = sender.asPlayer(); if(player.getPermissionLevel() >= 2){ if(player.isCreative()){ player.setGameMode(GameMode.SURVIVAL); player.sendMessage("Setting you back to survival mode"); }else{ player.setGameMode(GameMode.CREATIVE); player.sendMessage("Setting you to creative mode."); } } } }); } }
6da65a8b5631528d536cfa658aaf157aa694c3ed
fef4db06d1b6d2b84d4a5453537c30f7aa5145bc
/src/co/tapdatapp/TapReady.java
7f80ce34c05f3f47d24472f6c623a02e2aed5137
[]
no_license
MikeConner/TapDatAndroid
7f60701f281f2ce61fce98c7a004b079f9b9f105
d3e90805788a0d6d202d49535389e90946a2caea
refs/heads/master
2022-01-14T16:31:07.089533
2013-08-18T06:27:26
2013-08-18T06:27:26
12,041,552
0
0
null
null
null
null
UTF-8
Java
false
false
2,231
java
package co.tapdatapp; import android.os.Bundle; import android.app.Activity; import android.app.PendingIntent; import android.nfc.NdefMessage; import android.nfc.NfcAdapter; import android.content.Intent; import android.content.IntentFilter; import android.content.IntentFilter.MalformedMimeTypeException; import android.view.Menu; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class TapReady extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tap_ready); Bundle extras = getIntent().getExtras(); if (extras != null) { String tip_amount = extras.getString("tip_amount"); TextView edit_text1 = (TextView) findViewById(R.id.textView1); edit_text1.setText(tip_amount); } NfcAdapter mNfcAdapter = NfcAdapter.getDefaultAdapter(this); Object mNfcPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); // Intent filters for exchanging over p2p. IntentFilter ndefDetected = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED); try { ndefDetected.addDataType("tapdat/performer"); } catch (MalformedMimeTypeException e) { } IntentFilter[] mNdefExchangeFilters = new IntentFilter[] { ndefDetected }; //Toast.makeText(this, mNdefExchangeFilters.toString(), Toast.LENGTH_LONG).show(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.tap_ready, menu); return true; } @Override protected void onNewIntent(Intent intent) { // NDEF exchange mode // check write mode: !mWriteMode && if ( NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) { NdefMessage[] msgs = NfcUtils.getNdefMessages(intent); //fireFriendRequest(msgs[0]); Intent i = new Intent(this, TipSuccess.class); startActivity(i); Toast.makeText(this, "You tapped dat ass via nfc!", Toast.LENGTH_LONG).show(); } } public void readyForTap(View view){ } }
62e9e7e36cdf8e83fc6c9bddec4f59c3146eb958
ed930f339e8dbdccf359a54a71f4aa7cf6839132
/app/src/main/java/com/example/check24products/presentation/MainActivity.java
27951e123828aa53e09325e05a4800558173b73c
[]
no_license
umairqidwai/Check24Products
3e7d49e77e41a680e9dbb639b9aaba0547480cd8
6442eb28a6bf3fc4f5844f69c766eaacacf92040
refs/heads/main
2023-02-15T01:44:35.345193
2021-01-10T01:08:01
2021-01-10T01:08:01
326,806,698
0
0
null
null
null
null
UTF-8
Java
false
false
4,392
java
package com.example.check24products.presentation; import android.os.Bundle; import android.view.View; import android.widget.ImageView; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.DividerItemDecoration; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; import com.example.check24products.R; import com.example.check24products.presentation.adapter.ProductListAdapter; import com.example.check24products.databinding.ActivityMainBinding; import com.example.check24products.data.model.Header; import com.example.check24products.data.model.Product; import com.example.check24products.presentation.presenter.MainPresenter; import com.example.check24products.presentation.presenter.contract.MainView; import com.google.android.material.tabs.TabLayout; import java.util.List; public class MainActivity extends AppCompatActivity implements MainView { private ActivityMainBinding binding; private ProductListAdapter mAdapter; private MainPresenter mPresenter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binding = ActivityMainBinding.inflate(getLayoutInflater()); View view = binding.getRoot(); setContentView(view); initView(); mPresenter = new MainPresenter(this); mPresenter.getProducts(false); } private void initView() { mAdapter = new ProductListAdapter(getApplicationContext(), new ProductListAdapter.ProductListAdapterListener() { @Override public void onLoadImage(String imageUrl, ImageView imageView) { Glide.with(getApplicationContext()).load(imageUrl).placeholder(R.drawable.ic_launcher_background).into(imageView); } }); binding.refreshButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mPresenter.getProducts(true); } }); LinearLayoutManager llm = new LinearLayoutManager(getApplicationContext()); RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(getApplicationContext(), DividerItemDecoration.VERTICAL); binding.productListRv.setLayoutManager(llm); binding.productListRv.setAdapter(mAdapter); binding.productListRv.addItemDecoration(itemDecoration); binding.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() { @Override public void onTabSelected(TabLayout.Tab tab) { String filterName = tab.getText().toString(); mPresenter.getFilteredProduct(filterName); } @Override public void onTabUnselected(TabLayout.Tab tab) { } @Override public void onTabReselected(TabLayout.Tab tab) { } }); } @Override public void loadHeader(Header header) { binding.headerTitleTextview.setText(header.getHeaderTitle()); binding.headerDescriptionTextview.setText(header.getHeaderDescription()); } @Override public void loadFilters(List<String> filters) { for (int i = 0; i < filters.size(); i++) { binding.tabLayout.addTab(binding.tabLayout.newTab().setText(filters.get(i))); } } @Override public void loadProducts(List<Product> productList) { mAdapter.setmProductList(productList); mAdapter.notifyDataSetChanged(); } @Override public void showProgressBar() { binding.progressBar.setVisibility(View.VISIBLE); } @Override public void hideProgressBar() { binding.progressBar.setVisibility(View.GONE); } @Override public void refresh(List<Product> productList) { mAdapter.setmProductList(productList); mAdapter.notifyDataSetChanged(); TabLayout.Tab tab = binding.tabLayout.getTabAt(0); if(tab!=null){ tab.select(); } } @Override public void onError(String errMsg) { Toast.makeText(this, errMsg, Toast.LENGTH_SHORT).show(); } @Override public void onFilterProdcutList(String filterName) { mAdapter.setFilter(filterName); } }
d83f1f52a41e19e2b7859c0461ed1f3815ed3b6c
6d62df72b9e974ed2a0e1c636018f5cc79719af0
/app/src/main/java/com/zy/yaoproject/base/inter/IBaseView.java
728885612416070ba24b673f989cdabbbda6eb0e
[]
no_license
doutuifei/YaoProject
5b2fb257f716fd966b505af1ba5cd93ace869b57
61958bf278acc0822ac32c59ec572b8e628f959f
refs/heads/master
2021-09-14T07:13:07.980485
2018-05-09T11:06:11
2018-05-09T11:06:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,086
java
package com.zy.yaoproject.base.inter; import android.content.Context; import android.support.v4.widget.SwipeRefreshLayout; /** * Created by muzi on 2018/4/3. * [email protected] */ public interface IBaseView { /** * 获取当前上下文对象 * * @return */ Context getContext(); /** * 显示进度条 */ void showProgress(); /** * 隐藏进度条 */ void hideProgress(); /** * 刷新 * * @param refreshLayout * @param onRefreshListener */ void initRefresh(SwipeRefreshLayout refreshLayout, SwipeRefreshLayout.OnRefreshListener onRefreshListener); /** * 刷新完成 */ void refreshFinish(); /** * 根据资源文件id弹出toast * * @param resId 资源文件id */ void showToast(int resId); /** * 根据字符串弹出toast * * @param msg 提示内容 */ void showToast(String msg); /** * 结束当前页面 */ void close(); /** * 登录 */ void startLogin(); }
57305ba8d78bef87eacb1a72170a2930191a9b03
ba39bfacdd72261fb15d6dc6b93c69e0ff0562f3
/src/gwt/dojo/mobile/client/Pane.java
b99fc4b9bc14148b26e033f69c4d373a871a971a
[ "AFL-3.0", "BSD-3-Clause", "AFL-2.1", "Apache-2.0" ]
permissive
andrescabrera/gwt-dojo-toolkit
4cf0f7bf3061f1f1248dec731aca8d6fd91ac8dc
4faf915c62871b2267a49ce0cd703dd98d986644
refs/heads/master
2020-05-30T03:49:29.199573
2013-06-17T10:57:52
2013-06-17T10:57:52
40,503,638
0
0
null
null
null
null
UTF-8
Java
false
false
705
java
package gwt.dojo.mobile.client; import gwt.dojo.dijit.client.IContained; import gwt.dojo.dijit.client._WidgetBase; /** * A simple pane widget. * <p> * Pane is a simple general-purpose pane widget. It is a widget, but can be * regarded as a imple {@code <div>} element. * <p> * {@code baseClass='mblPane'} */ public class Pane extends _WidgetBase implements IContained { public static final String MODULE = "dojox/mobile/Pane"; /** * Not directly instantiable. * <p> * All subclasses must also define a protected, empty, no-arg constructor. */ protected Pane() { } /** * Calls resize() of each child widget. */ public final native void resize() /*-{ this.resize(); }-*/; }
1e99fd6a8d21ab51ddd72cd0afe40aa252c14832
821e348b780a7917f78fa0e8cd397230f3cf9f8d
/src/com/topsci/kwang/mobilecode/ArrayOfString.java
3addefbc949f9dd6b56e04cd02ad2904a378878a
[]
no_license
mmlvkk/webserviceClientTest
7bb4d34184e3f61c4ea6a2ac0603b20f10a87b02
a9b1c654c104b7caec77ae7ecb32035679d455e3
refs/heads/master
2020-12-24T18:32:57.288155
2016-05-18T06:06:00
2016-05-18T06:06:00
56,495,139
0
0
null
null
null
null
UTF-8
Java
false
false
1,899
java
package com.topsci.kwang.mobilecode; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for ArrayOfString complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="ArrayOfString"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="string" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ArrayOfString", propOrder = { "string" }) public class ArrayOfString { @XmlElement(nillable = true) protected List<String> string; /** * Gets the value of the string property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the string property. * * <p> * For example, to add a new item, do as follows: * <pre> * getString().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link String } * * */ public List<String> getString() { if (string == null) { string = new ArrayList<String>(); } return this.string; } }
346538de5f31c50f5a2cf34237c836148919af9f
8a5e3479744f9d96c684b31926f438748c3abf7f
/stream-reader/src/main/java/com/avenuecode/talk/stream/reader/model/Pixel.java
2a0b66591aaff2881f405099ca95ddf399ed5781
[]
no_license
smarotta/json-stream
000b79c6241a46dbf3ce996d979f855b3bbb7674
4fe82dd903a7d360e5f835ef055b0f4c9c86692c
refs/heads/master
2021-03-27T15:15:19.352613
2017-02-20T20:24:02
2017-02-20T20:24:02
77,847,037
3
0
null
null
null
null
UTF-8
Java
false
false
1,090
java
package com.avenuecode.talk.stream.reader.model; public class Pixel { private int x; private int y; private int a; private int r; private int g; private int b; public Pixel() { } public Pixel(int x, int y, int argb) { this.x = x; this.y = y; setARGB(argb); } public int getARGB() { int argb = 0; argb += a << 24; argb += r << 16; argb += g << 8; argb += b; return argb; } public void setARGB(int argb) { a = (argb & 0xFF000000) >> 24; r = (argb & 0x00FF0000) >> 16; g = (argb & 0x0000FF00) >> 8; b = (argb & 0x000000FF) >> 0; } public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } public int getA() { return a; } public void setA(int a) { this.a = a; } public int getR() { return r; } public void setR(int r) { this.r = r; } public int getG() { return g; } public void setG(int g) { this.g = g; } public int getB() { return b; } public void setB(int b) { this.b = b; } }
ac52596bafd9f4e955b2d03226d798bb9068400b
72cc7541542905823a38d73b8ee4a0941e1b0b88
/load-service-util/src/main/java/com/xu/util/Excel/ExportExcel.java
06dff50b75c03fade2d7ba94bfc009665cabd9f7
[]
no_license
xuhongda/load-service
8dd6f08ebbaf0a980501b4bdf6c7173fba252ee8
21b710904b378d31dbb56a67aa78f6648ee20966
refs/heads/master
2022-12-22T13:26:20.663306
2019-07-29T12:47:57
2019-07-29T12:47:57
129,882,390
0
0
null
null
null
null
UTF-8
Java
false
false
7,939
java
package com.xu.util.Excel; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.xssf.streaming.SXSSFCell; import org.apache.poi.xssf.streaming.SXSSFRow; import org.apache.poi.xssf.streaming.SXSSFSheet; import org.apache.poi.xssf.streaming.SXSSFWorkbook; import javax.servlet.http.HttpServletResponse; import java.io.FileOutputStream; import java.io.OutputStream; import java.lang.reflect.Method; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Map; /** * 将HSSFWorkbook 对象改换成 HSSFWorkbook 突破EXCSEL 六万多条限制 SXSSFWorkbook 突破大量数据导致的OOM * HSSFSheet==》》XSSFSheet ==》》SXSSFWorkbook * HSSFRow ===》》XSSFRow * HSSFCell ===》》XSSFCell * @author xuhongda on 2018/4/24 * com.zhiyuan.riskcloud.portrait.service.Excel * dataplatform */ public class ExportExcel { /*** * 构造方法 */ private ExportExcel() { } /*** * 工作簿 */ private static /*HSSFWorkbook*//*XSSFWorkbook*/ SXSSFWorkbook workbook; /*** * sheet */ private static /*HSSFSheet*//*XSSFSheet */SXSSFSheet sheet; /*** * 标题行开始位置 */ private static final int TITLE_START_POSITION = 0; /*** * 时间行开始位置 */ private static final int DATEHEAD_START_POSITION = 1; /*** * 表头行开始位置 */ private static final int HEAD_START_POSITION = 2; /*** * 文本行开始位置 */ private static final int CONTENT_START_POSITION = 3; /** * * @param dataList * 对象集合 * @param titleMap * 表头信息(对象属性名称->要显示的标题值)[按顺序添加] * @param sheetName * sheet名称和表头值 * @param res * response 对象 * @param fileNameAndPath * 文件完整路径名 */ public static void excelExport(List<?> dataList, Map<String, String> titleMap, String sheetName,String fileNameAndPath,HttpServletResponse res) { // 初始化workbook initHSSFWorkbook(sheetName); // 标题行 createTitleRow(titleMap, sheetName); // 时间行 createDateHeadRow(titleMap); // 表头行 createHeadRow(titleMap); // 文本行 createContentRow(dataList, titleMap); //设置自动伸缩 autoSizeColumn(titleMap.size()); // 写入处理结果 try { OutputStream out = new FileOutputStream( fileNameAndPath); workbook.write(out); out.close(); /*+++++++++++++++++++一以下载文件格式 ajax 异步请求不行 需要直接请求方式++++++++++++++++++++++++*/ // String fileName = "XXX表"; /*ByteArrayOutputStream os = new ByteArrayOutputStream(); workbook.write(os); byte[] content = os.toByteArray(); InputStream is = new ByteArrayInputStream(content); // 设置response参数,可以打开下载页面 res.reset(); res.setContentType("application/vnd.ms-excel;charset=utf-8"); res.setHeader("Content-Disposition", "attachment;filename=" + new String((fileName + ".xlsx").getBytes(), "iso-8859-1")); ServletOutputStream out = res.getOutputStream(); BufferedInputStream bis = null; BufferedOutputStream bos = null; try { bis = new BufferedInputStream(is); bos = new BufferedOutputStream(out); byte[] buff = new byte[2048]; int bytesRead; // Simple read/write loop. while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) { bos.write(buff, 0, bytesRead); } } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } finally { if (bis != null) { bis.close(); } if (bos != null) { bos.close(); } }*/ /*+++++++++++++++++++++++++++++++++++++++++++++*/ } catch (Exception e) { e.printStackTrace(); } } /*** * * @param sheetName * sheetName */ private static void initHSSFWorkbook(String sheetName) { //workbook = new HSSFWorkbook(); //workbook=new XSSFWorkbook(); workbook = new SXSSFWorkbook(); sheet = workbook.createSheet(sheetName); } /** * 生成标题(第零行创建) * @param titleMap 对象属性名称->表头显示名称 * @param sheetName sheet名称 */ private static void createTitleRow(Map<String, String> titleMap, String sheetName) { CellRangeAddress titleRange = new CellRangeAddress(0, 0, 0, titleMap.size() - 1); sheet.addMergedRegion(titleRange); /*HSSFRow*/ /*XSSFRow*/SXSSFRow titleRow = sheet.createRow(TITLE_START_POSITION); /* HSSFCell*//*XSSFCell*/SXSSFCell titleCell = titleRow.createCell(0); titleCell.setCellValue(sheetName); } /** * 创建时间行(第一行创建) * @param titleMap 对象属性名称->表头显示名称 */ private static void createDateHeadRow(Map<String, String> titleMap) { CellRangeAddress dateRange = new CellRangeAddress(1, 1, 0, titleMap.size() - 1); sheet.addMergedRegion(dateRange); /*HSSFRow*//*XSSFRow*/SXSSFRow dateRow = sheet.createRow(DATEHEAD_START_POSITION); /*HSSFCell*//*XSSFCell*/SXSSFCell dateCell = dateRow.createCell(0); dateCell.setCellValue(new SimpleDateFormat("yyyy年MM月dd日").format(new Date())); } /** * 创建表头行(第二行创建) * @param titleMap 对象属性名称->表头显示名称 */ private static void createHeadRow(Map<String, String> titleMap) { // 第1行创建 /*HSSFRow*//*XSSFRow*/SXSSFRow headRow = sheet.createRow(HEAD_START_POSITION); int i = 0; for (String entry : titleMap.keySet()) { /* HSSFCell*/ /*XSSFCell*/SXSSFCell headCell = headRow.createCell(i); headCell.setCellValue(titleMap.get(entry)); i++; } } /** * * @param dataList 对象数据集合 * @param titleMap 表头信息 */ private static void createContentRow(List<?> dataList, Map<String, String> titleMap) { try { int i=0; for (Object obj : dataList) { /*HSSFRow*//*XSSFRow*/SXSSFRow textRow = sheet.createRow(CONTENT_START_POSITION + i); int j = 0; for (String entry : titleMap.keySet()) { String method = "get" + entry.substring(0, 1).toUpperCase() + entry.substring(1); Method m = obj.getClass().getMethod(method, null); Object o =m.invoke(obj, null); String value = null; if (o != null){ value = o.toString(); } // String value = m.invoke(obj, null).toString(); /* HSSFCell*//*XSSFCell*/SXSSFCell textcell = textRow.createCell(j); textcell.setCellValue(value); j++; } i++; } } catch (Exception e) { e.printStackTrace(); } } /** * 自动伸缩列(如非必要,请勿打开此方法,耗内存) * @param size 列数 */ private static void autoSizeColumn(Integer size) { // sheet.trackAllColumnsForAutoSizing(); for (int j = 0; j < size; j++) { sheet.autoSizeColumn(j); } } }
410436df7a0b07b07877e9bb49c6f5f7a87d8c6b
e7f8acff7948cf6618043ec7b998867b7c6ad831
/java/blog1/src/main/java/com/pzh/blog/controls/admin/TagControl.java
bed80f37466114057171e9c153787fef46a8cdfb
[]
no_license
z778107203/pengzihao1999.github.io
9b97ecefba6557f1f815a5f17da33118ddf78b37
d683ba31772fb3a42085cb44ee0601637bcdd84e
refs/heads/master
2022-11-13T10:44:00.988950
2019-10-08T15:29:04
2019-10-08T15:29:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,350
java
package com.pzh.blog.controls.admin; import com.pzh.blog.domain.Tag; import com.pzh.blog.domain.Type; import com.pzh.blog.service.ITagService; import com.pzh.blog.service.ITypeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.mvc.support.RedirectAttributes; @Controller @RequestMapping("/admin/tag") public class TagControl { @Autowired private ITagService tagService ; //分页 @GetMapping public String tagPage(@PageableDefault(size = 5) Pageable pageable, Model model){ Page<Tag> tags = tagService.TagPage(pageable); model.addAttribute("tagPages",tags); return "admin/tag"; } //编辑,跳转到编辑页面 @GetMapping("/edit/{id}") public String editTag(@PathVariable Long id,Model model){ model.addAttribute("tagid",id); return "admin/tag-edit"; } //删除 @GetMapping("/delete/{id}") public String deleteTag(@PathVariable Long id){ tagService.deleteTag(id); return "redirect:/admin/tag"; } //转发到新增type页面 @GetMapping("/add") public String addTagpage(){ return "/admin/tag-add"; } //新增Type并且重定向到查询全部页面 @PostMapping("/addtag") public String addTag(@RequestParam(name = "tagname") String tagname, @RequestParam(name = "tagid") Long id, RedirectAttributes redirectAttributes){ Tag tag = new Tag(); tag.setName(tagname); if(tagname==null||tagname.trim().equals("")){ redirectAttributes.addFlashAttribute("msg","分类不能为空"); return "redirect:/admin/tag"; } Tag findtag = tagService.findTagByName(tag); if(findtag!=null){ redirectAttributes.addFlashAttribute("msg","不能重复添加分类"); return "redirect:/admin/tag"; } if(id!=null){ tag.setId(id); } tagService.saveTag(tag); return "redirect:/admin/tag"; } }
4f0006e4e3fa792359a7869f6fe591a3cd974195
1f19aec2ecfd756934898cf0ad2758ee18d9eca2
/u-1/u-11/u-11-111/u-11-111-1112/u-11-111-1112-11113/u-11-111-1112-11113-f5296.java
fedd489f32b2f62630c746e58ea26b971b725ed5
[]
no_license
apertureatf/perftest
f6c6e69efad59265197f43af5072aa7af8393a34
584257a0c1ada22e5486052c11395858a87b20d5
refs/heads/master
2020-06-07T17:52:51.172890
2019-06-21T18:53:01
2019-06-21T18:53:01
193,039,805
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117 5654831763331
aa7d8b7203ef5bbd3ae18f459b6dd854039e0fbb
cd7624204dc1aa5b1b08f2d27c8b1a62b5280e23
/src/main/java/com/example/blog/po/Tag.java
6ef1d4f9df8296a762ddfb0b254623ffea0c0efd
[]
no_license
coder-yyz/spring-boot-blog
a176bd9393d4f745993d6f8ad3f16f80990ded38
3db5e7bfa0fda0ee778e7f961d2b8cda68088023
refs/heads/master
2022-04-09T21:17:47.397633
2020-03-26T13:33:46
2020-03-26T13:33:46
250,263,682
2
0
null
null
null
null
UTF-8
Java
false
false
907
java
package com.example.blog.po; import javax.persistence.*; import java.util.ArrayList; import java.util.List; @Entity @Table(name = "t_tag") public class Tag { @Id @GeneratedValue private Long id; private String name; @ManyToMany(mappedBy = "tags") private List<Blog> blogs = new ArrayList<>(); public Tag() { } 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<Blog> getBlogs() { return blogs; } public void setBlogs(List<Blog> blogs) { this.blogs = blogs; } @Override public String toString() { return "Tag{" + "id=" + id + ", name='" + name + '\'' + '}'; } }
818f9b5dfe59174beaf722e0340b2cac862c2e58
8e2fa299246914d30ac47430d9799f4585aae270
/CompleteWebsiteWithJsp/src/java/com/mohitpaudel/webapplication/dao/SecondContentDao.java
09b13c88029f54072b7dde82f898be04941ab63c
[]
no_license
equinoxmohit/WebApplicationWithJsp
496b6c4243a80f1b6760c00b2feaf07e65b3a2af
4af20c23bb0aeb1bd56a3cbd94f08717d8124e04
refs/heads/master
2021-01-20T20:21:46.252041
2016-08-14T15:50:54
2016-08-14T15:50:54
65,612,619
0
0
null
null
null
null
UTF-8
Java
false
false
580
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 com.mohitpaudel.webapplication.dao; import com.mohitpaudel.webapplication.entity.SecondContent; import java.sql.SQLException; import java.util.List; /** * * @author Mohit */ public interface SecondContentDao { List<SecondContent> getAll() throws SQLException, ClassNotFoundException; int update(SecondContent secondContent) throws SQLException, ClassNotFoundException; }
e6834fb493c4f5f311c5a762185df9aa57bd903d
57399432ae3f143f704edb17745f30e9bf70e63f
/src/main/java/fr/telecom_st_etienne/ontientlebonbout/repository/search/ReponseSearchRepository.java
8f3fe2dcb7facb2d7a8a1b4936306f2ef8f0b627
[]
no_license
clementFrade/OnTientLeBonBout
a92152c764f495d16926113a215381acaf8f171e
952f7d7a6435fdf30d1377fc89408fa68016dcea
refs/heads/master
2022-12-21T21:25:25.759037
2020-01-27T07:50:41
2020-01-27T07:50:41
232,601,694
0
0
null
2022-12-16T04:43:16
2020-01-08T16:03:32
Java
UTF-8
Java
false
false
384
java
package fr.telecom_st_etienne.ontientlebonbout.repository.search; import fr.telecom_st_etienne.ontientlebonbout.domain.Reponse; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository; /** * Spring Data Elasticsearch repository for the {@link Reponse} entity. */ public interface ReponseSearchRepository extends ElasticsearchRepository<Reponse, Long> { }
a0b1950b125a14f36abe5109b497dd32a3fed83d
8140c99028ec7145162ffe0ae0ed9b08ae13ce27
/android/src/net/team11/pixeldungeon/playservices/adlisteners/RewardAdListener.java
f31c0dd8f187752bd5012d05b649bb5716a18586
[]
no_license
beenham/PixelDungeon
0df30430cdd2f9eedf1281a0b1f13526103ad604
8c4c9273cf5e783b01c2a345ea597b56b05cfa3d
refs/heads/master
2020-03-10T06:05:11.447740
2020-03-03T21:55:35
2020-03-03T21:55:35
129,231,369
0
0
null
null
null
null
UTF-8
Java
false
false
2,216
java
package net.team11.pixeldungeon.playservices.adlisteners; import android.util.Log; import com.google.android.gms.ads.reward.RewardItem; import com.google.android.gms.ads.reward.RewardedVideoAdListener; import net.team11.pixeldungeon.playservices.AdmobClient; import net.team11.pixeldungeon.screens.AbstractScreen; import net.team11.pixeldungeon.screens.ScreenManager; import net.team11.pixeldungeon.screens.components.dialog.RewardDialog; import net.team11.pixeldungeon.utils.Util; public class RewardAdListener implements RewardedVideoAdListener { private static final String TAG = "RewardAdListener"; private AdmobClient admobClient; private boolean loaded; public RewardAdListener(AdmobClient admobClient) { this.admobClient = admobClient; loaded = false; } @Override public void onRewardedVideoAdLoaded() { loaded = true; Log.i(TAG,"Video loaded.."); } @Override public void onRewardedVideoAdOpened() { loaded = false; Log.i(TAG,"Video opened.."); } @Override public void onRewardedVideoStarted() { Log.i(TAG,"Video started.."); } @Override public void onRewardedVideoAdClosed() { Log.i(TAG,"Video closed.."); admobClient.loadRewardAd(); } @Override public void onRewarded(RewardItem rewardItem) { Log.i(TAG,"Video rewarded.. " + rewardItem.getType() + ": " + rewardItem.getAmount()); Util.getInstance().getStatsUtil().getGlobalStats().addCurrentCoins(rewardItem.getAmount()); Util.getInstance().saveGame(); new RewardDialog(rewardItem.getAmount()).show((AbstractScreen) ScreenManager .getInstance().getScreen()); } @Override public void onRewardedVideoAdLeftApplication() { Log.i(TAG,"Video rewarded but left.."); } @Override public void onRewardedVideoAdFailedToLoad(int i) { } @Override public void onRewardedVideoCompleted() { Log.i(TAG,"Video Completed.."); } public boolean isLoaded() { Log.i(TAG,"Is loaded? " + loaded); if (!loaded) { admobClient.loadRewardAd(); } return loaded; } }
a4722094e63ee70dcb7477641c279776aa9e3504
f20aa19601fa453a18bd6504c98ec14f4d609571
/src/main/java/com/usa/ciclo3/reto3/web/ReservationControllerWeb.java
e740524b5cee00054f6396eabc31a21bd62b53f1
[]
no_license
RedmiRei/Reto3_4
788111c73af8e237906ae7ae7349c1ed2baa0270
25d74c69ecea53c1b9bb4d038408b7d610658ac1
refs/heads/master
2023-08-25T17:19:03.155974
2021-11-10T02:19:26
2021-11-10T02:19:26
423,009,204
1
3
null
null
null
null
UTF-8
Java
false
false
2,936
java
package com.usa.ciclo3.reto3.web; import java.util.List; import java.util.Optional; import com.usa.ciclo3.reto3.model.Reservation; import com.usa.ciclo3.reto3.reports.CounterClients; import com.usa.ciclo3.reto3.reports.StatusReservation; import com.usa.ciclo3.reto3.services.ReservationServices; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; /** * * @author USUARIO */ @RestController @RequestMapping("/api/Reservation") @CrossOrigin(origins = "*", methods= {RequestMethod.GET,RequestMethod.POST,RequestMethod.PUT,RequestMethod.DELETE}) public class ReservationControllerWeb { @Autowired private ReservationServices reservationServices; @GetMapping("/all") public List<Reservation> getReservation(){ return reservationServices.getAll(); } @GetMapping("/{id}") public Optional<Reservation> getReservation(@PathVariable("id") int idReservation) { return reservationServices.getReservation(idReservation); } @PostMapping("/save") @ResponseStatus(HttpStatus.CREATED) public Reservation save(@RequestBody Reservation reservation) { return reservationServices.save(reservation); } @PutMapping("/update") @ResponseStatus(HttpStatus.CREATED) public Reservation update(@RequestBody Reservation reservation) { return reservationServices.update(reservation); } @DeleteMapping("/{id}") @ResponseStatus(HttpStatus.NO_CONTENT) public boolean delete(@PathVariable("id") int idReservation) { return reservationServices.deleteReservation(idReservation); } @GetMapping("/report-status") public StatusReservation getReservationsStatusReport(){ return reservationServices.getReservationStatusReport(); } @GetMapping("/report-dates/{dateOne}/{dateTwo}") public List<Reservation> getReservationsReportDates(@PathVariable("dateOne") String dateOne, @PathVariable("dateTwo") String dateTwo){ return reservationServices.getReservationPeriod(dateOne, dateTwo); } @GetMapping("/report-clients") public List<CounterClients> getClients() { return reservationServices.getTopClients(); } }
309c212360a13b140bfb9389e72d9245344cdb23
fc8bc6d35fb82791ceb15e0d2729755ab5a384e5
/app/src/main/java/com/css/aimstar/aimstar/adapter/NearbyCollegesAdapter.java
064d8cbe1a3bbc4e3c7b5c0a2c23bfd2142c93c1
[]
no_license
rizshivalli/AimStar
d7957fff1a98bc4877cdffbd8b215f0ce775e3b5
4cc6153de4a299999c964084ff81e340add17ca0
refs/heads/master
2020-03-25T01:42:40.949237
2018-08-02T06:35:08
2018-08-02T06:35:08
143,252,556
0
0
null
null
null
null
UTF-8
Java
false
false
3,401
java
package com.css.aimstar.aimstar.adapter; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.css.aimstar.aimstar.R; import com.css.aimstar.aimstar.model.NearbyColleges; import java.util.List; public class NearbyCollegesAdapter extends RecyclerView.Adapter<NearbyCollegesAdapter.ViewHolder> { private List<NearbyColleges> nearbyColleges; private Context context; private String titlevar,imagevar; private String descriptionvar,path; public NearbyCollegesAdapter(Context applicationContext, List<NearbyColleges> nearbyCollegesList) { this.context = applicationContext; this.nearbyColleges = nearbyCollegesList; } public class ViewHolder extends RecyclerView.ViewHolder{ //public TextView title,description; public TextView title,description,path; public ImageView image; public ViewHolder(final View parent) { super(parent); title = (TextView) parent.findViewById(R.id.name); description = (TextView) parent.findViewById(R.id.description); image=(ImageView) parent.findViewById(R.id.image); } /* @Override public void onClick(View view) { Fragment2 descriptionFragment = new Fragment2(); Bundle args = new Bundle(); args.putString("title", titlevar); args.putString("description", descriptionvar); descriptionFragment.setArguments(args); MainActivity.fragmentManager.beginTransaction().replace(R.id.mainf, descriptionFragment, "null").addToBackStack(null).commit(); }*/ public void setScheduleData(NearbyColleges schedule) { this.title.setText(schedule.getTitle()); titlevar = schedule.getTitle(); this.description.setText(schedule.getDescription()); descriptionvar = schedule.getDescription(); //this.path.setText(schedule.getImage()); //imagevar=schedule.getImage(); // Glide.with(context).load(schedule.getImage()).into(image); } } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.nearby_colleges_card, parent, false); return new ViewHolder(itemView); } @Override public void onBindViewHolder(ViewHolder holder, int position) { NearbyColleges row = nearbyColleges.get(position); holder.title.setText(row.getTitle()); holder.description.setText(row.getDescription()); // holder.path.setText(row.getImage()); //String imageurl = row.getImage(); // Log.i(TAG, "onBindViewHolder:" + imageurl); Glide.with(holder.image.getContext()).load(row.getImage()).into(holder.image); ViewHolder inHolder = (ViewHolder) holder; NearbyColleges schedule = (NearbyColleges) nearbyColleges.get(position); // Picasso.with(context).load(row.getImage()).into(holder.image); inHolder.setScheduleData(schedule); } @Override public int getItemCount() { return nearbyColleges.size(); } }
ed0a2207360a9ad9bf1a736dab3427a23ad611e9
5fa37936066d19b9a287df4fa88a51a34effec27
/Workshop/src/systemSplit/core/command/factory/CommandFactory.java
5bcb0f2802e6cedc76367c970fdf8ce2639f11f6
[]
no_license
Kaloyan86/JavaOOP
4cb77b49ed41f5dd54f9d6ac6b4cb03dd59fa44c
f708b50c8dd1a732b7c4e1dba28e633dbf33f024
refs/heads/master
2020-09-04T14:53:38.177864
2019-11-05T14:07:33
2019-11-05T14:07:33
198,724,158
1
0
null
null
null
null
UTF-8
Java
false
false
920
java
package systemSplit.core.command.factory; import systemSplit.core.command.Command; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; public final class CommandFactory { private static final String BASE_COMMAND_PACKAGE = "systemSplit.core.command."; private static final String COMMAND_SUFFIX = "Command"; @SuppressWarnings("unchecked") public static Command buildCommand(String name, Object... args) { try { Class commandClass = Class.forName(BASE_COMMAND_PACKAGE + name + COMMAND_SUFFIX); Constructor<Command> constructor = commandClass.getDeclaredConstructors()[0]; return constructor.newInstance(new Object[]{args}); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | InvocationTargetException e) { e.printStackTrace(); } return null; } }
[ "me4ence3965" ]
me4ence3965
0907d72b7521c9a5f77f347e9afdb8b59d6a03e0
cb1dd4b55242d37526f931b5e2cf6304bcf00286
/src/lang/SBTest.java
f5ece300f18125aee652e35432065f083a4155b4
[]
no_license
Jungyerin/chapter03
f8f33ced9aecc558c2b736836c5fc49b72e5be74
232584002b66c469b0219fec4b12888e1062b57e
refs/heads/master
2021-01-20T00:51:08.110263
2017-04-24T05:06:23
2017-04-24T05:06:23
89,199,803
0
0
null
null
null
null
UTF-8
Java
false
false
918
java
package lang; public class SBTest { public static void main(String[] args) { // TODO Auto-generated method stub //생성 StringBuffer sb = new StringBuffer("This"); System.out.println(sb); //문자열 추가 sb.append(" is pencil"); System.out.println(sb); //삽입 sb.insert(7, " My"); System.out.println(sb); //치환 sb.replace(8, 10, "your"); System.out.println(sb); //버퍼 크기 조정 sb.setLength(3); System.out.println(sb); //더 중요한 내용 //문자열 + 연산은 내부적으로 StringBuffer 객체로 변환된다. String s1="Hello"+"World"+10+true; String s2 = new StringBuffer("Hello"). append("World"). append(10). append(true).toString(); System.out.println(s1); //s1을 실행하면 내부적으로 s2로 변환하여 실행한다. System.out.println(s2); } }
[ "JYL@DESKTOP-TORHHDE" ]
JYL@DESKTOP-TORHHDE
493ded3c2baf7ee6eabd890014648067295e6894
c1f3b8bbd97585c32187a33e27115aa0c547d35f
/src/main/java/net/fabricmc/loader/transformer/PublicAccessTransformer.java
9f6795229d5c4c28318d52856ebc30bfdd9db333
[ "Apache-2.0" ]
permissive
asiekierka/fabric-loader
8624f6933a6d8934ca8664ca4619a6f6398824f9
16d4470208e14c16202530efc46e429e75527cfa
refs/heads/master
2020-04-11T15:40:22.473017
2018-12-14T20:04:25
2018-12-14T20:04:25
161,899,113
0
0
null
2018-12-15T11:40:14
2018-12-15T11:40:14
null
UTF-8
Java
false
false
2,544
java
/* * Copyright 2016 FabricMC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.fabricmc.loader.transformer; import net.minecraft.launchwrapper.IClassTransformer; import org.objectweb.asm.*; public final class PublicAccessTransformer implements IClassTransformer { private static final int modAccess(int access) { if ((access & 0x7) != Opcodes.ACC_PRIVATE) { return (access & (~0x7)) | Opcodes.ACC_PUBLIC; } else { return access; } } static class AccessClassVisitor extends ClassVisitor { public AccessClassVisitor(int api, ClassVisitor classVisitor) { super(api, classVisitor); } @Override public void visit( final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { super.visit(version, modAccess(access), name, signature, superName, interfaces); } @Override public void visitInnerClass( final String name, final String outerName, final String innerName, final int access) { super.visitInnerClass(name, outerName, innerName, modAccess(access)); } @Override public FieldVisitor visitField( final int access, final String name, final String descriptor, final String signature, final Object value) { return super.visitField(modAccess(access), name, descriptor, signature, value); } @Override public MethodVisitor visitMethod( final int access, final String name, final String descriptor, final String signature, final String[] exceptions) { return super.visitMethod(modAccess(access), name, descriptor, signature, exceptions); } } @Override public byte[] transform(String name, String transformedName, byte[] bytes) { if (!name.startsWith("net.minecraft") && name.indexOf('.') >= 0) { return bytes; } ClassReader classReader = new ClassReader(bytes); ClassWriter classWriter = new ClassWriter(0); classReader.accept(new AccessClassVisitor(Opcodes.ASM7, classWriter), 0); return classWriter.toByteArray(); } }
38079470c4862c78af65b4b9e0c8aab3c9c993c1
8c7ba26a417fa2fb165fd0b9399e05e0bba6562c
/WEB-INF/classes/Login.java
42607833e25518c12f1ec1a658109acf15ebc917
[]
no_license
HaochenSun/stucat002
85d67091667876929eecd618b02eefe13e28425f
a26ef8f49f5303f7e87d3deb447a95f361505dd5
refs/heads/master
2021-01-18T15:37:13.120611
2015-04-17T12:52:02
2015-04-17T12:52:02
34,124,520
0
0
null
2015-04-17T15:33:13
2015-04-17T15:33:13
null
UTF-8
Java
false
false
2,796
java
import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.velocity.app.Velocity; import org.apache.velocity.context.Context; import org.apache.velocity.Template; import org.apache.velocity.tools.view.VelocityViewServlet; import java.io.*; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import javax.servlet.*; import javax.servlet.http.*; import com.mysql.jdbc.*; public class Login extends VelocityViewServlet { public Template handleRequest (HttpServletRequest request, HttpServletResponse response, Context ctx) { Template page = null; response.setContentType("text/html"); java.sql.Connection conn = null; java.sql.PreparedStatement ps=null; String email = request.getParameter("email"); String password = request.getParameter("pwd"); String checkname = ""; String checkemail = ""; Integer checkrole = 0; HttpSession session = request.getSession(true); try { // connect to the database String sqluserName="team152"; String sqlpassword="b042ba74"; String url="jdbc:mysql://stusql.dcs.shef.ac.uk/team152"; Class.forName("com.mysql.jdbc.Driver").newInstance(); conn=DriverManager.getConnection(url,sqluserName,sqlpassword); // prepare statement ps = conn.prepareStatement("SELECT * FROM User WHERE Email='" + email + "' AND Password='"+password+"';"); } catch(Exception e) { System.out.println(e); } try { ResultSet results = ps.executeQuery(); while (results.next()) { checkname = results.getString("Name"); checkrole = results.getInt("RoleId"); checkemail = results.getString("Email"); } } catch (SQLException e) { e.printStackTrace(); } finally { try{conn.close();}catch(SQLException e){e.printStackTrace();} } if (checkemail.equals(email) && checkemail != "") //Successful login { ctx.put("status","Logged in as: " + checkname); //Store important user values in session session.setAttribute("username", checkname); session.setAttribute("roleID", checkrole); session.setAttribute("email", checkemail); } else if (email == null && password == null) //No login attempt { ctx.put("status","Email and Password not entered"); } else //Email not found { ctx.put("status","Account not found"); } try { //Render homepage from servlet request.getRequestDispatcher("/").forward(request,response); } catch (Exception e) { System.out.println("VelocityForm excpetion: " + e); } return page; } }
717ba7a9582b50f1de593017a82ef49efec81591
7152de38f0981f66c8d900af5c7bacbe9430519f
/src/classanimal/TestAnimal.java
6293291d8b2d2f7fd2ea0434c6be6fae09feb6cb
[]
no_license
tranducluan1999/Java
8e577707d4cc0bc57f6422d1d71e9824fba97ad0
c8a88a8b97d4142f7dbbbd3dff45f4fce0319189
refs/heads/master
2022-11-24T04:56:22.334957
2020-07-20T17:04:40
2020-07-20T17:04:40
281,176,972
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
package classanimal; import java.util.Scanner; // String name, String spiece, float age, String food public class TestAnimal { public static void main(String[] args) { Animal animal = new Animal(); Scanner sc = new Scanner(System.in); System.out.println(" Name of animal: "); String ten = sc.nextLine(); System.out.println(" Spiece of animal: "); String loai = sc.nextLine(); System.out.println(" Age of animal: "); float tuoi = sc.nextFloat(); sc.nextLine(); System.out.println(" Food of animal: "); String doan = sc.nextLine(); animal = new Animal(ten, loai, tuoi, doan); System.out.println(animal); } }
dd7b9be8eaa571b0e70f4bae72b3ac5614cc64b6
e859a28584da0078282b3afa435c43ed9bcbcb34
/src/main/java/com/karen/fan/common/exception/InvalidParamsException.java
e0e3355491cdccd5dff26ba8dbb1844cfe0580d7
[]
no_license
fweilian/karen
1accedd6b04715226de3067cb20fd8491eccd14b
e3a5ad92b5f32fd1e3ec5e7e5dcec5ae051db298
refs/heads/master
2021-01-10T11:06:39.923454
2015-11-15T16:46:08
2015-11-15T16:46:08
46,225,515
0
0
null
null
null
null
UTF-8
Java
false
false
962
java
package com.karen.fan.common.exception; /** * @Date: 2015-07-12 * @author: fan */ public class InvalidParamsException extends GlobalException { private static final int errorCode = 900002; public InvalidParamsException() { super(); } public InvalidParamsException(String message) { super(message); } public InvalidParamsException(String message, Object data) { super(message, data); } public InvalidParamsException(String message, Throwable cause) { super(message, cause); } public InvalidParamsException(String message, Throwable cause, Object data) { super(message, cause, data); } public InvalidParamsException(Throwable cause) { super(cause); } public InvalidParamsException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } }
ee2e10aebabb12543332765493e7e54cf1d73658
384687d756b2401dbe013c8b49fd83b0a162eb50
/app/src/main/java/com/example/f/Bitmap_modifier.java
1393bc48f8ced169ab6008553567b76d40ff3330
[]
no_license
KoshkaMoroshka/GameEngineAndroid
51b225f7690d9d7e510c228eda7810eec9bfda88
42ba49d6c7c1150dc1dea814819ea6f16ce4e840
refs/heads/master
2023-03-15T22:33:37.570700
2021-03-12T11:09:07
2021-03-12T11:09:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,315
java
package com.example.f; import android.graphics.Bitmap; public class Bitmap_modifier { public static int add(int c1, int c2){ int a, r, g, b; b=c1&0xFF + c2&0xFF; b=b>0xFF?0xFF:b; c1=c1>>8; c2=c2>>8; g=c1&0xFF + c2&0xFF; g=g>0xFF?0xFF:g; c1=c1>>8; c2=c2>>8; r=c1&0xFF + c2&0xFF; r=r>0xFF?0xFF:r; c1=c1>>8; c2=c2>>8; a=c1&0xFF + c2&0xFF; a=a>0xFF?0xFF:a; return a+r+g+b; } public static Bitmap[] split(Bitmap bmp, int w0, int h0){ int cx=(bmp.getWidth()-1)/(1+w0); int cy=(bmp.getHeight()-1)/(1+h0); Bitmap[] res=new Bitmap[cx*cy]; for(int i=0; i<res.length; i++) res[i]=Bitmap.createBitmap(w0, h0, Bitmap.Config.ARGB_8888); int x0, y0; for(int i=0; i<res.length; i++){ x0=1+(1+w0)*(i%cx); y0=1+(1+h0)*(i/cx); for(int x=0; x<w0; x++) for(int y=0; y<h0; y++) res[i].setPixel(x, y, bmp.getPixel(x0+x, y0+y)); } return res; } public static Bitmap cut_space(Bitmap bmp, boolean l, boolean u, boolean r, boolean d){ int x1=0, y1=0, x2=bmp.getWidth(), y2=bmp.getHeight(); boolean s; if(l){ s=false; for(x1=x1; x1<x2 && !s; x1++) for(int y=y1; y<y2; y++) if(s=(bmp.getPixel(x1, y)!=0xFF000000)) break; x1--; } if(u){ s=false; for(y1=y1; y1<y2 && !s; y1++) for(int x=x1; x<x2; x++) if(s=(bmp.getPixel(x, y1)!=0xFF000000)) break; y1--; } if(r){ s=false; for(x2=x2; x2>x1 && !s; x2--) for(int y=y1; y<y2; y++) if(s=(bmp.getPixel(x2-1, y)!=0xFF000000)) break; x2++; } if(d){ s=false; for(y2=y2; y2>y1 && !s; y2--) for(int x=x1; x<x2; x++) if(s=(bmp.getPixel(x, y2-1)!=0xFF000000)) break; y2++; } Bitmap res=Bitmap.createBitmap(x2-x1, y2-y1, Bitmap.Config.ARGB_8888); for(int x=0; x<x2-x1; x++) for(int y=0; y<y2-y1; y++) res.setPixel(x, y, bmp.getPixel(x1+x, y1+y)); return res; } public static void cut_space(Bitmap[] bmps, boolean l, boolean u, boolean r, boolean d){ for(int i=0; i<bmps.length; i++) bmps[i]=cut_space(bmps[i], l, u, r, d); } public static Bitmap alphaGradient(Bitmap src){ int w=src.getWidth(), h=src.getHeight(); Bitmap res=Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888).copy(Bitmap.Config.ARGB_8888, true); for(int x=0; x<w; x++) for(int y=0; y<h; y++) res.setPixel(x, y, src.getPixel(x, y)&0x00FFFFFF | (int)(255.0f*y/h)<<24); return res; } public static Bitmap addLayer(Bitmap bmp, int color){ Bitmap res=Bitmap.createBitmap(bmp.getWidth(), bmp.getHeight(), Bitmap.Config.ARGB_8888).copy(Bitmap.Config.ARGB_8888, true); for(int x=0; x<res.getWidth(); x++) for(int y=0; y<res.getHeight(); y++) res.setPixel(x, y, add(color, bmp.getPixel(x, y))); return res; } public static Bitmap createFocusMask(int w, int h){ Bitmap res = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888).copy(Bitmap.Config.ARGB_8888, true); int color = 0xFF000000; for(int xx=0; xx<w; xx++) for(int yy=0; yy<h; yy++) res.setPixel(xx, yy, color); int range=10; int x0=w/2, y0=h/2, r=w-x0, dr=r/range; for(int i=0; i<range; i++) { color=(255*(range-i)/range)<<24; for(int xx=x0-r; xx<x0+r; xx++) for(int yy=y0-r; yy<y0+r; yy++) { if(xx<0 || xx>=w || yy<0 || yy>=h) continue; if((xx-x0)*(xx-x0)+(yy-y0)*(yy-y0)>r*r) continue; res.setPixel(xx, yy, color); } r-=dr; } return res; } }
4817e9c1859a343a3ccceced93ebb4b46404e536
bceb6add525f17713441b0cbb90cfb1b6f4f97e2
/lbs-server/src/main/java/com/lbs/nettyserver/dao/PowerValueDAO.java
4a090b8e60d4e0a22844c59cfc342dedd43a3dfd
[]
no_license
willint/lbs-netty-server
8e7fcd823cc7beefe112c311a5987e0f2b1bf007
fa168f8d6057181bc5370bed6452f761cb48f519
refs/heads/master
2021-04-12T02:58:34.741238
2018-03-18T07:12:41
2018-03-18T07:12:47
125,639,958
0
0
null
null
null
null
UTF-8
Java
false
false
1,605
java
package com.lbs.nettyserver.dao; import java.util.List; import javax.transaction.Transactional; import org.hibernate.Query; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.lbs.nettyserver.dao.common.BaseDao; import com.lbs.nettyserver.model.pojo.PowerValue; @Transactional @Repository("powerValueDAO") public class PowerValueDAO { @Autowired private SessionFactory sessionFactory; @Autowired private BaseDao baseDao; /** * 保存用户能量体力实体到数据库 * @param powerValue */ public void savePowerValue(PowerValue powerValue){ this.sessionFactory.getCurrentSession().save(powerValue); this.sessionFactory.getCurrentSession().flush(); } /** * 调用存储过程重置所有用户的体力和能量值 * @return * @throws Exception */ public Object userPowerValueResetByProc() throws Exception{ return baseDao.selectNativeSqlUniqueResult("select user_power_value_reset() as \"isSuccess\";", null, "isSuccess"); } /** * 根据用户Id获取用户体力能量实体类 * @param userId * @return */ public PowerValue getPowerValueByUserId(String userId){ String hql = "from PowerValue where user_id = :userId"; Query query = this.sessionFactory.getCurrentSession().createQuery(hql); query.setParameter("userId", userId); @SuppressWarnings("unchecked") List<PowerValue> list = query.list(); this.sessionFactory.getCurrentSession().flush(); return (list!=null && list.size()>0)?list.get(0):null; } }
86de2305f88597b11c9ad49eb85adbd8e81952bd
d7f0d3fe7f5bddf1a0f59281f910991cd46960ed
/Unidad4/U4_AnimationEvents/U4_AnimationEvents-master/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/asynclayoutinflater/R.java
468fd0c54e8300a8d032e2fcf05040f326d5ab4f
[]
no_license
JuanAntonioLopezSanchez/TAM2019
4899995a6a1be6961c74d682d753eb33eeed9033
df0462767d3b99522d259aeb93f64c5be4978af8
refs/heads/master
2020-04-21T21:28:55.600825
2019-06-04T21:19:17
2019-06-04T21:19:17
169,880,296
0
0
null
null
null
null
UTF-8
Java
false
false
10,466
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.asynclayoutinflater; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f020027; public static final int font = 0x7f02007a; public static final int fontProviderAuthority = 0x7f02007c; public static final int fontProviderCerts = 0x7f02007d; public static final int fontProviderFetchStrategy = 0x7f02007e; public static final int fontProviderFetchTimeout = 0x7f02007f; public static final int fontProviderPackage = 0x7f020080; public static final int fontProviderQuery = 0x7f020081; public static final int fontStyle = 0x7f020082; public static final int fontVariationSettings = 0x7f020083; public static final int fontWeight = 0x7f020084; public static final int ttcIndex = 0x7f02013c; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f04003f; public static final int notification_icon_bg_color = 0x7f040040; public static final int ripple_material_light = 0x7f04004a; public static final int secondary_text_default_material_light = 0x7f04004c; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f05004d; public static final int compat_button_inset_vertical_material = 0x7f05004e; public static final int compat_button_padding_horizontal_material = 0x7f05004f; public static final int compat_button_padding_vertical_material = 0x7f050050; public static final int compat_control_corner_material = 0x7f050051; public static final int compat_notification_large_icon_max_height = 0x7f050052; public static final int compat_notification_large_icon_max_width = 0x7f050053; public static final int notification_action_icon_size = 0x7f05005f; public static final int notification_action_text_size = 0x7f050060; public static final int notification_big_circle_margin = 0x7f050061; public static final int notification_content_margin_start = 0x7f050062; public static final int notification_large_icon_height = 0x7f050063; public static final int notification_large_icon_width = 0x7f050064; public static final int notification_main_column_padding_top = 0x7f050065; public static final int notification_media_narrow_margin = 0x7f050066; public static final int notification_right_icon_size = 0x7f050067; public static final int notification_right_side_padding_top = 0x7f050068; public static final int notification_small_icon_background_padding = 0x7f050069; public static final int notification_small_icon_size_as_large = 0x7f05006a; public static final int notification_subtext_size = 0x7f05006b; public static final int notification_top_pad = 0x7f05006c; public static final int notification_top_pad_large_text = 0x7f05006d; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f060056; public static final int notification_bg = 0x7f060057; public static final int notification_bg_low = 0x7f060058; public static final int notification_bg_low_normal = 0x7f060059; public static final int notification_bg_low_pressed = 0x7f06005a; public static final int notification_bg_normal = 0x7f06005b; public static final int notification_bg_normal_pressed = 0x7f06005c; public static final int notification_icon_background = 0x7f06005d; public static final int notification_template_icon_bg = 0x7f06005e; public static final int notification_template_icon_low_bg = 0x7f06005f; public static final int notification_tile_bg = 0x7f060060; public static final int notify_panel_notification_icon_bg = 0x7f060061; } public static final class id { private id() {} public static final int action_container = 0x7f07000d; public static final int action_divider = 0x7f07000f; public static final int action_image = 0x7f070010; public static final int action_text = 0x7f070016; public static final int actions = 0x7f070017; public static final int async = 0x7f07001e; public static final int blocking = 0x7f070021; public static final int chronometer = 0x7f07002d; public static final int forever = 0x7f070042; public static final int icon = 0x7f070048; public static final int icon_group = 0x7f070049; public static final int info = 0x7f07004c; public static final int italic = 0x7f07004e; public static final int line1 = 0x7f070050; public static final int line3 = 0x7f070051; public static final int normal = 0x7f070059; public static final int notification_background = 0x7f07005a; public static final int notification_main_column = 0x7f07005b; public static final int notification_main_column_container = 0x7f07005c; public static final int right_icon = 0x7f070065; public static final int right_side = 0x7f070066; public static final int tag_transition_group = 0x7f070086; public static final int tag_unhandled_key_event_manager = 0x7f070087; public static final int tag_unhandled_key_listeners = 0x7f070088; public static final int text = 0x7f070089; public static final int text2 = 0x7f07008a; public static final int time = 0x7f07008d; public static final int title = 0x7f07008e; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f080004; } public static final class layout { private layout() {} public static final int notification_action = 0x7f09001d; public static final int notification_action_tombstone = 0x7f09001e; public static final int notification_template_custom_big = 0x7f09001f; public static final int notification_template_icon_group = 0x7f090020; public static final int notification_template_part_chronometer = 0x7f090021; public static final int notification_template_part_time = 0x7f090022; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0b002a; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0c00ec; public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00ed; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00ee; public static final int TextAppearance_Compat_Notification_Time = 0x7f0c00ef; public static final int TextAppearance_Compat_Notification_Title = 0x7f0c00f0; public static final int Widget_Compat_NotificationActionContainer = 0x7f0c0158; public static final int Widget_Compat_NotificationActionText = 0x7f0c0159; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 }; public static final int ColorStateListItem_android_color = 0; public static final int ColorStateListItem_android_alpha = 1; public static final int ColorStateListItem_alpha = 2; public static final int[] FontFamily = { 0x7f02007c, 0x7f02007d, 0x7f02007e, 0x7f02007f, 0x7f020080, 0x7f020081 }; public static final int FontFamily_fontProviderAuthority = 0; public static final int FontFamily_fontProviderCerts = 1; public static final int FontFamily_fontProviderFetchStrategy = 2; public static final int FontFamily_fontProviderFetchTimeout = 3; public static final int FontFamily_fontProviderPackage = 4; public static final int FontFamily_fontProviderQuery = 5; public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f02007a, 0x7f020082, 0x7f020083, 0x7f020084, 0x7f02013c }; public static final int FontFamilyFont_android_font = 0; public static final int FontFamilyFont_android_fontWeight = 1; public static final int FontFamilyFont_android_fontStyle = 2; public static final int FontFamilyFont_android_ttcIndex = 3; public static final int FontFamilyFont_android_fontVariationSettings = 4; public static final int FontFamilyFont_font = 5; public static final int FontFamilyFont_fontStyle = 6; public static final int FontFamilyFont_fontVariationSettings = 7; public static final int FontFamilyFont_fontWeight = 8; public static final int FontFamilyFont_ttcIndex = 9; public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 }; public static final int GradientColor_android_startColor = 0; public static final int GradientColor_android_endColor = 1; public static final int GradientColor_android_type = 2; public static final int GradientColor_android_centerX = 3; public static final int GradientColor_android_centerY = 4; public static final int GradientColor_android_gradientRadius = 5; public static final int GradientColor_android_tileMode = 6; public static final int GradientColor_android_centerColor = 7; public static final int GradientColor_android_startX = 8; public static final int GradientColor_android_startY = 9; public static final int GradientColor_android_endX = 10; public static final int GradientColor_android_endY = 11; public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 }; public static final int GradientColorItem_android_color = 0; public static final int GradientColorItem_android_offset = 1; } }
a6816b121e79174d3e729ffbd28f815c4cef242d
a250d196d137fb20ae2b44f10ab762d4b39da84e
/app/src/main/java/cs/util/JsBridge.java
6c81fbedf2232465e3cc46f69007b7e961b5da0e
[]
no_license
ofts7th/sdumbachouti
96df285c72f02f88e5da541894192fd2e49b8a6a
1df6dd805412b741406f2047990acf0ce5caa669
refs/heads/master
2020-09-06T10:18:48.264931
2019-11-21T04:32:44
2019-11-21T04:32:44
220,397,610
0
0
null
null
null
null
UTF-8
Java
false
false
1,377
java
package cs.util; import android.webkit.JavascriptInterface; public class JsBridge { private WebViewActivityUtil util; public JsBridge(WebViewActivityUtil util) { this.util = util; } @JavascriptInterface public String readAssetFile(String path) { return Util.readAssetFile(path); } @JavascriptInterface public void exit() { this.util.finishActivity(); } @JavascriptInterface public String getConfig(String k) { return Util.getSafeConfig(k); } @JavascriptInterface public void saveConfig(String k, String v) { Util.saveConfig(k, v); } @JavascriptInterface public void exitApp() { System.exit(0); } @JavascriptInterface public String getChild(String s) { return this.util.getChild(s); } @JavascriptInterface public String getTiMuIds() { return this.util.getTiMuIds(); } @JavascriptInterface public String getTiMu(int id) { return this.util.getTiMu(id); } @JavascriptInterface public String getTodayCtRecord() { return this.util.getTodayCtRecord(); } @JavascriptInterface public void addTodayCtRecord(int id) { this.util.addTodayCtRecord(id); } @JavascriptInterface public void clearCtRecord() { this.util.clearCtRecord(); } }
5c51ca62b83fac53100dbc383c44f4c53f697eae
12b733f7550ab6070a3c6dd6151145b31becc26a
/BiCycle.java
abb680795fcabd7670c679bb41ccb39b4060d14a
[]
no_license
Thashma007/Java.Xworkz
4cb090841a3d7ea62f4559e11af27617efe0b0c3
da2573686e8e98b31005ff1055414bf8046b5276
refs/heads/master
2023-08-25T06:08:06.944987
2021-10-22T11:20:01
2021-10-22T11:20:01
412,306,665
0
0
null
null
null
null
UTF-8
Java
false
false
677
java
class BiCycle{ String color; float price; String brand; BicycleType name=BicycleType.ROADBIKE; BiCycle(String color,float price,String brand) { System.out.println("invoked cons location String,float"); this.color=color; this.price=price; this.brand=brand; } void brake() { System.out.println("invoked brake"); } void move() { System.out.println("invoked move"); } void displayDetails() { System.out.println("invoked displayDetails"); System.out.println("Bicycle color :"+this.color); System.out.println("Bicycle price :"+this.price); System.out.println("Bicycle brand :"+this.brand); System.out.println("Bicycle type :"+this.name); } }
322e0d7fccd9637269849853ddf812a08bb57428
405ad62d14fb86a6df6a9826bd1763c8bd7c3179
/src/test/Interesting.java
b20aa8bb8e72da302cf660065b18cb3cf4aabf81
[]
no_license
xueshijun/Tesseract-OCR-Java-Demo
5ae0695f695815287adbfafcb869edd95e0aa1aa
cc583ac169c0b09216a14980156110647f7ad235
refs/heads/master
2020-04-12T22:21:25.206499
2012-08-12T12:59:30
2012-08-12T12:59:30
5,174,386
1
0
null
null
null
null
GB18030
Java
false
false
1,160
java
package test; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import com.htmlparse.threesixzerobuy.JingDongItem.ItemImg; import com.htmlparse.yihaodian.YiHaoDianItem.ItemType; import com.sun.jndi.toolkit.url.Uri; public class Interesting { public void mymain(String[] args) throws IOException { System.out.println("=======BEGIN======"); String getUrl = "http://www.yihaodian.com/product/16082_1"; //指定网页地址 Document doc = Jsoup.connect(getUrl).userAgent("") // 设置User-Agent .timeout(3000) // 设置连接超时时间 .get(); // "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.15)" //"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7"; Element link=doc.select(".wrap>.produce.clearfix").first(); System.out.println(link.toString()); // } } }
95ebb153f1a68c10d8ccb13258d9b31b4bde9fe1
9040a7d2ca932ad3be3fa70d7cbd52bf4270a5fa
/Chatroom/Group17_InClass06-1/Group17_InClass06/ChatRoom/app/src/main/java/com/example/sandhyayalla/chatroom/MainActivity.java
a50b49f3c6e40950a92898516185d22b3995586d
[]
no_license
pawanbole/MobileApplicationDevelopment
06e3d9fec17689281c936ba7a41a7b766aed81fb
811a54c5d8825e7fc6ed68577824d541e1ffe71d
refs/heads/master
2020-03-30T03:18:19.979888
2018-10-28T21:51:54
2018-10-28T21:51:54
150,681,319
1
1
null
null
null
null
UTF-8
Java
false
false
7,151
java
/*FileName : Group17_InClass06.zip Group R-17 Assignment 6 Naga Sandhyadevi yalla, Pawan Bole , Sumanth */ package com.example.sandhyayalla.chatroom; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Handler; import android.os.Message; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import java.io.IOException; import okhttp3.Call; import okhttp3.Callback; import okhttp3.FormBody; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.RequestBody; import okhttp3.Response; import okhttp3.ResponseBody; public class MainActivity extends AppCompatActivity { TextView editTextUserName; TextView editTextPassword; Handler handler; Button buttonLogin; String loginUrl = "http://ec2-18-234-222-229.compute-1.amazonaws.com/api/login"; private final OkHttpClient client = new OkHttpClient(); public Login login = new Login(); UserAuthentication authenticationDetails; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //login editTextUserName = findViewById(R.id.editTextUserName); editTextPassword = findViewById(R.id.editTextPassword); buttonLogin = findViewById(R.id.buttonLogin); if (isConnected()) { handler = new Handler(new Handler.Callback() { @Override public boolean handleMessage(Message message) { if (message.what == 150) { Toast.makeText(MainActivity.this, "Username or password is incorrect", Toast.LENGTH_SHORT).show(); } return false; } }); buttonLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //validateSetCredentials(); if (editTextUserName.getText().toString().isEmpty() && editTextUserName.getText() != null) { editTextUserName.setError("Enter Username"); } else if (editTextPassword.getText().toString().isEmpty() && editTextPassword.getText() != null) { editTextPassword.setError("Enter Password"); } else { RequestBody formBody = new FormBody.Builder() .add("email", editTextUserName.getText().toString()) .add("password", editTextPassword.getText().toString()) .build(); Request request = new Request.Builder() .url(loginUrl) .post(formBody) .build(); client.newCall(request).enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { e.printStackTrace(); } @Override public void onResponse(Call call, Response response) throws IOException { if (!response.isSuccessful()) { //throw new IOException("Unexpected code " + response); Message message = new Message(); message.what = 150; handler.sendMessage(message); } else { authenticationDetails = AuthenticationParser.parseAuthenticationDetails(response.body().string()); Log.d("demo", "details" + authenticationDetails.toString()); //Toast.makeText(MainActivity.this,authenticationDetails.toString(),Toast.LENGTH_LONG).show(); //call the thread api to get the threads SharedPreferences preferences = getSharedPreferences("myPrefs", MODE_PRIVATE); preferences.edit().remove("token").commit();//remove if any pref tokens are there preferences.edit().putString("token", authenticationDetails.token.toString()).commit(); Intent messageintent = new Intent(MainActivity.this, MessageThreads.class); messageintent.putExtra("authenticationdetails", authenticationDetails); startActivity(messageintent); } // callMessageThread(authenticationDetails.toString().toString()); } }); }//for else } }); //end login //signup Button btn_Signup = (Button) findViewById(R.id.buttonSignUp); btn_Signup.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(MainActivity.this, SignUpActivity.class); startActivity(intent); finish(); } }); } else { Toast.makeText(this, "No internet Connection", Toast.LENGTH_SHORT).show(); } } /* public void validateSetCredentials() { if (editTextUserName.getText() != null && !editTextUserName.getText().toString().isEmpty()) { editTextUserName.setText(editTextUserName.getText().toString()); login.setUsername(editTextUserName.getText().toString()); } else { editTextUserName.requestFocus(); editTextUserName.setError("Enter Username"); } if (editTextPassword.getText() != null && !editTextPassword.getText().toString().isEmpty()) { editTextPassword.setText(editTextPassword.getText().toString()); login.setPassword(editTextPassword.getText().toString()); } else { editTextPassword.requestFocus(); editTextPassword.setError("Enter Password"); } }*/ private boolean isConnected() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); if (networkInfo == null || !networkInfo.isConnected() || (networkInfo.getType() != ConnectivityManager.TYPE_WIFI && networkInfo.getType() != ConnectivityManager.TYPE_MOBILE)) { return false; } else return true; } }
8ac8e00c5577d4f2a9f5da973dbb0375f948dbbc
55d09fcf216ea053c422dd4c6b0977658cb82791
/src/controlador/VistaController.java
05bd371ab1249bf119eaebc726392c8037375053
[]
no_license
ferguevara510/Licoreria
ca45320783a19245466babc6a05f35657275c565
c046441aed7bbbbe388601b0fdfb6980e3f9f89c
refs/heads/main
2023-06-10T01:15:08.568188
2021-06-18T02:10:25
2021-06-18T02:10:25
371,544,067
0
0
null
null
null
null
UTF-8
Java
false
false
869
java
package controlador; import javafx.fxml.FXMLLoader; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.input.MouseEvent; import javafx.stage.Stage; import java.io.IOException; import java.util.Objects; public class VistaController { public static void cargarVista(MouseEvent event, String titulo, String fxml) throws IOException { Parent root; root = FXMLLoader.load(Objects.requireNonNull(VistaController.class.getClassLoader().getResource(fxml))); Stage stage = new Stage(); stage.setTitle(titulo); stage.setScene(new Scene(root)); stage.show(); stage.setResizable(false); stage.getIcons().add(new Image("/vista/imagenes/vintage.png")); ((Node)(event.getSource())).getScene().getWindow().hide(); } }
53e6d4fc5dcb23ea5e16ab18216efe8dcc1f4b04
bceba483c2d1831f0262931b7fc72d5c75954e18
/src/qubed/corelogicextensions/PLATTEDLANDSEXTENSION.java
1305546e50ce1f604afb84e4e47173d23b52f3db
[]
no_license
Nigel-Qubed/credit-services
6e2acfdb936ab831a986fabeb6cefa74f03c672c
21402c6d4328c93387fd8baf0efd8972442d2174
refs/heads/master
2022-12-01T02:36:57.495363
2020-08-10T17:26:07
2020-08-10T17:26:07
285,552,565
0
1
null
null
null
null
UTF-8
Java
false
false
2,466
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2020.08.05 at 04:53:09 AM CAT // package qubed.corelogicextensions; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for PLATTED_LANDS_EXTENSION complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="PLATTED_LANDS_EXTENSION"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="MISMO" type="{http://www.mismo.org/residential/2009/schemas}MISMO_BASE" minOccurs="0"/> * &lt;element name="OTHER" type="{http://www.mismo.org/residential/2009/schemas}OTHER_BASE" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "PLATTED_LANDS_EXTENSION", propOrder = { "mismo", "other" }) public class PLATTEDLANDSEXTENSION { @XmlElement(name = "MISMO") protected MISMOBASE mismo; @XmlElement(name = "OTHER") protected OTHERBASE other; /** * Gets the value of the mismo property. * * @return * possible object is * {@link MISMOBASE } * */ public MISMOBASE getMISMO() { return mismo; } /** * Sets the value of the mismo property. * * @param value * allowed object is * {@link MISMOBASE } * */ public void setMISMO(MISMOBASE value) { this.mismo = value; } /** * Gets the value of the other property. * * @return * possible object is * {@link OTHERBASE } * */ public OTHERBASE getOTHER() { return other; } /** * Sets the value of the other property. * * @param value * allowed object is * {@link OTHERBASE } * */ public void setOTHER(OTHERBASE value) { this.other = value; } }
123b7ec9e62f6166261a43e7d79c62ad85a6d334
b2892a9090f06907261862f034a8bab151c3e91d
/src/lab5/Animalrescue/Dog.java
7a14d49b415f6866e618167d04974f6767d1731c
[]
no_license
magdapentek/lab.6
270f6b2bf8e2e446831ec9069c9620032dea8931
6c703ea47121bcee771cc472f8f7d38bd40ce2a2
refs/heads/master
2020-09-05T00:46:30.829104
2019-11-13T06:25:01
2019-11-13T06:25:01
219,937,186
0
0
null
null
null
null
UTF-8
Java
false
false
616
java
package lab5.Animalrescue; public class Dog extends Animal{ public class Main { public void animals(){ Dog rex = new Dog(); } public void healthLevel() { System.out.println("7"); } } public void age(){ System.out.println("\nThe dogs ages are between 1 - 19"); } public void favoritMeal(){ System.out.println("Pedigree"); } public void relaxActivity(){ System.out.println("Playing with frisbee"); } public void speak(){ System.out.println("Ham-ham"); } }
5db12a7bd4d8b8909a00135fbc467d2d9454a82d
816c91bb4d424cb7b2190bdb9b1d1988101939a7
/src/com/clillo/dmx/ui/jpanels/opcionesMenu/PanelMantienePuntosMovingHeads.java
74fa2b8c265ecc8d6597a2973b0985b0a7b3ac3a
[]
no_license
clillo/iluminacion
188743a0dc18a9fed07602bbc018e910be542e54
d9b9fc7471461b8f6a1da310bbf00fe830ef6a4e
refs/heads/master
2021-07-07T15:13:46.386311
2021-05-10T00:07:27
2021-05-10T00:07:27
236,244,798
0
0
null
null
null
null
UTF-8
Java
false
false
9,455
java
package com.clillo.dmx.ui.jpanels.opcionesMenu; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.util.ArrayList; import javax.swing.DefaultListModel; import javax.swing.JButton; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextField; import javax.swing.border.TitledBorder; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import com.clillo.dmx.configuracion.escenas.PuntosRoboticasCfg; import com.clillo.dmx.core.ListaFixtures; import com.clillo.dmx.core.fixtures.FixtureMovingHead; import com.clillo.dmx.ui.jpanels.fixtures.robotizados.ListenerCambioPosicion; import com.clillo.dmx.ui.jpanels.fixtures.robotizados.ListenerMovimientos; import com.clillo.dmx.ui.jpanels.fixtures.robotizados.PanelCanvas; import com.clillo.dmx.ui.jpanels.fixtures.robotizados.PanelControlPosicion; import com.clillo.dmx.ui.jpanels.fixtures.robotizados.Punto; import com.clillo.dmx.ui.jpanels.opcionesMenu.escenas.PuntoRoboticas; import javax.swing.JSpinner; import javax.swing.JScrollBar; public class PanelMantienePuntosMovingHeads extends PanelMenuGenerico implements ActionListener, ListenerCambioPosicion, ListSelectionListener, ListenerMovimientos, AdjustmentListener{ private static final long serialVersionUID = -5869553409971473557L; private PanelCanvas pnlCanvas; private JButton btnEditar; private PanelControlPosicion pnlControlPosicion; private PanelControlPosicion pnlControlPosicionFine; private PanelControlPosicion pnlTraslada; private PanelControlPosicion pnlEscala; private JList<PuntoRoboticas> lstPuntos; private DefaultListModel<PuntoRoboticas> modeloLista; private JScrollBar scrlX; private JScrollBar scrlY; private FixtureMovingHead entidad; private JTextField txtPosicion; private JTextField txtFine; private JPanel pnl1; private String id; public PanelMantienePuntosMovingHeads() { this.configura(530, 490, "Mantiene Puntos Moving Heads"); this.setLayout(null); pnl1 = new JPanel(); pnl1.setLayout(null); pnl1.setBounds(4, 4, 536, 484); add(pnl1); txtPosicion = new JTextField(); txtPosicion.setBounds(436, 24, 39, 20); pnl1.add(txtPosicion); txtFine = new JTextField(); txtFine.setBounds(475, 24, 39, 20); pnl1.add(txtFine); pnlCanvas = new PanelCanvas(); pnlCanvas.setBackground(Color.BLACK); pnlCanvas.setBounds(34, 22, 400, 400); pnlCanvas.setTxtPosicion(txtPosicion); pnlCanvas.setTxtFine(txtFine); pnl1.add(pnlCanvas); pnlControlPosicion = new PanelControlPosicion(); pnlControlPosicion.setBounds(451, 55, 60, 54); pnl1.add(pnlControlPosicion); pnlControlPosicionFine = new PanelControlPosicion(); pnlControlPosicionFine.setBounds(451, 120, 60, 54); pnl1.add(pnlControlPosicionFine); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(448, 185, 63, 75); pnl1.add(scrollPane); modeloLista = new DefaultListModel<PuntoRoboticas>(); lstPuntos = new JList<PuntoRoboticas>(modeloLista); lstPuntos.addListSelectionListener(this); scrollPane.setViewportView(lstPuntos); btnEditar = new JButton("Editar"); btnEditar.setBounds(446, 271, 68, 23); btnEditar.addActionListener(this); pnl1.add(btnEditar); pnlTraslada = new PanelControlPosicion(); pnlTraslada.setBounds(454, 305, 60, 54); pnl1.add(pnlTraslada); pnlEscala = new PanelControlPosicion(); pnlEscala.setBounds(438, 370, 60, 54); pnl1.add(pnlEscala); scrlX = new JScrollBar(); scrlX.setMaximum(255); scrlX.setOrientation(JScrollBar.HORIZONTAL); scrlX.setBounds(10, 433, 490, 20); scrlX.addAdjustmentListener(this); pnl1.add(scrlX); scrlY = new JScrollBar(); scrlY.setMaximum(255); scrlY.setBounds(1, 25, 23, 397); scrlY.addAdjustmentListener(this); pnl1.add(scrlY); } private void actualizaPuntos(){ lstPuntos.removeListSelectionListener(this); modeloLista.removeAllElements(); lstPuntos.addListSelectionListener(this); ArrayList<Punto> listaPuntos = new ArrayList<Punto>(); for (PuntoRoboticas pr: PuntosRoboticasCfg.getListaPuntos()){ modeloLista.addElement(pr); Punto p = new Punto(); p.setNombre(pr.getId()); if ("movingHead1".equals(this.id)){ p.setX(pr.getMovingHead1Pan()); p.setY(pr.getMovingHead1Tilt()); }else{ p.setX(pr.getMovingHead2Pan()); p.setY(pr.getMovingHead2Tilt()); } //System.out.println(System.identityHashCode(pr)+"\t"+ pr.getId() +"\t"+pr.getMovingHead1Pan()+"\t"+pr.getMovingHead1Tilt()); listaPuntos.add(p); } pnlCanvas.setListaPuntos(listaPuntos); } public void setId(String id){ entidad = (FixtureMovingHead)ListaFixtures.getFixture(id); pnlCanvas.setEntidad(entidad); entidad.setListenerCambioPosicion(this); pnlControlPosicion.setEntidad(entidad); pnlControlPosicionFine.setEntidad(entidad); pnlControlPosicionFine.setEsFine(true); pnlTraslada.setListener(this); pnlTraslada.setTipo(TipoMovimiento.TRASLADA); pnlEscala.setListener(this); pnlEscala.setTipo(TipoMovimiento.ESCALA); if (id.contains("1")) pnl1.setBorder(new TitledBorder(null, "Moving Head 1", TitledBorder.LEADING, TitledBorder.TOP, null, null)); else pnl1.setBorder(new TitledBorder(null, "Moving Head 2", TitledBorder.LEADING, TitledBorder.TOP, null, null)); this.id = id; actualizaPuntos(); } @Override public void actionPerformed(ActionEvent e) { if (e.getSource().equals(btnEditar)){ if (lstPuntos.getSelectedValue()!=null){ PuntoRoboticas pr = lstPuntos.getSelectedValue(); if ("movingHead1".equals(this.id)){ pr.setMovingHead1Pan(entidad.getPosX()); pr.setMovingHead1Tilt(entidad.getPosY()); pr.setMovingHead1PanFine(entidad.getPanFine()); pr.setMovingHead1TiltFine(entidad.getTiltFine()); }else{ pr.setMovingHead2Pan(entidad.getPosX()); pr.setMovingHead2Tilt(entidad.getPosY()); pr.setMovingHead2PanFine(entidad.getPanFine()); pr.setMovingHead2TiltFine(entidad.getTiltFine()); } //System.out.println(System.identityHashCode(pr)+"\t"+ pr.getId() +"\t"+pr.getMovingHead1Pan()+"\t"+pr.getMovingHead1Tilt()); actualizaPuntos(); pnlCanvas.repaint(); PuntosRoboticasCfg.grabar(); } } } @Override public void moverHasta(int x, int y, boolean fine) { if (fine){ scrlX.setValue(x); scrlY.setValue(y); } pnlCanvas.repaint(); } @Override public void valueChanged(ListSelectionEvent arg0) { if (arg0.getSource().equals(lstPuntos) && !arg0.getValueIsAdjusting()){ if (lstPuntos.getSelectedValue()!=null) lstPuntos.getSelectedValue().mueveA(); pnlCanvas.repaint(); } } @Override public void mueveArriba(TipoMovimiento tipo) { for (PuntoRoboticas pr: PuntosRoboticasCfg.getListaPuntos()){ if ("movingHead1".equals(this.id)){ if (tipo == TipoMovimiento.TRASLADA) pr.setMovingHead1Tilt(pr.getMovingHead1Tilt()-1); else pr.setMovingHead1Tilt((int)(pr.getMovingHead1Tilt()/1.025)); }else{ if (tipo == TipoMovimiento.TRASLADA) pr.setMovingHead2Tilt(pr.getMovingHead2Tilt()-1); else pr.setMovingHead2Tilt((int)(pr.getMovingHead2Tilt()/1.025)); } } actualizaPuntos(); pnlCanvas.repaint(); PuntosRoboticasCfg.grabar(); } @Override public void mueveAbajo(TipoMovimiento tipo) { for (PuntoRoboticas pr: PuntosRoboticasCfg.getListaPuntos()){ if ("movingHead1".equals(this.id)){ if (tipo == TipoMovimiento.TRASLADA) pr.setMovingHead1Tilt(pr.getMovingHead1Tilt()+1); else pr.setMovingHead1Tilt((int)(pr.getMovingHead1Tilt()*1.025)); }else{ if (tipo == TipoMovimiento.TRASLADA) pr.setMovingHead2Tilt(pr.getMovingHead2Tilt()+1); else pr.setMovingHead2Tilt((int)(pr.getMovingHead2Tilt()*1.025)); } } actualizaPuntos(); pnlCanvas.repaint(); PuntosRoboticasCfg.grabar(); } @Override public void mueveIzquerda(TipoMovimiento tipo) { for (PuntoRoboticas pr: PuntosRoboticasCfg.getListaPuntos()){ if ("movingHead1".equals(this.id)){ if (tipo == TipoMovimiento.TRASLADA) pr.setMovingHead1Pan(pr.getMovingHead1Pan()-1); else pr.setMovingHead1Pan((int)(pr.getMovingHead1Pan()/1.025)); }else{ if (tipo == TipoMovimiento.TRASLADA) pr.setMovingHead2Pan(pr.getMovingHead2Pan()-1); else pr.setMovingHead2Pan((int)(pr.getMovingHead2Pan()/1.025)); } } actualizaPuntos(); pnlCanvas.repaint(); PuntosRoboticasCfg.grabar(); } @Override public void mueveDerecha(TipoMovimiento tipo) { for (PuntoRoboticas pr: PuntosRoboticasCfg.getListaPuntos()){ if ("movingHead1".equals(this.id)){ if (tipo == TipoMovimiento.TRASLADA) pr.setMovingHead1Pan(pr.getMovingHead1Pan()+1); else pr.setMovingHead1Pan((int)(pr.getMovingHead1Pan()*1.025)); }else{ if (tipo == TipoMovimiento.TRASLADA) pr.setMovingHead2Pan(pr.getMovingHead2Pan()+1); else pr.setMovingHead2Pan((int)(pr.getMovingHead2Pan()*1.025)); } } actualizaPuntos(); pnlCanvas.repaint(); PuntosRoboticasCfg.grabar(); } @Override public void adjustmentValueChanged(AdjustmentEvent e) { entidad.setPanFine(scrlX.getValue()); entidad.setTiltFine(scrlY.getValue()); entidad.saltarAFine(scrlX.getValue(), scrlY.getValue()); pnlCanvas.repaint(); } }
[ "carlos@DESKTOP-BUHFA21" ]
carlos@DESKTOP-BUHFA21
4408e72049a1e9d48974d1e743d2e67896b44f2f
5cbf5236f71c9d4d67f165d444924fb86457e4cf
/app/src/main/java/com/magic/picshow/di/component/RegisterComponent.java
45c423a7ecd68101b4bbe369202602df37ca28df
[ "Apache-2.0" ]
permissive
snowwolf10285/PicShow-zhaipin
f54eb42bb6300a171a7728ab750e9d74d873659c
b8bec473db94b6214535e73355d2c2000927f70b
refs/heads/master
2021-01-18T03:53:48.856924
2017-03-22T03:10:25
2017-03-22T03:10:25
85,778,898
12
1
null
null
null
null
UTF-8
Java
false
false
1,243
java
package com.magic.picshow.di.component; import com.jess.arms.di.scope.ActivityScope; import com.magic.picshow.di.module.RegisterModule; import com.magic.picshow.mvp.ui.activity.RegisterActivity; import common.AppComponent; import dagger.Component; /** * 通过Template生成对应页面的MVP和Dagger代码,请注意输入框中输入的名字必须相同 * 由于每个项目包结构都不一定相同,所以每生成一个文件需要自己导入import包名,可以在设置中设置自动导入包名 * 请在对应包下按以下顺序生成对应代码,Contract->Model->Presenter->Activity->Module->Component * 因为生成Activity时,Module和Component还没生成,但是Activity中有它们的引用,所以会报错,但是不用理会 * 继续将Module和Component生成完后,编译一下项目再回到Activity,按提示修改一个方法名即可 * 如果想生成Fragment的相关文件,则将上面构建顺序中的Activity换为Fragment,并将Component中inject方法的参数改为此Fragment */ /** * Created by snowwolf on 17/1/29. */ @ActivityScope @Component(modules = RegisterModule.class, dependencies = AppComponent.class) public interface RegisterComponent { void inject(RegisterActivity activity); }
10929b1d2f46611c000cc6d654735c1e4aa8bb3c
3ec3e917a882d5b9c02ebc9dfa1c9c5a1ff1f242
/asciipic/src/main/java/com/asciipic/services/journalize/logout/JournalizeLogoutService.java
acef2b8473d22a66935b6cfe66a17b568b840429
[]
no_license
AlexandruTudose/TW
46eb553788896734410f9b0b4f123d47639adf52
f8aeb6f37bf62fd1164950e2ebcd7d1822a72450
refs/heads/master
2021-01-20T14:34:10.444057
2017-05-14T21:42:25
2017-05-14T21:42:25
90,627,032
0
0
null
null
null
null
UTF-8
Java
false
false
271
java
package com.asciipic.services.journalize.logout; import com.asciipic.models.JournalizeLogout; import com.asciipic.services.UpdateService; /** * Created by Alexandru on 5/14/2017. */ public interface JournalizeLogoutService extends UpdateService<JournalizeLogout> { }
4bf1093498516df58ff768568138884ce1f09c10
9eebccee9ec3211e98aa85f0b66ac8af3acf8309
/Netty/code/parent/socket-server/src/main/java/wr1ttenyu/study/netty/timeserver/aio/demo/AIOTimeServer.java
9ea5bc7741f08d1a3f5f69a243ce293637cd619d
[]
no_license
wr1ttenyu/study-record
db441d14a931acbe220910379d635f3bd0534fa0
b709a5e445e8fd61c74e8120971763d3a223c25a
refs/heads/master
2020-03-16T13:13:16.578607
2019-02-23T02:37:52
2019-02-23T02:37:52
132,684,034
0
0
null
null
null
null
UTF-8
Java
false
false
559
java
package wr1ttenyu.study.netty.timeserver.aio.demo; public class AIOTimeServer { public static void main(String[] args) { int port = 8080; if (args != null && args.length > 0) { try { port = Integer.valueOf(args[0]); } catch (NumberFormatException e) { // 采用默认值 } } AsyncTimeServerHandler asyncTimeServerHandler = new AsyncTimeServerHandler(port); new Thread(asyncTimeServerHandler, "AIO-AsyncTimeServerHandler-001").start(); } }
a5b5b71d9fd577bfb03bb16f7064535695eaf9d8
d3249d7a5badd76426f8a87888e6c27b136bf442
/SeleniumTutorials/src/testNG/AssertionsExample.java
aa3b0e7fc3ddb0a8fabfa493f0a6f9ba161e32a7
[]
no_license
SANJAY-46/SeleniumTutorials
76f73af7cbb3857c0241f7c10f30c4475f104e15
bbe8af177978a2e3c1712671ec4fea3f59f891a1
refs/heads/master
2022-11-30T12:47:54.873255
2020-08-14T11:54:43
2020-08-14T11:54:43
285,583,521
0
0
null
null
null
null
UTF-8
Java
false
false
587
java
package testNG; import org.testng.Assert; import org.testng.annotations.Test; import org.testng.asserts.Assertion; //Assertions main ah developers unit testing ku use panuvaganga nammo avalova use pana matom public class AssertionsExample { @Test public void checkEqual() { String name="Sanjay"; //NORMAL TYPE //if (name.equals("Sanjay")) { //System.out.println("Yes it is equal"); //}else { // System.out.println("no , it is not equal"); //} // ASSERTION TYPE Assert.assertEquals(name, "Sanjay"); } }
[ "Sanjay46@Sanjay" ]
Sanjay46@Sanjay
58c7e70dd1803ae1f1af9b280d337cca5b456a6d
a7e2488730e6d68f8aa306347a9f608d1f24e6e6
/main/src/sib/util/json/.svn/text-base/ParserException.java.svn-base
7ebfc9d8b49ebaf5abd8d63572ce5c5362fcf710
[]
no_license
cqels/LSBench
546be3f3462f01ae9f04766e78b6c8e46ded27ea
7ae2cb251d90d0b73fbc061e8d2c0715db2cc38a
refs/heads/master
2023-02-21T11:10:59.232016
2023-02-21T09:41:39
2023-02-21T09:41:39
208,025,232
9
3
null
2021-04-29T23:45:18
2019-09-12T10:29:44
Java
UTF-8
Java
false
false
1,107
/* * Big Database Semantic Metric Tools * * Copyright (C) 2011 OpenLink Software <[email protected]> * All Rights Reserved. * * 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; only Version 2 of the License dated * June 1991. * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package sib.util.json; @SuppressWarnings("serial") public class ParserException extends RuntimeException { public ParserException(String message) { super(message); } public ParserException(String message, Throwable cause) { super(message, cause); } }
adf5699e26b187cfe5235961272593e1b8f0e440
f6899a2cf1c10a724632bbb2ccffb7283c77a5ff
/glassfish-4.1.1/appserver/web/admin/src/main/java/org/glassfish/web/admin/monitor/statistics/AltServletStatsImpl.java
e18fcad964f61e19c0994f219bdd31fca79572d9
[]
no_license
Appdynamics/OSS
a8903058e29f4783e34119a4d87639f508a63692
1e112f8854a25b3ecf337cad6eccf7c85e732525
refs/heads/master
2023-07-22T03:34:54.770481
2021-10-28T07:01:57
2021-10-28T07:01:57
19,390,624
2
13
null
2023-07-08T02:26:33
2014-05-02T22:42:20
null
UTF-8
Java
false
false
5,325
java
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development * and Distribution License("CDDL") (collectively, the "License"). You * may not use this file except in compliance with the License. You can * obtain a copy of the License at * https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html * or packager/legal/LICENSE.txt. See the License for the specific * language governing permissions and limitations under the License. * * When distributing the software, include this License Header Notice in each * file and include the License file at packager/legal/LICENSE.txt. * * GPL Classpath Exception: * Oracle designates this particular file as subject to the "Classpath" * exception as provided by Oracle in the GPL Version 2 section of the License * file that accompanied this code. * * Modifications: * If applicable, add the following below the License Header, with the fields * enclosed by brackets [] replaced by your own identifying information: * "Portions Copyright [year] [name of copyright owner]" * * Contributor(s): * If you wish your version of this file to be governed by only the CDDL or * only the GPL Version 2, indicate your decision by adding "[Contributor] * elects to include this software in this distribution under the [CDDL or GPL * Version 2] license." If you don't indicate a single choice of license, a * recipient has the option to distribute your version of this file under * either the CDDL, the GPL Version 2 or to extend the choice of license to * its licensees as provided above. However, if you add GPL Version 2 code * and therefore, elected the GPL Version 2 license, then the option applies * only if the new code is made subject to such option by the copyright * holder. */ package org.glassfish.web.admin.monitor.statistics; import org.glassfish.web.admin.monitor.HttpServiceStatsProviderBootstrap; import org.jvnet.hk2.annotations.Service; import org.glassfish.hk2.api.PerLookup; import javax.inject.Inject; import org.glassfish.api.ActionReport; import org.glassfish.api.ActionReport.ExitCode; import org.glassfish.external.statistics.CountStatistic; import org.glassfish.external.statistics.RangeStatistic; import org.glassfish.admin.monitor.cli.MonitorContract; import org.glassfish.flashlight.datatree.TreeNode; import org.glassfish.flashlight.MonitoringRuntimeDataRegistry; import java.util.List; import java.util.ResourceBundle; @Service @PerLookup public class AltServletStatsImpl implements MonitorContract { private static final ResourceBundle rb = HttpServiceStatsProviderBootstrap.rb; @Inject private MonitoringRuntimeDataRegistry mrdr; private final static String name = "servlet"; private final static String displayFormat = "%1$-10s %2$-10s %3$-10s"; public String getName() { return name; } public ActionReport process(final ActionReport report, final String filter) { if (mrdr == null) { report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage(rb.getString(HTTPListenerStatsImpl.MRDR_NULL)); return report; } TreeNode serverNode = mrdr.get("server"); if (serverNode == null) { report.setActionExitCode(ActionReport.ExitCode.FAILURE); report.setMessage(rb.getString(HTTPListenerStatsImpl.MRDR_NULL)); return report; } String [] patternArr = new String [] {"server.web.servlet.*"}; long activeServletsLoadedCount = 0; long maxServletsLoadedCount = 0; long totalServletsLoadedCount = 0; for (String pattern : patternArr) { List<TreeNode> tnL = serverNode.getNodes(pattern); for (TreeNode tn : tnL) { if (tn.hasChildNodes()) { continue; } if ("activeservletsloadedcount".equals(tn.getName())) { activeServletsLoadedCount = getRangeStatisticValue(tn.getValue()); } else if ("maxservletsloadedcount".equals(tn.getName())) { maxServletsLoadedCount = getCountStatisticValue(tn.getValue()); } else if ("totalservletsloadedcount".equals(tn.getName())) { totalServletsLoadedCount = getCountStatisticValue(tn.getValue()); } } } report.setMessage(String.format(displayFormat, activeServletsLoadedCount, maxServletsLoadedCount, totalServletsLoadedCount)); report.setActionExitCode(ExitCode.SUCCESS); return report; } private long getCountStatisticValue(Object obj) { long l = 0L; if (obj == null) return l; if (obj instanceof CountStatistic) { return ((CountStatistic)obj).getCount(); } return l; } private long getRangeStatisticValue(Object obj) { long l = 0L; if (obj == null) return l; if (obj instanceof RangeStatistic) { return ((RangeStatistic)obj).getCurrent(); } return l; } }
a984cbefe749b6440dac15ac6b5e53b0a2b730e4
d49e3ff34467c71630681df5a791cb3e4bd72ab7
/src/com/adobe/primetime/core/radio/CommandQueue$1.java
5c7e2a984059b72afa1950620a3f8af9292b0ed4
[]
no_license
reverseengineeringer/com.gogoair.ife
124691cf49e832f5dd8009ceb590894a7a058dfa
e88a26eec5640274844e6cdafcd706be727e8ae3
refs/heads/master
2020-09-15T19:45:27.094286
2016-09-01T13:32:34
2016-09-01T13:32:34
67,133,682
0
0
null
null
null
null
UTF-8
Java
false
false
506
java
package com.adobe.primetime.core.radio; import com.adobe.primetime.core.ICallback; class CommandQueue$1 implements ICallback { CommandQueue$1(CommandQueue paramCommandQueue) {} public Object call(Object paramObject) { if (CommandQueue.access$000(this$0)) { return null; } CommandQueue.access$100(this$0); return null; } } /* Location: * Qualified Name: com.adobe.primetime.core.radio.CommandQueue.1 * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
d4ba67f276229f76d9e2a763e4cf946cdd9274b1
6dbae30c806f661bcdcbc5f5f6a366ad702b1eea
/Corpus/eclipse.jdt.ui/3550.java
f38c3739da0fd733cfba7bdc8c6c47c735075246
[ "MIT" ]
permissive
SurfGitHub/BLIZZARD-Replication-Package-ESEC-FSE2018
d3fd21745dfddb2979e8ac262588cfdfe471899f
0f8f4affd0ce1ecaa8ff8f487426f8edd6ad02c0
refs/heads/master
2020-03-31T15:52:01.005505
2018-10-01T23:38:50
2018-10-01T23:38:50
152,354,327
1
0
MIT
2018-10-10T02:57:02
2018-10-10T02:57:02
null
UTF-8
Java
false
false
139
java
package locals_in; public class A_test504 { public void foo() { int x = 10; /*[*/ /*]*/ --x; } }
16c6bcafefbdd1b193a117dd7145be04ff4bba7a
fc33c2ad683826100af04d86cddeba3820346370
/app/src/main/java/frame/golden/com/goldenframe/adapter/recycledemo.java
fcddc014694c3408179de71d1008ea25e1df58e4
[]
no_license
ylxjj/GoldenFrame
4872b9df606dfc92d07814d55b72cfb1974c9d14
1f5141bbe1ef5806992aa549fd5b489fd9c8a7c7
refs/heads/master
2021-05-15T08:11:56.255624
2017-10-10T16:19:13
2017-10-10T16:19:13
106,441,561
0
0
null
null
null
null
UTF-8
Java
false
false
180
java
package frame.golden.com.goldenframe.adapter; import android.support.v7.widget.RecyclerView; /** * Created by Jarnathin on 2017/10/4. */ public class recycledemo { }
49102db0e62cb422abb7c39482d8c5e234e9ffaa
68b7fff6f84f5d91e2bcc4c1b5473fa78f4a4402
/practice/WEB-INF/src/practice/util/DiaryUtil.java
b745b7bc6c43a3959428cd4f133c41cb29e690f8
[]
no_license
OmOm-muron/practice
c227bde2e57e7ef8d3fe8d5f039187ebae9a43c7
8fa6b77e6a03cae3ad90ced2840192dd0d9542dd
refs/heads/master
2022-09-12T11:51:06.306046
2020-05-26T09:44:31
2020-05-26T09:44:31
265,513,288
0
0
null
null
null
null
UTF-8
Java
false
false
6,120
java
package practice.util; import java.io.IOException; import java.text.ParseException; import java.util.ArrayList; import java.util.List; import practice.diary.Diary; import practice.io.CSVFileAccess; public class DiaryUtil { static private final int INDEX_ID = 0; static private final int INDEX_TITLE = 1; static private final int INDEX_DATE = 2; static private final int INDEX_CONTENT = 3; /** * 一行日記を全て取得 * @return * @throws IOException * @throws NumberFormatException * @throws ParseException */ public static List<Diary> getDiaryList() throws IOException, NumberFormatException { List<Diary> listDiary = new ArrayList<Diary>(); CSVFileAccess csvFA = new CSVFileAccess(); try { // CSVファイルの全行を読み込む int lineCount = csvFA.getLineCount(); for(int i = 1; i <= lineCount; i++) { // 1行のデータをカンマ区切りで配列化 String lineStr = csvFA.readLine(i); if (lineStr.isEmpty()) { continue; } String[] diaryElements = lineStr.split(","); // 一行日記の要素を取り出し int id = Integer.parseInt(diaryElements[INDEX_ID]); String title = diaryElements[INDEX_TITLE]; String date = diaryElements[INDEX_DATE]; String content = diaryElements[INDEX_CONTENT]; if (date.isBlank()) { // 日付が空なら削除済みなので非表示 continue; } // Diaryインスタンスを作成 Diary diary = new Diary(); diary.setId(id); diary.setTitle(title); diary.setDate(date); diary.setContent(content); // Listに追加 listDiary.add(diary); } return listDiary; } catch (NumberFormatException e) { e.printStackTrace(); throw e; } catch (IOException e) { e.printStackTrace(); throw e; } } /** * 一行日記を1件取得 * @param targetLine idと同義 * @return * @throws IOException * @throws NumberFormatException * @throws ParseException */ public static Diary getDiary(int targetLine) throws IOException, NumberFormatException { CSVFileAccess csvFA = new CSVFileAccess(); try { // 1行のデータをカンマ区切りで配列化 String lineStr = csvFA.readLine(targetLine); String[] diaryElements = lineStr.split(","); // 一行日記の要素を取り出し int id = Integer.parseInt(diaryElements[INDEX_ID]); String title = diaryElements[INDEX_TITLE]; String date = diaryElements[INDEX_DATE]; String content = diaryElements[INDEX_CONTENT]; // Diaryインスタンスを作成 Diary diary = new Diary(); diary.setId(id); diary.setTitle(title); diary.setDate(date); diary.setContent(content); return diary; } catch (NumberFormatException e) { e.printStackTrace(); throw e; } catch (IOException e) { e.printStackTrace(); throw e; } } /** * 一行日記を書き込み * @param diary * @throws IOException */ public static void addDiary(Diary diary) throws IOException { CSVFileAccess csvFA = new CSVFileAccess(); // 一行日記の要素を取り出し int diaryid = diary.getId(); String title = diary.getTitle(); String date = diary.getDate(); String content = diary.getContent(); // IDをStringに変換 String id = String.valueOf(diaryid); // CSVに書き込む文字列 String addStr = id + "," + title + "," + date + "," + content + "\n"; try { csvFA.addLine(addStr); } catch (IOException e) { e.printStackTrace(); throw e; } } /** * 一行日記を更新 * @param diary * @throws IOException */ public static void updateDiary(Diary diary) throws IOException { CSVFileAccess csvFA = new CSVFileAccess(); // 一行日記の要素を取り出し int diaryid = diary.getId(); String title = diary.getTitle(); String date = diary.getDate(); String content = diary.getContent(); // IDをStringに変換 String id = String.valueOf(diaryid); // 更新後の文字列 String afterStr = id + "," + title + "," + date + "," + content; try { csvFA.editLine(diaryid, afterStr); } catch (IOException e) { e.printStackTrace(); throw e; } } /** * 一行日記を削除 * @param diary * @throws IOException */ public static void deleteDiary(Diary diary) throws IOException { CSVFileAccess csvFA = new CSVFileAccess(); // 一行日記のIDを取り出し int diaryid = diary.getId(); // IDをStringに変換 String id = String.valueOf(diaryid); // 削除後の文字列 String afterStr = id + "," + " " + "," + " " + "," + " "; try { csvFA.editLine(diaryid, afterStr); } catch (IOException e) { e.printStackTrace(); throw e; } } }
e63ed02b3e6c8678a597946a6eb1e765cef4d761
40d844c1c780cf3618979626282cf59be833907f
/src/testcases/CWE369_Divide_by_Zero/s02/CWE369_Divide_by_Zero__float_zero_divide_02.java
82595ad466479f62b80fb1622b170e8498b1863b
[]
no_license
rubengomez97/juliet
f9566de7be198921113658f904b521b6bca4d262
13debb7a1cc801977b9371b8cc1a313cd1de3a0e
refs/heads/master
2023-06-02T00:37:24.532638
2021-06-23T17:22:22
2021-06-23T17:22:22
379,676,259
1
0
null
null
null
null
UTF-8
Java
false
false
5,214
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE369_Divide_by_Zero__float_zero_divide_02.java Label Definition File: CWE369_Divide_by_Zero__float.label.xml Template File: sources-sinks-02.tmpl.java */ /* * @description * CWE: 369 Divide by zero * BadSource: zero Set data to a hardcoded value of zero * GoodSource: A hardcoded non-zero number (two) * Sinks: divide * GoodSink: Check for zero before dividing * BadSink : Dividing by a value that may be zero * Flow Variant: 02 Control flow: if(true) and if(false) * * */ package testcases.CWE369_Divide_by_Zero.s02; import testcasesupport.*; public class CWE369_Divide_by_Zero__float_zero_divide_02 extends AbstractTestCase { public void bad() throws Throwable { float data; if (true) { data = 0.0f; /* POTENTIAL FLAW: data is set to zero */ } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0.0f; } if (true) { /* POTENTIAL FLAW: Possibly divide by zero */ int result = (int)(100.0 / data); IO.writeLine(result); } } /* goodG2B1() - use goodsource and badsink by changing first true to false */ private void goodG2B1() throws Throwable { float data; if (false) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0.0f; } else { /* FIX: Use a hardcoded number that won't a divide by zero */ data = 2.0f; } if (true) { /* POTENTIAL FLAW: Possibly divide by zero */ int result = (int)(100.0 / data); IO.writeLine(result); } } /* goodG2B2() - use goodsource and badsink by reversing statements in first if */ private void goodG2B2() throws Throwable { float data; if (true) { /* FIX: Use a hardcoded number that won't a divide by zero */ data = 2.0f; } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0.0f; } if (true) { /* POTENTIAL FLAW: Possibly divide by zero */ int result = (int)(100.0 / data); IO.writeLine(result); } } /* goodB2G1() - use badsource and goodsink by changing second true to false */ private void goodB2G1() throws Throwable { float data; if (true) { data = 0.0f; /* POTENTIAL FLAW: data is set to zero */ } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0.0f; } if (false) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ IO.writeLine("Benign, fixed string"); } else { /* FIX: Check for value of or near zero before dividing */ if (Math.abs(data) > 0.000001) { int result = (int)(100.0 / data); IO.writeLine(result); } else { IO.writeLine("This would result in a divide by zero"); } } } /* goodB2G2() - use badsource and goodsink by reversing statements in second if */ private void goodB2G2() throws Throwable { float data; if (true) { data = 0.0f; /* POTENTIAL FLAW: data is set to zero */ } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run * but ensure data is inititialized before the Sink to avoid compiler errors */ data = 0.0f; } if (true) { /* FIX: Check for value of or near zero before dividing */ if (Math.abs(data) > 0.000001) { int result = (int)(100.0 / data); IO.writeLine(result); } else { IO.writeLine("This would result in a divide by zero"); } } } public void good() throws Throwable { goodG2B1(); goodG2B2(); goodB2G1(); goodB2G2(); } /* 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); } }
12cf241a908b73bfa355359ad45154e878e343ee
13745970ffa57ffb477fb50f31670660dbd490b4
/eureka/src/main/java/com/muf/eureka/EurekaApplication.java
cb3241dc2782dced9e382b67e40729ca3ee3d728
[]
no_license
huharden/shopping-test
6105373606137160d326e6c473b738508bfcfc39
a139d29d71438068b07be507368435d9f201afe8
refs/heads/master
2020-04-25T15:38:38.303837
2019-02-27T09:32:27
2019-02-27T09:32:27
172,885,378
0
0
null
null
null
null
UTF-8
Java
false
false
481
java
package com.muf.eureka; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; /** * Description: * * @author: hutao * Date: 2019-02-27-15:06 */ @SpringBootApplication @EnableEurekaServer public class EurekaApplication { public static void main(String[] args){ SpringApplication.run(EurekaApplication.class,args); } }
a9bf91ac0e0b47659cf6c3ed812238fbebce7bf5
c65ee4d8342327adb4144255cfd41efac7f23feb
/src/main/java/net/hennabatch/hennadungeon/util/Reference.java
e4f06b39142d467974d67aa6c1802b0f6c71293f
[]
no_license
hennano/HennaDungeon
152308463216502ec49266a2dd32aeb7da98aa4d
b41bf12da824df0f7d3fdd4e5b9b35e110cbc380
refs/heads/master
2023-02-06T20:15:40.448801
2020-12-25T09:11:50
2020-12-25T09:11:50
306,565,343
0
0
null
null
null
null
UTF-8
Java
false
false
3,200
java
package net.hennabatch.hennadungeon.util; import net.hennabatch.hennadungeon.config.Config; import net.hennabatch.hennadungeon.entity.EnemyEntity; import net.hennabatch.hennadungeon.entity.character.*; import net.hennabatch.hennadungeon.item.Item; import net.hennabatch.hennadungeon.item.Items; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Reference { //config public static final Path CONFIG_PATH = Paths.get("config.ini").toAbsolutePath(); public static final SystemLogger logger = new SystemLogger(); public static final Config config = Config.loadConfig(CONFIG_PATH); //screen public static final int SCREEN_WIDTH = 20; public static final int SCREEN_HEIGHT = 20; public static final String SCREEN_EMPTY = " "; public static final String CURSOR_UP = "⯅ "; public static final String CURSOR_DOWN = "⯆ "; public static final String CURSOR_LEFT = "⯇ "; public static final String CURSOR_RIGHT = " ⯈"; public static final String HORIZONTAL_LINE = "―"; public static final String VERTICAL_LINE = "|"; public static final String CROSS = "+"; //dungeon public static final int DUNGEON_WIDTH = 75; public static final int DUNGEON_HEIGHT = 75; public static final int DUNGEON_MAXROOMS = 25; public static final int DUNGEON_MIN_ROOMWIDTH = 5; public static final int DUNGEON_MIN_ROOMHEIGTH = 5; public static final double DUNGEON_CONNECT_CHANCE = 0.5; public static final int PLAYER_SKILL_COOLTIME = 20; public static final int SPAWN_ENEMIES_PER_ROOM = 2; public static final int SPAWN_ITEMS_PER_ROOM = 1; public static final List<Class<? extends EnemyEntity>> SPANNABLE_ENEMIES = new ArrayList<>(Arrays.asList( BatEntity.class, GoblinEntity.class, SlimeEntity.class, WitchEntity.class, MimicEntity.class )); public static final List<Item> SPANNABLE_ITEMS = new ArrayList<>(Arrays.asList( Items.HEAL_POTION, Items.ATK_BUFF_POTION, Items.DEF_BUFF_POTION, Items.MDEF_BUFF_POTION, Items.REGENRATION_POTION )); public static final List<Item> SPANNABLE_WEAPONS = new ArrayList<>(Arrays.asList( Items.SWORD, Items.LONGSWORD, Items.MAGICALSWORD, Items.GRIMOIRE, Items.NECRONOMICON, Items.POISON_DAGGER, Items.BOW )); public static final List<Item> SPANNABLE_ARMORS = new ArrayList<>(Arrays.asList( Items.LEATHER_ARMOR, Items.IRON_ARMOR, Items.CROTHES, Items.ROBE )); public static final int SPAWN_TRAP_COUNT = 5; public static final String DUNGEON_SPACE = SCREEN_EMPTY; public static final String DUNGEON_WALL = "■"; public static final String DUNGEON_EXITPATH = "・"; public static final String DUNGEON_EXITROOM = "○"; public static final String WEAPON_RANGE = "※"; //state public static final int MAX_MDEFEND = 80; public static final int MAX_EVASION = 80; }
18b23986d5819ccc16e6c94ab9a7310d9f976109
2b4c61eb9feb6bc73704b5a0bc659fd82048a195
/src/main/java/pl/beda/UserAuthenticationSystem/repository/RoleRepository.java
18df2f7e46c0132fd5bdd91babbca8890ce865c5
[ "MIT" ]
permissive
marcinbeda/user-authentication-system
5ae7878c34d2f58c58e5a40c37e2b1d4c94f0274
f48cc8854f037b2ef15c882704c68752a00f8774
refs/heads/master
2023-08-22T03:25:49.650719
2021-10-30T09:10:49
2021-10-30T09:10:49
412,913,293
0
0
null
null
null
null
UTF-8
Java
false
false
312
java
package pl.beda.UserAuthenticationSystem.repository; import java.util.Optional; import org.springframework.data.repository.CrudRepository; import pl.beda.UserAuthenticationSystem.entity.Role; public interface RoleRepository extends CrudRepository<Role, Long> { Optional<Role> findByName(String name); }
f5ba8d305eeb2bd7a3d047f7d808630e1d65313e
c16b8990ec3c297ac36aecabb662a6ce124dd940
/base/src/org/openXpertya/model/X_C_CashBook.java
45f9f5d70275f9733f9df640339caa3acca810d3
[]
no_license
Lucas128/libertya
6decae77481ba0756a9a14998824f163001f4b7c
d2e8877a0342af5796c74809edabf726b9ff50dc
refs/heads/master
2021-01-10T16:52:41.332435
2015-05-26T19:34:39
2015-05-26T19:34:39
36,461,214
0
1
null
null
null
null
UTF-8
Java
false
false
4,553
java
/** Modelo Generado - NO CAMBIAR MANUALMENTE - Disytel */ package org.openXpertya.model; import java.util.*; import java.sql.*; import java.math.*; import org.openXpertya.util.*; /** Modelo Generado por C_CashBook * @author Comunidad de Desarrollo Libertya* *Basado en Codigo Original Modificado, Revisado y Optimizado de:* * Jorg Janke * @version - 2010-11-10 15:32:20.281 */ public class X_C_CashBook extends org.openXpertya.model.PO { /** Constructor estándar */ public X_C_CashBook (Properties ctx, int C_CashBook_ID, String trxName) { super (ctx, C_CashBook_ID, trxName); /** if (C_CashBook_ID == 0) { setCashBookType (null); // 'G' setC_CashBook_ID (0); setC_Currency_ID (0); // SQL=SELECT cb.C_Currency_ID FROM C_CashBook cb INNER JOIN C_Cash c ON (cb.C_CashBook_ID=c.C_CashBook_ID) WHERE c.C_Cash_ID=@C_Cash_ID@ setIsDefault (false); setName (null); } */ } /** Load Constructor */ public X_C_CashBook (Properties ctx, ResultSet rs, String trxName) { super (ctx, rs, trxName); } /** AD_Table_ID */ public static final int Table_ID = M_Table.getTableID("C_CashBook"); /** TableName=C_CashBook */ public static final String Table_Name="C_CashBook"; protected static KeyNamePair Model = new KeyNamePair(Table_ID,"C_CashBook"); protected static BigDecimal AccessLevel = new BigDecimal(3); /** Load Meta Data */ protected POInfo initPO (Properties ctx) { POInfo poi = POInfo.getPOInfo (ctx, Table_ID); return poi; } public String toString() { StringBuffer sb = new StringBuffer ("X_C_CashBook[").append(getID()).append("]"); return sb.toString(); } public static final int CASHBOOKTYPE_AD_Reference_ID = MReference.getReferenceID("C_CashBook Type"); /** General Cash Book = G */ public static final String CASHBOOKTYPE_GeneralCashBook = "G"; /** Journal Cash Book = J */ public static final String CASHBOOKTYPE_JournalCashBook = "J"; /** Set Cash Book Type. Cash Book Type */ public void setCashBookType (String CashBookType) { if (CashBookType.equals("G") || CashBookType.equals("J")); else throw new IllegalArgumentException ("CashBookType Invalid value - Reference = CASHBOOKTYPE_AD_Reference_ID - G - J"); if (CashBookType == null) throw new IllegalArgumentException ("CashBookType is mandatory"); if (CashBookType.length() > 1) { log.warning("Length > 1 - truncated"); CashBookType = CashBookType.substring(0,1); } set_ValueNoCheck ("CashBookType", CashBookType); } /** Get Cash Book Type. Cash Book Type */ public String getCashBookType() { return (String)get_Value("CashBookType"); } /** Set Cash Book. Cash Book for recording petty cash transactions */ public void setC_CashBook_ID (int C_CashBook_ID) { set_ValueNoCheck ("C_CashBook_ID", new Integer(C_CashBook_ID)); } /** Get Cash Book. Cash Book for recording petty cash transactions */ public int getC_CashBook_ID() { Integer ii = (Integer)get_Value("C_CashBook_ID"); if (ii == null) return 0; return ii.intValue(); } /** Set Currency. The Currency for this record */ public void setC_Currency_ID (int C_Currency_ID) { set_Value ("C_Currency_ID", new Integer(C_Currency_ID)); } /** Get Currency. The Currency for this record */ public int getC_Currency_ID() { Integer ii = (Integer)get_Value("C_Currency_ID"); if (ii == null) return 0; return ii.intValue(); } /** Set Description. Optional short description of the record */ public void setDescription (String Description) { if (Description != null && Description.length() > 255) { log.warning("Length > 255 - truncated"); Description = Description.substring(0,255); } set_Value ("Description", Description); } /** Get Description. Optional short description of the record */ public String getDescription() { return (String)get_Value("Description"); } /** Set Default. Default value */ public void setIsDefault (boolean IsDefault) { set_Value ("IsDefault", new Boolean(IsDefault)); } /** Get Default. Default value */ public boolean isDefault() { Object oo = get_Value("IsDefault"); if (oo != null) { if (oo instanceof Boolean) return ((Boolean)oo).booleanValue(); return "Y".equals(oo); } return false; } /** Set Name. Alphanumeric identifier of the entity */ public void setName (String Name) { if (Name == null) throw new IllegalArgumentException ("Name is mandatory"); if (Name.length() > 60) { log.warning("Length > 60 - truncated"); Name = Name.substring(0,60); } set_Value ("Name", Name); } /** Get Name. Alphanumeric identifier of the entity */ public String getName() { return (String)get_Value("Name"); } public KeyNamePair getKeyNamePair() { return new KeyNamePair(getID(), getName()); } }
7ac376ff86eac05ff697591975a8da1f3841f4fe
5bc9d8f92f38967cc9ecc03000c0606dbbb38f74
/sca4j/spec/tags/sca-api-r1.0-0.4.5/src/main/java/org/osoa/sca/annotations/package-info.java
90529a8415ef06a11d07332e372f03394b82dc30
[]
no_license
codehaus/service-conduit
795332fad474e12463db22c5e57ddd7cd6e2956e
4687d4cfc16f7a863ced69ce9ca81c6db3adb6d2
refs/heads/master
2023-07-20T00:35:11.240347
2011-08-24T22:13:28
2011-08-24T22:13:28
36,342,601
2
0
null
null
null
null
UTF-8
Java
false
false
2,988
java
/** * SCA4J * Copyright (c) 2009 - 2099 Service Symphony Ltd * * Licensed to you under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. A copy of the license * is included in this distrubtion or you may obtain a copy at * * http://www.opensource.org/licenses/apache2.0.php * * 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. * * This project contains code licensed from the Apache Software Foundation under * the Apache License, Version 2.0 and original code from project contributors. * * * Original Codehaus Header * * Copyright (c) 2007 - 2008 fabric3 project contributors * * Licensed to you under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. A copy of the license * is included in this distrubtion or you may obtain a copy at * * http://www.opensource.org/licenses/apache2.0.php * * 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. * * This project contains code licensed from the Apache Software Foundation under * the Apache License, Version 2.0 and original code from project contributors. * * Original Apache Header * * Copyright (c) 2005 - 2006 The Apache Software Foundation * * Apache Tuscany is an effort undergoing incubation at The Apache Software * Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is * required of all newly accepted projects until a further review indicates that * the infrastructure, communications, and decision making process have stabilized * in a manner consistent with other successful ASF projects. While incubation * status is not necessarily a reflection of the completeness or stability of the * code, it does indicate that the project has yet to be fully endorsed by the ASF. * * This product includes software developed by * The Apache Software Foundation (http://www.apache.org/). */ /** * SCA Common Annotations. * <p/> * Annotations that can be applied to Java code to provide additional meta-data about the SCA component type * or configuration information for the implementation container. These are common annotations that * are intended to provide consistent behaviour across different SCA implementation types but you should consult * the documentation on each implementation type for a definition of how the annotation will be interpreted. */ package org.osoa.sca.annotations;
[ "derekd@15bcc2b3-4398-4609-aa7c-97eea3cd106e" ]
derekd@15bcc2b3-4398-4609-aa7c-97eea3cd106e
c6104ada7400c5ca134dc96e5c6ddaf692aa12bb
b6e0056e358aa4068b5d485030e2116400099ca5
/practice_chap30(Generics)/src/sec02_exam_generic_type/copy/Box.java
10e5261b20d878a8807667632d29b194d6ca9947
[]
no_license
harrycjy1/java-bootcamp
f0c90dfaefa8639e26110caf514c8997ce0122c8
32c580e14c9184045a73c5b34199a53e76571c03
refs/heads/master
2020-04-02T21:04:39.948115
2018-10-26T06:31:02
2018-10-26T06:31:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
224
java
package sec02_exam_generic_type.copy; public class Box<T> { private T t; //setter public void set(T t) { this.t= t; } //getter public T get() { return this.t; } }
9058ccd43d90d190402871e1f419e9b666c6e57a
f9381d9fdbfad63ea2c389a10dfaa24ec39ab36f
/product-service/src/main/java/com/nagarro/amcart/dao/ProductDAO.java
08b5d0e331edddcc4d015f17b7e91060d50cfdde
[]
no_license
DishaDhingra/Ecom-5
1095623ed8f01d418f9e74fa3fa5a1da02385511
c644a975092d3033a326e6fc50baadcb86e9bfcb
refs/heads/master
2020-09-23T23:45:47.207283
2019-10-13T11:14:59
2019-10-13T11:14:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
530
java
package com.nagarro.amcart.dao; import java.util.List; import com.nagarro.amcart.model.ProductModel; public interface ProductDAO { void save(ProductModel productModel); ProductModel get(Long id); ProductModel getByCode(String code); void delete(ProductModel productModel); List<ProductModel> findAll(); List<ProductModel> findAllNewProducts(); List<ProductModel> findAllFeaturedProducts(); List<ProductModel> findAllBestSellerProducts(); List<ProductModel> findAllSpecialProducts(); }
d2fbaefbfa3a863b84213b97491c65d48ca2c8fb
4bfaee4e882214e2daf32a4c50affc0386e12707
/JRPG/src/com/jsandusky/util/GNullable.java
0bd78b88611ab9652986fc53583b2a64ecdb5f28
[ "Apache-2.0" ]
permissive
mmmika/GdxJRPG
2120ff0d407137d6a736a52d4d90d0a8e5c9e40c
d961925e29657d4baf93aff9b464829ae31c0919
refs/heads/master
2021-01-18T17:14:36.737945
2013-10-17T01:43:30
2013-10-17T01:43:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
335
java
package com.jsandusky.util; public class GNullable<T> { T value_; public GNullable() { } public GNullable(T val) { set(val); } public boolean isNull() { return value_ == null; } public T value() { return value_; } public void set(T arg) { value_ = arg; } public void reset() { value_ = null; } }
395f1ac8841561d3d889071627092990ccc0f75a
2efc1d98607038013391eab032b99a10f62a2c4d
/src/main/java/com/ht/Main.java
8e7eb5541590527199155362e11df826f0591602
[]
no_license
bluesky2525/Social-Check
88f4945e4624a06a8cecd90bec4140261873c310
d51230418751dc5c1682a47256917ff21dba19c0
refs/heads/master
2021-09-15T16:43:38.485201
2018-06-07T03:01:21
2018-06-07T03:01:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,353
java
package com.ht; import java.io.File; import java.io.IOException; import java.util.List; import javafx.application.Application; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.stage.FileChooser; import javafx.stage.Stage; import com.ht.view.MainFrameController; import javafx.scene.Scene; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.BorderPane; public class Main extends Application { private Stage primaryStage; private BorderPane rootLayout; @Override public void start(Stage primaryStage) { this.primaryStage = primaryStage; this.primaryStage.setTitle("社保基数检查"); initRootLayout(); showMainview(); // try { // BorderPane root = new BorderPane(); // Scene scene = new Scene(root,400,400); // scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); // primaryStage.setScene(scene); // primaryStage.show(); // } catch(Exception e) { // e.printStackTrace(); // } } /** * Initializes the root layout. */ public void initRootLayout() { rootLayout = new BorderPane(); // Show the scene containing the root layout. Scene scene = new Scene(rootLayout,600,400); scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); primaryStage.setScene(scene); primaryStage.show(); } /** * Shows the person overview inside the root layout. */ public void showMainview() { try { // Load person overview. FXMLLoader loader = new FXMLLoader(); loader.setLocation(Main.class.getResource("view/MainFrame.fxml")); AnchorPane personOverview = (AnchorPane) loader.load(); // Set person overview into the center of root layout. rootLayout.setCenter(personOverview); // Give the controller access to the main app. MainFrameController controller = (MainFrameController)loader.getController(); controller.setMainApp(this); } catch (IOException e) { e.printStackTrace(); } } /** * Returns the main stage. * @return */ public Stage getPrimaryStage() { return primaryStage; } public static void main(String[] args) { launch(args); } }
f9c63b03e37a3eb7b15e598ac29e06b555b398c4
2c199d88ff3ecc2f029a2ca6a5572620c1e005a2
/examples/com.mycorp.examples.student.remoteservice.host/src/com/mycorp/examples/student/remoteservice/host/StudentServiceImpl2.java
8fb55a811b4776cba940aaf002859aadd62fec5a
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
harshana05/JaxRSProviders
374b6f1af67a5431bc93ed00d5cfab8d9c0142c5
39194df66236685f515f525e406cc65318f2f202
refs/heads/master
2020-04-21T08:12:58.345665
2019-02-05T06:18:14
2019-02-05T06:18:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,978
java
/******************************************************************************* * Copyright (c) 2015 Composent, Inc. and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Composent, Inc. - initial API and implementation ******************************************************************************/ package com.mycorp.examples.student.remoteservice.host; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.UUID; import java.util.concurrent.CompletableFuture; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.osgi.service.component.annotations.Component; import com.mycorp.examples.student.Address; import com.mycorp.examples.student.Student; import com.mycorp.examples.student.StudentService; import com.mycorp.examples.student.Students; // The jax-rs path annotation for this service @Path("/studentservice") // The OSGi DS (declarative services) component annotation. //@Component(immediate = true, property = { "service.exported.interfaces=*", "service.exported.intents=osgi.async", // "service.exported.intents=jaxrs","osgi.basic.timeout=50000" }) public class StudentServiceImpl2 implements StudentService { // Provide a map-based storage of students private static Map<String, Student> students = Collections.synchronizedMap(new HashMap<String, Student>()); // Create a single student and add to students map static { Student s = new Student("Joe Senior"); s.setId(UUID.randomUUID().toString()); s.setGrade("First"); Address a = new Address(); a.setCity("New York"); a.setState("NY"); a.setPostalCode("11111"); a.setStreet("111 Park Ave"); s.setAddress(a); students.put(s.getId(), s); } // Implementation of StudentService based upon the students map @GET @Produces(MediaType.APPLICATION_JSON) @Path("/students") public Students getStudents() { Students result = new Students(); result.setStudents(new ArrayList<Student>(students.values())); return result; } @GET @Produces(MediaType.APPLICATION_JSON) @Path("/studentscf") public CompletableFuture<Students> getStudentsCF() { CompletableFuture<Students> cf = new CompletableFuture<Students>(); cf.complete(getStudents()); return cf; } @GET @Produces(MediaType.APPLICATION_JSON) @Path("/students/{studentId}") public Student getStudent(@PathParam("studentId") String id) { return students.get(id); } @POST @Produces(MediaType.APPLICATION_JSON) @Path("/students/{studentName}") public Student createStudent(@PathParam("studentName") String studentName) { if (studentName == null) return null; synchronized (students) { Student s = new Student(studentName); s.setId(UUID.randomUUID().toString()); students.put(s.getId(), s); return s; } } @PUT @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @Path("/students") public Student updateStudent(Student student) { Student result = null; if (student != null) { String id = student.getId(); if (id != null) { synchronized (students) { result = students.get(student.getId()); if (result != null) { String newName = student.getName(); if (newName != null) result.setName(newName); result.setGrade(student.getGrade()); result.setAddress(student.getAddress()); } } } } return result; } @DELETE @Path("/students/{studentId}") @Produces(MediaType.APPLICATION_JSON) public Student deleteStudent(@PathParam("studentId") String studentId) { return students.remove(studentId); } }
52df416f226c68e9577eafd42cd8eb0b5ad13128
8374135dce5bfa75a36c8b490460bd2fb2ffed6d
/src/main/java/com/sh/shdemo/Service/Receiver/TopicReceiver2.java
8930ced54bc40fe9344e174d8310c027cf065c79
[]
no_license
john-cpu/shdemo1
78ab6c716caf3da88a30cfbb885c12a2e6fc9c9c
2227058b99173bbc43f8d2b0c68d2d6ff25bb31a
refs/heads/master
2022-06-29T21:24:03.240879
2019-07-19T07:48:19
2019-07-19T07:48:19
193,200,009
0
0
null
2022-06-21T01:19:44
2019-06-22T06:30:43
Java
UTF-8
Java
false
false
425
java
package com.sh.shdemo.Service.Receiver; import org.springframework.amqp.rabbit.annotation.RabbitHandler; import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.stereotype.Component; @Component @RabbitListener(queues = "topic.message2") public class TopicReceiver2 { @RabbitHandler public void process(String msg) { System.out.println("TopicReceiver2 :" + msg); } }
188d392a57604843a20c2fb990a1440623c25fb8
5a8efd1d145f7de345d9a119605771b50624bdcc
/ch07-mocks/src/main/java/com/manning/junitbook/ch07/mocks/account/DefaultAccountManager2.java
fa4b203e7f6fd26bb141b4a1e2d04eb4bbd2f205
[]
no_license
a0248327/JUnit
f25909305bf5beab28d75887df54716e8364c3d1
ed283acb43c445c03b80c6ab394b3440622674d4
refs/heads/master
2020-05-18T12:42:10.176913
2015-02-25T13:35:50
2015-02-25T13:35:50
31,142,296
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
2,659
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.manning.junitbook.ch07.mocks.account; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.manning.junitbook.ch07.mocks.configurations.Configuration; import com.manning.junitbook.ch07.mocks.configurations.DefaultConfiguration; /** * Refactored architecture. We now pass the Configuration and Log objects to the * constructor and use them for our own logic. * * @version $Id: DefaultAccountManager2.java 508 2009-08-16 18:05:18Z paranoid12 * $ */ public class DefaultAccountManager2 implements AccountManager { /** * Logger instance. */ private Log logger; /** * Configuration to use. */ private Configuration configuration; /** * Constructor with no parameters. */ public DefaultAccountManager2() { this(LogFactory.getLog(DefaultAccountManager2.class), new DefaultConfiguration("technical")); } /** * Constructor with logger and configration parameters. * * @param logger * @param configuration */ public DefaultAccountManager2(Log logger, Configuration configuration) { this.logger = logger; this.configuration = configuration; } /** * Finds an account for user with the given userID. * * @param */ public Account findAccountForUser(String userId) { this.logger.debug("Getting account for user [" + userId + "]"); this.configuration.getSQL("FIND_ACCOUNT_FOR_USER"); // Some code logic to load a user account using JDBC // […] return null; } /** * Updates the given account. */ public void updateAccount(Account account) { // Perform database access here } }
3a88d62dc7d9cb817687ed2faaf7e8d1d6830db5
c406822ccec49ffa709447d25937b0f0fe93d879
/Tcc/src/br/senai/sc/Telas/TelaEscolhaPato.java
dee84683f25d0a07e11da5dbce0d7508f50a2770
[]
no_license
Brunohvc/TCCPatos
b3864128effd3f037ddc6ba701a98cc355423014
df9587a918876f45672423083fea495495f2752c
refs/heads/master
2020-03-19T08:54:56.873611
2018-11-06T23:15:15
2018-11-06T23:15:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,755
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package br.senai.sc.Telas; import br.senai.sc.DAO.PatosDAO; import br.senai.sc.DAO.UsuariopatosDAO; import br.senai.sc.DAO.UsuariosDAO; import br.senai.sc.Entidades.InfoUsuario; import br.senai.sc.Entidades.Patos; import br.senai.sc.Entidades.Usuariopatos; import br.senai.sc.Entidades.Usuarios; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author bruni */ public class TelaEscolhaPato extends javax.swing.JFrame { /** * Creates new form TelaLojaPersonagem */ public TelaEscolhaPato() { initComponents(); setLocationRelativeTo(null); IniciarImg(); SetImagem(); } Usuarios usu = new Usuarios(); UsuariosDAO usuDAO = new UsuariosDAO(); InfoUsuario IU = new InfoUsuario(); Patos pato = new Patos(); PatosDAO patoDAO = new PatosDAO(); Usuariopatos up = new Usuariopatos(); UsuariopatosDAO upDAO = new UsuariopatosDAO(); int id; /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); tabp = new javax.swing.JTable(); imgperso = new javax.swing.JLabel(); comprar = new javax.swing.JButton(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); addWindowListener(new java.awt.event.WindowAdapter() { public void windowActivated(java.awt.event.WindowEvent evt) { formWindowActivated(evt); } public void windowOpened(java.awt.event.WindowEvent evt) { formWindowOpened(evt); } }); jPanel1.setBackground(new java.awt.Color(255, 255, 255)); tabp.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {}, {}, {}, {} }, new String [] { } )); tabp.setFocusable(false); tabp.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { tabpMouseClicked(evt); } }); jScrollPane1.setViewportView(tabp); imgperso.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); comprar.setText("Escolher"); comprar.setEnabled(false); comprar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { comprarActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(250, 250, 250) .addComponent(imgperso, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 138, Short.MAX_VALUE) .addComponent(comprar, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap(22, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(imgperso, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(22, 22, 22)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(comprar, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)) ); jMenu1.setText("Voltar"); jMenu1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jMenu1MouseClicked(evt); } }); jMenuBar1.add(jMenu1); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened // TODO add your handling code here: }//GEN-LAST:event_formWindowOpened private void jMenu1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu1MouseClicked // TODO add your handling code here: TelaMenuPrincipal abrir = new TelaMenuPrincipal(); abrir.setVisible(true); dispose(); }//GEN-LAST:event_jMenu1MouseClicked private void tabpMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabpMouseClicked int linha = tabp.getSelectedRow(); if(linha>-1){ comprar.setEnabled(true); id = (int) tabp.getValueAt(linha, 0); SetImagem(); } }//GEN-LAST:event_tabpMouseClicked public void IniciarImg(){ usu.setIdusuario(IU.getIdusu()); up.setUsuarioID(usu); try { id = upDAO.AcharPato(up); } catch (Exception ex) { Logger.getLogger(TelaEscolhaPato.class.getName()).log(Level.SEVERE, null, ex); } } public void SetImagem(){ if(id!=-1){ try { pato = patoDAO.getPatoPorID(id); } catch (Exception ex) { Logger.getLogger(TelaEscolhaPato.class.getName()).log(Level.SEVERE, null, ex); } imgperso.setIcon(new javax.swing.ImageIcon(getClass().getResource(pato.getFoto()))); } } private void comprarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comprarActionPerformed // TODO add your handling code here: pato.Escolher(id); Comprados(); }//GEN-LAST:event_comprarActionPerformed private void formWindowActivated(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowActivated // TODO add your handling code here: Comprados(); }//GEN-LAST:event_formWindowActivated public void Comprados(){ try { tabp.setModel(upDAO.getTabelaComprados()); } catch (Exception ex) { Logger.getLogger(TelaEscolhaPato.class.getName()).log(Level.SEVERE, null, ex); } } /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(TelaEscolhaPato.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(TelaEscolhaPato.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(TelaEscolhaPato.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(TelaEscolhaPato.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new TelaEscolhaPato().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton comprar; private javax.swing.JLabel imgperso; private javax.swing.JMenu jMenu1; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable tabp; // End of variables declaration//GEN-END:variables }
a45a419639dd9aff179b809ba4cc651e15872b74
05331a56f11478bfcb7c8fec137343bfddb64ccc
/src/com/behavior/strategy/Test.java
ebe1a6c8338e0864c5389360fabfacecbad11c23
[]
no_license
xujiuhua/design-pattern
3803c26fd528e1e335773db5f03aec872a5a682a
dc1634a0d84bdf9e19af16a41def5c8e32612d99
refs/heads/master
2020-11-29T10:59:25.716727
2020-02-24T15:24:10
2020-02-24T15:24:10
230,097,859
0
0
null
null
null
null
UTF-8
Java
false
false
1,016
java
package com.behavior.strategy; /** * <p></p> * * @author jiuhua.xu * @version 1.0 * @since JDK 1.8 */ public class Test { public static void main(String[] args) { Player player1 = new Player("zs", new WinningStrategy(100)); Player player2 = new Player("ls", new WinningStrategy(200)); for (int i = 0; i < 100; i++) { Hand hand1 = player1.netHand(); Hand hand2 = player2.netHand(); if (hand1.isStrongerThan(hand2)) { System.out.println("Winner:" + player1); player1.win(); player2.lose(); } else if (hand1.isWeakThan(hand2)) { System.out.println("Winner:" + player2); player2.win(); player1.lose(); } else { System.out.println("Even..."); player1.even(); player2.even(); } } System.out.println(player1); System.out.println(player2); } }
cafe39e314850cb788e9b1a9786544d697a0212e
dcaff2751db87bc47992f1df31b9e444ea9673ee
/3.JavaMultithreading/src/com/javarush/task/task27/task2712/Tablet.java
f7578dc009291fb60427ed201eb51227fbdca50b
[]
no_license
ygreksh/JavaRushTasks
629ec9f0216b139d9134e2f0a160690b1af21dd4
3b8c0fd46d0b6740321d748580715a31b02fce22
refs/heads/master
2021-01-22T12:49:09.857400
2017-11-22T10:59:24
2017-11-22T10:59:24
102,356,387
0
0
null
null
null
null
UTF-8
Java
false
false
1,903
java
package com.javarush.task.task27.task2712; import com.javarush.task.task27.task2712.ad.AdvertisementManager; import com.javarush.task.task27.task2712.ad.NoVideoAvailableException; import com.javarush.task.task27.task2712.kitchen.Order; import com.javarush.task.task27.task2712.statistic.StatisticManager; import com.javarush.task.task27.task2712.statistic.event.NoAvailableVideoEventDataRow; import com.javarush.task.task27.task2712.statistic.event.VideoSelectedEventDataRow; import java.io.IOException; import java.util.Observable; import java.util.logging.Level; import java.util.logging.Logger; public class Tablet extends Observable{ final int number; public static Logger logger = Logger.getLogger(Tablet.class.getName()); public Order createOrder(){ Order order = null; try { order = new Order(this); if (!order.isEmpty()) { setChanged(); notifyObservers(order); AdvertisementManager advertisementManager = new AdvertisementManager(order.getTotalCookingTime()*60); try { //StatisticManager.getInstance().register(new VideoSelectedEventDataRow(advertisementManager.)); advertisementManager.processVideos(); } catch (NoVideoAvailableException e) { //StatisticManager.getInstance().register(new NoAvailableVideoEventDataRow(order.getTotalCookingTime()*60)); logger.log(Level.INFO, "No video is available for the order " + order); } } return order; } catch (IOException e) { logger.log(Level.SEVERE,"Console is unavailable."); return null; } } public Tablet(int number) { this.number = number; } @Override public String toString() { return "Tablet{number=" + number + "}"; } }
[ "ygreksh" ]
ygreksh
9fa4c8bab4ef50e9b4748f861d12d3aa12c25a5d
f29969ffbf7008c0d625fc3c88b12a992f3b3b12
/src/it/unitn/disi/giugno2018/torrehannoi.java
9ada17cc3fc44a38719ea454e7f1a08a980ca6c8
[]
no_license
lbottona/UNITN-lingProg-Torre_Hanoi
cc000f834ac9d892fd30796bbe2f23e8bd4d2620
675a178b0a9f6c15f9fed7ef82a10f0ef56a29de
refs/heads/master
2023-03-15T21:04:55.054868
2019-07-05T11:45:30
2019-07-05T11:45:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,570
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 it.unitn.disi.giugno2018; import javafx.application.Application; import javafx.event.ActionEvent; import javafx.event.Event; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Alert; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.input.MouseEvent; import javafx.scene.layout.Background; import javafx.scene.layout.BackgroundFill; import javafx.scene.layout.BorderPane; import javafx.scene.layout.ColumnConstraints; import javafx.scene.layout.CornerRadii; import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.stage.Stage; public class torrehannoi extends Application { Stage mainWindow = null; Palo p1 = null; Palo p2 = null; Palo p3 = null; Disco disco1 = null; Disco disco2 = null; Disco disco3 = null; Disco disco4 = null; Disco discoAppoggio = null; MyTextBox txtFrom = null; MyTextBox txtTo = null; Palo paloPartenza = null; Palo paloArrivo = null; Alert alert = new Alert(AlertType.WARNING); BorderPane prepareSceneContent() { Palo paloPartenza = null; Palo paloArrivo = null; BorderPane root = new BorderPane(); MyButton btnClose = new MyButton("Close", true, new ListenerClose()); VBox vbVerticaleSx = new VBox(); vbVerticaleSx.setAlignment(Pos.CENTER_LEFT); vbVerticaleSx.getChildren().add(btnClose); HBox hbSuperiore = new HBox(); hbSuperiore.setAlignment(Pos.CENTER); Label lblFrom = new Label("FROM"); Label lblTo = new Label("TO"); txtFrom = new MyTextBox("",true); txtTo = new MyTextBox("",true); MyButton btnClear = new MyButton("Clear", false, new ListenerClear()); hbSuperiore.getChildren().addAll(lblFrom,txtFrom,lblTo,txtTo,btnClear); MyButton btnReset = new MyButton("Reset", false, new ListenerReset()); VBox vbVerticaleDx = new VBox(); vbVerticaleDx.setAlignment(Pos.CENTER_RIGHT); vbVerticaleDx.getChildren().add(btnReset); HBox hbInferiore = new HBox(); hbInferiore.setAlignment(Pos.CENTER); MyButton btnMove = new MyButton("Move",false, new ListenerMove()); hbInferiore.getChildren().add(btnMove); GridPane gpCentrale = new GridPane(); gpCentrale.setBackground(new Background(new BackgroundFill(Color.LIGHTGRAY, CornerRadii.EMPTY, Insets.EMPTY))); p1= new Palo("p1"); p2= new Palo("p2"); p3= new Palo("p3"); gpCentrale.add(p1, 0, 0); gpCentrale.add(p2, 1, 0); gpCentrale.add(p3, 2, 0); gpCentrale.setAlignment(Pos.CENTER); disco1 = new Disco(1,Color.GREEN); disco2 = new Disco(2,Color.BLUE); disco3 = new Disco(3,Color.RED); disco4 = new Disco(4,Color.YELLOW); p1.aggiungi(disco1); p1.aggiungi(disco2); p1.aggiungi(disco3); p1.aggiungi(disco4); p1.addEventHandler(MouseEvent.MOUSE_CLICKED, new ListenerPali()); p2.addEventHandler(MouseEvent.MOUSE_CLICKED, new ListenerPali()); p3.addEventHandler(MouseEvent.MOUSE_CLICKED, new ListenerPali()); root.setTop(hbSuperiore); root.setLeft(vbVerticaleSx); root.setRight(vbVerticaleDx); root.setCenter(gpCentrale); root.setBottom(hbInferiore); return root; } class ListenerClose implements EventHandler { public void handle(Event t) { } } class ListenerClear implements EventHandler { public void handle(Event t) { txtFrom.setText(""); txtTo.setText(""); paloPartenza = null; paloArrivo = null; } } class ListenerReset implements EventHandler { public void handle(Event t) { p1.reset(); p2.reset(); p3.reset(); p1.aggiungi(disco1); p1.aggiungi(disco2); p1.aggiungi(disco3); p1.aggiungi(disco4); txtFrom.setText(""); txtTo.setText(""); paloPartenza = null; paloArrivo = null; } } class ListenerMove implements EventHandler { public void handle(Event t) { if (txtFrom.getText().equals("") || txtTo.getText().equals("")) { erroreTextBoxVuote(); } else { discoAppoggio = paloPartenza.rimuoviUltimo(); boolean risultato = paloArrivo.aggiungi(discoAppoggio); if (risultato == false) { paloPartenza.aggiungi(discoAppoggio); alert.setTitle("ATTENZIONE"); alert.setHeaderText("ATTENZIONE!!"); alert.setContentText("Impossibile appoggiare un disco su uno più piccolo"); alert.showAndWait(); } txtFrom.setText(""); txtTo.setText(""); paloPartenza = null; paloArrivo = null; } } private void erroreTextBoxVuote() { alert.setTitle("ATTENZIONE"); alert.setHeaderText("ATTENZIONE!!"); alert.setContentText("pali di partenza e di arrivo non definiti"); alert.showAndWait(); } } class ListenerPali implements EventHandler { public void handle(Event t) { String sorgente = t.getSource().toString(); if (txtFrom.getText().equals("") && txtTo.getText().equals("")) { switch(sorgente) { case "p1": if(!p1.isEmpty()) { paloPartenza = p1; txtFrom.setText(paloPartenza.getNome()); } else errorePaloPartenza(); break; case "p2": if(!p2.isEmpty()) { paloPartenza = p2; txtFrom.setText(paloPartenza.getNome()); } else errorePaloPartenza(); break; case "p3": if(!p3.isEmpty()) { paloPartenza = p3; txtFrom.setText(paloPartenza.getNome()); } else errorePaloPartenza(); break; } } else if (!txtFrom.getText().equals("") && txtTo.getText().equals("")) { switch(sorgente) { case "p1": if(!p1.equals(paloPartenza)) { paloArrivo = p1; txtTo.setText(paloArrivo.getNome()); } else errorePaloArrivo(); break; case "p2": if(!p2.equals(paloPartenza)) { paloArrivo = p2; txtTo.setText(paloArrivo.getNome()); } else errorePaloArrivo(); break; case "p3": if(!p3.equals(paloPartenza)) { paloArrivo = p3; txtTo.setText(paloArrivo.getNome()); } else errorePaloArrivo(); break; } } else if(!txtFrom.getText().equals("") && !txtTo.getText().equals("")) { errorePaliGiaDefiniti(); } } private void errorePaloPartenza() { alert.setTitle("ATTENZIONE"); alert.setHeaderText("ATTENZIONE!!"); alert.setContentText("Il palo di partenza non può essere vuoto"); alert.showAndWait(); } private void errorePaloArrivo() { alert.setTitle("ATTENZIONE"); alert.setHeaderText("ATTENZIONE!!"); alert.setContentText("il palo di partenza e quello di destinazione non possono coincidere"); alert.showAndWait(); } private void errorePaliGiaDefiniti() { alert.setTitle("ATTENZIONE"); alert.setHeaderText("ATTENZIONE!!"); alert.setContentText("il palo di partenza e quello di destinazione sono già definiti"); alert.showAndWait(); } } /** * BOTTONI */ class MyButton extends Button { MyButton(String label, boolean isDisabled, EventHandler listener) { super(label); setMinSize(20, 20); setDisable(isDisabled); addEventHandler(ActionEvent.ACTION, listener); } } /** * */ class MyTextBox extends TextField { MyTextBox(String label, boolean isDisable) { super(label); this.setDisable(isDisable); } } public void start(Stage primaryStage) { Scene scene = new Scene(this.prepareSceneContent(), 800, 500); mainWindow = primaryStage; primaryStage.setTitle("Torre Hanoi"); primaryStage.setScene(scene); primaryStage.centerOnScreen(); primaryStage.show(); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } }
5da6fb5a15e31f9087b55abbb40b381d23db0a42
f9b68e91fa085ed40b2eac6aa83db98e23c8a148
/app/src/main/java/com/example/automaticotpretrieval/OTPActivity.java
dc819cf24dacaa93ca8dd28bee3bb2f94fd3e0ae
[]
no_license
Mushahid2521/Automatic_OTP_retrieval_in_Android
9ebf7a3e73ae2dcbd3d27490383bb8b7d9f0a156
ed4594c1a3790c94f72e40b4f052636d872e66f4
refs/heads/master
2022-12-04T23:22:41.119005
2020-08-21T05:08:48
2020-08-21T05:08:48
286,504,291
0
0
null
null
null
null
UTF-8
Java
false
false
3,139
java
package com.example.automaticotpretrieval; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Toast; import java.util.regex.*; import com.google.android.gms.auth.api.phone.SmsRetriever; import com.google.android.gms.auth.api.phone.SmsRetrieverClient; import com.google.android.gms.common.api.CommonStatusCodes; import com.google.android.gms.common.api.Status; import com.google.android.gms.tasks.OnFailureListener; import com.google.android.gms.tasks.OnSuccessListener; import com.google.android.gms.tasks.Task; public class OTPActivity extends AppCompatActivity implements SMSReceiver.OTPReceiveListener{ private SMSReceiver smsReceiver; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_o_t_p); startSMSListener(); } private void startSMSListener() { try { smsReceiver = new SMSReceiver(); smsReceiver.setOTPListener(this); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(SmsRetriever.SMS_RETRIEVED_ACTION); this.registerReceiver(smsReceiver, intentFilter); SmsRetrieverClient client = SmsRetriever.getClient(this); Task<Void> task = client.startSmsRetriever(); task.addOnSuccessListener(new OnSuccessListener<Void>() { @Override public void onSuccess(Void aVoid) { // API successfully started Log.v("Hereeeeeee", "Successfully started api listner"); } }); task.addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { // Fail to start API } }); } catch (Exception e) { e.printStackTrace(); } } @Override public void onOTPReceived(String otp) { showToast("OTP Received: " + otp); if (smsReceiver != null) { unregisterReceiver(smsReceiver); smsReceiver = null; } // TODO: Send the OTP to the sever for Verification if (otp.equals("1234567")) { Intent intent = new Intent(OTPActivity.this, SuccessActivity.class); startActivity(intent); } } @Override public void onOTPTimeOut() { showToast("OTP Time out"); } @Override public void onOTPReceivedError(String error) { showToast(error); } @Override protected void onDestroy() { super.onDestroy(); if (smsReceiver != null) { unregisterReceiver(smsReceiver); } } private void showToast(String msg) { Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); } }
7d689f2850a2058efd717e1d55f05fccfe896841
16d65d418594eb28f9fdccb820d1812a95df2ea1
/src/main/java/com/player/Player/AudioPlayer.java
89cab01e62b6f76a5c5205d47b98040233d07136
[]
no_license
wang-kui-die/MediaPlayer
6a11d7b8e8e3777e26975fd83ba70c764af6bc11
3c4e191f5bfce1a5aeabeff7c30fe91f84204d21
refs/heads/master
2023-04-15T13:53:26.916349
2021-04-25T08:00:59
2021-04-25T08:00:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
11,235
java
package com.player.Player; import com.player.MainFrame; import com.player.UI.Bottom.BottomLeft; import com.player.UI.View.ViewPanel; import javazoom.jl.decoder.JavaLayerException; import javazoom.jl.player.Player; import org.jaudiotagger.audio.AudioFile; import org.jaudiotagger.audio.AudioFileIO; import org.jaudiotagger.audio.exceptions.CannotReadException; import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException; import org.jaudiotagger.audio.exceptions.ReadOnlyFileException; import org.jaudiotagger.audio.mp3.MP3File; import org.jaudiotagger.tag.TagException; import org.jaudiotagger.tag.id3.AbstractID3v2Frame; import org.jaudiotagger.tag.id3.AbstractID3v2Tag; import org.jaudiotagger.tag.id3.framebody.FrameBodyAPIC; import javax.imageio.ImageIO; import javax.imageio.stream.FileImageInputStream; import java.awt.image.BufferedImage; import java.io.*; import java.util.Objects; import java.util.Vector; import java.util.logging.Level; public class AudioPlayer { private boolean isPlaying = false; // 正在播放 private static String fileName = ""; // 当前处理的文件名 private static byte[] musicBytes; // 音乐文件流字节 private BufferedInputStream bufferedInputStream;// 音乐缓冲流,播放流 private static PlayMusicThread playMusicThread; // 播放线程对象 private static EndThread endThread;// 播放结束线程 private static int length; // 播放歌曲的长度 private static BufferedImage cover; // 封面图片 private static AudioPlayer audioPlayer = new AudioPlayer(); public static AudioPlayer getInstance() { return audioPlayer; } public static PlayMusicThread getPlayMusicThread() { return playMusicThread; } public boolean isPlaying() { return isPlaying; } // 启动时初始化,显示第一首歌 public void init() throws ReadOnlyFileException, CannotReadException, TagException, InvalidAudioFrameException, IOException { Vector v = getFileList("src/music/"); String path = "src/music/" + v.get(0); this.endThread = new EndThread(); //监听事件结束 this.endThread.start(); prepare(path); //初始化文件流 this.playMusicThread = new PlayMusicThread(this.bufferedInputStream); this.playMusicThread.start(); this.playMusicThread.suspend(); Process.getInstance().init(); } private Vector getFileList(String path) { File rootDirectory = new File(path); String[] fileList = rootDirectory.list(); Vector list = new Vector(); assert fileList != null; for (String file : fileList) if (file.endsWith(".mp3")) list.add(file); return list; } // 播放歌曲之前预先做好:准备好播放流、设置左下方标题 private void prepare(String path) throws ReadOnlyFileException, IOException, TagException, InvalidAudioFrameException, CannotReadException { // AudioFileIO.logger.setLevel(Level.OFF); // AbstractID3v2Tag.logger.setLevel(Level.OFF); // AbstractID3v2Frame.logger.setLevel(Level.OFF); // FrameBodyAPIC.logger.setLevel(Level.OFF); this.fileName = path.substring(path.lastIndexOf('/') + 1); String musicName = this.fileName.substring(0, this.fileName.lastIndexOf('.')); BottomLeft left = (BottomLeft) MainFrame.getBottom().getFileName(); left.setTitle(musicName); this.length = mp3Length(path); byte[] coverByte = getMp3Img(path); ByteArrayInputStream bais = new ByteArrayInputStream(coverByte); cover = ImageIO.read(bais); ViewPanel view = MainFrame.getView(); view.getCover().setCover(cover); File mp3 = new File(path); FileInputStream fileInputStream = new FileInputStream(mp3);//音乐文件流 this.musicBytes = streamToByte(fileInputStream); //音乐字节数组 this.bufferedInputStream = new BufferedInputStream(Objects.requireNonNull(byteToStream(this.musicBytes))); } // 根据文件路径得到mp3音乐播放时长 private int mp3Length(String path) throws TagException, ReadOnlyFileException, CannotReadException, InvalidAudioFrameException, IOException { File file = new File(path); AudioFile mp3 = AudioFileIO.read(file); return mp3.getAudioHeader().getTrackLength(); } // 获取mp3封面 private byte[] getMp3Img(String path) throws TagException, ReadOnlyFileException, CannotReadException, InvalidAudioFrameException, IOException { File file = new File(path); AudioFile mp3 = AudioFileIO.read(file); MP3File mp3File = (MP3File) mp3; AbstractID3v2Tag tag = mp3File.getID3v2Tag(); AbstractID3v2Frame frame = (AbstractID3v2Frame) tag.getFrame("APIC"); byte[] imageData; if (frame == null) { FileImageInputStream unknown = new FileImageInputStream(new File("src/icon/unknown.png")); ByteArrayOutputStream output = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int numBytesRead = 0; while ((numBytesRead = unknown.read(buf)) != -1) { output.write(buf, 0, numBytesRead); } imageData = output.toByteArray(); output.close(); unknown.close(); } else { FrameBodyAPIC body = (FrameBodyAPIC) frame.getBody(); imageData = body.getImageData(); } return imageData; } // 从头开始播放歌曲,可以认为是新的歌曲 public void playMusic(String path) throws ReadOnlyFileException, CannotReadException, TagException, InvalidAudioFrameException, IOException { if (this.playMusicThread != null) { this.playMusicThread.stop(); } prepare(path); this.isPlaying = true; this.playMusicThread = new PlayMusicThread(this.bufferedInputStream); this.playMusicThread.start(); Process.getInstance().changeMusic(this.length); } private byte[] streamToByte(FileInputStream fs) throws IOException { BufferedInputStream all = new BufferedInputStream(fs); ByteArrayOutputStream output = new ByteArrayOutputStream(); byte[] buffer = new byte[1024 * 50]; int n; while ((n = all.read(buffer)) != -1) output.write(buffer, 0, n); return output.toByteArray(); } private FileInputStream byteToStream(byte[] bytes) { File file = new File("src/cache"); FileInputStream fileInputStream; try { OutputStream output = new FileOutputStream(file); BufferedOutputStream bufferedOutput = new BufferedOutputStream(output); bufferedOutput.write(bytes); fileInputStream = new FileInputStream(file); // bufferedOutput.close(); // fileInputStream.close(); file.deleteOnExit(); return fileInputStream; } catch (IOException e) { e.printStackTrace(); } return null; } private void playEnd() throws TagException, ReadOnlyFileException, CannotReadException, InvalidAudioFrameException, IOException { isPlaying = false; fileName = getMusicName(1); playMusic("src/music/" + fileName); Process.getInstance().changeMusic(this.length); } public void playNext() throws TagException, ReadOnlyFileException, CannotReadException, InvalidAudioFrameException, IOException { playEnd(); } public void playPrev() throws TagException, ReadOnlyFileException, CannotReadException, InvalidAudioFrameException, IOException { isPlaying = false; fileName = getMusicName(-1); playMusic("src/music/" + fileName); Process.getInstance().changeMusic(this.length); } /** * @param flag 小于零得到上一首,大于零得到下一首 * @return 得到音乐文件名 */ public String getMusicName(int flag) { Vector v = getFileList("src/music"); int length = v.size(); String now = fileName; if (flag < 0) { // 上一首 for (int i = 1; i < length; i++) { if (v.get(i).toString().equals(now)) return v.get(i - 1).toString(); } return v.get(length - 1).toString(); } else { // 下一首 for (int i = 0; i < length - 1; i++) { if (v.get(i).toString().equals(now)) return v.get(i + 1).toString(); } return v.get(0).toString(); } } // 获得当前音乐时长 public int getLength() { return this.length; } // 设置进度,percent是百分比 public void setProcess(double percent, double time) { byte[] bytes = this.musicBytes; int index = (int) (bytes.length * percent); byte[] b = new byte[(int) (bytes.length * (1 - percent))]; System.arraycopy(bytes, index, b, 0, b.length); InputStream bs = new ByteArrayInputStream(b); this.bufferedInputStream = new BufferedInputStream(bs); this.playMusicThread.stop(); // 重新设置设置进度后,将线程销毁,重新创建线程 this.playMusicThread = new PlayMusicThread(this.bufferedInputStream); if (isPlaying) { this.playMusicThread.start(); } Process.getInstance().setProcess((int) time); } // 跳转,用于快进快退 public void jump(double percent, boolean forward) { double distance = 4.0; // 设置三秒的跳跃间隔 double rate = distance / length; if (forward) { percent += rate; if (percent > 1) { percent = 1; } } else { percent -= rate; if (percent < 0) { percent = 0; } } double time = percent * length; setProcess(percent, time); } // 暂停播放 public void pause() { this.isPlaying = false; this.playMusicThread.suspend(); Process.getInstance().pause(); } // 继续播放 public void go_on() { this.isPlaying = true; this.playMusicThread.resume(); Process.getInstance().go_on(); } class PlayMusicThread extends Thread { private BufferedInputStream bis; public PlayMusicThread(BufferedInputStream bis) { this.bis = bis; } @Override public void run() { try { Player player = new Player(this.bis); player.play(); endThread.resume(); } catch (JavaLayerException e) { e.printStackTrace(); } } } class EndThread extends Thread { @Override public void run() { while (true) { suspend(); try { Thread.sleep(1000); playEnd(); } catch (Exception e) { e.printStackTrace(); } } } } }
fdfe60255d8b397341aa036431c3df7e601f0cf1
8581e3b9c956e042f6ae0a35a928fdee5d7041c6
/src/main/java/com/gmail/mxwild/mealcalories/repository/UserRepository.java
8e15b8d0e30656d957fe2925a92252f56f0d0858
[]
no_license
MxWild/MealCalories
26d7f20e9337cce9064e7be900556015d8de10a1
b630f6360026eab8e0834d81a3e80f6f1f26a807
refs/heads/develop
2023-07-14T19:46:28.650787
2021-08-20T11:15:26
2021-08-20T11:15:26
386,525,386
0
1
null
2021-08-20T11:15:26
2021-07-16T05:52:57
Java
UTF-8
Java
false
false
311
java
package com.gmail.mxwild.mealcalories.repository; import com.gmail.mxwild.mealcalories.model.User; import java.util.List; public interface UserRepository { User save(User user); boolean delete(Integer id); User get(Integer id); User getByEmail(String email); List<User> getAll(); }
295c3e63b5b41d13dd929eec96d4476190b7ff6d
4c550ddac09a854cae2d01ea27a2939012fc362c
/src/com/company/cherry.java
5771fd377e4514c67b2d710543ed8f804030830f
[]
no_license
przeman90/laboratorium
ff03366e788bc0ed87db40371b544df90867e32e
0f997348331714d983dbcd5047b1dd2d51b7be30
refs/heads/main
2023-03-31T04:01:26.927367
2021-03-28T10:11:39
2021-03-28T10:11:39
352,277,383
0
0
null
2021-03-28T10:11:40
2021-03-28T08:25:44
Java
UTF-8
Java
false
false
47
java
package com.company; public class cherry { }
af3114b72324b7c6d6797db8df08f813790daeb5
ed321d5d7134be92256a1e83beebd763d5242840
/chap02/src/code02_06/Main.java
b23391db579a71acbc06e4d77ce0953a40b3b61c
[]
no_license
tttttt-mam/workspace02
b55ec7459dcaf0008dbc89c7e588bc609be08f34
2ff9cb117c7101b226953eabbbb87a43370b9fda
refs/heads/master
2023-03-27T00:24:34.248449
2021-03-16T05:10:57
2021-03-16T05:10:57
348,216,755
0
0
null
null
null
null
UTF-8
Java
false
false
198
java
package code02_06; public class Main { public static void main(String[] args) { // TODO 自動生成されたメソッド・スタブ int i = 3.2; System.out.println(i); } }
51bd1bafc7adae91ea3725e8e47f96a0f3135801
c35e1ac31da97c0fe4fc7f738ac872a72a35cfa4
/app/src/androidTest/java/cs407_mobile/prototype/ExampleInstrumentedTest.java
ef31d5a93f5466a76a3f94926540cb4def2622e0
[]
no_license
blakeyp/prototype
488a3216532c9fafda31ca4b8178baa59e5bbc0f
63f7c3a3fa00eb0eaca850f747379be7662edde8
refs/heads/master
2021-07-22T17:18:27.982417
2017-11-01T12:17:04
2017-11-01T12:17:04
106,825,148
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
package cs407_mobile.prototype; 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("cs407_mobile.prototype", appContext.getPackageName()); } }
8bd95ec36a041daeaeb7bc32e6dd7db7fc767066
3f5c0437489b129eaf48cd10bb139acac1555202
/java_src/HarvestAlgorithm.java
6994fb5b607fb3ad3241596c52632063e24b7254
[]
no_license
pjsavola/doe
41b897a310a0034d3441c381eb46b7f92d23766e
e7915f68232a547230aa1ce1d07527ed8ed9026f
refs/heads/master
2021-01-20T18:33:43.125350
2017-07-16T18:55:46
2017-07-16T18:56:49
61,939,543
0
0
null
null
null
null
UTF-8
Java
false
false
1,461
java
import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; public class HarvestAlgorithm { public static boolean isValid(final Set<Tile> selectedTiles, final Set<TownSite> townSites) { final Map<TownSite, List<Tile>> matching = new HashMap<>(); for (final TownSite townSite : townSites) { matching.put(townSite, new ArrayList<>()); } for (final Tile tile : selectedTiles) { final Set<TownSite> visited = new HashSet<>(); if (!bpm(tile, visited, matching)) { return false; } } return true; } private static boolean bpm(final Tile tile, final Set<TownSite> visited, final Map<TownSite, List<Tile>> matching) { for (final TownSite neighbor : tile.getTownSites()) { if (visited.add(neighbor)) { final List<Tile> assigned = matching.get(neighbor); if (assigned == null) { // Town site does not belong to the player continue; } if (assigned.size() < neighbor.size()) { assigned.add(tile); return true; } // Attempt re-assigning any of the already assigned sites for (final Tile assignedTile : assigned) { if (bpm(assignedTile, visited, matching)) { assigned.remove(assignedTile); assigned.add(tile); return true; } } } } return false; } }
58f61d27f1249ad16e8ab262148e8a1af6f2d38a
39bef83f3a903f49344b907870feb10a3302e6e4
/Android Studio Projects/bf.io.openshop/src/android/support/v7/widget/ListPopupWindow$ForwardingListener$DisallowIntercept.java
82f62e751d2f816642e074c62c8613204c6b80cc
[]
no_license
Killaker/Android
456acf38bc79030aff7610f5b7f5c1334a49f334
52a1a709a80778ec11b42dfe9dc1a4e755593812
refs/heads/master
2021-08-19T06:20:26.551947
2017-11-24T22:27:19
2017-11-24T22:27:19
111,960,738
0
0
null
null
null
null
UTF-8
Java
false
false
253
java
package android.support.v7.widget; private class DisallowIntercept implements Runnable { @Override public void run() { ForwardingListener.access$900(ForwardingListener.this).getParent().requestDisallowInterceptTouchEvent(true); } }
2091b586715309db8fc2a1f263ed0730c622fd31
231b53cb10d326623ff6cbde0806260448452926
/15-Jumlahkan-Tugas/Gabung.java
c4cc070f355a18451204db6d9bbd4bc75caf9578
[]
no_license
RayhanYulanda/StrukturData-2015
c6c6bc49ee64d85f469996c84babdcb27df74781
79600adf99422957736160a8a1c32dd937795f85
refs/heads/master
2021-01-10T16:14:43.334009
2016-01-11T16:44:26
2016-01-11T16:44:26
45,236,367
1
0
null
null
null
null
UTF-8
Java
false
false
1,173
java
/** * Write a description of class Gabung here. * * @author (your name) * @version (a version number or a date) */ public class Gabung { private double data []; private Kelompok [] kelompok = new Kelompok[5]; public Gabung(double data[]) { this.data=data; for (int i=0; i<5 ; i++){ int awal=(i*data.length/5); int akhir=awal+((data.length/5)-1); kelompok[i]=new Kelompok(awal,akhir,data); } Thread thread1 = new Thread(kelompok[0]); Thread thread2 = new Thread(kelompok[1]); Thread thread3 = new Thread(kelompok[2]); Thread thread4 = new Thread(kelompok[3]); Thread thread5 = new Thread(kelompok[4]); thread1.start(); thread2.start(); thread3.start(); thread4.start(); thread5.start(); } public double hasil() { try { Thread.sleep(1000); } catch(InterruptedException e) { } double hasil=0; for(int i=0;i<5;i++){ hasil=hasil+kelompok[i].hasil(); } return hasil; } }
d5cd3ba3b84cd6d3b24357f287df1b8e3dded9b0
3029337aae2416423c26ba45ed1d273a8e27f4f3
/api/src/main/java/com/honeybeedev/exclusiveprison/api/util/Clearable.java
b90e53563454542f78b6efe4c3be238e9073fc01
[]
no_license
OOP-778/exclusive-prison
083c390842a1e572145038383e34fecf7a3f5080
cf159c0e1b53c24c21d395949b2a85978559e307
refs/heads/master
2023-03-01T15:14:58.615642
2021-02-05T09:47:00
2021-02-05T09:47:00
326,151,438
2
1
null
null
null
null
UTF-8
Java
false
false
877
java
package com.honeybeedev.exclusiveprison.api.util; import java.util.function.Consumer; import java.util.function.Function; public class Clearable<T> { protected T object; public Clearable(T object) { this.object = object; } public void clear() { object = null; } public T get() { return object; } public void set(T object) { this.object = object; } public void ifPresent(Consumer<T> consumer) { if (object != null) consumer.accept(object); } public void consumeAndClear(Consumer<T> consumer) { if (object != null) { consumer.accept(object); object = null; } } public <O> O produce(Function<T, O> function) { if (object != null) { return function.apply(object); } return null; } }
d749d6bcbfc1e9bb66a97e911c7bc4fb08aa94f4
b8296b7173d044ba824d0d9a492aae89bb9924c9
/Exercise03/app/src/main/java/com/example/anas/exercise03/Music.java
4b6edf7cb3210b1c723fba0e714776f083208924
[]
no_license
anas9244/mis-2017-exercise-3-sensors-context
917caf415f150dd90f48ce35346e84bc1b52fea6
052c2e44995d78d33e496df39b0eba2dc12e9b22
refs/heads/master
2020-12-30T13:22:19.759698
2017-05-18T23:36:54
2017-05-18T23:36:54
91,211,931
0
0
null
2017-05-14T01:12:50
2017-05-14T01:12:50
null
UTF-8
Java
false
false
7,996
java
package com.example.anas.exercise03; import android.Manifest; import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.location.Location; import android.location.LocationManager; import android.media.MediaPlayer; import android.net.Uri; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.TextView; import java.io.IOException; public class Music extends AppCompatActivity implements SensorEventListener, MediaPlayer.OnPreparedListener, android.location.LocationListener { private SensorManager mSensorManager; private Sensor mAccelerometer; private MediaPlayer mediaPlayerJog, mediaPlayerBike; private Button pickRunFile, pickBikeFile; private TextView tSpeed; private boolean buttonRun; private LocationManager mLocationClient; boolean runPressed; int speed; TextView textView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_music); mLocationClient = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) { return; } mLocationClient.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, this); // Init Media players for both activities mediaPlayerJog = new MediaPlayer(); mediaPlayerBike = new MediaPlayer(); mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL); pickRunFile = (Button) findViewById(R.id.btnRun); pickRunFile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { runPressed=true; mediaPlayerJog.release(); mediaPlayerJog = new MediaPlayer(); Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI); startActivityForResult(intent, 10); } }); pickBikeFile = (Button) findViewById(R.id.btnBike); pickBikeFile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { buttonRun = false; /* Release and initialize Media Player every time the button is pressed in order to allow the user to change the song. */ mediaPlayerBike.release(); mediaPlayerBike = new MediaPlayer(); Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI); startActivityForResult(intent, 10); } }); textView= (TextView) findViewById(R.id.textView2); } @Override public void onLocationChanged(Location location) { // edit the speed when locationn changes, Speed is in Km per hour if (location != null) { speed = (int) ((location.getSpeed() * 3600) / 1000); Log.d("Speed: ", String.valueOf(speed)); } } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } @Override public void onProviderEnabled(String provider) { } @Override public void onProviderDisabled(String provider) { } @Override public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) { //Check if user is moving in the first plcae if ((getAccelerometer(event) > 0.9 && getAccelerometer(event) < 1.1)) { //not moving, then stop music mediaPlayerBike.pause(); mediaPlayerJog.pause(); textView.setText("No music, GET MOVIN'!!"); } else { //moving, then we use the speed detected from location to determine the activity if (speed > 1.9 && speed <= 10) { //running, Speed > 1.5 and <= 11 km/h mediaPlayerBike.pause(); mediaPlayerJog.start(); textView.setText("Playing jogging track. Your speed "+ speed+" Km/h"); } if (speed > 10 && speed <= 20) { //cycling, Speed > 10 and <= 20 km/h mediaPlayerJog.pause(); mediaPlayerBike.start(); textView.setText("Playing cycling track. Your speed "+ speed+" Km/h"); } if (speed > 20) { // in a moving vehicle mediaPlayerBike.pause(); mediaPlayerJog.pause(); textView.setText("No need for music, you'r in car"); } } } } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { } private void playRun(Context context, Uri uri) { try { mediaPlayerJog.setDataSource(context, uri); mediaPlayerJog.setOnPreparedListener(this); mediaPlayerJog.prepareAsync(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } private void playBike(Context context, Uri uri) { try { mediaPlayerBike.setDataSource(context, uri); mediaPlayerBike.setOnPreparedListener(this); mediaPlayerBike.prepareAsync(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void onPrepared(MediaPlayer mp) { mp.start(); mp.pause(); } public double getAccelerometer(SensorEvent event) { float[] values = event.values; // Movement float x = values[0]; float y = values[1]; float z = values[2]; //Log.d("Values", "x: " + x + " y: " + y + " z: " + z); float accelerationSQRT = (float) ((x * x + y * y + z * z) / (9.8 * 9.8)); return Math.sqrt(accelerationSQRT); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK && requestCode == 10) { Uri uriSound = data.getData(); if (buttonRun) playRun(this, uriSound); else playBike(this, uriSound); } } }
c93e4ea67579ff7c1bf6355f7600f421e5ccc42c
63686942df1e1e8b3bb6545f6ea68ca846adc19a
/app/src/main/java/tylorgarrett/xyz/twistedtipper/MainActivity.java
b67d0d9a5fc0e42c82d17c035fe95bcfcfacf570
[]
no_license
garr741/TwistedTipper
738cb1d31750e5c1fd0a70dcfe858ba18bfa5d46
4bff52521e79549514761cfee06656e34318b1c8
refs/heads/master
2021-05-01T01:13:05.117138
2016-09-09T01:06:32
2016-09-09T01:06:32
67,752,436
0
0
null
null
null
null
UTF-8
Java
false
false
338
java
package tylorgarrett.xyz.twistedtipper; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
3e58804449e45b28175b2012093296f4e9ce934c
8e507174ef6e0894fb3e4e6571db570575f53836
/src/main/java/com/ua/passlocker/auth/controller/UserController.java
738fa9338cc8aa14f45374f1a8a890fcbc3dc0db
[ "MIT" ]
permissive
itsaviu/passlocker-auth
b0ae00c2bb70358b03a9a41a7e11e770b4932541
ee9ca3ed258287753499771f3dc363abadc7d2e5
refs/heads/master
2020-12-14T22:33:52.338213
2020-02-08T17:54:05
2020-02-08T17:54:05
234,894,021
1
0
null
null
null
null
UTF-8
Java
false
false
1,321
java
package com.ua.passlocker.auth.controller; import com.fasterxml.jackson.annotation.JsonView; import com.ua.passlocker.auth.models.dto.UserDetailReq; import com.ua.passlocker.auth.service.UserService; import com.ua.passlocker.auth.views.Views; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; @RestController public class UserController { @Autowired private UserService userService; @PostMapping("/users") @JsonView({Views.UserViews.class}) public ResponseEntity fetchUsers(@RequestBody UserDetailReq userDetailReq) { return ResponseEntity.ok(userService.fetchUsers(userDetailReq)); } @GetMapping("/user") @JsonView({Views.UserViews.class}) public ResponseEntity fetchCurrentUser() { return ResponseEntity.ok(userService.fetchCurrentUser(SecurityContextHolder.getContext().getAuthentication().getPrincipal().toString())); } }
636278f27ca36262bec234f3bf2eb0fb8d5630a6
146a30bee123722b5b32c0022c280bbe7d9b6850
/depsWorkSpace/bc-java-master/pg/src/main/java/org/mightyfish/openpgp/operator/bc/BcPGPContentVerifierBuilderProvider.java
481e05bbb81c69b3b81c66dcbb0585e24e5aefb0
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
GLC-Project/java-experiment
1d5aa7b9974c8ae572970ce6a8280e6a65417837
b03b224b8d5028dd578ca0e7df85d7d09a26688e
refs/heads/master
2020-12-23T23:47:57.341646
2016-02-13T16:20:45
2016-02-13T16:20:45
237,313,620
0
1
null
2020-01-30T21:56:54
2020-01-30T21:56:53
null
UTF-8
Java
false
false
2,233
java
package org.mightyfish.openpgp.operator.bc; import java.io.OutputStream; import org.mightyfish.crypto.Signer; import org.mightyfish.openpgp.PGPException; import org.mightyfish.openpgp.PGPPublicKey; import org.mightyfish.openpgp.operator.PGPContentVerifier; import org.mightyfish.openpgp.operator.PGPContentVerifierBuilder; import org.mightyfish.openpgp.operator.PGPContentVerifierBuilderProvider; public class BcPGPContentVerifierBuilderProvider implements PGPContentVerifierBuilderProvider { private BcPGPKeyConverter keyConverter = new BcPGPKeyConverter(); public BcPGPContentVerifierBuilderProvider() { } public PGPContentVerifierBuilder get(int keyAlgorithm, int hashAlgorithm) throws PGPException { return new BcPGPContentVerifierBuilder(keyAlgorithm, hashAlgorithm); } private class BcPGPContentVerifierBuilder implements PGPContentVerifierBuilder { private int hashAlgorithm; private int keyAlgorithm; public BcPGPContentVerifierBuilder(int keyAlgorithm, int hashAlgorithm) { this.keyAlgorithm = keyAlgorithm; this.hashAlgorithm = hashAlgorithm; } public PGPContentVerifier build(final PGPPublicKey publicKey) throws PGPException { final Signer signer = BcImplProvider.createSigner(keyAlgorithm, hashAlgorithm); signer.init(false, keyConverter.getPublicKey(publicKey)); return new PGPContentVerifier() { public int getHashAlgorithm() { return hashAlgorithm; } public int getKeyAlgorithm() { return keyAlgorithm; } public long getKeyID() { return publicKey.getKeyID(); } public boolean verify(byte[] expected) { return signer.verifySignature(expected); } public OutputStream getOutputStream() { return new SignerOutputStream(signer); } }; } } }
f39f4149af21cdd767d8f6a46da632c5d42f5a6a
da711cbdfbf900c39b6d1c5ba168af0bcbd78058
/app/src/test/java/com/binerid/imagegridview/ExampleUnitTest.java
0932e12ec9a7e8d4105a10bc04ffed81856d4ae2
[]
no_license
fauzighozali/ImageGridView
ec278cfba89c8c543bd1160cf217dc7f0abd7ba9
006253d37f4cc9e1fcb467f6dfd1a69f206ee834
refs/heads/master
2021-05-02T10:44:10.836959
2018-02-08T13:14:19
2018-02-08T13:14:19
120,762,171
0
0
null
null
null
null
UTF-8
Java
false
false
403
java
package com.binerid.imagegridview; 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); } }
8999a5f08aefe9933a7f483209f5d65476dfe5e1
cbf0c8e0d7bea55f302f8b3c6f7d2faceb9e70d2
/app/src/main/java/gaugler/backitude/listener/BatteryListener.java
6c1df51618b4d0333346e71d873ab2b62eb528a3
[]
no_license
backitude/Backitude
7983eca97119982ebebe9e36dad7fd2af9b56c25
d314c967049c8b7333dd5269005fdfb8584c2a56
refs/heads/master
2020-03-19T09:05:16.068226
2018-06-06T02:29:04
2018-06-06T02:29:04
136,259,155
0
1
null
null
null
null
UTF-8
Java
false
false
3,274
java
package gaugler.backitude.listener; import gaugler.backitude.constants.PersistedData; import gaugler.backitude.constants.Prefs; import gaugler.backitude.service.ServiceManager; import gaugler.backitude.util.ZLogger; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; public class BatteryListener extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent arg1) { ZLogger.log("BatteryListener onReceive"); boolean isCharging = false; boolean oldIsCharging = false; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); if (arg1.getAction().equals(Intent.ACTION_POWER_CONNECTED)){ ZLogger.log("BatteryListener: Device is docked"); isCharging = true; // example, Intent.ACTION_BATTERY_CHANGED // Battery Level: (String.valueOf(arg1.getIntExtra("level", 0)) + "%"); // Voltage: (String.valueOf((float)arg1.getIntExtra("voltage", 0)/1000) + "V"); // Temperature: (String.valueOf((float)arg1.getIntExtra("temperature", 0)/10) + "c"); // Technology: (arg1.getStringExtra("technology")); // get BatteryManager.BATTERY_STATUS_UNKNOWN // Options: // BatteryManager.BATTERY_STATUS_CHARGING; // BatteryManager.BATTERY_STATUS_DISCHARGING) // BatteryManager.BATTERY_STATUS_NOT_CHARGING){ // BatteryManager.BATTERY_STATUS_FULL){ // Health = arg1.getIntExtra("health", BatteryManager.BATTERY_HEALTH_UNKNOWN); // Options: // BatteryManager.BATTERY_HEALTH_GOOD // BatteryManager.BATTERY_HEALTH_OVERHEAT // BatteryManager.BATTERY_HEALTH_DEAD // BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE // BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE } else { isCharging = false; ZLogger.log("BatteryListener: Device is UN-docked"); } if(prefs!=null) { oldIsCharging = prefs.getBoolean(PersistedData.KEY_isCharging, false); if(isCharging!=oldIsCharging) { ZLogger.log("BatteryListener: Device docked status is different then before"); SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean(PersistedData.KEY_isCharging, isCharging); editor.commit(); boolean realtimeEnabled = prefs.getBoolean(Prefs.KEY_realtime, false); boolean isEnabled = prefs.getBoolean(Prefs.KEY_appEnabled, false); boolean isWifiModeRunning = prefs.getBoolean(PersistedData.KEY_wifiModeRunning, false); /* * If RealTime updating is enabled and the application is enabled, * and if we're in here, the charging status changed * So we need to restart the alarm service to change the alarm as applicable */ if(isEnabled && realtimeEnabled && !isWifiModeRunning){ ZLogger.log("BatteryListener: docked status changed AND realtime updating is effected"); ServiceManager appStarter = new ServiceManager(); appStarter.startAlarmsWithDelay(context.getApplicationContext()); } else { ZLogger.log("BatteryListener: Device status changed but dont matter- doesnt affect realtime"); } } else { ZLogger.log("BatteryListener: Device status is the same as previous, do nothing"); } } } }
8efb3d93cdb24783b06b7a5e7939c0d8213955f9
9b3ecd7983a3264bc87365ff686f36e80e19320a
/src/main/common/utils/CookieUtils.java
8b1a99c0e9126a67b11795a7c009ed00586facad
[]
no_license
568792513/video_end
a224a701bc8462955f505830bf9edd8de3def94a
0dde099177107fc664d65436b6d277221d2a0873
refs/heads/master
2022-12-11T07:52:36.467072
2019-07-03T08:19:46
2019-07-03T08:19:51
128,072,216
0
0
null
2022-12-05T23:51:10
2018-04-04T14:14:47
Java
UTF-8
Java
false
false
1,233
java
package com.hui.user_service.common.utils; import com.alibaba.fastjson.JSONArray; import com.hui.user_service.entity.User; import com.hui.user_service.service.UserService; import com.mysql.jdbc.StringUtils; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import javax.annotation.Resource; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import java.util.regex.Matcher; import java.util.regex.Pattern; @Component public class CookieUtils { private static UserService userService; @Resource private UserService userServiceTmp; @PostConstruct public void init() { userService = this.userServiceTmp; } // 从header获取user public static User getUserByToken(HttpServletRequest request){ String token = request.getHeader("Authorization"); if (StringUtils.isNullOrEmpty(token)){ return null; } else { String regEx="[^0-9]"; Pattern p = Pattern.compile(regEx); Matcher m = p.matcher(token); String id = m.replaceAll("").trim(); Long Id = Long.valueOf(id); return userService.findUserById(Id); } } }
71c94c3f4c277491198637b54359e4c317a84f4f
54bfdbe6c1a249f00f87cafacccb65f8a32d40fc
/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/IdentifierRest.java
6cfb147ea3141fe2aff2b227891b97e188765cda
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "MPL-1.0", "W3C", "GPL-1.0-or-later", "LicenseRef-scancode-unicode", "LGPL-2.1-or-later", "LGPL-2.0-or-later", "CDDL-1.0", "MIT", "Apache-2.0", "JSON", "EPL-1.0", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unicode-icu-58" ]
permissive
4Science/DSpace
55fb70023af8e742191b3f6dd0a06a061bc8dfc9
0c4ee1a65dca7b0bc3382c1a6a642ac94a0a4fba
refs/heads/dspace-cris-7
2023-08-16T05:22:17.382990
2023-08-11T10:00:00
2023-08-11T10:00:00
63,231,221
43
96
BSD-3-Clause
2023-09-08T15:54:48
2016-07-13T09:02:10
Java
UTF-8
Java
false
false
3,267
java
/** * The contents of this file are subject to the license and copyright * detailed in the LICENSE and NOTICE files at the root of the source * tree and available online at * * http://www.dspace.org/license/ */ package org.dspace.app.rest.model; import com.fasterxml.jackson.annotation.JsonProperty; import org.dspace.app.rest.RestResourceController; /** * Implementation of IdentifierRest REST resource, representing some DSpace identifier * for use with the REST API * * @author Kim Shepherd <[email protected]> */ public class IdentifierRest extends BaseObjectRest<String> implements RestModel { // Set names used in component wiring public static final String NAME = "identifier"; public static final String PLURAL_NAME = "identifiers"; private String value; private String identifierType; private String identifierStatus; // Empty constructor public IdentifierRest() { } /** * Constructor that takes a value, type and status for an identifier * @param value the identifier value eg. https://doi.org/123/234 * @param identifierType identifier type eg. doi * @param identifierStatus identifier status eg. TO_BE_REGISTERED */ public IdentifierRest(String value, String identifierType, String identifierStatus) { this.value = value; this.identifierType = identifierType; this.identifierStatus = identifierStatus; } /** * Return name for getType() - this is the section name * and not the type of identifier, see: identifierType string * @return */ @Override @JsonProperty(access = JsonProperty.Access.READ_ONLY) public String getType() { return NAME; } @Override public String getTypePlural() { return PLURAL_NAME; } /** * Get the identifier value eg full DOI URL * @return identifier value eg. https://doi.org/123/234 */ public String getValue() { return value; } /** * Set the identifier value * @param value identifier value, eg. https://doi.org/123/234 */ public void setValue(String value) { this.value = value; } /** * Get type of identifier eg 'doi' or 'handle' * @return type string */ public String getIdentifierType() { return identifierType; } /** * Set type of identifier * @param identifierType type string eg 'doi' */ public void setIdentifierType(String identifierType) { this.identifierType = identifierType; } /** * Get status of identifier, if relevant * @return identifierStatus eg. null or TO_BE_REGISTERED */ public String getIdentifierStatus() { return identifierStatus; } /** * Set status of identifier, if relevant * @param identifierStatus eg. null or TO_BE_REGISTERED */ public void setIdentifierStatus(String identifierStatus) { this.identifierStatus = identifierStatus; } @Override public String getCategory() { return "pid"; } @Override public String getId() { return getValue(); } @Override public Class getController() { return RestResourceController.class; } }
e2f1bbfcc2a44a153bc6aa57278ce0d48bb44b2e
9863738e52fc6b869f688904d6231823f671cdcc
/java/josehp.java
a65d71614b48aa8c58a71c4f86a369f6d3937afc
[]
no_license
mihawkeyes/practice-pro
b5fedc9c16c921a1495441b57b397044beb2464f
c1db284f62fa037b70dfaf61e4ade11a2020c75e
refs/heads/master
2023-06-23T22:08:41.335383
2021-07-21T11:04:45
2021-07-21T11:04:45
314,197,710
0
0
null
null
null
null
UTF-8
Java
false
false
337
java
// java.util.*; public class josehp{ static int jos(int n,int k) { if(n==1) { return 0; } else { return(jos(n-1,k)+k)%n; } } public static void main(String[] args) { int n=5,k=3; System.out.println(jos(n,k)); } }
f4c75d6ef9a5e4202bc01c4d44ff308ad01bb36b
5752a92f29685b13a2e839ba85510953a08b48da
/BaseSmartFrame/src/com/basesmartframe/filecache/cache/DownloadListItems.java
e908bbf940fa5dd0240b71edadf3581daaf803c6
[]
no_license
xieningtao/new_sflib
3728054a79f9d4a2493ec2c0ff8d5681cdf97a32
0a301b7273e58caca5f24aebc5789c3966d2f70a
refs/heads/master
2022-06-02T23:57:03.881868
2016-09-10T06:14:33
2016-09-10T06:14:33
47,156,546
2
0
null
2022-05-20T20:49:30
2015-12-01T01:13:39
Java
UTF-8
Java
false
false
3,485
java
package com.basesmartframe.filecache.cache; import com.sf.utils.baseutil.SFBus; import com.basesmartframe.filecache.BaseFileCacheMessage; import com.sf.loglib.L; import com.google.gson.Gson; import com.sf.httpclient.core.AjaxParams; import com.sflib.reflection.core.SFMsgId; /** * Created by xieningtao on 15-5-21. */ public class DownloadListItems<T> extends DownloadTask { protected final RequestPullListEntity mEntity; /** * @param url * @param entity * @throws Exception if entity is null */ public DownloadListItems(String url, RequestPullListEntity entity) throws Exception { super(url,null); if (null == entity) { throw new IllegalArgumentException("entity is null"); } this.mEntity = entity; } public void excuteGet() { realRunGet(mEntity.params); } public void excutePost() { realRunPost(mEntity.params); } @Override public void onResponse(boolean success, AjaxParams params, String response) { Object result = null; boolean isIncrement = false; if (success) { try { Gson gson = new Gson(); result = gson.fromJson(response, mEntity.mResult); if (null != result) { isIncrement = isIncrement(response); } else { L.error(this, "result.data is null"); } } catch (Exception e) { L.error(TAG, "parse data fail : " + e); } } ResponsePullListEntity responsePullListEntity = new ResponsePullListEntity. ResponsePullListEntityBuilder(mEntity.type, success) .setIncrement(isIncrement) .setParams(params) .builder(); sendResult(result, responsePullListEntity); } private void sendResult(Object result, ResponsePullListEntity responsePullListEntity) { Class message_class = mEntity.mMessage; if (message_class != null) { try { BaseFileCacheMessage message_instance = (BaseFileCacheMessage) message_class.newInstance(); message_instance.setResponsePullListEntity(responsePullListEntity); message_instance.setResult(result); SFBus.send(SFMsgId.CacheMessage.CACHE_MESSAGE_ID,message_instance); } catch (InstantiationException e) { e.printStackTrace(); //TODO } catch (IllegalAccessException e) { e.printStackTrace(); //TODO } } else { //TODO } } private Boolean isRelIncrement(String result) { RequestPullListEntity.PaggingEvent paggingEvent = mEntity.mPaggingEvent; if (null == paggingEvent) return false; final int curOffset = paggingEvent.getOffSet(mEntity.params); final int pageSize = paggingEvent.getPageSize(mEntity.params); final int total = paggingEvent.getTotalPage(result); final int curTotalNum = pageSize * curOffset; return total > curTotalNum ? Boolean.TRUE : Boolean.FALSE; } protected boolean isIncrement(String result) { boolean isIncrement = false; if (null != result) { isIncrement = isRelIncrement(result); } else { L.error(this, "result.data is null"); } return isIncrement; } }
17ffceaeb39cbd5b0ba15ed7b3f75baeeb303921
c3ac8acb072a54f49c6fa0f7b9880e59efb642ed
/HSTest/app/src/main/java/com/example/windows_7/hstest/io/response/ValidateUserResponse.java
1d8e2a4bb94c02e746e6a11f48bf147eebf32ddf
[]
no_license
jonathanTaberna/AndroidStudioProjects
696257058eeecf15bf56b7967e037ecf96da0ae7
a495f183c40f7d35e35a7e8af292dd80fe20d298
refs/heads/master
2021-07-25T21:45:10.685834
2020-04-15T12:00:21
2020-04-15T12:00:21
141,704,289
0
0
null
null
null
null
UTF-8
Java
false
false
417
java
package com.example.windows_7.hstest.io.response; import com.example.windows_7.hstest.model.User; import com.google.gson.annotations.Expose; public class ValidateUserResponse { @Expose private Integer salida; private User usuario; private String msj; public Integer getSalida() { return salida; } public User getUsuario() { return usuario; } public String getMsj() { return msj; } }
6eabaa4ae22882f8c7865830923e362a899b6953
ad9d5c1f216039444c713f1e26fa05aa8e7bce60
/src/main/java/net/mcreator/scriptor/ScriptorMod.java
b8947f1d92facb33742d7eaf511f352c3a8d8c33
[]
no_license
shadowforce78/ScriptorMod
43bd2ac3db7a993c234e5565dc80787a31eb1e21
3083bdf70e960a88458619c7c425dda18a48250d
refs/heads/master
2023-06-01T01:05:39.099062
2021-06-28T18:17:21
2021-06-28T18:17:21
377,334,338
1
0
null
null
null
null
UTF-8
Java
false
false
3,973
java
/* * MCreator note: * * If you lock base mod element files, you can edit this file and the proxy files * and they won't get overwritten. If you change your mod package or modid, you * need to apply these changes to this file MANUALLY. * * Settings in @Mod annotation WON'T be changed in case of the base mod element * files lock too, so you need to set them manually here in such case. * * Keep the ScriptorModElements object in this class and all calls to this object * INTACT in order to preserve functionality of mod elements generated by MCreator. * * If you do not lock base mod element files in Workspace settings, this file * will be REGENERATED on each build. * */ package net.mcreator.scriptor; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.LogManager; import net.minecraftforge.fml.network.simple.SimpleChannel; import net.minecraftforge.fml.network.NetworkRegistry; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraft.util.ResourceLocation; import net.minecraft.item.Item; import net.minecraft.entity.EntityType; import net.minecraft.enchantment.Enchantment; import net.minecraft.block.Block; import java.util.function.Supplier; @Mod("scriptor") public class ScriptorMod { public static final Logger LOGGER = LogManager.getLogger(ScriptorMod.class); private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel PACKET_HANDLER = NetworkRegistry.newSimpleChannel(new ResourceLocation("scriptor", "scriptor"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals); public ScriptorModElements elements; public ScriptorMod() { elements = new ScriptorModElements(); FMLJavaModLoadingContext.get().getModEventBus().register(this); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::init); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientLoad); MinecraftForge.EVENT_BUS.register(new ScriptorModFMLBusEvents(this)); } private void init(FMLCommonSetupEvent event) { elements.getElements().forEach(element -> element.init(event)); } public void clientLoad(FMLClientSetupEvent event) { elements.getElements().forEach(element -> element.clientLoad(event)); } @SubscribeEvent public void registerBlocks(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll(elements.getBlocks().stream().map(Supplier::get).toArray(Block[]::new)); } @SubscribeEvent public void registerItems(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(elements.getItems().stream().map(Supplier::get).toArray(Item[]::new)); } @SubscribeEvent public void registerEntities(RegistryEvent.Register<EntityType<?>> event) { event.getRegistry().registerAll(elements.getEntities().stream().map(Supplier::get).toArray(EntityType[]::new)); } @SubscribeEvent public void registerEnchantments(RegistryEvent.Register<Enchantment> event) { event.getRegistry().registerAll(elements.getEnchantments().stream().map(Supplier::get).toArray(Enchantment[]::new)); } @SubscribeEvent public void registerSounds(RegistryEvent.Register<net.minecraft.util.SoundEvent> event) { elements.registerSounds(event); } private static class ScriptorModFMLBusEvents { private final ScriptorMod parent; ScriptorModFMLBusEvents(ScriptorMod parent) { this.parent = parent; } @SubscribeEvent public void serverLoad(FMLServerStartingEvent event) { this.parent.elements.getElements().forEach(element -> element.serverLoad(event)); } } }