blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
af2dcf16011162ca3ce0d351b0256d767beeed71
7c7ff8c075bc1a5bff42c8d21ae6675926b71750
/core/src/main/java/com/spring/guide/model/Name.java
392303f235e471cb608625fc867c9a35b4303956
[]
no_license
SunKyungCho/spring-guide
a9b801d2c2b60aba60e96c6df3a2c4a464732bce
e32a96a67564244e46ee842b97a1d4180d059d36
refs/heads/master
2020-05-31T15:20:36.594473
2019-05-18T04:11:01
2019-05-18T04:11:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,046
java
package com.spring.guide.model; import lombok.*; import org.springframework.util.StringUtils; import javax.persistence.Column; import javax.persistence.Embeddable; import javax.validation.constraints.NotEmpty; @Embeddable @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @ToString(of = {"first", "middle", "last"}) public class Name { @NotEmpty @Column(name = "first_name", length = 50) private String first; @Column(name = "middle_name", length = 50) private String middle; @NotEmpty @Column(name = "last_name", length = 50) private String last; @Builder public Name(final String first, final String middle, final String last) { this.first = first; this.middle = StringUtils.isEmpty(middle) ? null : middle; this.last = last; } public String getFullName() { if (this.middle == null) { return String.format("%s %s", this.first, this.last); } return String.format("%s %s %s", this.first, this.middle, this.last); } }
[ "cheese10yun@gmail.com" ]
cheese10yun@gmail.com
aa566136baa68a458c09b714289ea2fb04d7468d
6d57df661c8451e4e1664e5838605393653b9d88
/src/main/java/br/com/jusnexo/config/WebConfigurer.java
98c7b216b329ddf96cbb0aed79349a976e83b206
[]
no_license
fecrodrigues/jusnexo-hybridcloud
a5c554718b4b8c597be67954b44b6830a4d31fd3
897558a79fac4d905dd2577cd3bda1d0045413b1
refs/heads/master
2023-05-05T00:49:56.005743
2021-05-25T23:35:08
2021-05-25T23:35:08
370,832,631
0
0
null
null
null
null
UTF-8
Java
false
false
4,811
java
package br.com.jusnexo.config; import static java.net.URLDecoder.decode; import java.io.File; import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; import java.nio.file.Paths; import java.util.*; import javax.servlet.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.web.server.*; import org.springframework.boot.web.servlet.ServletContextInitializer; import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; import org.springframework.core.env.Profiles; import org.springframework.util.CollectionUtils; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; import tech.jhipster.config.JHipsterConstants; import tech.jhipster.config.JHipsterProperties; import tech.jhipster.config.h2.H2ConfigurationHelper; /** * Configuration of web application with Servlet 3.0 APIs. */ @Configuration public class WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> { private final Logger log = LoggerFactory.getLogger(WebConfigurer.class); private final Environment env; private final JHipsterProperties jHipsterProperties; public WebConfigurer(Environment env, JHipsterProperties jHipsterProperties) { this.env = env; this.jHipsterProperties = jHipsterProperties; } @Override public void onStartup(ServletContext servletContext) throws ServletException { if (env.getActiveProfiles().length != 0) { log.info("Web application configuration, using profiles: {}", (Object[]) env.getActiveProfiles()); } if (env.acceptsProfiles(Profiles.of(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT))) { initH2Console(servletContext); } log.info("Web application fully configured"); } /** * Customize the Servlet engine: Mime types, the document root, the cache. */ @Override public void customize(WebServerFactory server) { // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets. setLocationForStaticAssets(server); } private void setLocationForStaticAssets(WebServerFactory server) { if (server instanceof ConfigurableServletWebServerFactory) { ConfigurableServletWebServerFactory servletWebServer = (ConfigurableServletWebServerFactory) server; File root; String prefixPath = resolvePathPrefix(); root = new File(prefixPath + "target/classes/static/"); if (root.exists() && root.isDirectory()) { servletWebServer.setDocumentRoot(root); } } } /** * Resolve path prefix to static resources. */ private String resolvePathPrefix() { String fullExecutablePath; try { fullExecutablePath = decode(this.getClass().getResource("").getPath(), StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { /* try without decoding if this ever happens */ fullExecutablePath = this.getClass().getResource("").getPath(); } String rootPath = Paths.get(".").toUri().normalize().getPath(); String extractedPath = fullExecutablePath.replace(rootPath, ""); int extractionEndIndex = extractedPath.indexOf("target/"); if (extractionEndIndex <= 0) { return ""; } return extractedPath.substring(0, extractionEndIndex); } @Bean public CorsFilter corsFilter() { UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); CorsConfiguration config = jHipsterProperties.getCors(); if (!CollectionUtils.isEmpty(config.getAllowedOrigins())) { log.debug("Registering CORS filter"); source.registerCorsConfiguration("/api/**", config); source.registerCorsConfiguration("/management/**", config); source.registerCorsConfiguration("/v2/api-docs", config); source.registerCorsConfiguration("/v3/api-docs", config); source.registerCorsConfiguration("/swagger-resources", config); source.registerCorsConfiguration("/swagger-ui/**", config); } return new CorsFilter(source); } /** * Initializes H2 console. */ private void initH2Console(ServletContext servletContext) { log.debug("Initialize H2 console"); H2ConfigurationHelper.initH2Console(servletContext); } }
[ "ubuntu@ip-172-31-22-34.ec2.internal" ]
ubuntu@ip-172-31-22-34.ec2.internal
023005d2ecc48816b2b6d31cfa766daf9440eb4a
3fc503bed9e8ba2f8c49ebf7783bcdaa78951ba8
/TRAVACC_R5/travelrulesengine/src/de/hybris/platform/travelrulesengine/dao/impl/DefaultRuleTravelLocationDao.java
0d33f01ddab703125825a20ab2ac161d50b0d595
[]
no_license
RabeS/model-T
3e64b2dfcbcf638bc872ae443e2cdfeef4378e29
bee93c489e3a2034b83ba331e874ccf2c5ff10a9
refs/heads/master
2021-07-01T02:13:15.818439
2020-09-05T08:33:43
2020-09-05T08:33:43
147,307,585
0
0
null
null
null
null
UTF-8
Java
false
false
2,299
java
package de.hybris.platform.travelrulesengine.dao.impl;/* * [y] hybris Platform * * Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved. * * This software is the confidential and proprietary information of SAP * ("Confidential Information"). You shall not disclose such Confidential * Information and shall use it only in accordance with the terms of the * license agreement you entered into with SAP. */ import de.hybris.platform.servicelayer.internal.dao.DefaultGenericDao; import static de.hybris.platform.servicelayer.util.ServicesUtil.validateParameterNotNull; import de.hybris.platform.travelrulesengine.dao.RuleTravelLocationDao; import de.hybris.platform.travelservices.model.travel.LocationModel; import java.util.Collections; import java.util.List; import org.apache.commons.collections.CollectionUtils; import org.apache.log4j.Logger; /** * The type Default rule travel location dao. */ public class DefaultRuleTravelLocationDao extends DefaultGenericDao<LocationModel> implements RuleTravelLocationDao { private static final Logger LOG = Logger.getLogger(DefaultRuleTravelLocationDao.class); /** * Instantiates a new Default rule travel location dao. * * @param typecode * the typecode */ public DefaultRuleTravelLocationDao(final String typecode) { super(typecode); } @Override public LocationModel findLocation(final String code) { validateParameterNotNull(code, "Location code must not be null!"); final List<LocationModel> locationModels = find(Collections.singletonMap(LocationModel.CODE, (Object) code)); if (CollectionUtils.isEmpty(locationModels)) { LOG.info("No result for the given query"); return null; } else if (locationModels.size() > 1) { LOG.warn("Found " + locationModels.size() + " results for the given query"); return null; } return locationModels.get(0); } @Override public List<LocationModel> findLocationsByName(final String name) { validateParameterNotNull(name, "Location name must not be null!"); final List<LocationModel> locationModels = find(Collections.singletonMap(LocationModel.NAME, (Object) name)); if (CollectionUtils.isEmpty(locationModels)) { LOG.info("No result for the given query"); return null; } return locationModels; } }
[ "sebastian.rulik@gmail.com" ]
sebastian.rulik@gmail.com
60a0c75abe751cc1788598957fc2dcf0f9d5d0c6
649980384dfade1ccd4ff788b82f58e7081fef44
/shapes/MyTree.java
ad86ad8a50c17e02926130315cbe4c7265ce3100
[]
no_license
zenwattage/jav142
3d6e4290f40bffb140b626cddba22395817a6213
5e9e96e68d80785b65f19ca7fe00b9260d2e079c
refs/heads/master
2022-11-07T19:10:34.676840
2020-06-20T19:15:57
2020-06-20T19:15:57
267,398,199
0
0
null
null
null
null
UTF-8
Java
false
false
1,533
java
// Allow short name access to java.awt.Color import java.awt.Color; /** *@author Scott Hansford *@version Graphic Tree component */ public class MyTree extends NscComponent{ private NscRectangle trunk; private NscUpTriangle top; /* * * *@param int x x-coordinate for the tree *@param int y y-coordinate for the tree */ public MyTree(int x, int y) { // constructor for superclass - NscComponent super(x,y,50,80); // Draw the trunk rectangle trunk = new NscRectangle(15,40,20,40); trunk.setFilled(true); trunk.setBackground(new java.awt.Color(0x99, 0x33, 0x00)); // Draw the top triangle top = new NscUpTriangle(0,0,50,50); top.setFilled(true); top.setBackground(new java.awt.Color(0x00, 0x99, 0x00)); add(trunk); add(top); } /* * Overloaded constructor with a color param * *@param int x x-coordinate for the tree *@param int y y-coordinate for the tree *@param Color c color parameter for the leaves of the tree */ public MyTree(int x, int y, java.awt.Color c){ this(x, y); setColor(c); } /* * Set method for color of tree * *@param c Color for the tree */ public void setColor(java.awt.Color c){ trunk.setBackground(c); repaint(); } /** * Get method for color of tree * *@return The color of the tree */ public java.awt.Color getColor() { return trunk.getBackground(); } }
[ "zenwattage@gmail.com" ]
zenwattage@gmail.com
096706bac35b750675cf55fe3812deef3852d1c6
6ea40dc01580a3eb47a5b6240d6ef3379937ad8c
/social-network/src/test/java/service/UserServiceTest.java
e6992429d2510c413d96af1196fadeb0728bb43b
[]
no_license
OleksiiShpachenko/SocialNetwork
924ca4b4f41248d1f081da39e5f4c038a64e12b6
a51f376f12d4eeaeab77a5d28d8f68d7b3171fb5
refs/heads/master
2021-01-19T23:57:31.125569
2017-05-13T15:48:58
2017-05-13T15:48:58
89,055,863
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
6,688
java
package service; import static org.junit.Assert.*; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.*; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import com.shpach.sn.persistence.entities.User; import com.shpach.sn.persistence.jdbc.dao.user.IUserDao; import com.shpach.sn.service.UserService; import TestUtils.TestUtils; public class UserServiceTest { private IUserDao mockUserDao; private UserService userService; @Before public void init() { mockUserDao = Mockito.mock(IUserDao.class); userService = UserService.getInstance(); TestUtils.getInstance().mockPrivateField(userService, "userDao", mockUserDao); } @Test public void getUserByLoginTestExistUser() { when(mockUserDao.findUserByEmail(anyString())).thenReturn(new User()); User user = userService.getUserByLogin("userLogin"); verify(mockUserDao, times(1)).findUserByEmail(anyString()); assertNotNull(user); } @Test public void getUserByLoginTestNoExistUser() { when(mockUserDao.findUserByEmail(anyString())).thenReturn(null); User user = userService.getUserByLogin("userLogin"); verify(mockUserDao, times(1)).findUserByEmail(anyString()); assertNull(user); } @Test public void getUserByLoginTestNullLogin() { when(mockUserDao.findUserByEmail(anyString())).thenReturn(null); User user = userService.getUserByLogin(null); verify(mockUserDao, times(0)).findUserByEmail(anyString()); assertNull(user); } @Test public void validateUserNameTestOk(){ String userName1="àáâãä叿çèéêëìíîïðñòóôõö÷øùúûüýþÿÀÁÂÃÄŨÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞ߯¿³²"; String userName2="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; boolean res=userService.validateUserName(userName1); assertTrue(res); res=userService.validateUserName(userName2); assertTrue(res); } @Test public void validateUserNameTestFail(){ String userName1="<>!@#$%"; boolean res=userService.validateUserName(userName1); assertFalse(res); } @Test public void validatePasswordTestOk(){ String userName1="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; boolean res=userService.validatePassword(userName1); assertTrue(res); } @Test public void validatePasswordTestFail(){ String userName1="<>!@#$%AÀÁÂ"; boolean res=userService.validatePassword(userName1); assertFalse(res); } @Test public void validatePasswordTestFailSmall(){ String userName1="abcde"; boolean res=userService.validatePassword(userName1); assertFalse(res); } // @Test // public void getUsersByCommunityTestExistCommunityExistUsers() { // when(mockUserDao.findUsersByCommunityId(anyInt())).thenReturn(new ArrayList<User>()); // List<User> users = userService.getUsersByCommunity(new Community()); // verify(mockUserDao, times(1)).findUsersByCommunityId(anyInt()); // assertNotNull(users); // } // @Test // public void getUsersByCommunityTestExistCommunityNoExistUsers() { // when(mockUserDao.findUsersByCommunityId(anyInt())).thenReturn(null); // List<User> user = userService.getUsersByCommunity(new Community()); // verify(mockUserDao, times(1)).findUsersByCommunityId(anyInt()); // assertNull(user); // } /*@Test public void getUsersByCommunityTestNullCommunity() { List<User> user = userService.getUsersByCommunity(null); verify(mockUserDao, times(0)).findUsersByCommunityId(anyInt()); assertNull(user); }*/ @Test public void addNewUserSuccess() { when(mockUserDao.addOrUpdate(anyObject())).thenReturn(new User()); boolean res = userService.addNewUser(new User()); verify(mockUserDao, times(1)).addOrUpdate(anyObject()); assertTrue(res); } @Test public void addNewUserFail() { when(mockUserDao.addOrUpdate(anyObject())).thenReturn(null); boolean res = userService.addNewUser(new User()); verify(mockUserDao, times(1)).addOrUpdate(anyObject()); assertFalse(res); } @Test public void addNewUserNull() { boolean res = userService.addNewUser(null); verify(mockUserDao, times(0)).addOrUpdate(anyObject()); assertFalse(res); } /*@Test public void findUserWithGreatWorstStatisticTest(){ User user_1=new User(); user_1.setUserId(1); User user_2=new User(); user_2.setUserId(2); User user_3=new User(); user_3.setUserId(3); User user_4=new User(); user_4.setUserId(4); when(mockUserDao.findAll()).thenReturn(new ArrayList<User>(Arrays.asList(user_1, user_2, user_3, user_4))); TaskService taskService=Mockito.mock(TaskService.class); TestUtils.getInstance().mockPrivateField(userService,"taskService", taskService); when(taskService.getTasksByUser(anyObject())).thenReturn(null); when(taskService.getMinScore(null)).thenReturn(5,10,45,40); User user=userService.findUserWithGreatWorstStatistic(); verify(mockUserDao, times(1)).findAll(); verify(taskService, times(4)).getTasksByUser(anyObject()); verify(taskService, times(4)).getMinScore(anyObject()); assertEquals(user, user_3); }*/ /*@Test public void findUserWithGreatWorstStatisticTestNullUser(){ when(mockUserDao.findAll()).thenReturn(null); TaskService taskService=Mockito.mock(TaskService.class); TestUtils.getInstance().mockPrivateField(userService,"taskService", taskService); User user=userService.findUserWithGreatWorstStatistic(); verify(mockUserDao, times(1)).findAll(); verify(taskService, times(0)).getTasksByUser(anyObject()); verify(taskService, times(0)).getMinScore(anyObject()); assertNull(user); }*/ /*@Test public void findUserWithGreatWorstStatisticTestNullTests(){ User user_1=new User(); user_1.setUserId(1); User user_2=new User(); user_2.setUserId(2); User user_3=new User(); user_3.setUserId(3); User user_4=new User(); user_4.setUserId(4); when(mockUserDao.findAll()).thenReturn(new ArrayList<User>(Arrays.asList(user_1, user_2, user_3, user_4))); TaskService taskService=Mockito.mock(TaskService.class); TestUtils.getInstance().mockPrivateField(userService,"taskService", taskService); when(taskService.getTasksByUser(anyObject())).thenReturn(null); when(taskService.getMinScore(null)).thenReturn(Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE); User user=userService.findUserWithGreatWorstStatistic(); verify(mockUserDao, times(1)).findAll(); verify(taskService, times(4)).getTasksByUser(anyObject()); verify(taskService, times(4)).getMinScore(anyObject()); assertNull(user); }*/ }
[ "shpachenko.oleksii@gmail.com" ]
shpachenko.oleksii@gmail.com
781df0b7cccf984f84a0e14d438a8fcf23b899f4
950b3b5b3cef6af0ab38a1b4a7c3fa5b9a7d3753
/common/src/main/java/com/vendertool/common/dal/dao/codegen/QBeanImage.java
082f6248abc10eb4cfa29d1dfcc524c4075fe7e0
[]
no_license
Vacanth/VenderTool
af38788d8888ce98b3caabde75878aeefb799752
14ae350166ec76a2fc4fafcc593d795021acd52e
refs/heads/master
2021-03-25T03:03:45.068557
2013-11-05T04:18:02
2013-11-05T04:18:02
8,917,403
0
0
null
null
null
null
UTF-8
Java
false
false
2,534
java
package com.vendertool.common.dal.dao.codegen; import javax.annotation.Generated; /** * QBeanImage is a Querydsl bean type */ @Generated("com.mysema.query.codegen.BeanSerializer") public class QBeanImage { private Long accountId; private java.sql.Timestamp createdDate; private String hash; private String hostedUrl; private Integer imageFormat; private Long imageId; private String imageName; private java.sql.Timestamp lastModifiedDate; private Long refId; private Integer refType; private String size; private Integer sortOrderId; public Long getAccountId() { return accountId; } public void setAccountId(Long accountId) { this.accountId = accountId; } public java.sql.Timestamp getCreatedDate() { return createdDate; } public void setCreatedDate(java.sql.Timestamp createdDate) { this.createdDate = createdDate; } public String getHash() { return hash; } public void setHash(String hash) { this.hash = hash; } public String getHostedUrl() { return hostedUrl; } public void setHostedUrl(String hostedUrl) { this.hostedUrl = hostedUrl; } public Integer getImageFormat() { return imageFormat; } public void setImageFormat(Integer imageFormat) { this.imageFormat = imageFormat; } public Long getImageId() { return imageId; } public void setImageId(Long imageId) { this.imageId = imageId; } public String getImageName() { return imageName; } public void setImageName(String imageName) { this.imageName = imageName; } public java.sql.Timestamp getLastModifiedDate() { return lastModifiedDate; } public void setLastModifiedDate(java.sql.Timestamp lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; } public Long getRefId() { return refId; } public void setRefId(Long refId) { this.refId = refId; } public Integer getRefType() { return refType; } public void setRefType(Integer refType) { this.refType = refType; } public String getSize() { return size; } public void setSize(String size) { this.size = size; } public Integer getSortOrderId() { return sortOrderId; } public void setSortOrderId(Integer sortOrderId) { this.sortOrderId = sortOrderId; } }
[ "madhusudan.varadan@gmail.com" ]
madhusudan.varadan@gmail.com
b0e7f980e1425195752b39f92fbbf4cd27acbd18
fa1408365e2e3f372aa61e7d1e5ea5afcd652199
/src/testcases/CWE89_SQL_Injection/s02/CWE89_SQL_Injection__Environment_prepareStatement_66b.java
ab85c9f542cfd0fd0b391dd6fa1ce82e71e5606d
[]
no_license
bqcuong/Juliet-Test-Case
31e9c89c27bf54a07b7ba547eddd029287b2e191
e770f1c3969be76fdba5d7760e036f9ba060957d
refs/heads/master
2020-07-17T14:51:49.610703
2019-09-03T16:22:58
2019-09-03T16:22:58
206,039,578
1
2
null
null
null
null
UTF-8
Java
false
false
6,250
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE89_SQL_Injection__Environment_prepareStatement_66b.java Label Definition File: CWE89_SQL_Injection.label.xml Template File: sources-sinks-66b.tmpl.java */ /* * @description * CWE: 89 SQL Injection * BadSource: Environment Read data from an environment variable * GoodSource: A hardcoded string * Sinks: prepareStatement * GoodSink: Use prepared statement and execute (properly) * BadSink : data concatenated into SQL statement used in prepareStatement() call, which could result in SQL Injection * Flow Variant: 66 Data flow: data passed in an array from one method to another in different source files in the same package * * */ package testcases.CWE89_SQL_Injection.s02; import testcasesupport.*; import javax.servlet.http.*; import java.sql.*; import java.util.logging.Level; public class CWE89_SQL_Injection__Environment_prepareStatement_66b { public void badSink(String dataArray[] ) throws Throwable { String data = dataArray[2]; Connection dbConnection = null; PreparedStatement sqlStatement = null; try { /* POTENTIAL FLAW: data concatenated into SQL statement used in prepareStatement() call, which could result in SQL Injection */ dbConnection = IO.getDBConnection(); sqlStatement = dbConnection.prepareStatement("insert into users (status) values ('updated') where name='"+data+"'"); Boolean result = sqlStatement.execute(); if (result) { IO.writeLine("Name, " + data + ", updated successfully"); } else { IO.writeLine("Unable to update records for user: " + data); } } catch (SQLException exceptSql) { IO.logger.log(Level.WARNING, "Error getting database connection", exceptSql); } finally { try { if (sqlStatement != null) { sqlStatement.close(); } } catch (SQLException exceptSql) { IO.logger.log(Level.WARNING, "Error closing PreparedStatement", exceptSql); } try { if (dbConnection != null) { dbConnection.close(); } } catch (SQLException exceptSql) { IO.logger.log(Level.WARNING, "Error closing Connection", exceptSql); } } } /* goodG2B() - use goodsource and badsink */ public void goodG2BSink(String dataArray[] ) throws Throwable { String data = dataArray[2]; Connection dbConnection = null; PreparedStatement sqlStatement = null; try { /* POTENTIAL FLAW: data concatenated into SQL statement used in prepareStatement() call, which could result in SQL Injection */ dbConnection = IO.getDBConnection(); sqlStatement = dbConnection.prepareStatement("insert into users (status) values ('updated') where name='"+data+"'"); Boolean result = sqlStatement.execute(); if (result) { IO.writeLine("Name, " + data + ", updated successfully"); } else { IO.writeLine("Unable to update records for user: " + data); } } catch (SQLException exceptSql) { IO.logger.log(Level.WARNING, "Error getting database connection", exceptSql); } finally { try { if (sqlStatement != null) { sqlStatement.close(); } } catch (SQLException exceptSql) { IO.logger.log(Level.WARNING, "Error closing PreparedStatement", exceptSql); } try { if (dbConnection != null) { dbConnection.close(); } } catch (SQLException exceptSql) { IO.logger.log(Level.WARNING, "Error closing Connection", exceptSql); } } } /* goodB2G() - use badsource and goodsink */ public void goodB2GSink(String dataArray[] ) throws Throwable { String data = dataArray[2]; Connection dbConnection = null; PreparedStatement sqlStatement = null; try { /* FIX: Use prepared statement and execute (properly) */ dbConnection = IO.getDBConnection(); sqlStatement = dbConnection.prepareStatement("insert into users (status) values ('updated') where name=?"); sqlStatement.setString(1, data); Boolean result = sqlStatement.execute(); if (result) { IO.writeLine("Name, " + data + ", updated successfully"); } else { IO.writeLine("Unable to update records for user: " + data); } } catch (SQLException exceptSql) { IO.logger.log(Level.WARNING, "Error getting database connection", exceptSql); } finally { try { if (sqlStatement != null) { sqlStatement.close(); } } catch (SQLException exceptSql) { IO.logger.log(Level.WARNING, "Error closing PreparedStatement", exceptSql); } try { if (dbConnection != null) { dbConnection.close(); } } catch (SQLException exceptSql) { IO.logger.log(Level.WARNING, "Error closing Connection", exceptSql); } } } }
[ "bqcuong2212@gmail.com" ]
bqcuong2212@gmail.com
801f0944df7c5edd4c663f7e340959873c27aa9e
8a119c973748cb6d5ec96c625dfad43004799c6f
/src/test/java/com/web/startweb/JpaMappingTest.java
482080fd16069b15d2561b9fbab5c4567f924850
[]
no_license
dellife/start-web
c72c5338bc0b5c02ba44b933aed26cc14b4ba36b
15eee7885df16384ac45a05ac92cb711b5e57c52
refs/heads/master
2020-04-08T07:17:11.416674
2018-11-27T22:57:29
2018-11-27T22:57:29
159,133,467
0
0
null
null
null
null
UTF-8
Java
false
false
2,136
java
package com.web.startweb; import com.web.startweb.domain.Board; import com.web.startweb.domain.User; import com.web.startweb.domain.enums.BoardType; import com.web.startweb.repository.BoardRepository; import com.web.startweb.repository.UserRepository; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.test.context.junit4.SpringRunner; import java.time.LocalDateTime; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; @RunWith(SpringRunner.class) @DataJpaTest public class JpaMappingTest { private final String boardTestTitle = "테스트"; private final String email = "test@gmail.com"; @Autowired UserRepository userRepository; @Autowired BoardRepository boardRepository; @Before public void init(){ User user = userRepository.save(User.builder() .name("havi") .password("test") .email(email) .createdDate(LocalDateTime.now()) .build()); boardRepository.save(Board.builder() .title(boardTestTitle) .subTitle("서브 타이틀") .content("콘텐츠") .boardType(BoardType.free) .createdDate(LocalDateTime.now()) .updatedDate(LocalDateTime.now()) .user(user).build()); } @Test public void 제대로_생성됐는지_테스트() { User user = userRepository.findByEmail(email); assertThat(user.getName(), is("havi")); assertThat(user.getPassword(), is("test")); assertThat(user.getEmail(), is(email)); Board board = boardRepository.findByUser(user); assertThat(board.getTitle(), is(boardTestTitle)); assertThat(board.getSubTitle(), is("서브 타이틀")); assertThat(board.getContent(), is("콘텐츠")); assertThat(board.getBoardType(), is(BoardType.free)); } }
[ "sehee@sehee-MacBook-Pro.local" ]
sehee@sehee-MacBook-Pro.local
a693f7af84802fcd222e1b3a6757b69fc816d2af
d683a713901fadc651ae64ba8dad94838cda6a38
/springcloud-sso-oauth/src/main/java/com/jy/sso/config/SwaggerConfig.java
c0eea481c5d3b1edfd3be8c1ea277f1927c60498
[ "Apache-2.0" ]
permissive
jinchunzhao/sso-oauth
154b7dc25ac7dbde3e3fc4db02ef4917fca62ab5
4b5636304a37306eba5299c9ef463732b73fc66c
refs/heads/master
2023-07-09T08:10:06.235173
2021-08-11T07:21:17
2021-08-11T07:21:17
393,842,113
0
0
null
null
null
null
UTF-8
Java
false
false
1,388
java
package com.jy.sso.config; import io.swagger.annotations.Api; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; /** * 注解开启 swagger2 功能 * * @author jinchunzhao * @version 1.0 * @date 2021-07-31 10:41 */ @Configuration @EnableSwagger2 @ConditionalOnProperty(prefix = "mconfig", name = "swagger-ui-open", havingValue = "true") public class SwaggerConfig { @Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) .paths(PathSelectors.any()) .build(); } public ApiInfo apiInfo() { return new ApiInfoBuilder() .title("sso开放接口") .description("Rest API接口") .termsOfServiceUrl("https://blog.csdn.net/jinchunzhao123") .version("1.0") .build(); } }
[ "459147801@qq.com" ]
459147801@qq.com
800009ccc683f519778db60af19ec7207031f129
bf8fbbf61ce4770459145572191ad93a29701c8a
/era_bcb_sample/2/default/65922.java
0c0814db5eec788d26437232f96e432ed825d046
[]
no_license
gulaftab/DeckardDockerised
1dacb87f0684c08eab999678e55a8e07d7873329
fbf478a7a4d7da15261f9e2de8adfc80c3be9027
refs/heads/main
2023-03-11T21:17:45.280084
2021-02-26T09:23:27
2021-02-26T09:23:27
342,312,684
0
0
null
null
null
null
UTF-8
Java
false
false
5,757
java
import java.io.File; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Method; import java.net.JarURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; import java.net.URLDecoder; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.Stack; import java.util.StringTokenizer; import java.util.jar.Manifest; import java.util.logging.Level; import java.util.logging.Logger; /** * A program starter that reads a classpath and runnable type from manifest-file. The * comma-separated classpath is expanded (each entry that is a directory is scanned * for jar-files) and the runnable invoked with the resulting classpath. * * An applicable manifest file should roughly look like this example: META-INF/MANIFEST.MF * * <pre> * Main-Class: Run * Run-Classpath: ./lib * Run-Runnable: some.package.and.Runnable </pre> * * The manifest entry Main-Class makes sure that Run can be started via * <pre> * java -jar thejar.jar * </pre> */ public class Run { public static final String MANIFEST = "META-INF/MANIFEST.MF", CLASSPATH = "Run-Classpath", MAIN_CLASS = "Run-Class"; private static Logger logger = Logger.getLogger(Run.class.getName()); /** * Startup runnable with dynamically constructed classpath */ public static void main(String[] args) { try { cd(Run.class); Manifest mf = getManifest(); URL[] classpath = getClasspath(mf); ClassLoader cl = new URLClassLoader(classpath); Thread.currentThread().setContextClassLoader(cl); Class clazz = cl.loadClass(getClass(mf)); Method method = clazz.getMethod("main", new Class[] { String[].class }); method.invoke(null, new Object[] { args }); } catch (Throwable t) { t.printStackTrace(System.err); } } /** * Try to change into the directory of jar file that contains given class. * @param clazz class to get containing jar file for * @return success or not */ private static boolean cd(Class clazz) { try { JarURLConnection jarCon = (JarURLConnection) getClassURL(clazz).openConnection(); URL jarUrl = jarCon.getJarFileURL(); File jarFile = new File(URLDecoder.decode(jarUrl.getPath(), "UTF-8")); File jarDir = jarFile.getParentFile(); System.setProperty("user.dir", jarDir.getAbsolutePath()); logger.log(Level.FINE, "cd'd into " + jarDir + " with jar containing " + clazz); return true; } catch (Exception ex) { logger.log(Level.WARNING, "Couldn't cd into directory with jar containing " + clazz, ex); return false; } } /** * Get URL of the given class. * * @param clazz class to get URL for * @return the URL this class was loaded from */ private static URL getClassURL(Class clazz) { String resourceName = "/" + clazz.getName().replace('.', '/') + ".class"; return clazz.getResource(resourceName); } /** * Get main class from manifest file information */ private static String getClass(Manifest mf) { String clazz = mf.getMainAttributes().getValue(MAIN_CLASS); if (clazz == null || clazz.length() == 0) { throw new Error("No " + MAIN_CLASS + " defined in " + MANIFEST); } return clazz; } /** * Assemble classpath from manifest file information (optional) */ private static URL[] getClasspath(Manifest mf) throws MalformedURLException { String classpath = mf.getMainAttributes().getValue(CLASSPATH); if (classpath == null) classpath = ""; StringTokenizer tokens = new StringTokenizer(classpath, ",", false); List result = new ArrayList(); while (tokens.hasMoreTokens()) { String token = tokens.nextToken().trim(); File file = new File(token).getAbsoluteFile(); if (!file.exists()) { logger.log(Level.WARNING, CLASSPATH + " contains " + token + " but file/directory " + file.getAbsolutePath() + " doesn't exist"); continue; } buildClasspath(file, result); } return (URL[]) result.toArray(new URL[result.size()]); } private static void buildClasspath(File file, List result) throws MalformedURLException { if (!file.isDirectory() && file.getName().endsWith(".jar")) { result.add(file.toURL()); return; } File[] files = file.listFiles(); if (files != null) for (int i = 0; i < files.length; i++) buildClasspath(files[i], result); } /** * Get our manifest file. Normally all (parent) classloaders of a class do provide * resources and the enumeration returned on lookup of manifest.mf will start * with the topmost classloader's resources. * We're inverting that order to make sure we're consulting the manifest file in * the same jar as this class if available. */ private static Manifest getManifest() throws IOException { Stack manifests = new Stack(); for (Enumeration e = Run.class.getClassLoader().getResources(MANIFEST); e.hasMoreElements(); ) manifests.add(e.nextElement()); while (!manifests.isEmpty()) { URL url = (URL) manifests.pop(); InputStream in = url.openStream(); Manifest mf = new Manifest(in); in.close(); if (mf.getMainAttributes().getValue(MAIN_CLASS) != null) return mf; } throw new Error("No " + MANIFEST + " with " + MAIN_CLASS + " found"); } }
[ "gulaftab@gmail.com" ]
gulaftab@gmail.com
87bfed6a038e0072ba743b815e0ca7e2aaa94345
a816470bbfa76e0151b1931b64c4fcbb03e855c0
/xchange-gemini/src/test/java/org/knowm/xchange/gemini/v1/dto/marketdata/GeminiMarketDataJSONTest.java
c496083b35d152bfb568a57df784f9bc21003f82
[ "MIT" ]
permissive
ChangeOrientedProgrammingEnvironment/XChange
30981e03ded3b8595dbd46e13e534fe446435110
d036adb8503c24556ca8655acb6f5758dd06c15a
refs/heads/develop
2021-01-10T23:13:03.382144
2016-10-11T21:00:44
2016-10-11T21:00:44
70,632,046
0
0
null
2016-10-11T20:22:18
2016-10-11T20:22:17
null
UTF-8
Java
false
false
2,010
java
package org.knowm.xchange.gemini.v1.dto.marketdata; import static org.fest.assertions.api.Assertions.assertThat; import static org.junit.Assert.assertEquals; import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; import org.junit.Test; import com.fasterxml.jackson.databind.ObjectMapper; import org.knowm.xchange.currency.CurrencyPair; import org.knowm.xchange.dto.Order.OrderType; import org.knowm.xchange.gemini.v1.GeminiAdapters; import org.knowm.xchange.gemini.v1.dto.marketdata.GeminiDepth; import org.knowm.xchange.gemini.v1.dto.marketdata.GeminiLendDepth; public class GeminiMarketDataJSONTest { @Test public void testLendbookMarketData() throws IOException { InputStream resourceAsStream = GeminiMarketDataJSONTest.class.getResourceAsStream("/v1/marketdata/example-marketdepth-lendbook-data.json"); GeminiLendDepth lendDepth = new ObjectMapper().readValue(resourceAsStream, GeminiLendDepth.class); assertEquals(lendDepth.getAsks().length, 50); assertEquals(lendDepth.getBids().length, 50); } @Test public void testMarketDepth() throws Exception { InputStream resourceAsStream = GeminiMarketDataJSONTest.class.getResourceAsStream("/v1/marketdata/example-marketdepth-data.json"); GeminiDepth depthRaw = new ObjectMapper().readValue(resourceAsStream, GeminiDepth.class); GeminiAdapters.OrdersContainer asksOrdersContainer = GeminiAdapters.adaptOrders(depthRaw.getAsks(), CurrencyPair.BTC_EUR, OrderType.ASK); GeminiAdapters.OrdersContainer bidsOrdersContainer = GeminiAdapters.adaptOrders(depthRaw.getBids(), CurrencyPair.BTC_EUR, OrderType.BID); assertEquals(new BigDecimal("851.87"), asksOrdersContainer.getLimitOrders().get(0).getLimitPrice()); assertEquals(new BigDecimal("849.59"), bidsOrdersContainer.getLimitOrders().get(0).getLimitPrice()); assertThat(asksOrdersContainer.getTimestamp()).isEqualTo(1387060950000L); assertThat(bidsOrdersContainer.getTimestamp()).isEqualTo(1387060435000L); } }
[ "jonathan.heusser@gmail.com" ]
jonathan.heusser@gmail.com
f1d3932c1941a5dd4a236c05835908684db71bf6
25729cf0666fb83f0c9b7553cd647b6c33968886
/src/main/java/com/opendata/rs/action/RsTypeAction.java
c225f247efaf3782e48102877f904e356a3f5143
[]
no_license
545473750/zswxglxt
1b55f94d8c0c8c0de47a0180406cdcdacc2ff756
2a7b7aeba7981bd723f99db400c99d0decb6de43
refs/heads/master
2020-04-23T15:42:36.490753
2014-08-11T00:08:39
2014-08-11T00:08:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,928
java
/* * Powered By [rapid-framework] * Web Site: http://www.rapid-framework.org.cn * Google Code: http://code.google.com/p/rapid-framework/ * Since 2008 - 2011 */ package com.opendata.rs.action; import java.io.PrintWriter; import java.util.HashSet; import java.util.List; import java.util.Set; import org.apache.struts2.convention.annotation.Namespace; import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.convention.annotation.Results; import cn.org.rapid_framework.web.scope.Flash; import com.opensymphony.xwork2.Preparable; import com.opensymphony.xwork2.ModelDriven; import java.util.*; import com.opendata.common.base.*; import cn.org.rapid_framework.web.util.*; import cn.org.rapid_framework.page.*; import com.opendata.common.util.HTMLUtil; import com.opendata.common.util.Util; import com.opendata.rs.model.*; import com.opendata.rs.service.*; import com.opendata.rs.vo.query.*; /** * 资源类型action,用于对资源类型模块的请求转发处理 * * @author 王海龙 */ @Namespace("/rs") @Results({ @Result(name="QUERY_JSP", location="/WEB-INF/pages/rs/RsType/query.jsp", type="dispatcher"), @Result(name="LIST_JSP", location="/WEB-INF/pages/rs/RsType/list.jsp", type="dispatcher"), @Result(name="CREATE_JSP", location="/WEB-INF/pages/rs/RsType/create.jsp", type="dispatcher"), @Result(name="EDIT_JSP", location="/WEB-INF/pages/rs/RsType/edit.jsp", type="dispatcher"), @Result(name="SHOW_JSP", location="/WEB-INF/pages/rs/RsType/show.jsp", type="dispatcher"), @Result(name="LIST_ACTION", location="../rs/RsType!list.do", type="redirectAction"), @Result(name="PROPERTY_HTML", location="/WEB-INF/pages/rs/RsType/propertyHTML.jsp", type="dispatcher"), @Result(name="TYPEPROPER_LIST_JSP", location="/WEB-INF/pages/rs/RsType/typeProperList.jsp", type="dispatcher") }) public class RsTypeAction extends BaseStruts2Action implements Preparable, ModelDriven { //默认多列排序,example: username desc,createTime asc protected static final String DEFAULT_SORT_COLUMNS = null; protected static final String PROPERTY_HTML = "PROPERTY_HTML"; protected static final String TYPEPROPER_LIST_JSP = "TYPEPROPER_LIST_JSP"; private RsTypeManager rsTypeManager; private RsPropertyManager rsPropertyManager; private RsType rsType; java.lang.String id = null; private String[] items; private String html; public void prepare() throws Exception { if (isNullOrEmptyString(id)) { rsType = new RsType(); } else { rsType = (RsType)rsTypeManager.getById(id); } } /** * 执行搜索 * @return */ public String list() { RsTypeQuery query = newQuery(RsTypeQuery.class,DEFAULT_SORT_COLUMNS); String name = query.getTypeName(); if (name != null && !name.equals("")) { query.setTypeName("%" + name.trim() + "%"); } Page page = rsTypeManager.findPage(query); savePage(page,query); query.setTypeName(name); return LIST_JSP; } /** * 关联属性列表 * @return */ public String typeProperList(){ List<RsProperty> properList=rsPropertyManager.findAll(); getRequest().setAttribute("properList", properList); return TYPEPROPER_LIST_JSP; } /** * 保存关联关系 * @return */ public void saveTypeProper(){ String[] propertyIds=getRequest().getParameterValues("propertyids"); if (propertyIds != null) { Set<RsProperty> rsPropertys = new HashSet<RsProperty>(0); for (int i = 0; i < propertyIds.length; i++) { String str = propertyIds[i].trim(); rsPropertys.add(rsPropertyManager.getById(str)); } rsType.setRsPropertys(rsPropertys); rsTypeManager.save(rsType); } } /** * 查看对象 * @return */ public String show() { return SHOW_JSP; } /** * 进入新增页面 * @return */ public String create() { return CREATE_JSP; } /** * 保存新增对象 * @return */ public String save() { rsType.setTs(Util.getTimeStampString()); rsTypeManager.save(rsType); Flash.current().success(CREATED_SUCCESS); //存放在Flash中的数据,在下一次http请求中仍然可以读取数据,error()用于显示错误消息 return LIST_ACTION; } /** * 进入更新页面 * @return */ public String edit() { return EDIT_JSP; } /** * 保存更新对象 * @return */ public String update() { rsType.setTs(Util.getTimeStampString()); rsTypeManager.update(this.rsType); Flash.current().success(UPDATE_SUCCESS); return LIST_ACTION; } /** * 删除对象 * @return */ public String delete() { for(int i = 0; i < items.length; i++) { Hashtable params = HttpUtils.parseQueryString(items[i]); java.lang.String id = new java.lang.String((String)params.get("id")); rsType = (RsType)rsTypeManager.getById(id); if(rsType!=null){ rsType.setRsPropertys(null);//清空关联关系 rsTypeManager.removeById(rsType.getId()); } } Flash.current().success(DELETE_SUCCESS); return LIST_ACTION; } /** * 根据当前类型ID获取对应HTML * @return */ public void getPropertyHTML()throws Exception{ RsType rsType = rsTypeManager.getById(id); if(rsType != null){ html = HTMLUtil.generateHTML(rsType.getRsPropertys()); } PrintWriter pw = getResponse().getWriter(); pw.write(html); pw.close(); } /** 增加setXXXX()方法,spring就可以通过autowire自动设置对象属性,注意大小写 */ public void setRsTypeManager(RsTypeManager manager) { this.rsTypeManager = manager; } /** 增加setXXXX()方法,spring就可以通过autowire自动设置对象属性,注意大小写 */ public void setRsPropertyManager(RsPropertyManager manager) { this.rsPropertyManager = manager; } public Object getModel() { return rsType; } public void setId(java.lang.String val) { this.id = val; } public void setItems(String[] items) { this.items = items; } public String getHtml() { return html; } public void setHtml(String html) { this.html = html; } }
[ "545473750@qq.com" ]
545473750@qq.com
5d8cfe0568e8f258dd93f9a7c65959b033ac060e
7889c6d8f2e4314b777fe9ff2af02e742fd3f35a
/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/lifecycle/LifecycleListener.java
d42c52855896c129b34f8392db6c7da429d64b92
[ "LicenseRef-scancode-generic-cla", "LGPL-2.1-or-later", "MPL-1.1", "JSON", "LGPL-2.1-only", "MPL-1.0", "Apache-2.0", "LicenseRef-scancode-unknown", "X11", "W3C", "GPL-1.0-or-later", "CPL-1.0", "LicenseRef-scancode-oracle-openjdk-exception-2.0", "W3C-19980720", "LicenseRef-scancode-indiana-extreme", "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference", "EPL-1.0", "AFL-2.1", "LGPL-2.0-or-later", "LicenseRef-scancode-warranty-disclaimer", "Apache-1.1", "GPL-2.0-only", "Plexus", "xpp", "CDDL-1.0", "MIT", "BSD-2-Clause" ]
permissive
apache/geronimo
62a342bd56d55fbcc614a62df85ec55b4f8c19c6
9a930877a047348d82ba5b3b544ffa55af5b150f
refs/heads/trunk
2023-08-22T08:17:26.852926
2013-03-21T00:35:41
2013-03-21T00:35:41
240,468
27
34
Apache-2.0
2023-07-25T17:23:50
2009-07-01T08:09:43
Java
UTF-8
Java
false
false
1,401
java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.geronimo.kernel.lifecycle; import org.apache.geronimo.gbean.AbstractName; import java.util.EventListener; /** * @version $Rev$ $Date$ */ public interface LifecycleListener extends EventListener { public void loaded(AbstractName abstractName); public void starting(AbstractName abstractName); public void running(AbstractName abstractName); public void stopping(AbstractName abstractName); public void stopped(AbstractName abstractName); public void failed(AbstractName abstractName); public void unloaded(AbstractName abstractName); }
[ "djencks@apache.org" ]
djencks@apache.org
ca7837917b158ab45ecb1546a9940ab78cb4e1da
9702a51962cda6e1922d671dbec8acf21d9e84ec
/src/main/com/topcoder/apps/screening/ScreeningJob.java
f06cf5105ecc9b57de93df57be73febe2b48a8cc
[]
no_license
topcoder-platform/tc-website
ccf111d95a4d7e033d3cf2f6dcf19364babb8a08
15ab92adf0e60afb1777b3d548b5ba3c3f6c12f7
refs/heads/dev
2023-08-23T13:41:21.308584
2023-04-04T01:28:38
2023-04-04T01:28:38
83,655,110
3
19
null
2023-04-04T01:32:16
2017-03-02T08:43:01
Java
UTF-8
Java
false
false
23,796
java
/* * Copyright (c) 2006 TopCoder, Inc. All rights reserved. */ package com.topcoder.apps.screening; import com.topcoder.util.config.ConfigManager; import com.topcoder.util.idgenerator.IDGenerationException; import com.topcoder.util.idgenerator.IDGenerator; import com.topcoder.util.idgenerator.IDGeneratorFactory; import com.topcoder.shared.util.logging.Logger; import java.util.Timer; import java.util.TimerTask; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.Date; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; /** * <strong>Purpose</strong>: * This is the command line utility that runs the screening. It is a TimerTask which is run once every second. * The command line could accept a single argument which is the number of threads to spawn. * * Version 1.0.1 Change notes: * <ol> * <li> * Added "maxScreeningAttempts" property to CM. * </li> * <li> * fetchRequest, pullRequests, placeRequest were modified to add the new screening attempts treatment. * </li> * <li> * rollbackRequest added to prepare the request to be reprocessed. * </li> * <li> * run() was changed to test Screening for success or failure and completeRequest or rollbackRequest as needed. * </li> * </ol> * * @author WishingBone, pulky * @version 1.0.2 */ public class ScreeningJob extends TimerTask { /** * The namespace for the configuration. */ private static final String NAMESPACE = "com.topcoder.apps.screening.ScreeningJob"; /** * The name of the property in the configuration file that contains the number of threads. */ private static final String THREAD_NUMBER_PROPERTY_NAME = "thread_number"; /** * The name of the property in the configuration file that contains the run interval. */ private static final String RUN_INTERVAL_PROPERTY_NAME = "run_interval"; /** * The name of the property in the configuration file that contains the screener id. */ private static final String SCREENER_ID_PROPERTY_NAME = "screener_id"; /** * The name of the property in the configuration file that contains the maximum screening attempts. * * @since 1.0.1 */ private static final String MAX_SCREENING_ATTEMPTS_PROPERTY_NAME = "max_screening_attempts"; /** * The maximum number of screening attempts permitted. * * @since 1.0.1 */ private static final int MAX_SCREENING_ATTEMPTS_PERMITTED = 99; /** * The default number of screening attempts. * * @since 1.0.1 */ private static final int DEFAULT_SCREENING_ATTEMPTS = 3; /** * One ScreeningTool is used among threads since the screen() method is stateless. */ private ScreeningTool tool = null; /** * The number of screening threads. */ private int num = 1; /** * The screener id. */ private int screener = 1; /** * The threads used to screening. They are ScreeningThread instances. */ private Thread[] threads = null; /** * Whether the job is running. */ private boolean isRunning = false; /** * A map of last screening timestamps mapped from submitter ids to implement the round robin dispatch. */ private Map history = new HashMap(); /** * The log to use. */ private Logger log = null; /** * The max screening attempts for a screening task. * * @since 1.0.1 */ private int maxScreeningAttempts; /** * Creates a ScreeningJob. It initializes all the fields and could propagate exception to command line. * * @param num the number of threads to use. * @param screener the screener number to use. * @param maxScreeningAttempts the number of screening attempts to use. * * @throws Exception to command line. */ private ScreeningJob(int num, int screener, int maxScreeningAttempts) throws Exception { this.tool = new ScreeningTool(); this.num = num; this.screener = screener; this.maxScreeningAttempts = maxScreeningAttempts; this.threads = new Thread[num]; log = Logger.getLogger(ScreeningJob.class); cleanOldResults(); resetPendingTasks(); } /** * The task body. */ public void run() { // This prevents running with the last invocation. if (isRunning) { return; } isRunning = true; try { log.info("Running at " + new Date() + "."); // If all the threads are running, just quite this iteration. if (getCurrentLoad() == this.num) { log.info("All jobs are loaded."); return; } // Pull all the pending request from database queue. List requests = pullRequests(); log.info("Pulled " + requests.size() + " tasks."); // Tries to dispatch tasks for the threads. for (int i = 0; i < this.num; ++i) { if (this.threads[i] == null || !this.threads[i].isAlive()) { // Pick a request. IScreeningRequest request = fetchRequest(requests); if (request == null) { return; } // Spawn a new thread to run it. this.threads[i] = new ScreeningThread(request, i + 1); this.threads[i].start(); } } } finally { isRunning = false; } } /** * Get current load. * * @return current load. */ private int getCurrentLoad() { int load = 0; for (int i = 0; i < this.num; ++i) { if (this.threads[i] != null && this.threads[i].isAlive()) { ++load; } } return load; } /** * Reset all screenings not finished by this screener. */ private void cleanOldResults() { Connection conn = null; PreparedStatement stmt = null; try { conn = DbHelper.getConnection(); stmt = conn.prepareStatement( "DELETE FROM screening_result " + "WHERE (DATE(current) - DATE(create_date)) > 180"); int cnt = stmt.executeUpdate(); log.info(cnt + " old results cleaned."); } catch (SQLException sqle) { log.error("Could not clean old results: " + sqle.toString()); } finally { DbHelper.dispose(conn, stmt, null); } } /** * Reset all screenings not finished by this screener. */ private void resetPendingTasks() { Connection conn = null; PreparedStatement stmt = null; try { conn = DbHelper.getConnection(); stmt = conn.prepareStatement( "DELETE FROM screening_result " + "WHERE screening_task_id IN " + "(SELECT screening_task_id FROM screening_task " + " WHERE screened_ind = 0 and screener_id = ?)"); stmt.setLong(1, screener); stmt.executeUpdate(); stmt = null; stmt = conn.prepareStatement( "UPDATE screening_task " + "SET screener_id = NULL " + "WHERE screened_ind = 0 and screener_id = ?"); stmt.setLong(1, screener); stmt.executeUpdate(); } catch (SQLException sqle) { log.error(sqle.toString()); } finally { DbHelper.dispose(conn, stmt, null); } } /** * Pull all the screening requests from database queue. * Only pulls the request that have been processed less than "maxScreeningAttempts" times * * @return a list of ScreeningRequest instances. */ private List pullRequests() { List requests = new ArrayList(); Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; try { conn = DbHelper.getConnection(); stmt = conn.prepareStatement( "SELECT st.screening_task_id, su.submitter_id, st.submission_v_id, st.submission_path, st.screening_project_type_id " + "FROM submission su, screening_task st " + "WHERE su.submission_v_id = st.submission_v_id AND st.screener_id IS NULL " + "AND st.screened_ind = 0 AND st.screening_attempts < ?"); stmt.setLong(1, maxScreeningAttempts); rs = stmt.executeQuery(); while (rs.next()) { long taskId = rs.getLong(1); long submitterId = rs.getLong(2); long submissionVId = rs.getLong(3); String submissionPath = rs.getString(4); ProjectType projectType = ProjectType.getProjectType(rs.getLong(5)); requests.add(new SubmissionScreeningRequest(taskId, submitterId, submissionVId, submissionPath, projectType)); } rs.close(); stmt.close(); stmt = conn.prepareStatement( "SELECT st.screening_task_id, sp.specification_uploader_id, sp.specification_id, st.submission_path, st.screening_project_type_id " + "FROM specification sp, screening_task st " + "WHERE sp.specification_id = st.specification_id AND st.screener_id IS NULL " + "AND st.screened_ind = 0 AND st.screening_attempts < ?"); stmt.setLong(1, maxScreeningAttempts); rs = stmt.executeQuery(); while (rs.next()) { long taskId = rs.getLong(1); long submitterId = rs.getLong(2); long specificationId = rs.getLong(3); String specificationPath = rs.getString(4); ProjectType projectType = ProjectType.getProjectType(rs.getLong(5)); requests.add(new SpecificationScreeningRequest(taskId, submitterId, specificationId, specificationPath, projectType)); } rs.close(); stmt.close(); } catch (SQLException sqle) { log.error(sqle.toString()); } finally { DbHelper.dispose(conn, stmt, rs); } return requests; } /** * Fetch a request from the list of requests. * Also updates the screening_atempts counter. * * @param requests a list of requests to select from. * * @return the request for screening or null if non is selected. */ private IScreeningRequest fetchRequest(List requests) { while (requests.size() > 0) { IScreeningRequest request = pickRequest(requests); put(request); Connection conn = null; PreparedStatement stmt = null; try { conn = DbHelper.getConnection(); stmt = conn.prepareStatement("UPDATE screening_task SET screener_id = ?, " + "screening_attempts = screening_attempts + 1 WHERE screening_task_id = ? AND screener_id IS NULL"); stmt.setLong(1, this.screener); stmt.setLong(2, request.getTaskId()); // This ensures that multiple instances will not extract the same request. if (stmt.executeUpdate() == 1) { return request; } } catch (SQLException sqle) { log.error(sqle.toString()); } finally { DbHelper.dispose(conn, stmt, null); } } return null; } /** * Remove a request from task table. * * @param taskId the task id. */ private void completeRequest(long taskId) { Connection conn = null; PreparedStatement stmt = null; try { conn = DbHelper.getConnection(); stmt = conn.prepareStatement("UPDATE screening_task SET screened_ind = 1 WHERE screening_task_id = ?"); stmt.setLong(1, taskId); stmt.executeUpdate(); } catch (SQLException sqle) { log.error(sqle.toString()); } finally { DbHelper.dispose(conn, stmt, null); } } /** * Rolls back a request so it can be reprocessed. * * @param taskId the task id. * * @since 1.0.1 */ private void rollbackRequest(long taskId) { Connection conn = null; PreparedStatement stmt = null; try { conn = DbHelper.getConnection(); stmt = conn.prepareStatement( "DELETE FROM screening_result " + "WHERE screening_task_id = ?"); stmt.setLong(1, taskId); try { stmt.executeUpdate(); } catch (SQLException sqle) { log.error("Could not rollback screening_results: " + sqle.toString()); } stmt = null; stmt = conn.prepareStatement( "UPDATE screening_task " + "SET screener_id = NULL " + "WHERE screener_id = ?"); stmt.setLong(1, screener); stmt.executeUpdate(); } catch (SQLException sqle) { log.error(sqle.toString()); } finally { DbHelper.dispose(conn, stmt, null); } } /** * Pick a request from a list of requests. * * @param requests a list of requests to select from. * * @return the request chosen. */ private IScreeningRequest pickRequest(List requests) { if (requests.size() == 0) { return null; } IScreeningRequest chosen = null; for (int i = 0; i < requests.size(); ++i) { IScreeningRequest request = (IScreeningRequest) requests.get(i); long time = get(request); if (time == -1) { chosen = request; break; } if (chosen == null || time < get(chosen)) { chosen = request; } } requests.remove(chosen); return chosen; } /** * Get the last millisecond timestamp the submitter is screened. * * @param request the request for the submitter. * * @return a millisecond timestamp, or -1 if no record exists. */ private long get(IScreeningRequest request) { Long value = (Long) this.history.get(new Long(request.getSubmitterId())); if (value == null) { return -1; } return value.longValue(); } /** * Place a record for the submitter with the current time. * * @param request the request for the submitter. */ private void put(IScreeningRequest request) { this.history.put(new Long(request.getSubmitterId()), new Long(System.currentTimeMillis())); } /** * Get the version id for the current submission. * * @param submissionId the submission id. * * @return the submission version id. * */ public static long getVersionId(long submissionId) { Connection conn = null; try { conn = DbHelper.getConnection(); return getVersionId(submissionId, conn); } finally { DbHelper.dispose(conn, null, null); } } /** * Get the version id for the current submission, using a specified connection. * * @param submissionId the submission id. * @param conn the connection to use. * * @return the submission version id. */ public static long getVersionId(long submissionId, Connection conn) { PreparedStatement stmt = null; ResultSet rs = null; try { stmt = conn.prepareStatement("SELECT submission_v_id FROM submission WHERE submission_id = ? " + "AND cur_version = 1"); stmt.setLong(1, submissionId); rs = stmt.executeQuery(); rs.next(); return rs.getLong(1); } catch (SQLException sqle) { throw new DatabaseException("getVersionId() fails.", sqle); } finally { DbHelper.dispose(null, stmt, rs); } } /** * Place a request in the database queue. * * @param request the request to place. */ public static void placeRequest(IScreeningRequest request) { Connection conn = null; try { conn = DbHelper.getConnection(); if (request instanceof SubmissionScreeningRequest) { placeRequest((SubmissionScreeningRequest) request, conn); } else if (request instanceof SpecificationScreeningRequest) { placeRequest((SpecificationScreeningRequest) request, conn); } } finally { DbHelper.dispose(conn, null, null); } } /** * Place a request in the database queue, using a specific connection. Initializes screening_attempts with 0. * * @param request the request to place. * @param conn the connection to use. */ public static void placeRequest(IScreeningRequest request, Connection conn) { PreparedStatement stmt = null; try { if (request instanceof SubmissionScreeningRequest) { stmt = conn.prepareStatement("INSERT INTO screening_task(screening_task_id, submission_path, " + "screening_project_type_id, screening_attempts, submission_v_id, screened_ind) VALUES(?, ?, ?, ?, ?, ?)"); } else if (request instanceof SpecificationScreeningRequest){ stmt = conn.prepareStatement("INSERT INTO screening_task(screening_task_id, submission_path, " + "screening_project_type_id, screening_attempts, specification_id, screened_ind) VALUES(?, ?, ?, ?, ?, ?)"); } if (request.getTaskId() == -1) { request.setTaskId(generateNewTaskID()); } stmt.setLong(1, request.getTaskId()); stmt.setString(2, request.getArtifactPath()); stmt.setLong(3, request.getProjectType().getId()); stmt.setLong(4, 0); stmt.setLong(5, request.getArtifactId()); stmt.setLong(6, 0); stmt.executeUpdate(); } catch (SQLException sqle) { throw new DatabaseException("placeRequest() fails.", sqle); } catch (IDGenerationException e) { throw new DatabaseException("Unable to generate ID.", e); } finally { DbHelper.dispose(null, stmt, null); } } /** * Generates tasks Ids * * @return the next Id */ private static long generateNewTaskID() throws IDGenerationException { IDGenerator gen = IDGeneratorFactory.getIDGenerator("SCREENING_TASK_SEQ"); return gen.getNextID(); } /** * Worker thread to perform the screening. */ class ScreeningThread extends Thread { /** * The request to screen. */ private IScreeningRequest request = null; /** * The thread id. */ private int id = 0; /** * Create instance with the request to screen. * * @param request the request to screen. */ ScreeningThread(IScreeningRequest request, int id) { this.request = request; this.id = id; } /** * Thread body. Simply perform the screen. */ public void run() { StringBuffer buffer = new StringBuffer(); buffer.append("screening submitter "); buffer.append(request.getSubmitterId()); buffer.append(" submission "); buffer.append(request.getArtifactId()); buffer.append(" of type "); buffer.append(request.getProjectType().getName()); buffer.append(" from "); buffer.append(request.getArtifactPath()); buffer.append(" at "); log.info("Thread " + id + ": start " + buffer.toString() + new Date()); log.info("Current load " + getCurrentLoad() + "/" + num); // runs screening, if succeded, completes the request, otherwise, rolbacks it to be reprocessed. boolean successfullScreen = tool.screen(request, log); if (successfullScreen) { log.info("tool.screen completed successfully."); completeRequest(request.getTaskId()); } else { log.info("tool.screen unsuccessfully."); rollbackRequest(request.getTaskId()); } log.info("Thread " + id + ": end " + buffer.toString() + new Date()); log.info("Current load " + (getCurrentLoad() - 1) + "/" + num); } } /** * Command line entry. Contains a single argument - the number of threads to use. Could be absent which means * to run single thread. * * @param args the arguments. * * @throws Exception to command line. */ public static void main(String[] args) throws Exception { ConfigManager cm = ConfigManager.getInstance(); boolean namespaceExists = cm.existsNamespace(NAMESPACE); int num = 1; if (args.length > 0) { num = Integer.parseInt(args[0]); } else if (namespaceExists) { String value = cm.getString(NAMESPACE, THREAD_NUMBER_PROPERTY_NAME); if (value != null && value.trim().length() > 0) { num = Integer.parseInt(value); } } int interval = 30; if (args.length > 1) { interval = Integer.parseInt(args[1]); } else if (namespaceExists) { String value = cm.getString(NAMESPACE, RUN_INTERVAL_PROPERTY_NAME); if (value != null && value.trim().length() > 0) { interval = Integer.parseInt(value); } } int screener = 1; if (args.length > 2) { screener = Integer.parseInt(args[2]); } else if (namespaceExists) { String value = cm.getString(NAMESPACE, SCREENER_ID_PROPERTY_NAME); if (value != null && value.trim().length() > 0) { screener = Integer.parseInt(value); } } int maxScreeningAttempts = DEFAULT_SCREENING_ATTEMPTS; if (namespaceExists) { String value = cm.getString(NAMESPACE, MAX_SCREENING_ATTEMPTS_PROPERTY_NAME); if (value != null && value.trim().length() > 0) { maxScreeningAttempts = Integer.parseInt(value); if (maxScreeningAttempts > MAX_SCREENING_ATTEMPTS_PERMITTED) { System.out.println("Screening attempts = " + maxScreeningAttempts + " exceeds maximum permitted (" + MAX_SCREENING_ATTEMPTS_PERMITTED + "), the maximum value will be used."); maxScreeningAttempts = MAX_SCREENING_ATTEMPTS_PERMITTED; } } } System.out.println("Number of threads = " + num); System.out.println("Interval = " + interval); System.out.println("Screener ID = " + screener); System.out.println("Max screening attempts = " + maxScreeningAttempts); // Schedule it immediate and run per second. new Timer(false).schedule(new ScreeningJob(num, screener, maxScreeningAttempts), 0, interval * 1000); } }
[ "amorehead@cb5b18d2-80dd-4a81-9b1c-945e1ee644f9" ]
amorehead@cb5b18d2-80dd-4a81-9b1c-945e1ee644f9
5040c98dcfd8f3220e11a74dc4460830f02cb748
2efdee34f03ed372141d065fbbb70690b1a979d1
/netbeans/Antiguo_Proyecto_Java/AnalizadorLexico.java~
ade64dbee60c02c8e82d948945ff86d1a22844af
[]
no_license
christianqw/tesisGit
9c123bccefbdb91269288a2757cb1ef2828931a5
1eb2b018e993408b838f047b1be40d58d4627ebb
refs/heads/master
2021-01-21T04:43:08.520070
2016-03-24T15:52:17
2016-03-24T15:52:17
42,554,725
0
0
null
null
null
null
UTF-8
Java
false
true
20,200
/* The following code was generated by JFlex 1.5.0-SNAPSHOT */ /* --------------------------Codigo de Usuario----------------------- */ package ejemplocup; import java_cup.runtime.*; import java.io.Reader; /** * This class is a scanner generated by * <a href="http://www.jflex.de/">JFlex</a> 1.5.0-SNAPSHOT * from the specification file <tt>alexico.flex</tt> */ class AnalizadorLexico implements java_cup.runtime.Scanner { /** This character denotes the end of file */ public static final int YYEOF = -1; /** initial size of the lookahead buffer */ private static final int ZZ_BUFFERSIZE = 16384; /** lexical states */ public static final int YYINITIAL = 0; /** * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l * at the beginning of a line * l is of the form l = 2*k, k a non negative integer */ private static final int ZZ_LEXSTATE[] = { 0, 0 }; /** * Translates characters to character classes */ private static final String ZZ_CMAP_PACKED = "\11\0\1\3\1\2\1\0\1\3\1\1\22\0\1\3\2\0\1\6"+ "\2\0\1\12\1\0\1\15\1\16\2\0\1\17\20\0\1\13\1\14"+ "\1\0\1\7\32\5\3\0\1\12\2\0\32\4\1\0\1\11\1\0"+ "\1\10\55\0\1\10\uff53\0"; /** * Translates characters to character classes */ private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); /** * Translates DFA states to action switch labels. */ private static final int [] ZZ_ACTION = zzUnpackAction(); private static final String ZZ_ACTION_PACKED_0 = "\1\0\1\1\2\2\1\3\1\4\1\5\1\6\1\7"+ "\1\10\1\11\1\1\1\12\1\13\1\14\1\15\1\4"+ "\1\16"; private static int [] zzUnpackAction() { int [] result = new int[18]; int offset = 0; offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); return result; } private static int zzUnpackAction(String packed, int offset, int [] result) { int i = 0; /* index in packed string */ int j = offset; /* index in unpacked array */ int l = packed.length(); while (i < l) { int count = packed.charAt(i++); int value = packed.charAt(i++); do result[j++] = value; while (--count > 0); } return j; } /** * Translates a state to a row index in the transition table */ private static final int [] ZZ_ROWMAP = zzUnpackRowMap(); private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\20\0\40\0\20\0\60\0\100\0\20\0\20"+ "\0\20\0\20\0\20\0\120\0\20\0\20\0\20\0\140"+ "\0\160\0\20"; private static int [] zzUnpackRowMap() { int [] result = new int[18]; int offset = 0; offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); return result; } private static int zzUnpackRowMap(String packed, int offset, int [] result) { int i = 0; /* index in packed string */ int j = offset; /* index in unpacked array */ int l = packed.length(); while (i < l) { int high = packed.charAt(i++) << 16; result[j++] = high | packed.charAt(i++); } return j; } /** * The transition table of the DFA */ private static final int [] ZZ_TRANS = zzUnpackTrans(); private static final String ZZ_TRANS_PACKED_0 = "\1\2\1\3\2\4\1\5\1\6\1\7\1\10\1\11"+ "\1\12\1\13\1\14\1\2\1\15\1\16\1\17\22\0"+ "\1\4\21\0\1\5\17\0\1\20\1\21\26\0\1\22"+ "\7\0\2\20\17\0\1\21\12\0"; private static int [] zzUnpackTrans() { int [] result = new int[128]; int offset = 0; offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); return result; } private static int zzUnpackTrans(String packed, int offset, int [] result) { int i = 0; /* index in packed string */ int j = offset; /* index in unpacked array */ int l = packed.length(); while (i < l) { int count = packed.charAt(i++); int value = packed.charAt(i++); value--; do result[j++] = value; while (--count > 0); } return j; } /* error codes */ private static final int ZZ_UNKNOWN_ERROR = 0; private static final int ZZ_NO_MATCH = 1; private static final int ZZ_PUSHBACK_2BIG = 2; /* error messages for the codes above */ private static final String ZZ_ERROR_MSG[] = { "Unkown internal scanner error", "Error: could not match input", "Error: pushback value was too large" }; /** * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code> */ private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); private static final String ZZ_ATTRIBUTE_PACKED_0 = "\1\0\1\11\1\1\1\11\2\1\5\11\1\1\3\11"+ "\2\1\1\11"; private static int [] zzUnpackAttribute() { int [] result = new int[18]; int offset = 0; offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); return result; } private static int zzUnpackAttribute(String packed, int offset, int [] result) { int i = 0; /* index in packed string */ int j = offset; /* index in unpacked array */ int l = packed.length(); while (i < l) { int count = packed.charAt(i++); int value = packed.charAt(i++); do result[j++] = value; while (--count > 0); } return j; } /** the input device */ private java.io.Reader zzReader; /** the current state of the DFA */ private int zzState; /** the current lexical state */ private int zzLexicalState = YYINITIAL; /** this buffer contains the current text to be matched and is the source of the yytext() string */ private char zzBuffer[] = new char[ZZ_BUFFERSIZE]; /** the textposition at the last accepting state */ private int zzMarkedPos; /** the current text position in the buffer */ private int zzCurrentPos; /** startRead marks the beginning of the yytext() string in the buffer */ private int zzStartRead; /** endRead marks the last character in the buffer, that has been read from input */ private int zzEndRead; /** number of newlines encountered up to the start of the matched text */ private int yyline; /** the number of characters up to the start of the matched text */ private int yychar; /** * the number of characters from the last newline up to the start of the * matched text */ private int yycolumn; /** * zzAtBOL == true <=> the scanner is currently at the beginning of a line */ private boolean zzAtBOL = true; /** zzAtEOF == true <=> the scanner is at the EOF */ private boolean zzAtEOF; /** denotes if the user-EOF-code has already been executed */ private boolean zzEOFDone; /* user code: */ /* Generamos un java_cup.Symbol para guardar el tipo de token encontrado */ private Symbol symbol(int type) { return new Symbol(type, yyline, yycolumn); } /* Generamos un Symbol para el tipo de token encontrado junto con su valor */ private Symbol symbol(int type, Object value) { return new Symbol(type, yyline, yycolumn, value); } /** * Creates a new scanner * There is also a java.io.InputStream version of this constructor. * * @param in the java.io.Reader to read input from. */ AnalizadorLexico(java.io.Reader in) { this.zzReader = in; } /** * Creates a new scanner. * There is also java.io.Reader version of this constructor. * * @param in the java.io.Inputstream to read input from. */ AnalizadorLexico(java.io.InputStream in) { this(new java.io.InputStreamReader (in, java.nio.charset.Charset.forName("UTF-8"))); } /** * Unpacks the compressed character translation table. * * @param packed the packed character translation table * @return the unpacked character translation table */ private static char [] zzUnpackCMap(String packed) { char [] map = new char[0x10000]; int i = 0; /* index in packed string */ int j = 0; /* index in unpacked array */ while (i < 68) { int count = packed.charAt(i++); char value = packed.charAt(i++); do map[j++] = value; while (--count > 0); } return map; } /** * Refills the input buffer. * * @return <code>false</code>, iff there was new input. * * @exception java.io.IOException if any I/O-Error occurs */ private boolean zzRefill() throws java.io.IOException { /* first: make room (if you can) */ if (zzStartRead > 0) { System.arraycopy(zzBuffer, zzStartRead, zzBuffer, 0, zzEndRead-zzStartRead); /* translate stored positions */ zzEndRead-= zzStartRead; zzCurrentPos-= zzStartRead; zzMarkedPos-= zzStartRead; zzStartRead = 0; } /* is the buffer big enough? */ if (zzCurrentPos >= zzBuffer.length) { /* if not: blow it up */ char newBuffer[] = new char[zzCurrentPos*2]; System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length); zzBuffer = newBuffer; } /* finally: fill the buffer with new input */ int numRead = zzReader.read(zzBuffer, zzEndRead, zzBuffer.length-zzEndRead); if (numRead > 0) { zzEndRead+= numRead; return false; } // unlikely but not impossible: read 0 characters, but not at end of stream if (numRead == 0) { int c = zzReader.read(); if (c == -1) { return true; } else { zzBuffer[zzEndRead++] = (char) c; return false; } } // numRead < 0 return true; } /** * Closes the input stream. */ public final void yyclose() throws java.io.IOException { zzAtEOF = true; /* indicate end of file */ zzEndRead = zzStartRead; /* invalidate buffer */ if (zzReader != null) zzReader.close(); } /** * Resets the scanner to read from a new input stream. * Does not close the old reader. * * All internal variables are reset, the old input stream * <b>cannot</b> be reused (internal buffer is discarded and lost). * Lexical state is set to <tt>ZZ_INITIAL</tt>. * * Internal scan buffer is resized down to its initial length, if it has grown. * * @param reader the new input stream */ public final void yyreset(java.io.Reader reader) { zzReader = reader; zzAtBOL = true; zzAtEOF = false; zzEOFDone = false; zzEndRead = zzStartRead = 0; zzCurrentPos = zzMarkedPos = 0; yyline = yychar = yycolumn = 0; zzLexicalState = YYINITIAL; if (zzBuffer.length > ZZ_BUFFERSIZE) zzBuffer = new char[ZZ_BUFFERSIZE]; } /** * Returns the current lexical state. */ public final int yystate() { return zzLexicalState; } /** * Enters a new lexical state * * @param newState the new lexical state */ public final void yybegin(int newState) { zzLexicalState = newState; } /** * Returns the text matched by the current regular expression. */ public final String yytext() { return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead ); } /** * Returns the character at position <tt>pos</tt> from the * matched text. * * It is equivalent to yytext().charAt(pos), but faster * * @param pos the position of the character to fetch. * A value from 0 to yylength()-1. * * @return the character at position pos */ public final char yycharat(int pos) { return zzBuffer[zzStartRead+pos]; } /** * Returns the length of the matched text region. */ public final int yylength() { return zzMarkedPos-zzStartRead; } /** * Reports an error that occured while scanning. * * In a wellformed scanner (no or only correct usage of * yypushback(int) and a match-all fallback rule) this method * will only be called with things that "Can't Possibly Happen". * If this method is called, something is seriously wrong * (e.g. a JFlex bug producing a faulty scanner etc.). * * Usual syntax/scanner level error handling should be done * in error fallback rules. * * @param errorCode the code of the errormessage to display */ private void zzScanError(int errorCode) { String message; try { message = ZZ_ERROR_MSG[errorCode]; } catch (ArrayIndexOutOfBoundsException e) { message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; } throw new Error(message); } /** * Pushes the specified amount of characters back into the input stream. * * They will be read again by then next call of the scanning method * * @param number the number of characters to be read again. * This number must not be greater than yylength()! */ public void yypushback(int number) { if ( number > yylength() ) zzScanError(ZZ_PUSHBACK_2BIG); zzMarkedPos -= number; } /** * Contains user EOF-code, which will be executed exactly once, * when the end of file is reached */ private void zzDoEOF() throws java.io.IOException { if (!zzEOFDone) { zzEOFDone = true; yyclose(); } } /** * Resumes scanning until the next regular expression is matched, * the end of input is encountered or an I/O-Error occurs. * * @return the next token * @exception java.io.IOException if any I/O-Error occurs */ public java_cup.runtime.Symbol next_token() throws java.io.IOException { int zzInput; int zzAction; // cached fields: int zzCurrentPosL; int zzMarkedPosL; int zzEndReadL = zzEndRead; char [] zzBufferL = zzBuffer; char [] zzCMapL = ZZ_CMAP; int [] zzTransL = ZZ_TRANS; int [] zzRowMapL = ZZ_ROWMAP; int [] zzAttrL = ZZ_ATTRIBUTE; while (true) { zzMarkedPosL = zzMarkedPos; boolean zzR = false; for (zzCurrentPosL = zzStartRead; zzCurrentPosL < zzMarkedPosL; zzCurrentPosL++) { switch (zzBufferL[zzCurrentPosL]) { case '\u000B': case '\u000C': case '\u0085': case '\u2028': case '\u2029': yyline++; yycolumn = 0; zzR = false; break; case '\r': yyline++; yycolumn = 0; zzR = true; break; case '\n': if (zzR) zzR = false; else { yyline++; yycolumn = 0; } break; default: zzR = false; yycolumn++; } } if (zzR) { // peek one character ahead if it is \n (if we have counted one line too much) boolean zzPeek; if (zzMarkedPosL < zzEndReadL) zzPeek = zzBufferL[zzMarkedPosL] == '\n'; else if (zzAtEOF) zzPeek = false; else { boolean eof = zzRefill(); zzEndReadL = zzEndRead; zzMarkedPosL = zzMarkedPos; zzBufferL = zzBuffer; if (eof) zzPeek = false; else zzPeek = zzBufferL[zzMarkedPosL] == '\n'; } if (zzPeek) yyline--; } zzAction = -1; zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; zzState = ZZ_LEXSTATE[zzLexicalState]; // set up zzAction for empty match case: int zzAttributes = zzAttrL[zzState]; if ( (zzAttributes & 1) == 1 ) { zzAction = zzState; } zzForAction: { while (true) { if (zzCurrentPosL < zzEndReadL) zzInput = zzBufferL[zzCurrentPosL++]; else if (zzAtEOF) { zzInput = YYEOF; break zzForAction; } else { // store back cached positions zzCurrentPos = zzCurrentPosL; zzMarkedPos = zzMarkedPosL; boolean eof = zzRefill(); // get translated positions and possibly new buffer zzCurrentPosL = zzCurrentPos; zzMarkedPosL = zzMarkedPos; zzBufferL = zzBuffer; zzEndReadL = zzEndRead; if (eof) { zzInput = YYEOF; break zzForAction; } else { zzInput = zzBufferL[zzCurrentPosL++]; } } int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ]; if (zzNext == -1) break zzForAction; zzState = zzNext; zzAttributes = zzAttrL[zzState]; if ( (zzAttributes & 1) == 1 ) { zzAction = zzState; zzMarkedPosL = zzCurrentPosL; if ( (zzAttributes & 8) == 8 ) break zzForAction; } } } // store back cached position zzMarkedPos = zzMarkedPosL; switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { case 1: { /* Imprime mensaje de eror, modifica la variable de "ERROR" */ System.out.println(" Reconoce error Lexico "); AnalizadorSintactico.var_error.setError(modelado.Error.tipoError.LEXICO, new String("Caracter ilegal <"+yytext()+">")); /* Retorna el caracter error con la ubicacion del mismo fila, columna */ return symbol(sym.ERROR, new String("Caracter ilegal <"+yytext()+">")); } case 15: break; case 2: { /* ignora los espacios */ } case 16: break; case 3: { System.out.print(yytext()); return symbol(sym.IDVAR, new String(yytext())); } case 17: break; case 4: { System.out.print(yytext()); return symbol(sym.IDFUNC, new String(yytext())); } case 18: break; case 5: { System.out.print(" # "); return symbol(sym.EXISTE); } case 19: break; case 6: { System.out.print(" @ "); return symbol(sym.PARATODO); } case 20: break; case 7: { System.out.print(" ¬ "); return symbol(sym.NEGACION); } case 21: break; case 8: { System.out.print(" or "); return symbol(sym.DISYUNCION); } case 22: break; case 9: { System.out.print(" and "); return symbol(sym.CONJUNCION); } case 23: break; case 10: { System.out.print(" ( "); return symbol(sym.PA); } case 24: break; case 11: { System.out.print(" ) "); return symbol(sym.PC); } case 25: break; case 12: { System.out.print(" , "); return symbol(sym.COMA); } case 26: break; case 13: { System.out.print(yytext()); return symbol(sym.IDPRED, new String(yytext())); } case 27: break; case 14: { System.out.print(" -> "); return symbol(sym.IMPLICACION); } case 28: break; default: if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { zzAtEOF = true; zzDoEOF(); { return new java_cup.runtime.Symbol(sym.EOF); } } else { zzScanError(ZZ_NO_MATCH); } } } } }
[ "christianqw@gmail.com" ]
christianqw@gmail.com
f1a8154f29ac8bb56e8d84abd126fa353a0d228f
acab6a2c52cc0759d2a819a8013d0940c772d81b
/common/plugins/eu.esdihumboldt.hale.common.core/src/eu/esdihumboldt/hale/common/core/io/ComplexValueType.java
29b1cd31e708e45b3e0b28e5bacddb4290bee9cc
[]
no_license
nunotoriz/hale
b154196bd64c304b12c501c71b00b0cde23c915f
29436a3aea78e19fd57fa46de3cc2a81a3db3f37
refs/heads/master
2021-01-17T18:03:03.925124
2013-11-29T09:25:43
2013-12-02T16:07:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,511
java
/* * Copyright (c) 2013 Data Harmonisation Panel * * All rights reserved. This program and the accompanying materials are made * available under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 3 of the License, * or (at your option) any later version. * * You should have received a copy of the GNU Lesser General Public License * along with this distribution. If not, see <http://www.gnu.org/licenses/>. * * Contributors: * Data Harmonisation Panel <http://www.dhpanel.eu> */ package eu.esdihumboldt.hale.common.core.io; import org.w3c.dom.Element; /** * Handles storing a complex value to a DOM or loading it from a DOM. * * @param <T> the type of the complex value * @param <C> the type of the context that should be supplied * @author Simon Templer */ public interface ComplexValueType<T, C> { /** * Load the complex value from a document object model. * * @param fragment the complex value fragment root element * @param context the complex value context, may be <code>null</code> if * unavailable * @return the loaded complex value */ public T fromDOM(Element fragment, C context); /** * Store the complex value to a document object model. * * @param value the complex value to save * @return the complex value fragment root element */ public Element toDOM(T value); /** * @return the type of the complex value context */ public Class<C> getContextType(); }
[ "simon.templer@igd.fraunhofer.de" ]
simon.templer@igd.fraunhofer.de
8fa2569bf69dccd7e80d2347875c7d710d5c08e8
8b8f33dd0d93973b578d44d68acf319d33a399d2
/app/src/main/java/com/tracking/cartracking/Model/user.java
26943d9fbfe74f0199468c2c6ef2e9369ba461c6
[]
no_license
suhair93/tracking_app-master
465b5bfa7f0eb587105178bf54868f9261ecb5c9
51f7e21670e9999b49ad905163386dbc658af5f0
refs/heads/master
2020-04-08T13:22:05.202245
2018-12-01T23:47:30
2018-12-01T23:48:09
159,387,912
0
0
null
null
null
null
UTF-8
Java
false
false
1,260
java
package com.tracking.cartracking.Model; /** * Created by locall on 2/14/2018. */ public class user { private String email; private String password; private String typeUser; private String city; private String name_org; public user(){} public user(String email, String password, String typeUser, String city, String name_org) { this.email = email; this.password = password; this.typeUser = typeUser; this.city = city; this.name_org = name_org; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getName_org() { return name_org; } public void setName_org(String name_org) { this.name_org = name_org; } public String getPassword() { return password; } public String getTypeUser() { return typeUser; } public String getEmail() { return email; } public void setPassword(String password) { this.password = password; } public void setTypeUser(String typeUser) { this.typeUser = typeUser; } public void setEmail(String username) { this.email = username; } }
[ "suhair.madhoun@gmail.com" ]
suhair.madhoun@gmail.com
42afdc4a3f29fb00d2fd7964725abf6c5b88d953
ca19c71291828c4cf3ee6cc33984771d35b6257f
/src/pl/com/bottega/photostock/sales/application/ConsoleApp.java
591b511a455617571ecfedf0038a184099268c74
[]
no_license
ksrubka/photostock
4f199a471e46cf23818f1d63a599d5f23d722aeb
1a2758ab448a08783bf513234dedd52308cd39f8
refs/heads/master
2021-01-21T04:47:01.667702
2016-06-11T21:53:01
2016-06-11T21:53:01
55,002,259
0
0
null
null
null
null
UTF-8
Java
false
false
3,159
java
package pl.com.bottega.photostock.sales.application; import pl.com.bottega.photostock.sales.model.*; import pl.com.bottega.photostock.sales.model.products.Clip; import pl.com.bottega.photostock.sales.model.products.Picture; import pl.com.bottega.photostock.sales.model.Product; import pl.com.bottega.photostock.sales.model.products.Song; /** * Created by Beata Iłowiecka on 08.04.16. */ public class ConsoleApp { public static void main(String[] args) { /* Picture programming = new Picture(); Product goldOnTheCeiling = new Song(); Product littleNumbers = new Clip(); Client paniHelenka = new Client(); LightBox lightBoxPaniHelenki = new LightBox(paniHelenka, "nr1"); lightBoxPaniHelenki.add(programming, goldOnTheCeiling, littleNumbers); Reservation rezerwacjaPaniHelenki = new Reservation(paniHelenka, "nr1"); // TODO sensowne byłoby overloadowanie kontruktora tak żeby można było tworzyć rezerwację z lightboxa, o tak: // public Reservation(LightBox lbx)){ // tu idzie kodzik przerzucający itemsy} rezerwacjaPaniHelenki.add(programming, goldOnTheCeiling, littleNumbers); Offer ofertaPaniHelenki = rezerwacjaPaniHelenki.generateOffer(); System.out.println("Pani Helenka ma w ofercie " + ofertaPaniHelenki.getItemsCount() + " produkty."); System.out.println();*/ // Zaraz nastąpi próba rezerwacji zdjęcia przez drugiego klienta // zdjęcie jest niepodzielne (shared == false) więc nie powinno być można zarezerwować // ale paniKasia jest vipem więc może. // ale czy powinna móc po wygenerowniu oferty dla kogos innego? chyba nie. // TODO należy dodać zmiany w generateOffer() w klasie Reservation // np dodać pole boolean hasOfferGenerated w klasie AbstractProduct? // i jeśli true to nie rezerwujemy już dla nikogo // (ale to trzeba wyłączyć po wygaśnięciu oferty dla każdego produktu) niezależnie od tego czy tworzymy Purchase czy rezygnujemy // - ale czy jest sens to robić? może można lepiej, inaczej? // TODO no właśnie - jak wygasić ofertę? i kiedy? i gdzie? w konstruktorze Purchase? // i tu znowu powraca temat usuwania obiektów. Można by odliczyć np 30 min i potem dać kodzik który by usuwał obiekt // jak usunąć obiekt? może przypisać zmienną do nulla, a wtedy tamten obiekt straci referencję i GarbageCollector go usunie ? // ale wtedy cała aplikacja musi czekać pół godziny bez sensu. I tu chyba przydały by się wątki? // wracając do AbstractProduct - jeśli canBeBoughtByMany == true (do zmiany zamiast to enigmatyczne !shared) (zrobione!) // to nie bierzemy pod uwage tego hasOfferGenerated bo wtedy i tak można rezerwować /*ClientVIP paniKasia = new ClientVIP(); Reservation rezerwacjaPaniKasi = new Reservation(paniKasia, "nr1"); rezerwacjaPaniKasi.add(programming); System.out.print("Tyle pani Kasia ma produktów w rezerwacji: "); System.out.println(rezerwacjaPaniKasi.getItemsCount());*/ } }
[ "beata.choluj@wp.pl" ]
beata.choluj@wp.pl
ed21f37d1b9801466c03b683494e1bb126fa2583
b3e01a459f36f3939bdeb0e632728ba5aa769a7a
/.svn/pristine/a3/a3f474da7e96022064031c2ad75fdbcdcb477a67.svn-base
f8d7b4ef75e038a12936010a87d2ad35042015e2
[]
no_license
wsw2008new/OBDController
aa8ecf27d358d999749274345a6c5ddcefc560fa
ba604345283577a6c89d0781c9ff4933403b9b2f
refs/heads/master
2021-01-16T20:38:39.007533
2014-10-28T03:05:36
2014-10-28T03:05:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
295
package com.fix.obd.web.service; import java.util.List; import com.fix.obd.web.model.Business; public interface BusinessService { public boolean updateBusiness(Business business); public Business getBusinessByBid(int bid); public String checkBusinessUser(String email, String password); }
[ "chrismacong@163.com" ]
chrismacong@163.com
b89fb22a315259f8378235f6e7e5a2adfd70e3e7
93a4eadab25828899ff60695fbb391545abf9dda
/Zsxs/Zsxs/app/src/main/java/cn/huida/burt/zsxs/utils/md5cast.java
53aa27a786b11b949c0e99ecef12d6fd8fc045e3
[]
no_license
BurtTeam/Zsxs
95f8cdaff4f4645bbc694874fb6c6004ea0da5b7
bc277169dfcc615b0ba957f98bff8f0e1e5ebff3
refs/heads/master
2020-12-03T02:27:41.016706
2017-07-01T08:25:22
2017-07-01T08:25:22
95,268,128
0
0
null
null
null
null
UTF-8
Java
false
false
1,143
java
package cn.huida.burt.zsxs.utils; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; /** * Created by Q on 2017/6/24. */ public class md5cast { public static void main(String[] args) { try { System.out.println("md5:"+getMD5("1234567890")); } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static String getMD5(String val) throws NoSuchAlgorithmException{ MessageDigest md5 = MessageDigest.getInstance("MD5"); md5.update(val.getBytes()); byte[] m = md5.digest();//加密 return getString(m); } private static String getString(byte[] b) { StringBuffer buf = new StringBuffer(); for (int i = 0; i < b.length; i++) { int a = b[i]; if (a < 0) a += 256; if (a < 16) buf.append("0"); buf.append(Integer.toHexString(a)); } return buf.toString(); //32位 //或者 return buf.toString().substring(8,24); //16位 } }
[ "gudujianjsk@gmail.com18733519953@163.com" ]
gudujianjsk@gmail.com18733519953@163.com
b9c3c49ea60b5c9e7370f31fa1beab43bd8b3178
01883b64ab087dfb8781b0886e5f39641fd26789
/api-performance-mgmt/src/test/java/io/pms/api/service/NotificationServiceTest.java
db120ba9f30d5bc28e42635b9edba4c82a7690bd
[]
no_license
rugved-marathe/prs
e2f38faf872bca713cd0c01c69208871fa3308c5
9a7b51b6b21f26af27156bdf74d97cc4da79d96f
refs/heads/master
2021-06-27T02:15:50.436461
2019-12-06T09:42:10
2019-12-06T09:42:10
226,294,941
0
0
null
2021-04-26T19:46:03
2019-12-06T09:41:12
Java
UTF-8
Java
false
false
11,366
java
package io.pms.api.service; import static org.junit.Assert.assertNull; import java.util.Arrays; import org.joda.time.DateTime; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.auditing.AuditingHandler; import org.springframework.data.mongodb.core.convert.MappingMongoConverter; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.client.RestTemplate; import io.pms.api.common.FormStatus; import io.pms.api.common.PerformanceCycle; import io.pms.api.common.Role; import io.pms.api.common.Status; import io.pms.api.exception.ValidationException; import io.pms.api.model.Employee; import io.pms.api.repositories.EmployeeRepository; import io.pms.api.services.NotificationService; import io.pms.api.vo.EmailResponse; import io.pms.api.vo.FormNotificationVO; import io.pms.api.vo.NotificationVO; @RunWith(SpringRunner.class) public class NotificationServiceTest { @MockBean private MappingMongoConverter mongoConverter; @MockBean private AuditingHandler auditingHandler; @MockBean private EmployeeRepository employeeRepository; @MockBean private RestTemplate restTemplate; @InjectMocks private NotificationService notificationService; @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); } private EmailResponse mockEmailResponse() { EmailResponse emailResponse = new EmailResponse(); emailResponse.setSuccess("true"); emailResponse.setMsg("Email Sent Successfully !!!"); return emailResponse; } private FormNotificationVO mockFormNotificationVO() { FormNotificationVO formNotificationVO = new FormNotificationVO(); formNotificationVO.setEmployeeId("AFT00001"); return formNotificationVO; } private NotificationVO notificationVO() { NotificationVO notificationVO = new NotificationVO(); notificationVO.setApiKey(""); notificationVO.setEmail("john.doe@afourtech.com"); notificationVO.setTo("james.gosling@afourtech.com"); notificationVO.setSubject("Test Subject"); notificationVO.setHtml("This is mail body."); return notificationVO; } private Employee mockEmployee() { Employee employee = new Employee(); employee.setEmpId("AFT00003"); employee.setEmpName("John Doe"); employee.setCurrentMgrId("AFT00002"); employee.setCurrentDUHeadId("AFT00001"); employee.setDateOfJoining(new DateTime().withDate(2024, 1, 1)); employee.setStatus(Status.ACTIVE); employee.setPerformanceCycle(PerformanceCycle.APRIL); employee.setCurrentProject(Arrays.asList("PRS")); return employee; } @Test public void whenSendFormNotificationForUnderReviewStatusIsTriggered_thenNotificationIsSent() { FormNotificationVO mockFormNotification = mockFormNotificationVO(); mockFormNotification.setRole(Role.EMPLOYEE); mockFormNotification.setFormStatus(FormStatus.UNDER_REVIEW); Mockito.when(employeeRepository.findByEmpId(Mockito.anyString())).thenReturn(mockEmployee()); Mockito.when(restTemplate.postForObject("http://192.168.7.196:80/projects/sendEmail", notificationVO(), EmailResponse.class)).thenReturn(mockEmailResponse()); EmailResponse emailResponse = notificationService.sendFormNotification(mockFormNotification); assertNull(emailResponse); } @Test public void whenSendFormNotificationForPendingStatusIsTriggered_thenNotificationIsSent() { FormNotificationVO mockFormNotification = mockFormNotificationVO(); mockFormNotification.setRole(Role.HR); mockFormNotification.setFormStatus(FormStatus.PENDING); Mockito.when(employeeRepository.findByEmpId(Mockito.anyString())).thenReturn(mockEmployee()); Mockito.when(restTemplate.postForObject("http://192.168.7.196:80/projects/sendEmail", notificationVO(), EmailResponse.class)).thenReturn(mockEmailResponse()); EmailResponse emailResponse = notificationService.sendFormNotification(mockFormNotification); assertNull(emailResponse); } @Test public void whenSendFormNotificationForFormReceivedStatusIsTriggered_thenNotificationIsSent() { FormNotificationVO mockFormNotification = mockFormNotificationVO(); mockFormNotification.setRole(Role.MANAGER); mockFormNotification.setFormStatus(FormStatus.FORM_RECEIVED); Mockito.when(employeeRepository.findByEmpId(Mockito.anyString())).thenReturn(mockEmployee()); Mockito.when(restTemplate.postForObject("http://192.168.7.196:80/projects/sendEmail", notificationVO(), EmailResponse.class)).thenReturn(mockEmailResponse()); EmailResponse emailResponse = notificationService.sendFormNotification(mockFormNotification); assertNull(emailResponse); } @Test public void whenSendFormNotificationForApprovedStatusIsTriggered_thenNotificationIsSent() { FormNotificationVO mockFormNotification = mockFormNotificationVO(); mockFormNotification.setRole(Role.DU_HEAD); mockFormNotification.setFormStatus(FormStatus.APPROVED); Mockito.when(employeeRepository.findByEmpId(Mockito.anyString())).thenReturn(mockEmployee()); Mockito.when(restTemplate.postForObject("http://192.168.7.196:80/projects/sendEmail", notificationVO(), EmailResponse.class)).thenReturn(mockEmailResponse()); EmailResponse emailResponse = notificationService.sendFormNotification(mockFormNotification); assertNull(emailResponse); } @Test public void whenSendFormNotificationForPendingStatusAndHrRoleIsTriggered_thenNotificationIsSent() { FormNotificationVO mockFormNotification = mockFormNotificationVO(); mockFormNotification.setRole(Role.HR); mockFormNotification.setFormStatus(FormStatus.INCOMPLETE); Mockito.when(employeeRepository.findByEmpId(Mockito.anyString())).thenReturn(mockEmployee()); Mockito.when(restTemplate.postForObject("http://192.168.7.196:80/projects/sendEmail", notificationVO(), EmailResponse.class)).thenReturn(mockEmailResponse()); EmailResponse emailResponse = notificationService.sendFormNotification(mockFormNotification); assertNull(emailResponse); } @Test public void whenSendFormNotificationForPendingStatusAndEmployeeRoleIsTriggered_thenNotificationIsSent() { FormNotificationVO mockFormNotification = mockFormNotificationVO(); mockFormNotification.setRole(Role.EMPLOYEE); mockFormNotification.setFormStatus(FormStatus.PENDING); Mockito.when(employeeRepository.findByEmpId(Mockito.anyString())).thenReturn(mockEmployee()); Mockito.when(restTemplate.postForObject("http://192.168.7.196:80/projects/sendEmail", notificationVO(), EmailResponse.class)).thenReturn(mockEmailResponse()); EmailResponse emailResponse = notificationService.sendFormNotification(mockFormNotification); assertNull(emailResponse); } @Test public void whenSendFormNotificationForPendingStatusAndManagerRoleIsTriggered_thenNotificationIsSent() { FormNotificationVO mockFormNotification = mockFormNotificationVO(); mockFormNotification.setRole(Role.MANAGER); mockFormNotification.setFormStatus(FormStatus.PENDING); Mockito.when(employeeRepository.findByEmpId(Mockito.anyString())).thenReturn(mockEmployee()); Mockito.when(restTemplate.postForObject("http://192.168.7.196:80/projects/sendEmail", notificationVO(), EmailResponse.class)).thenReturn(mockEmailResponse()); EmailResponse emailResponse = notificationService.sendFormNotification(mockFormNotification); assertNull(emailResponse); } @Test public void whenSendFormNotificationForPendingStatusAndDuHeadRoleIsTriggered_thenNotificationIsSent() { FormNotificationVO mockFormNotification = mockFormNotificationVO(); mockFormNotification.setRole(Role.DU_HEAD); mockFormNotification.setFormStatus(FormStatus.PENDING); Mockito.when(employeeRepository.findByEmpId(Mockito.anyString())).thenReturn(mockEmployee()); Mockito.when(restTemplate.postForObject("http://192.168.7.196:80/projects/sendEmail", notificationVO(), EmailResponse.class)).thenReturn(mockEmailResponse()); EmailResponse emailResponse = notificationService.sendFormNotification(mockFormNotification); assertNull(emailResponse); } @Test public void whenSendFormNotificationForFinishedStatusAndHrRoleIsTriggered_thenNotificationIsSent() { FormNotificationVO mockFormNotification = mockFormNotificationVO(); mockFormNotification.setRole(Role.HR); mockFormNotification.setFormStatus(FormStatus.FINISHED); Mockito.when(employeeRepository.findByEmpId(Mockito.anyString())).thenReturn(mockEmployee()); Mockito.when(restTemplate.postForObject("http://192.168.7.196:80/projects/sendEmail", notificationVO(), EmailResponse.class)).thenReturn(mockEmailResponse()); EmailResponse emailResponse = notificationService.sendFormNotification(mockFormNotification); assertNull(emailResponse); } @Test public void whenSendFormNotificationForCompletedStatusAndManagerRoleIsTriggered_thenNotificationIsSent() { FormNotificationVO mockFormNotification = mockFormNotificationVO(); mockFormNotification.setRole(Role.MANAGER); mockFormNotification.setFormStatus(FormStatus.COMPLETED); Mockito.when(employeeRepository.findByEmpId(Mockito.anyString())).thenReturn(mockEmployee()); Mockito.when(restTemplate.postForObject("http://192.168.7.196:80/projects/sendEmail", notificationVO(), EmailResponse.class)).thenReturn(mockEmailResponse()); EmailResponse emailResponse = notificationService.sendFormNotification(mockFormNotification); assertNull(emailResponse); } @SuppressWarnings("unchecked") @Test(expected = ValidationException.class) public void whenSendFormNotificationForPendingStatusAndDuHeadRoleIsTriggered_thenThrowValidationException() { FormNotificationVO mockFormNotification = mockFormNotificationVO(); mockFormNotification.setRole(null); mockFormNotification.setFormStatus(FormStatus.PENDING); Mockito.when(restTemplate.postForObject("http://192.168.7.196:80/projects/sendEmail", notificationVO(), EmailResponse.class)).thenReturn(mockEmailResponse()); notificationService.sendFormNotification(mockFormNotification); } @SuppressWarnings("unchecked") @Test(expected = ValidationException.class) public void whenSendFormNotificationForPendingStatusAndManagerRoleIsTriggered_thenThrowValidationException() { FormNotificationVO mockFormNotification = mockFormNotificationVO(); mockFormNotification.setRole(Role.MANAGER); mockFormNotification.setFormStatus(null); Mockito.when(restTemplate.postForObject("http://192.168.7.196:80/projects/sendEmail", notificationVO(), EmailResponse.class)).thenReturn(mockEmailResponse()); notificationService.sendFormNotification(mockFormNotification); } /* * @Test public void * whenSendFormNotificationForNullRoleValueIsTriggered_thenNotificationIsNotSent * () { FormNotificationVO mockFormNotification = mockFormNotificationVO(); * mockFormNotification.setFormStatus(FormStatus.PENDING); * Mockito.when(employeeRepository.findByEmpId(Mockito.anyString())).thenReturn( * mockEmployee()); * * Mockito.when(restTemplate.postForObject( * "http://192.168.7.196:80/projects/sendEmail", notificationVO(), * EmailResponse.class)).thenReturn(mockEmailResponse()); * * EmailResponse emailResponse = * notificationService.sendFormNotification(mockFormNotification); * * assertNull(emailResponse); } */ }
[ "rugved.marathe@afourtech.com" ]
rugved.marathe@afourtech.com
8cfa33d201b8be860d1991f86e86a116e955f9da
a2b591ee24c8914c53009e0a4b9a8f326a92e2dc
/halcyon-core/src/main/java/com/marshal/halcyon/core/service/impl/BaseServiceImpl.java
2a44e08e52f8b196ae28de0d0bec36f7c01e308b
[]
no_license
JeremiahLiu/halcyon
1645905d23af7d40fecbbc5557a1ee8cded1406c
8cd42633502336eabcdcb3ab6ddfb93d8d90fde5
refs/heads/master
2021-10-24T18:37:07.181526
2019-03-27T16:15:16
2019-03-27T16:15:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,493
java
package com.marshal.halcyon.core.service.impl; import com.github.pagehelper.PageHelper; import com.marshal.halcyon.core.service.BaseService; import com.marshal.halcyon.core.util.DtoUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import tk.mybatis.mapper.common.Mapper; import java.util.List; /** * @auth: Marshal * @date: 2018/1/7 * @desc: common service */ @Transactional public class BaseServiceImpl<T> implements BaseService<T> { @Autowired Mapper<T> mapper; @Override public List<T> select(T condition, int pageNum, int pageSize) { PageHelper.startPage(pageNum, pageSize); return mapper.select(condition); } @Override public List<T> select(T condition) { return mapper.select(condition); } @Override public List<T> selectAll() { return mapper.selectAll(); } @Override public T selectOne(T condition) { return mapper.selectOne(condition); } @Override public T selectByPrimaryKey(Object record) { return mapper.selectByPrimaryKey(record); } @Override public int insert(T record) { record = (T) DtoUtil.setCreateAttribute(record); return mapper.insert(record); } @Override public int insertSelective(T record) { record = (T) DtoUtil.setCreateAttribute(record); return mapper.insertSelective(record); } @Override public int updateByPrimaryKey(T record) { record = (T) DtoUtil.setUpdateAttribute(record); return mapper.updateByPrimaryKey(record); } @Override public int updateByPrimaryKeySelective(T record) { record = (T) DtoUtil.setUpdateAttribute(record); return mapper.updateByPrimaryKeySelective(record); } @Override public int deleteByPrimaryKey(Object record) { return mapper.deleteByPrimaryKey(record); } @Override public int save(T record) { if (DtoUtil.isPrimaryKeyNull(record)) { return this.insertSelective(record); } else { return this.updateByPrimaryKey(record); } } @Override public void batchDelete(Object[] keys) { for (Object primaryKey : keys) { this.deleteByPrimaryKey(primaryKey); } } @Override public void batchDelete(List<T> records) { records.forEach(item -> this.deleteByPrimaryKey(item)); } }
[ "453607106@qq.com" ]
453607106@qq.com
8dd9fe5582c2b981f90ec9f27355ea509d193401
919ea201f9ba51b630b189910c792bf4c575af15
/CryptographyProject3/CryptographyProject3/CryptographyProject3/src/Crypto/LicenseControllerApp.java
d37f9b8e040cd51e94b8791ede1dbd64b69e39e1
[]
no_license
meryemmhamdi1/LicenseManagementServer
14fc0827637f472324b6aa539734e0d9d6a7d41e
3ed5c54fefaffc0b16f1db3f452cf6a4cfac825e
refs/heads/master
2021-01-20T20:56:47.928236
2016-07-16T12:09:01
2016-07-16T12:09:01
63,478,738
0
0
null
null
null
null
UTF-8
Java
false
false
4,620
java
package Crypto; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JLabel; import java.awt.Font; import javax.swing.JTextField; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.io.File; import java.util.Scanner; public class LicenseControllerApp extends JFrame { private JPanel contentPane; private JTextField path; private DDLoggerInterface logger; private boolean access; private boolean closed; private JTextField textField; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { LicenseControllerApp frame = new LicenseControllerApp(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public LicenseControllerApp() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblInformationToControl = new JLabel("Information to control Provided License:"); lblInformationToControl.setFont(new Font("Lucida Grande", Font.BOLD, 14)); lblInformationToControl.setBounds(84, 26, 308, 16); contentPane.add(lblInformationToControl); JLabel lblLicensePath = new JLabel("License Path:"); lblLicensePath.setFont(new Font("Lucida Grande", Font.BOLD, 13)); lblLicensePath.setBounds(29, 87, 88, 16); contentPane.add(lblLicensePath); path = new JTextField(); path.setBounds(152, 81, 148, 28); contentPane.add(path); path.setColumns(10); JButton btnBrowse = new JButton("Browse"); btnBrowse.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { final JFileChooser fc = new JFileChooser(); fc.showOpenDialog(contentPane); try { File license = fc.getSelectedFile(); path.setText(license.toString()); } catch (Exception e){ JOptionPane.showMessageDialog( null,"File Path not valid","Error", JOptionPane.ERROR_MESSAGE); } } }); btnBrowse.setBounds(312, 82, 117, 29); contentPane.add(btnBrowse); JButton btnVerifyLicense = new JButton("Verify License"); btnVerifyLicense.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { LicenseController lc = new LicenseController(logger); lc.getActivationKey(path.getText()); try { lc.getMacAddress(textField.getText()); } catch (Exception e1) { // TODO Auto-generated catch block JOptionPane.showMessageDialog( null,"Public Key Path not Valid. Try Again!","Error", JOptionPane.ERROR_MESSAGE); } if(lc.verifyLicense()==true){ //Grant Access to the Application access = true; launchApplication(); } else { //Deny Access to the Application access = false; JOptionPane.showMessageDialog( null,"License not valid","Error", JOptionPane.ERROR_MESSAGE); } closed = true; } }); btnVerifyLicense.setBounds(159, 196, 117, 29); contentPane.add(btnVerifyLicense); JLabel lblPublicKeyPath = new JLabel("Public Key Path:"); lblPublicKeyPath.setFont(new Font("Lucida Grande", Font.BOLD, 13)); lblPublicKeyPath.setBounds(29, 142, 125, 16); contentPane.add(lblPublicKeyPath); textField = new JTextField(); textField.setColumns(10); textField.setBounds(152, 136, 148, 28); contentPane.add(textField); JButton button = new JButton("Browse"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { final JFileChooser fc = new JFileChooser(); fc.showOpenDialog(contentPane); try { File license = fc.getSelectedFile(); textField.setText(license.toString()); } catch (Exception e){ JOptionPane.showMessageDialog( null,"File Path not valid","Error", JOptionPane.ERROR_MESSAGE); } } }); button.setBounds(312, 137, 117, 29); contentPane.add(button); } public boolean getAccess(){ return access; } public void launchApplication(){ HelloWorld hw = new HelloWorld(); hw.setVisible(true); } }
[ "meryemmhamdi@bitbucket.org" ]
meryemmhamdi@bitbucket.org
4b8f74635239aea03e3ee1320e2bbfb2d63a4327
15c6c6648e6c9661f63bcbd26794f19e1919d36b
/src/main/java/org/mavriksc/messin/SumKeyBasedOnValue.java
71f47d6c981809e587734fbbc96228df97c8d363
[]
no_license
mavriksc/jus-messin
0d340c10979cf8ab54dbc357a8803b709fb79894
1ad6db987a9b9a1721bfca063a6452a7cd22b2ee
refs/heads/master
2023-08-30T07:04:19.744933
2023-08-17T01:41:34
2023-08-17T01:41:34
156,572,163
0
0
null
2023-02-03T01:52:53
2018-11-07T16:02:02
Java
UTF-8
Java
false
false
602
java
package org.mavriksc.messin; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.stream.Collectors; public class SumKeyBasedOnValue { public static void main(String[] args){ Map<Integer,Integer> inventory = new HashMap<>(); Map<Integer,Integer> consolidate = consolidateInventory(inventory); } private static Map<Integer, Integer> consolidateInventory(Map<Integer, Integer> inventory) { return inventory.entrySet().stream().collect(Collectors.groupingBy(Entry::getValue,Collectors.summingInt(Entry::getValue))); } }
[ "scarlisle@hylamobile.com" ]
scarlisle@hylamobile.com
47022055bdc78a783562ebb7c47b458e7f985a52
6bd4ede0a1ef6cda595bde6708d3d6a5c989608f
/risenb-manage-web/src/main/java/com/risenb/controller/manage/HomeController.java
a0afd12dce10977c6df14f35f6bb1d6633c70b8a
[]
no_license
AmenWu/risenb-parent
6e42020c0b138f90e1eb44d48cd5c6a9d45d1e5d
01959fb2f3043367762cd878217be98fef7196fd
refs/heads/master
2020-03-06T15:36:54.639152
2018-03-27T09:08:02
2018-03-27T09:08:02
126,959,098
0
0
null
null
null
null
UTF-8
Java
false
false
3,581
java
package com.risenb.controller.manage; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import com.risenb.annotation.Log; import com.risenb.common.CommonControllor; import com.risenb.common.Constant; import com.risenb.common.SystemInfo; import com.risenb.manage.bean.Manager; import com.risenb.manage.bean.Permission; import com.risenb.manage.service.PermissionService; /** * <p> * Title:登录控制类 * </p> * <p> * Description: * </p> * * @version 1.0 */ @Controller @RequestMapping(value = "/home") public class HomeController extends CommonControllor { @Autowired private PermissionService permissionService; private static SystemInfo systemInfo; /** * 欢迎页 * * @return */ @Log(isLog = false) @RequestMapping(value = "welcome") public ModelAndView welcome() { ModelAndView view = new ModelAndView("manage/home_sysinfo"); systemInfo = new SystemInfo(); view.addObject(systemInfo); return view; } /** * 跳转到首页,并展示相应的权限 * * @return */ @Log(isLog = false) @RequestMapping(value = "index") public ModelAndView index() { ModelAndView view = new ModelAndView("manage/home_index"); Manager manager = (Manager) session().getAttribute(Constant.SESSION_MANAGER); if (manager == null) { view.setViewName("login"); return view; } List<Permission> permissionList = permissionService.getPermissionByManagerId(manager.getManageId()); List<Permission> navMenus = new ArrayList<Permission>(); // 所有左侧菜单信息 List<Permission> subNavMenus = new ArrayList<Permission>(); // 所有左侧菜单信息 for (int i = 0, size = permissionList.size(); i < size; i++) { Permission permission = permissionList.get(i); Integer isMenu = permission.getIsMenu(); // 0为左侧菜单 1为功能菜单 if (null != isMenu) { if (0 == isMenu) { subNavMenus.add(permission); Integer parentid = permission.getParentId(); if (null != parentid && parentid == 0) { navMenus.add(permission); } } } } // 组织权限关系图 for (int i = 0, size = subNavMenus.size(); i < size; i++) { Permission permission = subNavMenus.get(i); Integer id = permission.getPermissionId(); if (null != id) { for (int j = 0, sizes = subNavMenus.size(); j < sizes; j++) { Permission permission2 = subNavMenus.get(j); Integer parentid = permission2.getParentId(); if (null != parentid && parentid.intValue() == id) { List<Permission> children = permission.getChildren(); if (null == children) { children = new ArrayList<Permission>(); } children.add(permission2); permission.setChildren(children); } } } } Map<String, String> permissionMap = new HashMap<String, String>(); for (int i = 0, size = permissionList.size(); i < size; i++) { Permission permission = permissionList.get(i); String url = permission.getUrl(); if (null != url && !"".equals(url)) { permissionMap.put(url, url); } } // 将权限放入session Collections.sort(navMenus); session().setAttribute("permissionMap", permissionMap); session().setAttribute("navMenus", navMenus); session().setAttribute(Constant.SESSION_MANAGER_PERMISSIONLIST, permissionList); return view; } }
[ "251404448@qq.com" ]
251404448@qq.com
7ff02211c383c8927cdb7e551482d72fa56f4533
17f33277f38e08c8e3a30d854ddc9fcf90e3dc7f
/src/main/java/com/intuit/developer/sampleapp/oauth2/helper/HttpHelper.java
ba170098f28d5cb413f50bc58060aa3a46da69a7
[ "Apache-2.0" ]
permissive
e-gov/TARA-Java
fb1bf9a6b5a4f9601ad2acf5c75b412d25ea838e
e1bc7bdeac8bb3d8825ea56c76bba63971ffc2cf
refs/heads/master
2022-11-30T06:18:13.584671
2021-10-25T16:02:20
2021-10-25T16:02:20
130,127,598
2
2
Apache-2.0
2021-03-22T07:28:00
2018-04-18T22:11:01
Java
UTF-8
Java
false
false
2,489
java
package com.intuit.developer.sampleapp.oauth2.helper; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpSession; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.tomcat.util.codec.binary.Base64; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.intuit.developer.sampleapp.oauth2.domain.OAuth2Configuration; /** * @author dderose * */ @Service public class HttpHelper { @Autowired public OAuth2Configuration oAuth2Configuration; public HttpPost addHeader(HttpPost post) { String base64ClientIdSec = Base64.encodeBase64String((oAuth2Configuration.getClientId() + ":" + oAuth2Configuration.getClientSecret()).getBytes()); post.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); post.setHeader("Authorization", "Basic " + base64ClientIdSec); post.setHeader("Accept", "application/json"); return post; } public List<NameValuePair> getUrlParameters(HttpSession session, String action) { List<NameValuePair> urlParameters = new ArrayList<>(); String refreshToken = (String)session.getAttribute("refresh_token"); if (action == "revoke") { urlParameters.add(new BasicNameValuePair("token", refreshToken)); } else if (action == "refresh") { urlParameters.add(new BasicNameValuePair("refresh_token", refreshToken)); urlParameters.add(new BasicNameValuePair("grant_type", "refresh_token")); } else { String auth_code = (String)session.getAttribute("auth_code"); urlParameters.add(new BasicNameValuePair("code", auth_code)); urlParameters.add(new BasicNameValuePair("redirect_uri", oAuth2Configuration.getRedirectUri())); urlParameters.add(new BasicNameValuePair("grant_type", "authorization_code")); } return urlParameters; } public StringBuffer getResult(HttpResponse response) throws IOException { BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); StringBuffer result = new StringBuffer(); String line = ""; while ((line = rd.readLine()) != null) { result.append(line); } return result; } }
[ "priit.parmakson@gmail.com" ]
priit.parmakson@gmail.com
13530dfd39e970a4549f45689f7221ee9714e029
427dc04cba641e8fa3acce06efc21625f959d224
/test/practicework/pages/ReserveInputPage.java
6f30b98bc8393080b8349e749ccb66345742626d
[ "MIT" ]
permissive
SoftwareTestAutomationResearch/STARHOTEL-Teaching-Materials
22c687c2bc6c0db48f60f46634d3f46cf9865be5
e09ecee28f9e6085337e49dc01e424cdfbdc33d9
refs/heads/release
2020-02-26T17:35:03.608747
2016-06-13T08:59:50
2016-06-13T08:59:50
14,633,925
8
10
null
2016-06-13T08:59:50
2013-11-23T01:17:30
JavaScript
UTF-8
Java
false
false
1,560
java
package practicework.pages; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; public class ReserveInputPage { private WebDriver driver; private By reserveYear = By.id("reserve_year"); private By reserveMonth = By.id("reserve_month"); private By reserveDay = By.id("reserve_day"); private By reserveTerm = By.id("reserve_term"); private By goToNext = By.id("goto_next"); public ReserveInputPage(WebDriver driver) { this.driver = driver; } private void setReserveYear(String value) { WebElement element = driver.findElement(reserveYear); element.clear(); element.sendKeys(value); } private void setReserveMonth(String value) { WebElement element = driver.findElement(reserveMonth); element.clear(); element.sendKeys(value); } private void setReserveDay(String value) { WebElement element = driver.findElement(reserveDay); element.clear(); element.sendKeys(value); } public void setReserveDate(String year, String month, String day) { setReserveYear(year); setReserveMonth(month); setReserveDay(day); } public void setReserveTerm(String value) { WebElement element = driver.findElement(reserveTerm); element.clear(); element.sendKeys(value); } public ReserveConfirmPage goToNext() { driver.findElement(goToNext).click(); return new ReserveConfirmPage(driver); } }
[ "nozomi.ito@trident-qa.com" ]
nozomi.ito@trident-qa.com
92900adf45ef5428021abfb992535146171141d2
667cda19ff596caccea5a4141d83df3ba70fcc65
/demo/src/main/java/Controler/Controller.java
f5ff8a09dae8152e844e1718092a0a98ea68707a
[]
no_license
DRTIGAS/c-repository
ff3522960779a811dbbd2d76395faec56f716cc8
418da3dac82728bf792b9ed9d1cc047b4d69e8b1
refs/heads/master
2023-04-04T05:57:45.919895
2023-03-31T02:20:22
2023-03-31T02:20:22
67,957,156
0
0
null
null
null
null
UTF-8
Java
false
false
512
java
package Controler; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/thiago/exemplo") public class Controller { @GetMapping(value = "/{nome}") public String exemplo(@PathVariable("nome") String nome){ return "Teste" + nome; } }
[ "thiagocezar17@msn.com" ]
thiagocezar17@msn.com
334e4fe2f51fb00ade69f139caefe629d022f6e4
e4434dbb49e022be9ad1065898197902f6141be3
/Day1ProjectBulghak/src/by/javatr/task2/util/WrongMonthException.java
49e40001253c4824ec112dc63fe6ed592d8a22f3
[]
no_license
Alexthefirstest/JavaTr
f478918577c76a77d1a2a24ee95f9537c6d0601c
64885e5454a60db62634b64c9d41dcfc6fc62773
refs/heads/master
2020-09-12T22:37:33.331317
2020-01-31T00:04:38
2020-01-31T00:04:38
222,581,796
0
0
null
null
null
null
UTF-8
Java
false
false
166
java
package by.javatr.task2.util; public class WrongMonthException extends Exception { public WrongMonthException(String message) { super(message); } }
[ "aleksandarbulgak@yandex.by" ]
aleksandarbulgak@yandex.by
daaebb3e85e22ef24d755876f517f1ba3a7b9d8d
66c846a595f3e0d4367d5a6c908a4ec940a966cd
/AlgosRef/src/Q200_Q249/Q221.java
2bebec658bf080985c9655fee92d1c3e23c30e3c
[]
no_license
cheers32/tradepartner
8cd052a9b73386abe31d998707f828144600318b
ab3936f0b4c71127fb19f9b963ac0c00acb28e29
refs/heads/master
2022-12-07T21:27:18.925248
2020-09-07T18:49:40
2020-09-07T18:49:40
273,936,249
0
0
null
2020-06-21T20:21:57
2020-06-21T15:52:34
Python
UTF-8
Java
false
false
1,585
java
package Q200_Q249; import java.util.HashMap; import java.util.Map; public class Q221 { public int maximalSquare(char[][] matrix) { // 这种题就是注意3个方向, 只有三个方向统一(最小值)才有可能下一个加一,最大还是最小,+1还是-1,从上到小从左到右单独的计数一般没用,累计还是单格,每一个值要有意义,多用例子推一下; // 我之前面试的那个题其实就是一个简单的2D DP,应该能够做的更好 if(matrix==null || matrix.length==0) return 0; Map<String, Integer> map = new HashMap<>(); int max = 0; for(int i=0; i<matrix.length; i++) { for(int j=0; j<matrix[0].length; j++) { if(matrix[i][j]=='0') continue; // int left = j==0? 0 : matrix[i][j-1]; // int up = i==0? 0 : matrix[i-1][j]; // int upLeft = i==0 && j==0? 0 : matrix[i-1][j-1]; int left = map.getOrDefault(i+"_"+(j-1),0); int up = map.getOrDefault(i-1+"_"+j,0); int upLeft = map.getOrDefault(i-1+"_"+(j-1),0); int cur = Math.min(Math.min(left, up), upLeft)+1; max = Math.max(cur, max); map.put(i+"_"+j, cur); } } return max*max; } public static void main(String[] args) { char[][] input = new char[][] {{'0','0','0','0'},{'1','1','1','0'},{'0','1','1','1'},{'1','1','1','1'}}; System.out.println(new Q221().maximalSquare(input)); } }
[ "cheers32@outlook.com" ]
cheers32@outlook.com
5305fee646575286f9e72190f1666549622399f5
213821e513e8766505b30073d797f634fe5d11ab
/chitcat/src/main/java/io/olid16/actions/ReadTimeline.java
39080e44ab342a55130191c540e8612012145992
[]
no_license
felipefzdz/chitcat
1fed5c255af60f11983a4519efe24c811403473e
b9c5c56375c417819a924eb397b55ac0fdab5635
refs/heads/master
2020-12-26T01:29:52.652581
2015-02-06T15:40:24
2015-02-06T15:40:24
29,728,214
1
0
null
null
null
null
UTF-8
Java
false
false
494
java
package io.olid16.actions; import com.google.inject.Inject; import io.olid16.domain.collections.Timelines; import io.olid16.domain.entities.Timeline; import io.olid16.domain.values.Username; import java.util.Optional; public class ReadTimeline { private final Timelines timelines; @Inject public ReadTimeline(Timelines timelines) { this.timelines = timelines; } public Optional<Timeline> with(Username username) { return timelines.by(username); } }
[ "olid16@gmail.com" ]
olid16@gmail.com
6f9bcf772a1fef48fd92c5e25abbd804cbcae6b6
226e89b4a72aa7c2972d8093f2aca5e2a97dd32a
/src/main/java/com/wl/threadHandler/Handler.java
f009c292a5cc958d2c8840c094cbc32918383165
[]
no_license
linwang-zf/EncryptDataBase-Phoenix
edf9d0edbd57d0e553ab12a71a4bf8a1c0bb503d
3a02d6fd8cceda1aabaa9aecb242ac415b8b5794
refs/heads/master
2023-02-09T02:22:51.810643
2021-01-02T05:42:16
2021-01-02T05:42:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
138
java
package com.wl.threadHandler; /* * Author : LinWang * Date : 2020/12/9 */ public interface Handler { String executeHandler(); }
[ "903862530@qq.com" ]
903862530@qq.com
b8fd777d31e0ee26175e75d442437f55bd52cfb3
737b0fc040333ec26f50409fc16372f5c64c7df6
/bus-image/src/main/java/org/aoju/bus/image/metric/internal/hl7/HL7Parser.java
be2e47d2a6fa847bf49d57f2f2e165030fe607cf
[ "MIT" ]
permissive
sfg11/bus
1714cdc6c77f0042e3b80f32e1d9b7483c154e3e
d560ba4d3abd2e0a6c5dfda9faf7075da8e8d73e
refs/heads/master
2022-12-13T02:26:18.533039
2020-08-26T02:23:34
2020-08-26T02:23:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,629
java
/********************************************************************************* * * * The MIT License (MIT) * * * * Copyright (c) 2015-2020 aoju.org and other contributors. * * * * Permission is hereby granted, free of charge, to any person obtaining a copy * * of this software and associated documentation files (the "Software"), to deal * * in the Software without restriction, including without limitation the rights * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included in * * all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * * THE SOFTWARE. * ********************************************************************************/ package org.aoju.bus.image.metric.internal.hl7; import org.aoju.bus.core.lang.Normal; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; import java.util.EnumSet; import java.util.StringTokenizer; /** * @author Kimi Liu * @version 6.0.8 * @since JDK 1.8+ */ public class HL7Parser { private static final String NAMESPACE = "http://aurora.regenstrief.org/xhl7"; private final ContentHandler ch; private final AttributesImpl atts = new AttributesImpl(); private final EnumSet<Delimiter> open = EnumSet.noneOf(Delimiter.class); private String namespace = Normal.EMPTY; private String delimiters; public HL7Parser(ContentHandler ch) { this.ch = ch; } public final boolean isIncludeNamespaceDeclaration() { return namespace == NAMESPACE; } public final void setIncludeNamespaceDeclaration(boolean includeNameSpaceDeclaration) { this.namespace = includeNameSpaceDeclaration ? NAMESPACE : Normal.EMPTY; } public void parse(Reader reader) throws IOException, SAXException { parse(reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader)); } public void parse(BufferedReader reader) throws IOException, SAXException { startDocument(); delimiters = Delimiter.DEFAULT; String line; while ((line = reader.readLine()) != null) { line = line.trim(); if (line.length() == 0) continue; if (line.length() < 3) throw new IOException("Segment to short: " + line); String seg = line.substring(0, 3); String[] tks; int tkindex = 0; if (isHeaderSegment(line)) { if (line.length() < 8) throw new IOException("Header Segment to short: " + line); seg = line.substring(0, 3); setDelimiters(line.substring(3, 8)); tks = tokenize(line.substring(8)); } else { tks = tokenize(line); seg = tks[tkindex++]; } startElement(seg); while (tkindex < tks.length) { String tk = tks[tkindex++]; Delimiter d = delimiter(tk); if (d != null) { if (d != Delimiter.escape) { endElement(d); startElement(d); continue; } if (tks.length > tkindex + 1 && tks[tkindex + 1].equals(tk)) { tk = tks[tkindex++]; int e = escapeIndex(tk); if (e >= 0) { ch.characters(delimiters.toCharArray(), e, 1); } else { startElement(Delimiter.escape.name()); ch.characters(tk.toCharArray(), 0, tk.length()); endElement(Delimiter.escape.name()); } tkindex++; continue; } } ch.characters(tk.toCharArray(), 0, tk.length()); } endElement(Delimiter.field); endElement(seg); } endDocument(); } private boolean isHeaderSegment(String line) { return (line.startsWith("MSH") || line.startsWith("BHS") || line.startsWith("FHS")); } private void startDocument() throws SAXException { ch.startDocument(); addAttribute("xml-space", "preserved"); startElement("hl7"); } private void endDocument() throws SAXException { endElement("hl7"); ch.endDocument(); } private void setDelimiters(String delimiters) { Delimiter[] a = Delimiter.values(); for (int i = 0; i < a.length; i++) addAttribute(a[i].attribute(), delimiters.substring(i, i + 1)); this.delimiters = delimiters; } private void addAttribute(String name, String value) { atts.addAttribute(namespace, name, name, "NMTOKEN", value); } private Delimiter delimiter(String tk) { if (tk.length() != 1) return null; int index = delimiters.indexOf(tk.charAt(0)); return index >= 0 ? Delimiter.values()[index] : null; } private int escapeIndex(String tk) { return tk.length() != 1 ? Delimiter.ESCAPE.indexOf(tk.charAt(0)) : -1; } private String[] tokenize(String s) { StringTokenizer stk = new StringTokenizer(s, delimiters, true); String[] tks = new String[stk.countTokens()]; for (int i = 0; i < tks.length; i++) tks[i] = stk.nextToken(); return tks; } private void startElement(Delimiter d) throws SAXException { startElement(d.name()); open.add(d); } private void startElement(String name) throws SAXException { ch.startElement(namespace, name, name, atts); atts.clear(); } private void endElement(Delimiter delimiter) throws SAXException { Delimiter d = Delimiter.escape; do if (open.remove(d = d.parent())) endElement(d.name()); while (d != delimiter); } private void endElement(String name) throws SAXException { ch.endElement(namespace, name, name); } }
[ "839536@qq.com" ]
839536@qq.com
89fb0abff8f9e0dbf612c0abc717c6330009cca7
34ab4d824b5c0e1aa008bd373bae97e3d3f54720
/lutece-core/src/java/fr/paris/lutece/portal/service/util/RemovalListenerService.java
7b1447246d9e1dbefaf65cf512c2ae544511db80
[]
no_license
jchaline/jchaline
f974f83c81adeeb8a69bacafcd6b26bdf35b2e1e
7614e49d2a48ccac339dd3861626e5664571d13e
refs/heads/master
2020-05-17T17:01:49.460252
2014-12-01T08:29:07
2014-12-01T08:29:07
32,218,451
0
0
null
null
null
null
UTF-8
Java
false
false
2,938
java
/* * Copyright (c) 2002-2013, Mairie de Paris * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright notice * and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice * and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * License 1.0 */ package fr.paris.lutece.portal.service.util; import java.util.ArrayList; import java.util.List; import java.util.Locale; /** * RemovalListenerService */ public class RemovalListenerService { private List<RemovalListener> _listRegisteredListeners = new ArrayList<RemovalListener>( ); /** * Register a new Removal listener * @param listener The listener to register */ public void registerListener( RemovalListener listener ) { _listRegisteredListeners.add( listener ); } /** * Check if an object can be remove * @param strIdToRemove The object ID * @param listMessages Messages if some listeners have refused the removal * @param locale The current locale * @return true if the object can be removed otherwise false */ public boolean checkForRemoval( String strIdToRemove, List<String> listMessages, Locale locale ) { boolean bCheck = true; for ( RemovalListener listener : _listRegisteredListeners ) { if ( !listener.canBeRemoved( strIdToRemove ) ) { listMessages.add( listener.getRemovalRefusedMessage( strIdToRemove, locale ) ); bCheck = false; } } return bCheck; } }
[ "chaline.jeremy@gmail.com@e2e358a1-c3a5-5c30-0f45-651ad65eccec" ]
chaline.jeremy@gmail.com@e2e358a1-c3a5-5c30-0f45-651ad65eccec
7a912bde62932f1e524d0c72c449ffcea4075f82
1dd2897c2a7b2c08e51c502419608ca7563537cc
/src/main/java/org/bian/dto/BQCreditPlanRetrieveInputModel.java
6b773789ac1715bb4b95dd923544fa85518134b5
[ "Apache-2.0" ]
permissive
bianapis/sd-credit-charge-card-v2.0
25e6f1a517bea65907552acb3381fea4e22f0eaa
8202fa3cc3dfb2cb4cfebc038a6044967b4092a0
refs/heads/master
2020-07-11T07:12:57.797929
2019-09-09T06:37:13
2019-09-09T06:37:13
204,475,097
0
0
null
null
null
null
UTF-8
Java
false
false
2,743
java
package org.bian.dto; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.bian.dto.BQCreditPlanRetrieveInputModelCreditPlanInstanceAnalysis; import org.bian.dto.BQCreditPlanRetrieveInputModelCreditPlanInstanceReport; import javax.validation.Valid; /** * BQCreditPlanRetrieveInputModel */ public class BQCreditPlanRetrieveInputModel { private Object creditPlanRetrieveActionTaskRecord = null; private String creditPlanRetrieveActionRequest = null; private BQCreditPlanRetrieveInputModelCreditPlanInstanceReport creditPlanInstanceReport = null; private BQCreditPlanRetrieveInputModelCreditPlanInstanceAnalysis creditPlanInstanceAnalysis = null; /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Binary general-info: The retrieve service call consolidated processing record * @return creditPlanRetrieveActionTaskRecord **/ public Object getCreditPlanRetrieveActionTaskRecord() { return creditPlanRetrieveActionTaskRecord; } public void setCreditPlanRetrieveActionTaskRecord(Object creditPlanRetrieveActionTaskRecord) { this.creditPlanRetrieveActionTaskRecord = creditPlanRetrieveActionTaskRecord; } /** * `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: Details of the retrieve action service request (lists requested reports) * @return creditPlanRetrieveActionRequest **/ public String getCreditPlanRetrieveActionRequest() { return creditPlanRetrieveActionRequest; } public void setCreditPlanRetrieveActionRequest(String creditPlanRetrieveActionRequest) { this.creditPlanRetrieveActionRequest = creditPlanRetrieveActionRequest; } /** * Get creditPlanInstanceReport * @return creditPlanInstanceReport **/ public BQCreditPlanRetrieveInputModelCreditPlanInstanceReport getCreditPlanInstanceReport() { return creditPlanInstanceReport; } public void setCreditPlanInstanceReport(BQCreditPlanRetrieveInputModelCreditPlanInstanceReport creditPlanInstanceReport) { this.creditPlanInstanceReport = creditPlanInstanceReport; } /** * Get creditPlanInstanceAnalysis * @return creditPlanInstanceAnalysis **/ public BQCreditPlanRetrieveInputModelCreditPlanInstanceAnalysis getCreditPlanInstanceAnalysis() { return creditPlanInstanceAnalysis; } public void setCreditPlanInstanceAnalysis(BQCreditPlanRetrieveInputModelCreditPlanInstanceAnalysis creditPlanInstanceAnalysis) { this.creditPlanInstanceAnalysis = creditPlanInstanceAnalysis; } }
[ "team1@bian.org" ]
team1@bian.org
0c74e4960e68a2278e7d4c3295a65833ed6dceb9
490bd3cd7d6a77305122981ba07014aca89457f4
/java_test_assignment/src/main/java/automationFramework/firstTestCase.java
6e8d31b2c531b099853004a1d0e37453322280f8
[]
no_license
goran-olbina/alasTask
e19af2c8f2d62eea59c126661f6c481022d30a5c
e74741943893bf7fb77ab59d5ed85d44fe4a7d8a
refs/heads/master
2023-04-19T01:42:54.987310
2021-04-26T22:57:13
2021-04-26T22:57:13
361,909,878
0
0
null
null
null
null
UTF-8
Java
false
false
156
java
package automationFramework; public class firstTestCase { public static void main(String[] args) { // TODO Auto-generated method stub } }
[ "golbina2@gmail.com" ]
golbina2@gmail.com
f81ab3d88a1bddf630f3e4d9392a23943263cc70
2f61c1897bdbd63a8288a7998b79b28c542ac6d4
/Interview/src/com/rainmonth/pattern/behavioral/chain/king/OrcCommander.java
7ab8143d98dd4bf7156c8729b689795ac60def70
[]
no_license
Rainmonth/JavaLearn
d41e0b352256283812c0dabf975ad662b6742744
39b8ec0503c33efbf833dd7c9ede20e81d0aa0d3
refs/heads/main
2023-08-04T03:27:37.183682
2021-09-15T09:41:53
2021-09-15T09:41:53
354,026,982
1
0
null
null
null
null
UTF-8
Java
false
false
521
java
package com.rainmonth.pattern.behavioral.chain.king; public class OrcCommander extends RequestHandler { public OrcCommander(RequestHandler next) { super(next); } @Override public void handleRequest(Request request) { if (request.getRequestType() == RequestType.TRAIN_SOLDIER) { printHandling(request); } else { super.handleRequest(request); } } @Override public String toString() { return getClass().getSimpleName(); } }
[ "rainmonth@yeah.net" ]
rainmonth@yeah.net
a8081a9e812b18ccfc4695dcb8ade941f0bbb8ef
9ad9d7800c5e4b124b8947366dbb7f35387107ab
/app/src/main/java/gachon/mpclass/mp_team_newnew/form/LoginForm.java
dbe38e7ad74ae453f019e70fe9a05b02e23b1aeb
[]
no_license
CYC0227/tomorrow-cook
646de1bc500506f83bf128ebd678dd3442127b2d
1601fd1100d51aafbbbce6095478d0efa507936b
refs/heads/main
2023-05-07T14:21:11.341874
2021-05-30T07:23:55
2021-05-30T07:23:55
366,945,116
0
3
null
2021-05-31T12:02:19
2021-05-13T05:36:11
Java
UTF-8
Java
false
false
374
java
package gachon.mpclass.mp_team_newnew.form; public class LoginForm { private String email; private String pw; public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPw() { return pw; } public void setPw(String pw) { this.pw = pw; } }
[ "cyc0227@gachon.ac.kr" ]
cyc0227@gachon.ac.kr
223b6741f2a645181854646398de5cfb6b7ab1d5
c35894bc2cc7d38d01295d81baee76a7dce10b20
/Ch01_Start/src/p02/variables/ByteExample.java
ec8d4783cdc5be944624fcc59be864f4763790bb
[]
no_license
jongtix/JAVA_jongtix
93e5c289ed3e514cd481373988f18904b8c698cf
4f9f29456ac3956a34d05428c9bf7df14bb7b718
refs/heads/master
2021-08-29T23:14:02.840808
2017-12-15T07:43:22
2017-12-15T07:43:22
107,648,776
0
0
null
null
null
null
UTF-8
Java
false
false
900
java
package p02.variables; /** * 변수 선언과 사용 * 변수선언: 타입 변수명 * * main()이라는 메소드 내에서 선언된 변수는 * {}이 블럭을 벗어나는 순간 메모리에서 사라짐. * 메소드내에서 선언된 변수는 로컬변수라고 함. * 로컬변수는 메소드블럭{}을 벗어나는 순간 메모리에서 사라지므로 * 메소드 밖에서 사용할 수 없음. */ public class ByteExample { public static void main(String[] args) { // 변수의 선언 // 타입 변수명; 변수명 = 값; // 타입 변수명 = 값; byte var1 = -128; byte var2 = -30; byte var3 = 0; byte var4; var4 = 30; byte var5; var5 = 127; System.out.println("var1 = " + var1); System.out.println("var2 = " + var2); System.out.println("var3 = " + var3); System.out.println("var4 = " + var4); System.out.println("var5 = " + var5); } }
[ "jong1145@naver.com" ]
jong1145@naver.com
c2f0ca9d4cfc3f99bcdda7b20eedcde154333566
28ebe6f4c1c40f65ff1b0fe6f31f0f3219265279
/src/com/operators/SwappingTwoNumbers.java
625278f9d30f601141eae7a6ee9b2220632b06ce
[]
no_license
Vyshnavi565/vyshnavi-Day1
0be08d3df02bfd96c5506d973fe8c954e31a5b7e
5a28a0eb6c24768d518593a50e8ced456940a008
refs/heads/main
2023-07-05T05:05:19.339112
2021-08-23T11:31:49
2021-08-23T11:31:49
397,885,130
0
0
null
null
null
null
UTF-8
Java
false
false
405
java
package com.operators; import java.util.Scanner; public class SwappingTwoNumbers { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); System.out.println("First Input: "); int i=sc.nextInt(); System.out.println("Second Input: "); int j=sc.nextInt(); int k=i; i=j; j=k; System.out.println(i); System.out.println(j); } }
[ "vyshuchalasani2905@gmail.com" ]
vyshuchalasani2905@gmail.com
8e7a2c7a45937bdeae38970c7d01c4ad0dc6e140
9db8ff93c66e82bcc68667fa65cfc38da4b23415
/mix-auth/src/main/java/cn/liangjq/mix/auth/security/JWTAuthenticationEntryPoint.java
89b79ea4dd11e2a7e3f85bbc2bc176a3d70ea49b
[ "Apache-2.0" ]
permissive
fbljq5/mix
e6aec5008d9e497199eced51197adf96b8a512a0
e6d910205c2787dd1e94eaf9ae4093e52e1e7893
refs/heads/master
2023-06-07T20:46:04.433682
2021-06-20T22:32:54
2021-06-20T22:32:54
350,398,000
1
0
null
null
null
null
UTF-8
Java
false
false
883
java
package cn.liangjq.mix.auth.security; import com.alibaba.fastjson.JSONObject; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * @Description: 认证入口点 * @Author: liangjq * @Date: 2021/4/7 */ public class JWTAuthenticationEntryPoint implements AuthenticationEntryPoint { @Override public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException { response.setCharacterEncoding("utf-8"); response.setContentType("text/javascript;charset=utf-8"); response.getWriter().print(JSONObject.toJSONString("您没有访问权限")); } }
[ "420030650@qq.com" ]
420030650@qq.com
861e94f6543a192a9760bdbf141beb797bcf1c8b
5a7a5b6d2d3e5362a2fcd7d89a5f91ff9b192fa4
/ejerciciosInternet/src/ejerciciosInternet/_01.java
734c2df2c4abcef9ed8767575dd31d1816651803
[]
no_license
guillebort/fundamentos1
a4bf40ca76fb32b549e9e63c4051a7ca6285d308
781ecd6188c0ceb2bec1ade291cd1a0660433e75
refs/heads/master
2021-03-16T12:08:17.720537
2020-05-27T17:33:16
2020-05-27T17:33:16
246,905,123
0
0
null
null
null
null
UTF-8
Java
false
false
1,156
java
package ejerciciosInternet; import java.util.Scanner; public class _01 { public static void main(String[] args) { Scanner tec = new Scanner (System.in); int[] num = new int [10]; System.out.println("Introduce valores"); int valor1 = tec.nextInt(); num[0] = valor1; System.out.println(valor1 + " valor 0"); int valor2= tec.nextInt(); num[1] = valor2; System.out.println(valor2 + " valor 1"); int valor3= tec.nextInt(); num[2] = valor3; System.out.println(valor3 + " valor 2"); int valor4= tec.nextInt(); num[3] = valor4; System.out.println(valor4 + " valor 3"); int valor5= tec.nextInt(); num[4] = valor5; System.out.println(valor5 + " valor 4"); int valor6= tec.nextInt(); num[5] = valor6; System.out.println(valor6 + " valor 5"); int valor7= tec.nextInt(); num[6] = valor7; System.out.println(valor7 + " valor 6"); int valor8= tec.nextInt(); num[7] = valor8; System.out.println(valor8 + " valor 7"); int valor9= tec.nextInt(); num[8] = valor9; System.out.println(valor9 + " valor 8"); int valor10= tec.nextInt(); num[9] = valor10; System.out.println(valor10 + " valor 9"); } }
[ "User@DESKTOP-PERTML3" ]
User@DESKTOP-PERTML3
4ec7bf2fc49c17a19e27288144f7a20e69821087
0ab5b3e86ea65a9fb216e7178b3f8ae5fe6b3a1c
/mobile/taf/taf-java/src/com/qq/taf/proxy/utils/TimeoutNode.java
ce9a87efb6aff7b495ce4c06bd70f3344fc65fa0
[]
no_license
lineCode/mobile-1
197675bcde3d8db021c84858e276fc961b960643
66971911b57105b8ef5ad126b089b3fd1cc0f9b0
refs/heads/master
2020-03-29T11:02:22.037467
2017-02-13T09:40:59
2017-02-13T09:40:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
923
java
package com.qq.taf.proxy.utils; import com.qq.sim.Millis100TimeProvider; public final class TimeoutNode<K, V> { K key; V value; TimeoutNode<K, V> next; TimeoutNode<K, V> prev; long createTime; long aliveTime; TimeoutHandler<K,V> handler; TimeoutNode(K k, V v, TimeoutHandler<K,V> handler , long createTime,long aliveTime) { this.key = k; this.value = v; this.createTime = createTime; this.aliveTime = aliveTime; this.handler = handler; } public K getKey() { return key; } public V getValue() { return value; } public void setValue(V value) { createTime = Millis100TimeProvider.INSTANCE.currentTimeMillis(); this.value = value; } public long getCreateTime() { return createTime; } public void setCreateTime(long time) { createTime = time; } public long getAliveTime() { return aliveTime; } public void setAliveTime(long aliveTime) { this.aliveTime = aliveTime; } }
[ "zys0633@175game.com" ]
zys0633@175game.com
32b1ea7e7d708373018794f2d6f9792a8581d2fd
2d6f6b8df970ea126911ab96e415dbadc736ca5f
/dp/src/main/java/com/ok/example/dp/behavioral/strategy/StrategyClient.java
3cbe99920b18f33a7223dd58d088f247dca1528e
[]
no_license
suraj805kumar/project
9ae57988d356662a186fb18ce3790a7f9552cd05
f87fd254137c44e86864fbd33392996bd4cd48b6
refs/heads/master
2020-06-30T03:44:09.472782
2019-08-05T19:15:42
2019-08-05T19:15:42
200,713,638
0
0
null
null
null
null
UTF-8
Java
false
false
666
java
package com.ok.example.dp.behavioral.strategy; public class StrategyClient { public static void main(String[] args) { // setting Strategy Object inside the Context Object OperationManager om = new OperationManager(new AddOperation()); // perform the action System.out.println("12 + 22 = " + om.calculate(12, 22)); om = new OperationManager(new SubsOperation()); System.out.println("55 - 7 = " + om.calculate(55, 7)); om = new OperationManager(new MultiOperation()); System.out.println("44 * 78 = " + om.calculate(44,78)); om = new OperationManager(new DivOperation()); System.out.println("98 / 7 = " + om.calculate(98, 7)); } }
[ "suraj990kumar@gmail.com" ]
suraj990kumar@gmail.com
29cfa39793e4ee0c19b5265a362cbb1a166d2bfc
d4ad9d64f18bebe3fad83140ac45eb4c460cbbc6
/QLVLXD1/src/java/controller/searchOrderController.java
57968c57ef08fc6382a449d67a6bb1767d9c8881
[]
no_license
nguyenmanhsonbg/JavaWeb321Project
823766d8e95e431a77292eb5e4bad87949de4369
e2430a4a0b0b50a50db19d4dd5f752a4f5e1347a
refs/heads/master
2023-07-08T10:03:02.665276
2021-08-11T11:12:26
2021-08-11T11:12:26
394,959,902
0
0
null
null
null
null
UTF-8
Java
false
false
2,810
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 controller; import dal.OrderDAO; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import model.Order; /** * * @author Admin */ public class searchOrderController extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> /** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); String name = request.getParameter("customerName"); String from = request.getParameter("from"); String to = request.getParameter("to"); request.setAttribute("name", name); request.setAttribute("from", from); request.setAttribute("to", to); OrderDAO od = new OrderDAO(); ArrayList<Order> lstOrder = od.getAllOrders(name,from,to); request.setAttribute("listOrder", lstOrder); request.getRequestDispatcher("order.jsp").forward(request, response); } /** * Handles the HTTP <code>POST</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); } /** * Returns a short description of the servlet. * * @return a String containing servlet description */ @Override public String getServletInfo() { return "Short description"; }// </editor-fold> }
[ "you@example.com" ]
you@example.com
dc81c3727f7c53d4d5e37b566c2e69fdbfaaca37
2b2d7efc6ddd0bc6175c68c4d839e23da3278714
/src/main/java/com/mozss/basic/patterns/behavior/observe/second_demo/ConcreteSubject.java
60a1d0994f42aaf1cc0bf13027a0c225347de43a
[]
no_license
mozss/notes-java
440bac316bba57888cb1265ed87273b77f7dfc86
0f4e1e5b7e77fd9c72d7dc0925ba29c19fa17880
refs/heads/master
2023-01-07T10:37:00.001220
2020-11-08T14:55:56
2020-11-08T14:55:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
365
java
package com.mozss.basic.patterns.behavior.observe.second_demo; /** * @author mozss * @create 2019-10-28 15:08 */ public class ConcreteSubject extends Subject { private String state; /* * 调用这个方法更改主题的状态 * */ public void change(String newState) { state = newState; this.notifyObservers(); } }
[ "mozss1024@gmail.com" ]
mozss1024@gmail.com
bcf3b10f8bdeafaf2b345083c97b7d770e36577a
5cba56abc16530a0f962b30427c7902b5fc7ad5e
/Jathakamu4/src/main/java/mpp/jathakamu/beans/HouseInfo.java
48a8b83e92f773f94efbfdbd33cedd82caa272e3
[]
no_license
mphanip/Jathakam
521b24341ac5d8e1ee81af15db6594771ce22c52
5fef289deb9ab9c0866bd55b144323d8d2ce2f00
refs/heads/master
2022-07-25T02:55:19.286454
2022-07-06T05:10:53
2022-07-06T05:10:53
9,834,377
10
11
null
2022-07-06T05:00:46
2013-05-03T11:03:40
Java
UTF-8
Java
false
false
705
java
/* * Yet to decide on the license */ package mpp.jathakamu.beans; import java.io.Serializable; import mpp.jathakamu.types.HouseEntity; /** * * @author phani */ public interface HouseInfo extends Serializable { /** * House information * * @param housePosition * @return */ HouseEntity[] getHouseInfo(int housePosition); /** * To clear information */ void clearInformation(); /** * Add information to be displayed * * @param info */ void addInformation(String info); /** * The information will be display in the center panel * * @return */ String[] getInformation(); }
[ "phani.pramod@gmail.com" ]
phani.pramod@gmail.com
8cb44f1e0a83e32c0f7facebeaecc3fd24edf226
752769cdbde5709ec894e46509ea26d072f63860
/jsf-utils/src/main/java/com/jsf/utils/sdk/fdfs/proto/storage/internal/StorageDeleteFileRequest.java
4161a9d53ed79b58571889b92bde62b1022ea3cd
[ "BSD-3-Clause" ]
permissive
cjg208/JSF
dca375b472d16e2a7cb9ac56e939b63d60cc86cf
693041b6bb6a1b753d3be072c8ee7d879622e6b5
refs/heads/master
2023-01-01T08:39:47.925873
2020-10-27T08:35:08
2020-10-27T08:35:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,346
java
package com.jsf.utils.sdk.fdfs.proto.storage.internal; import com.jsf.utils.sdk.fdfs.proto.CmdConstants; import com.jsf.utils.sdk.fdfs.proto.FdfsRequest; import com.jsf.utils.sdk.fdfs.proto.OtherConstants; import com.jsf.utils.sdk.fdfs.proto.ProtoHead; import com.jsf.utils.sdk.fdfs.proto.mapper.DynamicFieldType; import com.jsf.utils.sdk.fdfs.proto.mapper.FdfsColumn; /** * 文件上传命令 * * @author tobato * */ public class StorageDeleteFileRequest extends FdfsRequest { /** 组名 */ @FdfsColumn(index = 0, max = OtherConstants.FDFS_GROUP_NAME_MAX_LEN) private String groupName; /** 路径名 */ @FdfsColumn(index = 1, dynamicField = DynamicFieldType.allRestByte) private String path; /** * 删除文件命令 * * @param groupName * @param path */ public StorageDeleteFileRequest(String groupName, String path) { super(); this.groupName = groupName; this.path = path; this.head = new ProtoHead(CmdConstants.STORAGE_PROTO_CMD_DELETE_FILE); } public String getGroupName() { return groupName; } public void setGroupName(String groupName) { this.groupName = groupName; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } }
[ "809573150@qq.com" ]
809573150@qq.com
c1ad0d36b6176d49b649864b7bf7ba7f2bce4cfd
dbd1048d4131f673dd6c459779afbbec5cf6fb0c
/baseframe/src/androidTest/java/com/ysq/android/utils/baseframe/ExampleInstrumentedTest.java
ca0579f8738c3bbeea067234a81c35c490d68b56
[ "Apache-2.0" ]
permissive
yshqing/BaseFrame
09ae4323288a873b5479826369da874f4f41e919
5577bd752ae84d435db49c57244cf8de7eb6f857
refs/heads/master
2020-05-29T15:15:52.941208
2018-07-09T05:59:37
2018-07-09T05:59:37
65,003,164
0
0
null
null
null
null
UTF-8
Java
false
false
766
java
package com.ysq.android.utils.baseframe; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.ysq.android.utils.baseframe", appContext.getPackageName()); } }
[ "340711340@qq.com" ]
340711340@qq.com
4c8a2696fbc6275b30cd9b802811d0781a429bcc
0d049300c2d54032e352115b68360d2bc819e4c0
/src/LinkedList/LinkedList.java
3a21f43c74f82153726225086300584b074ebeef
[]
no_license
MadhaviPothuganti/CoreJava
464d3faeb794a87945ad3c2351e872d74482bb22
462210b8769b72a5d0c56ed8402b619d213f02a7
refs/heads/master
2020-03-25T15:31:38.893532
2018-08-07T23:26:21
2018-08-07T23:26:21
143,887,458
0
0
null
2018-08-07T23:26:22
2018-08-07T14:46:03
Java
UTF-8
Java
false
false
480
java
package LinkedList; public class LinkedList { Node head; public void insert(int data) { Node node = new Node(); node.data = data; node.next = null; if( head==null) { head = node; }else { Node n = head; while(n.next!=null) { n = n.next; } n.next = node; } } public void show() { Node node = head; while(node.next!=null) { System.out.println(node.data); node = node.next; } System.out.println(node.next); } }
[ "madhavi.pothuganti@sap.com" ]
madhavi.pothuganti@sap.com
641daf7a293551dd8f0e89ea8d0e7f73a0c13543
25af7adcfebd4c8e72f63e413babb9612470acf6
/app/src/main/java/com/example/islamgsayed/firstapp/pillapp/ViewController/adapter/TabsAdapter.java
b4a49e1554b3dafc0ff5c918c70bf5d2703d7585
[]
no_license
islamgamaloff/Pharma
5331f3189f2b75df8c39717711c6c7b02407ca97
a0fb9a7f91d87fc92cff348325abb6bf123d9a85
refs/heads/master
2020-09-20T12:04:38.445268
2019-11-27T16:47:17
2019-11-27T16:47:17
224,471,098
1
0
null
null
null
null
UTF-8
Java
false
false
1,313
java
package com.example.islamgsayed.firstapp.pillapp.ViewController.adapter; /** * Created by Qinghao on 3/11/2015. */ import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import com.example.islamgsayed.firstapp.pillapp.ViewController.HistoryFragment; import com.example.islamgsayed.firstapp.pillapp.ViewController.TodayFragment; import com.example.islamgsayed.firstapp.pillapp.ViewController.TomorrowFragment; /** * This fragment is based on the code at * http://www.feelzdroid.com/2014/10/android-action-bar-tabs-swipe-views.html * * This is a customized fragment pager adapter that handles the controller of * the swipe tabs we use in the main page/activity. */ public class TabsAdapter extends FragmentPagerAdapter { private int TOTAL_TABS = 3; public TabsAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int index) { switch (index) { case 0: return new HistoryFragment(); case 1: return new TodayFragment(); case 2: return new TomorrowFragment(); } return null; } @Override public int getCount() { return TOTAL_TABS; } }
[ "islam.gamal.sayed@hotamil.com" ]
islam.gamal.sayed@hotamil.com
bb25eb971fcd4bf083700dac22f103d3494f29ac
f569418cee5d085fed72fde9d3181320e20bc3ac
/app/src/androidTest/java/com/example/shivamkumar/synocare/ExampleInstrumentedTest.java
9483715d61f1ebc826d95436cbd54cef625d8121
[]
no_license
shivam-kmr/HealthCare_Project_AndroidApp
4562650925005d5a4aeea03a4a56abfdd738d3b8
0cf58e341e9aba11aea4ea70d7b6047453a545b8
refs/heads/master
2020-03-28T20:31:47.215107
2018-09-17T06:53:19
2018-09-17T06:53:19
149,079,036
0
1
null
null
null
null
UTF-8
Java
false
false
748
java
package com.example.shivamkumar.synocare; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.shivamkumar.synocare", appContext.getPackageName()); } }
[ "shivam.kumar@live.in" ]
shivam.kumar@live.in
1095d3635cb6ca6fb79cdf260dd28cf7bac27a8c
74aec2865bfacb7cd533601612aa3e15012dce45
/Java/src/Java.java
e4d5d14b3c808a2771358b5a0420ab1f855ac51e
[]
no_license
sanjay-nag/CMPE273-RefresherHomework
8bd769859f1bda5122d5ed8f532b291496c7656f
5f3528901d99f97cfc134e61bca7edcbd01e0cb5
refs/heads/master
2020-04-21T19:49:17.149744
2019-02-25T19:31:05
2019-02-25T19:31:05
169,820,928
0
0
null
null
null
null
UTF-8
Java
false
false
176
java
public class Java implements DisplaySyntax{ @Override public String displayToScreen() { String syntax = "System.out.println()"; return syntax; } }
[ "sanjaynag.bangaloreravishankar@sjsu.edu" ]
sanjaynag.bangaloreravishankar@sjsu.edu
e4ecb1ac904ba03f66aafaaaef94e0a9db4912f1
a245569e5f05965928ad942de22c1b14239b0e77
/app/src/main/java/a4everstudent/sunshine/MainActivity.java
6fe2bf39c7bb3ff050e193f21ddeedefbf959878
[]
no_license
4everstudent/Sunshine-Udacity
e17f899c4d51fdde621da678943c5829e793449c
43a0825eeaa2a2716c8f43cc782916463368d167
refs/heads/master
2021-01-17T10:33:03.684381
2016-06-10T12:11:58
2016-06-10T12:11:58
59,283,681
0
0
null
null
null
null
UTF-8
Java
false
false
2,773
java
package a4everstudent.sunshine; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends AppCompatActivity { private final String LOG_TAG = MainActivity.class.getSimpleName(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new ForecastFragment()) .commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { startActivity(new Intent(this, SettingsActivity.class)); return true; } if (id == R.id.action_map){ openPreferredLocationMap(); return true; } return super.onOptionsItemSelected(item); } private void openPreferredLocationMap() { SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); String location = sharedPrefs.getString( getString(R.string.pref_location_key), getString(R.string.pref_location_default)); //Using the URI scheme for showing a location found on a map. This super-handy intent can is //detailed in the "Common Intents" page of Android's developer site: //http://developer.android.com/guide/components/intents-common.html#Maps Uri geoLocation = Uri.parse("geo:0,0").buildUpon() .appendQueryParameter("q", location) .build(); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(geoLocation); if(intent.resolveActivity(getPackageManager())!= null) { startActivity(intent); } else{ Log.d(LOG_TAG, "Couldn't call" + location+", no receiving apps installed!"); } } }
[ "mail@4everstudent.com" ]
mail@4everstudent.com
35e2f992a2832f148e54868b3105a108b82fc0ac
06a358e82d634b640c3a21c16bae6c808a03da1b
/PanelModificarCliente.java
c6dec676b4f73854879a504b0088c0b5b0a9299b
[]
no_license
juancruz1990/VidaVerde
69d29f659d9210af83088b08005433653fbbc493
b8826feb41323859f3343512a84554d5462ca366
refs/heads/master
2021-09-01T20:21:08.602062
2017-12-28T15:33:42
2017-12-28T15:33:42
115,442,168
0
0
null
null
null
null
UTF-8
Java
false
false
4,531
java
import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; public class PanelModificarCliente extends JPanel { private JTextField caja1; private JTextField caja2; private JTextField caja3; private JTextField caja4; private JTextField caja5; public PanelModificarCliente(JFrame frame, Cliente cliente, int identy) { super(); iniciarVentana(frame, cliente, identy); } private void cerrarPanel() { this.setVisible(false); } public void iniciarVentana(JFrame frame, Cliente cliente, int identy) { JPanel panel2 = new JPanel(); panel2.setBounds(50, 50, 700, 370); panel2.setBackground(Color.ORANGE); JButton boton1 = new JButton(); JButton boton2 = new JButton(); JLabel textoNombre = new JLabel(); JLabel textoApellido = new JLabel(); JLabel textoDni = new JLabel(); JLabel textoLocalidad = new JLabel(); JLabel textoDireccion = new JLabel(); JLabel texto = new JLabel(); texto.setText("MODIFICAR CLIENTE"); texto.setFont(new java.awt.Font("Times New Roman", 0, 30)); texto.setBounds(12, 0, 500, 40); this.add(texto); caja1 = new JTextField(); caja2 = new JTextField(); caja3 = new JTextField(); caja4 = new JTextField(); caja5 = new JTextField(); this.setLayout(null); textoNombre.setText("Nombre"); textoNombre.setBounds(250, 90, 150, 50); textoNombre.setFont(new java.awt.Font("Times New Roman", 0, 20)); caja1.setBounds(340, 100, 150, 30); textoApellido.setText("Apellido"); textoApellido.setFont(new java.awt.Font("Times New Roman", 0, 20)); textoApellido.setBounds(250, 130, 150, 50); caja2.setBounds(340, 140, 150, 30); textoDni.setText("Dni"); textoDni.setBounds(250, 170, 150, 50); textoDni.setFont(new java.awt.Font("Times New Roman", 0, 20)); caja3.setBounds(340, 180, 150, 30); textoDireccion.setText("Direccion"); textoDireccion.setBounds(250, 210, 150, 50); textoDireccion.setFont(new java.awt.Font("Times New Roman", 0, 20)); caja4.setBounds(340, 220, 150, 30); textoLocalidad.setText("Localidad"); textoLocalidad.setBounds(250, 250, 150, 50); textoLocalidad.setFont(new java.awt.Font("Times New Roman", 0, 20)); caja5.setBounds(340, 260, 150, 30); Cliente miCliente = new Cliente(); ArrayList<Cliente> miLista = miCliente.buscarClienteId(identy); if (miLista.size() > 0) { caja1.setText(miLista.get(0).getNombre()); caja2.setText(miLista.get(0).getApellido()); Integer.toString(miLista.get(0).getDni()); caja3.setText(Integer.toString(miLista.get(0).getDni())); caja4.setText(miLista.get(0).getLocalidad()); caja5.setText(miLista.get(0).getDireccion()); } boton1.setText("MODIFICAR CLIENTE"); boton1.setBackground(Color.LIGHT_GRAY); boton1.setForeground(Color.DARK_GRAY); boton1.setFont(new java.awt.Font("Times New Roman", 0, 20)); boton1.setBounds(230, 310, 300, 50); boton2.setText("VOLVER"); boton2.setBackground(Color.LIGHT_GRAY); boton2.setForeground(Color.DARK_GRAY); boton2.setFont(new java.awt.Font("Times New Roman", 0, 20)); boton2.setBounds(300, 370, 150, 50); this.add(textoNombre); this.add(textoApellido); this.add(textoDni); this.add(textoLocalidad); this.add(textoDireccion); this.add(caja1); this.add(caja2); this.add(caja3); this.add(caja4); this.add(caja5); this.add(boton1); this.add(boton2); this.add(panel2); frame.add(this); boton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Cliente persona = new Cliente(); int dni = Integer.parseInt(caja3.getText()); persona.setIdCliente(identy); persona.setNombre(caja1.getText()); persona.setApellido(caja2.getText()); persona.setDni(dni); persona.setLocalidad(caja4.getText()); persona.setDireccion(caja5.getText()); persona.modificaCliente(persona); PanelMenuCliente menuCliente = new PanelMenuCliente(frame); cerrarPanel(); frame.add(menuCliente); } }); boton2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { PanelMenuCliente modificarCliente = new PanelMenuCliente(frame); cerrarPanel(); frame.add(modificarCliente); } }); } }
[ "noreply@github.com" ]
juancruz1990.noreply@github.com
7bea2dd1c4c605e4ee966ed68037ffb9ff011dfa
4a8bf6cc24934d986084fac73ada9d632ccedc96
/src/main/java/com/cdiscount/www/GetOrderQuestionListDocument.java
66f931f53dc26cef095dac2f30a94516a66641ea
[]
no_license
myccnice/cdiscount-java-sdk
c96a13248e22d883db857dff922a59f0c6811eac
7ecba352924077cf9f923750bb6969be6d356dd4
refs/heads/master
2020-03-25T22:48:38.285488
2018-08-22T12:44:29
2018-08-22T12:44:29
144,243,504
0
0
null
2018-08-10T06:03:10
2018-08-10T06:03:09
null
UTF-8
Java
false
false
12,323
java
/* * An XML document type. * Localname: GetOrderQuestionList * Namespace: http://www.cdiscount.com * Java type: com.cdiscount.www.GetOrderQuestionListDocument * * Automatically generated - do not modify. */ package com.cdiscount.www; /** * A document containing one GetOrderQuestionList(@http://www.cdiscount.com) element. * * This is a complex type. */ public interface GetOrderQuestionListDocument extends org.apache.xmlbeans.XmlObject { public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType) org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(GetOrderQuestionListDocument.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.s299C95E2D55508F813FE05B50BDB21D0").resolveHandle("getorderquestionlist87b9doctype"); /** * Gets the "GetOrderQuestionList" element */ com.cdiscount.www.GetOrderQuestionListDocument.GetOrderQuestionList getGetOrderQuestionList(); /** * Sets the "GetOrderQuestionList" element */ void setGetOrderQuestionList(com.cdiscount.www.GetOrderQuestionListDocument.GetOrderQuestionList getOrderQuestionList); /** * Appends and returns a new empty "GetOrderQuestionList" element */ com.cdiscount.www.GetOrderQuestionListDocument.GetOrderQuestionList addNewGetOrderQuestionList(); /** * An XML GetOrderQuestionList(@http://www.cdiscount.com). * * This is a complex type. */ public interface GetOrderQuestionList extends org.apache.xmlbeans.XmlObject { public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType) org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(GetOrderQuestionList.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.s299C95E2D55508F813FE05B50BDB21D0").resolveHandle("getorderquestionlistd3d1elemtype"); /** * Gets the "headerMessage" element */ org.datacontract.schemas._2004._07.cdiscount_framework_core_communication_messages.HeaderMessage getHeaderMessage(); /** * Tests for nil "headerMessage" element */ boolean isNilHeaderMessage(); /** * True if has "headerMessage" element */ boolean isSetHeaderMessage(); /** * Sets the "headerMessage" element */ void setHeaderMessage(org.datacontract.schemas._2004._07.cdiscount_framework_core_communication_messages.HeaderMessage headerMessage); /** * Appends and returns a new empty "headerMessage" element */ org.datacontract.schemas._2004._07.cdiscount_framework_core_communication_messages.HeaderMessage addNewHeaderMessage(); /** * Nils the "headerMessage" element */ void setNilHeaderMessage(); /** * Unsets the "headerMessage" element */ void unsetHeaderMessage(); /** * Gets the "orderQuestionFilter" element */ com.cdiscount.www.OrderQuestionFilter getOrderQuestionFilter(); /** * Tests for nil "orderQuestionFilter" element */ boolean isNilOrderQuestionFilter(); /** * True if has "orderQuestionFilter" element */ boolean isSetOrderQuestionFilter(); /** * Sets the "orderQuestionFilter" element */ void setOrderQuestionFilter(com.cdiscount.www.OrderQuestionFilter orderQuestionFilter); /** * Appends and returns a new empty "orderQuestionFilter" element */ com.cdiscount.www.OrderQuestionFilter addNewOrderQuestionFilter(); /** * Nils the "orderQuestionFilter" element */ void setNilOrderQuestionFilter(); /** * Unsets the "orderQuestionFilter" element */ void unsetOrderQuestionFilter(); /** * A factory class with static methods for creating instances * of this type. */ public static final class Factory { public static com.cdiscount.www.GetOrderQuestionListDocument.GetOrderQuestionList newInstance() { return (com.cdiscount.www.GetOrderQuestionListDocument.GetOrderQuestionList) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); } public static com.cdiscount.www.GetOrderQuestionListDocument.GetOrderQuestionList newInstance(org.apache.xmlbeans.XmlOptions options) { return (com.cdiscount.www.GetOrderQuestionListDocument.GetOrderQuestionList) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); } private Factory() { } // No instance of this class allowed } } /** * A factory class with static methods for creating instances * of this type. */ public static final class Factory { public static com.cdiscount.www.GetOrderQuestionListDocument newInstance() { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); } public static com.cdiscount.www.GetOrderQuestionListDocument newInstance(org.apache.xmlbeans.XmlOptions options) { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); } /** @param xmlAsString the string value to parse */ public static com.cdiscount.www.GetOrderQuestionListDocument parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, null ); } public static com.cdiscount.www.GetOrderQuestionListDocument parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, options ); } /** @param file the file from which to load an xml document */ public static com.cdiscount.www.GetOrderQuestionListDocument parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, null ); } public static com.cdiscount.www.GetOrderQuestionListDocument parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, options ); } public static com.cdiscount.www.GetOrderQuestionListDocument parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); } public static com.cdiscount.www.GetOrderQuestionListDocument parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); } public static com.cdiscount.www.GetOrderQuestionListDocument parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); } public static com.cdiscount.www.GetOrderQuestionListDocument parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); } public static com.cdiscount.www.GetOrderQuestionListDocument parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); } public static com.cdiscount.www.GetOrderQuestionListDocument parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); } public static com.cdiscount.www.GetOrderQuestionListDocument parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, null ); } public static com.cdiscount.www.GetOrderQuestionListDocument parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, options ); } public static com.cdiscount.www.GetOrderQuestionListDocument parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); } public static com.cdiscount.www.GetOrderQuestionListDocument parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); } /** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */ public static com.cdiscount.www.GetOrderQuestionListDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); } /** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */ public static com.cdiscount.www.GetOrderQuestionListDocument parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { return (com.cdiscount.www.GetOrderQuestionListDocument) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); } /** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); } /** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */ public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException { return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); } private Factory() { } // No instance of this class allowed } }
[ "develop.api@qq.com" ]
develop.api@qq.com
11078d311cf56d8e895809ec981a3b3990319562
841ec7d8ab0b7bf6ff703ee4a6226ca269bdddf3
/src/site/resources/ex/UserAdminEventBus.java
5f529b648874a2e2eb41bf4720b54aa943fdf4e2
[]
no_license
panterch/org.vaadin.mvp
9d7e5a462b4737fcb6fce4537ccca7c01137b71e
acb808c977574ec506d767f166d2087097ef1943
refs/heads/master
2021-07-03T20:06:38.387794
2012-09-17T21:41:31
2012-09-17T21:41:31
907,274
4
4
null
2021-06-07T18:11:01
2010-09-13T14:14:41
Java
UTF-8
Java
false
false
655
java
package com.example.useradmin; import org.vaadin.mvp.eventbus.EventBus; import org.vaadin.mvp.eventbus.annotation.Event; import com.example.main.MainPresenter; import com.vaadin.ui.Window; public interface UserAdminEventBus extends EventBus { @Event(handlers = { UserAdminPresenter.class }) public void createUser(); @Event(handlers = { UserAdminPresenter.class }) public void removeUser(); @Event(handlers = { MainPresenter.class }) public void showDialog(Window dialog); @Event(handlers = { UserAdminPresenter.class }) public void saveUser(); @Event(handlers = { UserAdminPresenter.class }) public void cancelEditUser(); }
[ "tam@mikatosh.panter.local" ]
tam@mikatosh.panter.local
9ae14bc6be117f77e704363ddc1242e446b88eb9
2bf44281da43f37aedaa497520140f2b8e57f549
/java/com/example/login/statActivity.java
7f14f2b3173f8e9e4401d35d0172ff27ad1cffcb
[]
no_license
subhankar-Riju/and
4d3490ed3b2d0c03a59b2de0266752d569e34710
7d8887623f52755c9ead81d73d489d33bb7b737b
refs/heads/main
2023-04-18T20:43:07.082849
2021-04-22T15:37:36
2021-04-22T15:37:36
326,356,344
0
0
null
null
null
null
UTF-8
Java
false
false
10,980
java
package com.example.login; import androidx.appcompat.app.AppCompatActivity; import android.database.Cursor; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.Spinner; import android.widget.Toast; import com.github.mikephil.charting.charts.BarChart; import com.github.mikephil.charting.data.BarData; import com.github.mikephil.charting.data.BarDataSet; import com.github.mikephil.charting.data.BarEntry; import com.github.mikephil.charting.utils.ColorTemplate; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map; public class statActivity extends AppCompatActivity { Button st_btn,dist_btn,bo_btn,finalcon_btn,click; String district_name,state_name,crime_name,yr; Spinner sp_state,sp_dist,sp_bo,sp_final; state_dist_array state_dist_array=new state_dist_array(); double[] y=new double[14]; DatabaseAccess databaseAccess; String dist[]; String crime[]={"Rape", "Kidnapping and Abduction", "Dowry Deaths", "Assault on women with intent to outrage her modesty", "Insult to modesty of Women", "Cruelty by Husband or his Relatives", "Importation of Girls", "TotalCrime"}; String year[]={"2001","2002","2003","2004","2005","2006","2007","2008","2009","2010","2011","2012","2013","2014"}; String state[]={"A & N ISLANDS","ANDHRA PRADESH","ARUNACHAL PRADESH","ASSAM","BIHAR","CHANDIGARH","CHHATTISGARH","PONDICHERRY","DAMAN & DIU","D & N HAVELI","GOA","GUJARAT","HARYANA","HIMACHAL PRADESH","JAMMU & KASHMIR","KARNATAKA","KERALA","LAKSHADWEEP","MADHYA PRADESH","MAHARASHTRA","MANIPUR","MEGHALAYA","MIZORAM","NAGALAND","ODISHA","PUNJAB","RAJASTHAN","SIKKIM","TAMIL NADU","TRIPURA","UTTAR PRADESH","UTTARAKHAND","WEST BENGAL"}; String bo[]={"crime","year"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_stat); //Button st_btn=(Button)findViewById(R.id.btn_stat_state); dist_btn=(Button)findViewById(R.id.btn_stat_dist); bo_btn=(Button)findViewById(R.id.btn_stat_bo); finalcon_btn=(Button)findViewById(R.id.btn_stat_finalcon); click=(Button)findViewById(R.id.btn_st_click); final BarChart barChart = (BarChart) findViewById(R.id.barchart); //spinner sp_state=(Spinner)findViewById(R.id.sp_stat_st); sp_dist=(Spinner)findViewById(R.id.sp_stat_dist); sp_bo=(Spinner)findViewById(R.id.sp_stat_bo); sp_final=(Spinner)findViewById(R.id.sp_stat_final); //spinner state ArrayList<String> arrayList_state=new ArrayList<>(Arrays.asList(state)); final ArrayAdapter<String> arrayAdapter_state=new ArrayAdapter<>(this,R.layout.support_simple_spinner_dropdown_item,arrayList_state); sp_state.setAdapter(arrayAdapter_state); sp_state.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, final int position, long id) { call1(); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); //Button state confirm st_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { call1(); } }); //spinner for based on ArrayList<String> arrayList_bo=new ArrayList<>(Arrays.asList(bo)); final ArrayAdapter<String> arrayAdapter_bo=new ArrayAdapter<>(this,R.layout.support_simple_spinner_dropdown_item,arrayList_bo); sp_bo.setAdapter(arrayAdapter_bo); sp_bo.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, final int position, long id) { call3(); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); //button based on bo_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { call3(); } }); //final confirm finalcon_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { call3(); } }); //click click.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(yr.equals("")){ databaseAccess=DatabaseAccess.getInstance(getApplicationContext()); databaseAccess.open(); Cursor cursor=databaseAccess.getAddress(state_name,district_name,"Total Crime"); int i=0; ArrayList<BarEntry> entries = new ArrayList<>(); while(cursor.moveToNext()){ while(i<=13){ entries.add(new BarEntry(cursor.getInt(i+2), i)); i++; } } //Toast.makeText(getApplicationContext(),cursor.getColumnNames().toString(),Toast.LENGTH_SHORT).show(); BarDataSet bardataset = new BarDataSet(entries, "Cells"); ArrayList<String> labels = new ArrayList<String>(); for(int j=0;j<=13;j++){ String s=""; s=s+(2001+j); labels.add(s); s=""; } BarData data = new BarData(labels, bardataset); barChart.setData(data); // set the data and list of labels into chart barChart.setDescription("Set Bar Chart Description Here"); // set the description bardataset.setColors(ColorTemplate.COLORFUL_COLORS); barChart.animateY(5000); cursor.close(); databaseAccess.close(); } // yr got //run recursive querry to fetch the crime numbers gainsty the yr else { databaseAccess = DatabaseAccess.getInstance(getApplicationContext()); databaseAccess.open(); ArrayList<BarEntry> entries = new ArrayList<>(); for (int i = 0; i < crime.length; i++) { Cursor cursor = databaseAccess.getAddress2(yr, crime[i], state_name, district_name); /* while (cursor.moveToNext()) { Toast.makeText(getApplicationContext(), crime[i], Toast.LENGTH_SHORT).show(); entries.add(new BarEntry(cursor.getInt(0), i)); }*/ } /* BarDataSet bardataset = new BarDataSet(entries, "Cells"); ArrayList<String> labels = new ArrayList<String>(); for(int j=0;j<=13;j++){ String s=""; s=s+(2001+j); labels.add(s); s=""; } BarData data = new BarData(labels, bardataset); barChart.setData(data); // set the data and list of labels into chart barChart.setDescription("Set Bar Chart Description Here"); // set the description bardataset.setColors(ColorTemplate.COLORFUL_COLORS); barChart.animateY(5000); Toast.makeText(getApplicationContext(),entries.toString(),Toast.LENGTH_LONG).show(); */ } } }); } public void call1(){ dist=state_dist_array.select(sp_state.getSelectedItem().toString()); state_name=sp_state.getSelectedItem().toString(); dis_dist(dist); } public void dis_dist(String[] dist){ ArrayList<String> arrayList=new ArrayList<>(Arrays.asList(dist)); final ArrayAdapter<String> arrayAdapter=new ArrayAdapter<>(this,R.layout.support_simple_spinner_dropdown_item,arrayList); sp_dist.setAdapter(arrayAdapter); sp_dist.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { call2(); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); } public void call2(){ district_name=sp_dist.getSelectedItem().toString(); } public void call3(){ if(sp_bo.getSelectedItem().toString().equals("crime")){ ArrayList<String> arrayList = new ArrayList<>(Arrays.asList(crime)); final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, arrayList); sp_final.setAdapter(arrayAdapter); sp_final.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { call4(); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); } else{ ArrayList<String> arrayList = new ArrayList<>(Arrays.asList(year)); final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(this, R.layout.support_simple_spinner_dropdown_item, arrayList); sp_final.setAdapter(arrayAdapter); sp_final.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { // call2(); call5(); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); } } public void call4(){ crime_name=sp_final.getSelectedItem().toString(); yr=""; } public void call5(){ yr=sp_final.getSelectedItem().toString(); crime_name=""; } }
[ "noreply@github.com" ]
subhankar-Riju.noreply@github.com
156ee8803e3892d7ebbdfe5329f2382d94eecdf5
3749f493ff14efe68d9948d2672c4088b5e39099
/Lecture/210628-JavaPrimer/java-environment/day6/src/animal/LaysEggs.java
527eb323a925d291cd7a6d7473dc935dac699b57
[]
no_license
khalerev/rev2week
8914b9052fffa7a9aaeaa56512df4820219a3f36
c00539bb5166a9788219c9645431d23d84524be6
refs/heads/main
2023-06-29T06:51:17.911041
2021-08-02T04:30:53
2021-08-02T04:30:53
382,074,972
0
0
null
null
null
null
UTF-8
Java
false
false
463
java
package animal; public interface LaysEggs { /* * When you create a method in an interface, it is implicitly * public and abstract * * If you want to provide a definition for a method in * an interface, you must use the 'default' keyword * * It is not encouraged to use the 'default' keyword in * an interface, but we do have the ability to do so */ public default void LayEgg() { System.out.println("Laid an Egg - Interface Level"); } }
[ "kha.le@revature.net" ]
kha.le@revature.net
5976e33286e1a186ceff924f1e47849f4d59a706
b812b4685af9f4aa8dbf5700842b082f315c0b8e
/TheClinic/shared-kernel/src/main/java/mk/finki/ukim/dipl/sharedkernel/sharedkernel/domain/config/TopicHolder.java
d357e1454261e6bbb400523e04d377dcb1296d0f
[]
no_license
stolick/TheClinic
7c28e606c3714254afd3ef417855af4576d02eff
30d24d57f9d703878f9277d1a2b446492f648689
refs/heads/master
2023-06-10T20:45:05.885826
2021-07-03T19:34:01
2021-07-03T19:34:01
370,790,505
0
0
null
null
null
null
UTF-8
Java
false
false
152
java
package mk.finki.ukim.dipl.sharedkernel.sharedkernel.domain.config; public class TopicHolder { public final static String TOPIC = "some-topic"; }
[ "kristina.stolic@sorsix.com" ]
kristina.stolic@sorsix.com
84e70fa9e20f8d2b655332edbae2d8ca36a2c43b
c35c677d613523135209f50eabc23aae694f716c
/workspace/11_jdbc/src/main/StaffManger.java
058a82248d7eb31864efa96b3700a5e62e9c203f
[]
no_license
ha-taeyeong/javastudy
eb15daabe8dbb6270fa03e676d996f7db14fda88
6850aa23bda51a6de8c0353fe03a70d337ba8e5e
refs/heads/main
2023-03-24T00:30:40.564387
2021-03-30T08:23:12
2021-03-30T08:23:12
347,885,802
0
0
null
null
null
null
UTF-8
Java
false
false
3,188
java
package main; import java.util.List; import java.util.Scanner; import dao.StaffDao; import dto.StaffDto; public class StaffManger { // field private StaffDao dao = StaffDao.getInstance(); private Scanner sc = new Scanner(System.in); // method public void menu() { System.out.println("=====사원관리프로그램====="); System.out.println("1. 사원 등록"); System.out.println("2. 정보 수정"); System.out.println("3. 퇴사 처리"); System.out.println("4. 사원 조회"); System.out.println("5. 전체 조회"); System.out.println("6. 프로그램 종료"); System.out.println("======================"); } public void execute() { while(true) { menu(); System.out.print("선택(1~6) >>>"); switch (sc.nextInt()) { case 1: insertStaff(); break; case 2: updateStaff(); break; case 3: deleteStaff(); break; case 4: selectOne(); break; case 5: selectList(); break; case 6: System.out.println("프로그램을 종료합니다."); return; default: System.out.println("다시 선택하세요."); } } } public void insertStaff() { System.out.print("신규 사원 이름 >>> "); String name = sc.next(); System.out.print("신규 부서 이름 >>> "); String department = sc.next(); StaffDto staffDto = new StaffDto(); int no = dao.selectMaxNo(); staffDto.setNo(no + 1); staffDto.setName(name); staffDto.setDepartment(department); int result = dao.insertStaff(staffDto); System.out.println(result + "명의 사원이 추가되었습니다."); } public void updateStaff() { System.out.print("수정할 사원 번호 입력 >>> "); int no = sc.nextInt(); StaffDto staffDto = dao.selectOneByNo(no); System.out.println("수정할 내용을 선택하세요.(1:이름, 2:부서) >>> "); int choice = sc.nextInt(); if (choice == 1) { System.out.print("새로운 사원 이름 입력 >>> "); String name = sc.next(); staffDto.setName(name); } else if (choice == 2) { System.out.print("새로운 부서 이름 입력 >>> "); String department = sc.next(); staffDto.setDepartment(department); } else { System.out.println("잘못된 선택입니다. 수정이 취소됩니다."); return; } int result = dao.updateStaff(staffDto); System.out.println(result + "명의 사원정보가 수정되었습니다."); } public void deleteStaff() { System.out.print("삭제할 사원 번호 입력 >>> "); int no = sc.nextInt(); StaffDto staffDto = new StaffDto(); staffDto.setNo(no); int result = dao.deleteStaff(staffDto); System.out.println(result + "명의 사원이 삭제되었습니다."); } public void selectOne() { System.out.print("조회할 사원 번호 입력 >>> "); int no = sc.nextInt(); StaffDto staffDto = dao.selectOneByNo(no); if (staffDto == null) { System.out.println("사원 번호 " + no + "를 가진 사원이 없습니다."); } else { System.out.println(staffDto); } } public void selectList() { List<StaffDto> staffList = dao.selectList(); System.out.println("총 사원 수: " + staffList.size() + "명"); for (StaffDto staffDto : staffList) { System.out.println(staffDto); } } }
[ "electro0218@gmail.com" ]
electro0218@gmail.com
b9ba597fc4575d48fe3649cb859163ac24e699f0
5a78ee08fbd19be65f35c46062075b033de37b85
/app/src/main/java/com/tushar/own/myexpensemonitor/activities/MainActivity.java
15beb70a3b01b60dea042f9f5f5255ea8fee4e1c
[]
no_license
tusharpramanikbd/my-expense-monitor
48beb9e276966a8ab3d3569fc477ac28c1dda0cb
d28391b059c3db23124efa8adebc4d5e9b27d8f0
refs/heads/master
2022-07-12T01:29:41.692251
2020-05-13T14:49:20
2020-05-13T14:49:20
263,628,965
0
0
null
null
null
null
UTF-8
Java
false
false
7,328
java
package com.tushar.own.myexpensemonitor.activities; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.viewpager.widget.ViewPager; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import com.google.android.material.bottomnavigation.BottomNavigationView; import com.tushar.own.myexpensemonitor.R; import com.tushar.own.myexpensemonitor.adapters.ViewPagerAdapter; import com.tushar.own.myexpensemonitor.fragments.AddExpenseFragment; import com.tushar.own.myexpensemonitor.fragments.ChartFragment; import com.tushar.own.myexpensemonitor.fragments.HistoryFragment; import com.tushar.own.myexpensemonitor.listeners.SettingsButtonClickListener; import com.tushar.own.myexpensemonitor.services.SettingsChangedServices; import com.tushar.own.myexpensemonitor.services.SharedPreferenceServices; import com.tushar.own.myexpensemonitor.services.ViewPagerPageChangedServices; import com.tushar.own.myexpensemonitor.utils.MyAlertDialog; public class MainActivity extends AppCompatActivity { private BottomNavigationView bottomNavigationView; private Toolbar toolbar; private ViewPager viewPager; private MenuItem prevMenuItem; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); SharedPreferenceServices.getInstance().setActivity(this); //Initializing all the UI element initializeUI(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.popup_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.item_about){ MyAlertDialog.showAboutAlertDialog(this, this); } else if (id == R.id.item_settings){ MyAlertDialog.showSettingsAlertDialog( SharedPreferenceServices.getInstance().getExpenseLimit(), SharedPreferenceServices.getInstance().getExpenseCurrency(), this, this, new SettingsButtonClickListener() { @Override public void onSettingsButtonClicked(String dailyLimit, String currency) { SharedPreferenceServices.getInstance().setLimitAndCurrency(dailyLimit, currency); SettingsChangedServices.getInstance().changeExpenseTextColor(); } } ); } else if (id == android.R.id.home){ finish(); } return super.onOptionsItemSelected(item); } /** * This method is used to initialize all the view element and event listener. */ private void initializeUI() { initBottomNavigationView(); initToolbar(); initViewPager(); } /** * This method is used to initialize the bottom navigation view * and it's on click listener. */ private void initBottomNavigationView(){ //Initializing the bottom navigation bar bottomNavigationView = findViewById(R.id.bottom_navigation); //Handling bottom navigation icon select bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { switch (item.getItemId()) { case R.id.menu_charts: viewPager.setCurrentItem(0); toolbar.setTitle(getResources().getString(R.string.charts)); return true; case R.id.menu_add_expense: viewPager.setCurrentItem(1); toolbar.setTitle(getResources().getString(R.string.add_expense)); return true; case R.id.menu_history: viewPager.setCurrentItem(2); toolbar.setTitle(getResources().getString(R.string.history)); return true; } return false; } }); } /** * This method is used to initialize the toolbar with title and back button. */ private void initToolbar(){ //Initializing the toolbar toolbar = findViewById(R.id.toolbar); //setting the title toolbar.setTitle(getResources().getString(R.string.add_expense)); //placing toolbar in place of actionbar setSupportActionBar(toolbar); // add back arrow to toolbar if (getSupportActionBar() != null){ getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); } } /** * This method is used to initialize the viewpager with the created fragments object * and set the @{AddExpenseFragment} as default page. */ private void initViewPager() { viewPager = findViewById(R.id.viewpager); AddExpenseFragment addExpenseFragment = new AddExpenseFragment(); HistoryFragment historyFragment = new HistoryFragment(); ChartFragment chartFragment = new ChartFragment(); ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFragment(chartFragment); adapter.addFragment(addExpenseFragment); adapter.addFragment(historyFragment); viewPager.setAdapter(adapter); viewPager.setOffscreenPageLimit(2); //Setting the local fragment as default bottomNavigationView.setSelectedItemId(R.id.menu_add_expense); //Manipulating the fragments with view pager viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { if (prevMenuItem != null) { prevMenuItem.setChecked(false); } else { bottomNavigationView.getMenu().getItem(0).setChecked(false); } bottomNavigationView.getMenu().getItem(position).setChecked(true); prevMenuItem = bottomNavigationView.getMenu().getItem(position); if (position == 0){ toolbar.setTitle(getResources().getString(R.string.charts)); ViewPagerPageChangedServices.getInstance().changeViewPagerPageElement(); } else if (position == 1){ toolbar.setTitle(getResources().getString(R.string.add_expense)); } else if (position == 2){ toolbar.setTitle(getResources().getString(R.string.history)); } } @Override public void onPageScrollStateChanged(int state) { } }); } }
[ "tuse1993@gmail.com" ]
tuse1993@gmail.com
967c5cfeed0710b9e64b265950e5d27eaeaebda5
4ad2a846f991cf4a042a855cbceceeec97194ada
/src/main/java/org/lsst/ccs/integrationgantrygui/icon/ArrowRight.java
3208e68329e7fc470635cf8b40768473ae321b42
[]
no_license
lsst-camera-ccs/org-lsst-ccs-subsystem-integrationgantrygui
76738c4ab2a132c65a10a4f713f9a331b9fc7cc7
524a4da14dbaa2b44de2fdfa267a85fe5882ab8a
refs/heads/main
2023-07-23T23:52:14.835564
2023-07-14T00:18:21
2023-07-14T00:18:21
130,423,594
0
0
null
null
null
null
UTF-8
Java
false
false
2,315
java
package org.lsst.ccs.integrationgantrygui.icon; import java.awt.*; import java.awt.geom.*; import java.awt.image.*; import static java.awt.Color.*; /** * This class has been automatically generated using * <a href="http://ebourg.github.io/flamingo-svg-transcoder/">Flamingo SVG * transcoder</a>. */ public class ArrowRight implements javax.swing.Icon { private static final int SIZE = 24; /** * The width of this icon. */ private int width; /** * The height of this icon. */ private int height; /** * The rendered image. */ private BufferedImage image; /** * Creates a new transcoded SVG image. */ public ArrowRight() { this(SIZE, SIZE); } /** * Creates a new transcoded SVG image. */ public ArrowRight(int width, int height) { this.width = width; this.height = height; } @Override public int getIconHeight() { return height; } @Override public int getIconWidth() { return width; } @Override public void paintIcon(Component c, Graphics g, int x, int y) { if (image == null) { image = new BufferedImage(getIconWidth(), getIconHeight(), BufferedImage.TYPE_INT_ARGB); double coef = Math.min((double) width / (double) SIZE, (double) height / (double) SIZE); Graphics2D g2d = image.createGraphics(); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.scale(coef, coef); paint(g2d); g2d.dispose(); } g.drawImage(image, x, y, null); } /** * Paints the transcoded SVG image on the specified graphics context. * * @param g Graphics context. */ private static void paint(Graphics2D g) { // // _0 // _0_0 Shape shape = new Line2D.Float(5.000000f, 12.000000f, 19.000000f, 12.000000f); g.setPaint(BLACK); g.setStroke(new BasicStroke(2, 1, 1, 4)); g.draw(shape); // _0_1 shape = new GeneralPath(); ((GeneralPath) shape).moveTo(12.0, 5.0); ((GeneralPath) shape).lineTo(19.0, 12.0); ((GeneralPath) shape).lineTo(12.0, 19.0); g.draw(shape); } }
[ "tonyj@stanford.edu" ]
tonyj@stanford.edu
2bf2c4650cb645d52c75cb085bac8cd2ea635339
cb52955c4a8193325ba32c0ee697a82425d22bc6
/FirstJava/src/test/BBB.java
89886f1927028d5b2a08b097a4329b1131a74403
[]
no_license
JeongSuIn/classproject
c847edc5fe83b8042e59ca6f99cfbc943fafb0f5
4f3e386c752864c5e735a8105d59db79722181ec
refs/heads/master
2023-03-24T06:10:32.201139
2021-03-19T04:44:24
2021-03-19T04:44:24
299,173,479
0
0
null
null
null
null
UTF-8
Java
false
false
154
java
package test; public class BBB { public static void main(String[] args) { // 인스턴스 생성 AAA a = new AAA(); a.num = 10; } }
[ "71997955+JeongSuIn@users.noreply.github.com" ]
71997955+JeongSuIn@users.noreply.github.com
e6e2a414f3cdd30e47b010854cf4ab63a761f59b
31817c49fee549f347d35f94bcd44e94a62d74e3
/Stack_Queues/Check_Redundant_Brackets.java
fdb62250dd14c4df852d4f04c4c9127328c0cc6e
[]
no_license
ravivish/DS-in-Java
f751afc7b41a8eea6ab43529646e92d96da74e2a
840b1c3f8b2bda8d51597168732a29ba0097719b
refs/heads/master
2022-12-25T20:40:58.871890
2022-12-14T02:09:46
2022-12-14T02:09:46
181,742,977
0
0
null
null
null
null
UTF-8
Java
false
false
1,103
java
package Stack_Queues; import java.util.Stack; public class Check_Redundant_Brackets { public static boolean checkRedundantBrackets(String input) { // Write your code here if (input.length() == 0) { return false; } Stack<Character> stack = new Stack<>(); int index = 0; while(index < input.length()){ char c = input.charAt(index); if(c == '(' || c == '+' || c == '-' || c == '*' || c == '/'){ stack.push(c); } else if(c == ')'){ if(stack.peek() == '('){ return true; } else{ while(!stack.isEmpty() && stack.peek() != '('){ stack.pop(); } stack.pop(); } } index++; } return false; } public static void main(String[] args) { String str = "(a + (b)) "; boolean status = checkRedundantBrackets(str); System.out.println("status = " + status); } }
[ "ravivishwakarma825@gmail.com" ]
ravivishwakarma825@gmail.com
6fbad106cfdb832d3cf035493650a0a87e95708b
b1fb347d86e6b47cefaf1af8a2438609bdc18b6e
/app/src/main/java/com/robert/viewlearn/utils/UIUtils.java
8a4cbe836b44a04cd5b4c5cec854c1170ea86a5a
[]
no_license
IdioticMadman/ViewLearn
c2457689fd329b12bf7c4f856bfa68e74e5d4809
f12e7e72a2b4b6dcd4746d6002958de5f3b1f0dc
refs/heads/master
2021-07-05T02:52:27.246946
2017-09-28T14:22:32
2017-09-28T14:22:32
103,648,054
0
0
null
null
null
null
UTF-8
Java
false
false
1,534
java
package com.robert.viewlearn.utils; import android.content.Context; import android.util.DisplayMetrics; import java.util.Random; /** * @author: robert * @date: 2017-09-12 * @time: 19:24 * @说明: */ public class UIUtils { private static Random sRandom; private UIUtils() { } static { sRandom = new Random(); } public static int[] getScreenSize(Context context) { int[] size = new int[2]; DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); size[0] = displayMetrics.widthPixels; size[1] = displayMetrics.heightPixels; return size; } public static int getStatusBarHeight(Context context) { int result = 0; int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { result = context.getResources().getDimensionPixelSize(resourceId); } return result; } public static String getRandomColorStr() { String r = Integer.toHexString(sRandom.nextInt(256)).toUpperCase(); String g = Integer.toHexString(sRandom.nextInt(256)).toUpperCase(); String b = Integer.toHexString(sRandom.nextInt(256)).toUpperCase(); r = r.length() == 1 ? "0" + r : r; g = g.length() == 1 ? "0" + g : g; b = b.length() == 1 ? "0" + b : b; return "#"+r + g + b; } public static int getRandomColorInt(){ return sRandom.nextInt(0xffffff); } }
[ "idioticbear666@gmail.com" ]
idioticbear666@gmail.com
bad9e77ffd8bc4760e2a9cd654a22b402f885210
7f261a1e2bafd1cdd98d58f00a2937303c0dc942
/src/ANXCamera/sources/io/reactivex/observers/SafeObserver.java
00f3ffbc2855f9c68a4acc79ab3816776c63f22c
[]
no_license
xyzuan/ANXCamera
7614ddcb4bcacdf972d67c2ba17702a8e9795c95
b9805e5197258e7b980e76a97f7f16de3a4f951a
refs/heads/master
2022-04-23T16:58:09.592633
2019-05-31T17:18:34
2019-05-31T17:26:48
259,555,505
3
0
null
2020-04-28T06:49:57
2020-04-28T06:49:57
null
UTF-8
Java
false
false
5,362
java
package io.reactivex.observers; import io.reactivex.Observer; import io.reactivex.annotations.NonNull; import io.reactivex.disposables.Disposable; import io.reactivex.exceptions.CompositeException; import io.reactivex.exceptions.Exceptions; import io.reactivex.internal.disposables.DisposableHelper; import io.reactivex.internal.disposables.EmptyDisposable; import io.reactivex.plugins.RxJavaPlugins; public final class SafeObserver<T> implements Observer<T>, Disposable { final Observer<? super T> actual; boolean done; Disposable s; public SafeObserver(@NonNull Observer<? super T> observer) { this.actual = observer; } public void dispose() { this.s.dispose(); } public boolean isDisposed() { return this.s.isDisposed(); } public void onComplete() { if (!this.done) { this.done = true; if (this.s == null) { onCompleteNoSubscription(); return; } try { this.actual.onComplete(); } catch (Throwable th) { Exceptions.throwIfFatal(th); RxJavaPlugins.onError(th); } } } /* access modifiers changed from: 0000 */ public void onCompleteNoSubscription() { NullPointerException nullPointerException = new NullPointerException("Subscription not set!"); try { this.actual.onSubscribe(EmptyDisposable.INSTANCE); try { this.actual.onError(nullPointerException); } catch (Throwable th) { Exceptions.throwIfFatal(th); RxJavaPlugins.onError(new CompositeException(nullPointerException, th)); } } catch (Throwable th2) { Exceptions.throwIfFatal(th2); RxJavaPlugins.onError(new CompositeException(nullPointerException, th2)); } } public void onError(@NonNull Throwable th) { if (this.done) { RxJavaPlugins.onError(th); return; } this.done = true; if (this.s == null) { NullPointerException nullPointerException = new NullPointerException("Subscription not set!"); try { this.actual.onSubscribe(EmptyDisposable.INSTANCE); try { this.actual.onError(new CompositeException(th, nullPointerException)); } catch (Throwable th2) { Exceptions.throwIfFatal(th2); RxJavaPlugins.onError(new CompositeException(th, nullPointerException, th2)); } } catch (Throwable th3) { Exceptions.throwIfFatal(th3); RxJavaPlugins.onError(new CompositeException(th, nullPointerException, th3)); } } else { if (th == null) { th = new NullPointerException("onError called with null. Null values are generally not allowed in 2.x operators and sources."); } try { this.actual.onError(th); } catch (Throwable th4) { Exceptions.throwIfFatal(th4); RxJavaPlugins.onError(new CompositeException(th, th4)); } } } public void onNext(@NonNull T t) { if (!this.done) { if (this.s == null) { onNextNoSubscription(); } else if (t == null) { NullPointerException nullPointerException = new NullPointerException("onNext called with null. Null values are generally not allowed in 2.x operators and sources."); try { this.s.dispose(); onError(nullPointerException); } catch (Throwable th) { Exceptions.throwIfFatal(th); onError(new CompositeException(nullPointerException, th)); } } else { try { this.actual.onNext(t); } catch (Throwable th2) { Exceptions.throwIfFatal(th2); onError(new CompositeException(th, th2)); } } } } /* access modifiers changed from: 0000 */ public void onNextNoSubscription() { this.done = true; NullPointerException nullPointerException = new NullPointerException("Subscription not set!"); try { this.actual.onSubscribe(EmptyDisposable.INSTANCE); try { this.actual.onError(nullPointerException); } catch (Throwable th) { Exceptions.throwIfFatal(th); RxJavaPlugins.onError(new CompositeException(nullPointerException, th)); } } catch (Throwable th2) { Exceptions.throwIfFatal(th2); RxJavaPlugins.onError(new CompositeException(nullPointerException, th2)); } } public void onSubscribe(@NonNull Disposable disposable) { if (DisposableHelper.validate(this.s, disposable)) { this.s = disposable; try { this.actual.onSubscribe(this); } catch (Throwable th) { Exceptions.throwIfFatal(th); RxJavaPlugins.onError(new CompositeException(th, th)); } } } }
[ "sv.xeon@gmail.com" ]
sv.xeon@gmail.com
9aa44da40716909d24fb5d77a4fd233c407da554
009df5aa27e60e2765ac451735086d8e715ecb16
/src/main/java/com/microej/examples/xml/ReadPoem.java
c7fa1f98991af9034465b1c19857dfff4f5cbfb5
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
MicroEJ/ExampleJava-XML
25583246cb15d5f77c93e745087ceed2aab1e602
05d75bc2fd3fe9b783bb5cde076aa93ed4e2ba1c
refs/heads/master
2021-01-19T07:41:36.704911
2020-11-06T12:31:30
2020-11-06T12:31:30
24,194,032
2
1
null
null
null
null
UTF-8
Java
false
false
1,037
java
/* * Java * * Copyright 2014-2020 MicroEJ Corp. All rights reserved. * Use of this source code is governed by a BSD-style license that can be found with this software. */ package com.microej.examples.xml; import java.io.IOException; import org.xmlpull.v1.XmlPullParserException; import com.microej.examples.xml.model.Poem; import com.microej.examples.xml.util.XMLPoemReader; /** * Reads a poem and print it on the console. */ public class ReadPoem { private static final String ROSES_XML = "/xml/poem.xml"; //$NON-NLS-1$ /** * Reads a poem and print it on the console. * * @param args * useless. * @throws XmlPullParserException * if a problem occurs with the XML parser (configuration or parsing). * @throws IOException * if the poem file cannot be read. */ public static void main(String[] args) throws XmlPullParserException, IOException { XMLPoemReader xmlReader = new XMLPoemReader(); Poem poem = xmlReader.parse(ROSES_XML); System.out.println(poem); } }
[ "delivery@microej.com" ]
delivery@microej.com
48f53f58779f967460d19222562ac68dd0226ff0
d9477e8e6e0d823cf2dec9823d7424732a7563c4
/plugins/ProjectViewer/tags/pv_2_0_3/projectviewer/importer/ReImporter.java
9708685cef783e64c966d4e4b7f0aa3d1c041033
[]
no_license
RobertHSchmidt/jedit
48fd8e1e9527e6f680de334d1903a0113f9e8380
2fbb392d6b569aefead29975b9be12e257fbe4eb
refs/heads/master
2023-08-30T02:52:55.676638
2018-07-11T13:28:01
2018-07-11T13:28:01
140,587,948
1
0
null
null
null
null
UTF-8
Java
false
false
4,209
java
/* * :tabSize=4:indentSize=4:noTabs=false: * :folding=explicit:collapseFolds=1: * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package projectviewer.importer; //{{{ Imports import java.io.File; import java.io.FilenameFilter; import java.util.Iterator; import java.util.ArrayList; import java.util.Collection; import java.util.Enumeration; import java.awt.Component; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.filechooser.FileFilter; import org.gjt.sp.jedit.jEdit; import projectviewer.ProjectViewer; import projectviewer.vpt.VPTFile; import projectviewer.vpt.VPTNode; import projectviewer.vpt.VPTProject; import projectviewer.vpt.VPTDirectory; //}}} /** * Re-imports files and/or directories from the project root and from other * nodes that are not under the root. Re-importing from nodes not under the * root works as following: if the directory does not exist, the file nodes * below it are checked to see if they still exist, and removed if they don't; * if the directory exists, the importing method chosen by the user is used * to re-import the directory. These actions take place recursively. * * @author Marcelo Vanzin * @version $Id$ */ public class ReImporter extends RootImporter { //{{{ +ReImporter(VPTNode, ProjectViewer) : <init> /** * Creates a ReImport object. Most of the functionality is inherited from * the RootImporter class. */ public ReImporter(VPTNode node, ProjectViewer viewer) { super(node, viewer, true); } //}}} //{{{ #internalDoImport() : Collection /** * Uses the user options from the RootImporter and re-imports the nodes * not under the root. */ protected Collection internalDoImport() { super.internalDoImport(); // iterates through the children for (Enumeration en = project.children(); en.hasMoreElements(); ) { VPTNode node = (VPTNode) en.nextElement(); String path = node.getNodePath(); // check whether the node is under the root (new or old) if (!path.startsWith(project.getRootPath())) { if (node.isFile()) { if (!((VPTFile)node).getFile().exists()) { unregisterFile((VPTFile)node); } } else if (node.isDirectory()) { reimportDirectory((VPTDirectory)node); } } } return null; } //}}} //{{{ -reimportDirectory(VPTDirectory) : void private void reimportDirectory(VPTDirectory dir) { if (dir.getFile().exists()) { unregisterDir(dir); addTree(dir.getFile(), dir, fnf); } else { ArrayList toRemove = null; for (int i = 0; i < dir.getChildCount(); i++) { VPTNode node = (VPTNode) dir.getChildAt(i); if (node.isFile()) { if (!((VPTFile)node).getFile().exists()) { unregisterFile((VPTFile)node); dir.remove(i--); } } else if (node.isDirectory()) { reimportDirectory((VPTDirectory)node); } } } } //}}} //{{{ #unregisterDir(VPTDirectory) : void /** * Unregisters all files in the directory from the project, recursively, * and removes the child nodes from the parent. */ protected void unregisterDir(VPTDirectory dir) { for (int i = 0; i < dir.getChildCount(); i++) { VPTNode n = (VPTNode) dir.getChildAt(i); if (n.isDirectory()) { VPTDirectory cdir = (VPTDirectory) n; if (cdir.getFile().exists() && cdir.getFile().getParent().equals(dir.getNodePath())) { unregisterFiles((VPTDirectory)n); dir.remove(i--); } else { reimportDirectory(cdir); } } else if (n.isFile()) { unregisterFile((VPTFile)n); dir.remove(i--); } } } //}}} }
[ "nobody@6b1eeb88-9816-0410-afa2-b43733a0f04e" ]
nobody@6b1eeb88-9816-0410-afa2-b43733a0f04e
77f2bc04ad3b0f07a242241deaf7e349e2251396
ff68df41a13fca81821cec5de29be071980080fa
/src/medium/LargestPlusSign.java
604c155b0a3ab9321c66da0c1c86b00349c3f6f4
[]
no_license
amitrajan012/LeetCode
e921746ffa7bcc7c520548eca15cf6939811c7a3
9ef813f56d88e7dbfc9dff851073ec7c69e1ec62
refs/heads/master
2020-03-16T05:01:26.055702
2018-07-22T19:55:06
2018-07-22T19:55:06
132,523,936
0
0
null
null
null
null
UTF-8
Java
false
false
1,182
java
package medium; import java.util.Arrays; /* * https://leetcode.com/problems/largest-plus-sign/description/ */ public class LargestPlusSign { public int orderOfLargestPlusSign(int N, int[][] mines) { int[][] grid = new int[N][N]; for(int i=0;i<N;i++) { Arrays.fill(grid[i], N); } for(int[] mine: mines) { grid[mine[0]][mine[1]] = 0; } for (int i = 0; i < N; i++) { for (int j = 0, k = N - 1, l = 0, r = 0, u = 0, d = 0; j < N; j++, k--) { grid[i][j] = Math.min(grid[i][j], l = (grid[i][j] == 0 ? 0 : l + 1)); // left direction grid[i][k] = Math.min(grid[i][k], r = (grid[i][k] == 0 ? 0 : r + 1)); // right direction grid[j][i] = Math.min(grid[j][i], u = (grid[j][i] == 0 ? 0 : u + 1)); // up direction grid[k][i] = Math.min(grid[k][i], d = (grid[k][i] == 0 ? 0 : d + 1)); // down direction } } int res = 0; for(int i=0;i<N;i++) { for(int j=0;j<N;j++) { res = Math.max(res, grid[i][j]); } } return res; } }
[ "amitrajan012@gmail.com" ]
amitrajan012@gmail.com
6c3244ab6d2da453360eeaa55bf3d7c3459d81b9
ba3225e5a90f6c1da3804bd0639c4bfd40ec43b5
/server/src/main/java/com/yc/server/ServerApplication.java
76601e6b27bc8c69283d4e71be0939da5cc013f1
[]
no_license
hcl0923/springboot
52bc0ca7158e4fcbfc4f3f5c7cc010ded4f16a8d
d75f5e8ed13546f6455325b03ff4a1bd52f8a092
refs/heads/master
2023-05-13T00:50:29.742474
2021-06-08T09:14:03
2021-06-08T09:14:03
362,752,799
0
0
null
null
null
null
UTF-8
Java
false
false
1,060
java
package com.yc.server; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; //@SpringBootApplication //public class ServerApplication { // // public static void main(String[] args) { // // SpringApplication.run(ServerApplication.class, args); // } // //} @SpringBootApplication public class ServerApplication extends SpringBootServletInitializer { private static Log log = LogFactory.getLog(ServerApplication.class); @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { log.info("启动服务器"); return application.sources(ServerApplication.class); } public static void main(String[] args) { SpringApplication.run(ServerApplication.class, args); } }
[ "2958731272@qq.com" ]
2958731272@qq.com
7796106b1d895aea5924cb71d12756370d4d33c2
9930124fca20f0f5f89290a2a69d12acd5448208
/AbrirArquivo/src/abrirarquivo/ChegarAtrasadoException.java
e02dccbb5215f6c6a5b0279dce7e25ce9c7c9436
[]
no_license
rodrigoelias15/Orienta-o-a-objetos
751b13751d48c702de148f46fb43d7dac108d801
bd871866b0e1b1123c9f3b42d2efb3062a6ccd9b
refs/heads/master
2021-10-09T08:08:02.848985
2018-12-23T21:51:09
2018-12-23T21:51:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
437
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 abrirarquivo; import java.util.concurrent.CompletableFuture; /** * * @author ice */ public class ChegarAtrasadoException extends RuntimeException{ public ChegarAtrasadoException(String msg) { super(msg); } }
[ "noreply@github.com" ]
rodrigoelias15.noreply@github.com
58dc7447de24188b335dec218cb3cd8121bf686b
3b0dd18b5c8ed25fd36f4e625433cb712a767447
/app/src/androidTest/java/dts/polinema/mylocation/ExampleInstrumentedTest.java
43fc09fd30255d292b99d80a6c198a191c0bf52b
[]
no_license
rizqifirman/dtschapter13-starter
e5d7938e2c2321e3fccbc2266ad4c8d6affda7fc
53f895ffcdd987100b2698e9c5e5d8ef489898a6
refs/heads/master
2020-09-01T07:02:14.042087
2019-07-17T22:52:57
2019-07-17T22:52:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
717
java
package dts.polinema.mylocation; import android.content.Context; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("dts.polinema.mylocation", appContext.getPackageName()); } }
[ "milyun.nima.shoumi@gmail.com" ]
milyun.nima.shoumi@gmail.com
56702bd95cde54e5143faf73e1f783c6f592eb8f
a5ab2153602cea4026e19cfd68d474ed86c98c23
/Myapplication/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
cd843fdc98818f4a318edce85c15d06fdd1477b6
[]
no_license
Dhruvish-Patel/Smart-Mall
9ec5803dbfead1f6458b644919ce8494080b24e7
93fd4818ec1c00e7038d1a8244f6729aa59be1d6
refs/heads/master
2022-07-12T05:44:35.250754
2020-05-16T06:54:43
2020-05-16T06:54:43
264,373,415
4
0
null
null
null
null
UTF-8
Java
false
false
1,118
java
package io.flutter.plugins; import androidx.annotation.Keep; import androidx.annotation.NonNull; import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry; /** * Generated file. Do not edit. * This file is generated by the Flutter tool based on the * plugins that support the Android platform. */ @Keep public final class GeneratedPluginRegistrant { public static void registerWith(@NonNull FlutterEngine flutterEngine) { ShimPluginRegistry shimPluginRegistry = new ShimPluginRegistry(flutterEngine); io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin.registerWith(shimPluginRegistry.registrarFor("io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin")); io.flutter.plugins.firebaseauth.FirebaseAuthPlugin.registerWith(shimPluginRegistry.registrarFor("io.flutter.plugins.firebaseauth.FirebaseAuthPlugin")); flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.core.FirebaseCorePlugin()); flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.database.FirebaseDatabasePlugin()); } }
[ "noreply@github.com" ]
Dhruvish-Patel.noreply@github.com
48a3cbe81ae7aaa62954fcb82bfe732456c3ae1c
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/16/16_ca06b5e5a6a29982d68ae8cbdbb098536d9ccec1/BluetoothWidget/16_ca06b5e5a6a29982d68ae8cbdbb098536d9ccec1_BluetoothWidget_t.java
280482cdc97670c912202352dce2d2c34cc2e536
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
4,653
java
package com.mridang.bluetooth; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.provider.Settings; import android.util.Log; import com.bugsense.trace.BugSenseHandler; import com.google.android.apps.dashclock.api.DashClockExtension; import com.google.android.apps.dashclock.api.ExtensionData; /* * This class is the main class that provides the widget */ public class BluetoothWidget extends DashClockExtension{ /* This is the instance of the receiver that deals with bluetooth status */ private ToggleReceiver objBluetoothReciver; /* * This class is the receiver for getting bluetooth toggle events */ private class ToggleReceiver extends BroadcastReceiver { /* * @see android.content.BroadcastReceiver#onReceive(android.content.Context, android.content.Intent) */ @Override public void onReceive(Context ctxContext, Intent ittIntent) { if (ittIntent.getAction().equals(BluetoothAdapter.ACTION_STATE_CHANGED)) { if (ittIntent.getIntExtra(BluetoothAdapter.EXTRA_STATE, 0) == BluetoothAdapter.STATE_ON) { Log.v("BluetoothWidget", "Bluetooth enabled"); onUpdateData(BluetoothAdapter.STATE_ON); return; } if (ittIntent.getIntExtra(BluetoothAdapter.EXTRA_STATE, 0) == BluetoothAdapter.STATE_OFF) { Log.v("BluetoothWidget", "Bluetooth disabled"); onUpdateData(BluetoothAdapter.STATE_OFF); return; } } if (ittIntent.getAction().equals(BluetoothAdapter.ACTION_STATE_CHANGED)) { if (ittIntent.getAction().equals(BluetoothAdapter.STATE_CONNECTED)) { Log.v("BluetoothWidget", "Bluetooth connected"); onUpdateData(BluetoothAdapter.STATE_CONNECTED); return; } if (ittIntent.getAction().equals(BluetoothAdapter.STATE_DISCONNECTED)) { Log.v("BluetoothWidget", "Bluetooth disconnected"); onUpdateData(BluetoothAdapter.STATE_DISCONNECTED); return; } } } } /* * @see com.google.android.apps.dashclock.api.DashClockExtension#onInitialize(boolean) */ @Override protected void onInitialize(boolean booReconnect) { super.onInitialize(booReconnect); if (objBluetoothReciver != null) { try { Log.d("BluetoothWidget", "Unregistered any existing status receivers"); unregisterReceiver(objBluetoothReciver); } catch (Exception e) { e.printStackTrace(); } } IntentFilter itfIntents = new IntentFilter((BluetoothAdapter.ACTION_STATE_CHANGED)); itfIntents.addAction(BluetoothDevice.ACTION_ACL_CONNECTED); itfIntents.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED); objBluetoothReciver = new ToggleReceiver(); registerReceiver(objBluetoothReciver, itfIntents); Log.d("BluetoothWidget", "Registered the status receivers"); } /* * @see com.google.android.apps.dashclock.api.DashClockExtension#onCreate() */ public void onCreate() { super.onCreate(); Log.d("BluetoothWidget", "Created"); BugSenseHandler.initAndStartSession(this, "17259530"); } /* * @see * com.google.android.apps.dashclock.api.DashClockExtension#onUpdateData * (int) */ @Override protected void onUpdateData(int arg0) { Log.d("BluetoothWidget", "Fetching bluetooth connectivity information"); ExtensionData edtInformation = new ExtensionData(); edtInformation.visible(false); try { Log.d("BluetoothWidget", "Checking if the bluetooth is on"); if (BluetoothAdapter.getDefaultAdapter().isEnabled()) { Log.d("BluetoothWidget", "Bluetooth is on"); edtInformation.visible(true); edtInformation.clickIntent(new Intent(Settings.ACTION_BLUETOOTH_SETTINGS)); edtInformation.status(BluetoothAdapter.getDefaultAdapter().getName()); edtInformation.expandedBody(getString(arg0 == BluetoothAdapter.STATE_CONNECTED ? R.string.connected : R.string.disconnected)); } else { Log.d("BluetoothWidget", "Bluetooth is off"); } } catch (Exception e) { Log.e("BluetoothWidget", "Encountered an error", e); BugSenseHandler.sendException(e); } edtInformation.icon(R.drawable.ic_dashclock); publishUpdate(edtInformation); Log.d("BluetoothWidget", "Done"); } /* * @see com.google.android.apps.dashclock.api.DashClockExtension#onDestroy() */ public void onDestroy() { super.onDestroy(); Log.d("BluetoothWidget", "Destroyed"); BugSenseHandler.closeSession(this); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
e4b604373e2fc20218aaa294064c5f98ce70b92e
a8978eaaf25625f791c1b0165271a42ffddff86c
/src/reminder/Update_DB.java
cc54935da071711a0f9028bfadaee47a3761acf6
[]
no_license
manager-core/version1.2
c8919f1e953749a761b1ed6ef5cd063520903347
539bce2925981d681122eaf14a793c984e0f7e60
refs/heads/master
2022-12-01T18:23:34.367404
2020-08-19T10:33:06
2020-08-19T10:33:06
288,699,719
0
0
null
null
null
null
UTF-8
Java
false
false
964
java
package reminder; import java.io.*; /** * Created by Daniel on 3/15/2018. */ public class Update_DB { public static void main(String[] args) throws InterruptedException, IOException { File source = new File("d:/manager/data/db.mv"); File dest = new File("d:/backup/as.ted"); copyFileUsingStream(source, dest); // System.out.println("Time taken by Stream Copy = "+(System.nanoTime()-start)); } private static void copyFileUsingStream(File source, File dest) throws IOException { InputStream is = null; OutputStream os = null; try { is = new FileInputStream(source); os = new FileOutputStream(dest); byte[] buffer = new byte[1024]; int length; while ((length = is.read(buffer)) > 0) { os.write(buffer, 0, length); } } finally { is.close(); os.close(); } } }
[ "cerna.daniel@outlook.com" ]
cerna.daniel@outlook.com
5568a48475ff05f6876f88944f8394250301f8f4
716ede2192c2872a115d0ec981b2d70b72f9ffbe
/String/romanToInt.java
becc7fed5ba4cfaafbcf7befef02124b1fc10875
[]
no_license
SwapDixit/OA-Practice
cf03677386429f15363b019ca25a75f00c6aa3c2
6c41f7dde15dc212ac4d4f92715fa98006747bd2
refs/heads/main
2023-03-06T17:34:31.375586
2021-02-14T21:13:00
2021-02-14T21:13:00
338,902,216
1
0
null
null
null
null
UTF-8
Java
false
false
719
java
import java.util.HashMap; import java.util.Map; public class romanToInt { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println(getInt("XIX")); } static int getInt(String s) { int result = 0; Map<Character, Integer> map = new HashMap<>(); map.put('I', 1); map.put('V', 5); map.put('X', 10); map.put('L', 50); map.put('C', 100); map.put('D', 500); map.put('M', 1000); for (int i = 0; i < s.length(); i++) { if (i > 0 && map.get(s.charAt(i)) > map.get(s.charAt(i - 1))) { result += map.get(s.charAt(i)) - 2 * map.get(s.charAt(i - 1)); }else result += map.get(s.charAt(i)); } return result; } }
[ "noreply@github.com" ]
SwapDixit.noreply@github.com
8d248db05062d428a855325f40e17974a54e2e65
829cb3e438f4b7a5c7e6649bab30a40df115d267
/cmon-app-portlet/docroot/WEB-INF/service/org/oep/cmon/dao/cd/service/persistence/NgheNghiepPersistence.java
22a1fa38dad09b7f96c177f29168845b57d91e60
[ "Apache-2.0" ]
permissive
doep-manual/CMON-App
643bc726ca55a268fb7e44e80b181642224b2b67
17007602673b0ecffbf844ad78a276d953e791a7
refs/heads/master
2020-12-29T00:29:01.395897
2015-06-29T08:00:58
2015-06-29T08:00:58
38,224,623
0
0
null
2015-06-29T02:56:41
2015-06-29T02:56:41
null
UTF-8
Java
false
false
12,771
java
/** * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package org.oep.cmon.dao.cd.service.persistence; import com.liferay.portal.service.persistence.BasePersistence; import org.oep.cmon.dao.cd.model.NgheNghiep; /** * The persistence interface for the nghe nghiep service. * * <p> * Caching information and settings can be found in <code>portal.properties</code> * </p> * * @author LIEMNN * @see NgheNghiepPersistenceImpl * @see NgheNghiepUtil * @generated */ public interface NgheNghiepPersistence extends BasePersistence<NgheNghiep> { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this interface directly. Always use {@link NgheNghiepUtil} to access the nghe nghiep persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this interface. */ /** * Caches the nghe nghiep in the entity cache if it is enabled. * * @param ngheNghiep the nghe nghiep */ public void cacheResult(org.oep.cmon.dao.cd.model.NgheNghiep ngheNghiep); /** * Caches the nghe nghieps in the entity cache if it is enabled. * * @param ngheNghieps the nghe nghieps */ public void cacheResult( java.util.List<org.oep.cmon.dao.cd.model.NgheNghiep> ngheNghieps); /** * Creates a new nghe nghiep with the primary key. Does not add the nghe nghiep to the database. * * @param id the primary key for the new nghe nghiep * @return the new nghe nghiep */ public org.oep.cmon.dao.cd.model.NgheNghiep create(long id); /** * Removes the nghe nghiep with the primary key from the database. Also notifies the appropriate model listeners. * * @param id the primary key of the nghe nghiep * @return the nghe nghiep that was removed * @throws org.oep.cmon.dao.cd.NoSuchNgheNghiepException if a nghe nghiep with the primary key could not be found * @throws SystemException if a system exception occurred */ public org.oep.cmon.dao.cd.model.NgheNghiep remove(long id) throws com.liferay.portal.kernel.exception.SystemException, org.oep.cmon.dao.cd.NoSuchNgheNghiepException; public org.oep.cmon.dao.cd.model.NgheNghiep updateImpl( org.oep.cmon.dao.cd.model.NgheNghiep ngheNghiep, boolean merge) throws com.liferay.portal.kernel.exception.SystemException; /** * Returns the nghe nghiep with the primary key or throws a {@link org.oep.cmon.dao.cd.NoSuchNgheNghiepException} if it could not be found. * * @param id the primary key of the nghe nghiep * @return the nghe nghiep * @throws org.oep.cmon.dao.cd.NoSuchNgheNghiepException if a nghe nghiep with the primary key could not be found * @throws SystemException if a system exception occurred */ public org.oep.cmon.dao.cd.model.NgheNghiep findByPrimaryKey(long id) throws com.liferay.portal.kernel.exception.SystemException, org.oep.cmon.dao.cd.NoSuchNgheNghiepException; /** * Returns the nghe nghiep with the primary key or returns <code>null</code> if it could not be found. * * @param id the primary key of the nghe nghiep * @return the nghe nghiep, or <code>null</code> if a nghe nghiep with the primary key could not be found * @throws SystemException if a system exception occurred */ public org.oep.cmon.dao.cd.model.NgheNghiep fetchByPrimaryKey(long id) throws com.liferay.portal.kernel.exception.SystemException; /** * Returns all the nghe nghieps where daXoa = &#63;. * * @param daXoa the da xoa * @return the matching nghe nghieps * @throws SystemException if a system exception occurred */ public java.util.List<org.oep.cmon.dao.cd.model.NgheNghiep> findByTrangThai( int daXoa) throws com.liferay.portal.kernel.exception.SystemException; /** * Returns a range of all the nghe nghieps where daXoa = &#63;. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param daXoa the da xoa * @param start the lower bound of the range of nghe nghieps * @param end the upper bound of the range of nghe nghieps (not inclusive) * @return the range of matching nghe nghieps * @throws SystemException if a system exception occurred */ public java.util.List<org.oep.cmon.dao.cd.model.NgheNghiep> findByTrangThai( int daXoa, int start, int end) throws com.liferay.portal.kernel.exception.SystemException; /** * Returns an ordered range of all the nghe nghieps where daXoa = &#63;. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param daXoa the da xoa * @param start the lower bound of the range of nghe nghieps * @param end the upper bound of the range of nghe nghieps (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching nghe nghieps * @throws SystemException if a system exception occurred */ public java.util.List<org.oep.cmon.dao.cd.model.NgheNghiep> findByTrangThai( int daXoa, int start, int end, com.liferay.portal.kernel.util.OrderByComparator orderByComparator) throws com.liferay.portal.kernel.exception.SystemException; /** * Returns the first nghe nghiep in the ordered set where daXoa = &#63;. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param daXoa the da xoa * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the first matching nghe nghiep * @throws org.oep.cmon.dao.cd.NoSuchNgheNghiepException if a matching nghe nghiep could not be found * @throws SystemException if a system exception occurred */ public org.oep.cmon.dao.cd.model.NgheNghiep findByTrangThai_First( int daXoa, com.liferay.portal.kernel.util.OrderByComparator orderByComparator) throws com.liferay.portal.kernel.exception.SystemException, org.oep.cmon.dao.cd.NoSuchNgheNghiepException; /** * Returns the last nghe nghiep in the ordered set where daXoa = &#63;. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param daXoa the da xoa * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the last matching nghe nghiep * @throws org.oep.cmon.dao.cd.NoSuchNgheNghiepException if a matching nghe nghiep could not be found * @throws SystemException if a system exception occurred */ public org.oep.cmon.dao.cd.model.NgheNghiep findByTrangThai_Last( int daXoa, com.liferay.portal.kernel.util.OrderByComparator orderByComparator) throws com.liferay.portal.kernel.exception.SystemException, org.oep.cmon.dao.cd.NoSuchNgheNghiepException; /** * Returns the nghe nghieps before and after the current nghe nghiep in the ordered set where daXoa = &#63;. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param id the primary key of the current nghe nghiep * @param daXoa the da xoa * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the previous, current, and next nghe nghiep * @throws org.oep.cmon.dao.cd.NoSuchNgheNghiepException if a nghe nghiep with the primary key could not be found * @throws SystemException if a system exception occurred */ public org.oep.cmon.dao.cd.model.NgheNghiep[] findByTrangThai_PrevAndNext( long id, int daXoa, com.liferay.portal.kernel.util.OrderByComparator orderByComparator) throws com.liferay.portal.kernel.exception.SystemException, org.oep.cmon.dao.cd.NoSuchNgheNghiepException; /** * Returns all the nghe nghieps. * * @return the nghe nghieps * @throws SystemException if a system exception occurred */ public java.util.List<org.oep.cmon.dao.cd.model.NgheNghiep> findAll() throws com.liferay.portal.kernel.exception.SystemException; /** * Returns a range of all the nghe nghieps. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param start the lower bound of the range of nghe nghieps * @param end the upper bound of the range of nghe nghieps (not inclusive) * @return the range of nghe nghieps * @throws SystemException if a system exception occurred */ public java.util.List<org.oep.cmon.dao.cd.model.NgheNghiep> findAll( int start, int end) throws com.liferay.portal.kernel.exception.SystemException; /** * Returns an ordered range of all the nghe nghieps. * * <p> * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param start the lower bound of the range of nghe nghieps * @param end the upper bound of the range of nghe nghieps (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of nghe nghieps * @throws SystemException if a system exception occurred */ public java.util.List<org.oep.cmon.dao.cd.model.NgheNghiep> findAll( int start, int end, com.liferay.portal.kernel.util.OrderByComparator orderByComparator) throws com.liferay.portal.kernel.exception.SystemException; /** * Removes all the nghe nghieps where daXoa = &#63; from the database. * * @param daXoa the da xoa * @throws SystemException if a system exception occurred */ public void removeByTrangThai(int daXoa) throws com.liferay.portal.kernel.exception.SystemException; /** * Removes all the nghe nghieps from the database. * * @throws SystemException if a system exception occurred */ public void removeAll() throws com.liferay.portal.kernel.exception.SystemException; /** * Returns the number of nghe nghieps where daXoa = &#63;. * * @param daXoa the da xoa * @return the number of matching nghe nghieps * @throws SystemException if a system exception occurred */ public int countByTrangThai(int daXoa) throws com.liferay.portal.kernel.exception.SystemException; /** * Returns the number of nghe nghieps. * * @return the number of nghe nghieps * @throws SystemException if a system exception occurred */ public int countAll() throws com.liferay.portal.kernel.exception.SystemException; }
[ "giang@dtt.vn" ]
giang@dtt.vn
3dc279b0e3a2af28340f4c8c8c0131e77b53b969
76a179c7b0ed26cf7d37266a92fc83ef4c259273
/src/Week6Pro1.java
234287e0b65bfa584f8b2f81e146994cc563170a
[]
no_license
GodisG/java-homework-week-6
fad27581241562719cf255a0044ca61fffba89d6
04f81ea9cc044454dae13c484d8785087cc6fd84
refs/heads/master
2023-08-29T07:14:27.461487
2021-10-10T17:22:15
2021-10-10T17:22:15
415,468,731
0
0
null
null
null
null
UTF-8
Java
false
false
417
java
public class Week6Pro1 { int p = 94; int s = 84; public void msm (){ System.out.println(p); System.out.println(s); System.out.println(p+s); } public static void main(String[] args) { Week6Pro1 m = new Week6Pro1(); Week6Pro1 n = new Week6Pro1(); System.out.println(m.p); System.out.println(n.s); System.out.println(m.p + n.s); } }
[ "dharades@gmail.com" ]
dharades@gmail.com
7a97626db5b270efc7ef585be6656219465fd30d
d8cdd94b74ab06d134576e10de5df62aa2b73709
/src/main/java/scripts/AMLPipeline.java
5cdc28c9e90d2a248ee5df53a9d0cbdcc9071766
[]
no_license
PavanGovardhanan/TookitakiProject
44159a4128f53d5631363a183576eee2b504d5d0
b96234022582dcf3c60d6421918f54c58009d628
refs/heads/master
2021-01-02T17:13:02.611573
2017-08-04T06:21:08
2017-08-04T06:21:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,175
java
package scripts; import java.io.IOException; import org.openqa.selenium.By; import atu.testng.reports.ATUReports; import commonMethods.Config; import commonMethods.Keywords; import commonMethods.Utils; public class AMLPipeline extends Keywords { /** * Name : Pavan * Created Date: 01/Aug/2017 * Modified Date:01/Aug/2017 * Description:AML PIpeline * */ public static void amlPipeline() throws IOException { String automationName = Utils.getDataFromTestData("amlPipeline", "Automation Name"); String file1 = Utils.getDataFromTestData("amlPipeline", "OutputFile1"); String file2 = Utils.getDataFromTestData("amlPipeline", "OutputFile2"); String file3 = Utils.getDataFromTestData("amlPipeline", "OutputFile3"); String file4 = Utils.getDataFromTestData("amlPipeline", "OutputFile4"); String file5 = Utils.getDataFromTestData("amlPipeline", "OutputFile5"); String file6 = Utils.getDataFromTestData("amlPipeline", "OutputFile6"); String file7 = Utils.getDataFromTestData("amlPipeline", "OutputFile7"); waitForElement(dashboard); click(dashboard); waitForElement(pipeline); click(pipeline); waitForElement(viewPipeline); click(createpipeline); defaultWait(); waitForElement(addPipelineName); sendKeys(addPipelineName, automationName); waitForElement(addProcess); click(addProcess); waitForElement(addTransformation); click(addTransformation); defaultWait(); waitForElement(chooseTransformation); click(chooseTransformation); waitForElement(selectTransformation); sendKeys(selectTransformation, file1); defaultWait(); tab(); click(add); defaultWait(); waitForElement(addProcess); click(addProcess); waitForElement(addTransformation); click(addTransformation); defaultWait(); waitForElement(chooseTransformation); click(chooseTransformation); waitForElement(selectTransformation); sendKeys(selectTransformation, file2); scrollBottom(); waitForElement(selectFileTransformation); click(selectFileTransformation); click(add); defaultWait(); waitForElement(addProcess); click(addProcess); waitForElement(addTransformation); click(addTransformation); defaultWait(); waitForElement(chooseTransformation); click(chooseTransformation); waitForElement(selectTransformation); sendKeys(selectTransformation, file3); keyboardArrowDown(); keyboardArrowDown(); keyboardArrowDown(); keyboardArrowDown(); tab(); click(add); defaultWait(); waitForElement(addProcess); click(addProcess); waitForElement(addTransformation); click(addTransformation); defaultWait(); waitForElement(chooseTransformation); click(chooseTransformation); waitForElement(selectTransformation); sendKeys(selectTransformation, file3); keyboardArrowDown(); keyboardArrowDown(); keyboardArrowDown(); tab(); click(add); defaultWait(); waitForElement(addProcess); click(addProcess); waitForElement(addTransformation); click(addTransformation); defaultWait(); waitForElement(chooseTransformation); click(chooseTransformation); waitForElement(selectTransformation); sendKeys(selectTransformation, file3); keyboardArrowDown(); keyboardArrowDown(); tab(); click(add); defaultWait(); waitForElement(addProcess); click(addProcess); waitForElement(addTransformation); click(addTransformation); defaultWait(); waitForElement(chooseTransformation); click(chooseTransformation); waitForElement(selectTransformation); sendKeys(selectTransformation, file3); keyboardArrowDown(); tab(); click(add); defaultWait(); waitForElement(addProcess); click(addProcess); waitForElement(addTransformation); click(addTransformation); defaultWait(); waitForElement(chooseTransformation); click(chooseTransformation); waitForElement(selectTransformation); sendKeys(selectTransformation, file3); tab(); click(add); defaultWait(); click(addProcess); waitForElement(addTransformation); click(addTransformation); defaultWait(); waitForElement(chooseTransformation); click(chooseTransformation); waitForElement(selectTransformation); sendKeys(selectTransformation, file4); keyboardArrowDown(); keyboardArrowDown(); keyboardArrowDown(); tab(); click(add); defaultWait(); click(addProcess); waitForElement(addTransformation); click(addTransformation); defaultWait(); waitForElement(chooseTransformation); click(chooseTransformation); waitForElement(selectTransformation); sendKeys(selectTransformation, file4); keyboardArrowDown(); keyboardArrowDown(); tab(); click(add); defaultWait(); click(addProcess); waitForElement(addTransformation); click(addTransformation); defaultWait(); waitForElement(chooseTransformation); click(chooseTransformation); waitForElement(selectTransformation); sendKeys(selectTransformation, file4); keyboardArrowDown(); tab(); click(add); defaultWait(); click(addProcess); waitForElement(addTransformation); click(addTransformation); defaultWait(); waitForElement(chooseTransformation); click(chooseTransformation); waitForElement(selectTransformation); sendKeys(selectTransformation, file4); tab(); click(add); defaultWait(); click(addProcess); waitForElement(addTransformation); click(addTransformation); defaultWait(); waitForElement(chooseTransformation); click(chooseTransformation); waitForElement(selectTransformation); sendKeys(selectTransformation, file5); keyboardArrowDown(); keyboardArrowDown(); tab(); click(add); defaultWait(); click(addProcess); waitForElement(addTransformation); click(addTransformation); defaultWait(); waitForElement(chooseTransformation); click(chooseTransformation); waitForElement(selectTransformation); sendKeys(selectTransformation, file5); keyboardArrowDown(); tab(); click(add); defaultWait(); click(addProcess); waitForElement(addTransformation); click(addTransformation); defaultWait(); waitForElement(chooseTransformation); click(chooseTransformation); waitForElement(selectTransformation); sendKeys(selectTransformation, file5); tab(); click(add); defaultWait(); click(addProcess); waitForElement(addTransformation); click(addTransformation); defaultWait(); waitForElement(chooseTransformation); click(chooseTransformation); waitForElement(selectTransformation); sendKeys(selectTransformation, file6); tab(); click(add); defaultWait(); click(addProcess); waitForElement(addModel); click(addModel); defaultWait(); waitForElement(chooseModel); click(chooseModel); waitForElement(selectTransformation); sendKeys(selectTransformation, file7); tab(); waitForElement(chooseAnalyzer); click(chooseAnalyzer); tab(); click(add); defaultWait(); waitForElement(runAutomation); click(runAutomation); waitForElement(processRunAutomation); click(processRunAutomation); } }
[ "noreply@github.com" ]
PavanGovardhanan.noreply@github.com
6b0e12cd9d0d8cb22a73696d1112ff694d47c991
24345b0ba19cf0ba05dca18fcf93094886726f47
/app/src/main/java/com/drife/digitaf/retrofitmodule/Model/CarType.java
da2931b706f6eed9473eadcc7f0057df296bd263
[]
no_license
adityarachmat1/Digitaf
6bc28cfc72a07740e730f1b13df6788477236d93
cbc5c8a76479e3fb31bb3cbcddf53c9fd82f34aa
refs/heads/master
2020-04-22T03:00:21.245327
2019-02-11T08:30:14
2019-02-11T08:30:14
170,070,518
0
0
null
null
null
null
UTF-8
Java
false
false
2,818
java
package com.drife.digitaf.retrofitmodule.Model; import com.google.gson.annotations.SerializedName; public class CarType { @SerializedName("id") private String id; @SerializedName("code") private String code; @SerializedName("name") private String name; @SerializedName("description") private String description; @SerializedName("car_model_id") private String car_model_id; @SerializedName("created_by") private String created_by; @SerializedName("modified_by") private String modified_by; @SerializedName("is_active") private String is_active; @SerializedName("is_active_confins") private String is_active_confins; @SerializedName("created_at") private String created_at; @SerializedName("updated_at") private String updated_at; @SerializedName("deleted_at") private String deleted_at; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getCar_model_id() { return car_model_id; } public void setCar_model_id(String car_model_id) { this.car_model_id = car_model_id; } public String getCreated_by() { return created_by; } public void setCreated_by(String created_by) { this.created_by = created_by; } public String getModified_by() { return modified_by; } public void setModified_by(String modified_by) { this.modified_by = modified_by; } public String getIs_active() { return is_active; } public void setIs_active(String is_active) { this.is_active = is_active; } public String getIs_active_confins() { return is_active_confins; } public void setIs_active_confins(String is_active_confins) { this.is_active_confins = is_active_confins; } public String getCreated_at() { return created_at; } public void setCreated_at(String created_at) { this.created_at = created_at; } public String getUpdated_at() { return updated_at; } public void setUpdated_at(String updated_at) { this.updated_at = updated_at; } public String getDeleted_at() { return deleted_at; } public void setDeleted_at(String deleted_at) { this.deleted_at = deleted_at; } }
[ "aditrachmat1@gmail.com" ]
aditrachmat1@gmail.com
48d511356209386b2b0e00cd679f57152a109137
88d39a7428a2f739ac390bced9de8e31e04e49c2
/Springs/Spring Demo(Practise JDBC)/src/com/spring/MainApp.java
1043cc998a3b43747ef1c47a7244199f6ac18284
[]
no_license
darshanmestry/workspace
862ce98e3061173ca7e7f9b289853fd131ab52fb
585c1567cd9e043372bf3a3de532aa64deeb79c9
refs/heads/master
2020-06-18T05:05:54.078338
2016-12-04T12:20:32
2016-12-04T12:20:32
74,944,697
0
0
null
null
null
null
UTF-8
Java
false
false
855
java
package com.spring; import java.util.*; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class MainApp { public static void main(String[] args) { // TODO Auto-generated method stub ApplicationContext context=new ClassPathXmlApplicationContext("Spring.xml"); StudentJDBCTemplate studentJDBCTemplate=(StudentJDBCTemplate) context.getBean("studentJDBCTemplate"); System.out.println("Record creation"); studentJDBCTemplate.create("abc", 18); System.out.println("Display records"); List<Student> students=studentJDBCTemplate.listStudent(); for(Student records: students) { System.out.print("ID: "+records.getId() ); System.out.print(",Name: "+records.getName()); System.out.println(",Age:"+records.getAge()); } } }
[ "dm.personaldocs@gmail.com" ]
dm.personaldocs@gmail.com
44d2d666a2b1154c7f06caf888fddf5e78d06290
e1adfbd140b6587e8ba94b47393bdd6f9b733bbc
/app/src/main/java/com/yf/autotask/WelconActivity.java
2acf5e138ce6b893583fef2134cf9942d0a82bdb
[]
no_license
yanglangfei/AutoTask
9db2349c2a141e7e21e9a3cdabce3544d3a26437
07618d65ea01d0ea718860e556d5027f0ad0c4de
refs/heads/master
2020-07-12T16:29:50.799413
2016-11-22T07:03:00
2016-11-22T07:03:00
73,903,584
0
0
null
null
null
null
UTF-8
Java
false
false
571
java
package com.yf.autotask; import android.os.Bundle; import android.view.View; import android.webkit.WebView; /** * Created by Administrator on 2016/11/17. */ public class WelconActivity extends BaseActivity { private WebView wv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ui_welcom); wv= (WebView) findViewById(R.id.wv); wv.getSettings().setJavaScriptEnabled(true); // wv.loadUrl(); } public void onJs(View view){ } }
[ "185601452@qq.com" ]
185601452@qq.com
a5475c358f0935b70bd95fbdf7e2c5a297cc68c0
238c4251bbc7b6de3801b421ba8396bd93ec6d52
/src/main/java/com/ice/pattern/visitor/Straberry.java
b86801c8764ee53802f8cc32ce3897ea6efc0a31
[]
no_license
warmicelb/test
aebdabd010a44004694f7dc5e8c33dc0c56daa2e
ef86579e7daa0a2a3b3feb7178f55f3b4c3b57fc
refs/heads/master
2022-12-22T12:55:49.709866
2019-12-19T03:49:12
2019-12-19T03:49:12
203,124,594
1
0
null
2022-12-16T04:58:03
2019-08-19T07:50:35
Java
UTF-8
Java
false
false
288
java
package com.ice.pattern.visitor; /** * 实现accept接口 * @author: ice * @create: 2019/4/2 **/ public class Straberry implements FruitVisit { @Override public void accept(Visitor visitor) { visitor.visit(this); } @Override public void eat() { } }
[ "851354511@qq.com" ]
851354511@qq.com
74b596293d8b8634e589d737a979585e4122ba12
8191bd7f71730a5213a9e364e9e409f7011442f6
/MVC Design Pattern/MVC Design Pattern/src/mvcdesignpattern/CalculatorModel.java
1b6083ab43bd668790f9702c2baea5e9e98ccf3c
[]
no_license
ParthoShuvo/DesignPattern
ea64fd671316a0a9599eb8960c25517788bd2e59
621ad76a4e90830ca8b128ef8eebc94fad576536
refs/heads/master
2021-01-10T15:59:21.983140
2016-04-10T16:50:53
2016-04-10T16:50:53
52,113,196
1
0
null
null
null
null
UTF-8
Java
false
false
222
java
package mvcdesignpattern; public class CalculatorModel { private int sum; public CalculatorModel() { } public void addTwoNumber(int a, int b) { sum = a + b; } public int getCalculation() { return sum; } }
[ "shuvojitsahashuvo@gmail.com" ]
shuvojitsahashuvo@gmail.com
e123c83a0108b867c1f33a56ea7902df4df3927f
6b3de994d2e803e1c7d858384d65cd2f0742f17b
/src/main/java/vehiculos/Vehiculo.java
86a8a2464e9311a0798309f844f461a616a9b739
[]
no_license
Uroboros-Z23/taller-6-erjimene
8eb4678b95a466dae0ce9c1f259aeb504054ac16
5f42c0af9d92e31357729b48b48a533190d6bf6d
refs/heads/master
2022-12-23T23:07:18.501866
2020-10-06T20:12:29
2020-10-06T20:12:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,114
java
package vehiculos; public class Vehiculo { private String placa; private int puertas; private int velocidadMaxima; private String nombre; private int precio; private int peso; private String traccion; private Fabricante fabricante; private static int cantidadVehiculos; public Vehiculo(String placa, int puertas, int velocidadMaxima, String nombre, int precio, int peso, String traccion, Fabricante fabricante) { super(); this.placa = placa; this.puertas = puertas; this.velocidadMaxima = velocidadMaxima; this.nombre = nombre; this.precio = precio; this.peso = peso; this.traccion = traccion; this.fabricante = fabricante; cantidadVehiculos++; fabricante.setVentas(); } public String getPlaca() { return placa; } public void setPlaca(String placa) { this.placa = placa; } public int getPuertas() { return puertas; } public void setPuertas(int puertas) { this.puertas = puertas; } public int getVelocidadMaxima() { return velocidadMaxima; } public void setVelocidadMaxima(int velocidadMaxima) { this.velocidadMaxima = velocidadMaxima; } public String getNombre() { return nombre; } public void setNombre(String nombre) { this.nombre = nombre; } public int getPrecio() { return precio; } public void setPrecio(int precio) { this.precio = precio; } public int getPeso() { return peso; } public void setPeso(int peso) { this.peso = peso; } public String getTraccion() { return traccion; } public void setTraccion(String traccion) { this.traccion = traccion; } public Fabricante getFabricante() { return fabricante; } public void setFabricante(Fabricante fabricante) { this.fabricante = fabricante; } public static int getCantidadVehiculos() { return cantidadVehiculos; } public static void setCantidadVehiculos(int cantidadVehiculos) { Vehiculo.cantidadVehiculos = cantidadVehiculos; } public String vehiculosPorTipo() { return "Automoviles: "+Automovil.getCantidadAutomoviles()+"\nCamionetas: "+Camioneta.getCantidadCamionetas()+"\nCamiones: "+Camion.getCantidadCamiones(); } }
[ "erjimene@unal.edu.co" ]
erjimene@unal.edu.co
87fe25155620b349e4bbf94cf7e54fcde859a86f
9507965cb7c50e863f80507641469e58b4736a8b
/src/Chp7_Object_Oriented_Design/Q2CallCenter/Director.java
d5d5601891976e8aa67b87969cc37d5c1841dd34
[]
no_license
ShijiZ/Cracking_the_Coding_Interview
79b2bf983321907c474e9886f70565460eb4a06c
a02be7d412ae9a1637bd17dd959ece3ad70d9527
refs/heads/master
2023-02-10T22:23:09.585336
2021-01-08T06:07:20
2021-01-08T06:07:20
208,915,168
0
0
null
null
null
null
UTF-8
Java
false
false
219
java
package Chp7_Object_Oriented_Design.Q2CallCenter; public class Director extends Employee { public Director(CallHandler callHandler, String id){ super(callHandler, id); rank = Rank.Director; } }
[ "zhaoshiji2016@gmail.com" ]
zhaoshiji2016@gmail.com
4cbe32ee516ea03d0e7967f57b92b251518e8f81
5e66c2ff4acb91bb3d625c28c64415eb11c8b006
/Java-Advanced-Programming-20554/mmn12/RobotWorld/Robot.java
e4017a71aa612d57c9faa2933cfa6286d9f6dde2
[]
no_license
Adrorriver/University-Homework-and-Projects
8031800bc0eceaaa6e3c936a89156626e82eacbe
4eb5962716b026bd3953434af14e3d8fe52b9221
refs/heads/master
2020-07-26T08:21:35.343500
2016-08-27T20:55:12
2016-08-27T20:55:12
65,979,402
1
0
null
null
null
null
UTF-8
Java
false
false
2,039
java
/* * class represent a Robot with all of it's attributes */ import java.awt.Graphics; public class Robot { private int id; private Position position; private int direction; private static final int UP = 0; private static final int RIGHT = 1; private static final int DOWN = 2; private static final int LEFT = 3; private static final int CELL_SIZE = 20; private static final int CORRECTION_X = 8; private static final int CORRECTION_Y = 16; public Robot(int id, Position position, int direction) { super(); this.id = id; this.position = position; this.direction = direction; } public void move() { switch (direction) { case UP: position.set_y(position.get_y() - 1); break; case RIGHT: position.set_x(position.get_x() + 1); break; case DOWN: position.set_y(position.get_y() + 1); break; case LEFT: position.set_x(position.get_x() - 1); break; } } public void turnLeft() { if (direction == UP) { direction = LEFT; } else { direction--; } } public void turnRigth() { if (direction == LEFT) { direction = UP; } else { direction++; } } public Position getPosition() { return position; } public void setPosition(Position position) { this.position = position; } public void drawRobot(Graphics g) { g.drawOval(position.get_x() * CELL_SIZE, position.get_y() * CELL_SIZE, CELL_SIZE, CELL_SIZE); if (direction == UP) { g.drawString("^", position.get_x() * CELL_SIZE + CORRECTION_X, position.get_y() * CELL_SIZE + CORRECTION_Y); } else if (direction == RIGHT) { g.drawString(">", position.get_x() * CELL_SIZE + CORRECTION_X, position.get_y() * CELL_SIZE + CORRECTION_Y); } else if (direction == DOWN) { g.drawString("v", position.get_x() * CELL_SIZE + CORRECTION_X, position.get_y() * CELL_SIZE + CORRECTION_Y); } else { g.drawString("<", position.get_x() * CELL_SIZE + CORRECTION_X, position.get_y() * CELL_SIZE + CORRECTION_Y); } } }
[ "noreply@github.com" ]
Adrorriver.noreply@github.com
4e792f31bd1e524356503b3a2ed713bbfdd3ce82
452219970fb6080bf065bcf700e00cbf6c452b80
/spring-demo-thymeleaf/src/main/java/com/spring/demo/config/ServletInitializer.java
e48471ad7fcb9cf5e4e33a00ea08d86fcbc27678
[]
no_license
aliceclone/code-spring-hibernate
8b1a87def4c587114d9809c07759ee57e9be3fa1
6ce44e3ad7e7148bb99aca9a648c629f6b77b911
refs/heads/main
2023-06-10T13:00:06.844248
2021-06-27T15:51:51
2021-06-27T15:51:51
368,825,616
0
0
null
null
null
null
UTF-8
Java
false
false
489
java
package com.spring.demo.config; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import com.spring.demo.SpringDemoThymeleafApplication; public class ServletInitializer extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(SpringDemoThymeleafApplication.class); } }
[ "subject.edu@gmail.com" ]
subject.edu@gmail.com
72d9545e63212d259a2089c6333c35a0803e5b91
96510a5757cf40b939dfc07454c5b354e8f1ff21
/src/programmingExercices/EqualSidesOfAnArrayTest.java
6b3b3c54c22b71468ebfea72baee48db70fe91bf
[]
no_license
bankass79/programmingExercices
f9e85c9055e00689d6d8af75e80ec7f8c267d310
083f800cd2805de57bd657253602b6758a5d09c5
refs/heads/master
2021-01-18T23:04:36.663593
2017-05-22T10:47:37
2017-05-22T10:47:37
87,086,913
0
0
null
null
null
null
UTF-8
Java
false
false
857
java
package programmingExercices; import static org.junit.Assert.assertEquals; import org.junit.Test; public class EqualSidesOfAnArrayTest { @Test public void test() { assertEquals(3,EqualSidesOfAnArray.findEvenIndex(new int[] {1,2,3,4,3,2,1})); assertEquals(1,EqualSidesOfAnArray.findEvenIndex(new int[] {1,100,50,-51,1,1})); assertEquals(-1,EqualSidesOfAnArray.findEvenIndex(new int[] {1,2,3,4,5,6})); assertEquals(3,EqualSidesOfAnArray.findEvenIndex(new int[] {20,10,30,10,10,15,35})); assertEquals(-1,EqualSidesOfAnArray.findEvenIndex(new int[] {-8505, -5130, 1926, -9026})); assertEquals(1,EqualSidesOfAnArray.findEvenIndex(new int[] {2824, 1774, -1490, -9084, -9696, 23094})); assertEquals(6,EqualSidesOfAnArray.findEvenIndex(new int[] {4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4})); } }
[ "amadoumguindo@yahoo.fr" ]
amadoumguindo@yahoo.fr
33d26d7d4d8ef5f8b5480b37dc65070096af6a83
fa8b72c78f4a098b339c5a06331639e6d49470b8
/social-core/src/test/java/com/epam/brest/course2015/social/core/FriendshipTest.java
e867f78ddc1fb2f6dcb8123fd680b84d03112c64
[]
no_license
Brest-Java-Course-2015/Alejano-Borhez-Social
535c7fd69993538ad0e25cf13578a59ba02f4934
a9e96161c4406fed9052b009cb455c258981cff6
refs/heads/master
2021-01-19T14:03:42.198431
2016-07-07T09:29:52
2016-07-07T09:29:52
46,605,202
1
1
null
null
null
null
UTF-8
Java
false
false
2,094
java
package com.epam.brest.course2015.social.core; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import java.util.Date; import static org.junit.Assert.*; /** * Created by alexander on 26.10.15. */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:test-spring-core.xml"}) public class FriendshipTest { private static final Integer testFirstFriend = 1; private static final Integer testSecondFriend = 2; @Autowired private Friendship friendship; @Test public void testGetFirstFriend() throws Exception { friendship.setFriend1Id(testFirstFriend); assertNotNull(friendship.getFriend1Id()); assertEquals(testFirstFriend, friendship.getFriend1Id()); } @Test public void testGetSecondFriend() throws Exception { friendship.setFriend2Id(testSecondFriend); assertNotNull(friendship.getFriend2Id()); assertEquals(testSecondFriend, friendship.getFriend2Id()); } @Test public void testGetCreatedDate() throws Exception { friendship.setCreatedDate(new Date()); assertNotNull(friendship.getCreatedDate()); assertEquals(Date.class, friendship.getCreatedDate().getClass()); } @Test public void testBaseConstructor() throws Exception { Friendship testFriendship = new Friendship(testFirstFriend, testSecondFriend); assertNotNull(testFriendship); assertEquals(testFirstFriend, testFriendship.getFriend1Id()); assertEquals(Integer.class, testFriendship.getFriend1Id().getClass()); assertEquals(testSecondFriend, testFriendship.getFriend2Id()); assertEquals(Integer.class, testFriendship.getFriend2Id().getClass()); assertNotNull(testFriendship.getCreatedDate()); assertEquals(Date.class, testFriendship.getCreatedDate().getClass()); } }
[ "alexander.borohov17@gmail.com" ]
alexander.borohov17@gmail.com
65c78394cedecd233f16bd2d4be49cf379f64ca1
89440428ce025e1a6f60de3569f563c80ce09f1d
/WebSite/src/ec/EcHelper.java
0d42ff316f1948e565403c758a60b2d33f9440af
[]
no_license
ShioriTateyama/MyWebSite
9457de64c22d75856a4e8f6bf2a16ef1f3114173
883866ab735a5e7fc051a00c24294bdb1cc87516
refs/heads/master
2020-04-19T22:58:41.525451
2019-02-25T09:15:14
2019-02-25T09:15:14
168,484,664
0
0
null
null
null
null
UTF-8
Java
false
false
1,942
java
package ec; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; import javax.servlet.http.HttpSession; import beans.ItemDetailBeans; /** * 定数保持、処理及び表示簡略化ヘルパークラス * * @author d-yamaguchi * */ public class EcHelper { /** * 商品の合計金額を算出する * * @param items * @return total */ public static int getTotalItemPrice(ArrayList<ItemDetailBeans> items) { int total = 0; for (ItemDetailBeans item : items) { total += item.getPrice()*item.getQuantity(); } return total; } public static int getTotalItemQuantity(ArrayList<ItemDetailBeans> items) { int total = 0; for (ItemDetailBeans item : items) { total += item.getQuantity(); } return total; } /** * ハッシュ関数 * * @param target * @return */ public static String getSha256(String target) { MessageDigest md = null; StringBuffer buf = new StringBuffer(); try { md = MessageDigest.getInstance("SHA-256"); md.update(target.getBytes()); byte[] digest = md.digest(); for (int i = 0; i < digest.length; i++) { buf.append(String.format("%02x", digest[i])); } } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return buf.toString(); } /** * セッションから指定データを取得(削除も一緒に行う) * * @param session * @param str * @return */ public static Object cutSessionAttribute(HttpSession session, String str) { Object test = session.getAttribute(str); session.removeAttribute(str); return test; } /** * ログインIDのバリデーション * * @param inputLoginId * @return */ public static boolean isLoginIdValidation(String inputLoginId) { // 英数字アンダースコア以外が入力されていたら if (inputLoginId.matches("[0-9a-zA-Z-_]+")) { return true; } return false; } }
[ "shiori@tatesanshiorinoMacBook-Pro.local" ]
shiori@tatesanshiorinoMacBook-Pro.local
e6259b5ace0f7747d54b3ed386c41e9c92e7c8f8
0af8b92686a58eb0b64e319b22411432aca7a8f3
/api-vs-impl-small/core/src/main/java/org/gradle/testcore/performancenull_10/Productionnull_1000.java
64f0247aa3a881c0ce7fda6d68ef868c726a10d5
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
589
java
package org.gradle.testcore.performancenull_10; public class Productionnull_1000 { private final String property; public Productionnull_1000(String param) { this.property = param; } public String getProperty() { return property; } private String prop0; public String getProp0() { return prop0; } public void setProp0(String value) { prop0 = value; } private String prop1; public String getProp1() { return prop1; } public void setProp1(String value) { prop1 = value; } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
cd70d80e7f2b4ce9a83cb4bba8642b299d881b2d
1f64ebd0f55a84c3a43316f772f2a30bb93860a6
/JSON-CliniqueManagementSystem-master/src/com/bridgelabz/Driver/CliniqueManagementApp.java
f2aa098e7135b4505eb8acb12873c11eed55abdc
[]
no_license
narayanmestry/ObjectOrientedPrograms
2dde3e67bb1a70e58647386cf052a2f9ec9cb808
8e75f4b1e2fbbffc6435cab87842bd1efd31897c
refs/heads/master
2021-03-11T10:21:25.722190
2020-03-11T09:10:13
2020-03-11T09:10:13
246,523,227
0
0
null
null
null
null
UTF-8
Java
false
false
1,131
java
package com.bridgelabz.Driver; import java.io.IOException; import com.bridgelabz.controller.CliniqueControl; import com.bridgelabz.utility.Utility; public class CliniqueManagementApp { public static void main(String[] args) throws IOException { start(); } public static void start() throws IOException { int ch; char c; do { System.out.println("Select the User :\n1.Admin\n2.User (Doctor/Patient)"); ch = Utility.inputNumber(); switch (ch) { case 1: System.out.println("Enter the Username :"); String uname = Utility.inputString(); System.out.println("Enter the Password"); String pass = Utility.inputString(); if (uname.equals("admin") && pass.equals("admin123")) { CliniqueControl.adminOperation(); } else { System.out.println("Invalid Username and Password"); } break; case 2: CliniqueControl.UserOperation(); break; default: System.out.println("Enter the Valid Choice ..........!!!!!"); } System.out.println("Do you want to Continue : ............Press Y or y"); c = Utility.inputchar(); } while (c == 'Y' || c == 'y'); } }
[ "mestryn9727@gmail.com" ]
mestryn9727@gmail.com
7f628cd8226cf9c5afcb6c2ec5bafd120e7115a5
bb565c646c7cce82c9be9eb3289a8dd811fd38c7
/EasyExpressionSystem/src/main/java/com/elminster/easyexpression/func/StandardOperation.java
83c196ad3425d31c625b255b48fbdd55b843918f
[ "Apache-2.0" ]
permissive
elminsterjimmy/java
d097690777fbf49bc93f8a2b83fa490ae9d5526a
c2dc2d57e17ecba646a1d8db6f7e317f72e5d6e6
refs/heads/master
2020-04-10T13:20:49.232581
2014-12-19T09:12:12
2014-12-19T09:12:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,031
java
package com.elminster.easyexpression.func; import com.elminster.easyexpression.DataType; import com.elminster.easyexpression.operator.AndOperator; import com.elminster.easyexpression.operator.DivOperator; import com.elminster.easyexpression.operator.EqualCompareOperator; import com.elminster.easyexpression.operator.GreaterEqualThanCompareOperator; import com.elminster.easyexpression.operator.GreaterThanCompareOperator; import com.elminster.easyexpression.operator.LessEqualThanCompareOperator; import com.elminster.easyexpression.operator.LessThanCompareOperator; import com.elminster.easyexpression.operator.MinusOperator; import com.elminster.easyexpression.operator.NotEqualCompareOperator; import com.elminster.easyexpression.operator.OrOperator; import com.elminster.easyexpression.operator.PLSOperator; import com.elminster.easyexpression.operator.PlusOperator; import com.elminster.easyexpression.operator.SubOperator; public class StandardOperation { public static final Operator1Def MINUS = new Operator1Def("-", 13, DataType.OBJECT, DataType.OBJECT, MinusOperator.INSTANCE); public static final Operator2Def EQ = new Operator2Def("=", 9, DataType.OBJECT, DataType.OBJECT, DataType.BOOLEAN, EqualCompareOperator.INSTANCE); public static final Operator2Def GET = new Operator2Def(">=", 9, DataType.OBJECT, DataType.OBJECT, DataType.BOOLEAN, GreaterEqualThanCompareOperator.INSTANCE); public static final Operator2Def GT = new Operator2Def(">", 9, DataType.OBJECT, DataType.OBJECT, DataType.BOOLEAN, GreaterThanCompareOperator.INSTANCE); public static final Operator2Def LET = new Operator2Def("<=", 9, DataType.OBJECT, DataType.OBJECT, DataType.BOOLEAN, LessEqualThanCompareOperator.INSTANCE); public static final Operator2Def LT = new Operator2Def("<", 9, DataType.OBJECT, DataType.OBJECT, DataType.BOOLEAN, LessThanCompareOperator.INSTANCE); public static final Operator2Def NEQ1 = new Operator2Def("<>", 9, DataType.OBJECT, DataType.OBJECT, DataType.BOOLEAN, NotEqualCompareOperator.INSTANCE); public static final Operator2Def NEQ2 = new Operator2Def("!=", 9, DataType.OBJECT, DataType.OBJECT, DataType.BOOLEAN, NotEqualCompareOperator.INSTANCE); public static final Operator2Def AND = new Operator2Def("and", 8, DataType.OBJECT, DataType.OBJECT, DataType.BOOLEAN, AndOperator.INSTANCE); public static final Operator2Def OR = new Operator2Def("or", 7, DataType.OBJECT, DataType.OBJECT, DataType.BOOLEAN, OrOperator.INSTANCE); public static final Operator2Def PLUS = new Operator2Def("+", 10, DataType.OBJECT, DataType.OBJECT, DataType.OBJECT, PlusOperator.INSTANCE); public static final Operator2Def SUB = new Operator2Def("-", 10, DataType.OBJECT, DataType.OBJECT, DataType.OBJECT, SubOperator.INSTANCE); public static final Operator2Def PLS = new Operator2Def("*", 11, DataType.OBJECT, DataType.OBJECT, DataType.OBJECT, PLSOperator.INSTANCE); public static final Operator2Def DIV = new Operator2Def("/", 11, DataType.OBJECT, DataType.OBJECT, DataType.OBJECT, DivOperator.INSTANCE); }
[ "Jinglei.Gu@kisters.cn" ]
Jinglei.Gu@kisters.cn
bd15127acc84e8d21540d2fc4378e9576d0d00e4
2ff780e3fbf5a4039a01da6bc670d4c152db4f0f
/app/src/main/java/com/profitfarm/hlks/profit_farm/base/BaseActivity.java
61977bf780d8d5bdc7d5879bedecc204c4fe40be
[]
no_license
GitHubZSDGH/Profit_Farm
8417f38c4129e4f7eb2947f12e4bb1c52e458d10
15668a0c9a0395fb120faf34899da09f7ddb22fa
refs/heads/master
2020-03-15T20:12:15.727044
2018-05-06T12:21:10
2018-05-06T12:21:10
132,327,159
0
1
null
null
null
null
UTF-8
Java
false
false
15,548
java
package com.profitfarm.hlks.profit_farm.base; import android.app.Activity; import android.app.ActivityManager; import android.content.Context; import android.content.pm.ActivityInfo; import android.content.res.Configuration; import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.os.IBinder; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.view.MotionEvent; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import com.profitfarm.hlks.profit_farm.App; import com.profitfarm.hlks.profit_farm.utils.KeyBoardUtils; import java.lang.reflect.Method; import java.util.List; import java.util.Stack; import butterknife.ButterKnife; /** * 编写人:老田 * Created by localadmin on 2017/7/28. */ //所有的activity继承AutoLayoutActivity public abstract class BaseActivity extends AppCompatActivity { //判断是否从后台切换到前台 private int count; private static boolean isActive; private boolean isSearchEditTextCeanter = false; private KeyBordListener keyBordListener; private int[] ids; /** * 用来保存所有已打开的Activity这有坑 */ private static Stack<Activity> listActivity = new Stack<Activity>(); @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); listActivity.push(this); if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } setContentView(getLayoutId()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (!isEMUI3_1()) { window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(Color.TRANSPARENT); getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); } } App.baseActivity = this; // getSupportActionBar().hide(); ButterKnife.bind(this); initView(); loadData(); setListener(); } public static boolean isEMUI3_1() { if ("EmotionUI_3.1".equals(getEmuiVersion())) { return true; } return false; } private static String getEmuiVersion(){ Class<?> classType = null; try { classType = Class.forName("android.os.SystemProperties"); Method getMethod = classType.getDeclaredMethod("get", String.class); return (String)getMethod.invoke(classType, "ro.build.version.emui"); } catch (Exception e){ } return ""; } public void setKeyBordListener(KeyBordListener keyBordListener) { this.keyBordListener = keyBordListener; } public void setKeyBordListenerNull() { keyBordListener = null; } public abstract int getLayoutId(); public abstract void initView(); public abstract void loadData(); public abstract void setListener(); @Override protected void onResume() { super.onResume(); App.baseActivity = this; } /** * APP是否处于前台唤醒状态 * * @return */ public boolean isAppOnForeground() { ActivityManager activityManager = (ActivityManager) getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE); String packageName = getApplicationContext().getPackageName(); List<ActivityManager.RunningAppProcessInfo> appProcesses = activityManager .getRunningAppProcesses(); if (appProcesses == null) return false; for (ActivityManager.RunningAppProcessInfo appProcess : appProcesses) { // The name of the process that this object is associated with. if (appProcess.processName.equals(packageName) && appProcess.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) { return true; } } return false; } @Override public boolean dispatchTouchEvent(MotionEvent ev) { // if (ev.getAction() == MotionEvent.ACTION_DOWN) { // if (isSearchEditTextCeanter) { // View v = getCurrentFocus(); // if (isShouldHideKeyboard(v, ev)) { // hideKeyboard(v.getWindowToken()); // } // } // } if (ev.getAction() == MotionEvent.ACTION_DOWN) { if (isTouchView(filterViewByIds(), ev)) return super.dispatchTouchEvent(ev); if (hideSoftByEditViewIds() == null || hideSoftByEditViewIds().length == 0) return super.dispatchTouchEvent(ev); View v = getCurrentFocus(); if (isFocusEditText(v, hideSoftByEditViewIds())) { if (isTouchView(hideSoftByEditViewIds(), ev)) return super.dispatchTouchEvent(ev); //隐藏键盘 KeyBoardUtils.hideInputForce(this); if (keyBordListener != null) { keyBordListener.onHideKeyBord(); } // clearViewFocus(v, hideSoftByEditViewIds());//解决焦点问题 } } return super.dispatchTouchEvent(ev); } /** * 清除editText的焦点 * * @param v 焦点所在View * @param ids 输入框 */ public void clearViewFocus(View v, int... ids) { if (null != v && null != ids && ids.length > 0) { for (int id : ids) { if (v.getId() == id) { v.clearFocus(); break; } } } } /** * 隐藏键盘 * * @param v 焦点所在View * @param ids 输入框 * @return true代表焦点在edit上 */ public boolean isFocusEditText(View v, int... ids) { if (v instanceof EditText) { EditText tmp_et = (EditText) v; for (int id : ids) { if (tmp_et.getId() == id) { return true; } } } return false; } /** * 传入EditText的Id * 没有传入的EditText不做处理 * * @return id 数组 */ public int[] hideSoftByEditViewIds() { return ids; } public void hideEditext(int[] ids){ this.ids = ids; } /** * 传入要过滤的View * 过滤之后点击将不会有隐藏软键盘的操作 * * @return id 数组 */ public View[] filterViewByIds() { return null; } //是否触摸在指定view上面,对某个控件过滤 public boolean isTouchView(View[] views, MotionEvent ev) { if (views == null || views.length == 0) return false; int[] location = new int[2]; for (View view : views) { view.getLocationOnScreen(location); int x = location[0]; int y = location[1]; if (ev.getX() > x && ev.getX() < (x + view.getWidth()) && ev.getY() > y && ev.getY() < (y + view.getHeight())) { return true; } } return false; } //是否触摸在指定view上面,对某个控件过滤 public boolean isTouchView(int[] ids, MotionEvent ev) { int[] location = new int[2]; for (int id : ids) { View view = findViewById(id); if (view == null) continue; view.getLocationOnScreen(location); int x = location[0]; int y = location[1]; if (ev.getX() > x && ev.getX() < (x + view.getWidth()) && ev.getY() > y && ev.getY() < (y + view.getHeight())) { return true; } } return false; } /** * 根据EditText所在坐标和用户点击的坐标相对比,来判断是否隐藏键盘,因为当用户点击EditText时则不能隐藏 * * @param v * @param event * @return */ private boolean isShouldHideKeyboard(View v, MotionEvent event) { if (v != null && (v instanceof EditText)) { int[] l = {0, 0}; v.getLocationInWindow(l); int left = l[0], top = l[1], bottom = top + v.getHeight(), right = left + v.getWidth(); if (event.getX() > left && event.getX() < right && event.getY() > top && event.getY() < bottom) { // 点击EditText的事件,忽略它。 return false; } else { v.clearFocus(); return true; } } // 如果焦点不是EditText则忽略,这个发生在视图刚绘制完,第一个焦点不在EditText上,和用户用轨迹球选择其他的焦点 return false; } /** * 获取InputMethodManager,隐藏软键盘 * * @param token */ public void hideKeyboard(IBinder token) { if (token != null) { InputMethodManager im = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE); im.hideSoftInputFromWindow(token, InputMethodManager.HIDE_NOT_ALWAYS); } } public void setIsSearchEditTextCeanter(boolean isSearchEditTextCeanter) { this.isSearchEditTextCeanter = isSearchEditTextCeanter; } public interface KeyBordListener { void onHideKeyBord(); } // @Override // protected void onStart() { // super.onStart(); // if (mLoginReceiver == null) { // mLoginReceiver = new SingleLoginReceiver(); // } // if (loginBroadcastReceiver == null) { // loginBroadcastReceiver = new CoreService.LoginBroadcastReceiver(); // } // IntentFilter loginFilter = new IntentFilter(); // loginFilter.addAction(AppBroadcastAction.XMPP_LOGIN_ACTION); // registerReceiver(loginBroadcastReceiver, loginFilter); // mLoginReceiver.setSingleLoginListener(mSingleLoginListener); // IntentFilter intentFilter = new IntentFilter(); // intentFilter.addAction(AppBroadcastAction.SINGLE_LOGIN_ACTION); // registerReceiver(mLoginReceiver, intentFilter); // } // // @Override // protected void onDestroy() { // try { // unregisterReceiver(mLoginReceiver); // unregisterReceiver(loginBroadcastReceiver); // } catch (IllegalArgumentException e) { // } // super.onDestroy(); // // 从栈中移除当前activity // if (listActivity.contains(this)) { // listActivity.remove(this); // } // } // // /** // * 关闭所有(前台、后台)Activity,注意:请以BaseActivity为父类 // */ // protected static void finishAll() { // int len = listActivity.size(); // for (int i = 0; i < len; i++) { // Activity activity = listActivity.pop(); // activity.finish(); // } // } // private SingleLoginReceiver mLoginReceiver; // private CoreService.LoginBroadcastReceiver loginBroadcastReceiver; // /** // * 单点登录接收广播 // */ // private SingleLoginReceiver.SingleLoginListener mSingleLoginListener = new SingleLoginReceiver.SingleLoginListener() { // // String token = SharedPreferencesUtils.getString(KeyUtils.TOKEN_KEY); // //// @Override //// public void onReceive(final Context context, Intent intent) { //// if (intent != null) { //// Log.e("KKKK", "服务器==" + intent.getStringExtra("token")); //// Log.e("KKKK", "本地==" + UserUtils.getToken()); //// //// boolean isLoginOut = intent.getBooleanExtra("isLoginOut", false); //// if (isLoginOut && UserUtils.getToken().equals(intent.getStringExtra("token"))) { //// AppAlertDialog dialog = new AppAlertDialog(context, true, true, true); //// dialog.setCanceledOnTouchOutside(false); //// dialog.setTitle("下线通知"); //// dialog.setMessage("您的账号于" + TimeUtils.getNowString(new SimpleDateFormat("yyyy年MM月dd日HH时mm分", Locale.getDefault())) //// + "在另一台设备上登录,如非本人操作建议登录后修改密码或联系客服95132修改"); //// dialog.setLeftButton("退出", new View.OnClickListener() { //// @Override //// public void onClick(View v) { //// SharedPreferencesUtils.remove(KeyUtils.TOKEN_KEY); //// finishAll(); //// } //// }); //// dialog.setRightButton("重新登录", new View.OnClickListener() { //// @Override //// public void onClick(View v) { //// finishAll(); //// startActivity(new Intent(context, LoginActivity.class)); //// } //// }); //// } // @Override // public void singleLoginListener(boolean isLoginOut, String imToken) { // LogUtils.e("-----------Token = " + token); // LogUtils.e("-----------imToken = " + imToken); // if("myokhttp".equals(imToken)){ // imToken = UserUtils.getToken(); // } // if (isLoginOut && token.equals(imToken)) { // AppAlertDialog dialog = new AppAlertDialog(BaseActivity.this, true, true, true); // dialog.setCanceledOnTouchOutside(false); // dialog.setTitle("下线通知"); // dialog.setMessage("您的账号于" + TimeUtils.getNowString(new SimpleDateFormat("yyyy年MM月dd日HH时mm分", Locale.getDefault())) // + "在另一台设备上登录,如非本人操作建议登录后修改密码或联系客服95132修改"); // dialog.setLeftButton("退出", new View.OnClickListener() { // @Override // public void onClick(View v) { // SharedPreferencesUtils.remove(KeyUtils.TOKEN_KEY); // finishAll(); // } // }); // dialog.setRightButton("重新登录", new View.OnClickListener() { // @Override // public void onClick(View v) { // finishAll(); // startActivity(new Intent(BaseActivity.this, LoginActivity.class)); // } // }); // } // } // }; }
[ "402401594@qq.com" ]
402401594@qq.com
cbb8ab97d32cfb9d4d41f2a14f0cee3592ea4ef8
bbb31ebaa33b437ab1a4c5200ba7b4bb24415252
/src/creational/factory/Blog.java
5304f463c34ecabce1302e3f1e13a5acba7ec283
[]
no_license
abalakka/design-patterns
f996b60fbae458b2e288462af2d0252e0744311c
f09f3ca5ca2c3a8be130f8d6a7e6c3418cc89665
refs/heads/master
2020-09-04T21:57:27.618773
2019-12-18T04:28:38
2019-12-18T04:28:38
219,902,912
0
0
null
null
null
null
UTF-8
Java
false
false
249
java
package creational.factory; public class Blog extends Website { @Override public void createWebsite() { pages.add(new Post()); pages.add(new About()); } @Override public String toString() { return "Blog [pages=" + pages + "]"; } }
[ "anirudhbalakka@gmail.com" ]
anirudhbalakka@gmail.com
e7b77425f08a5ebdf99f4d38bcd6e1c423eeed25
76896aa5dd3b241696602eb79038405e123f56d2
/src/cn/student/servlet/StudentLeave.java
09aa3de0f2db363ffcabb9afccef6d1825a0e594
[]
no_license
songshuhome/couragesTest
a830a297850fd0ad29c2c32225e631263cbc0172
5368395e1d234567f7ac5e32f76171d710cf18b2
refs/heads/master
2021-08-24T10:56:41.855241
2017-12-09T10:54:29
2017-12-09T10:54:29
113,662,542
0
0
null
null
null
null
UTF-8
Java
false
false
5,082
java
package cn.student.servlet; import cn.admin.facory.FactoryService; import cn.student.factory.ServiceFactory; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.sql.SQLException; import java.util.Calendar; import java.util.Map; import cn.student.factory.StudentFactory; import cn.student.vo.student; import util.validate.Validate; @WebServlet(name="studentLeave",urlPatterns = "/pages/back/StudentLeave/*") public class StudentLeave extends HttpServlet { @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { this.doGet(req,resp); } protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String path="/pages/errors.jsp";//定义错误页面 String status=req.getRequestURI().substring(req.getRequestURI().lastIndexOf("/")+1); if(status!=null){ if("leave".equals(status)){ try { path=this.updateLeave(req); } catch (Exception e) { e.printStackTrace(); } }else if("sign".equals(status)){ path=this.updateSign(req); }else if("courage".equals(status)){ path=this.getCourage(req); } } req.getRequestDispatcher(path).forward(req,resp); } private String getCourage(HttpServletRequest req) { String sid= (String) req.getSession().getAttribute("aid"); Map<String ,Object> map=null; try { map= ServiceFactory.getStudentCourage().getAllCourages(sid); } catch (Exception e) { e.printStackTrace(); } req.setAttribute("allCourages",map.get("allCourages")); return "/pages/back/student/weekCourage.jsp"; } private String updateSign(HttpServletRequest req) { String msg="";//提示 String url="";//表示跳转路径 String a=req.getParameter("lng"); String b=req.getParameter("lat"); boolean flag=false; flag=getMap(a,b); String sid= (String) req.getSession().getAttribute("aid"); student vo=new student(); vo.setSid(sid); Integer time=presentTime(); if(allow(time)){ try { if(ServiceFactory.getStudentServiceLeaveInstance().updateSignStudent(vo)&&false){ msg="签到成功"; url="/pages/back/student/studentleave.jsp"; }else{ msg="签到不成功,请重新登录签到"; url="/login.jsp"; } } catch (SQLException e) { e.printStackTrace(); } }else{ msg="签到时间未到,请选者正确时间登录!"; url="/pages/back/student/studentleave.jsp"; } req.setAttribute("msg",msg); req.setAttribute("url",url); return "/pages/forward.jsp"; } private boolean getMap(String a,String b) { boolean flag=false; double f= Double.parseDouble(a); double g=Double.parseDouble(b); if((f>=115.89352755-0.1&&f<=115.89352755+0.1)&&(g>=28.689578-0.1&&g<=28.689578+0.1)){ flag=true; }else{ flag=false; } return flag; } private String updateLeave(HttpServletRequest req) { String msg="";//提示 String url="";//表示跳转路径 String sid= (String) req.getSession().getAttribute("aid"); student vo=new student(); vo.setSid(sid); Integer time=presentTime(); if(allow(time)){ try { if(ServiceFactory.getStudentServiceLeaveInstance().updateLeaveStudent(vo)){ msg="请假成功!"; url="/pages/back/student/studentleave.jsp"; }else{ msg="请假不成功,请重新登录请假"; url="/login.jsp"; } } catch (SQLException e) { e.printStackTrace(); } }else{ msg="请假时间未到,请选者正确时间登录!"; url="/pages/back/student/studentleave.jsp"; } req.setAttribute("msg",msg); req.setAttribute("url",url); return "/pages/forward.jsp"; } private Integer presentTime(){ Calendar cal=Calendar.getInstance(); int hour=cal.get(Calendar.HOUR_OF_DAY); int minnue=cal.get(Calendar.MINUTE); int time=hour*100+minnue; return time; } private boolean allow(Integer time){ if((time>=750&&time<=755)||(time>=1000&&time<=1005)||(time>=1400&&time<=1405)||(time>=1600&&time<=1605)||(time>1650)) return true; else return false; } }
[ "1505523351@qq.com" ]
1505523351@qq.com
881878dd448794714dca4a79077bb040a7850180
31cdee930dba58d1afec3467dbc65d7725863f13
/src/mylistener/listeningmechanism/listenerdemo1/PersonListener.java
759ff1252d99c63d7c2ff670492ced30b8467912
[]
no_license
woniu567/rivamed
6e7ca93ae37fbb50a939d4bcd27d300a2b9d0118
b8c370c2208ffe7d8a3d5eb0738245c4af98f1a0
refs/heads/master
2021-06-30T09:40:06.915688
2020-12-10T08:59:36
2020-12-10T08:59:36
202,953,658
0
0
null
null
null
null
UTF-8
Java
false
false
167
java
package mylistener.listeningmechanism.listenerdemo1; public interface PersonListener { public void dorun(Person person); public void doeat(Person person); }
[ "sunchaoyang@rivamed.cn" ]
sunchaoyang@rivamed.cn
00f7a0aca1e41a75c834f9e76ab1c13b8992287d
9b4c8e9267f798e1469cc7db186e028de47c4822
/src/main/java/com/numb3r3/common/db/mongodb/MongoDBFactory.java
29a7c47c5a1241c3738d17cc86225ec20feee072
[]
no_license
hezila/commons-java
5ac0d86f94ea21ef3ea98092cf962c86e4d8be5e
ad25c9312da4dd4949bfc5a7e4fe3ce885d2453f
refs/heads/master
2021-05-28T17:12:54.817538
2015-03-23T12:53:13
2015-03-23T12:53:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,882
java
package com.numb3r3.common.db.mongodb; import java.net.UnknownHostException; import java.util.List; import java.util.Map; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.mongodb.*; /** * A factory class of MongoDB database * * @author Feng Wang * */ public class MongoDBFactory { /** * The default database name */ private final static String DEFAULT_DB_NAME = "MONGO-APP-DEFAULT"; /** * The default database host url */ private final static String DEFAULT_HOST = "localhost"; /** * The default database port */ private final static int DEFAULT_PORT = 27017; /** * The MongoDB DB class instance */ // private static DB db; public static Map<String, DB> dbs = Maps.newHashMap(); public static DB cur_db = null; public static void init(String dbName) { try { MongoClient mg = new MongoClient(DEFAULT_HOST, DEFAULT_PORT); DB db = mg.getDB(dbName); cur_db = db; dbs.put(dbName, db); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MongoException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * Get the DB instance. * @return */ public static DB getDB() { return cur_db; } /** * Get the DB instance. * @return */ public static DB getDB(String dbName) { if (dbs.containsKey(dbName)) { //cur_db = dbs.get(dbName); return dbs.get(dbName); } else { try { MongoClient mg = new MongoClient(DEFAULT_HOST, DEFAULT_PORT); DB db = mg.getDB(dbName); //cur_db = db; dbs.put(dbName, db); return db; } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } catch (MongoException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } } } public static void use(String dbName){ cur_db = getDB(dbName); } public static DBCollection collection(String collectionName) { DBCollection collection = cur_db.getCollection(collectionName); return collection; } public static DBCollection collection(String dbName, String collectionName) { DB db = getDB(dbName); DBCollection collection = db.getCollection(collectionName); return collection; } public static DBCursor find(String collectionName, BasicDBObject searchQuery) { DBCollection collection = collection(collectionName); DBCursor cursor = collection.find(searchQuery); return cursor; } public static DBCursor find(String dbName, String collectionName, BasicDBObject searchQuery) { DBCollection collection = collection(dbName, collectionName); DBCursor cursor = collection.find(searchQuery); return cursor; } public static DBObject findOne(String collectionName, BasicDBObject searchQuery) { DBCollection collection = collection(collectionName); return collection.findOne(searchQuery); } public static DBObject findOne(String dbName, String collectionName, BasicDBObject searchQuery) { DBCollection collection = collection(dbName, collectionName); return collection.findOne(searchQuery); } public static void delete(String dbName, String collectionName, BasicDBObject searchQuery) { DBCollection collection = collection(dbName, collectionName); collection.remove(searchQuery); } }
[ "314159" ]
314159