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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6dd9ca0b2515590064ab188a55e58a1d89ed100a | 1a0a654723d9c09007c2732ef71f32e4f8676b7c | /Sizeof() operator/Main.java | 4f1f0dc8653f559a953701d196501d0695f9b80a | [] | no_license | kirthan0899/Playground | ec6f560129a0bbea86bd50234feeda6e2dd0e88f | 81835d1feb2f53e9f680a88f91a729c52a52d49a | refs/heads/master | 2021-05-24T12:47:18.214696 | 2020-07-18T14:21:41 | 2020-07-18T14:21:41 | 253,569,412 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 221 | java | #include<iostream>
using namespace std;
int main()
{
//Type your code here.
char a;
int b;
float c;
double d;
cout<<sizeof(a)<<endl;
cout<<sizeof(b)<<endl;
cout<<sizeof(c)<<endl;
cout<<sizeof(d)<<endl;
} | [
"50295656+kirthan0899@users.noreply.github.com"
] | 50295656+kirthan0899@users.noreply.github.com |
9f0cc2a2715d58d4c4313dd883805c8e6a521c6b | 4b0bf4787e89bcae7e4759bde6d7f3ab2c81f849 | /aliyun-java-sdk-privatelink/src/main/java/com/aliyuncs/privatelink/transform/v20200415/CheckResourceSupportOperateResponseUnmarshaller.java | af7a49e9d020713d33af3f025fbb387ad5166611 | [
"Apache-2.0"
] | permissive | aliyun/aliyun-openapi-java-sdk | a263fa08e261f12d45586d1b3ad8a6609bba0e91 | e19239808ad2298d32dda77db29a6d809e4f7add | refs/heads/master | 2023-09-03T12:28:09.765286 | 2023-09-01T09:03:00 | 2023-09-01T09:03:00 | 39,555,898 | 1,542 | 1,317 | NOASSERTION | 2023-09-14T07:27:05 | 2015-07-23T08:41:13 | Java | UTF-8 | Java | false | false | 1,457 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aliyuncs.privatelink.transform.v20200415;
import com.aliyuncs.privatelink.model.v20200415.CheckResourceSupportOperateResponse;
import com.aliyuncs.transform.UnmarshallerContext;
public class CheckResourceSupportOperateResponseUnmarshaller {
public static CheckResourceSupportOperateResponse unmarshall(CheckResourceSupportOperateResponse checkResourceSupportOperateResponse, UnmarshallerContext _ctx) {
checkResourceSupportOperateResponse.setRequestId(_ctx.stringValue("CheckResourceSupportOperateResponse.RequestId"));
checkResourceSupportOperateResponse.setResourceZoneCanBeDeleted(_ctx.booleanValue("CheckResourceSupportOperateResponse.ResourceZoneCanBeDeleted"));
checkResourceSupportOperateResponse.setResourceCanBeDowngraded(_ctx.booleanValue("CheckResourceSupportOperateResponse.ResourceCanBeDowngraded"));
return checkResourceSupportOperateResponse;
}
} | [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
93d80a9fb3113bf7952357291c85876f1aed43e5 | 56319e53f4155b0f0ae4ab249b1d3249fc8ddd98 | /apache-tomcat-8.0.39/converted/org/apache/tomcat/util/descriptor/web/MainForTestWebXmlOrdering_testOrderWebFragmentsRelative4Bug54068.java | 3eeadacf572c8faaac301fc3bf2020d2c5284811 | [] | no_license | SnowOnion/J2mConvertedTestcases | 2f904e2f2754f859f6125f248d3672eb1a70abd1 | e74b0e4c08f12e5effeeb8581670156ace42640a | refs/heads/master | 2021-01-11T19:01:42.207334 | 2017-01-19T12:22:22 | 2017-01-19T12:22:22 | 79,295,183 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 536 | java | package org.apache.tomcat.util.descriptor.web;
import org.apache.tomcat.util.descriptor.web.TestWebXmlOrdering;
public class MainForTestWebXmlOrdering_testOrderWebFragmentsRelative4Bug54068 {
public static void main(String[] args) {
try {
TestWebXmlOrdering objTestWebXmlOrdering = new TestWebXmlOrdering();
objTestWebXmlOrdering.setUp();
objTestWebXmlOrdering.testOrderWebFragmentsRelative4Bug54068();
} catch (Throwable e) {
e.printStackTrace();
}
}
}
| [
"snowonionlee@gmail.com"
] | snowonionlee@gmail.com |
9b3a3cac4c0bd36936788699b05fb3734100676c | c527445ef8883fd56053037133d03d182b4f6e3d | /src/test/java/org/ycx/uaa/web/rest/AccountResourceIntTest.java | 82cb63506ef910ad6fff12ed429e2e52913af211 | [] | no_license | zhaolj214/uaa | 3f90dbbf4abda1f7a45e1e6e81703e69389a680d | e24ac51fa78156bf51472721ffabb794348200ad | refs/heads/master | 2020-03-22T03:00:25.399835 | 2018-07-02T07:35:30 | 2018-07-02T07:35:30 | 139,407,646 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 33,171 | java | package org.ycx.uaa.web.rest;
import org.ycx.uaa.config.Constants;
import org.ycx.uaa.UaaApp;
import org.ycx.uaa.domain.Authority;
import org.ycx.uaa.domain.User;
import org.ycx.uaa.repository.AuthorityRepository;
import org.ycx.uaa.repository.UserRepository;
import org.ycx.uaa.security.AuthoritiesConstants;
import org.ycx.uaa.service.MailService;
import org.ycx.uaa.service.dto.UserDTO;
import org.ycx.uaa.service.dto.PasswordChangeDTO;
import org.ycx.uaa.web.rest.errors.ExceptionTranslator;
import org.ycx.uaa.web.rest.vm.KeyAndPasswordVM;
import org.ycx.uaa.web.rest.vm.ManagedUserVM;
import org.ycx.uaa.service.UserService;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import java.time.Instant;
import java.util.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Test class for the AccountResource REST controller.
*
* @see AccountResource
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = UaaApp.class)
public class AccountResourceIntTest {
@Autowired
private UserRepository userRepository;
@Autowired
private AuthorityRepository authorityRepository;
@Autowired
private UserService userService;
@Autowired
private PasswordEncoder passwordEncoder;
@Autowired
private HttpMessageConverter<?>[] httpMessageConverters;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Mock
private UserService mockUserService;
@Mock
private MailService mockMailService;
private MockMvc restMvc;
private MockMvc restUserMockMvc;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
doNothing().when(mockMailService).sendActivationEmail(any());
AccountResource accountResource =
new AccountResource(userRepository, userService, mockMailService);
AccountResource accountUserMockResource =
new AccountResource(userRepository, mockUserService, mockMailService);
this.restMvc = MockMvcBuilders.standaloneSetup(accountResource)
.setMessageConverters(httpMessageConverters)
.setControllerAdvice(exceptionTranslator)
.build();
this.restUserMockMvc = MockMvcBuilders.standaloneSetup(accountUserMockResource)
.setControllerAdvice(exceptionTranslator)
.build();
}
@Test
public void testNonAuthenticatedUser() throws Exception {
restUserMockMvc.perform(get("/api/authenticate")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().string(""));
}
@Test
public void testAuthenticatedUser() throws Exception {
restUserMockMvc.perform(get("/api/authenticate")
.with(request -> {
request.setRemoteUser("test");
return request;
})
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().string("test"));
}
@Test
public void testGetExistingAccount() throws Exception {
Set<Authority> authorities = new HashSet<>();
Authority authority = new Authority();
authority.setName(AuthoritiesConstants.ADMIN);
authorities.add(authority);
User user = new User();
user.setLogin("test");
user.setFirstName("john");
user.setLastName("doe");
user.setEmail("john.doe@jhipster.com");
user.setImageUrl("http://placehold.it/50x50");
user.setLangKey("en");
user.setAuthorities(authorities);
when(mockUserService.getUserWithAuthorities()).thenReturn(Optional.of(user));
restUserMockMvc.perform(get("/api/account")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.login").value("test"))
.andExpect(jsonPath("$.firstName").value("john"))
.andExpect(jsonPath("$.lastName").value("doe"))
.andExpect(jsonPath("$.email").value("john.doe@jhipster.com"))
.andExpect(jsonPath("$.imageUrl").value("http://placehold.it/50x50"))
.andExpect(jsonPath("$.langKey").value("en"))
.andExpect(jsonPath("$.authorities").value(AuthoritiesConstants.ADMIN));
}
@Test
public void testGetUnknownAccount() throws Exception {
when(mockUserService.getUserWithAuthorities()).thenReturn(Optional.empty());
restUserMockMvc.perform(get("/api/account")
.accept(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(status().isInternalServerError());
}
@Test
@Transactional
public void testRegisterValid() throws Exception {
ManagedUserVM validUser = new ManagedUserVM();
validUser.setLogin("joe");
validUser.setPassword("password");
validUser.setFirstName("Joe");
validUser.setLastName("Shmoe");
validUser.setEmail("joe@example.com");
validUser.setActivated(true);
validUser.setImageUrl("http://placehold.it/50x50");
validUser.setLangKey(Constants.DEFAULT_LANGUAGE);
validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
assertThat(userRepository.findOneByLogin("joe").isPresent()).isFalse();
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(validUser)))
.andExpect(status().isCreated());
assertThat(userRepository.findOneByLogin("joe").isPresent()).isTrue();
}
@Test
@Transactional
public void testRegisterInvalidLogin() throws Exception {
ManagedUserVM invalidUser = new ManagedUserVM();
invalidUser.setLogin("funky-log!n");// <-- invalid
invalidUser.setPassword("password");
invalidUser.setFirstName("Funky");
invalidUser.setLastName("One");
invalidUser.setEmail("funky@example.com");
invalidUser.setActivated(true);
invalidUser.setImageUrl("http://placehold.it/50x50");
invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE);
invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invalidUser)))
.andExpect(status().isBadRequest());
Optional<User> user = userRepository.findOneByEmailIgnoreCase("funky@example.com");
assertThat(user.isPresent()).isFalse();
}
@Test
@Transactional
public void testRegisterInvalidEmail() throws Exception {
ManagedUserVM invalidUser = new ManagedUserVM();
invalidUser.setLogin("bob");
invalidUser.setPassword("password");
invalidUser.setFirstName("Bob");
invalidUser.setLastName("Green");
invalidUser.setEmail("invalid");// <-- invalid
invalidUser.setActivated(true);
invalidUser.setImageUrl("http://placehold.it/50x50");
invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE);
invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invalidUser)))
.andExpect(status().isBadRequest());
Optional<User> user = userRepository.findOneByLogin("bob");
assertThat(user.isPresent()).isFalse();
}
@Test
@Transactional
public void testRegisterInvalidPassword() throws Exception {
ManagedUserVM invalidUser = new ManagedUserVM();
invalidUser.setLogin("bob");
invalidUser.setPassword("123");// password with only 3 digits
invalidUser.setFirstName("Bob");
invalidUser.setLastName("Green");
invalidUser.setEmail("bob@example.com");
invalidUser.setActivated(true);
invalidUser.setImageUrl("http://placehold.it/50x50");
invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE);
invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invalidUser)))
.andExpect(status().isBadRequest());
Optional<User> user = userRepository.findOneByLogin("bob");
assertThat(user.isPresent()).isFalse();
}
@Test
@Transactional
public void testRegisterNullPassword() throws Exception {
ManagedUserVM invalidUser = new ManagedUserVM();
invalidUser.setLogin("bob");
invalidUser.setPassword(null);// invalid null password
invalidUser.setFirstName("Bob");
invalidUser.setLastName("Green");
invalidUser.setEmail("bob@example.com");
invalidUser.setActivated(true);
invalidUser.setImageUrl("http://placehold.it/50x50");
invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE);
invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restUserMockMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(invalidUser)))
.andExpect(status().isBadRequest());
Optional<User> user = userRepository.findOneByLogin("bob");
assertThat(user.isPresent()).isFalse();
}
@Test
@Transactional
public void testRegisterDuplicateLogin() throws Exception {
// Good
ManagedUserVM validUser = new ManagedUserVM();
validUser.setLogin("alice");
validUser.setPassword("password");
validUser.setFirstName("Alice");
validUser.setLastName("Something");
validUser.setEmail("alice@example.com");
validUser.setActivated(true);
validUser.setImageUrl("http://placehold.it/50x50");
validUser.setLangKey(Constants.DEFAULT_LANGUAGE);
validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
// Duplicate login, different email
ManagedUserVM duplicatedUser = new ManagedUserVM();
duplicatedUser.setLogin(validUser.getLogin());
duplicatedUser.setPassword(validUser.getPassword());
duplicatedUser.setFirstName(validUser.getFirstName());
duplicatedUser.setLastName(validUser.getLastName());
duplicatedUser.setEmail("alicejr@example.com");
duplicatedUser.setActivated(validUser.isActivated());
duplicatedUser.setImageUrl(validUser.getImageUrl());
duplicatedUser.setLangKey(validUser.getLangKey());
duplicatedUser.setCreatedBy(validUser.getCreatedBy());
duplicatedUser.setCreatedDate(validUser.getCreatedDate());
duplicatedUser.setLastModifiedBy(validUser.getLastModifiedBy());
duplicatedUser.setLastModifiedDate(validUser.getLastModifiedDate());
duplicatedUser.setAuthorities(new HashSet<>(validUser.getAuthorities()));
// Good user
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(validUser)))
.andExpect(status().isCreated());
// Duplicate login
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(duplicatedUser)))
.andExpect(status().is4xxClientError());
Optional<User> userDup = userRepository.findOneByEmailIgnoreCase("alicejr@example.com");
assertThat(userDup.isPresent()).isFalse();
}
@Test
@Transactional
public void testRegisterDuplicateEmail() throws Exception {
// Good
ManagedUserVM validUser = new ManagedUserVM();
validUser.setLogin("john");
validUser.setPassword("password");
validUser.setFirstName("John");
validUser.setLastName("Doe");
validUser.setEmail("john@example.com");
validUser.setActivated(true);
validUser.setImageUrl("http://placehold.it/50x50");
validUser.setLangKey(Constants.DEFAULT_LANGUAGE);
validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
// Duplicate email, different login
ManagedUserVM duplicatedUser = new ManagedUserVM();
duplicatedUser.setLogin("johnjr");
duplicatedUser.setPassword(validUser.getPassword());
duplicatedUser.setFirstName(validUser.getFirstName());
duplicatedUser.setLastName(validUser.getLastName());
duplicatedUser.setEmail(validUser.getEmail());
duplicatedUser.setActivated(validUser.isActivated());
duplicatedUser.setImageUrl(validUser.getImageUrl());
duplicatedUser.setLangKey(validUser.getLangKey());
duplicatedUser.setCreatedBy(validUser.getCreatedBy());
duplicatedUser.setCreatedDate(validUser.getCreatedDate());
duplicatedUser.setLastModifiedBy(validUser.getLastModifiedBy());
duplicatedUser.setLastModifiedDate(validUser.getLastModifiedDate());
duplicatedUser.setAuthorities(new HashSet<>(validUser.getAuthorities()));
// Good user
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(validUser)))
.andExpect(status().isCreated());
// Duplicate email
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(duplicatedUser)))
.andExpect(status().is4xxClientError());
// Duplicate email - with uppercase email address
ManagedUserVM userWithUpperCaseEmail = new ManagedUserVM();
userWithUpperCaseEmail.setId(validUser.getId());
userWithUpperCaseEmail.setLogin("johnjr");
userWithUpperCaseEmail.setPassword(validUser.getPassword());
userWithUpperCaseEmail.setFirstName(validUser.getFirstName());
userWithUpperCaseEmail.setLastName(validUser.getLastName());
userWithUpperCaseEmail.setEmail(validUser.getEmail().toUpperCase());
userWithUpperCaseEmail.setActivated(validUser.isActivated());
userWithUpperCaseEmail.setImageUrl(validUser.getImageUrl());
userWithUpperCaseEmail.setLangKey(validUser.getLangKey());
userWithUpperCaseEmail.setCreatedBy(validUser.getCreatedBy());
userWithUpperCaseEmail.setCreatedDate(validUser.getCreatedDate());
userWithUpperCaseEmail.setLastModifiedBy(validUser.getLastModifiedBy());
userWithUpperCaseEmail.setLastModifiedDate(validUser.getLastModifiedDate());
userWithUpperCaseEmail.setAuthorities(new HashSet<>(validUser.getAuthorities()));
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(userWithUpperCaseEmail)))
.andExpect(status().is4xxClientError());
Optional<User> userDup = userRepository.findOneByLogin("johnjr");
assertThat(userDup.isPresent()).isFalse();
}
@Test
@Transactional
public void testRegisterAdminIsIgnored() throws Exception {
ManagedUserVM validUser = new ManagedUserVM();
validUser.setLogin("badguy");
validUser.setPassword("password");
validUser.setFirstName("Bad");
validUser.setLastName("Guy");
validUser.setEmail("badguy@example.com");
validUser.setActivated(true);
validUser.setImageUrl("http://placehold.it/50x50");
validUser.setLangKey(Constants.DEFAULT_LANGUAGE);
validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN));
restMvc.perform(
post("/api/register")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(validUser)))
.andExpect(status().isCreated());
Optional<User> userDup = userRepository.findOneByLogin("badguy");
assertThat(userDup.isPresent()).isTrue();
assertThat(userDup.get().getAuthorities()).hasSize(1)
.containsExactly(authorityRepository.findById(AuthoritiesConstants.USER).get());
}
@Test
@Transactional
public void testActivateAccount() throws Exception {
final String activationKey = "some activation key";
User user = new User();
user.setLogin("activate-account");
user.setEmail("activate-account@example.com");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(false);
user.setActivationKey(activationKey);
userRepository.saveAndFlush(user);
restMvc.perform(get("/api/activate?key={activationKey}", activationKey))
.andExpect(status().isOk());
user = userRepository.findOneByLogin(user.getLogin()).orElse(null);
assertThat(user.getActivated()).isTrue();
}
@Test
@Transactional
public void testActivateAccountWithWrongKey() throws Exception {
restMvc.perform(get("/api/activate?key=wrongActivationKey"))
.andExpect(status().isInternalServerError());
}
@Test
@Transactional
@WithMockUser("save-account")
public void testSaveAccount() throws Exception {
User user = new User();
user.setLogin("save-account");
user.setEmail("save-account@example.com");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
userRepository.saveAndFlush(user);
UserDTO userDTO = new UserDTO();
userDTO.setLogin("not-used");
userDTO.setFirstName("firstname");
userDTO.setLastName("lastname");
userDTO.setEmail("save-account@example.com");
userDTO.setActivated(false);
userDTO.setImageUrl("http://placehold.it/50x50");
userDTO.setLangKey(Constants.DEFAULT_LANGUAGE);
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN));
restMvc.perform(
post("/api/account")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(userDTO)))
.andExpect(status().isOk());
User updatedUser = userRepository.findOneByLogin(user.getLogin()).orElse(null);
assertThat(updatedUser.getFirstName()).isEqualTo(userDTO.getFirstName());
assertThat(updatedUser.getLastName()).isEqualTo(userDTO.getLastName());
assertThat(updatedUser.getEmail()).isEqualTo(userDTO.getEmail());
assertThat(updatedUser.getLangKey()).isEqualTo(userDTO.getLangKey());
assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword());
assertThat(updatedUser.getImageUrl()).isEqualTo(userDTO.getImageUrl());
assertThat(updatedUser.getActivated()).isEqualTo(true);
assertThat(updatedUser.getAuthorities()).isEmpty();
}
@Test
@Transactional
@WithMockUser("save-invalid-email")
public void testSaveInvalidEmail() throws Exception {
User user = new User();
user.setLogin("save-invalid-email");
user.setEmail("save-invalid-email@example.com");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
userRepository.saveAndFlush(user);
UserDTO userDTO = new UserDTO();
userDTO.setLogin("not-used");
userDTO.setFirstName("firstname");
userDTO.setLastName("lastname");
userDTO.setEmail("invalid email");
userDTO.setActivated(false);
userDTO.setImageUrl("http://placehold.it/50x50");
userDTO.setLangKey(Constants.DEFAULT_LANGUAGE);
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN));
restMvc.perform(
post("/api/account")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(userDTO)))
.andExpect(status().isBadRequest());
assertThat(userRepository.findOneByEmailIgnoreCase("invalid email")).isNotPresent();
}
@Test
@Transactional
@WithMockUser("save-existing-email")
public void testSaveExistingEmail() throws Exception {
User user = new User();
user.setLogin("save-existing-email");
user.setEmail("save-existing-email@example.com");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
userRepository.saveAndFlush(user);
User anotherUser = new User();
anotherUser.setLogin("save-existing-email2");
anotherUser.setEmail("save-existing-email2@example.com");
anotherUser.setPassword(RandomStringUtils.random(60));
anotherUser.setActivated(true);
userRepository.saveAndFlush(anotherUser);
UserDTO userDTO = new UserDTO();
userDTO.setLogin("not-used");
userDTO.setFirstName("firstname");
userDTO.setLastName("lastname");
userDTO.setEmail("save-existing-email2@example.com");
userDTO.setActivated(false);
userDTO.setImageUrl("http://placehold.it/50x50");
userDTO.setLangKey(Constants.DEFAULT_LANGUAGE);
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN));
restMvc.perform(
post("/api/account")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(userDTO)))
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin("save-existing-email").orElse(null);
assertThat(updatedUser.getEmail()).isEqualTo("save-existing-email@example.com");
}
@Test
@Transactional
@WithMockUser("save-existing-email-and-login")
public void testSaveExistingEmailAndLogin() throws Exception {
User user = new User();
user.setLogin("save-existing-email-and-login");
user.setEmail("save-existing-email-and-login@example.com");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
userRepository.saveAndFlush(user);
UserDTO userDTO = new UserDTO();
userDTO.setLogin("not-used");
userDTO.setFirstName("firstname");
userDTO.setLastName("lastname");
userDTO.setEmail("save-existing-email-and-login@example.com");
userDTO.setActivated(false);
userDTO.setImageUrl("http://placehold.it/50x50");
userDTO.setLangKey(Constants.DEFAULT_LANGUAGE);
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN));
restMvc.perform(
post("/api/account")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(userDTO)))
.andExpect(status().isOk());
User updatedUser = userRepository.findOneByLogin("save-existing-email-and-login").orElse(null);
assertThat(updatedUser.getEmail()).isEqualTo("save-existing-email-and-login@example.com");
}
@Test
@Transactional
@WithMockUser("change-password-wrong-existing-password")
public void testChangePasswordWrongExistingPassword() throws Exception {
User user = new User();
String currentPassword = RandomStringUtils.random(60);
user.setPassword(passwordEncoder.encode(currentPassword));
user.setLogin("change-password-wrong-existing-password");
user.setEmail("change-password-wrong-existing-password@example.com");
userRepository.saveAndFlush(user);
restMvc.perform(post("/api/account/change-password").contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO("1"+currentPassword, "new password"))))
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin("change-password-wrong-existing-password").orElse(null);
assertThat(passwordEncoder.matches("new password", updatedUser.getPassword())).isFalse();
assertThat(passwordEncoder.matches(currentPassword, updatedUser.getPassword())).isTrue();
}
@Test
@Transactional
@WithMockUser("change-password")
public void testChangePassword() throws Exception {
User user = new User();
String currentPassword = RandomStringUtils.random(60);
user.setPassword(passwordEncoder.encode(currentPassword));
user.setLogin("change-password");
user.setEmail("change-password@example.com");
userRepository.saveAndFlush(user);
restMvc.perform(post("/api/account/change-password").contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, "new password"))))
.andExpect(status().isOk());
User updatedUser = userRepository.findOneByLogin("change-password").orElse(null);
assertThat(passwordEncoder.matches("new password", updatedUser.getPassword())).isTrue();
}
@Test
@Transactional
@WithMockUser("change-password-too-small")
public void testChangePasswordTooSmall() throws Exception {
User user = new User();
String currentPassword = RandomStringUtils.random(60);
user.setPassword(passwordEncoder.encode(currentPassword));
user.setLogin("change-password-too-small");
user.setEmail("change-password-too-small@example.com");
userRepository.saveAndFlush(user);
restMvc.perform(post("/api/account/change-password").contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, "new"))))
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin("change-password-too-small").orElse(null);
assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword());
}
@Test
@Transactional
@WithMockUser("change-password-too-long")
public void testChangePasswordTooLong() throws Exception {
User user = new User();
String currentPassword = RandomStringUtils.random(60);
user.setPassword(passwordEncoder.encode(currentPassword));
user.setLogin("change-password-too-long");
user.setEmail("change-password-too-long@example.com");
userRepository.saveAndFlush(user);
restMvc.perform(post("/api/account/change-password").contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, RandomStringUtils.random(101)))))
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin("change-password-too-long").orElse(null);
assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword());
}
@Test
@Transactional
@WithMockUser("change-password-empty")
public void testChangePasswordEmpty() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setLogin("change-password-empty");
user.setEmail("change-password-empty@example.com");
userRepository.saveAndFlush(user);
restMvc.perform(post("/api/account/change-password").content(RandomStringUtils.random(0)))
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin("change-password-empty").orElse(null);
assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword());
}
@Test
@Transactional
public void testRequestPasswordReset() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
user.setLogin("password-reset");
user.setEmail("password-reset@example.com");
userRepository.saveAndFlush(user);
restMvc.perform(post("/api/account/reset-password/init")
.content("password-reset@example.com"))
.andExpect(status().isOk());
}
@Test
@Transactional
public void testRequestPasswordResetUpperCaseEmail() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
user.setLogin("password-reset");
user.setEmail("password-reset@example.com");
userRepository.saveAndFlush(user);
restMvc.perform(post("/api/account/reset-password/init")
.content("password-reset@EXAMPLE.COM"))
.andExpect(status().isOk());
}
@Test
public void testRequestPasswordResetWrongEmail() throws Exception {
restMvc.perform(
post("/api/account/reset-password/init")
.content("password-reset-wrong-email@example.com"))
.andExpect(status().isBadRequest());
}
@Test
@Transactional
public void testFinishPasswordReset() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setLogin("finish-password-reset");
user.setEmail("finish-password-reset@example.com");
user.setResetDate(Instant.now().plusSeconds(60));
user.setResetKey("reset key");
userRepository.saveAndFlush(user);
KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM();
keyAndPassword.setKey(user.getResetKey());
keyAndPassword.setNewPassword("new password");
restMvc.perform(
post("/api/account/reset-password/finish")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(keyAndPassword)))
.andExpect(status().isOk());
User updatedUser = userRepository.findOneByLogin(user.getLogin()).orElse(null);
assertThat(passwordEncoder.matches(keyAndPassword.getNewPassword(), updatedUser.getPassword())).isTrue();
}
@Test
@Transactional
public void testFinishPasswordResetTooSmall() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setLogin("finish-password-reset-too-small");
user.setEmail("finish-password-reset-too-small@example.com");
user.setResetDate(Instant.now().plusSeconds(60));
user.setResetKey("reset key too small");
userRepository.saveAndFlush(user);
KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM();
keyAndPassword.setKey(user.getResetKey());
keyAndPassword.setNewPassword("foo");
restMvc.perform(
post("/api/account/reset-password/finish")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(keyAndPassword)))
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin(user.getLogin()).orElse(null);
assertThat(passwordEncoder.matches(keyAndPassword.getNewPassword(), updatedUser.getPassword())).isFalse();
}
@Test
@Transactional
public void testFinishPasswordResetWrongKey() throws Exception {
KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM();
keyAndPassword.setKey("wrong reset key");
keyAndPassword.setNewPassword("new password");
restMvc.perform(
post("/api/account/reset-password/finish")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(keyAndPassword)))
.andExpect(status().isInternalServerError());
}
}
| [
"jhipster-bot@users.noreply.github.com"
] | jhipster-bot@users.noreply.github.com |
fcb9f490f4bf8533c2b8c9b0eb31078e6e160c3e | 446a56b68c88df8057e85f424dbac90896f05602 | /support/cas-server-support-bucket4j-core/src/main/java/org/apereo/cas/bucket4j/consumer/BucketConsumer.java | cdf7aedf9f635ca865829515fcb3612621c03d23 | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | apereo/cas | c29deb0224c52997cbfcae0073a4eb65ebf41205 | 5dc06b010aa7fd1b854aa1ae683d1ab284c09367 | refs/heads/master | 2023-09-01T06:46:11.062065 | 2023-09-01T01:17:22 | 2023-09-01T01:17:22 | 2,352,744 | 9,879 | 3,935 | Apache-2.0 | 2023-09-14T14:06:17 | 2011-09-09T01:36:42 | Java | UTF-8 | Java | false | false | 1,122 | java | package org.apereo.cas.bucket4j.consumer;
import java.util.concurrent.TimeUnit;
/**
* This is {@link BucketConsumer}.
*
* @author Misagh Moayyed
* @since 6.5.0
*/
@FunctionalInterface
public interface BucketConsumer {
/**
* Header value to indicate available tokens.
*/
String HEADER_NAME_X_RATE_LIMIT_REMAINING = "X-Rate-Limit-Remaining";
/**
* Header value to indicate available tokens once capacity is consumed..
*/
String HEADER_NAME_X_RATE_LIMIT_RETRY_AFTER_SECONDS = "X-Rate-Limit-Retry-After-Seconds";
/**
* limit of time(in nanoseconds) which thread can wait for a blocking call.
*/
long MAX_WAIT_NANOS = TimeUnit.HOURS.toNanos(1);
/**
* Permit all bucket consumer.
*
* @return the bucket consumer
*/
static BucketConsumer permitAll() {
return key -> BucketConsumptionResult.builder().consumed(true).build();
}
/**
* Consume bucket and return consumption result.
*
* @param key the key
* @return the bucket consumption result
*/
BucketConsumptionResult consume(String key);
}
| [
"mm1844@gmail.com"
] | mm1844@gmail.com |
8475aeb2baf7e1f72dc870d1e8fdf17ec59e530b | d7f8185f4f32656e597b22e6887d0fc01bf9df6d | /src/main/java/com/miklesw/conway/grid/model/CellPosition.java | e5d413d1e0025586b07c312abe357c110f3dfd4b | [] | no_license | YatingPan/conway-game-of-life | a32b969da394cc73af294ee84e748cb9ea0d32ac | 76bd98e1ad49fa442427a94657256c53b15f4cd3 | refs/heads/master | 2023-03-18T14:25:16.543252 | 2018-08-14T03:08:23 | 2018-08-14T03:17:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 901 | java | package com.miklesw.conway.grid.model;
import java.util.Objects;
public class CellPosition {
private final int x;
private final int y;
public CellPosition() {
this (0,0);
}
public CellPosition(int x, int y) {
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CellPosition that = (CellPosition) o;
return x == that.x &&
y == that.y;
}
@Override
public int hashCode() {
return Objects.hash(x, y);
}
@Override
public String toString() {
return "CellPosition{" +
"x=" + x +
", y=" + y +
'}';
}
}
| [
"miklesw@gmail.com"
] | miklesw@gmail.com |
c3a4a2a0a51f26000f666b4999cde8e050b680e9 | 5630377d9b1612326b2b84943a1488e8a09fb09e | /app/src/main/java/rs/cod3rs/shopifine/fragment/EditProfileFragmentDialog.java | 895d674eb2b0371a8e229ca5981e687b9d26dc24 | [] | no_license | cod3rs-ns/shopifine-android-app | 1ec4fff094259d033beccda24847b8da47fbe83f | 0aaa70a54634e78c6a0afb93efdae70145fd2ef5 | refs/heads/master | 2021-09-15T23:39:31.047524 | 2018-06-12T21:02:13 | 2018-06-12T21:02:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,056 | java | package rs.cod3rs.shopifine.fragment;
import android.app.FragmentManager;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.location.places.Place;
import com.google.android.gms.location.places.ui.PlaceAutocompleteFragment;
import com.google.android.gms.location.places.ui.PlaceSelectionListener;
import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Background;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.UiThread;
import org.androidannotations.annotations.ViewById;
import org.androidannotations.rest.spring.annotations.RestService;
import org.springframework.core.NestedRuntimeException;
import java.util.Objects;
import rs.cod3rs.shopifine.R;
import rs.cod3rs.shopifine.hateoas.users.UpdateUserRequest;
import rs.cod3rs.shopifine.hateoas.users.UpdateUserRequestAttributes;
import rs.cod3rs.shopifine.hateoas.users.UpdateUserRequestData;
import rs.cod3rs.shopifine.http.Users;
import static rs.cod3rs.shopifine.hateoas.DataTypes.USER_TYPE;
@EFragment(R.layout.dialog_edit_profile)
public class EditProfileFragmentDialog extends DialogFragment {
public static final String FIRST_NAME_ARG = "first_name";
public static final String LAST_NAME_ARG = "last_name";
public static final String ADDRESS_ARG = "address";
@ViewById
EditText editProfileFirstName;
@ViewById
EditText editProfileLastName;
@RestService
Users users;
@ViewById
ProgressBar editProfileProgressBar;
@ViewById
Button saveEditBtn;
private Place selectedPlace;
private Boolean addressUpdated;
private EditProfileDialogListener listener;
@AfterViews
public void updateInfo() {
final Bundle bundle = this.getArguments();
if (bundle != null) {
final String fn = bundle.getString(FIRST_NAME_ARG, "");
final String ln = bundle.getString(LAST_NAME_ARG, "");
final String address = bundle.getString(ADDRESS_ARG, "");
editProfileFirstName.setText(fn);
editProfileLastName.setText(ln);
final PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment) getActivity().getFragmentManager().findFragmentById(R.id.editProfileAddress);
final EditText placeField = (EditText) autocompleteFragment.getView().findViewById(R.id.place_autocomplete_search_input);
placeField.setText(address);
addressUpdated = false;
}
}
@AfterViews
public void customizeView() {
final PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment) getActivity().getFragmentManager().findFragmentById(R.id.editProfileAddress);
final float scaledDensity = getResources().getDisplayMetrics().scaledDensity;
final float textSize = editProfileFirstName.getTextSize() / scaledDensity;
final LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) autocompleteFragment.getView().getLayoutParams();
params.setMargins(0, 0, 0, 0);
autocompleteFragment.getView().setLayoutParams(params);
final EditText placeField = (EditText) autocompleteFragment.getView().findViewById(R.id.place_autocomplete_search_input);
placeField.setTextColor(getResources().getColor(R.color.colorWhite));
placeField.setHintTextColor(editProfileFirstName.getHintTextColors());
placeField.setHint(getResources().getString(R.string.address));
placeField.setTextSize(textSize);
final ImageView searchIcon = (ImageView) autocompleteFragment.getView().findViewById(R.id.place_autocomplete_search_button);
searchIcon.setImageDrawable(getResources().getDrawable(R.drawable.ic_person_pin_circle_white_24dp));
searchIcon.setPadding(13, 0, 0, 5);
final ImageView deleteIcon = (ImageView) autocompleteFragment.getView().findViewById(R.id.place_autocomplete_clear_button);
deleteIcon.setImageDrawable(getResources().getDrawable(R.drawable.outline_clear_white_24));
deleteIcon.setPadding(0, 0, getResources().getDimensionPixelSize(R.dimen.googleAddressClearMargin), 5);
}
@Override
public void onAttach(final Context context) {
super.onAttach(context);
try {
listener = (EditProfileDialogListener) context;
} catch (final ClassCastException e) {
throw new ClassCastException(String.format("%s must implement EditProfileDialogListener", context.toString()));
}
}
@Override
public void onDestroyView() {
super.onDestroyView();
final FragmentManager manager = getActivity().getFragmentManager();
final PlaceAutocompleteFragment placeFragment = (PlaceAutocompleteFragment) manager.findFragmentById(R.id.editProfileAddress);
if (Objects.nonNull(placeFragment)) {
manager.beginTransaction().remove(placeFragment).commit();
}
}
@AfterViews
void addAddressSelectionListener() {
final PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment) getActivity().getFragmentManager().findFragmentById(R.id.editProfileAddress);
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(final Place place) {
final EditText placeField = (EditText) autocompleteFragment.getView().findViewById(R.id.place_autocomplete_search_input);
placeField.setError(null);
addressUpdated = true;
selectedPlace = place;
}
@Override
public void onError(final Status status) {
Log.e("Google address", "An error occurred: " + status);
}
});
}
@AfterViews
void addAddressRemovingListener() {
final PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment) getActivity().getFragmentManager().findFragmentById(R.id.editProfileAddress);
autocompleteFragment.getView().findViewById(R.id.place_autocomplete_clear_button)
.setOnClickListener(view -> {
autocompleteFragment.setText("");
addressUpdated = true;
view.setVisibility(View.GONE);
selectedPlace = null;
});
}
@Click
void cancelBtn() {
final Fragment prev = getActivity().getSupportFragmentManager().findFragmentByTag(String.valueOf(R.layout.dialog_edit_profile));
if (prev != null) {
final DialogFragment df = (DialogFragment) prev;
df.dismiss();
}
}
@Click
void saveEditBtn() {
final UpdateUserRequest userReq = validate();
if (userReq != null) {
showProgressBar();
updateCustomer(userReq);
}
}
@Background
void updateCustomer(final UpdateUserRequest userReq) {
try {
users.updateCustomer(userReq);
final UpdateUserRequestAttributes attributes = userReq.getData().getAttributes();
listener.onFinishEditDialog(attributes.getFirstName(), attributes.getLastName(), attributes.getAddress());
cancelBtn();
} catch (final NestedRuntimeException e) {
hideProgressBar();
}
}
@UiThread
void hideProgressBar() {
editProfileProgressBar.setVisibility(View.INVISIBLE);
saveEditBtn.setVisibility(View.VISIBLE);
}
@UiThread
void showProgressBar() {
editProfileProgressBar.setVisibility(View.VISIBLE);
saveEditBtn.setVisibility(View.INVISIBLE);
}
private UpdateUserRequest validate() {
boolean valid = true;
final String firstName = editProfileFirstName.getText().toString().trim();
if (firstName.isEmpty()) {
editProfileFirstName.setError(getResources().getString(R.string.fn_missing_err));
valid = false;
}
final String lastName = editProfileLastName.getText().toString().trim();
if (lastName.isEmpty()) {
editProfileLastName.setError(getResources().getString(R.string.ln_missing_err));
valid = false;
}
if (addressUpdated && Objects.isNull(selectedPlace)) {
final PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment) getActivity().getFragmentManager().findFragmentById(R.id.editProfileAddress);
final EditText placeField = (EditText) autocompleteFragment.getView().findViewById(R.id.place_autocomplete_search_input);
placeField.setError(getResources().getString(R.string.address_missing_err));
valid = false;
}
if (valid) {
final UpdateUserRequestAttributes attrs;
if (Objects.nonNull(selectedPlace)) {
final Double longitude = selectedPlace.getLatLng().longitude;
final Double latitude = selectedPlace.getLatLng().latitude;
attrs = new UpdateUserRequestAttributes(firstName, lastName, selectedPlace.getAddress().toString(), longitude, latitude);
} else {
attrs = new UpdateUserRequestAttributes(firstName, lastName, null, null, null);
}
final UpdateUserRequestData data = new UpdateUserRequestData(USER_TYPE, attrs);
return new UpdateUserRequest(data);
}
return null;
}
public interface EditProfileDialogListener {
void onFinishEditDialog(String firstName, String lastName, String address);
}
}
| [
"datiglavaradi@gmail.com"
] | datiglavaradi@gmail.com |
138cb117c6479a8ca7e335976ba137c725fc644a | 05ce1888353ed78307e4366b904bb61e9565e53a | /PreferenceFragment/src/com/jewelzqiu/preferencefragment/PreferenceFragment.java | d88493430d04f110a2e5963ee3f7c002b76829e9 | [] | no_license | MrKhantee/PreferenceFragment-1 | 54b4c970577cd9557a5afaff43cf2bde9d43e7b8 | 3fad92ecae55521ac9aff60e66965e33c72c1e8c | refs/heads/master | 2021-05-26T17:04:49.420260 | 2013-10-11T05:06:55 | 2013-10-11T05:06:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,375 | java | package com.jewelzqiu.preferencefragment;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.preference.Preference;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.ListView;
public class PreferenceFragment extends ListFragment {
private PreferenceManager mPreferenceManager;
/**
* The starting request code given out to preference framework.
*/
private static final int FIRST_REQUEST_CODE = 100;
private static final int MSG_BIND_PREFERENCES = 0;
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case MSG_BIND_PREFERENCES:
bindPreferences();
break;
}
}
};
private ListView lv;
private int xmlId;
public PreferenceFragment(int xmlId) {
this.xmlId = xmlId;
}
// must be provided
public PreferenceFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle b) {
postBindPreferences();
return lv;
}
@Override
public void onDestroyView() {
super.onDestroyView();
ViewParent p = lv.getParent();
if (p != null)
((ViewGroup) p).removeView(lv);
}
@Override
public void onCreate(Bundle b) {
super.onCreate(b);
if (b != null)
xmlId = b.getInt("xml");
mPreferenceManager = onCreatePreferenceManager();
lv = (ListView) LayoutInflater.from(getActivity()).inflate(
R.layout.preference_list_content, null);
lv.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
addPreferencesFromResource(xmlId);
postBindPreferences();
((OnPreferenceAttachedListener) getActivity()).onPreferenceAttached(
getPreferenceScreen(), xmlId);
}
@Override
public void onStop() {
super.onStop();
try {
Method m = PreferenceManager.class
.getDeclaredMethod("dispatchActivityStop");
m.setAccessible(true);
m.invoke(mPreferenceManager);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onDestroy() {
super.onDestroy();
lv = null;
try {
Method m = PreferenceManager.class
.getDeclaredMethod("dispatchActivityDestroy");
m.setAccessible(true);
m.invoke(mPreferenceManager);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putInt("xml", xmlId);
super.onSaveInstanceState(outState);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
try {
Method m = PreferenceManager.class.getDeclaredMethod(
"dispatchActivityResult", int.class, int.class,
Intent.class);
m.setAccessible(true);
m.invoke(mPreferenceManager, requestCode, resultCode, data);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Posts a message to bind the preferences to the list view.
* <p>
* Binding late is preferred as any custom preference types created in
* {@link #onCreate(Bundle)} are able to have their views recycled.
*/
private void postBindPreferences() {
if (mHandler.hasMessages(MSG_BIND_PREFERENCES))
return;
mHandler.obtainMessage(MSG_BIND_PREFERENCES).sendToTarget();
}
private void bindPreferences() {
final PreferenceScreen preferenceScreen = getPreferenceScreen();
if (preferenceScreen != null) {
preferenceScreen.bind(lv);
}
}
/**
* Creates the {@link PreferenceManager}.
*
* @return The {@link PreferenceManager} used by this activity.
*/
private PreferenceManager onCreatePreferenceManager() {
try {
Constructor<PreferenceManager> c = PreferenceManager.class
.getDeclaredConstructor(Activity.class, int.class);
c.setAccessible(true);
PreferenceManager preferenceManager = c.newInstance(
this.getActivity(), FIRST_REQUEST_CODE);
return preferenceManager;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* Returns the {@link PreferenceManager} used by this activity.
*
* @return The {@link PreferenceManager}.
*/
public PreferenceManager getPreferenceManager() {
return mPreferenceManager;
}
/**
* Sets the root of the preference hierarchy that this activity is showing.
*
* @param preferenceScreen
* The root {@link PreferenceScreen} of the preference hierarchy.
*/
public void setPreferenceScreen(PreferenceScreen preferenceScreen) {
try {
Method m = PreferenceManager.class.getDeclaredMethod(
"setPreferences", PreferenceScreen.class);
m.setAccessible(true);
boolean result = (Boolean) m.invoke(mPreferenceManager,
preferenceScreen);
if (result && preferenceScreen != null) {
postBindPreferences();
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Gets the root of the preference hierarchy that this activity is showing.
*
* @return The {@link PreferenceScreen} that is the root of the preference
* hierarchy.
*/
public PreferenceScreen getPreferenceScreen() {
try {
Method m = PreferenceManager.class
.getDeclaredMethod("getPreferenceScreen");
m.setAccessible(true);
return (PreferenceScreen) m.invoke(mPreferenceManager);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* Adds preferences from activities that match the given {@link Intent}.
*
* @param intent
* The {@link Intent} to query activities.
*/
public void addPreferencesFromIntent(Intent intent) {
throw new RuntimeException("too lazy to include this bs");
}
/**
* Inflates the given XML resource and adds the preference hierarchy to the
* current preference hierarchy.
*
* @param preferencesResId
* The XML resource ID to inflate.
*/
public void addPreferencesFromResource(int preferencesResId) {
try {
Method m = PreferenceManager.class.getDeclaredMethod(
"inflateFromResource", Context.class, int.class,
PreferenceScreen.class);
m.setAccessible(true);
PreferenceScreen prefScreen = (PreferenceScreen) m.invoke(
mPreferenceManager, getActivity(), preferencesResId,
getPreferenceScreen());
setPreferenceScreen(prefScreen);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Finds a {@link Preference} based on its key.
*
* @param key
* The key of the preference to retrieve.
* @return The {@link Preference} with the key, or null.
* @see PreferenceGroup#findPreference(CharSequence)
*/
public Preference findPreference(CharSequence key) {
if (mPreferenceManager == null) {
return null;
}
return mPreferenceManager.findPreference(key);
}
public interface OnPreferenceAttachedListener {
public void onPreferenceAttached(PreferenceScreen root, int xmlId);
}
}
| [
"jewelz.q.915@gmail.com"
] | jewelz.q.915@gmail.com |
1285c01591804af782cf96272d1ba778bf56f684 | 029c6e45d8d828b804d4c9962e6646d0a2ca457c | /src/action/StudentAction.java | 74427c0114620d89d0260dbee4f4fae4faeb09bd | [] | no_license | lnliunan/LanguageLearningSystem | b6bc489c871598e67d93bb39a9b4c52ff58ded69 | 45758df654593e28aaada3db9cd4a2191a2046de | refs/heads/master | 2021-06-14T08:29:17.441033 | 2021-03-16T08:37:51 | 2021-03-16T08:37:51 | 166,670,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,761 | java | package action;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import entity.Student;
import service.StudentService;
@Controller
public class StudentAction {
@Autowired
private StudentService studentService;
public StudentService getStudentService() {
return studentService;
}
public void setStudentService(StudentService studentService) {
this.studentService = studentService;
}
@RequestMapping("/studentAddView")
public ModelAndView addView(){
return new ModelAndView("studentAdd");
}
@RequestMapping("/studentAdd.do")
public ModelAndView studentAdd(@RequestParam(value = "photo") MultipartFile photo,String id,String name,String age,HttpServletRequest request){
Student student = new Student();
student.setId(id);
student.setName(name);
student.setAge(Integer.parseInt(age));
ServletContext application = request.getServletContext();
String realPath = application.getRealPath("/photo/");
int index = photo.getOriginalFilename().lastIndexOf(".");
String suffix = photo.getOriginalFilename().substring(index+1);
String fileName = realPath+File.separator+id+"."+suffix;
// 存文件到photo中
try {
photo.transferTo(new File(fileName));
} catch (Exception e) {
e.printStackTrace();
}
student.setPhotoPath(suffix);
boolean ok = studentService.addStudent(student);
Map<String,Object> model = new HashMap<String,Object>();
if(ok){
List<Student> students = studentService.getStudents();
model.put("students",students);
return new ModelAndView("studentList",model);
}else{
model.put("info","添加失败");
return new ModelAndView("studentAdd",model);
}
}
/*
* 更新界面
*/
@RequestMapping("/studentUpdateView.do")
public ModelAndView updateView(String id){
Student student = studentService.findById(id);
Map<String,Object> model = new HashMap<String,Object>();
model.put("student",student);
return new ModelAndView("studentUpdate",model);
}
/*
* 更新功能
*/
@RequestMapping("/studentUpdate.do")
public ModelAndView updateView(Student student){
boolean ok = studentService.updateStudent(student);
Map<String,Object> model = new HashMap<String,Object>();
List<Student> students = studentService.getStudents();
model.put("students",students);
return new ModelAndView("studentList",model);
}
/*
* 删除
*/
@RequestMapping("/studentDelete.do")
public ModelAndView delete(String id){
boolean ok = studentService.delete(id);
Map<String,Object> model = new HashMap<String,Object>();
List<Student> students = studentService.getStudents();
model.put("students",students);
return new ModelAndView("studentList",model);
}
/*
* 查看学生列表
*/
@RequestMapping("/studentList.do")
public ModelAndView studentList(){
Map<String,Object> model = new HashMap<String,Object>();
List<Student> students = studentService.getStudents();
model.put("students",students);
return new ModelAndView("studentList",model);
}
/*
* 显示照片
*/
@RequestMapping("/studentPhoto.do")
public void studentPhoto(String id,String photoPath,HttpServletRequest request,HttpServletResponse response){
// 找到文件
ServletContext application = request.getServletContext();
String realPath = application.getRealPath("photo/");
String fileName = realPath+File.separator+id+"."+photoPath;
File file = new File(fileName);
if (file.exists()) {
byte[] buffer = new byte[1024];
FileInputStream fis = null;
BufferedInputStream bis = null;
try {
fis = new FileInputStream(file);
bis = new BufferedInputStream(fis);
OutputStream os = response.getOutputStream();
int i = bis.read(buffer);
while (i != -1) {
os.write(buffer, 0, i);
i = bis.read(buffer);
}
}catch(Exception e){
e.printStackTrace();
}finally{
if(bis!=null)
try{bis.close();}catch(Exception e){}
if(fis!=null)
try{fis.close();}catch(Exception e){}
}
}
}
}
| [
"1359630652@qq.com"
] | 1359630652@qq.com |
1472a30e6367b4386f12376c5e88d4a21828813e | 5b55f38a753d251c1696f87d52f9554f2c04334a | /src/com/more/mes/smt/linemonitor/http/oracle/GetMonitorLineCom.java | a3377459e723c289ff8050ec4be0b2adba1198d3 | [] | no_license | 1wangxueyan2/SKS-MC | 2b64d4a51547214690a60dd8bde5cdbdfd67e6ca | 898e38e5be2dc78d268774d76cf3054f09c747fe | refs/heads/master | 2022-03-06T06:40:51.405811 | 2019-10-25T06:59:18 | 2019-10-25T06:59:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,584 | java | /*
* @File GetMonitorLineCom.java
* @Package com.more.mes.cs.http
* @Copyinght Copyright (c) 2017
* @Company morelean
* @author hxh
* @date 2017-7-31 下午5:00:50
* @version V1.0
*/
package com.more.mes.smt.linemonitor.http.oracle;
import java.util.List;
import org.springframework.orm.hibernate3.HibernateTemplate;
import com.more.fw.core.common.method.StringUtils;
import com.more.fw.http.service.HttpCoreService;
import com.more.fw.http.service.IhttpServiceJosn;
import com.more.fw.interf.InterfaceLog;
import com.more.mes.smt.linemonitor.service.oracle.LineMonitorService;
/**
* @Title 获取监控线体、工作中心下拉列表
* @Description 〈功能详细描述〉
* @ClassName GetMonitorLineCom
* @author hxh
* @version 1.0 developer 2017-7-31 created
* @see GetMonitorLineCom
* @since 2017-7-31
* @Copyright: Copyright (c) 2017
* @Company: morelean
*/
public class GetMonitorLineCom extends InterfaceLog implements IhttpServiceJosn
{
//
/**
* @param arg0
* @param arg1
* @return
* @see com.more.fw.core.dbo.model.dao.BaseDao#find(java.lang.String, java.lang.Object[])
*/
public List find(String arg0, Object... arg1)
{
// TODO Auto-generated method stub
return null;
}
/**
* @param arg0
* @param arg1
* @param arg2
* @return
* @see com.more.fw.core.dbo.model.dao.BaseDao#find(org.springframework.orm.hibernate3.HibernateTemplate,
* java.lang.String, java.lang.Object[])
*/
public List find(HibernateTemplate arg0, String arg1, Object... arg2)
{
// TODO Auto-generated method stub
return null;
}
/**
* @param arg0
* @return
* @see com.more.fw.http.service.IhttpServiceJosn#exeFunc(com.more.fw.http.service.HttpCoreService)
*/
@Override
public String exeFunc(HttpCoreService service)
{
// TODO Auto-generated method stub
String type = String.valueOf(service.getDit().get("type"));// 类型:0为线体,1为工作中心,2为设备列表
LineMonitorService lms = new LineMonitorService();
if (StringUtils.isNotBlank(type) && type.equals("1"))
{
String parentId = String.valueOf(service.getDit().get("parentId"));
service.getDit().put("dataList", lms.getWorkCenterCom(parentId));
}
else if (StringUtils.isNotBlank(type) && type.equals("2"))
{
String caId = String.valueOf(service.getDit().get("caId"));
service.getDit().put("dataList", lms.getDeviceList(caId));
}
else
{
// 线体
service.getDit().put("dataList", lms.getMonitorLineCom());
}
return null;
}
}
| [
"phantomsaber@foxmail.com"
] | phantomsaber@foxmail.com |
bd4ed4d18e87a7c9b59e7a247cb4d0f2ba3c0e0c | 7671e9da8ef77f3cf440645d98e62d79a5e7c223 | /Gameoflife/src/com/david/giczi/gameoflife/model/GameOfLifeLogic.java | f71167be9cf8d5c84c067ba7f49994ad1bd92681 | [] | no_license | davidgiczi/GameOfLife | e33f1643b551f64b3cbe10b85d8e51e15bb20333 | 9f3d51dff4949ac92c0ed40be2667cfe611ce22d | refs/heads/master | 2020-04-17T00:18:29.248757 | 2019-01-17T14:41:32 | 2019-01-17T14:41:32 | 141,571,054 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,050 | java | package com.david.giczi.gameoflife.model;
import java.util.ArrayList;
import java.util.List;
public class GameOfLifeLogic {
private List<Cell> universeOne;
private List<Cell> universeTwo;
private int rows;
private int cols;
private int origoX;
private int origoY;
public GameOfLifeLogic(int rows, int cols, int origoX, int origoY) {
this.universeOne = new ArrayList<>();
this.universeTwo=new ArrayList<>();
setRows(rows);
setCols(cols);
setOrigoX(origoX);
setOrigoY(origoY);
for (int i = 0; i < this.rows; i++) {
for (int j = 0; j < this.cols; j++) {
universeOne.add(new Cell(i,j));
universeTwo.add(new Cell(i,j));
}
}
}
public List<Cell> getUniverseOne() {
return universeOne;
}
public int getRows() {
return rows;
}
public int getCols() {
return cols;
}
public int getOrigoX() {
return origoX;
}
public int getOrigoY() {
return origoY;
}
public void setRows(int rows) {
if(rows<100)
this.rows=100;
else
this.rows = rows;
}
public void setCols(int cols) {
if(cols<100)
this.cols=100;
else
this.cols = cols;
}
public void setOrigoX(int origoX) {
if(cols<=100)
this.origoX = 50;
else
this.origoX=1+origoX*-1;
}
public void setOrigoY(int origoY) {
if(rows<=100)
this.origoY=50;
else
this.origoY = 1+origoY*-1;
}
public void setUniverseOne(List<Cell> universeOne) {
this.universeOne = universeOne;
}
public List<Cell> life1_05FileProcessing(List<String> inputData) {
int x=origoX;
int y=origoY;
int rowCounter=0;
int pX=0;
int pY=0;
for (String row : inputData) {
if(row.startsWith("#P")) {
String[] origo=row.split(" ");
x=origoX;
y=origoY;
rowCounter=0;
pX=Integer.parseInt(origo[1]);
pY=Integer.parseInt(origo[2]);
x+=pX;
y+=pY;
}
if(row.startsWith(".") || row.startsWith("*")) {
for (int i = 0; i < row.length(); i++) {
x=origoX+pX;
if(row.charAt(i)=='*') {
x+=i;
y+=rowCounter;
universeOne.get(y*cols+x).setAlive(true);
y=origoY+pY;
}
}
rowCounter++;
}
}
return universeOne;
}
public List<Cell> life1_06FileProcessing(List<String> inputData) {
for(int i=0; i<inputData.size(); i++) {
if(!inputData.get(i).startsWith("#")) {
String[] coords=inputData.get(i).split(" ");
int x=Integer.parseInt(coords[0])+origoX;
int y=Integer.parseInt(coords[1])+origoY;
universeOne.get(x*cols+y).setAlive(true);
}
}
return universeOne;
}
public List<Cell> cellsInTheUniverseAreAliveOrDead() {
for (int i=0; i<universeOne.size(); i++) {
if(universeOne.get(i).isAlive() && cellNeighborhoodCounter(universeOne.get(i))<2)
universeTwo.get(i).setAlive(false);
else if((universeOne.get(i).isAlive() && cellNeighborhoodCounter(universeOne.get(i))==2) || (universeOne.get(i).isAlive() && cellNeighborhoodCounter(universeOne.get(i))==3))
universeTwo.get(i).setAlive(true);
else if(universeOne.get(i).isAlive() && cellNeighborhoodCounter(universeOne.get(i))>3)
universeTwo.get(i).setAlive(false);
else if(!universeOne.get(i).isAlive() && cellNeighborhoodCounter(universeOne.get(i))==3)
universeTwo.get(i).setAlive(true);
else;
}
return universeTwo;
}
public boolean tableChanging() {
if(canGrowth()) {
for (int i = 0; i < universeTwo.size(); i++) {
universeOne.get(i).setAlive(universeTwo.get(i).isAlive());
}
return true;
}
return false;
}
private boolean canGrowth() {
for (int i = 0; i < universeOne.size(); i++) {
if(universeOne.get(i).isAlive()!=universeTwo.get(i).isAlive())
return true;
}
return false;
}
private int cellNeighborhoodCounter(Cell cell){
int cellNeighbors=0;
int x=cell.getX();
int y=cell.getY();
if(x-1>=0 && universeOne.get((x-1)*cols+y).isAlive())
cellNeighbors++;
if(x-1>=0 && y+1<cols && universeOne.get((x-1)*cols+y+1).isAlive())
cellNeighbors++;
if(y+1<cols && universeOne.get(x*cols+y+1).isAlive())
cellNeighbors++;
if(x+1<rows && y+1<cols && universeOne.get((x+1)*cols+y+1).isAlive())
cellNeighbors++;
if(x+1<rows && universeOne.get((x+1)*cols+y).isAlive())
cellNeighbors++;
if(x+1<rows && y-1>=0 && universeOne.get((x+1)*cols+y-1).isAlive())
cellNeighbors++;
if(y-1>=0 && universeOne.get(x*cols+y-1).isAlive())
cellNeighbors++;
if(x-1>=0 && y-1>=0 && universeOne.get((x-1)*cols+y-1).isAlive())
cellNeighbors++;
return cellNeighbors;
}
}
| [
"noreply@github.com"
] | davidgiczi.noreply@github.com |
c243c1f6bd87aaa65288bb1728632a954c89ddfa | 56f504b4af35e1ed8d3a729ba7e300f3f6294fcf | /backup/CommonDao.java | c58defd8b43de57777df578903cbc33a96b440f4 | [] | no_license | jagadeeshmenda/DataUsageEngine | f3c53973931fe101d210578e9679136728a50684 | 82f9a72c3ff8e2dfbe708995b39681a9e09e9b04 | refs/heads/master | 2021-01-10T10:26:44.062064 | 2015-10-31T06:20:06 | 2015-10-31T06:20:06 | 45,168,673 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,378 | java |
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class CommonDao {
public Connection getDbConnction () {
try {
System.out.println("Loading driver...");
Class.forName("oracle.jdbc.OracleDriver");
System.out.println("Driver loaded!");
} catch (ClassNotFoundException e) {
throw new RuntimeException("Cannot find the driver in the classpath!", e);
}
String url = "jdbc:oracle:thin:@113.128.163.241:1521:xe"; // Important
String username = "SYSTEM";
String password = "password";
Connection connection = null;
try {
System.out.println("Connecting database...");
connection = DriverManager.getConnection(url, username, password);
System.out.println("Got the connection " + connection);
System.out.println("Database connected!");
} catch (SQLException e) {
e.printStackTrace();
throw new RuntimeException("Cannot connect the database!", e);
} finally {
System.out.println("Closing the connection.");
if (connection != null) try { connection.close(); } catch (SQLException ignore) {}
}
return connection;
}
public static void main (String args[]){
CommonDao common = new CommonDao () ;
common.getDbConnction();
}
}
| [
"jagadee.me@gmail.com"
] | jagadee.me@gmail.com |
96255b4050a1e5ada1b8e9584e42bdeecd0cbcf9 | fa93c9be2923e697fb8a2066f8fb65c7718cdec7 | /sources/com/avito/android/analytics/event/ShowHomeScreenEvent.java | a7247fe124bcb54a59604c163caabca40eb93a7d | [] | no_license | Auch-Auch/avito_source | b6c9f4b0e5c977b36d5fbc88c52f23ff908b7f8b | 76fdcc5b7e036c57ecc193e790b0582481768cdc | refs/heads/master | 2023-05-06T01:32:43.014668 | 2021-05-25T10:19:22 | 2021-05-25T10:19:22 | 370,650,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,350 | java | package com.avito.android.analytics.event;
import com.avito.android.analytics_firebase.FirebaseEvent;
import com.avito.android.analytics_firebase.FirebaseEventTracker;
import com.avito.android.analytics_firebase.SimpleFirebaseEvent;
import java.util.Map;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000*\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0003\n\u0002\u0010$\n\u0002\u0010\u0000\n\u0002\b\u0006\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0010\u0010\u0011J\u0018\u0010\u0005\u001a\u00020\u00042\u0006\u0010\u0003\u001a\u00020\u0002H\u0001¢\u0006\u0004\b\u0005\u0010\u0006R\u0016\u0010\n\u001a\u00020\u00078\u0016@\u0016X\u0005¢\u0006\u0006\u001a\u0004\b\b\u0010\tR$\u0010\u000f\u001a\u0010\u0012\u0004\u0012\u00020\u0007\u0012\u0004\u0012\u00020\f\u0018\u00010\u000b8\u0016@\u0016X\u0005¢\u0006\u0006\u001a\u0004\b\r\u0010\u000e¨\u0006\u0012"}, d2 = {"Lcom/avito/android/analytics/event/ShowHomeScreenEvent;", "Lcom/avito/android/analytics_firebase/FirebaseEvent;", "Lcom/avito/android/analytics_firebase/FirebaseEventTracker;", "tracker", "", "accept", "(Lcom/avito/android/analytics_firebase/FirebaseEventTracker;)V", "", "getName", "()Ljava/lang/String;", "name", "", "", "getFirebaseEventParams", "()Ljava/util/Map;", "firebaseEventParams", "<init>", "()V", "serp_release"}, k = 1, mv = {1, 4, 2})
public final class ShowHomeScreenEvent implements FirebaseEvent {
public final /* synthetic */ SimpleFirebaseEvent a = new SimpleFirebaseEvent("Main", null, 2, null);
@Override // com.avito.android.analytics_firebase.FirebaseEvent
public void accept(@NotNull FirebaseEventTracker firebaseEventTracker) {
Intrinsics.checkNotNullParameter(firebaseEventTracker, "tracker");
this.a.accept(firebaseEventTracker);
}
@Override // com.avito.android.analytics_firebase.FirebaseEvent
@Nullable
public Map<String, Object> getFirebaseEventParams() {
return this.a.getFirebaseEventParams();
}
@Override // com.avito.android.analytics_firebase.FirebaseEvent
@NotNull
public String getName() {
return this.a.getName();
}
}
| [
"auchhunter@gmail.com"
] | auchhunter@gmail.com |
cbe40a8351df06186da67e98c4f1fd8fbd38407f | be5f2f166d3855c8fb47f4ac820ee1c4cb406064 | /src/main/java/com/sharingcard/common/config/QuartzConfigration.java | d58cd67864cbbb076bf02f3594038470d6f9f7f0 | [
"Apache-2.0"
] | permissive | superbase-zz/head_study_java | 5c4e038fe5fea35166eee475ed8f640a50c2370b | 9e626c62599f700bd5b4fba5ffb04fedf96bf50b | refs/heads/master | 2022-11-14T13:46:04.918984 | 2020-01-19T07:12:36 | 2020-01-19T07:12:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,533 | java | package com.sharingcard.common.config;
import java.io.IOException;
import java.util.Properties;
import org.quartz.Scheduler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.PropertiesFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import com.sharingcard.common.quartz.factory.JobFactory;
@Configuration
public class QuartzConfigration {
@Autowired
JobFactory jobFactory;
@Bean
public SchedulerFactoryBean schedulerFactoryBean() {
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
try {
schedulerFactoryBean.setOverwriteExistingJobs(true);
schedulerFactoryBean.setQuartzProperties(quartzProperties());
schedulerFactoryBean.setJobFactory(jobFactory);
} catch (IOException e) {
e.printStackTrace();
}
return schedulerFactoryBean;
}
// 指定quartz.properties
@Bean
public Properties quartzProperties() throws IOException {
PropertiesFactoryBean propertiesFactoryBean = new PropertiesFactoryBean();
propertiesFactoryBean.setLocation(new ClassPathResource("/config/quartz.properties"));
propertiesFactoryBean.afterPropertiesSet();
return propertiesFactoryBean.getObject();
}
// 创建schedule
@Bean(name = "scheduler")
public Scheduler scheduler() {
return schedulerFactoryBean().getScheduler();
}
}
| [
"780357902@qq.com"
] | 780357902@qq.com |
223f515c2e7a24faf03f03bb33bc096c96d7fdb3 | b1027dba76a5976dce7f2c40b27908728ad53a77 | /javase/classloader_impl/src/main/java/io/github/xudaojie/agent/X.java | 3bb760ae77f43a405b3f7892f750880b117426fc | [] | no_license | XuDaojie/Java | 475d159985cfbe2040af2f31ccf93ad0a17892cd | 713866e692ca7980ab325dfc81386e907caef845 | refs/heads/master | 2021-11-08T22:32:16.845792 | 2021-10-25T16:54:36 | 2021-10-25T16:54:36 | 86,455,525 | 0 | 1 | null | 2017-07-06T08:50:33 | 2017-03-28T12:08:39 | Java | UTF-8 | Java | false | false | 102 | java | package io.github.xudaojie.agent;
/**
* @author XuDaojie
* @since 2020/9/28
*/
public class X {
}
| [
"xudaojieg@gmail.com"
] | xudaojieg@gmail.com |
5d49fe7263429e3361dc0408206885636f71571e | cf2e4937e170f6b38839feca7bdf5dd31fa7e135 | /ryqcxls/src/main/java/com/ystech/cust/model/BuyCarType.java | 372e99a2a2c1dd7149f44f303573ac0e7c503ca1 | [] | no_license | shusanzhan/ryqcxly | ff5ba983613bd9041248dc4d55fd1f593eee626e | 3ef738d1a0c7d61ea448a66f2ccbb7fe3ece992d | refs/heads/master | 2022-12-24T16:25:47.960029 | 2021-02-22T02:57:28 | 2021-02-22T02:57:28 | 193,863,573 | 0 | 0 | null | 2022-12-16T08:01:59 | 2019-06-26T08:31:32 | Java | UTF-8 | Java | false | false | 716 | java | package com.ystech.cust.model;
// Generated 2014-2-22 16:01:27 by Hibernate Tools 4.0.0
/**
* Buycartype generated by hbm2java
*/
public class BuyCarType implements java.io.Serializable {
private Integer dbid;
private String name;
private String note;
public BuyCarType() {
}
public BuyCarType(String name, String note) {
this.name = name;
this.note = note;
}
public Integer getDbid() {
return this.dbid;
}
public void setDbid(Integer dbid) {
this.dbid = dbid;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getNote() {
return this.note;
}
public void setNote(String note) {
this.note = note;
}
}
| [
"shusanzhan@163.com"
] | shusanzhan@163.com |
56b36153e0c2b9001a0be1e3bebcfec9e89c7df2 | 2bd48e3511b9e9c66da087036e2a6bba0f850e61 | /ParseLoginUI/gen/com/parse/ui/BuildConfig.java | 39ca33ddde7cf333919ff9b1af42bd312b89ab0e | [] | no_license | zippoobbiz/SurvivalGuide | db825e35b4770b04de352be7f397324423e3ed0c | 622239d22c1dc115e3ed7519fdc505013825c020 | refs/heads/master | 2020-12-30T22:55:23.213430 | 2016-09-19T06:20:19 | 2016-09-19T06:20:19 | 68,575,169 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 154 | java | /** Automatically generated file. DO NOT MODIFY */
package com.parse.ui;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"zippoobbiz@gmail.com"
] | zippoobbiz@gmail.com |
6e8d6add5def9069b4e897b65858a9f01ce110e7 | 5bf8cd06fc35e86cccee08c40c537812bd35f8a6 | /06-Dynamic programming/LongestPalindromeSubstring.java | 41486ce36237048f378d300946203112d9dda124 | [
"Apache-2.0"
] | permissive | Shivamsharma009/Algorithms | af346a923d95d8b68be70441a4820d05c82acfa9 | 1af1ffe779b3f1410fa1404eb77ff53638ac61af | refs/heads/master | 2020-09-28T04:02:56.407016 | 2020-06-07T16:24:14 | 2020-06-07T16:24:14 | 226,681,069 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,446 | java | // java Program to Implement Manchestor Algorithm
public class LongestPalindromeSubstring {
public int longestPalindromeSubstringEasy(char arr[]) {
int longest_substring = 1;
for (int i = 0; i < arr.length; i++) {
int x, y;
int palindrome;
x = i;
y = i + 1;
palindrome = 0;
while (x >= 0 && y < arr.length && arr[x] == arr[y]) {
x--;
y++;
palindrome += 2;
}
longest_substring = Math.max(longest_substring, palindrome);
x = i - 1;
y = i + 1;
palindrome = 1;
while (x >= 0 && y < arr.length && arr[x] == arr[y]) {
x--;
y++;
palindrome += 2;
}
longest_substring = Math.max(longest_substring, palindrome);
}
return longest_substring;
}
public static void main(String args[]) {
LongestPalindromeSubstring lps = new LongestPalindromeSubstring();
System.out.println(lps.longestPalindromeSubstringEasy("abba".toCharArray()));
System.out.println(lps.longestPalindromeSubstringEasy("abbababba".toCharArray()));
System.out.println(lps.longestPalindromeSubstringEasy("babcbaabcbaccba".toCharArray()));
System.out.println(lps.longestPalindromeSubstringEasy("cdbabcbabdab".toCharArray()));
}
} | [
"shivamsharma0501@gmail.com"
] | shivamsharma0501@gmail.com |
31258d05bd3284a70f6cf3a15ec40dc61b7ac1c8 | 37bd7599c01f01895a352d280b537c43f8f95f13 | /src/kitchen/Electric.java | 6583ba3d9c13ca0ad8748d16a6fe596df9300ef6 | [] | no_license | Stephan-VZ19/Learning | 0f12780d8c38398dac752c1880fbb0c41f19bc68 | 02307e13fb2b9a0138492abf630e099e46f77aa1 | refs/heads/master | 2023-01-02T14:07:57.398781 | 2020-10-25T22:15:59 | 2020-10-25T22:15:59 | 306,978,868 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 109 | java | package kitchen;
public interface Electric {
public boolean isElectric();
public int resistance();
}
| [
"stephan.baumann@students.fhnw.ch"
] | stephan.baumann@students.fhnw.ch |
91a0ad1b59a768688ab491fcca287290f8c4434f | 3839aaa34aed4e4a05a5b8650481aae59e5d7094 | /src/edu/ua/cs/hergin/proglan/parser/Parser.java | 7959c324c12d00f20e70caf8c528c22888e71df6 | [] | no_license | hergin/MDLN | c5211b3f630b9508f85ca2d7f57664cbd625c66a | ce9e2f890c034daf7fe19d093f768202b797e03a | refs/heads/master | 2021-01-14T19:37:37.089292 | 2016-09-20T00:38:37 | 2016-09-20T00:38:37 | 68,658,238 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,063 | java | /*
* Huseyin Ergin - hergin@crimson.ua.edu
*/
package edu.ua.cs.hergin.proglan.parser;
import edu.ua.cs.hergin.proglan.lexer.Lexeme;
import edu.ua.cs.hergin.proglan.lexer.LexemeTypes;
import edu.ua.cs.hergin.proglan.parser.Cons.ConsTypes;
import edu.ua.cs.hergin.proglan.recognizer.EndOfInputException;
import edu.ua.cs.hergin.proglan.recognizer.Recognizer;
import edu.ua.cs.hergin.proglan.recognizer.RecognizerException;
public class Parser {
ParserUtil util;
public Parser(String fileName) {
try {
util = new ParserUtil(fileName);
} catch (EndOfInputException e) {
System.out.println("File is empty!");
}
}
public Cons parse() {
Cons res = null;
try {
res = program();
} catch (RecognizerException e) {
e.print();
// e.printStackTrace();
} catch (EndOfInputException e) {
e.printStackTrace();
System.out.println("Source code fits to the grammar!");
}
return res;
}
private Cons program() throws RecognizerException, EndOfInputException {
Cons res = new Cons(ConsTypes.PROGRAM);
if (structListPending()) {
res.setLeft(structList());
}
res.setRight(mainClause());
if (!util.check(LexemeTypes.ENDofINPUT)) {
throw new RecognizerException("More unnecessary code under main!");
}
return res;
}
private Cons mainClause() throws RecognizerException, EndOfInputException {
Cons res = new Cons(ConsTypes.MAIN);
res.setLeft(util.match(LexemeTypes.MAIN));
Cons J1 = new Cons();
J1.setLeft(util.match(LexemeTypes.OCURLY));
res.setRight(J1);
Cons J2 = new Cons();
if (statementListPending()) {
J2.setLeft(statementList());
}
J2.setRight(util.match(LexemeTypes.CCURLY));
J1.setRight(J2);
return res;
}
private Cons prototypeDeclaration() throws RecognizerException,
EndOfInputException {
Cons res = new Cons(ConsTypes.PROTOTYPE);
res.setLeft(util.match(LexemeTypes.FORWARD));
res.setRight(util.match(LexemeTypes.ID));
return res;
}
private boolean prototypeDeclarationPending() {
return util.check(LexemeTypes.FORWARD);
}
private Cons structList() throws RecognizerException, EndOfInputException {
Cons res = new Cons(ConsTypes.STRUCTLIST);
res.setLeft(struct());
if (structListPending()) {
res.setRight(structList());
}
return res;
}
private Cons struct() throws RecognizerException, EndOfInputException {
if (classDeclarationPending()) {
return classDeclaration();
} else if (functionDeclarationPending()) {
return functionDeclaration();
} else if (prototypeDeclarationPending()) {
return prototypeDeclaration();
} else {
return variableDeclaration();
}
}
private Cons functionDeclaration() throws RecognizerException,
EndOfInputException {
Cons res = new Cons(ConsTypes.FUNCTIONDECLARATION);
res.setLeft(util.match(LexemeTypes.FUNCTION));
Cons J1 = new Cons();
J1.setLeft(util.match(LexemeTypes.ID));
res.setRight(J1);
Cons J2 = new Cons();
J2.setLeft(util.match(LexemeTypes.OPAREN));
J1.setRight(J2);
Cons J3 = new Cons();
if (parameterListPending()) {
J3.setLeft(parameterList());
}
J2.setRight(J3);
Cons J4 = new Cons();
J4.setLeft(util.match(LexemeTypes.CPAREN));
J3.setRight(J4);
Cons J5 = new Cons();
J5.setLeft(util.match(LexemeTypes.OCURLY));
J4.setRight(J5);
Cons J6 = new Cons();
if (statementListPending()) {
J6.setLeft(statementList());
}
J6.setRight(util.match(LexemeTypes.CCURLY));
J5.setRight(J6);
return res;
}
private Cons parameterList() throws RecognizerException,
EndOfInputException {
Cons res = new Cons(ConsTypes.PARAMETERLIST);
res.setLeft(util.match(LexemeTypes.ID));
if (util.check(LexemeTypes.COMMA)) {
Cons J1 = new Cons();
J1.setLeft(util.match(LexemeTypes.COMMA));
J1.setRight(parameterList());
res.setRight(J1);
}
return res;
}
private Cons statementList() throws RecognizerException,
EndOfInputException {
Cons res = new Cons(ConsTypes.STATEMENTLIST);
res.setLeft(statement());
if (statementListPending()) {
res.setRight(statementList());
}
return res;
}
private Cons statement() throws RecognizerException, EndOfInputException {
if (ifStatementPending()) {
return ifStatement();
} else if (forStatementPending()) {
return forStatement();
} else if (whileStatementPending()) {
return whileStatement();
} else if (variableDeclarationPending()) {
return variableDeclaration();
} else if (variableAssignmentPending()) {
return variableAssignment();
} else {
return regularStatement();
}
}
private Cons variableAssignment() throws RecognizerException,
EndOfInputException {
Cons res = new Cons(ConsTypes.VARIABLEASSIGNMENT);
res.setLeft(util.match(LexemeTypes.SET));
Cons J1 = new Cons();
J1.setLeft(util.match(LexemeTypes.ID));
res.setRight(J1);
Cons J2 = new Cons();
J2.setLeft(util.match(LexemeTypes.ASSIGN));
J2.setRight(expression());
J1.setRight(J2);
return res;
}
private boolean variableAssignmentPending() {
return util.check(LexemeTypes.SET);
}
private Cons whileStatement() throws RecognizerException,
EndOfInputException {
Cons res = new Cons(ConsTypes.WHILESTATEMENT);
res.setLeft(util.match(LexemeTypes.WHILE));
Cons J1 = new Cons();
J1.setLeft(util.match(LexemeTypes.OPAREN));
res.setRight(J1);
Cons J2 = new Cons();
J2.setLeft(expression());
J1.setRight(J2);
Cons J3 = new Cons();
J3.setLeft(util.match(LexemeTypes.CPAREN));
J3.setRight(regularBlock());
J2.setRight(J3);
return res;
}
private Cons forStatement() throws RecognizerException, EndOfInputException {
Cons res = new Cons(ConsTypes.FORSTATEMENT);
res.setLeft(util.match(LexemeTypes.FOR));
Cons J1 = new Cons();
J1.setLeft(util.match(LexemeTypes.OPAREN));
res.setRight(J1);
Cons J2 = new Cons();
J2.setLeft(variableDeclaration());
J1.setRight(J2);
Cons J3 = new Cons();
J3.setLeft(util.match(LexemeTypes.SEMICOLON));
J2.setRight(J3);
Cons J4 = new Cons();
J4.setLeft(expression());
J3.setRight(J4);
Cons J5 = new Cons();
J5.setLeft(util.match(LexemeTypes.SEMICOLON));
J4.setRight(J5);
Cons J6 = new Cons();
J6.setLeft(variableAssignment());
J5.setRight(J6);
Cons J7 = new Cons();
J7.setLeft(util.match(LexemeTypes.CPAREN));
J7.setRight(regularBlock());
J6.setRight(J7);
return res;
}
private Cons variableDeclaration() throws RecognizerException,
EndOfInputException {
Cons res = new Cons(ConsTypes.VARIABLEDECLARATION);
res.setLeft(util.match(LexemeTypes.VAR));
Cons J1 = new Cons();
J1.setLeft(util.match(LexemeTypes.ID));
res.setRight(J1);
Cons J2 = new Cons();
if (util.check(LexemeTypes.ASSIGN)) {
J2.setLeft(util.match(LexemeTypes.ASSIGN));
J2.setRight(expression());
J1.setRight(J2);
} else if (util.check(LexemeTypes.ID)) {
J2.setLeft(util.match(LexemeTypes.ID));
J1.setRight(J2);
Cons J3 = new Cons();
J3.setLeft(util.match(LexemeTypes.OPAREN));
J2.setRight(J3);
Cons J4 = new Cons();
if (attributeListPending()) {
J4.setLeft(attributeList());
}
J4.setRight(util.match(LexemeTypes.CPAREN));
J3.setRight(J4);
}
return res;
}
private Cons attributeList() throws RecognizerException,
EndOfInputException {
Cons res = new Cons(ConsTypes.ATTRIBUTELIST);
res.setLeft(attribute());
Cons J1 = new Cons();
if (util.check(LexemeTypes.COMMA)) {
J1.setLeft(util.match(LexemeTypes.COMMA));
J1.setRight(attributeList());
res.setRight(J1);
}
return res;
}
private Cons attribute() throws RecognizerException, EndOfInputException {
Cons res = new Cons(ConsTypes.ATTRIBUTE);
res.setLeft(util.match(LexemeTypes.ID));
Cons J1 = new Cons();
J1.setLeft(util.match(LexemeTypes.ASSIGN));
J1.setRight(primary());
res.setRight(J1);
return res;
}
private Cons regularStatement() throws RecognizerException,
EndOfInputException {
Cons res = new Cons(ConsTypes.REGULARSTATEMENT);
if (returnPending()) {
res.setLeft(returnClause());
}
res.setRight(expression());
return res;
}
private Cons returnClause() throws RecognizerException, EndOfInputException {
return util.match(LexemeTypes.RETURN);
}
private Cons ifStatement() throws RecognizerException, EndOfInputException {
Cons res = new Cons(ConsTypes.IFSTATEMENT);
res.setLeft(util.match(LexemeTypes.IF));
Cons J1 = new Cons();
J1.setLeft(util.match(LexemeTypes.OPAREN));
res.setRight(J1);
Cons J2 = new Cons();
J2.setLeft(expression());
J1.setRight(J2);
Cons J3 = new Cons();
J3.setLeft(util.match(LexemeTypes.CPAREN));
J2.setRight(J3);
Cons J4 = new Cons();
J4.setLeft(regularBlock());
if (elseClausePending()) {
J4.setRight(elseClause());
}
J3.setRight(J4);
return res;
}
private Cons elseClause() throws RecognizerException, EndOfInputException {
Cons res = new Cons(ConsTypes.ELSE);
res.setLeft(util.match(LexemeTypes.ELSE));
if (regularBlockPending()) {
res.setRight(regularBlock());
} else {
res.setRight(ifStatement());
}
return res;
}
private Cons regularBlock() throws RecognizerException, EndOfInputException {
Cons res = new Cons(ConsTypes.REGULARBLOCK);
res.setLeft(util.match(LexemeTypes.OCURLY));
Cons J1 = new Cons();
J1.setLeft(statementList());
J1.setRight(util.match(LexemeTypes.CCURLY));
res.setRight(J1);
return res;
}
private Cons classDeclaration() throws RecognizerException,
EndOfInputException {
Cons res = new Cons(ConsTypes.CLASSDECLARATION);
res.setLeft(util.match(LexemeTypes.CLASS));
Cons temp = new Cons(ConsTypes.JOIN);
temp.setLeft(util.match(LexemeTypes.ID));
Cons temp2 = new Cons(ConsTypes.JOIN);
if (extendsStatementPending()) {
temp2.setLeft(extendsStatement());
}
temp2.setRight(declarationBlock());
temp.setRight(temp2);
res.setRight(temp);
return res;
}
private Cons extendsStatement() throws RecognizerException,
EndOfInputException {
Cons res = new Cons(ConsTypes.EXTENDS);
res.setLeft(util.match(LexemeTypes.EXTENDS));
res.setRight(util.match(LexemeTypes.ID));
return res;
}
private Cons declarationBlock() throws RecognizerException,
EndOfInputException {
Cons res = new Cons(ConsTypes.DECLARATIONBLOCK);
res.setLeft(util.match(LexemeTypes.OCURLY));
Cons temp = new Cons(ConsTypes.JOIN);
if (structListPending()) {
temp.setLeft(structList());
}
temp.setRight(util.match(LexemeTypes.CCURLY));
res.setRight(temp);
return res;
}
private Cons expression() throws RecognizerException, EndOfInputException {
Cons res = new Cons(Cons.ConsTypes.EXPRESSION);
res.setLeft(primary());
if (operatorPending()) {
Cons temp = new Cons();
temp.setLeft(operator());
temp.setRight(expression());
res.setRight(temp);
}
return res;
}
private Cons primary() throws RecognizerException, EndOfInputException {
Cons res = new Cons(ConsTypes.PRIMARY);
if (util.check(LexemeTypes.INTEGER)) {
return util.match(LexemeTypes.INTEGER);
} else if (util.check(LexemeTypes.STRING)) {
return util.match(LexemeTypes.STRING);
} else if (util.check(LexemeTypes.ID)) {
return util.match(LexemeTypes.ID);
} else if (functionCallPending()) {
return functionCall();
} else {
res.setLeft(util.match(LexemeTypes.OPAREN));
Cons J1 = new Cons();
J1.setLeft(expression());
J1.setRight(util.match(LexemeTypes.CPAREN));
res.setRight(J1);
}
return res;
}
private Cons functionCall() throws RecognizerException, EndOfInputException {
Cons res = new Cons(ConsTypes.FUNCTIONCALL);
res.setLeft(util.match(LexemeTypes.CALL));
Cons J1 = new Cons();
J1.setLeft(util.match(LexemeTypes.ID));
res.setRight(J1);
Cons J2 = new Cons();
if (util.check(LexemeTypes.OPAREN)) {
J2.setLeft(util.match(LexemeTypes.OPAREN));
J1.setRight(J2);
Cons J3 = new Cons();
if (argumentListPending()) {
J3.setLeft(argumentList());
}
J3.setRight(util.match(LexemeTypes.CPAREN));
J2.setRight(J3);
} else {
J2.setLeft(util.match(LexemeTypes.DOT));
J1.setRight(J2);
Cons J3 = new Cons();
J3.setLeft(util.match(LexemeTypes.ID));
J2.setRight(J3);
Cons J4 = new Cons();
J4.setLeft(util.match(LexemeTypes.OPAREN));
J3.setRight(J4);
Cons J5 = new Cons();
if (argumentListPending()) {
J5.setLeft(argumentList());
}
J5.setRight(util.match(LexemeTypes.CPAREN));
J4.setRight(J5);
}
return res;
}
private Cons argumentList() throws RecognizerException, EndOfInputException {
Cons res = new Cons(ConsTypes.ARGUMENTLIST);
res.setLeft(expression());
if (util.check(LexemeTypes.COMMA)) {
Cons J1 = new Cons();
J1.setLeft(util.match(LexemeTypes.COMMA));
J1.setRight(argumentList());
res.setRight(J1);
}
return res;
}
private Cons operator() throws RecognizerException, EndOfInputException {
if (util.check(LexemeTypes.ADD)) {
return util.match(LexemeTypes.ADD);
} else if (util.check(LexemeTypes.SUBTRACT)) {
return util.match(LexemeTypes.SUBTRACT);
} else if (util.check(LexemeTypes.MULTIPLY)) {
return util.match(LexemeTypes.MULTIPLY);
} else if (util.check(LexemeTypes.DIVIDE)) {
return util.match(LexemeTypes.DIVIDE);
} else if (util.check(LexemeTypes.ASSIGN)) {
return util.match(LexemeTypes.ASSIGN);
} else if (util.check(LexemeTypes.LESSTHAN)) {
return util.match(LexemeTypes.LESSTHAN);
} else if (util.check(LexemeTypes.GREATERTHAN)) {
return util.match(LexemeTypes.GREATERTHAN);
} else {
return util.match(LexemeTypes.DOT);
}
}
private boolean operatorPending() {
return util.check(LexemeTypes.ADD) || util.check(LexemeTypes.SUBTRACT)
|| util.check(LexemeTypes.MULTIPLY)
|| util.check(LexemeTypes.DIVIDE)
|| util.check(LexemeTypes.ASSIGN)
|| util.check(LexemeTypes.LESSTHAN)
|| util.check(LexemeTypes.GREATERTHAN)
|| util.check(LexemeTypes.DOT);
}
private boolean parameterListPending() {
return expressionPending();
}
private boolean functionDeclarationPending() {
return util.check(LexemeTypes.FUNCTION);
}
private boolean regularBlockPending() {
return util.check(LexemeTypes.OCURLY);
}
private boolean elseClausePending() {
return util.check(LexemeTypes.ELSE);
}
private boolean forStatementPending() {
return util.check(LexemeTypes.FOR);
}
private boolean ifStatementPending() {
return util.check(LexemeTypes.IF);
}
private boolean whileStatementPending() {
return util.check(LexemeTypes.WHILE);
}
private boolean returnPending() {
return util.check(LexemeTypes.RETURN);
}
private boolean regularStatementPending() {
return expressionPending() || util.check(LexemeTypes.RETURN);
}
private boolean expressionPending() {
return primaryPending();
}
private boolean primaryPending() {
return util.check(LexemeTypes.INTEGER)
|| util.check(LexemeTypes.STRING) || util.check(LexemeTypes.ID)
|| util.check(LexemeTypes.OPAREN) || functionCallPending();
}
private boolean statementListPending() {
return statementPending();
}
private boolean statementPending() {
return ifStatementPending() || forStatementPending()
|| whileStatementPending() || regularStatementPending()
|| variableDeclarationPending() || variableAssignmentPending();
}
private boolean argumentListPending() {
return expressionPending();
}
private boolean functionCallPending() {
return util.check(LexemeTypes.CALL);
}
private boolean attributeListPending() {
return attributePending();
}
private boolean attributePending() {
return util.check(LexemeTypes.ID);
}
private boolean variableDeclarationPending() {
return util.check(LexemeTypes.VAR);
}
private boolean extendsStatementPending() {
return util.check(LexemeTypes.EXTENDS);
}
private boolean classDeclarationPending() {
return util.check(LexemeTypes.CLASS);
}
private boolean structListPending() {
return structPending();
}
private boolean structPending() {
return classDeclarationPending() || functionDeclarationPending()
|| variableDeclarationPending()
|| prototypeDeclarationPending();
}
}
| [
"hergin@crimson.ua.edu"
] | hergin@crimson.ua.edu |
6f08b36e088e5e65baa4b14f27c75a08cb80da55 | a6e0faabade66696829427d16107551edaddf485 | /algorithms-lecture/src/main/java/com/brianway/learning/algorithms/lectures/sort/Checker.java | 7b255f297ae8e6569bc4f13a758a5862875649a4 | [
"Apache-2.0"
] | permissive | brianway/algorithms-learning | ff979b84499c225d0429d01af67e0f325c9562f1 | febc684107d80fda9fcfabc3336f40c1a9c3d42f | refs/heads/master | 2022-12-22T02:45:40.046990 | 2022-12-11T13:46:58 | 2022-12-11T13:46:58 | 55,965,971 | 211 | 68 | null | null | null | null | UTF-8 | Java | false | false | 841 | java | package com.brianway.learning.algorithms.lectures.sort;
import java.util.Arrays;
/**
* Created by brian on 16/11/7.
*
* 请设计一个高效算法,判断数组中是否有重复值。
* 必须保证额外空间复杂度为O(1)。
* 给定一个int数组A及它的大小n,请返回它是否有重复值。
*/
public class Checker {
public boolean checkDuplicate(int[] a, int n) {
if (a == null || n == 0) {
return false;
}
Arrays.sort(a);
for (int i = 1; i < n; i++) {
if (a[i] == a[i - 1]) {
return true;
}
}
return false;
}
public static void main(String[] args) {
int[] a = {2, 1, 4, 3, 6, 5, 8, 7, 10, 9};
boolean b = new Checker().checkDuplicate(a, 10);
System.out.println(b);
}
}
| [
"250902678@qq.com"
] | 250902678@qq.com |
5aaa207b06a0e478704e1446b722a5f2aa8d9b50 | d96987482f59cf1f33e5bbc4c0e8c604c112dacb | /app/src/main/java/com/example/xyzhokaoyimoni/presenter/LoginPresenter.java | 7bcd65b956c86d97baaae1ff44b0cc8d4e27b07e | [] | no_license | jjtgit/MVPxin | 5124b968b22fc8a3bc3e4bd3e22bf82543d83b5d | 191078eb630c122b9d2f23b3dbb3e108ccb7b03a | refs/heads/master | 2020-04-13T23:31:09.252116 | 2018-12-29T12:17:47 | 2018-12-29T12:17:47 | 163,508,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,388 | java | package com.example.xyzhokaoyimoni.presenter;
import com.example.xyzhokaoyimoni.entity.UserEntity;
import com.example.xyzhokaoyimoni.model.LoginModel;
import com.example.xyzhokaoyimoni.net.RequestCallback;
import com.example.xyzhokaoyimoni.view.IregisterView;
import java.util.HashMap;
public class LoginPresenter {
private LoginModel loginModel;
private IregisterView iregisterView;
public LoginPresenter(IregisterView iregisterView){
this.loginModel=new LoginModel();
this.iregisterView=iregisterView;
}
public void login(HashMap<String,String>params){
if (loginModel!=null){
loginModel.login(params, new RequestCallback() {
@Override
public void failure(String msg) {
if (iregisterView!=null){
iregisterView.failure(msg);
}
}
@Override
public void successMsg(String msg) {
if (iregisterView!=null){
iregisterView.successMsg(msg);
}
}
@Override
public void success(UserEntity userEntity) {
if (iregisterView!=null){
iregisterView.success(userEntity);
}
}
});
}
}
}
| [
"you@example.com"
] | you@example.com |
31a913724c1c46167897a31a9c04b40fb08ebd0f | e83ebecc0ec40b0d5c1358295c310c6b2731e226 | /src/main/java/com/airbus/domain/Product.java | f7b5ed3392e651e6bab3dea53dbf8b48295b464d | [] | no_license | Anand-Patil20/inventory-backend | 0f8803d2c17e1b7fcbe1a3b6f86f23da31074b28 | 0d573033a7347a3511770c74f120964e39f6f1b8 | refs/heads/main | 2023-08-21T11:13:53.840509 | 2021-09-27T13:47:53 | 2021-09-27T13:47:53 | 409,834,667 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,850 | java | package com.airbus.domain;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "product")
public class Product{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
@Column(name = "product_id")
private String productId;
@Column(name = "product_category")
private String productCategory;
@Column(name = "product_name")
private String productName;
@Column(name = "product_description")
private String productDescription;
private Integer units;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
this.productId = productId;
}
public String getProductCategory() {
return productCategory;
}
public void setProductCategory(String productCategory) {
this.productCategory = productCategory;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductDescription() {
return productDescription;
}
public void setProductDescription(String productDescription) {
this.productDescription = productDescription;
}
public Integer getUnits() {
return units;
}
public void setUnits(Integer units) {
this.units = units;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((productCategory == null) ? 0 : productCategory.hashCode());
result = prime * result + ((productDescription == null) ? 0 : productDescription.hashCode());
result = prime * result + ((productId == null) ? 0 : productId.hashCode());
result = prime * result + ((productName == null) ? 0 : productName.hashCode());
result = prime * result + ((units == null) ? 0 : units.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Product other = (Product) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (productCategory == null) {
if (other.productCategory != null)
return false;
} else if (!productCategory.equals(other.productCategory))
return false;
if (productDescription == null) {
if (other.productDescription != null)
return false;
} else if (!productDescription.equals(other.productDescription))
return false;
if (productId == null) {
if (other.productId != null)
return false;
} else if (!productId.equals(other.productId))
return false;
if (productName == null) {
if (other.productName != null)
return false;
} else if (!productName.equals(other.productName))
return false;
if (units == null) {
if (other.units != null)
return false;
} else if (!units.equals(other.units))
return false;
return true;
}
@Override
public String toString() {
return "Inventory [id=" + id + ", productId=" + productId + ", productCategory=" + productCategory
+ ", productName=" + productName + ", productDescription=" + productDescription + ", units=" + units
+ "]";
}
public Product() {
}
public Product(Integer id, String productId, String productCategory, String productName, String productDescription,
Integer units) {
super();
this.id = id;
this.productId = productId;
this.productCategory = productCategory;
this.productName = productName;
this.productDescription = productDescription;
this.units = units;
}
}
| [
"patil.anand2021@gmail.com"
] | patil.anand2021@gmail.com |
7461c3ef261789e8e2dba8c77b01d1c831669499 | 463c113435a42a63817bf7a42aed7eb05dc6bf82 | /uklon/src/main/java/ua/lviv/iot/uklon/controller/implementation/AdressControllerImpl.java | f16b104bd7f9f53f4b9cffecb8bfba2f748553aa | [] | no_license | Ari100telll/DB_4_lab | 59ef8e50cc442d93ef76bcb437c5d223f3c9f99d | f3ee6c21c08f32bfbeffe7847c05d280de47a7cf | refs/heads/main | 2023-01-13T04:34:01.791086 | 2020-11-22T20:25:18 | 2020-11-22T20:25:18 | 315,117,214 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package ua.lviv.iot.uklon.controller.implementation;
import ua.lviv.iot.uklon.controller.AdressController;
import ua.lviv.iot.uklon.model.entity.Adress;
import ua.lviv.iot.uklon.model.service.implementation.AdressServiceImpl;
public class AdressControllerImpl extends AbstractController<Adress, Integer> implements AdressController {
public AdressControllerImpl() {
super(new AdressServiceImpl());
}
}
| [
"masternik007@gmail.com"
] | masternik007@gmail.com |
62f4c7e5fccfb45579d14c188b68ce1189bd1b44 | e374416be223d57a1ef6d6e5cb3eff931022bbad | /app/src/demo/java/com/manijshrestha/buildvariantdemo/service/WeatherService.java | 3086cce81bd5b87eb17bbbe17d1ecf91d4d28079 | [] | no_license | manijshrestha/BuildVariantDemo | bef87a1cf82c3860fed137dc640122d8c5b875b0 | ac069fdf583c1d9fc9e9580e101fc4185dc412f5 | refs/heads/master | 2020-12-24T15:40:38.127309 | 2015-03-26T16:09:05 | 2015-03-26T16:09:05 | 32,965,617 | 21 | 12 | null | 2018-05-05T08:16:16 | 2015-03-27T03:19:18 | Java | UTF-8 | Java | false | false | 766 | java | package com.manijshrestha.buildvariantdemo.service;
import com.manijshrestha.buildvariantdemo.model.WeatherData;
/**
* Weather service that uses canned data
*/
public class WeatherService {
private WeatherListener mListener;
public WeatherService(WeatherListener listener) {
this.mListener = listener;
}
public void getWeather(String cityName) {
if (cityName.equalsIgnoreCase("bermuda")) {
mListener.onNoWeatherData();
} else {
WeatherData weatherData = new WeatherData();
WeatherData.MainData mainInfo = new WeatherData.MainData();
mainInfo.setTemp("75.00");
weatherData.setMain(mainInfo);
mListener.onWeatherData(weatherData);
}
}
}
| [
"manijshrestha@gmail.com"
] | manijshrestha@gmail.com |
8ec18f28084c47caf1b21ef5cb8234e6999e36b1 | e2860fc448bb8e80f241422d67d3c680b624402a | /AS/src/Persistencia/ControladorSessioDB.java | 7d204c91c47ecc1569eef9a6171585673d3d71ad | [] | no_license | Xilef09/EntregaAS | 4e151cc9d7c1f0fd74a5ffed00004e7917f3fbf9 | 710c30ac2906514a08a462dcbd63ac92a2335bb4 | refs/heads/master | 2021-01-10T14:34:42.184959 | 2016-01-15T03:34:13 | 2016-01-15T03:34:13 | 49,510,365 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,611 | java | package Persistencia;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import Domini.Representacio;
import Domini.Sessio;
public class ControladorSessioDB implements ControladorSessio{
public ControladorSessioDB() {
}
@Override
public Sessio get(String sessio) throws Exception {
SessionFactory factory = new Configuration().configure().buildSessionFactory();
Session session = factory.openSession();
session.beginTransaction();
List<Sessio> l = session.createQuery("from Sessio where sessio = :ses")
.setParameter("ses", sessio).list();
session.getTransaction().commit();
factory.close();
if (!l.isEmpty()) return l.get(0);
throw new Exception ("Session no existe");
}
@Override
public Boolean exists(String sessio) throws Exception {
SessionFactory factory = new Configuration().configure().buildSessionFactory();
Session session = factory.openSession();
session.beginTransaction();
List<Sessio> l = session.createQuery("from Sessio where sessio = :ses")
.setParameter("ses", sessio).list();
session.getTransaction().commit();
factory.close();
return !l.isEmpty();
}
@Override
public ArrayList<Sessio> all() throws Exception {
SessionFactory factory = new Configuration().configure().buildSessionFactory();
Session session = factory.openSession();
session.beginTransaction();
ArrayList<Sessio> l = (ArrayList<Sessio>) session.createQuery("from Sessio").list();
session.getTransaction().commit();
factory.close();
return l;
}
}
| [
"felix.hortelano@est.fib.upc.edu"
] | felix.hortelano@est.fib.upc.edu |
007c6069a2e558b209f4cd8cfc3b91ede8072105 | 193607321e9a948510f48db8cfe01c50083a0ed0 | /WeekThreev.2/app/src/main/java/rosemak/weekthreev2/CustomListAdapter.java | a3b3022f0de7d18f5b2fbee9488b3fe1055d2011 | [] | no_license | r36745/newTest | 971dd93c496b6819cfc6f24b9c22dd0e78cbe146 | 57100c81e0224cff4d960c9c91db8f4a85ad86ad | refs/heads/master | 2021-01-16T18:56:52.027762 | 2014-09-06T16:52:40 | 2014-09-06T16:52:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,163 | java | package rosemak.weekthreev2;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
/**
* Created by stevierose on 8/17/14.
*/
public class CustomListAdapter extends ArrayAdapter {
private Activity activity;
private ArrayList data;
public Resources res;
FantasyTeam tempValues = null;
LayoutInflater inflater;
//Custom adapter Constructor
public CustomListAdapter(Main mainContext, int resource, ArrayList objects, Resources resLocal) {
super(mainContext, resource, objects);
activity = mainContext;
data = objects;
res = resLocal;
inflater =(LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public View getDropDownView(int position, View convertView,ViewGroup parent) {
return getCustomView(position, convertView, parent);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return getCustomView(position, convertView, parent);
}
private View getCustomView(int position, View convertView, ViewGroup parent) {
View row = inflater.inflate(R.layout.row_layout, parent, false);
tempValues = null;
tempValues = (FantasyTeam) data.get(position);
TextView nameLabel = (TextView) row.findViewById(R.id.textViewPlayersName);
TextView teamLabel = (TextView) row.findViewById(R.id.textViewPlayersTeam);
TextView positionLabel = (TextView) row.findViewById(R.id.textViewPlayersPosition);
if(position == 0) {
//Default Text
nameLabel.setText("Fantasy Football");
} else {
nameLabel.setText(tempValues.getPlayerName());
teamLabel.setText(tempValues.getPlayerTeam());
positionLabel.setText(tempValues.getPlayerPosition());
}
return row;
}
}
| [
"stevierose@fullsail.edu"
] | stevierose@fullsail.edu |
8707c428dc3e7ab49cfc8df3fe01288a5b309184 | a0f4730e7c94d95ca2831812ac2b680d31034bbb | /src/keyword/EqualsTest.java | 3d2478740ece181f306f2d184217ddae476b605b | [] | no_license | XuPeng211985/javabeantest | d40ce300bdbd9360bd338ba500930674d0177247 | 96ccec50033d6a45a1d017fffb41bbb47aed7bd0 | refs/heads/master | 2020-03-18T11:13:19.075601 | 2018-05-31T02:48:26 | 2018-05-31T02:48:26 | 134,585,513 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,853 | java | package keyword;
/**
* 1》== 比较的是两个对象或者基本数据类型的存储地址是否相同
* 2》equals方法是Object类中提供用来比较两个对象是否相等的方法
* 默认情况下比较两个对象是否指向同一个引用,也就是比较两个对象
* 所指向的地址是否相同,但是设计equals的初衷是为了比较两个对象的状态
* 是否相等,比如一个学生对象可以由姓名和学号唯一确定,那么只要两个学生
* 对象的姓名和学号对应相等,那么我们就说这两个学生是同一个学生,因此通常
* 情况下我们需要重写equals方法用它来比较两个对象状态是否相等,必须满足5个
* 特性:自反性,对称性,传递性,一致性,非空引用e.equals.(null)必须返回null
* 注:通常重写时会调用对象中某个字段的equals方法,来比较两个字段对象的值是否相等
* 为了避免两个对象都为null时返回false
*
* 应用场景:通常在开发系统登录功能时,首先需要调用equals方法比较
* 数据库中查出的对象是否和前端界面传入的对象信息是否匹配,
* 如果采用默认equals方法,两个对象是不同时刻创建的两个不同的对象
* equals方法肯定会返回false,永远也登录不进去,那么你就算正确输入
* 登录名和密码也没有办法。
* ==============================================================
* ==============================================================
* 关于hashCode方法:hashCode的字面意思是散列码,它是由对象导出的一个整型值
* 散列码的生成是没有特定规律的,(1)如果两个对象相同(equals方法返回true),那么它们的hashCode值一定要相同;(2)如果两个对象的hashCode相同,它们并不一定相同。当然,你未必要按照要求去做,
* 但是如果你违背了上述原则就会发现在使用容器时,相同的对象可以出现在Set集
* 合中,同时增加新元素的效率会大大下降(对于使用哈希存储的系统,如果哈希
* 码频繁的冲突将会造成存取性能急剧下降)。
* ========================================================
* ========================================================
* 关于instanceof :比较两个对象的类型是否相等,通常在多态下判断父类的不同子类的类型
*/
public class EqualsTest {
public static void main(String[] args) {
String t1 = "test";
String t2 = "test";
String t3 = new String("test");
System.out.println("t2从常量池中找到了test 并且这个test就是刚才t1创建的");
System.out.println(t1 == t2);
System.out.println("t3直接new了一个新的String对象");
System.out.println(t1 == t3);
System.out.println("String类重写了equals方法 比较char[] 数组中每一个元素是否相等");
System.out.println(t1.equals(t2));
System.out.println(t1.equals(t3));
System.out.println("===============================");
System.out.println("===============================");
String s = "OK";
StringBuffer sb = new StringBuffer(s);
System.out.println(s.hashCode() + " " + sb.hashCode());
String t = new String("OK");
StringBuilder tb = new StringBuilder(t);
System.out.println(t.hashCode() + " " + tb.hashCode());
System.out.println("总结:String重写了hashCode 方法,由字符串内容决定 所以两个String类型的值相等");
System.out.println(" StringBuffer没有重写hashCode 方法,默认比较地址 所以两个String类型的hash值不相等");
}
}
| [
"1757140904@qq.com"
] | 1757140904@qq.com |
110f7d6fdff92ec6a2f8d5ea019317d60ed9db7c | abdf6a348b3f53ff614d9b228572dd1ca931e050 | /eclipse/jcoinlibs/src/org/ripple/bouncycastle/crypto/tls/TlsCompression.java | 690e05b2864ab286d6cf47f48d5e9f2cb9f6479f | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | cping/RipplePower | 5b2afd114eddbdb1a688e9de98cb409f16adfb89 | 4bdfd7ddca69e2cfb2c33852379844880cfe2a2a | refs/heads/master | 2021-05-16T02:40:30.916689 | 2021-01-02T07:37:47 | 2021-01-02T07:37:47 | 19,198,112 | 42 | 13 | null | 2015-01-15T08:02:34 | 2014-04-27T07:11:33 | Java | UTF-8 | Java | false | false | 210 | java | package org.ripple.bouncycastle.crypto.tls;
import java.io.OutputStream;
public interface TlsCompression
{
OutputStream compress(OutputStream output);
OutputStream decompress(OutputStream output);
}
| [
"longwind2012@hotmail.com"
] | longwind2012@hotmail.com |
0d12d3358ad341f8b3c461f9c8766f271d752717 | a18bb257f38405a83235aeb68d9010176abab5a7 | /src/test/java/com/enosh/couponsystemfinish/dao/CompanyTests.java | 4c5cfafa770058dbfbabf35dfb51f225f437e262 | [] | no_license | EnoshTsur/coupon-sys-admin | 6ec587a8a68b89ca0b157dd9fcb5dfcf99bdc293 | ce82d813a46a2a36a3c2cccfd387aa3b25500f89 | refs/heads/master | 2022-08-26T12:06:42.559462 | 2020-05-23T12:00:43 | 2020-05-23T12:00:43 | 266,327,304 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,105 | java | package com.enosh.couponsystemfinish.dao;
import com.enosh.couponsystemfinish.dao.CompanyDao;
import com.enosh.couponsystemfinish.exceptions.DoesntExistsException;
import com.enosh.couponsystemfinish.model.Company;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
@SpringBootTest
class CompanyTests {
@Autowired
private CompanyDao companyDao;
@Test
void contextLoads() {
}
@Test
void add() {
Stream.of(new Company(
"rainbow",
"rainbow@com",
"l2323"
), new Company(
"yes",
"yes@gm",
"223354"
), new Company(
"bug",
"2njk@jkj",
"545454"
), new Company(
"sports",
"sp@hopj",
"443219"
)).map(companyDao::addCompany)
.forEach(System.out::println);
}
@Test
void update() {
try {
Company updated = companyDao.updateCompany(c -> {
c.setName("aromale");
return c;
}, 17L);
System.out.println(updated);
} catch (DoesntExistsException e) {
e.printStackTrace();
}
}
@Test
void findById() {
companyDao.findById(18L).ifPresent(System.out::println);
}
@Test
void findAll() {
companyDao.findAll().forEach(System.out::println);
}
@Test
void delete() {
try {
Company deleted = companyDao.deleteCompany(17L);
System.out.println(deleted);
} catch (DoesntExistsException e) {
e.printStackTrace();
}
}
@Test
void existsByName(){
System.out.println(companyDao.existsByName("aromale"));
}
@Test
void existsByEmail(){
System.out.println(companyDao.existsByEmail("yes@gm"));
}
}
| [
"enosh.tsur@haaretz.co.il"
] | enosh.tsur@haaretz.co.il |
1009d3ff7e4507f231efeee0b5f119bdcca91e87 | 24c56bc6b04e6eb334655ac1c8916b55352fb7ef | /NorthPointGlobal/src/java/com/NorthPointGlobal/myCore/WarrantSettings.java | f1373385750136312727f74f25e46d1e1baacfb8 | [] | no_license | ohyicong/WarrantAnalytics | 963a09923c30b9c918309a65eb120f298d80c701 | 1e0ab8c1bb7b1a3957f4af5bb951dfa882495e52 | refs/heads/master | 2020-03-18T19:02:42.608603 | 2018-05-28T08:43:52 | 2018-05-28T08:43:52 | 135,130,856 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,630 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.NorthPointGlobal.myCore;
/**
*
* @author OHyic
*/
public class WarrantSettings {
private String warrantCode;
private int sensitivityRowNumber,sensitivityColNumber;
private String warrantName;
public int getSensitivityColNumber() {
return sensitivityColNumber;
}
public void setSensitivityColNumber(int sensitivityColNumber) {
this.sensitivityColNumber = sensitivityColNumber;
}
private double sensitivity;
public WarrantSettings(String warrantName,String warrantCode,double sensitivity){
this.warrantCode=warrantCode;
this.warrantName=warrantName;
this.sensitivityRowNumber=0;
this.sensitivityColNumber=0;
}
public int getSensitivityRowNumber() {
return sensitivityRowNumber;
}
public void setSensitivityRowNumber(int sensitivityRowNumber) {
this.sensitivityRowNumber = sensitivityRowNumber;
}
public double getSensitivity() {
return sensitivity;
}
public void setSensitivity(double sensitivity) {
this.sensitivity = sensitivity;
}
public String getWarrantName(){
return warrantName;
}
public void setWarrantName(String warrantName){
this.warrantName=warrantName;
}
public String getWarrantCode() {
return warrantCode;
}
public void setWarrantCode(String warrantCode) {
this.warrantCode = warrantCode;
}
}
| [
"ohyicong@hotmail.com"
] | ohyicong@hotmail.com |
34a919dcfc6477e1dc0fb7e65d061e2d2c358117 | 9a213d7e673401af94f30f0130cd53c4ffbf9c8f | /src/test/java/com/test/RSAAlgorithmTest.java | bf978b1ded70c128dcf882e97e184bf5e3f0789e | [] | no_license | lamfire/lamfire | 7eb69ec4b8c93eaff0f893ffae8949d418f1c3de | a9adf18eca0bdf61b04ce72a507230d9225853ce | refs/heads/master | 2022-12-09T22:35:12.792146 | 2022-11-29T01:59:43 | 2022-11-29T01:59:43 | 190,158,270 | 0 | 1 | null | 2020-10-13T13:39:51 | 2019-06-04T08:12:15 | Java | UTF-8 | Java | false | false | 10,530 | java | package com.test;
import com.lamfire.code.Base64;
import com.lamfire.code.Hex;
import com.lamfire.code.RSAAlgorithm;
import com.lamfire.utils.*;
import java.math.BigInteger;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
* Created with IntelliJ IDEA.
* User: linfan
* Date: 15-6-11
* Time: 下午8:56
* To change this template use File | Settings | File Templates.
*/
public class RSAAlgorithmTest {
static AtomicInteger counter = new AtomicInteger();
static BigInteger privateKey = new BigInteger("18d260e2fd33a08ae4a638952befb33496f072e00ce92029f84a1cf0e3ef0c9ef50a60f84cf91c7a0d69cf8d2feaaeb06aae75e94273ecf1684340da1d43b00707ce1a5b4e0063bb6aa9a6c63b9ab7aab59b716e2d514d648caf10be5231394a5d93434589ff9538359fd6e5055341ce0f9d032ffe20db1b3e1b940842b4e49f",16);
static BigInteger publicKey = new BigInteger("d4d2c80d52ddb2ed4394bb3f8e6c6b82d55f0e8316da658f5262d4b1aa32bd63676604cba4a4f4bf8e511a5c6d680a12d9b9ce30d412516dcfa5165d50617547969536a46dd120502447ffa10c2344d64b900033908eb1b254625b459b6eee8468fde9bf35eaa2a89881823672d70659cdf990ee264823db6a1bea10412242d7",16);
static BigInteger modulus = new BigInteger("1e72a06a87163b2fb694f3caaf225c6cfa102ebf2b188088997ce7ae958617c1cafbcf445c201f87b82b913d581cf18681673b2a02f2b164de1e1b9569f56bd61f611068f252db8a3cf56ef98ed91e4f7cde10eb364b12d1229f3d4615594945e444a13a0f10362e7b6cb7cf5d2d0ed0d87ca2ec37e1545e8b674427badd6d67",16);
static final int keyBits = 1024;
static void endetest(byte[] bytes , RSAAlgorithm rsa,BigInteger privateKey,BigInteger publicKey,BigInteger modulus){
byte[] cipher =rsa.encode(bytes,privateKey,modulus);
// 解密
byte[] plain = rsa.decode(cipher,publicKey,modulus);
if(!Bytes.equals(bytes,plain)){
System.out.println("[SOURCE]:" + Hex.encode(bytes));
System.out.println("[DECODE]:" + Hex.encode(plain));
}
Asserts.equalsArrayAssert(bytes,plain);
System.out.println(new String(plain));
}
private static void testFile() throws Exception {
RSAAlgorithm rsa = new RSAAlgorithm(keyBits);
rsa.genKey();
privateKey = rsa.getPrivateKey();
publicKey = rsa.getPublicKey();
modulus = rsa.getModulus();
String source = IOUtils.toString(ClassLoaderUtils.getResourceAsStream("data.txt", RSAAlgorithm.class));
System.out.println("source:");
System.out.println(source);
System.out.println("---------------------------------------------------");
byte[] bytes = rsa.encode(source.getBytes("utf-8"),publicKey,modulus);
byte[] deBytes = rsa.decode(bytes,privateKey,modulus);
String de = new String(deBytes,"utf-8");
System.out.println("decode:");
System.out.println(de);
Asserts.equalsAssert(source,de);
}
private static void testKey() throws Exception {
// 加密
String source = "RSA公钥加密算法是1977年由Ron Rivest、Adi Shamirh和LenAdleman在(美国麻省理工学院)开发的。RSA公钥加密算法是1977年由Ron Rivest、Adi Shamirh和LenAdleman在(美国麻省理工学院)开发的。";
System.out.println("privKey:" + privateKey.bitLength());
System.out.println(privateKey);
System.out.println("pubKey:" + publicKey.bitLength());
System.out.println(publicKey);
System.out.println("modulus:" + modulus.bitLength());
System.out.println(modulus);
System.out.println("============================");
RSAAlgorithm rsa = new RSAAlgorithm(keyBits);
byte[] bytes = source.getBytes("utf-8");
System.out.println("[SOURCE BYTES]:" + bytes.length);
byte[] cipher =rsa.encode(bytes,privateKey,modulus);
System.out.println("[ENCODE BYTES]:" + cipher.length);
System.out.println("[ENCODE]:\r\n" + Hex.encode(cipher));
System.out.println("============================");
// 解密
byte[] plain = rsa.decode(cipher,publicKey,modulus);
String decode = new String(plain, "UTF-8");
System.out.println("[DECODE BYTES]:" + plain.length);
System.out.println("[DECODE]:\r\n" +decode);
//Asserts.assertEquals(source,decode);
}
private static void test() throws Exception {
// BigInteger Q = new BigInteger(Hex.decode("8682236E835BAF3CFEC279F0C479558EF55EADA5836D1D1B18D6D85736EB71F263D440DC9E7E0A997BECDD05B60EC19D63AC71EC27D91269739453D5050A6783"));
// BigInteger P = new BigInteger(Hex.decode("F4FE37F84135BFB46DCBF5F58976990E0922969FA129A1B210B9036F2B9236399BABF2580582B5EEFD49EA6151A938CABD3405B70483E7DFB4183BDE41A3FD1B"));
// BigInteger E = new BigInteger(Hex.decode("B60432D2F12CD321D5F827E67DE1B5BCA51A13BEB59B9969E6A7E509F0442FF6FC9AE091E8B4B49B1A8AC275FF9A1922F4EDED500AE1E08ED64D2974BDA352A3"));
BigInteger Q = RSAAlgorithm.genProbablePrime(511);
BigInteger P = RSAAlgorithm.genProbablePrime(511);
BigInteger E = RSAAlgorithm.genProbablePrime(1024);
System.out.println(String.format("Q:%d , P:%d , E:%d", Q.bitLength(), P.bitLength(), E.bitLength()));
RSAAlgorithm rsa = new RSAAlgorithm(1024,P,Q,E);
System.out.println("PrivateKey[" + rsa.getPrivateKey().bitLength() +"]:" + rsa.getPrivateKey().toString(16));
System.out.println("PublicKey[" + rsa.getPublicKey().bitLength() +"]:" +rsa.getPublicKey().toString(16));
System.out.println("Modulus[" + rsa.getModulus().bitLength()+"]:"+rsa.getModulus().toString(16));
System.out.println("============================");
// 加密
String source = "RSA公钥加密算法是1977年由Ron Rivest、Adi Shamirh和LenAdleman在(美国麻省理工学院)开发的。";
byte[] bytes = source.getBytes("utf-8");
System.out.println("[SOURCE BYTES]:" + bytes.length);
byte[] cipher =rsa.encode(bytes,rsa.getPrivateKey(),rsa.getModulus());
System.out.println("[ENCODE BYTES]:" + cipher.length);
System.out.println("[ENCODE]:\r\n" + Hex.encode(cipher));
System.out.println("============================");
// 解密
byte[] plain = rsa.decode(cipher,rsa.getPublicKey(),rsa.getModulus());
String decode = new String(plain, "UTF-8");
System.out.println("[DECODE BYTES]:" + plain.length);
System.out.println("[DECODE]:\r\n" +decode);
//Asserts.assertEquals(source,decode);
}
public static void randomTest() throws Exception {
RSAAlgorithm rsa = new RSAAlgorithm(keyBits);
//rsa.genKey();
String source = RandomUtils.randomTextWithFixedLength(117);
System.out.println(source);
byte[] bytes = source.getBytes();
byte[] enBytes = rsa.encode(bytes,privateKey,modulus);
byte[] deBytes = rsa.decode(enBytes,publicKey,modulus);
String des = new String(deBytes);
System.out.println(des);
Asserts.equalsAssert(source,des);
}
public static void testGenKey()throws Exception{
BigInteger Q = RSAAlgorithm.genProbablePrime(511);
BigInteger P = RSAAlgorithm.genProbablePrime(511);
BigInteger E = RSAAlgorithm.genProbablePrime(1024);
System.out.println(String.format("Q:%d , P:%d , E:%d", Q.bitLength(), P.bitLength(), E.bitLength()));
RSAAlgorithm rsa = new RSAAlgorithm(1024,P,Q,E);
privateKey = rsa.getPrivateKey();
publicKey = rsa.getPublicKey();
modulus = rsa.getModulus();
System.out.println("PrivateKey[" + rsa.getPrivateKey().bitLength() +"]:" + rsa.getPrivateKey().toString(16));
System.out.println("PublicKey[" + rsa.getPublicKey().bitLength() +"]:" +rsa.getPublicKey().toString(16));
System.out.println("Modulus[" + rsa.getModulus().bitLength()+"]:"+rsa.getModulus().toString(16));
}
public static void test(String source) throws Exception {
RSAAlgorithm rsa = new RSAAlgorithm(keyBits);
//System.out.println(source);
byte[] bytes = source.getBytes();
//rsa.genKey();
byte[] enBytes = rsa.encode(bytes,privateKey,modulus);
byte[] deBytes = rsa.decode(enBytes,publicKey,modulus);
String des = new String(deBytes);
//System.out.println(des);
Asserts.equalsAssert(source,des);
}
public static void testDecode(String source,byte[] encodeBytes){
RSAAlgorithm rsa = new RSAAlgorithm(keyBits);
//System.out.println(source);
byte[] bytes = source.getBytes();
byte[] deBytes = rsa.decode(encodeBytes,publicKey,modulus);
String des = new String(deBytes);
//System.out.println(des);
Asserts.equalsAssert(source,des);
}
static void performance()throws Exception{
final OPSMonitor m = new OPSMonitor("rsa-001");
m.startup();
ThreadPoolExecutor executor = Threads.newFixedThreadPool(8);
for(int i=0;i<8;i++){
executor.submit(new PerformanceTask(m));
}
}
static class PerformanceTask implements Runnable{
OPSMonitor monitor;
public PerformanceTask(OPSMonitor monitor){
this.monitor = monitor;
}
@Override
public void run() {
RSAAlgorithm rsa = new RSAAlgorithm(keyBits);
String source = "{\"apppkg\":\"com.sharesdk.cn.App\",\"appver\":\"2.01\",\"plat\":1,\"network\":\"wifi\",\"deviceinfo\":{\"udid\":\"534b9af8e4b00675af367632\",\"adsid\":\"adsid1234556677\",\"imei\":\"652487889215035\",\"serialno\":\"52245787\",\"mac\":\"EA:00:45:23:A5:FF\",\"model\":\"Note II\",\"factory\":\"sumsung\",\"carrier\":4600,\"screensize\":\"480x960\",\"sysver\":\"4.03\",\"androidid\":\"froyo\"}}";//RandomUtils.randomTextWithFixedLength(64);
byte[] encodeBytes = rsa.encode(source.getBytes(),privateKey,modulus);
while(true){
testDecode(source, encodeBytes);
monitor.done();
counter.incrementAndGet();
}
}
}
public static void main(String[] args) throws Exception {
//testFile();
//testGenKey();
//test();
performance();
}
}
| [
"52089489@qq.com"
] | 52089489@qq.com |
8d238d5b8dc885533fad7ba806adc5cf656c3723 | 2ae28773963604b3cbee6626959dd262c1cc3a6e | /base/deploy/deployer/src/main/java/com/android/tools/deployer/SqlApkFileDatabase.java | 7efd6e81d45b424a3217ae7537d5237c329174e5 | [
"Apache-2.0"
] | permissive | qiangxu1996/vmtrace | c95985e76253f140467e20f67d38022b2623e94e | 3411c5436d0d34e6e2b84cbf0e9395ac8c55c9d4 | refs/heads/master | 2022-04-18T22:32:39.132937 | 2020-04-18T23:01:55 | 2020-04-18T23:01:55 | 255,410,085 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 14,494 | java | /*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.tools.deployer;
import com.android.tools.deployer.model.Apk;
import com.android.tools.deployer.model.ApkEntry;
import com.android.tools.deployer.model.DexClass;
import com.android.tools.r8.Version;
import com.android.tools.tracer.Trace;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** Implementation of the {@link ApkFileDatabase} based on SQLite. */
public class SqlApkFileDatabase implements ApkFileDatabase {
// The SQLite use this property to determine where to temporary extract the .so / .dll during init.
private static final String SQLITE_JDBC_TEMP_DIR_PROPERTY = "org.sqlite.tmpdir";
public static final int MAX_DEXFILES_ENTRY = 200;
// Purely a value-based check. No plans to make the cache database forward / backward compatible.
// IE: All tables will be dropped if version number on the file does not match this number.
// History:
// 0.1 - Initial Check-in
// 0.2 - First Release (AS 3.5)
// 0.3 - Take into account of dex splitter version.
// 1.0 - D8 Checksum support (Note: No database table scheme was changed, just changing checksum computation)
private static final String CURRENT_SCHEMA_VERSION_NUMBER = "1.0";
private static final String CURRENT_CHECKSUM_TOOL_VERSION = Version.getVersionString();
private static final String CURRENT_DATABASE_VERSION_STRING =
CURRENT_SCHEMA_VERSION_NUMBER + "|" + CURRENT_CHECKSUM_TOOL_VERSION;
private final String databaseVersion;
private final int maxDexFilesEntries;
private Connection connection;
/**
* @param nativeLibraryTmpDir SQLite requires extracting a native .so / .dll in a temp directory
* for it to work. However, some OS set up might have given /tmp noexec. We are going to
* require the caller to give us a good place to extract that library to. If this is null,
* it will continue to use the OS's temp dir.
*/
public SqlApkFileDatabase(File file, String nativeLibraryTmpDir) {
this(file, nativeLibraryTmpDir, CURRENT_DATABASE_VERSION_STRING, MAX_DEXFILES_ENTRY);
}
public SqlApkFileDatabase(
File file, String nativeLibraryTmpDir, String databaseVersion, int maxDexFileEntries) {
this.databaseVersion = databaseVersion;
this.maxDexFilesEntries = maxDexFileEntries;
// Save the property incase someone needs to do something else with it.
String previousSqliteTmpdir = System.getProperty(SQLITE_JDBC_TEMP_DIR_PROPERTY);
try {
if (nativeLibraryTmpDir != null) {
System.setProperty(SQLITE_JDBC_TEMP_DIR_PROPERTY, nativeLibraryTmpDir);
File tmpDir = new File(nativeLibraryTmpDir);
if (!tmpDir.exists() && !tmpDir.mkdirs()) {
throw new RuntimeException("Cannot create temp directory: " + tmpDir.getPath());
}
}
// For older versions of the JDBC we need to force load the sqlite.JDBC driver to trigger static initializer's and register
// the JDBC driver with the Java DriverManager.
Class.forName("org.sqlite.JDBC");
boolean newFile = !file.exists();
connection =
DriverManager.getConnection(String.format("jdbc:sqlite:%s", file.getPath()));
if (newFile) {
fillTables();
} else {
dropOldTables();
}
executeStatements("PRAGMA foreign_keys=ON;");
} catch (ClassNotFoundException | SQLException e) {
throw new RuntimeException(e);
} finally {
if (nativeLibraryTmpDir != null) {
if (previousSqliteTmpdir == null) {
System.clearProperty(SQLITE_JDBC_TEMP_DIR_PROPERTY);
} else {
System.setProperty(SQLITE_JDBC_TEMP_DIR_PROPERTY, previousSqliteTmpdir);
}
}
}
}
@Override
public void close() {
try {
connection.close();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
private void dropOldTables() throws SQLException {
try (Statement s = connection.createStatement();
ResultSet result =
s.executeQuery(
"SELECT value from metadata WHERE name = \"schema-version\";")) {
if (result.next()) {
String version = result.getString("value");
if (version.equals(databaseVersion)) {
return;
}
}
} catch (SQLException ignored) {
// If there is anything wrong, we are dropping all the tables.
}
// Otherwise we are dropping everything and starting over.
executeStatements(
"PRAGMA writable_schema = 1;",
"delete from sqlite_master where type in ('table', 'index', 'trigger');",
"PRAGMA writable_schema = 0;",
"VACUUM;");
fillTables();
}
private void fillTables() throws SQLException {
executeStatements(
"CREATE TABLE metadata (name VARCHAR(255) UNIQUE NOT NULL, value TEXT NOT NULL, PRIMARY KEY (name));",
"INSERT INTO metadata (name, value) values (\"schema-version\", \""
+ databaseVersion
+ "\");",
"CREATE TABLE dexfiles (id INTEGER PRIMARY KEY AUTOINCREMENT, name VARCHAR(255) NOT NULL, checksum LONG NOT NULL);",
"CREATE INDEX dexfiles_checksum_index ON dexfiles(checksum);",
"CREATE TABLE archives (dexfileId INTEGER, checksum VARCHAR(255), "
+ "CONSTRAINT fk_archives_dexfileId FOREIGN KEY(dexfileId) REFERENCES dexfiles(id) ON DELETE CASCADE);",
"CREATE INDEX archives_checksum_index ON archives(checksum);",
"CREATE TABLE classes (dexfileId INTEGER, name TEXT, checksum LONG, "
+ "CONSTRAINT fk_classes_dexfileId FOREIGN KEY(dexfileId) REFERENCES dexfiles(id) ON DELETE CASCADE);",
"CREATE INDEX classes_dexfileId_name_index ON classes(dexfileId);");
}
private void flushOldCache() {
try {
executeUpdate(
"DELETE FROM dexfiles WHERE id < (SELECT * FROM (SELECT id from dexfiles ORDER BY id DESC LIMIT "
+ maxDexFilesEntries
+ ") ORDER BY id LIMIT 1);");
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
private void executeStatements(String... statements) throws SQLException {
try (Statement s = connection.createStatement()) {
if (statements.length == 1) {
s.execute(statements[0]);
} else {
for (String statement : statements) {
s.addBatch(statement);
}
s.executeBatch();
}
}
}
private int executeUpdate(String query) throws SQLException {
try (Statement s = connection.createStatement()) {
return s.executeUpdate(query);
}
}
@Override
public List<DexClass> getClasses(ApkEntry dex) {
try (Trace ignored = Trace.begin("SqlApkFileDatabase.getClasses");
Statement s = connection.createStatement();
ResultSet result =
s.executeQuery(
"SELECT classes.name as name, classes.checksum as checksum"
+ " FROM dexfiles"
+ " INNER JOIN archives on archives.dexfileId = dexfiles.id"
+ " INNER JOIN classes on classes.dexfileId = dexfiles.id"
+ " WHERE dexfiles.name = \""
+ dex.name
+ "\" AND dexfiles.checksum = "
+ dex.checksum
+ " ORDER BY id DESC")) {
List<DexClass> classes = new ArrayList<>();
while (result.next()) {
String name = result.getString("name");
long checksum = result.getLong("checksum");
classes.add(new DexClass(name, checksum, null, dex));
}
return classes;
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
@Override
public void addClasses(Collection<DexClass> allClasses) {
try {
Map<Apk, Multimap<ApkEntry, DexClass>> map = new HashMap<>();
for (DexClass clazz : allClasses) {
Multimap<ApkEntry, DexClass> multimap = map.get(clazz.dex.apk);
if (multimap == null) {
multimap = HashMultimap.create();
map.put(clazz.dex.apk, multimap);
}
multimap.put(clazz.dex, clazz);
}
for (Map.Entry<Apk, Multimap<ApkEntry, DexClass>> entry : map.entrySet()) {
Multimap<ApkEntry, DexClass> classes = entry.getValue();
List<Integer> ids = new ArrayList<>();
for (ApkEntry dex : classes.keySet()) {
int id = addDexFile(dex.checksum, dex.name);
ids.add(id);
// TODO: Verify if writing all the classses in one go would help
addClasses(id, classes.get(dex));
}
addDexFiles(entry.getKey().checksum, ids);
}
flushOldCache();
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
private int addDexFile(long checksum, String name) throws SQLException {
String insert =
String.format(
"INSERT INTO dexfiles(name, checksum) VALUES (\"%s\", %d);",
name, checksum);
try (Statement s = connection.createStatement()) {
int updated = s.executeUpdate(insert);
assert updated == 1;
try (ResultSet set = s.executeQuery("SELECT LAST_INSERT_ROWID();")) {
return set.getInt(1);
}
}
}
private void addClasses(int dexId, Collection<DexClass> classes) throws SQLException {
if (classes.isEmpty()) {
return;
}
String values =
classes.stream()
.map(e -> String.format("(%d, \"%s\", %d)", dexId, e.name, e.checksum))
.collect(Collectors.joining(","));
String insert =
String.format("INSERT INTO classes (dexfileId, name, checksum) VALUES %s;", values);
int updated = executeUpdate(insert);
assert updated == classes.size();
}
private void addDexFiles(String archiveChecksum, List<Integer> files) throws SQLException {
if (files.isEmpty()) {
return;
}
String values =
files.stream()
.map(e -> String.format("(%d, \"%s\")", e, archiveChecksum))
.collect(Collectors.joining(","));
String insert =
String.format("INSERT INTO archives (dexfileId, checksum) VALUES %s;", values);
int updated = executeUpdate(insert);
assert updated == files.size();
}
@Override
@VisibleForTesting
public List<DexClass> dump() {
List<DexClass> classes = new ArrayList<>();
for (Apk apk : getApks()) {
for (ApkEntry file : getFiles(apk)) {
classes.addAll(getClasses(file));
}
}
classes.sort(Comparator.comparingInt(a -> (int) a.checksum));
return classes;
}
/** Test only code */
private List<ApkEntry> getFiles(Apk apk) {
try (Statement s = connection.createStatement();
ResultSet result =
s.executeQuery(
"SELECT dexfiles.name as name, dexfiles.checksum as checksum FROM dexfiles"
+ " INNER JOIN archives on archives.dexfileId = dexfiles.id"
+ " WHERE archives.checksum = \""
+ apk.checksum
+ "\"")) {
List<ApkEntry> files = new ArrayList<>();
while (result.next()) {
files.add(new ApkEntry(result.getString("name"), result.getLong("checksum"), apk));
}
return files;
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
/** Test only code */
private List<Apk> getApks() {
try (Statement s = connection.createStatement();
ResultSet result = s.executeQuery("SELECT DISTINCT checksum from archives")) {
List<Apk> apks = new ArrayList<>();
while (result.next()) {
apks.add(Apk.builder().setChecksum(result.getString("checksum")).build());
}
return apks;
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
| [
"qiangxu1996@gmail.com"
] | qiangxu1996@gmail.com |
67204b97b72337265a6862d1fcf0c8d6186f44a1 | ca85f7e638c229d60615f3ee63114124e536229f | /Capgemini_HTD/BackEnd/CoreJAVA/exceptionhandling/src/com/capgemini/exceptionhandle/railway/PVR.java | 6b6c5faac43191ed4a4ee2c7c7b0ffea248541e5 | [] | no_license | aishwarya0311/TY_CG_HTD_PuneMumbai_JFS_AishwaryaNarwade | 8b52f79bef7665f9506204a8f7dad8667702f679 | 24b2d48becc20b041114571d2be60fb63c67c3cf | refs/heads/master | 2022-12-26T20:53:57.664162 | 2019-11-20T08:25:15 | 2019-11-20T08:25:15 | 225,846,064 | 0 | 0 | null | 2022-12-15T23:50:31 | 2019-12-04T11:00:51 | Java | UTF-8 | Java | false | false | 345 | java | package com.capgemini.exceptionhandle.railway;
public class PVR {
void confirm ()
{
System.out.println("confirm started");
try {
System.out.println(10/0);
}
catch(ArithmeticException s)
{
System.out.println("Exception caught at confirm in pvr");
throw s;
}
finally
{
System.out.println("confirm ended");
}
}
}
| [
"aishunarwade11@gmail.com"
] | aishunarwade11@gmail.com |
8a2f02ff64a17df58cd8109653087ff994ff145a | ad4a779ec6e031bf82d1b228a0ccf9c27453735c | /case_study/furama/src/main/java/furama/service/impl/RentTypeServiceImpl.java | ffab5ee099fbc9e173ac75ad52c9d2f4f057efa7 | [] | no_license | tuongvule/C0420G1-DuongNhatHuy-Module4 | add537c84324c0a658145ba646ad3e5f48816025 | 5e756ee16870712408fcf082bac360ccbf7532f5 | refs/heads/master | 2022-12-22T08:50:03.732347 | 2020-09-18T13:32:16 | 2020-09-18T13:32:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 521 | java | package furama.service.impl;
import furama.model.RentType;
import furama.repository.RentTypeRepository;
import furama.service.RentTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class RentTypeServiceImpl implements RentTypeService {
@Autowired
private RentTypeRepository rentTypeRepository;
@Override
public List<RentType> findAll() {
return rentTypeRepository.findAll();
}
}
| [
"nhathuy.155@gmail.com"
] | nhathuy.155@gmail.com |
3f0fa2238de3fef1d72380355b33b2199b1a6083 | 89ce13475ed5f71e5c392f3400c27b1e1f1cd8f6 | /src/main/java/com/finalproject/BankApplication/model/Address.java | eeeab404932f076d52599081b86a0ddded3f3cd6 | [] | no_license | cheuwami/BankApplication | ff5e546531995b50e4359579c69eae8ad615c50d | bddce0f76aa7cb4c42717b25067b765194d4df81 | refs/heads/main | 2023-03-05T21:58:25.867978 | 2021-02-21T11:45:53 | 2021-02-21T11:45:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 548 | java | package com.finalproject.BankApplication.model;
import lombok.Data;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.util.HashSet;
import java.util.Set;
@Entity
@Data
@Table
public class Address extends BaseEntity{
private String country;
private String city;
private String postcode;
private String street;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "address")
private Set<Client> clients = new HashSet<>();
}
| [
"leonardolorusso83@gmail.com"
] | leonardolorusso83@gmail.com |
3d5f965a6414cf91ed27e1ac679c683dde29b8ec | dbfbff013780644fa1f2b4748d4cffcbfb775d7d | /deep-in-design-pattern/category-3-behavioral-design-patterns/section-4-observer-pattern/src/main/java/com/jinm/observer/Observer.java | 692be359f98a9d3152871695fd17fdf809738506 | [] | no_license | jinminer/design-patterns | 6202508fa3a8df83b532bfbe070d6c1ad2f90440 | 936a9f1186d8c08a210aee4530cf3dc3b1769451 | refs/heads/master | 2022-12-23T23:17:56.341547 | 2021-04-08T16:42:53 | 2021-04-08T16:42:53 | 154,426,796 | 2 | 0 | null | 2022-12-16T03:35:16 | 2018-10-24T02:30:07 | Java | UTF-8 | Java | false | false | 217 | java | package com.jinm.observer;
public interface Observer {
//method to update the observer, used by subject
public void update();
//attach with subject to observe
public void setSubject(Subject sub);
}
| [
"keanemer@gmail.com"
] | keanemer@gmail.com |
a1beb3e9bcfaab04499754cc338af291f3b8c07b | 6d60a8adbfdc498a28f3e3fef70366581aa0c5fd | /codebase/default/deftrans/135212.java | 87c4e5482e3299cb077c7e61a168e3648731f4ea | [] | no_license | rayhan-ferdous/code2vec | 14268adaf9022d140a47a88129634398cd23cf8f | c8ca68a7a1053d0d09087b14d4c79a189ac0cf00 | refs/heads/master | 2022-03-09T08:40:18.035781 | 2022-02-27T23:57:44 | 2022-02-27T23:57:44 | 140,347,552 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,837 | java | import java . util . HashMap ;
import java . util . Map ;
import edu . ucdavis . genomics . metabolomics . binbase . cluster . ClusterUtil ;
import edu . ucdavis . genomics . metabolomics . binbase . cluster . ClusterUtilFactory ;
import edu . ucdavis . genomics . metabolomics . binbase . cluster . handler . AbstractClusterHandler ;
import edu . ucdavis . genomics . metabolomics . binbase . cluster . util . RocksClusterFactoryImpl ;
import edu . ucdavis . genomics . metabolomics . util . config . XMLConfigurator ;
import edu . ucdavis . genomics . metabolomics . util . status . ReportEvent ;
import edu . ucdavis . genomics . metabolomics . util . status . ReportType ;
public class YourOwnCalucation3 extends AbstractClusterHandler {
public boolean startProcessing ( ) throws Exception {
if ( getObject ( ) instanceof Long ) {
getReport ( ) . report ( getObject ( ) , new ReportEvent ( "start" , "" ) , new ReportType ( "calculate" , "" ) ) ;
long result = fib ( ( Long ) getObject ( ) ) ;
getReport ( ) . report ( getObject ( ) , new ReportEvent ( "finished" , "" ) , new ReportType ( "result" , "the result for you current calculation" , result ) ) ;
}
return true ;
}
public long fib ( long n ) {
if ( n <= 1 ) return n ; else return fib ( n - 1 ) + fib ( n - 2 ) ;
}
public static void main ( String [ ] args ) throws Exception {
XMLConfigurator . getInstance ( ) . getProperties ( ) ;
Map < String , String > properties = new HashMap < String , String > ( ) ;
properties . put ( "username" , args [ 1 ] ) ;
properties . put ( "password" , args [ 2 ] ) ;
properties . put ( "server" , args [ 0 ] ) ;
ClusterUtil util = ClusterUtilFactory . newInstance ( RocksClusterFactoryImpl . class . getName ( ) ) . createUtil ( properties ) ;
util . scheduleJob ( new Long ( 35 ) , YourOwnCalucation3 . class . getName ( ) ) ;
util . scheduleJob ( new Long ( 40 ) , YourOwnCalucation3 . class . getName ( ) ) ;
util . scheduleJob ( new Long ( 45 ) , YourOwnCalucation3 . class . getName ( ) ) ;
util . scheduleJob ( new Long ( 50 ) , YourOwnCalucation3 . class . getName ( ) ) ;
System . out . println ( util . startNode ( ) ) ;
System . out . println ( util . startNode ( ) ) ;
System . out . println ( util . startNode ( ) ) ;
System . out . println ( util . startNode ( ) ) ;
util . destroy ( ) ;
}
}
| [
"aaponcseku@gmail.com"
] | aaponcseku@gmail.com |
ff9ee28b52f89ccc4c904279511163287ef8116d | ccf6c7c25e0defe8a3936eb267785314ff68769c | /src/main/java/com/mage/crm/dao/PermissionDao.java | 783fe5a629060378dba78af3a9f87fc524f73dfc | [] | no_license | 18779918803/ceshicrm | 1d1f4a49638ad6a4df08bb55ea92203d78ab7ef7 | 79e4c649d979fa4b276f29ccd39ee6f8391b0194 | refs/heads/master | 2020-09-02T03:02:34.034845 | 2020-01-06T11:09:05 | 2020-01-06T11:09:05 | 219,119,048 | 1 | 0 | null | 2019-11-02T07:25:28 | 2019-11-02T07:23:45 | null | UTF-8 | Java | false | false | 906 | java | package com.mage.crm.dao;
import com.mage.crm.vo.Permission;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface PermissionDao {
@Select("SELECT count(1) from t_permission where role_id=#{rid}")
int queryPermissionCountByRid(Integer rid);
@Delete("delete from t_permission where role_id=#{rid}")
int deletePermissionByRid(Integer rid);
int insertBatch(List<Permission> permissions);
@Select("SELECT module_id from t_permission where role_id=#{rid}")
List<Integer> queryPermissionModuleIdsByRid(Integer rid);
@Select("select acl_value FROM t_user u"
+ " LEFT JOIN t_user_role ur ON u.id = ur.user_id"
+ " LEFT JOIN t_permission p ON ur.role_id = p.role_id"
+ " where u.id=#{uid} and u.is_valid=1")
List<String> queryPermissionByUserId(String uid);
}
| [
"814883929@qq.com"
] | 814883929@qq.com |
66297b915401516c5c21ce06e9ffe9aa8ba29b6b | 75ba039a91e8bfdf00af26761beca5989e7a00dd | /src/main/java/com/silab/vinicius/entity/task/TaskPriority.java | f9911437acbd6fb1c8bcb87262a73094712b095e | [] | no_license | viniagostini/SI_Lab3_backend | f27586ab128dff4e6e32c940286f5865fe646f8d | 398f2e78daade368786bafaaa71936e4c342ba70 | refs/heads/master | 2021-06-12T01:19:04.713429 | 2017-02-25T02:18:42 | 2017-02-25T02:18:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 142 | java | package com.silab.vinicius.entity.task;
/**
* Created by viniagostini on 23/01/2017.
*/
public enum TaskPriority {
LOW, MEDIUM, HIGH
}
| [
"fodas123"
] | fodas123 |
f1437411785908d54f87c2e667f13d2aa50f0cee | 5063e98fe42a0dc1bac13fc1e5bf990ebdc6b144 | /J3_PARCIAL/src/j3_parcial/Cliente.java | 6f3ebb20868d092cd2df257b5ec17f3ca91ca1de | [] | no_license | TOXQUI17/J3_parcial | ea76a60d015bbc760206c982bf27922c9a30d2ee | fe29f94b3ffb1baf14264a80151a1777882e3e5a | refs/heads/master | 2020-03-21T23:49:38.069688 | 2018-06-30T00:57:21 | 2018-06-30T00:57:21 | 139,208,221 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 482 | java | import org.springframework.data.annotation.Id;
public class Cliente {
@Id
private String id;
private String nombre;
private Tarjeta tarjeta;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public Cliente() {
}
} | [
"T204@PC048"
] | T204@PC048 |
83e08c5607ef876db185a19735f90eb979c5a7a1 | 69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e | /methods/Method_1002683.java | d85834b3362fd20b48cbd6ebdec7d63a3d2de1af | [] | no_license | P79N6A/icse_20_user_study | 5b9c42c6384502fdc9588430899f257761f1f506 | 8a3676bc96059ea2c4f6d209016f5088a5628f3c | refs/heads/master | 2020-06-24T08:25:22.606717 | 2019-07-25T15:31:16 | 2019-07-25T15:31:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 158 | java | @Override public final Set<AsciiString> names(){
final HttpHeadersBase getters=getters();
return getters != null ? getters.names() : ImmutableSet.of();
}
| [
"sonnguyen@utdallas.edu"
] | sonnguyen@utdallas.edu |
c925859f1bb0404a940559c2aa97d049a991e2f1 | d8d60e76791ea2bc7c154cd9eb974b73635d1061 | /app/src/main/java/theater/ReservationRepository.java | dc9745507fcdd497b4e4f83652ce1020a69c92e9 | [] | no_license | Jae-hyung-Lee/reqres_theater | a9bd667a1fb62c5d0c6dfd22a682551bed54948e | 2370d61465a94d0021100aa08707de1c7a668ed0 | refs/heads/main | 2023-05-06T14:39:08.622995 | 2021-05-25T05:37:54 | 2021-05-25T05:37:54 | 369,720,565 | 0 | 0 | null | 2021-05-22T05:10:23 | 2021-05-22T05:10:22 | null | UTF-8 | Java | false | false | 348 | java | package theater;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel="reservations", path="reservations")
public interface ReservationRepository extends PagingAndSortingRepository<Reservation, Long>{
}
| [
"skycows3@gmail.com"
] | skycows3@gmail.com |
f135dce2ce98c54644125c5b70e00b56cd954810 | d718b9a38c667ea1d2e3a676c86ef6f8b9d88dda | /Android/src/com/esteniek/treasurely_android/TreasuresFoundFragment.java | 7b72ed6055e037ec20406692233c9d89c9eba37b | [] | no_license | niekw91/Treasurely-Mobile | a92b24b38be211f74e75f3fae3fb5ad74a1de4d4 | 67053a68a68f46a12e272e0a5e0d78ddcc28192d | refs/heads/master | 2021-01-18T02:23:12.251053 | 2014-04-08T14:20:39 | 2014-04-08T14:20:39 | 18,309,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,389 | java | package com.esteniek.treasurely_android;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONObject;
import android.app.Activity;
import android.app.Fragment;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;
import com.esteniek.treasurely_android.services.LocationService;
import com.esteniek.treasurely_android.services.RESTService;
/**
* A fragment representing a list of Items.
* <p />
* Large screen devices (such as tablets) are supported by replacing the
* ListView with a GridView.
* <p />
* Activities containing this fragment MUST implement the {@link Callbacks}
* interface.
*/
public class TreasuresFoundFragment extends Fragment {
private ArrayList<Treasure> treasures;
private OnItemSelectedListener listener;
private LocationService location;
private RESTService rest;
private TreasureAdapter adapter;
public interface OnItemSelectedListener {
public void onItemSelected(Treasure treasure);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
treasures = new ArrayList<Treasure>();
// Start location service
location = new LocationService(getActivity());
// Start rest service
rest = new RESTService(getActivity());
// Search for treasure
findTreasure();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater
.inflate(R.layout.fragment_treasuresfoundfragment_list,
container, false);
final ListView listView = (ListView) view
.findViewById(R.id.treasure_list);
setListViewAdapter(listView);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int position, long arg3) {
Treasure treasure = (Treasure) arg0.getItemAtPosition(position);
listener.onItemSelected(treasure);
}
});
return view;
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (activity instanceof OnItemSelectedListener) {
listener = (OnItemSelectedListener) activity;
} else {
throw new ClassCastException(
activity.toString()
+ " must implement TreasuresFoundFragment.OnItemSelectedListener");
}
}
@Override
public void onDetach() {
super.onDetach();
listener = null;
}
private void setListViewAdapter(ListView listView) {
if (treasures != null) {
adapter = new TreasureAdapter(this.getActivity(),
R.layout.treasure_found_item, treasures);
listView.setAdapter(adapter);
}
}
private void findTreasure() {
String url = getResources().getString(R.string.baseUrl) + "/treasures/"
+ location.getLatitude() + "/" + location.getLongitude();
String testurl = "http://treasurely.no-ip.org:7000/treasures/37.334476/-122.039740";
//System.out.println("findTreasure url: " + url);
new FindTreasureTask().execute(testurl);
}
/**
* Find treasures
*
* @author st
*
*/
private class FindTreasureTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
return rest.findTreasures(params[0]);
}
// onPostExecute displays the results of the AsyncTask.
@Override
protected void onPostExecute(String result) {
Toast.makeText(getActivity(), "Received!", Toast.LENGTH_LONG)
.show();
System.out.println(result);
try {
setResult(result);
} catch (Exception e) {
e.printStackTrace();
}
if (!treasures.isEmpty()) {
adapter.notifyDataSetChanged();
}
}
}
private void setResult(String result) throws Exception {
String title = "";
String text = "";
String media = "";
JSONArray array = new JSONArray(result);
System.out.println(array.length());
for (int i = 0; i < array.length(); i++) {
JSONObject row = array.getJSONObject(i);
title = row.getString("title");
text = row.getString("text");
media = row.getString("media");
if(media != null) {
treasures.add(new Treasure(title, text, media));
} else {
treasures.add(new Treasure(title, text));
}
}
}
}
| [
"etigele@gmail.com"
] | etigele@gmail.com |
b53068b1465ec35267b48d3c4cf0ac339e0b4660 | b6c4471648c760b70b39e8d7d2e3dbbd1927ddd1 | /src/main/java/com/kakaopay/sprinkle/repository/MoneySprinkleRepository.java | 16d53d18a504c5be7377316eab1c99da2313cea3 | [] | no_license | dkwkehgud77/kakaopay | 51616e8fc48bd1ae56284086e3d73d1b331e7eb2 | 7edfa4291fcc3c973495152740973fd5f142f56f | refs/heads/main | 2023-02-17T13:05:45.553203 | 2021-01-19T00:27:27 | 2021-01-19T00:27:27 | 330,756,394 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 585 | java | package com.kakaopay.sprinkle.repository;
import com.kakaopay.sprinkle.model.entity.MoneySprinkle;
import com.kakaopay.sprinkle.model.entity.RoomUser;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface MoneySprinkleRepository extends JpaRepository<MoneySprinkle,Long> {
Optional<MoneySprinkle> findByTokenAndSprinkleUserId(String token,String sprinkleUserId);
Optional<MoneySprinkle> findByTokenAndSprinkleUserIdStartsWith(String token,String roomId);
}
| [
"konan@konantech.com"
] | konan@konantech.com |
879fef9f6763d5a00647026fb7bcefa27d483543 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/13/13_e3e4060b371434aa23719364c6343e9108fa7c31/BuildDomain/13_e3e4060b371434aa23719364c6343e9108fa7c31_BuildDomain_s.java | c5a8fa1158d7e7890b1309c8c82eff4a79d3b8b6 | [] | 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 | 3,791 | java | /**
* Copyright (c) 2013 TerraFrame, Inc. All rights reserved.
*
* This file is part of Runway SDK(tm).
*
* Runway SDK(tm) 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 3 of the
* License, or (at your option) any later version.
*
* Runway SDK(tm) is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Runway SDK(tm). If not, see <http://www.gnu.org/licenses/>.
*/
package com.runwaysdk.jstest;
import groovy.lang.GroovyShell;
import groovy.lang.Script;
import com.runwaysdk.business.ontology.MdTermDAO;
import com.runwaysdk.business.ontology.MdTermRelationshipDAO;
import com.runwaysdk.business.ontology.OntologyStrategyIF;
import com.runwaysdk.constants.AssociationType;
import com.runwaysdk.constants.EntityCacheMaster;
import com.runwaysdk.constants.MdAttributeBooleanInfo;
import com.runwaysdk.constants.MdAttributeLocalInfo;
import com.runwaysdk.constants.MdClassInfo;
import com.runwaysdk.constants.MdTermInfo;
import com.runwaysdk.constants.MdTermRelationshipInfo;
import com.runwaysdk.constants.MdTreeInfo;
import com.runwaysdk.generation.loader.LoaderDecorator;
import com.runwaysdk.session.Request;
import com.runwaysdk.util.DateUtilities;
public class BuildDomain
{
public static final String PACKAGE = "com.runwaysdk.jstest.business.ontology";
@Request
public static void main(String[] args)
{
// String s = "2005-07-15T08:59:14";
// String s = "2008-01-25T19:36:44Z";
// DateUtilities.parseDate(s);
MdTermDAO mdTerm = MdTermDAO.newInstance();
mdTerm.setValue(MdTermInfo.NAME, "Alphabet");
mdTerm.setValue(MdTermInfo.PACKAGE, PACKAGE);
mdTerm.setStructValue(MdTermInfo.DISPLAY_LABEL, MdAttributeLocalInfo.DEFAULT_LOCALE, "JS Test Class");
mdTerm.setStructValue(MdTermInfo.DESCRIPTION, MdAttributeLocalInfo.DEFAULT_LOCALE, "Temporary JS Test Class");
mdTerm.setValue(MdTermInfo.EXTENDABLE, MdAttributeBooleanInfo.TRUE);
mdTerm.setValue(MdTermInfo.ABSTRACT, MdAttributeBooleanInfo.FALSE);
mdTerm.setValue(MdTermInfo.CACHE_ALGORITHM, EntityCacheMaster.CACHE_NOTHING.getId());
mdTerm.apply();
MdTermRelationshipDAO mdTermRelationship = MdTermRelationshipDAO.newInstance();
mdTermRelationship.setValue(MdTreeInfo.NAME, "Sequential");
mdTermRelationship.setValue(MdTreeInfo.PACKAGE, PACKAGE);
mdTermRelationship.setStructValue(MdTreeInfo.DISPLAY_LABEL, MdAttributeLocalInfo.DEFAULT_LOCALE, "Sequential Relationship");
mdTermRelationship.setValue(MdTreeInfo.PARENT_MD_BUSINESS, mdTerm.getId());
mdTermRelationship.setValue(MdTreeInfo.PARENT_CARDINALITY, "*");
mdTermRelationship.setStructValue(MdTreeInfo.PARENT_DISPLAY_LABEL, MdAttributeLocalInfo.DEFAULT_LOCALE, "Previous Letter");
mdTermRelationship.setValue(MdTreeInfo.CHILD_MD_BUSINESS, mdTerm.getId());
mdTermRelationship.setValue(MdTreeInfo.CHILD_CARDINALITY, "*");
mdTermRelationship.setStructValue(MdTreeInfo.CHILD_DISPLAY_LABEL, MdAttributeLocalInfo.DEFAULT_LOCALE, "Next Letter");
mdTermRelationship.setValue(MdTreeInfo.PARENT_METHOD, "ParentTerm");
mdTermRelationship.setValue(MdTreeInfo.CHILD_METHOD, "ChildTerm");
mdTermRelationship.setGenerateMdController(false);
mdTermRelationship.addItem(MdTermRelationshipInfo.ASSOCIATION_TYPE, AssociationType.RELATIONSHIP.getId());
mdTermRelationship.apply();
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
a6657f528735d14ea304dbd525105daf38d4bd63 | a7b741bf60d8a1e8b5f5b386544ceb9d116293af | /Proyecto Android/HotMetal/app/src/main/java/com/example/hotmetal/ui/Citas/CitasReservarViewModel.java | feacd50c8bc1844664f0c50fc80ad2429cc406b9 | [] | no_license | dragon-hash/Proyecto-IHC | bb2f3f5280a6b79a567c5b184839dd130be55dc8 | bd08d0fabed22f980474f8bfc0c66733fff268de | refs/heads/master | 2023-08-09T15:06:12.490582 | 2019-12-06T17:48:33 | 2019-12-06T17:48:33 | 226,380,428 | 0 | 0 | null | 2023-07-22T23:40:14 | 2019-12-06T17:43:51 | CSS | UTF-8 | Java | false | false | 180 | java | package com.example.hotmetal.ui.Citas;
import androidx.lifecycle.ViewModel;
public class CitasReservarViewModel extends ViewModel {
// TODO: Implement the ViewModel
}
| [
"forcedragon558@gmail.com"
] | forcedragon558@gmail.com |
ee11da34f28065ee182d4a07d571e0cb7f009fbf | 1de2391b03f183fef5393645e8b91704e9895ede | /app/build/generated/source/apt/debug/com/canplay/milk/mvp/activity/account/EditorPwsActivity_ViewBinding.java | 621e78b6748881391c1c245ce11751287cab6ac8 | [] | no_license | Meikostar/Milk_Machiness | ff0e49d02fddc7dc17970424fced147a79081cc5 | c9bc711726b91d8545394da40c2358ea43aa20af | refs/heads/master | 2020-03-20T05:07:19.559246 | 2018-06-13T11:19:58 | 2018-06-13T11:19:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,774 | java | // Generated code from Butter Knife. Do not modify!
package com.canplay.milk.mvp.activity.account;
import android.support.annotation.CallSuper;
import android.support.annotation.UiThread;
import android.view.View;
import android.widget.TextView;
import butterknife.Unbinder;
import butterknife.internal.Utils;
import com.canplay.medical.R;
import com.canplay.milk.view.ClearEditText;
import com.canplay.milk.view.NavigationBar;
import java.lang.IllegalStateException;
import java.lang.Override;
public class EditorPwsActivity_ViewBinding implements Unbinder {
private EditorPwsActivity target;
@UiThread
public EditorPwsActivity_ViewBinding(EditorPwsActivity target) {
this(target, target.getWindow().getDecorView());
}
@UiThread
public EditorPwsActivity_ViewBinding(EditorPwsActivity target, View source) {
this.target = target;
target.navigationbar = Utils.findRequiredViewAsType(source, R.id.navigationbar, "field 'navigationbar'", NavigationBar.class);
target.etPws = Utils.findRequiredViewAsType(source, R.id.et_pws, "field 'etPws'", ClearEditText.class);
target.etPws1 = Utils.findRequiredViewAsType(source, R.id.et_pws1, "field 'etPws1'", ClearEditText.class);
target.etPws2 = Utils.findRequiredViewAsType(source, R.id.et_pws2, "field 'etPws2'", ClearEditText.class);
target.tvSure = Utils.findRequiredViewAsType(source, R.id.tv_sure, "field 'tvSure'", TextView.class);
}
@Override
@CallSuper
public void unbind() {
EditorPwsActivity target = this.target;
if (target == null) throw new IllegalStateException("Bindings already cleared.");
this.target = null;
target.navigationbar = null;
target.etPws = null;
target.etPws1 = null;
target.etPws2 = null;
target.tvSure = null;
}
}
| [
"admin"
] | admin |
34b4a4f377fea3d154d98bdd81e1df72cfa843f9 | 84b08410296a3985370cdd9fad56f869e05c0c77 | /app/src/main/java/prototype/vn/autoparser/BackendModels/ParseUrls.java | 296e08ef71413869e63ba3782809134e476f3017 | [] | no_license | narkusv/autoparserAndroid | 6810b263a72d86ba7f82edeec83ef9991c77876e | ad9d36d6b1f04ec3470f6521142966a2b6449828 | refs/heads/master | 2021-01-13T07:08:04.305511 | 2017-06-21T19:28:13 | 2017-06-21T19:28:13 | 95,038,572 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package prototype.vn.autoparser.BackendModels;
/**
* Created by narku on 2017-06-21.
*/
public class ParseUrls {
public int id;
public String url;
public pivot pivot;
public class pivot {
public int user_id;
public int parse_url_id;
public String name;
}
}
| [
"narkus.v@gmail.com"
] | narkus.v@gmail.com |
e09ee9142c3a5200ddd278abce0f3241a893567a | e1757e44a77dab17206ad38d33d20f5da1aa6b3f | /3-Week04-a3-GDPR/week4-a3-GDPR-Assignments/src/main/java/dk/cphbusiness/security/encryption/Exercise3CryptoEdit.java | 4c0379dc3af56be3a0e6df940e8835675be7b44d | [] | no_license | marshmallouws/Security | 9e218fb3e715cc2f687d93f2c4851934538571fe | b66163c289f5254c61b686c0c7ebf18422434874 | refs/heads/master | 2022-12-14T09:29:32.442339 | 2020-06-24T12:02:58 | 2020-06-24T12:02:58 | 242,768,237 | 0 | 0 | null | 2022-09-01T23:29:04 | 2020-02-24T15:13:53 | Java | UTF-8 | Java | false | false | 8,679 | java | package dk.cphbusiness.security.encryption;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.SecureRandom;
import java.util.Base64;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/*
* 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.
*/
/**
*
* @author kasper
*/
public class Exercise3CryptoEdit extends javax.swing.JFrame {
private static final String PATH = "\\Users\\Annika\\Desktop\\Sem4\\coding_projects\\security\\code_assignments\\Week04-a3-GDPR\\cryptofile.foo";
private String base64Iv;
public Exercise3CryptoEdit() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
pwField = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
editText = new javax.swing.JTextArea();
load = new javax.swing.JButton();
save = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("Amazing Crypto editor. Enter password:");
pwField.setText("super secret");
editText.setColumns(20);
editText.setRows(5);
jScrollPane1.setViewportView(editText);
load.setText("Load");
load.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
loadActionPerformed(evt);
}
});
save.setText("Save");
save.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(pwField, javax.swing.GroupLayout.PREFERRED_SIZE, 246, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 258, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(load)
.addComponent(save))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(pwField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(16, 16, 16))
.addGroup(layout.createSequentialGroup()
.addComponent(load)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(save)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 218, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void loadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadActionPerformed
// Decryption
try {
byte[] text = Files.readAllBytes(Paths.get(PATH));
String[] t = new String(text).split(":");
byte[] iv = Base64.getDecoder().decode(t[0].getBytes()); // iv is not secret
byte[] cipher = Base64.getDecoder().decode(t[1].getBytes());
byte[] keyBytes = String2Key.string2KeyArray(pwField.getText());
String plainText = new String(AESGoodImplementation.decrypt(keyBytes, iv, cipher));
editText.setText(plainText);
} catch (IOException | InvalidKeyException | InvalidAlgorithmParameterException e) {
// Do something
}
}//GEN-LAST:event_loadActionPerformed
private void saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveActionPerformed
try {
//Use non-blocking SecureRandom implementation for the new IV.
final SecureRandom secureRandom = new SecureRandom();
byte[] ivBytes = new byte[16];
//Generate a new IV.
secureRandom.nextBytes(ivBytes);
byte[] keyBytes = String2Key.string2KeyArray(pwField.getText());
byte[] plainText = editText.getText().getBytes();
String newStoredCipher = Base64.getEncoder().encodeToString(ivBytes)
+ ":" + Base64.getEncoder().encodeToString(AESGoodImplementation.encrypt(keyBytes, ivBytes, plainText));
Files.write(Paths.get(PATH), newStoredCipher.getBytes());
} catch (IOException | InvalidKeyException | InvalidAlgorithmParameterException ex) {
JOptionPane.showMessageDialog(null, "Shit happened: " + ex.getLocalizedMessage());
}
}//GEN-LAST:event_saveActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Exercise3CryptoEdit.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Exercise3CryptoEdit.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Exercise3CryptoEdit.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Exercise3CryptoEdit.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Exercise3CryptoEdit().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextArea editText;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JButton load;
private javax.swing.JTextField pwField;
private javax.swing.JButton save;
// End of variables declaration//GEN-END:variables
}
| [
"e_hlers@live.dk"
] | e_hlers@live.dk |
a4c4087f020cdd2cb4ff5f92b64f6f261613efcf | f8257451f49b547af688e63c587daf5023b98e4b | /src/main/java/com/cloudmersive/client/model/RemoveDocxHeadersAndFootersResponse.java | 111c11c5c369154c6d84ef12c8f3ec430874d6cc | [] | no_license | Anguchamy/Cloudmersive.APIClient.Java | c4a382c58014666110b1617f57caaf427be4b5ab | 97621c033c3cf873e946c2eb713ecf5b0cb5c35f | refs/heads/master | 2021-05-19T08:57:41.672348 | 2020-03-30T05:37:17 | 2020-03-30T05:37:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,831 | java | /*
* convertapi
* Convert API lets you effortlessly convert file formats and types.
*
* OpenAPI spec version: v1
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.cloudmersive.client.model;
import java.util.Objects;
import java.util.Arrays;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
/**
* Result of running a Remove Headers and Footers command
*/
@ApiModel(description = "Result of running a Remove Headers and Footers command")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2020-03-29T22:36:28.924-07:00")
public class RemoveDocxHeadersAndFootersResponse {
@SerializedName("Successful")
private Boolean successful = null;
@SerializedName("EditedDocumentURL")
private String editedDocumentURL = null;
public RemoveDocxHeadersAndFootersResponse successful(Boolean successful) {
this.successful = successful;
return this;
}
/**
* True if successful, false otherwise
* @return successful
**/
@ApiModelProperty(value = "True if successful, false otherwise")
public Boolean isSuccessful() {
return successful;
}
public void setSuccessful(Boolean successful) {
this.successful = successful;
}
public RemoveDocxHeadersAndFootersResponse editedDocumentURL(String editedDocumentURL) {
this.editedDocumentURL = editedDocumentURL;
return this;
}
/**
* URL of the resulting edited document; this is a secure URL and cannot be downloaded without adding the Apikey header; it is also temporary, stored in an in-memory cache and will be deleted. Call Finish-Editing to get the result document contents.
* @return editedDocumentURL
**/
@ApiModelProperty(value = "URL of the resulting edited document; this is a secure URL and cannot be downloaded without adding the Apikey header; it is also temporary, stored in an in-memory cache and will be deleted. Call Finish-Editing to get the result document contents.")
public String getEditedDocumentURL() {
return editedDocumentURL;
}
public void setEditedDocumentURL(String editedDocumentURL) {
this.editedDocumentURL = editedDocumentURL;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
RemoveDocxHeadersAndFootersResponse removeDocxHeadersAndFootersResponse = (RemoveDocxHeadersAndFootersResponse) o;
return Objects.equals(this.successful, removeDocxHeadersAndFootersResponse.successful) &&
Objects.equals(this.editedDocumentURL, removeDocxHeadersAndFootersResponse.editedDocumentURL);
}
@Override
public int hashCode() {
return Objects.hash(successful, editedDocumentURL);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class RemoveDocxHeadersAndFootersResponse {\n");
sb.append(" successful: ").append(toIndentedString(successful)).append("\n");
sb.append(" editedDocumentURL: ").append(toIndentedString(editedDocumentURL)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"35204726+Cloudmersive@users.noreply.github.com"
] | 35204726+Cloudmersive@users.noreply.github.com |
af6eb0d23ff09318440408597fef0f24084408ae | 152eaceed8550cca4556acd484b2f56a0ba9f12f | /DovizveAltinKurlari/app/src/main/java/seo/com/dovizvealtinkurlari/JSONRead.java | 9b7633d55944b7113eaa49c2acc5242091c7c696 | [] | no_license | edpsahn/DovizveAltinKurlari | a9e1a59f0804136e9a355bfe4090702f2880a800 | 64c808891a485f7dd1e4bff33ae5f46c6f33303d | refs/heads/master | 2021-05-02T12:20:15.246413 | 2021-02-13T11:47:08 | 2021-02-13T11:47:08 | 120,735,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,262 | java | package seo.com.dovizvealtinkurlari;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
/**
* Created by jubat on 6.8.2017.
*/
public class JSONRead {
public ArrayList<Data> SerbestDataList =new ArrayList<Data>();
public ArrayList<Data> AltinDataList =new ArrayList<Data>();
Images images = new Images();
public void SerbestDataRead(String urlText) {
try {
HttpHandler sh = new HttpHandler();
String jsonStr = sh.makeServiceCall(urlText);
if(jsonStr != null && !jsonStr.isEmpty()){
jsonStr = jsonStr.replace("[","").replace("]","");
jsonStr = jsonStr.replace("},","}~~");
String[] stringList = jsonStr.split("~~");
for(int i = 0; i < stringList.length; i++ ){
JSONObject jsonObj = new JSONObject(stringList[i]);
Data data = new Data();
data.Bayrak=images.serbest[i];
data.Para=jsonObj.getString("full_name");
data.Satis=jsonObj.getString("selling");
data.Alis=jsonObj.getString("buying");
double x=jsonObj.getDouble("change_rate");
if (x < 0){
data.Oran=R.drawable.down;
}
else if(x>0){
data.Oran=R.drawable.up;
}
else{
data.Oran=R.drawable.xxx;
}
SerbestDataList.add(data);
}
}
}
catch (final JSONException e) {
e.printStackTrace();
}
}
public ArrayList<Data> SerbestGetData(){
return SerbestDataList;
}
public void AltinDataRead(String urlText) {
try {
HttpHandler sh = new HttpHandler();
String jsonStr = sh.makeServiceCall(urlText);
if(jsonStr != null && !jsonStr.isEmpty()){
jsonStr = jsonStr.replace("[","").replace("]","");
jsonStr = jsonStr.replace("},","}~~");
String[] stringList = jsonStr.split("~~");
for(int i = 0; i < stringList.length; i++ ){
JSONObject jsonObj = new JSONObject(stringList[i]);
Data data = new Data();
data.Bayrak=R.drawable.altin;
data.Para=jsonObj.getString("full_name");
data.Satis=jsonObj.getString("selling");
data.Alis=jsonObj.getString("buying");
double x=jsonObj.getDouble("change_rate");
if (x < 0){
data.Oran=R.drawable.down;
}
else if(x>0){
data.Oran=R.drawable.up;
}
else{
data.Oran=R.drawable.xxx;
}
AltinDataList.add(data);
}
}
}
catch (final JSONException e) {
e.printStackTrace();
}
}
public ArrayList<Data> AltinGetData(){
return AltinDataList;
}
}
| [
"edpsahn@gmail.com"
] | edpsahn@gmail.com |
58bcd48f557e37c152a2ce57d249508b7169a99d | 95d20c83d8aff34e314c56a3ecb2b87c9fa9fc86 | /Ghidra/Features/Base/ghidra_scripts/AsciiToBinaryScript.java | b9e313a4469cbba9895a40a341a8fe4e901feb58 | [
"GPL-1.0-or-later",
"GPL-3.0-only",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"LGPL-2.1-only",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | NationalSecurityAgency/ghidra | 969fe0d2ca25cb8ac72f66f0f90fc7fb2dbfa68d | 7cc135eb6bfabd166cbc23f7951dae09a7e03c39 | refs/heads/master | 2023-08-31T21:20:23.376055 | 2023-08-29T23:08:54 | 2023-08-29T23:08:54 | 173,228,436 | 45,212 | 6,204 | Apache-2.0 | 2023-09-14T18:00:39 | 2019-03-01T03:27:48 | Java | UTF-8 | Java | false | false | 2,239 | java | /* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//Converts an ascii hex file into binary file. Works for files with spaces and without. Assumes hex bytes are zero padded so all values are two bytes long.
//@category Conversion
import ghidra.app.script.GhidraScript;
import java.io.*;
public class AsciiToBinaryScript extends GhidraScript {
private static final String EMPTY_STRING = "";
private static final String SPACE = " ";
@Override
public void run() throws Exception {
File inAsciiFile = askFile("Select Ascii File", "Ascii File");
if (!inAsciiFile.exists()) {
popup(inAsciiFile.getAbsolutePath() + " does not exist.");
return;
}
File outBinaryFile = askFile("Select Binary File", "Binary File");
if (outBinaryFile.equals(inAsciiFile)) {
popup("Input file and output file are the same. Please choose a different file for the output." +
inAsciiFile.getAbsolutePath());
return;
}
if (outBinaryFile.exists()) {
if (!askYesNo("Binary File Already Exists",
"The binary file already exists.\nDo you want to overwrite it?")) {
return;
}
}
BufferedReader in = new BufferedReader(new FileReader(inAsciiFile));
OutputStream out = new FileOutputStream(outBinaryFile);
while (true) {
if (monitor.isCancelled()) {
break;
}
String line = in.readLine();
if (line == null) {
break;
}
line = line.replace(SPACE, EMPTY_STRING);
int length = line.length();
for (int i = 0; i < length; i += 2) {
if (monitor.isCancelled()) {
break;
}
String asciiByte = line.substring(i, i + 2);
int value = Integer.parseInt(asciiByte, 16);
out.write(value);
}
}
in.close();
out.close();
}
}
| [
"46821332+nsadeveloper789@users.noreply.github.com"
] | 46821332+nsadeveloper789@users.noreply.github.com |
e3cd6cf2ca3b8686ece7c01d38af5f30d5c164bf | 8ccf7e4efe6ccdf7b89352269bef9d61e5c978ac | /src/main/java/pl/gpost/example/TGWExample1.java | 570972e37306d8a8966fa01bbb97116cb2015fbb | [] | no_license | yichuanDavid/tgw | ebca955925323774d4e924bdf9a1914a90cc77b5 | 124de57d9df1e4f375424bb096af160bd676cefc | refs/heads/master | 2020-08-26T22:39:25.016217 | 2015-04-07T22:21:33 | 2015-04-07T22:21:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,372 | java | package pl.gpost.example;
import pl.gpost.TurtleGraphicsWindow;
class TGWExample1 extends TurtleGraphicsWindow {
public TGWExample1() {
super(600, 600);
}
void box(int side) {
for (int i = 4; i > 0; i--) {
forward(side);
right(90);
}
}
void drawSomething() {
setpensize(1);
home();
setheading(NORTH);
for (int count = 30; count > 0; count--) {
box(180);
right(360 / 30);
}
penup();
home();
setheading(NORTH);
right(360 / 120);
for (int colorNumber = 1; colorNumber < 32; colorNumber++) {
if (colorNumber == WHITE)
continue;
forward(90);
setpencolor(colorNumber);
fill();
home();
right(360 / 30);
}
home();
setheading(NORTH);
right(360 / 40);
for (int colorNumber = 31; colorNumber > 0; colorNumber--) {
if (colorNumber == WHITE)
continue;
forward(90);
setpencolor(colorNumber);
fill();
home();
right(360 / 30);
}
}
public static void main(String[] args) {
TGWExample1 me = new TGWExample1();
me.hideturtle();
me.drawSomething();
}
}
| [
"gonciarz@gmail.com"
] | gonciarz@gmail.com |
5f47fcd38220b1f34558b9047608d09958998b43 | 8fdd2c8d659ab2183f012222c05ac9d1b99583a4 | /app/src/main/java/com/intkhabahmed/popularmoviesstage1/model/Movie.java | 51ba717f006d6298bac4c39cdfe7c07002dd5834 | [] | no_license | intkhabahmed/Popular-Movies-Stage-1 | 67ab4c5150ab72aefab87908127aa3b9934f17da | bc85155de52a709dd90ad281d2b7584852f97233 | refs/heads/master | 2020-03-19T04:14:02.075896 | 2018-06-10T09:10:01 | 2018-06-10T09:10:01 | 135,808,241 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,996 | java | package com.intkhabahmed.popularmoviesstage1.model;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.Date;
public class Movie implements Serializable{
@SerializedName("original_title")
private String originalTitle;
@SerializedName("release_date")
private Date releaseDate;
@SerializedName("poster_path")
private String posterUrl;
@SerializedName("vote_average")
private float voteAverage;
@SerializedName("overview")
private String overview;
@SerializedName("backdrop_path")
private String backdropPath;
public Movie(String originalTitle, Date releaseDate, String posterUrl, float voteAverage, String overview, String backdropPath) {
this.originalTitle = originalTitle;
this.releaseDate = releaseDate;
this.posterUrl = posterUrl;
this.voteAverage = voteAverage;
this.overview = overview;
this.backdropPath = backdropPath;
}
public String getOriginalTitle() {
return originalTitle;
}
public void setOriginalTitle(String originalTitle) {
this.originalTitle = originalTitle;
}
public Date getReleaseDate() {
return releaseDate;
}
public void setReleaseDate(Date releaseDate) {
this.releaseDate = releaseDate;
}
public String getPosterUrl() {
return posterUrl;
}
public void setPosterUrl(String posterUrl) {
this.posterUrl = posterUrl;
}
public float getVoteAverage() {
return voteAverage;
}
public void setVoteAverage(float voteAverage) {
this.voteAverage = voteAverage;
}
public String getOverview() {
return overview;
}
public void setOverview(String overview) {
this.overview = overview;
}
public String getBackdropPath() {
return backdropPath;
}
public void setBackdropPath(String backdropPath) {
this.backdropPath = backdropPath;
}
}
| [
"intkhab.ahmed64@gmail.com"
] | intkhab.ahmed64@gmail.com |
4b8698215aae0f3966a155abf2a66a3dbb2b65af | 43b4a57373ae857bbd66e4ed3175bc6a54c7a923 | /SpringMVC/src/main/java/com/springlesson/service/CommentsService.java | 830202df8985818b91155f41d8c3479a6476e0aa | [] | no_license | JIN-0616/shopProject | ea472b787071167b12ce0ebf8bd1d392140af288 | f879c46336acde0d660dc1540880cc99343d1aba | refs/heads/master | 2020-04-23T20:17:40.786098 | 2019-02-19T08:33:09 | 2019-02-19T08:33:09 | 171,434,895 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 466 | java | package com.springlesson.service;
import java.util.List;
import java.util.Map;
import com.springlesson.domain.Comments;
public interface CommentsService {
public List<Comments> readCommentList(Map map) throws Exception;
public int addComments(Comments comments) throws Exception;
public void removeComments(int num) throws Exception;
public void removeAllComments(int board_num) throws Exception;
public int readCount(int board_num) throws Exception;
}//end
| [
"jungjin0616@gmail.com"
] | jungjin0616@gmail.com |
bf84d5568a7fe511b3786192b66b5bc7be4ae00b | 372231097ca9e6e5c99bcf2485ccd521e1ec61ee | /Client/znzpApp/src/com/myapp/activity/QyInfoActivity.java | 74a23a705678cbd51fcebccafd611cb36c31874e | [] | no_license | Xiiaofan/Find-Your-Job | b076220c808568e7c262fd49cb4bba1cf1f4a0ed | 0fabb1ee6d629deb17cef12a9f8b28b8002bdf5e | refs/heads/master | 2022-11-06T06:51:00.918408 | 2020-06-19T12:43:36 | 2020-06-19T13:03:39 | 273,183,447 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,188 | java | package com.myapp.activity;
import java.util.HashMap;
import java.util.Map;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.alibaba.fastjson.JSONObject;
import com.myapp.common.HttpUtil;
import com.myweb.domain.User;
public class QyInfoActivity extends ActionBarActivity {
MyApplication myApp;
TextView loginnameTxt;
EditText usernameTxt;
EditText passwordTxt;
EditText emailtxt;
EditText reg_teltxt;
Button regBtn;
Map<String, Object> userMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_qyinfo);
loginnameTxt = (TextView) findViewById(R.id.reg_loginnametxt);
passwordTxt = (EditText) findViewById(R.id.reg_passwordtxt);
emailtxt = (EditText) findViewById(R.id.reg_emailtxt);
reg_teltxt = (EditText) findViewById(R.id.reg_teltxt);
usernameTxt = (EditText) findViewById(R.id.usernameTxt);
regBtn = (Button) findViewById(R.id.reg_regbtn);
regBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Thread saveThread = new Thread(new SaveThread());
saveThread.start();
}
});
Thread userThread = new Thread(new UserInfoThread());
userThread.start();
myApp = (MyApplication) getApplication(); // get MyApp
}
class UserInfoThread implements Runnable {
public void run() {
try {
JSONObject paraObj = new JSONObject();
paraObj.put("userid", String.valueOf(myApp.getUser().getId()));
paraObj.put("action", "init");
String result = HttpUtil.getJsonFromServlet(paraObj.toString(),
"UserService");
if (!result.equals("")) {
User user = JSONObject.parseObject(result, User.class);
Map<String, Object> userMap1 = new HashMap<String, Object>();
userMap1.put("loginname", user.getLoginname());
userMap1.put("password", user.getLoginpsw());
userMap1.put("username", user.getUsername());
userMap1.put("email", user.getEmail());
userMap1.put("telphone", user.getTel());
Message msg = new Message();
msg.what = 4;// success
msg.obj = userMap1;
handler.sendMessage(msg);
}
} catch (Exception ex) {
System.out.println("ex: " + ex.getMessage());
Message msg = new Message();
msg.what = 0;// error
handler.sendMessage(msg);
}
}
}
class SaveThread implements Runnable {
public void run() {
try {
String loginpsw = ((EditText) findViewById(R.id.reg_passwordtxt))
.getText().toString();
String emailtxt = ((EditText) findViewById(R.id.reg_emailtxt))
.getText().toString();
String teltxt = ((EditText) findViewById(R.id.reg_teltxt))
.getText().toString();
String username = ((EditText) findViewById(R.id.usernameTxt))
.getText().toString();
User user = myApp.getUser();
user.setLoginpsw(loginpsw);
user.setTel(teltxt);
user.setEmail(emailtxt);
user.setUsername(username);
JSONObject paraObj = new JSONObject();
paraObj.put("action", "update");
paraObj.put("user", JSONObject.toJSONString(user));
String result = HttpUtil.getJsonFromServlet(paraObj.toString(),
"UserService");
if (result.equals("ok")) {
Message msg = new Message();
msg.what = 1;// success
handler.sendMessage(msg);
}
} catch (Exception ex) {
System.out.println("ex: " + ex.getMessage());
Message msg = new Message();
msg.what = 2;// error
handler.sendMessage(msg);
}
}
}
// Handler
Handler handler = new Handler() {
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 1:
Toast.makeText(getApplicationContext(), "success!",
Toast.LENGTH_SHORT).show();
break;
case 2:
Toast.makeText(getApplicationContext(), "failed, please check the network!",
Toast.LENGTH_SHORT).show();
break;
case 4:
try {
userMap = (Map<String, Object>) msg.obj;
loginnameTxt.setText(userMap.get("loginname").toString());
passwordTxt.setText(userMap.get("password").toString());
emailtxt.setText(userMap.get("email").toString());
usernameTxt.setText(userMap.get("username").toString());
reg_teltxt.setText(userMap.get("telphone").toString());
} catch (Exception ex) {
System.out.print(ex.getMessage());
}
}
}
};
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
// getMenuInflater().inflate(R.menu.add_question, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
return super.onOptionsItemSelected(item);
}
}
| [
"liuxiiaofan@gmail.com"
] | liuxiiaofan@gmail.com |
3a017e175d300b1b77ce12d723dc47c624ac48b1 | 83f5213fff51e2ff7405f1a0e2c6577b9cb649b7 | /FileDownload/src/main/java/http/HttpManager.java | 3187275a0aba6f50f42e19329aae8c39b3035ebd | [] | no_license | CTAS00/Demo_GitOkHttp | 34e4326d764808b3156634b05f058dfe4c55800a | 2a53e2387fe906908ccfca7aaf49305f6e1d2355 | refs/heads/master | 2021-09-02T09:29:07.123123 | 2018-01-01T12:27:56 | 2018-01-01T12:27:56 | 115,917,781 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,063 | java | package http;
import android.content.Context;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import ctas.filedownload.utils.File.FileStorageManager;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
/**
* Created by CTAS on 2017/12/28.
*/
public class HttpManager {
private static final HttpManager sManager=new HttpManager();
private Context mContext;
public void init(Context context){
mContext = context;
}
public static HttpManager getInstance(){
return sManager;
}
private HttpManager(){
mClient = new OkHttpClient();
}
private OkHttpClient mClient ;
public static final int NETWORK_CODE = 1;
public static final int NETWORK_CONTENT_LENGTH = 2;
public static final int NETWORK_RUNNING_TASK = 3;
public Response syncRequest(String url){
Request request = new Request.Builder().url(url).build();
try {
return mClient.newCall(request).execute();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public Response syncRequestByRange(String url,long start,long end){
Request request = new Request.Builder()
.url(url)
.addHeader("Range", "bytes=" + start + "-" + end)
.build();
try {
return mClient.newCall(request).execute();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public void asyncRequest(String url,Callback callback){
Request request = new Request.Builder().url(url).build();
mClient.newCall(request).enqueue(callback);
}
public void asyncRequest(final String url, final DownloadCallback callback){
Request request = new Request.Builder().url(url).build();
mClient.newCall(request).enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if(!response.isSuccessful()&&callback!=null){
callback.fail(NETWORK_CODE,"请求失败");
}
File file = FileStorageManager.getInstance().getFileName(url);
byte[] buffer = new byte[1024*500];
int len;
FileOutputStream fileOutputStream = new FileOutputStream(file);
InputStream inputStream = response.body().byteStream();
while((len = inputStream.read(buffer))!=-1){
fileOutputStream.write(buffer,0,len);
fileOutputStream.flush();
}
fileOutputStream.close();
inputStream.close();
if(callback!=null){
callback.success(file);
}
}
});
}
}
| [
"CT@qq.com"
] | CT@qq.com |
2f268e5ced5c7b02dec9bcb6ed97d9f3e4fc4d1d | 1bf6f2bffbff2c40e26885ca64d15adf69007e73 | /src/me/timothy/tests/database/mysql/MysqlTraditionalScammerMappingTest.java | a9b8dcb1853a8dbfdc6433f2d66b8c84fdee9031 | [] | no_license | Tjstretchalot/USLBot | 7e092ecf0c46f737cedd112b87cce9536d3e8697 | dd89777c761e447e30638934aa3be3d93b8ba641 | refs/heads/master | 2022-11-06T11:23:20.157772 | 2022-11-01T14:49:56 | 2022-11-01T14:49:56 | 107,429,676 | 22 | 0 | null | null | null | null | UTF-8 | Java | false | false | 645 | java | package me.timothy.tests.database.mysql;
import java.util.Properties;
import org.junit.After;
import org.junit.Before;
import me.timothy.bots.USLDatabase;
import me.timothy.tests.database.TraditionalScammerMappingTest;
public class MysqlTraditionalScammerMappingTest extends TraditionalScammerMappingTest {
@Before
public void setUp() {
Properties testDBProperties = MysqlTestUtils.fetchTestDatabaseProperties();
USLDatabase testDb = MysqlTestUtils.getDatabase(testDBProperties);
MysqlTestUtils.clearDatabase(testDb);
super.database = testDb;
}
@After
public void cleanUp() {
((USLDatabase) database).disconnect();
}
}
| [
"mtimothy983@gmail.com"
] | mtimothy983@gmail.com |
6724de099d89e3d0076abde02cf9c261c4cdc79f | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/kylin/learning/2380/DoggedCubeBuilder.java | 126525661314e581af8431cb839f595e806ded8b | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,883 | 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.kylin.cube.inmemcubing;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.NavigableMap;
import java.util.PriorityQueue;
import java.util.concurrent.BlockingQueue;
import org.apache.kylin.common.util.ByteArray;
import org.apache.kylin.common.util.Dictionary;
import org.apache.kylin.common.util.ImmutableBitSet;
import org.apache.kylin.cube.cuboid.CuboidScheduler;
import org.apache.kylin.gridtable.GTRecord;
import org.apache.kylin.gridtable.GTScanRequestBuilder;
import org.apache.kylin.gridtable.IGTScanner;
import org.apache.kylin.measure.MeasureAggregators;
import org.apache.kylin.metadata.model.IJoinedFlatTableDesc;
import org.apache.kylin.metadata.model.TblColRef;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.Lists;
/**
* When base cuboid does not fit in memory, cut the input into multiple splits and merge the split outputs at last.
*/
public class DoggedCubeBuilder extends AbstractInMemCubeBuilder {
private static Logger logger = LoggerFactory.getLogger(DoggedCubeBuilder.class);
private int unitRows = ConsumeBlockingQueueController.DEFAULT_BATCH_SIZE;
public DoggedCubeBuilder(CuboidScheduler cuboidScheduler, IJoinedFlatTableDesc flatDesc,
Map<TblColRef, Dictionary<String>> dictionaryMap) {
super(cuboidScheduler, flatDesc, dictionaryMap);
// check memory more often if a single row is big
if (cubeDesc.hasMemoryHungryMeasures())
unitRows /= 10;
}
@Override
public <T> void build(BlockingQueue<T> input, InputConverterUnit<T> inputConverterUnit, ICuboidWriter output)
throws IOException {
new BuildOnce().build(input, inputConverterUnit, output);
}
private class BuildOnce {
BuildOnce() {
}
public <T> void build(BlockingQueue<T> input, InputConverterUnit<T> inputConverterUnit, ICuboidWriter output)
throws IOException {
final RecordConsumeBlockingQueueController<T> inputController = RecordConsumeBlockingQueueController
.getQueueController(inputConverterUnit, input, unitRows);
final List<SplitThread> splits = new ArrayList<SplitThread>();
final Merger merger = new Merger();
long start = System.currentTimeMillis();
logger.info("Dogged Cube Build start");
try {
while (true) {
if (inputController.ifEnd()) {
break;
}
SplitThread last = new SplitThread(splits.size() + 1, inputController);
splits.add(last);
last.start();
logger.info("Split #{} kickoff", splits.size());
// Build splits sequentially
last.join();
checkException(splits);
}
logger.info("Dogged Cube Build splits complete, took {} ms", (System.currentTimeMillis() - start));
merger.mergeAndOutput(splits, output);
} catch (Throwable e) {
logger.error("Dogged Cube Build error", e);
if (e instanceof Error)
throw (Error) e;
else if (e instanceof RuntimeException)
throw (RuntimeException) e;
else
throw new IOException(e);
} finally {
output.close();
closeGirdTables(splits);
logger.info("Dogged Cube Build end, totally took {} ms", (System.currentTimeMillis() - start));
ensureExit(splits);
logger.info("Dogged Cube Build return");
}
}
private void closeGirdTables(List<SplitThread> splits) {
for (SplitThread split : splits) {
if (split.buildResult != null) {
for (CuboidResult r : split.buildResult.values()) {
try {
r.table.close();
} catch (Throwable e) {
logger.error("Error closing grid table " + r.table, e);
}
}
}
}
}
private void ensureExit(List<SplitThread> splits) throws IOException {
try {
for (int i = 0; i < splits.size(); i++) {
SplitThread split = splits.get(i);
if (split.isAlive()) {
abort(splits);
}
}
} catch (Throwable e) {
logger.error("Dogged Cube Build error", e);
}
}
private void checkException(List<SplitThread> splits) throws IOException {
for (int i = 0; i < splits.size(); i++) {
SplitThread split = splits.get(i);
if (split.exception != null)
abort(splits);
}
}
private void abort(List<SplitThread> splits) throws IOException {
for (SplitThread split : splits) {
split.builder.abort();
}
ArrayList<Throwable> errors = new ArrayList<Throwable>();
for (SplitThread split : splits) {
try {
split.join();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
errors.add(e);
}
if (split.exception != null)
errors.add(split.exception);
}
InMemCubeBuilder.processErrors(errors);
}
}
private class SplitThread extends Thread {
final RecordConsumeBlockingQueueController<?> inputController;
final InMemCubeBuilder builder;
NavigableMap<Long, CuboidResult> buildResult;
RuntimeException exception;
public SplitThread(final int num, final RecordConsumeBlockingQueueController<?> inputController) {
super("SplitThread" + num);
this.inputController = inputController;
this.builder = new InMemCubeBuilder(cuboidScheduler, flatDesc, dictionaryMap);
this.builder.setConcurrentThreads(taskThreadCount);
this.builder.setReserveMemoryMB(reserveMemoryMB);
}
@Override
public void run() {
try {
buildResult = builder.build(inputController);
} catch (Exception e) {
if (e instanceof RuntimeException)
this.exception = (RuntimeException) e;
else
this.exception = new RuntimeException(e);
inputController.findException();
}
}
}
private class Merger {
MeasureAggregators reuseAggrs;
Object[] reuseMetricsArray;
ByteArray reuseMetricsSpace;
long lastCuboidColumnCount;
ImmutableBitSet lastMetricsColumns;
Merger() {
reuseAggrs = new MeasureAggregators(cubeDesc.getMeasures());
reuseMetricsArray = new Object[cubeDesc.getMeasures().size()];
}
public void mergeAndOutput(List<SplitThread> splits, ICuboidWriter output) throws IOException {
if (splits.size() == 1) {
for (CuboidResult cuboidResult : splits.get(0).buildResult.values()) {
outputCuboid(cuboidResult.cuboidId, cuboidResult.table, output);
cuboidResult.table.close();
}
return;
}
LinkedList<MergeSlot> open = Lists.newLinkedList();
for (SplitThread split : splits) {
open.add(new MergeSlot(split));
}
PriorityQueue<MergeSlot> heap = new PriorityQueue<MergeSlot>();
while (true) {
// ready records in open slots and add to heap
while (!open.isEmpty()) {
MergeSlot slot = open.removeFirst();
if (slot.fetchNext()) {
heap.add(slot);
}
}
// find the smallest on heap
MergeSlot smallest = heap.poll();
if (smallest == null)
break;
open.add(smallest);
// merge with slots having the same key
if (smallest.isSameKey(heap.peek())) {
Object[] metrics = getMetricsValues(smallest.currentRecord);
reuseAggrs.reset();
reuseAggrs.aggregate(metrics);
do {
MergeSlot slot = heap.poll();
open.add(slot);
metrics = getMetricsValues(slot.currentRecord);
reuseAggrs.aggregate(metrics);
} while (smallest.isSameKey(heap.peek()));
reuseAggrs.collectStates(metrics);
setMetricsValues(smallest.currentRecord, metrics);
}
output.write(smallest.currentCuboidId, smallest.currentRecord);
}
}
private void setMetricsValues(GTRecord record, Object[] metricsValues) {
ImmutableBitSet metrics = getMetricsColumns(record);
if (reuseMetricsSpace == null) {
reuseMetricsSpace = new ByteArray(record.getInfo().getMaxColumnLength(metrics));
}
record.setValues(metrics, reuseMetricsSpace, metricsValues);
}
private Object[] getMetricsValues(GTRecord record) {
ImmutableBitSet metrics = getMetricsColumns(record);
return record.getValues(metrics, reuseMetricsArray);
}
private ImmutableBitSet getMetricsColumns(GTRecord record) {
// metrics columns always come after dimension columns
if (lastCuboidColumnCount == record.getInfo().getColumnCount())
return lastMetricsColumns;
int to = record.getInfo().getColumnCount();
int from = to - reuseMetricsArray.length;
lastCuboidColumnCount = record.getInfo().getColumnCount();
lastMetricsColumns = new ImmutableBitSet(from, to);
return lastMetricsColumns;
}
}
private static class MergeSlot implements Comparable<MergeSlot> {
final Iterator<CuboidResult> cuboidIterator;
IGTScanner scanner;
Iterator<GTRecord> recordIterator;
long currentCuboidId;
GTRecord currentRecord;
public MergeSlot(SplitThread split) {
cuboidIterator = split.buildResult.values().iterator();
}
public boolean fetchNext() throws IOException {
if (recordIterator == null) {
if (cuboidIterator.hasNext()) {
CuboidResult cuboid = cuboidIterator.next();
currentCuboidId = cuboid.cuboidId;
scanner = cuboid.table.scan(new GTScanRequestBuilder().setInfo(cuboid.table.getInfo()).setRanges(null).setDimensions(null).setFilterPushDown(null).createGTScanRequest());
recordIterator = scanner.iterator();
} else {
return false;
}
}
if (recordIterator.hasNext()) {
currentRecord = recordIterator.next();
return true;
} else {
scanner.close();
recordIterator = null;
return fetchNext();
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MergeSlot mergeSlot = (MergeSlot) o;
return compareTo(mergeSlot) == 0;
}
@Override
public int hashCode() {
return Long.hashCode(currentCuboidId);
}
@Override
public int compareTo(MergeSlot o) {
long cuboidComp = this.currentCuboidId - o.currentCuboidId;
if (cuboidComp != 0)
return cuboidComp < 0 ? -1 : 1;
// note GTRecord.equals() don't work because the two GTRecord comes from different GridTable
ImmutableBitSet pk = this.currentRecord.getInfo().getPrimaryKey();
for (int i = 0; i < pk.trueBitCount(); i++) {
int c = pk.trueBitAt(i);
int comp = this.currentRecord.get(c).compareTo(o.currentRecord.get(c));
if (comp != 0)
return comp;
}
return 0;
}
public boolean isSameKey(MergeSlot o) {
if (o == null)
return false;
else
return this.compareTo(o) == 0;
}
};
}
| [
"bloriot97@gmail.com"
] | bloriot97@gmail.com |
f551ea7af0b61d17f75f827d3058abbc9e733c15 | bf61baf5b0690ec490340418bff4d0e5a286ce37 | /src/puf/m2/basket/view/SeasonView.java | 2f7847ed81d374666b284eda61b08b8b65598572 | [] | no_license | pufm2/basket-ball | 1017e267fed8b38ab3d79ad1e4a24e07ce13cc11 | 7caaf707b7fb34332c3fb326312abf81cd16835b | refs/heads/master | 2020-05-31T18:13:50.149274 | 2012-08-05T11:49:48 | 2012-08-05T11:49:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,631 | java | package puf.m2.basket.view;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.List;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import com.toedter.calendar.JDateChooser;
import puf.m2.basket.model.entity.Season;
import puf.m2.basket.model.support.BasketException;
import puf.m2.basket.model.support.Condition;
import puf.m2.basket.model.support.EntityUtils;
import puf.m2.basket.view.support.ViewSupport;
public class SeasonView extends JPanel implements ActionListener {
private static final long serialVersionUID = 7386815518964502831L;
// Variables declaration - do not modify
Season season;
FormState formState;
boolean pressUpdate = false;
private javax.swing.JButton btnCancel;
private javax.swing.JButton btnDelete;
private javax.swing.JButton btnFind;
private javax.swing.JButton btnNew;
private javax.swing.JButton btnSave;
private javax.swing.JButton btnUpdate;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private JDateChooser txtEndDate;
private javax.swing.JTextField txtSeasonID;
private javax.swing.JTextField txtSeasonName;
private JDateChooser txtStartDate;
// End of variables declaration
public SeasonView() {
initComponents();
addActionListeners();
season = new Season();
formState = FormState.INITIAL;
updateForm();
}
@Override
public void actionPerformed(ActionEvent e) {
if ("Cancel".equals(e.getActionCommand())) {
formState = FormState.INITIAL;
} else if ("Delete".equals(e.getActionCommand())) {
Season seasonToDelete = null;
if (!isInteger(txtSeasonID.getText())) {
JOptionPane.showMessageDialog(this,
"Please input correct season ID", "Error",
JOptionPane.ERROR_MESSAGE);
return;
}
try {
season = makeSeason();
seasonToDelete = EntityUtils.loadById(season.getId(),
Season.class);
} catch (BasketException | SQLException e1) {
e1.printStackTrace();
}
if (seasonToDelete == null) {
JOptionPane.showMessageDialog(this,
"This season ID does not exists, can not delete",
"Error", JOptionPane.ERROR_MESSAGE);
return;
} else if (JOptionPane.showConfirmDialog(this,
"Do you really to delete this season?",
"Confirm to delete season", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
// Delete this season
deleteSeason();
JOptionPane.showMessageDialog(this, "This season is deleted");
}
formState = FormState.INITIAL;
} else if ("Find".equals(e.getActionCommand())) {
formState = FormState.FIND;
String seasonName = JOptionPane.showInputDialog(this,
"Please give name of season", "Season 1");
// Find season with that name
if (seasonName == null)
return;
else
seasonName = seasonName.toUpperCase();
List<Season> seasons = null;
try {
seasons = EntityUtils
.loadByCondition(new Condition("SEASON_NAME",
seasonName), Season.class, "SEASON_NAME");
} catch (BasketException e1) {
e1.printStackTrace();
}
// If exist season, show its information
if (seasons.size() > 0) {
season = seasons.get(0);
setTextField();
JOptionPane.showMessageDialog(this, "Season is founded",
"Notice", JOptionPane.INFORMATION_MESSAGE);
formState = FormState.FIND;
} else {
// If not exist season, show error message
JOptionPane.showMessageDialog(this,
"Can not found that season", "Error",
JOptionPane.ERROR_MESSAGE);
formState = FormState.INITIAL;
}
} else if ("New".equals(e.getActionCommand())) {
pressUpdate = false;
formState = FormState.NEW;
} else if ("Save".equals(e.getActionCommand())) {
if (isEmptyData()) {
JOptionPane.showMessageDialog(this,
"Please give enought information of season", "Error",
JOptionPane.ERROR_MESSAGE);
}
if (isTypeMismatch()) {
JOptionPane.showMessageDialog(this,
"Please give correct type in each text field", "Error",
JOptionPane.ERROR_MESSAGE);
} else {
if (!pressUpdate) {
season = makeSeason();
if (isDuplicateData(season)) {
JOptionPane
.showMessageDialog(
this,
"Can not insert new season which is duplicate ID/ Name with existing season",
"Error", JOptionPane.ERROR_MESSAGE);
return;
} else {
// Save new season
saveSeason();
JOptionPane.showMessageDialog(this,
"Save new season successful", "Success",
JOptionPane.INFORMATION_MESSAGE);
}
} else {
// Update existing season
season = makeSeason();
updateSeason();
JOptionPane.showMessageDialog(this,
"Update season successful", "Success",
JOptionPane.INFORMATION_MESSAGE);
}
}
formState = FormState.INITIAL;
} else if ("Update".equals(e.getActionCommand())) {
pressUpdate = true;
formState = FormState.NEW;
}
// Finally for each button
updateForm();
}
private void addActionListeners() {
btnCancel.setActionCommand("Cancel");
btnCancel.addActionListener(this);
btnDelete.setActionCommand("Delete");
btnDelete.addActionListener(this);
btnFind.setActionCommand("Find");
btnFind.addActionListener(this);
btnNew.setActionCommand("New");
btnNew.addActionListener(this);
btnSave.setActionCommand("Save");
btnSave.addActionListener(this);
btnUpdate.setActionCommand("Update");
btnUpdate.addActionListener(this);
}
private void deleteSeason() {
try {
season.setDeleted(1);
season.update();
} catch (SQLException | BasketException e) {
e.printStackTrace();
}
}
private void initComponents() {
jButton2 = new javax.swing.JButton();
txtSeasonID = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
txtStartDate = new JDateChooser();
jLabel2 = new javax.swing.JLabel();
btnNew = new javax.swing.JButton();
btnFind = new javax.swing.JButton();
btnSave = new javax.swing.JButton();
btnCancel = new javax.swing.JButton();
btnUpdate = new javax.swing.JButton();
btnDelete = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
txtEndDate = new JDateChooser();
jLabel4 = new javax.swing.JLabel();
txtSeasonName = new javax.swing.JTextField();
jButton2.setText("jButton2");
jLabel1.setText("Season ID");
jLabel2.setText("Start Date");
btnNew.setText("New");
btnNew.setToolTipText("Add new office");
btnFind.setText("Find");
btnFind.setToolTipText("Find an existing office");
btnSave.setText("Save");
btnSave.setToolTipText("Save new office");
btnCancel.setText("Cancel");
btnUpdate.setText("Update");
btnDelete.setText("Delete");
jLabel3.setText("End Date");
jLabel4.setText("Season name");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(layout
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
layout.createSequentialGroup()
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
layout.createSequentialGroup()
.addContainerGap()
.addComponent(
btnNew,
javax.swing.GroupLayout.PREFERRED_SIZE,
76,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(
btnFind,
javax.swing.GroupLayout.PREFERRED_SIZE,
78,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(
btnCancel,
javax.swing.GroupLayout.PREFERRED_SIZE,
78,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(
btnSave,
javax.swing.GroupLayout.PREFERRED_SIZE,
76,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(
btnUpdate,
javax.swing.GroupLayout.PREFERRED_SIZE,
78,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(
btnDelete,
javax.swing.GroupLayout.PREFERRED_SIZE,
82,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(
layout.createSequentialGroup()
.addGap(19, 19,
19)
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(
jLabel1)
.addComponent(
jLabel2)
.addComponent(
jLabel3)
.addComponent(
jLabel4))
.addGap(37, 37,
37)
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING,
false)
.addComponent(
txtStartDate,
javax.swing.GroupLayout.DEFAULT_SIZE,
234,
Short.MAX_VALUE)
.addComponent(
txtSeasonID,
javax.swing.GroupLayout.PREFERRED_SIZE,
91,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(
txtEndDate,
javax.swing.GroupLayout.DEFAULT_SIZE,
234,
Short.MAX_VALUE)
.addComponent(
txtSeasonName))))
.addContainerGap(23, Short.MAX_VALUE)));
layout.setVerticalGroup(layout
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
layout.createSequentialGroup()
.addContainerGap()
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(
txtSeasonID,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(
txtSeasonName,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(
txtStartDate,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(
javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(
txtEndDate,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(
layout.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnNew)
.addComponent(btnFind)
.addComponent(btnCancel)
.addComponent(btnUpdate)
.addComponent(btnDelete)
.addComponent(btnSave))
.addContainerGap(20, Short.MAX_VALUE)));
layout.linkSize(javax.swing.SwingConstants.VERTICAL,
new java.awt.Component[] { txtSeasonID, txtStartDate });
}// </editor-fold>
private boolean isDuplicateData(Season season) {
List<Season> seasons = null;
// check if duplicate season ID
try {
seasons = EntityUtils.loadByCondition(new Condition("id", season
.getId().toString()), Season.class, "id");
} catch (BasketException | SQLException e) {
e.printStackTrace();
}
if (seasons.size() > 0)
return true;
seasons = null;
// check if duplicate season name
try {
seasons = EntityUtils.loadByCondition(new Condition("SEASON_NAME",
season.getId().toString()), Season.class, "SEASON_NAME");
} catch (BasketException | SQLException e) {
e.printStackTrace();
}
if (seasons.size() > 0)
return true;
return false;
}
private boolean isEmptyData() {
if (txtSeasonID.getText().equals("")
|| txtSeasonName.getText().equals(""))
return true;
return false;
}
public boolean isInteger(String s) {
try {
Integer.parseInt(s);
} catch (NumberFormatException nfe) {
return false;
}
return true;
}
private boolean isTypeMismatch() {
if (!isInteger(txtSeasonID.getText()))
return true;
return false;
}
private Season makeSeason() {
setFieldtoAttribute();
try {
season.setDeleted(0);
} catch (SQLException e) {
e.printStackTrace();
}
return season;
}
private void saveSeason() {
setFieldtoAttribute();
try {
season.setDeleted(0);
season.save();
} catch (NumberFormatException | BasketException | SQLException e) {
e.printStackTrace();
}
}
private void setFieldtoAttribute() {
try {
season.setId(Integer.parseInt(txtSeasonID.getText().trim()));
season.setSeasonName(txtSeasonName.getText().trim());
season.setSeasonStartdate(new Timestamp(txtStartDate.getDate()
.getTime()));
season.setSeasonEnddate(new Timestamp(txtEndDate.getDate()
.getTime()));
} catch (NumberFormatException | SQLException e1) {
e1.printStackTrace();
}
}
private void setTextField() {
try {
txtSeasonID.setText(season.getId().toString());
txtSeasonName.setText(season.getSeasonName());
txtStartDate
.setDate(ViewSupport.toDate(season.getSeasonStartdate()));
txtEndDate.setDate(ViewSupport.toDate(season.getSeasonEnddate()));
} catch (SQLException e) {
e.printStackTrace();
}
}
private void updateForm() {
switch (formState) {
case INITIAL:
btnCancel.setVisible(false);
btnSave.setVisible(false);
btnUpdate.setVisible(false);
btnDelete.setVisible(false);
btnNew.setVisible(true);
btnFind.setVisible(true);
break;
case NEW:
btnNew.setVisible(false);
btnFind.setVisible(false);
btnUpdate.setVisible(false);
btnDelete.setVisible(false);
btnSave.setVisible(true);
btnCancel.setVisible(true);
break;
case FIND:
btnSave.setVisible(false);
btnCancel.setVisible(true);
btnNew.setVisible(true);
btnFind.setVisible(true);
btnUpdate.setVisible(true);
btnDelete.setVisible(true);
break;
}
}
private void updateSeason() {
setFieldtoAttribute();
try {
season.setDeleted(0);
season.update();
} catch (BasketException | SQLException e) {
e.printStackTrace();
}
}
}
| [
"phatpt01@gmail.com"
] | phatpt01@gmail.com |
ba2a34f5066315e68c102736f91d82050432121c | f5c3c76446b0e20acef3cfafb9cf322e3f2ecbf3 | /jaf-examples-redis/src/test/java/com/jaf/examples/redis/cluster/spring/ClusterAppConfig.java | 32129d8499d175d16b748e2a03a0111c951a3d1e | [
"MIT"
] | permissive | walle-liao/jaf-examples | 05df8673623eb92547952598abe9b215b4e6c3ab | bb6e2222bf5d89fe134843159e78fc2c7cb82c02 | refs/heads/master | 2021-10-12T01:38:08.786458 | 2021-10-05T07:54:09 | 2021-10-05T07:54:09 | 60,753,330 | 4 | 5 | null | null | null | null | UTF-8 | Java | false | false | 781 | java | package com.jaf.examples.redis.cluster.spring;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisClusterConfiguration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
/**
* TODO
*
* @author liaozhicheng.cn@163.com
* @date 2016年7月23日
* @since 1.0
*/
//@Configuration
public class ClusterAppConfig {
@Autowired
private ClusterConfigurationProperties clusterProperties;
@Bean
public RedisConnectionFactory connectionFactory() {
return new JedisConnectionFactory(
new RedisClusterConfiguration(clusterProperties.getNodes()));
}
}
| [
"liaozhicheng.cn@163.com"
] | liaozhicheng.cn@163.com |
61c97901c933d85cc8adc9e76d0357a2cd641ab0 | 07e99af05e98e26739caaff3232c1d274021f6a6 | /archunit/src/test/java/com/tngtech/archunit/core/importer/testexamples/hierarchicalfieldaccess/AccessToSuperAndSubClassField.java | 8d44a095b28fe8b6e9eef5c5e962e576049dd9fe | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | up1/ArchUnit | 4fdb1e933df3709e6d718b36ae09892be832118e | 72b5ad67c84a1936c41d9f012bfe367bcdd6d081 | refs/heads/master | 2022-04-22T05:43:37.093283 | 2020-04-15T17:29:48 | 2020-04-15T17:29:48 | 258,765,678 | 1 | 0 | Apache-2.0 | 2020-04-25T12:04:57 | 2020-04-25T12:04:57 | null | UTF-8 | Java | false | false | 325 | java | package com.tngtech.archunit.core.importer.testexamples.hierarchicalfieldaccess;
public class AccessToSuperAndSubClassField {
String accessSuperClassField() {
return new SubClassWithAccessedField().field;
}
int accessSubClassField() {
return new SubClassWithAccessedField().maskedField;
}
}
| [
"peter.gafert@tngtech.com"
] | peter.gafert@tngtech.com |
e3ddb0e1cd1cad4f6056a227e0502c3e0de36614 | 09d8aa658e5bb88f0491df4fa4ffd7fdb2eff64f | /UserMS/src/main/java/com/infy/infycart/user/service/WishlistService.java | 483436ac1435c1b0aa912e7cfcf662be275da23b | [] | no_license | Ashwini1204/ReskellingProject | e0294160ff13e069155c79b45ff87bdc6e6081b8 | b24a97667cb96e12c9937576f376afd398ba3be3 | refs/heads/master | 2023-04-29T08:12:06.549841 | 2021-05-20T15:56:02 | 2021-05-20T15:56:02 | 368,805,444 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package com.infy.infycart.user.service;
import java.util.List;
import com.infy.infycart.user.dto.WishlistDTO;
public interface WishlistService {
public String addWishlist(WishlistDTO wishlistDTO);
public String deleteWishlist(WishlistDTO wishlistDTO);
public List<WishlistDTO> getAllWishlist();
public List<WishlistDTO> getAllWishlistByBuyerId(Integer buyerId);
} | [
"Ashwini@LAPTOP-8FQANADD"
] | Ashwini@LAPTOP-8FQANADD |
acfe421cb3ddfdf7dc7e8ccb948b273435e85938 | 4cc693355b5185b2cd755636726979824acdc6a3 | /backend/src/main/java/server/utils/Calculator.java | 30448886899e9184ab4aa6053b4c48a7c228c058 | [] | no_license | kundlatsch/desafio-bridge | 2579acd965687b2abb647ee896fb14026ac85f30 | da02b6dc4edfdcbbad7e7ab2e282961b623e237c | refs/heads/master | 2022-12-16T05:59:43.635511 | 2020-09-14T19:52:33 | 2020-09-14T19:52:33 | 294,958,596 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | package server;
public class Calculator {
public static int factorial(int number) {
if (number == 0)
return 1;
else
return(number * factorial(number-1));
}
} | [
"gustavo.kundlatsch@gmail.com"
] | gustavo.kundlatsch@gmail.com |
2a938cd8071505be4966cfe0f333086c96141513 | 7b26222e8996694acf6c8131136dc6ab438f0486 | /src/br/com/project/exception/CustomExceptionHandlerFactory.java | db0889a0df13709f0202e1bac314fe1dcdd1af0d | [] | no_license | mrenancidrao/caixaeletronico | 66b3c3a2ad8b37f5f55b43805014b4c7f69bb4e2 | b9cba3e860939e99ec5bb29fc9ab5e3db3e72eea | refs/heads/master | 2020-03-28T14:13:00.301372 | 2018-10-24T03:07:31 | 2018-10-24T03:07:31 | 148,468,024 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 526 | java | package br.com.project.exception;
import javax.faces.context.ExceptionHandler;
import javax.faces.context.ExceptionHandlerFactory;
public class CustomExceptionHandlerFactory extends ExceptionHandlerFactory {
private ExceptionHandlerFactory parent;
public CustomExceptionHandlerFactory(ExceptionHandlerFactory parent) {
this.parent = parent;
}
@Override
public ExceptionHandler getExceptionHandler() {
ExceptionHandler handler = new CustomExceptionHandler(parent.getExceptionHandler());
return handler;
}
}
| [
"mrenancidrao@gmail.com"
] | mrenancidrao@gmail.com |
50e14a89a101b976847aafe368be692f43cbba0e | 91fd134c890416c062cb307239a7938e4e5d3738 | /src/main/java/com/motors/gm/controller/VehicleModelDeleteController.java | 3d58fefddfabfc2d46a342e945f2b27645a9ed84 | [] | no_license | SumitDhall/gmAuthServer | 63f2c220bff129bae887e1406c8ad48e6d7299a9 | 13d82e1cc2f6fcd26559e4c16749dbbabd0dadef | refs/heads/master | 2021-03-12T02:39:55.147037 | 2020-03-11T13:53:57 | 2020-03-11T13:53:57 | 246,582,218 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,477 | java | //package com.motors.gm.controller;
//
//import java.util.List;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.mongodb.core.MongoTemplate;
//import org.springframework.web.bind.annotation.DeleteMapping;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.PutMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import com.motors.gm.model.VehicleModel;
//import com.motors.gm.repository.VehicleModelDeleteRepository;
//import com.motors.gm.service.VehicleModelDeleteService;
//
//@RestController
//@RequestMapping(path = "/deleteAsset")
//public class VehicleModelDeleteController {
//
// @Autowired
// private MongoTemplate mongoTemplate;
//
// @Autowired
// VehicleModelDeleteService vehicleModelDeleteService;
//
// // delete method will call service delete method to delete the existing
// // vehicle in DB
// // TO-DO need to create new project for Delete
// @DeleteMapping(path = "/deleteVehicle/{regNumber}", produces = "application/json")
// public String deleteVehicle(@PathVariable String regNumber) {
// return vehicleModelDeleteService.deleteVehicle(regNumber);
// }
//
//}
| [
"sumitdhall123@gmail.com"
] | sumitdhall123@gmail.com |
2aa16e34ceacefdb243cd75d5cbfcecacb4c0449 | 1a8aa581f638d7872b7f54637f7132eacb2e400a | /LC II/Lista0/Lista04.java | 4472b6399b0489efda9286a9a0c4e66987d9fad1 | [] | no_license | mcarneirobug/PUC-MG | d16eae6656c9b2f7f49179a8d07a38fdfb914e5c | 6557f18f2576b171eb169d35d0d02403421d15d3 | refs/heads/master | 2021-05-06T13:08:54.289548 | 2019-02-14T10:11:42 | 2019-02-14T10:11:42 | 113,245,816 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 844 | java | /* Dependence */
import java.io.IOException;
import java.util.Scanner;
public class Lista04 extends Lista05 {
/* Global variable to manipulate input and output data */
public static Scanner in = new Scanner (System.in);
public static void main (String [] args) throws IOException {
/* method main call */
area();
System.exit(0);
} //end main()
public static void area () {
/* define data */
double answer;
int x = 10;
int y = 20;
double p;
for ( p = x; p <= y; p += 2) {
/* call function */
answer = areaCalculator(p);
/* printer */
System.out.println("X = " + x + " | " + "Y = " + y + " | " + "Raio = " + p + " | " + "Area = " + answer);
} //end for
} //end area()
} //end Lista04
| [
"noreply@github.com"
] | mcarneirobug.noreply@github.com |
5103844175294a0538312ac950d595e499ddd52a | f26df4abd8ca4b196dad4276d323dc85b0309a61 | /TD6/Frame.java | 6f015cd8df3be5d59d01524345e5f268e36249ee | [] | no_license | simonatila/SE | 5f7d1ea14c87d92185f0db71a82726f3902339ae | 30f2505f99f25c5ac1babc1240cc6b8aacc7af02 | refs/heads/master | 2021-01-21T13:18:15.712449 | 2016-05-18T20:18:24 | 2016-05-18T20:18:24 | 53,654,255 | 0 | 2 | null | 2016-05-04T21:01:09 | 2016-03-11T09:07:45 | null | UTF-8 | Java | false | false | 855 | java | /**
* Frame.java
*
* A class which represents a physical page frame.
*
* @author Gagne, Galvin, Silberschatz
* Operating System Concepts with Java - Eighth Edition
* Copyright John Wiley & Sons - 2010.
*
* adapted by myf1: at construction every frame is filled
* with values [0..PAGE_SIZE-1]
*/
//package opsys1.vmm;
public class Frame
{
public static final int PAGE_SIZE = 256;
private byte[] frameValue;
public Frame() {
frameValue = new byte[PAGE_SIZE];
for (int i = 0; i < PAGE_SIZE; i++)
frameValue[i] = (byte) i;
}
public void setFrame(byte[] bytes)
{
/**
* Make sure we use System.arraycopy() as we don't
* want the frame to be a unique refernece.
*/
System.arraycopy(bytes, 0, frameValue, 0, PAGE_SIZE);
}
public byte readWord(int offset)
{
return frameValue[offset];
}
}
| [
"simona.tila@yahoo.com"
] | simona.tila@yahoo.com |
354b2da57cfefcc967c72f68d30a5dbc49d4562c | 24be5f03d908bedba38dc5f71cfb0eb69ac6fa91 | /algorithmic_toolbox/week5/EditDistance.java | 5c0cdccfb679713a465e0587b9819873629b4eae | [] | no_license | vandita5/coursera_learning | 2ba89768a6f26cd9844e81ea11d292f63d6adc06 | ec39a59a9519ddad127e8064ea12eacd86b4c42a | refs/heads/master | 2021-01-20T03:54:45.466198 | 2017-05-09T13:16:51 | 2017-05-09T13:16:51 | 89,607,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,120 | java | import java.util.*;
import java.lang.Math;
class EditDistance {
public static int EditDistance(String s, String t) {
//write your code here
int[][] dist = new int[s.length() + 1][t.length() + 1];
for (int i = 0; i < s.length() + 1; i++) {
dist[i][0] = i;
}
for (int j = 0; j < t.length() + 1; j++) {
dist[0][j] = j;
}
for (int i = 1; i < s.length() + 1; i++) {
for (int j = 1; j < t.length() + 1; j++) {
int insertion = dist[i - 1][j] + 1;
int deletion = dist[i][j - 1] + 1;
int mismatch = dist[i - 1][j - 1] + 1;
int match = dist[i - 1][j - 1];
if (s.charAt(i - 1) == t.charAt(j - 1)) {
dist[i][j] = Math.min(insertion, Math.min(deletion, match));
}
else
{
dist[i][j] = Math.min(insertion, Math.min(deletion, mismatch));
}
}
}
return dist[s.length()][t.length()];
}
public static void main(String args[]) {
Scanner scan = new Scanner(System.in);
String s = scan.next();
String t = scan.next();
System.out.println(EditDistance(s, t));
}
}
| [
"vs1321@nyu.edu"
] | vs1321@nyu.edu |
5e9bd9c5e818bfbd8af61e60d7c8c3859626adfe | a3846efefd52bfa7c694c5c85f50d264905842ad | /src/main/java/com/houjingyi/huodongbaoming/config/GlobalConfig.java | 78563e619445a36b6297c3d72ba4940815ca566f | [] | no_license | NPC2048/huodongbaoming-api | 8bf0977ee4647d6fcbc5e24866996dc0766d480d | 5779f60159711a0cf78be76866126597c3e8f036 | refs/heads/main | 2023-06-22T04:40:19.479779 | 2021-07-20T08:28:31 | 2021-07-20T08:28:31 | 353,966,721 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 961 | java | package com.houjingyi.huodongbaoming.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import javax.annotation.PreDestroy;
import java.util.concurrent.ThreadPoolExecutor;
/**
* 全局配置,暂无
*
* @author yuelong.liang
*/
@Slf4j
public class GlobalConfig {
@Bean
public ThreadPoolTaskExecutor threadPoolExecutor() {
// 线程池,基本没用到,随便配一下
ThreadPoolTaskExecutor threadPool = new ThreadPoolTaskExecutor();
threadPool.setCorePoolSize(1);
threadPool.setMaxPoolSize(2);
threadPool.setQueueCapacity(32);
threadPool.setDaemon(true);
threadPool.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
return threadPool;
}
@PreDestroy
public void preDestroy() {
log.info("程序优雅退出");
}
}
| [
"35749025+NPC2048@users.noreply.github.com"
] | 35749025+NPC2048@users.noreply.github.com |
5a7140716d77b8bf6e88f7866f3d773a7bf88506 | f38fe176785eb15859fbad7bdd5e5990dab0c3f9 | /app/src/main/java/com/kstech/zoomlion/engine/server/ItemCheckPrepareTask.java | 97cba860461c511a16f633b51157bf18e9244c20 | [] | no_license | lijieqing/zoomlion | e74648ffcb5deee8d38425a7d8826ab4dde6bb76 | 441b85fa37d8c62b0e04aabaf7c281f1858fc742 | refs/heads/master | 2021-07-11T10:05:00.218894 | 2018-04-22T14:29:01 | 2018-04-22T14:29:01 | 96,391,040 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,232 | java | package com.kstech.zoomlion.engine.server;
import android.os.AsyncTask;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import com.kstech.zoomlion.engine.base.BaseCheckFunction;
import com.kstech.zoomlion.model.enums.CheckItemResultEnum;
import com.kstech.zoomlion.model.session.URLCollections;
import com.kstech.zoomlion.utils.Globals;
import com.kstech.zoomlion.view.activity.BaseActivity;
import com.kstech.zoomlion.view.activity.CheckHomeActivity;
import org.json.JSONException;
import org.json.JSONObject;
import org.xutils.http.RequestParams;
import org.xutils.x;
/**
* Created by lijie on 2018/1/8.
* 项目调试准备线程
*/
public class ItemCheckPrepareTask extends AsyncTask<Void, Integer, Void> {
/**
* CheckHomeActivity中的handler
*/
private Handler handler;
/**
* 基础功能Activity
*/
private BaseCheckFunction funActivity;
/**
* 请求参数的数据集合
*/
private RequestParams params;
/**
* 是否运行在ItemCheckActivity
*/
private boolean inCheckMode = false;
/**
* 是跳到下一项目
*/
private boolean next = false;
/**
* 当前调试项目的连续通过次数
*/
public static int serverItemPassTimes = -1;
/**
* 当前调试项目的已完成次数
*/
public static int serverItemDoneTimes = -1;
/**
* 当前调试项目的服务器状态
*/
public static int serverItemStatus = -1;
public ItemCheckPrepareTask(Handler handler) {
this.handler = handler;
}
/**
* 设置为调试模式
*
* @param funActivity activity工具
* @param next 去往下一项
*/
public void setInCheckMode(BaseCheckFunction funActivity, boolean next) {
this.inCheckMode = true;
this.next = next;
this.funActivity = funActivity;
}
@Override
protected void onPreExecute() {
super.onPreExecute();
//URLCollections.GET_ITEM_CHECK_INFO
params = new RequestParams(URLCollections.getGetItemCheckInfoURL());
params.addHeader("Cookie", Globals.SID);
handler.sendEmptyMessage(BaseActivity.DIALOG_SHOW);
}
@Override
protected Void doInBackground(Void... voids) {
params.addBodyParameter("sn", Globals.deviceSN);
params.addBodyParameter("qcitemDictId", Globals.currentCheckItem.getDictId());
Message message;
message = Message.obtain();
message.what = BaseActivity.UPDATE_PROGRESS_CONTENT;
message.obj = "向服务器验证调试项目状态";
message.arg1 = 15;
handler.sendMessage(message);
String result = "";
try {
result = x.http().postSync(params, String.class);
JSONObject object = new JSONObject(result);
message = Message.obtain();
if (URLCollections.isRequestSuccess(object)) {
serverItemPassTimes = object.getInt("passTimes");
serverItemDoneTimes = object.getInt("doneTimes");
serverItemStatus = object.getInt("status");
message.what = BaseActivity.UPDATE_PROGRESS_CONTENT;
message.obj = "服务器请求成功,当前调试项目状态:" + CheckItemResultEnum.getDescByCode(serverItemStatus);
message.arg1 = 30;
handler.sendMessage(message);
SystemClock.sleep(1000);
handler.sendEmptyMessage(BaseActivity.DIALOG_CANCEL);
if (inCheckMode && funActivity != null) {
funActivity.loadCheckItemData();
}else {
handler.sendEmptyMessage(CheckHomeActivity.ITEM_SERVER_INFO_LOADED);
}
} else {
message.what = BaseActivity.UPDATE_PROGRESS_CONTENT;
message.obj = "服务器请求失败,无法进入项目调试";
message.arg1 = 100;
handler.sendMessage(message);
SystemClock.sleep(1000);
handler.sendEmptyMessage(BaseActivity.DIALOG_CANCEL);
if (inCheckMode && funActivity != null) {
if (next) {
Globals.forwardCheckItem();
} else {
Globals.nextCheckItem();
}
}
}
} catch (JSONException e) {
e.printStackTrace();
message = Message.obtain();
if (URLCollections.isReLogin(result)) {
message.what = BaseActivity.USER_RELOGIN;
message.obj = "用户身份异常,重新登录";
handler.sendMessage(message);
} else {
message.what = BaseActivity.UPDATE_PROGRESS_CONTENT;
message.obj = "数据格式错误";
message.arg1 = 100;
handler.sendMessage(message);
SystemClock.sleep(1000);
}
handler.sendEmptyMessage(BaseActivity.DIALOG_CANCEL);
if (inCheckMode && funActivity != null) {
if (next) {
Globals.forwardCheckItem();
} else {
Globals.nextCheckItem();
}
}
} catch (Throwable throwable) {
//此异常为无法
throwable.printStackTrace();
message = Message.obtain();
message.what = BaseActivity.UPDATE_PROGRESS_CONTENT;
message.obj = throwable.getMessage();
message.arg1 = 100;
handler.sendMessage(message);
SystemClock.sleep(1000);
handler.sendEmptyMessage(BaseActivity.DIALOG_CANCEL);
if (inCheckMode && funActivity != null) {
if (next) {
Globals.forwardCheckItem();
} else {
Globals.nextCheckItem();
}
}
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
handler.sendEmptyMessage(BaseActivity.DIALOG_CANCEL);
}
}
| [
"759353118@qq.com"
] | 759353118@qq.com |
3f540750a864fc500d854f82f748d66db4d3b37d | 4306d9dcad66fb43733f3a0e67d50e5c43397928 | /BBS/src/main/java/bbs/member/service/SaveImgDBService.java | ae08a018344e90fe0f69839263e88bf861d6153f | [] | no_license | leegangmin/jsp-team-d | b7be5d15a0d2545d5c368e6b233130e3fc108451 | 5435802f09460b084c4cd378bb81c8e51c575066 | refs/heads/main | 2023-08-08T00:47:56.845788 | 2021-09-17T08:44:50 | 2021-09-17T08:44:50 | null | 0 | 0 | null | null | null | null | ISO-8859-3 | Java | false | false | 913 | java | package bbs.member.service;
import java.sql.Connection;
import java.sql.SQLException;
import bbs.jdbc.ConnectionProvider;
import bbs.jdbc.JdbcUtil;
import bbs.member.dao.MemberDao;
import bbs.member.model.Member;
public class SaveImgDBService {
public static Member modify(ModifyRequest modiReq) { //20210808 Çö
Connection conn = null;
try {
conn = ConnectionProvider.getConnection();
conn.setAutoCommit(false);
MemberDao memberDao = new MemberDao();
Member member = memberDao.whereMyImg(conn, modiReq.getId());
if (member == null) {
throw new MemberNotFoundException();
}
member.setImgName(modiReq.getImgName());
memberDao.updateProfile(conn, member);
conn.commit();
return member;
} catch (SQLException e) {
JdbcUtil.rollBack(conn);
throw new RuntimeException(e);
} finally {
JdbcUtil.close(conn);
}
}
}
| [
"elites202@gmail.com"
] | elites202@gmail.com |
2b08ea17fc3adf70419f0699fc840bc4ef684f62 | 6baf1fe00541560788e78de5244ae17a7a2b375a | /hollywood/com.oculus.unifiedtelemetry-UnifiedTelemetry/sources/X/AbstractC00409v.java | 55de27184e29084dde8f6c7020348814a306dd5a | [] | no_license | phwd/quest-tracker | 286e605644fc05f00f4904e51f73d77444a78003 | 3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba | refs/heads/main | 2023-03-29T20:33:10.959529 | 2021-04-10T22:14:11 | 2021-04-10T22:14:11 | 357,185,040 | 4 | 2 | null | 2021-04-12T12:28:09 | 2021-04-12T12:28:08 | null | UTF-8 | Java | false | false | 353 | java | package X;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
/* renamed from: X.9v reason: invalid class name and case insensitive filesystem */
public interface AbstractC00409v {
void A3e(@NonNull Fragment fragment, @NonNull AnonymousClass5d v);
void A41(@NonNull Fragment fragment, @NonNull AnonymousClass5d v);
}
| [
"cyuubiapps@gmail.com"
] | cyuubiapps@gmail.com |
cf7c9ec44cf782afb9ce0ae8e3945d7e2a04c8ba | 840059b9f2a257d099f48eff96e3595255e408af | /src/test/java/com/demo/test/MavenDemoTest.java | 6df181aa916783a7d4e90770589d0ccddbc50829 | [] | no_license | QingYanL/mavendemo | 1f8491b1bcbabb3d4f032356d535a677a4b0da4f | b529b98a78ecdec014d4c2ee671528a92811a2a8 | refs/heads/maven-demo-test | 2023-05-11T02:10:15.856986 | 2019-09-05T07:28:26 | 2019-09-05T07:28:26 | 206,502,543 | 0 | 0 | null | 2023-05-09T18:31:53 | 2019-09-05T07:31:01 | HTML | UTF-8 | Java | false | false | 171 | java | package com.demo.test;
import org.testng.annotations.Test;
public class MavenDemoTest {
@Test
public void testMavenDemo(){
System.out.println("hello! ");
}
}
| [
"liyan@cryptape.com"
] | liyan@cryptape.com |
8c882cf6694a7edec8b9d2500d4c2990c4dfdb85 | f6a57e6fbb6dbaf0b0d6600e27da3ae9dc254408 | /scanner_parser/jflex/jflex-1.5.1/src/main/java/jflex/gui/OptionsDialog.java | 9e11505d53497ad46c568df242adf2ecca7ef4f3 | [
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | basirati/headerimporter | fd5da1eb896b25ce04506969ebfc1069fdfa9246 | 5eeaa6980000542f086b5c268ab1be18e4f69017 | refs/heads/master | 2021-01-01T05:33:04.700125 | 2020-08-18T09:21:43 | 2020-08-18T09:21:43 | 28,005,119 | 0 | 0 | null | 2020-10-13T03:32:25 | 2014-12-14T19:26:20 | Java | UTF-8 | Java | false | false | 7,724 | java | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* JFlex 1.5 *
* Copyright (C) 1998-2014 Gerwin Klein <lsf@jflex.de> *
* All rights reserved. *
* *
* License: BSD *
* *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
package jflex.gui;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import jflex.GeneratorException;
import jflex.Options;
import jflex.Skeleton;
/**
* A dialog for setting JFlex options
*
* @author Gerwin Klein
* @version $Revision: 776 $, $Date: 2014-01-22 06:00:50 +0100 (Wed, 22 Jan 2014) $
*/
public class OptionsDialog extends Dialog {
/**
*
*/
private static final long serialVersionUID = 6807759416163314769L;
private Frame owner;
private Button skelBrowse;
private TextField skelFile;
private Button ok;
private Button defaults;
private Checkbox dump;
private Checkbox verbose;
private Checkbox time;
private Checkbox no_minimize;
private Checkbox no_backup;
private Checkbox input_stream_ctor;
private Checkbox jlex;
private Checkbox dot;
private Checkbox tableG;
private Checkbox switchG;
private Checkbox packG;
private Checkbox legacy_dot;
/**
* Create a new options dialog
*
* @param owner
*/
public OptionsDialog(Frame owner) {
super(owner, "Options");
this.owner = owner;
setup();
pack();
addWindowListener( new WindowAdapter() {
public void windowClosing(WindowEvent e) {
close();
}
});
}
public void setup() {
// create components
ok = new Button("Ok");
defaults = new Button("Defaults");
skelBrowse = new Button(" Browse");
skelFile = new TextField();
skelFile.setEditable(false);
CheckboxGroup codeG = new CheckboxGroup();
tableG = new Checkbox(" table (DEPRECATED)",Options.gen_method == Options.TABLE, codeG);
switchG = new Checkbox(" switch (DEPRECATED)",Options.gen_method == Options.SWITCH, codeG);
packG = new Checkbox(" pack",Options.gen_method == Options.PACK, codeG);
legacy_dot = new Checkbox( " dot (.) matches [^\\n] instead of "
+ "[^\\n\\r\\000B\\u000C\\u0085\\u2028\\u2029]");
dump = new Checkbox(" dump");
verbose = new Checkbox(" verbose");
time = new Checkbox(" time statistics");
no_minimize = new Checkbox(" skip minimization");
no_backup = new Checkbox(" no backup file");
input_stream_ctor = new Checkbox(" InputStream ctor");
jlex = new Checkbox(" JLex compatibility");
dot = new Checkbox(" dot graph files");
// setup interaction
ok.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
close();
}
} );
defaults.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
setDefaults();
}
} );
skelBrowse.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
skelBrowse();
}
} );
tableG.addItemListener( new ItemListener() {
public void itemStateChanged(ItemEvent e) {
setGenMethod();
}
} );
verbose.addItemListener( new ItemListener() {
public void itemStateChanged(ItemEvent e) {
Options.verbose = verbose.getState();
}
} );
dump.addItemListener( new ItemListener() {
public void itemStateChanged(ItemEvent e) {
Options.dump = dump.getState();
}
} );
jlex.addItemListener( new ItemListener() {
public void itemStateChanged(ItemEvent e) {
Options.jlex = jlex.getState();
// JLex compatibility implies that dot (.) metachar matches [^\n]
legacy_dot.setState(false);
legacy_dot.setEnabled( ! jlex.getState());
}
} );
no_minimize.addItemListener( new ItemListener() {
public void itemStateChanged(ItemEvent e) {
Options.no_minimize = no_minimize.getState();
}
} );
no_backup.addItemListener( new ItemListener() {
public void itemStateChanged(ItemEvent e) {
Options.no_backup = no_backup.getState();
}
} );
dot.addItemListener( new ItemListener() {
public void itemStateChanged(ItemEvent e) {
Options.dot = dot.getState();
}
} );
legacy_dot.addItemListener( new ItemListener() {
public void itemStateChanged(ItemEvent e) {
Options.legacy_dot = legacy_dot.getState();
}
} );
time.addItemListener( new ItemListener() {
public void itemStateChanged(ItemEvent e) {
Options.time = time.getState();
}
} );
input_stream_ctor.addItemListener( new ItemListener() {
public void itemStateChanged(ItemEvent e) {
Options.emitInputStreamCtor = input_stream_ctor.getState();
}
});
// setup layout
GridPanel panel = new GridPanel(4,7,10,10);
panel.setInsets( new Insets(10,5,5,10) );
panel.add(3,0,ok);
panel.add(3,1,defaults);
panel.add(0,0,2,1,Handles.BOTTOM,new Label("skeleton file:"));
panel.add(0,1,2,1,skelFile);
panel.add(2,1,1,1,Handles.TOP, skelBrowse);
panel.add(0,2,1,1,Handles.BOTTOM,new Label("code:"));
panel.add(0,3,1,1,tableG);
panel.add(0,4,1,1,switchG);
panel.add(0,5,1,1,packG);
panel.add(0,6,4,1,legacy_dot);
panel.add(1,3,1,1,dump);
panel.add(1,4,1,1,verbose);
panel.add(1,5,1,1,time);
panel.add(2,3,1,1,no_minimize);
panel.add(2,4,1,1,no_backup);
panel.add(2,5,1,1,input_stream_ctor);
panel.add(3,3,1,1,jlex);
panel.add(3,4,1,1,dot);
add("Center", panel);
updateState();
}
private void skelBrowse() {
FileDialog d = new FileDialog(owner , "Choose file", FileDialog.LOAD);
d.setVisible(true);
if (d.getFile() != null) {
File skel = new File(d.getDirectory()+d.getFile());
try {
Skeleton.readSkelFile(skel);
skelFile.setText(skel.toString());
}
catch (GeneratorException e) {
// do nothing
}
}
}
private void setGenMethod() {
if ( tableG.getState() ) {
Options.gen_method = Options.TABLE;
return;
}
if ( switchG.getState() ) {
Options.gen_method = Options.SWITCH;
return;
}
if ( packG.getState() ) {
Options.gen_method = Options.PACK;
return;
}
}
private void updateState() {
tableG.setState(Options.gen_method == Options.TABLE);
switchG.setState(Options.gen_method == Options.SWITCH);
packG.setState(Options.gen_method == Options.PACK);
legacy_dot.setState(Options.legacy_dot);
dump.setState(Options.dump);
verbose.setState(Options.verbose);
time.setState(Options.time);
no_minimize.setState(Options.no_minimize);
no_backup.setState(Options.no_backup);
input_stream_ctor.setState(Options.emitInputStreamCtor);
jlex.setState(Options.jlex);
dot.setState(Options.dot);
}
private void setDefaults() {
Options.setDefaults();
Skeleton.readDefault();
skelFile.setText("");
updateState();
legacy_dot.setEnabled(!jlex.getState());
}
public void close() {
setVisible(false);
}
}
| [
"mbasirati@gmail.com"
] | mbasirati@gmail.com |
51a0ffca842d52f70aa1c6b0dfd5920f05a87709 | b3a694913d943bdb565fbf828d6ab8a08dd7dd12 | /sources/p124p/p185r/C1657a.java | 1025f93160c215706244f7f313bf2e6cd750b036 | [] | no_license | v1ckxy/radar-covid | feea41283bde8a0b37fbc9132c9fa5df40d76cc4 | 8acb96f8ccd979f03db3c6dbfdf162d66ad6ac5a | refs/heads/master | 2022-12-06T11:29:19.567919 | 2020-08-29T08:00:19 | 2020-08-29T08:00:19 | 294,198,796 | 1 | 0 | null | 2020-09-09T18:39:43 | 2020-09-09T18:39:43 | null | UTF-8 | Java | false | false | 723 | java | package p124p.p185r;
import android.annotation.SuppressLint;
import android.os.Bundle;
import p124p.p137c.p138a.p140b.C1235b;
@SuppressLint({"RestrictedApi"})
/* renamed from: p.r.a */
public final class C1657a {
/* renamed from: a */
public C1235b<String, C1659b> f4892a = new C1235b<>();
/* renamed from: b */
public Bundle f4893b;
/* renamed from: c */
public boolean f4894c;
/* renamed from: d */
public boolean f4895d;
/* renamed from: p.r.a$a */
public interface C1658a {
/* renamed from: a */
void mo6459a(C1661c cVar);
}
/* renamed from: p.r.a$b */
public interface C1659b {
/* renamed from: a */
Bundle mo6460a();
}
}
| [
"josemmoya@outlook.com"
] | josemmoya@outlook.com |
aaa164f130258e86890002af8512a4a0d0a78bc8 | 5969dccc7ca5763c378429cfba822b544493ac19 | /src/edu/sysuedaily/utils/DataGetter.java | 111d873ed740a94b859b1a500c8f41ef5418ac3f | [] | no_license | FrankChanCQF/eDaily | 115063813bc3e6d20b65c89884344d8bd85cb537 | 3526b1e5c3045ea2998844481fcca1e8f743b9e5 | refs/heads/master | 2021-01-22T05:20:34.986313 | 2012-09-14T06:08:42 | 2012-09-14T06:08:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,504 | java | package edu.sysuedaily.utils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONException;
import org.json.JSONObject;
import android.os.AsyncTask;
public abstract class DataGetter {
protected static String SERVER_ADDR = "";
URL url;
public DataGetter(String urlstr) {
url = null;
try {
url = new URL(urlstr);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
abstract public void getListData(int page, int pageSize,
OnCompleteListener listener);
abstract public void getData(int id, OnCompleteListener listener);
public interface OnCompleteListener {
public void onComplete(Object data);
}
protected class DataParams {
JSONObject jsonObject;
public DataParams() {
jsonObject = new JSONObject();
}
public void put(String key, Object value) {
try {
jsonObject.put(key, value);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public JSONObject getJSONObject() {
return jsonObject;
}
}
abstract protected class DataAsyncGetter extends
AsyncTask<DataParams, Void, JSONObject> {
@Override
protected JSONObject doInBackground(DataParams... params) {
JSONObject result = null;
try {
HttpsURLConnection connection = (HttpsURLConnection) url
.openConnection();
connection.setRequestMethod("GET");
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestProperty("Content-type", "text/json");
connection.connect();
PrintWriter writer = new PrintWriter(
connection.getOutputStream());
writer.print("data="
+ URLEncoder.encode(params[0].getJSONObject().toString()));
writer.flush();
InputStreamReader reader = new InputStreamReader(
connection.getInputStream());
BufferedReader bufferedReader = new BufferedReader(reader);
String ret = bufferedReader.readLine();
result = new JSONObject(ret);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
@Override
abstract protected void onPostExecute(JSONObject result);
}
}
| [
"zonyitoo@gmail.com"
] | zonyitoo@gmail.com |
f2f69daf659cab7039e5b3dd1b999a163677942c | d58e55d6da68613e8cb2817ddeb487143d011fdd | /src/main/java/event/demo/domain/EventExample.java | ca64952853395d926886a82929ddd62fd912d0fd | [] | no_license | Assisiwjj/event-api | f02cf5698d4d07c6ee3ec1ba01ad339717550867 | eeeea2d64c80ddca137f1da6c6fccdbd6127b66c | refs/heads/master | 2020-05-15T15:50:21.960010 | 2019-04-20T08:23:59 | 2019-04-20T08:23:59 | 182,380,208 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 28,077 | java | package event.demo.domain;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class EventExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
private Integer limit;
private Integer offset;
public EventExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public Integer getLimit() {
return limit;
}
public void setOffset(Integer offset) {
this.offset = offset;
}
public Integer getOffset() {
return offset;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andPkIdIsNull() {
addCriterion("pk_id is null");
return (Criteria) this;
}
public Criteria andPkIdIsNotNull() {
addCriterion("pk_id is not null");
return (Criteria) this;
}
public Criteria andPkIdEqualTo(Long value) {
addCriterion("pk_id =", value, "pkId");
return (Criteria) this;
}
public Criteria andPkIdNotEqualTo(Long value) {
addCriterion("pk_id <>", value, "pkId");
return (Criteria) this;
}
public Criteria andPkIdGreaterThan(Long value) {
addCriterion("pk_id >", value, "pkId");
return (Criteria) this;
}
public Criteria andPkIdGreaterThanOrEqualTo(Long value) {
addCriterion("pk_id >=", value, "pkId");
return (Criteria) this;
}
public Criteria andPkIdLessThan(Long value) {
addCriterion("pk_id <", value, "pkId");
return (Criteria) this;
}
public Criteria andPkIdLessThanOrEqualTo(Long value) {
addCriterion("pk_id <=", value, "pkId");
return (Criteria) this;
}
public Criteria andPkIdIn(List<Long> values) {
addCriterion("pk_id in", values, "pkId");
return (Criteria) this;
}
public Criteria andPkIdNotIn(List<Long> values) {
addCriterion("pk_id not in", values, "pkId");
return (Criteria) this;
}
public Criteria andPkIdBetween(Long value1, Long value2) {
addCriterion("pk_id between", value1, value2, "pkId");
return (Criteria) this;
}
public Criteria andPkIdNotBetween(Long value1, Long value2) {
addCriterion("pk_id not between", value1, value2, "pkId");
return (Criteria) this;
}
public Criteria andEventIdIsNull() {
addCriterion("event_id is null");
return (Criteria) this;
}
public Criteria andEventIdIsNotNull() {
addCriterion("event_id is not null");
return (Criteria) this;
}
public Criteria andEventIdEqualTo(String value) {
addCriterion("event_id =", value, "eventId");
return (Criteria) this;
}
public Criteria andEventIdNotEqualTo(String value) {
addCriterion("event_id <>", value, "eventId");
return (Criteria) this;
}
public Criteria andEventIdGreaterThan(String value) {
addCriterion("event_id >", value, "eventId");
return (Criteria) this;
}
public Criteria andEventIdGreaterThanOrEqualTo(String value) {
addCriterion("event_id >=", value, "eventId");
return (Criteria) this;
}
public Criteria andEventIdLessThan(String value) {
addCriterion("event_id <", value, "eventId");
return (Criteria) this;
}
public Criteria andEventIdLessThanOrEqualTo(String value) {
addCriterion("event_id <=", value, "eventId");
return (Criteria) this;
}
public Criteria andEventIdLike(String value) {
addCriterion("event_id like", value, "eventId");
return (Criteria) this;
}
public Criteria andEventIdNotLike(String value) {
addCriterion("event_id not like", value, "eventId");
return (Criteria) this;
}
public Criteria andEventIdIn(List<String> values) {
addCriterion("event_id in", values, "eventId");
return (Criteria) this;
}
public Criteria andEventIdNotIn(List<String> values) {
addCriterion("event_id not in", values, "eventId");
return (Criteria) this;
}
public Criteria andEventIdBetween(String value1, String value2) {
addCriterion("event_id between", value1, value2, "eventId");
return (Criteria) this;
}
public Criteria andEventIdNotBetween(String value1, String value2) {
addCriterion("event_id not between", value1, value2, "eventId");
return (Criteria) this;
}
public Criteria andEventIsNull() {
addCriterion("event is null");
return (Criteria) this;
}
public Criteria andEventIsNotNull() {
addCriterion("event is not null");
return (Criteria) this;
}
public Criteria andEventEqualTo(String value) {
addCriterion("event =", value, "event");
return (Criteria) this;
}
public Criteria andEventNotEqualTo(String value) {
addCriterion("event <>", value, "event");
return (Criteria) this;
}
public Criteria andEventGreaterThan(String value) {
addCriterion("event >", value, "event");
return (Criteria) this;
}
public Criteria andEventGreaterThanOrEqualTo(String value) {
addCriterion("event >=", value, "event");
return (Criteria) this;
}
public Criteria andEventLessThan(String value) {
addCriterion("event <", value, "event");
return (Criteria) this;
}
public Criteria andEventLessThanOrEqualTo(String value) {
addCriterion("event <=", value, "event");
return (Criteria) this;
}
public Criteria andEventLike(String value) {
addCriterion("event like", value, "event");
return (Criteria) this;
}
public Criteria andEventNotLike(String value) {
addCriterion("event not like", value, "event");
return (Criteria) this;
}
public Criteria andEventIn(List<String> values) {
addCriterion("event in", values, "event");
return (Criteria) this;
}
public Criteria andEventNotIn(List<String> values) {
addCriterion("event not in", values, "event");
return (Criteria) this;
}
public Criteria andEventBetween(String value1, String value2) {
addCriterion("event between", value1, value2, "event");
return (Criteria) this;
}
public Criteria andEventNotBetween(String value1, String value2) {
addCriterion("event not between", value1, value2, "event");
return (Criteria) this;
}
public Criteria andProjectIdIsNull() {
addCriterion("project_id is null");
return (Criteria) this;
}
public Criteria andProjectIdIsNotNull() {
addCriterion("project_id is not null");
return (Criteria) this;
}
public Criteria andProjectIdEqualTo(String value) {
addCriterion("project_id =", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotEqualTo(String value) {
addCriterion("project_id <>", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThan(String value) {
addCriterion("project_id >", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdGreaterThanOrEqualTo(String value) {
addCriterion("project_id >=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThan(String value) {
addCriterion("project_id <", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLessThanOrEqualTo(String value) {
addCriterion("project_id <=", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdLike(String value) {
addCriterion("project_id like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotLike(String value) {
addCriterion("project_id not like", value, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdIn(List<String> values) {
addCriterion("project_id in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotIn(List<String> values) {
addCriterion("project_id not in", values, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdBetween(String value1, String value2) {
addCriterion("project_id between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andProjectIdNotBetween(String value1, String value2) {
addCriterion("project_id not between", value1, value2, "projectId");
return (Criteria) this;
}
public Criteria andProjectNameIsNull() {
addCriterion("project_name is null");
return (Criteria) this;
}
public Criteria andProjectNameIsNotNull() {
addCriterion("project_name is not null");
return (Criteria) this;
}
public Criteria andProjectNameEqualTo(String value) {
addCriterion("project_name =", value, "projectName");
return (Criteria) this;
}
public Criteria andProjectNameNotEqualTo(String value) {
addCriterion("project_name <>", value, "projectName");
return (Criteria) this;
}
public Criteria andProjectNameGreaterThan(String value) {
addCriterion("project_name >", value, "projectName");
return (Criteria) this;
}
public Criteria andProjectNameGreaterThanOrEqualTo(String value) {
addCriterion("project_name >=", value, "projectName");
return (Criteria) this;
}
public Criteria andProjectNameLessThan(String value) {
addCriterion("project_name <", value, "projectName");
return (Criteria) this;
}
public Criteria andProjectNameLessThanOrEqualTo(String value) {
addCriterion("project_name <=", value, "projectName");
return (Criteria) this;
}
public Criteria andProjectNameLike(String value) {
addCriterion("project_name like", value, "projectName");
return (Criteria) this;
}
public Criteria andProjectNameNotLike(String value) {
addCriterion("project_name not like", value, "projectName");
return (Criteria) this;
}
public Criteria andProjectNameIn(List<String> values) {
addCriterion("project_name in", values, "projectName");
return (Criteria) this;
}
public Criteria andProjectNameNotIn(List<String> values) {
addCriterion("project_name not in", values, "projectName");
return (Criteria) this;
}
public Criteria andProjectNameBetween(String value1, String value2) {
addCriterion("project_name between", value1, value2, "projectName");
return (Criteria) this;
}
public Criteria andProjectNameNotBetween(String value1, String value2) {
addCriterion("project_name not between", value1, value2, "projectName");
return (Criteria) this;
}
public Criteria andAttrIsNull() {
addCriterion("attr is null");
return (Criteria) this;
}
public Criteria andAttrIsNotNull() {
addCriterion("attr is not null");
return (Criteria) this;
}
public Criteria andAttrEqualTo(String value) {
addCriterion("attr =", value, "attr");
return (Criteria) this;
}
public Criteria andAttrNotEqualTo(String value) {
addCriterion("attr <>", value, "attr");
return (Criteria) this;
}
public Criteria andAttrGreaterThan(String value) {
addCriterion("attr >", value, "attr");
return (Criteria) this;
}
public Criteria andAttrGreaterThanOrEqualTo(String value) {
addCriterion("attr >=", value, "attr");
return (Criteria) this;
}
public Criteria andAttrLessThan(String value) {
addCriterion("attr <", value, "attr");
return (Criteria) this;
}
public Criteria andAttrLessThanOrEqualTo(String value) {
addCriterion("attr <=", value, "attr");
return (Criteria) this;
}
public Criteria andAttrLike(String value) {
addCriterion("attr like", value, "attr");
return (Criteria) this;
}
public Criteria andAttrNotLike(String value) {
addCriterion("attr not like", value, "attr");
return (Criteria) this;
}
public Criteria andAttrIn(List<String> values) {
addCriterion("attr in", values, "attr");
return (Criteria) this;
}
public Criteria andAttrNotIn(List<String> values) {
addCriterion("attr not in", values, "attr");
return (Criteria) this;
}
public Criteria andAttrBetween(String value1, String value2) {
addCriterion("attr between", value1, value2, "attr");
return (Criteria) this;
}
public Criteria andAttrNotBetween(String value1, String value2) {
addCriterion("attr not between", value1, value2, "attr");
return (Criteria) this;
}
public Criteria andUrlIsNull() {
addCriterion("url is null");
return (Criteria) this;
}
public Criteria andUrlIsNotNull() {
addCriterion("url is not null");
return (Criteria) this;
}
public Criteria andUrlEqualTo(String value) {
addCriterion("url =", value, "url");
return (Criteria) this;
}
public Criteria andUrlNotEqualTo(String value) {
addCriterion("url <>", value, "url");
return (Criteria) this;
}
public Criteria andUrlGreaterThan(String value) {
addCriterion("url >", value, "url");
return (Criteria) this;
}
public Criteria andUrlGreaterThanOrEqualTo(String value) {
addCriterion("url >=", value, "url");
return (Criteria) this;
}
public Criteria andUrlLessThan(String value) {
addCriterion("url <", value, "url");
return (Criteria) this;
}
public Criteria andUrlLessThanOrEqualTo(String value) {
addCriterion("url <=", value, "url");
return (Criteria) this;
}
public Criteria andUrlLike(String value) {
addCriterion("url like", value, "url");
return (Criteria) this;
}
public Criteria andUrlNotLike(String value) {
addCriterion("url not like", value, "url");
return (Criteria) this;
}
public Criteria andUrlIn(List<String> values) {
addCriterion("url in", values, "url");
return (Criteria) this;
}
public Criteria andUrlNotIn(List<String> values) {
addCriterion("url not in", values, "url");
return (Criteria) this;
}
public Criteria andUrlBetween(String value1, String value2) {
addCriterion("url between", value1, value2, "url");
return (Criteria) this;
}
public Criteria andUrlNotBetween(String value1, String value2) {
addCriterion("url not between", value1, value2, "url");
return (Criteria) this;
}
public Criteria andPropertiesIsNull() {
addCriterion("properties is null");
return (Criteria) this;
}
public Criteria andPropertiesIsNotNull() {
addCriterion("properties is not null");
return (Criteria) this;
}
public Criteria andPropertiesEqualTo(String value) {
addCriterion("properties =", value, "properties");
return (Criteria) this;
}
public Criteria andPropertiesNotEqualTo(String value) {
addCriterion("properties <>", value, "properties");
return (Criteria) this;
}
public Criteria andPropertiesGreaterThan(String value) {
addCriterion("properties >", value, "properties");
return (Criteria) this;
}
public Criteria andPropertiesGreaterThanOrEqualTo(String value) {
addCriterion("properties >=", value, "properties");
return (Criteria) this;
}
public Criteria andPropertiesLessThan(String value) {
addCriterion("properties <", value, "properties");
return (Criteria) this;
}
public Criteria andPropertiesLessThanOrEqualTo(String value) {
addCriterion("properties <=", value, "properties");
return (Criteria) this;
}
public Criteria andPropertiesLike(String value) {
addCriterion("properties like", value, "properties");
return (Criteria) this;
}
public Criteria andPropertiesNotLike(String value) {
addCriterion("properties not like", value, "properties");
return (Criteria) this;
}
public Criteria andPropertiesIn(List<String> values) {
addCriterion("properties in", values, "properties");
return (Criteria) this;
}
public Criteria andPropertiesNotIn(List<String> values) {
addCriterion("properties not in", values, "properties");
return (Criteria) this;
}
public Criteria andPropertiesBetween(String value1, String value2) {
addCriterion("properties between", value1, value2, "properties");
return (Criteria) this;
}
public Criteria andPropertiesNotBetween(String value1, String value2) {
addCriterion("properties not between", value1, value2, "properties");
return (Criteria) this;
}
public Criteria andGmtCreateIsNull() {
addCriterion("gmt_create is null");
return (Criteria) this;
}
public Criteria andGmtCreateIsNotNull() {
addCriterion("gmt_create is not null");
return (Criteria) this;
}
public Criteria andGmtCreateEqualTo(Date value) {
addCriterion("gmt_create =", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateNotEqualTo(Date value) {
addCriterion("gmt_create <>", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateGreaterThan(Date value) {
addCriterion("gmt_create >", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateGreaterThanOrEqualTo(Date value) {
addCriterion("gmt_create >=", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateLessThan(Date value) {
addCriterion("gmt_create <", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateLessThanOrEqualTo(Date value) {
addCriterion("gmt_create <=", value, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateIn(List<Date> values) {
addCriterion("gmt_create in", values, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateNotIn(List<Date> values) {
addCriterion("gmt_create not in", values, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateBetween(Date value1, Date value2) {
addCriterion("gmt_create between", value1, value2, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtCreateNotBetween(Date value1, Date value2) {
addCriterion("gmt_create not between", value1, value2, "gmtCreate");
return (Criteria) this;
}
public Criteria andGmtModifiedIsNull() {
addCriterion("gmt_modified is null");
return (Criteria) this;
}
public Criteria andGmtModifiedIsNotNull() {
addCriterion("gmt_modified is not null");
return (Criteria) this;
}
public Criteria andGmtModifiedEqualTo(Date value) {
addCriterion("gmt_modified =", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedNotEqualTo(Date value) {
addCriterion("gmt_modified <>", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedGreaterThan(Date value) {
addCriterion("gmt_modified >", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedGreaterThanOrEqualTo(Date value) {
addCriterion("gmt_modified >=", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedLessThan(Date value) {
addCriterion("gmt_modified <", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedLessThanOrEqualTo(Date value) {
addCriterion("gmt_modified <=", value, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedIn(List<Date> values) {
addCriterion("gmt_modified in", values, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedNotIn(List<Date> values) {
addCriterion("gmt_modified not in", values, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedBetween(Date value1, Date value2) {
addCriterion("gmt_modified between", value1, value2, "gmtModified");
return (Criteria) this;
}
public Criteria andGmtModifiedNotBetween(Date value1, Date value2) {
addCriterion("gmt_modified not between", value1, value2, "gmtModified");
return (Criteria) this;
}
}
/**
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"390424697@qq.com"
] | 390424697@qq.com |
c646b52025d1f4dec46eaca1d946c1b3e0bcc5b5 | e53daa94a988135b8b1379c2a1e19e25bb045091 | /cp_movie/app/src/main/java/com/uyt/ying/yuan/uuuu/iuymn/mkjnb/model/UsingEquipmentEntity.java | e86e64b45a64aaadca112d720d0e919f8f757a4a | [] | no_license | 2020xiaotu/trunk | f90c9bf15c9000a1bb18c7c0a3c0a96d4daf8e68 | ba19836c64828c2994e1f0db22fb5d26b4a014f5 | refs/heads/master | 2023-08-27T08:10:41.709940 | 2021-10-05T06:27:12 | 2021-10-05T06:27:12 | 413,684,673 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,062 | java | package com.uyt.ying.yuan.uuuu.iuymn.mkjnb.model;
import java.util.List;
public class UsingEquipmentEntity {
/**
* message : success
* medalInfoType_2 : []
* medalInfoType_1 : []
* sysGrade : {"createdDate":1609415957000,"createdUser":"qixi","growthIntegral":900,"id":10,"image":"upload/images/20201231/1609415926818.png","isDelete":0,"name":"小财主",CommonStr.GRADE:6,"speechIntervalSeconds":2,"txImage":""}
* status : success
* medalInfoType_0 : [{"image":"upload/images/20201231/1609380977400.png","name":"奥拓","type":0}]
*/
private String message;
/**
* createdDate : 1609415957000
* createdUser : qixi
* growthIntegral : 900.0
* id : 10
* image : upload/images/20201231/1609415926818.png
* isDelete : 0
* name : 小财主
* pointGrade : 6
* speechIntervalSeconds : 2
* txImage :
*/
private SysGradeBean sysGrade;
private String status;
private List<MedalInfoType2Bean> medalInfoType_2;
private List<MedalInfoType1Bean> medalInfoType_1;
/**
* image : upload/images/20201231/1609380977400.png
* name : 奥拓
* type : 0
*/
private List<MedalInfoType0Bean> medalInfoType_0;
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public SysGradeBean getSysGrade() {
return sysGrade;
}
public void setSysGrade(SysGradeBean sysGrade) {
this.sysGrade = sysGrade;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public List<MedalInfoType2Bean> getMedalInfoType_2() {
return medalInfoType_2;
}
public void setMedalInfoType_2(List<MedalInfoType2Bean> medalInfoType_2) {
this.medalInfoType_2 = medalInfoType_2;
}
public List<MedalInfoType1Bean> getMedalInfoType_1() {
return medalInfoType_1;
}
public void setMedalInfoType_1(List<MedalInfoType1Bean> medalInfoType_1) {
this.medalInfoType_1 = medalInfoType_1;
}
public List<MedalInfoType0Bean> getMedalInfoType_0() {
return medalInfoType_0;
}
public void setMedalInfoType_0(List<MedalInfoType0Bean> medalInfoType_0) {
this.medalInfoType_0 = medalInfoType_0;
}
public static class SysGradeBean {
private long createdDate;
private String createdUser;
private String growthIntegral;
private String id;
private String image;
private String isDelete;
private String name;
private String pointGrade;
private String speechIntervalSeconds;
private String txImage;
public long getCreatedDate() {
return createdDate;
}
public void setCreatedDate(long createdDate) {
this.createdDate = createdDate;
}
public String getCreatedUser() {
return createdUser;
}
public void setCreatedUser(String createdUser) {
this.createdUser = createdUser;
}
public String getGrowthIntegral() {
return growthIntegral;
}
public void setGrowthIntegral(String growthIntegral) {
this.growthIntegral = growthIntegral;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getIsDelete() {
return isDelete;
}
public void setIsDelete(String isDelete) {
this.isDelete = isDelete;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPointGrade() {
return pointGrade;
}
public void setPointGrade(String pointGrade) {
this.pointGrade = pointGrade;
}
public String getSpeechIntervalSeconds() {
return speechIntervalSeconds;
}
public void setSpeechIntervalSeconds(String speechIntervalSeconds) {
this.speechIntervalSeconds = speechIntervalSeconds;
}
public String getTxImage() {
return txImage;
}
public void setTxImage(String txImage) {
this.txImage = txImage;
}
}
public static class MedalInfoType0Bean {
private String image;
private String name;
private String type;
private String txImage;
public String getImage() {
return image;
}
public String getTxImage() {
return txImage;
}
public void setTxImage(String txImage) {
this.txImage = txImage;
}
public void setImage(String image) {
this.image = image;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
public static class MedalInfoType1Bean {
private String image;
private String name;
private String type;
private String txImage;
public String getImage() {
return image;
}
public String getTxImage() {
return txImage;
}
public void setTxImage(String txImage) {
this.txImage = txImage;
}
public void setImage(String image) {
this.image = image;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
public static class MedalInfoType2Bean {
private String image;
private String name;
private String type;
private String txImage;
public String getTxImage() {
return txImage;
}
public void setTxImage(String txImage) {
this.txImage = txImage;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
}
| [
"xiaotu20201016@gmail.com"
] | xiaotu20201016@gmail.com |
cd26b1e6755869ec8d077a355fe13dd6a9f5bead | f4a8c96137395a436c212b751f4f50ebf98fb30a | /src/main/java/org/mybatis/generator/api/dom/java/Claxx.java | a08b2eca0c74f35732540caceaf1eca71ba57035 | [] | no_license | lujun920/mybatis-generator-gui | 5f948e01a2f1477091aaff95bf0c97087758899d | bcb58046a1df7e9ad690fc13f8676c49db4da0b5 | refs/heads/master | 2022-06-22T09:06:33.238145 | 2020-03-04T08:56:44 | 2020-03-04T08:56:44 | 153,235,440 | 0 | 0 | null | 2022-06-17T01:59:59 | 2018-10-16T06:42:00 | Java | UTF-8 | Java | false | false | 6,133 | java | /**
* Copyright 2006-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mybatis.generator.api.dom.java;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import static org.mybatis.generator.api.dom.OutputUtilities.calculateImports;
import static org.mybatis.generator.api.dom.OutputUtilities.newLine;
import static org.mybatis.generator.internal.util.StringUtility.stringHasValue;
/**
* The Class Interface.
*
* @author Jeff Butler
*/
public class Claxx extends InnerClass implements CompilationUnit{
/** The imported types. */
private Set<FullyQualifiedJavaType> importedTypes;
/** The static imports. */
private Set<String> staticImports;
/** The file comment lines. */
private List<String> fileCommentLines;
/**
* Instantiates a new top level class.
*
* @param type
* the type
*/
public Claxx(FullyQualifiedJavaType type) {
super(type);
importedTypes = new TreeSet<FullyQualifiedJavaType>();
fileCommentLines = new ArrayList<String>();
staticImports = new TreeSet<String>();
}
/**
* Instantiates a new top level class.
*
* @param typeName
* the type name
*/
public Claxx(String typeName) {
this(new FullyQualifiedJavaType(typeName));
}
/**
* Gets the imported types.
*
* @return Returns the importedTypes.
*/
@Override
public Set<FullyQualifiedJavaType> getImportedTypes() {
return Collections.unmodifiableSet(importedTypes);
}
/**
* Adds the imported type.
*
* @param importedType
* the imported type
*/
public void addImportedType(String importedType) {
addImportedType(new FullyQualifiedJavaType(importedType));
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.dom.java.CompilationUnit#addImportedType(org.mybatis.generator.api.dom.java.FullyQualifiedJavaType)
*/
@Override
public void addImportedType(FullyQualifiedJavaType importedType) {
if (importedType != null
&& importedType.isExplicitlyImported()
&& !importedType.getPackageName().equals(
getType().getPackageName())
&& !importedType.getShortName().equals(getType().getShortName())) {
importedTypes.add(importedType);
}
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.dom.java.CompilationUnit#getFormattedContent()
*/
@Override
public String getFormattedContent() {
StringBuilder sb = new StringBuilder();
for (String fileCommentLine : fileCommentLines) {
sb.append(fileCommentLine);
newLine(sb);
}
if (stringHasValue(getType().getPackageName())) {
sb.append("package "); //$NON-NLS-1$
sb.append(getType().getPackageName());
sb.append(';');
newLine(sb);
newLine(sb);
}
for (String staticImport : staticImports) {
sb.append("import static "); //$NON-NLS-1$
sb.append(staticImport);
sb.append(';');
newLine(sb);
}
if (staticImports.size() > 0) {
newLine(sb);
}
Set<String> importStrings = calculateImports(importedTypes);
for (String importString : importStrings) {
sb.append(importString);
newLine(sb);
}
if (importStrings.size() > 0) {
newLine(sb);
}
sb.append(super.getFormattedContent(0, this));
return sb.toString();
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.dom.java.CompilationUnit#isJavaInterface()
*/
@Override
public boolean isJavaInterface() {
return false;
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.dom.java.CompilationUnit#isJavaEnumeration()
*/
@Override
public boolean isJavaEnumeration() {
return false;
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.dom.java.CompilationUnit#addFileCommentLine(java.lang.String)
*/
@Override
public void addFileCommentLine(String commentLine) {
fileCommentLines.add(commentLine);
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.dom.java.CompilationUnit#getFileCommentLines()
*/
@Override
public List<String> getFileCommentLines() {
return fileCommentLines;
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.dom.java.CompilationUnit#addImportedTypes(java.util.Set)
*/
@Override
public void addImportedTypes(Set<FullyQualifiedJavaType> importedTypes) {
this.importedTypes.addAll(importedTypes);
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.dom.java.CompilationUnit#getStaticImports()
*/
@Override
public Set<String> getStaticImports() {
return staticImports;
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.dom.java.CompilationUnit#addStaticImport(java.lang.String)
*/
@Override
public void addStaticImport(String staticImport) {
staticImports.add(staticImport);
}
/* (non-Javadoc)
* @see org.mybatis.generator.api.dom.java.CompilationUnit#addStaticImports(java.util.Set)
*/
@Override
public void addStaticImports(Set<String> staticImports) {
this.staticImports.addAll(staticImports);
}
}
| [
"baizhang@dian.so"
] | baizhang@dian.so |
e3cffe567c16c48bedf0f8fa5417ad4fbf9ee47b | b6d72aee5eea18b3e4203b32fae4b71a458376d8 | /odsmaster/dom/src/main/java/com/wipro/wess/ods/asset/servicemapping/OmAssetOutputservice.java | 33a7040afbde216de4ce233495e530bb1ca8b6f7 | [] | no_license | Ranganath233/odsmaster | 60c4de59dcd4ae33db89ad69adc451811e2065ef | b50da2ac785583698fce05152d4a9550d47d540d | refs/heads/master | 2020-05-24T13:07:36.769834 | 2014-08-22T17:14:30 | 2014-08-22T17:14:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,271 | java | package com.wipro.wess.ods.asset.servicemapping;
// Generated Jan 7, 2014 12:15:31 PM by Hibernate Tools 3.2.2.GA
import java.util.Date;
import java.util.List;
import javax.jdo.InstanceCallbacks;
import javax.jdo.annotations.Column;
import javax.jdo.annotations.Columns;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.Persistent;
import org.apache.isis.applib.DomainObjectContainer;
import org.apache.isis.applib.annotation.Audited;
import org.apache.isis.applib.annotation.Bookmarkable;
import org.apache.isis.applib.annotation.Bulk;
import org.apache.isis.applib.annotation.CssClass;
import org.apache.isis.applib.annotation.Hidden;
import org.apache.isis.applib.annotation.Mandatory;
import org.apache.isis.applib.annotation.Named;
import org.apache.isis.applib.annotation.ObjectType;
import org.apache.isis.applib.annotation.Title;
import org.apache.isis.applib.annotation.Where;
import com.wipro.wess.ods.asset.OmAsset;
import com.wipro.wess.ods.organisation.MOrganisation;
import com.wipro.wess.ods.service.OmServiceConfig;
/**
* OmAssetOutputservice generated by hbm2java
*/
@Named("AssetOutputservice")
@Bookmarkable
@Audited
@ObjectType("OmAssetOutputservice")
@javax.jdo.annotations.PersistenceCapable(schema = "gemsods", table = "om_asset_outputservice", objectIdClass = OmAssetOutputservicePK.class, identityType = IdentityType.APPLICATION)
@javax.jdo.annotations.Queries({
@javax.jdo.annotations.Query(name = "fetch_OmAssetOutputservice_by_pk", language = "JDOQL", value = "SELECT "
+ " OmAssetOutputservice FROM com.wipro.wess.ods.asset.servicemapping.OmAssetOutputservice OmAssetOutputservice WHERE orgId == :orgId && assetUid == :assetUid && "
+ " outputserviceAssetUid == :outputserviceAssetUid"),
@javax.jdo.annotations.Query(name = "fetch_output_services_by_user", language = "JPQL", value = "SELECT service FROM com.wipro.wess.ods.asset.servicemapping.OmAssetOutputservice service "
+ " JOIN service.assetUid asset "
+ " JOIN asset.omLocationHierarchy loc_hcy "
+ " JOIN loc_hcy.omSite site WHERE EXISTS "
+ " (SELECT 1 FROM com.wipro.wess.pdm.security.OmPermission permission WHERE permission.site = site AND permission IN "
+ " (SELECT "
+ " OmRolesPermissions.permission FROM com.wipro.wess.pdm.security.OmRolesPermissions OmRolesPermissions "
+ " WHERE role IN ( SELECT OmUsersRoles.role FROM com.wipro.wess.pdm.security.OmUsersRoles OmUsersRoles WHERE OmUsersRoles.user.userName = :userName) ) ) ") })
public class OmAssetOutputservice implements java.io.Serializable, InstanceCallbacks {
/**
*
*/
private static final long serialVersionUID = -1471724595261044062L;
private MOrganisation orgId;
private OmAsset assetUid;
private OmServiceConfig outputserviceAssetUid;
private int rowseqId;
private String monitoringAssetUid;
private String description;
private Long sourceId;
private String changeby;
private Date changedt;
private Long loadbatch;
private Date loaddate;
private String configUser;
public OmAssetOutputservice() {
}
public OmAssetOutputservice(int rowseqId, Date changedt) {
this.rowseqId = rowseqId;
this.changedt = changedt;
}
public OmAssetOutputservice(int rowseqId, String monitoringAssetUid, String description, Long sourceId,
String changeby, Date changedt, Long loadbatch, Date loaddate) {
this.rowseqId = rowseqId;
this.monitoringAssetUid = monitoringAssetUid;
this.description = description;
this.sourceId = sourceId;
this.changeby = changeby;
this.changedt = changedt;
this.loadbatch = loadbatch;
this.loaddate = loaddate;
}
@Column(allowsNull = "false", name = "org_id")
@Title
@Persistent(primaryKey = "true")
public MOrganisation getOrgId() {
return orgId;
}
public void setOrgId(MOrganisation orgId) {
this.orgId = orgId;
}
@Columns(value = { @Column(allowsNull = "false", name = "asset_uid"), @Column(name = "asset_org_id") })
@Title
@Persistent(primaryKey = "true")
@Mandatory
public OmAsset getAssetUid() {
return assetUid;
}
public void setAssetUid(OmAsset assetUid) {
this.assetUid = assetUid;
}
@Column(allowsNull = "false", name = "outputservice_asset_uid")
@Title
@Persistent(primaryKey = "true")
public OmServiceConfig getOutputserviceAssetUid() {
return outputserviceAssetUid;
}
public void setOutputserviceAssetUid(OmServiceConfig outputserviceAssetUid) {
this.outputserviceAssetUid = outputserviceAssetUid;
}
@Column(allowsNull = "false", name = "rowseq_id")
@Persistent(valueStrategy = IdGeneratorStrategy.INCREMENT)
@Hidden
public int getRowseqId() {
return this.rowseqId;
}
public void setRowseqId(int rowseqId) {
this.rowseqId = rowseqId;
}
@Column(name = "monitoring_asset_uid")
public String getMonitoringAssetUid() {
return this.monitoringAssetUid;
}
public void setMonitoringAssetUid(String monitoringAssetUid) {
this.monitoringAssetUid = monitoringAssetUid;
}
@Column(name = "description")
public String getDescription() {
return this.description;
}
public void setDescription(String description) {
this.description = description;
}
@Column(name = "source_id")
@Hidden(where = Where.ALL_TABLES)
public Long getSourceId() {
return this.sourceId;
}
public void setSourceId(Long sourceId) {
this.sourceId = sourceId;
}
@Column(allowsNull = "false", name = "changeby")
@Hidden
public String getChangeby() {
return this.changeby;
}
public void setChangeby(String changeby) {
this.changeby = changeby;
}
@Column(allowsNull = "false", name = "changedt")
@Hidden
public Date getChangedt() {
return this.changedt;
}
public void setChangedt(Date changedt) {
this.changedt = changedt;
}
@Column(name = "loadbatch")
@Hidden
public Long getLoadbatch() {
return this.loadbatch;
}
public void setLoadbatch(Long loadbatch) {
this.loadbatch = loadbatch;
}
@Column(name = "loaddate")
@Hidden
public Date getLoaddate() {
return this.loaddate;
}
public void setLoaddate(Date loaddate) {
this.loaddate = loaddate;
}
@Column(name = "config_user")
@Hidden(where = Where.EVERYWHERE)
public String getConfigUser() {
return configUser;
}
public void setConfigUser(String configUser) {
this.configUser = configUser;
}
private DomainObjectContainer container;
public void injectDomainObjectContainer(final DomainObjectContainer container) {
this.container = container;
}
public void jdoPostLoad() {
}
public void jdoPreClear() {
}
public void jdoPreStore() {
this.setChangeby(this.container.getUser().getName());
this.setChangedt(new Date());
this.setConfigUser(this.container.getUser().getName());
}
public void jdoPreDelete() {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((assetUid == null) ? 0 : assetUid.hashCode());
result = prime * result + ((orgId == null) ? 0 : orgId.hashCode());
result = prime * result + ((outputserviceAssetUid == null) ? 0 : outputserviceAssetUid.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
OmAssetOutputservice other = (OmAssetOutputservice) obj;
if (assetUid == null) {
if (other.assetUid != null)
return false;
} else if (!assetUid.equals(other.assetUid))
return false;
if (orgId == null) {
if (other.orgId != null)
return false;
} else if (!orgId.equals(other.orgId))
return false;
if (outputserviceAssetUid == null) {
if (other.outputserviceAssetUid != null)
return false;
} else if (!outputserviceAssetUid.equals(other.outputserviceAssetUid))
return false;
return true;
}
private AssetServiceMappingService assetServiceMappingService;
public void injectAssetServiceMappingService(AssetServiceMappingService assetServiceMappingService) {
this.assetServiceMappingService = assetServiceMappingService;
}
@Bulk
@CssClass("x-caution")
public List<OmAssetOutputservice> delete() {
this.container.removeIfNotAlready(this);
this.container.informUser("Deleted " + container.titleOf(this));
return this.assetServiceMappingService.listAllAssetOutputServices();
}
}
| [
"chittari.varma@wipro.com"
] | chittari.varma@wipro.com |
74f71bd97c0393e5eddd351257a7ebb5be74608f | eaa16dc31b897791be72ee331f60b7c58db6f1c3 | /src/ru/fizteh/fivt/students/asaitgalin/multifilehashmap/Main.java | 56afcf8111d2b4e6cc606e899351f07347c3ab09 | [] | no_license | sanevova/fizteh-java-2013 | 10b979815da842b6745cc01a62d2fdd9d895c12a | 869482f31c4de784c5a3c1b8261713aae8d3284f | refs/heads/master | 2021-01-17T21:45:21.110144 | 2013-11-17T22:50:25 | 2013-11-17T23:06:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,517 | java | package ru.fizteh.fivt.students.asaitgalin.multifilehashmap;
import ru.fizteh.fivt.students.asaitgalin.multifilehashmap.commands.*;
import ru.fizteh.fivt.students.asaitgalin.shell.CommandTable;
import ru.fizteh.fivt.students.asaitgalin.shell.ShellUtils;
import java.io.File;
public class Main {
public static void main(String[] args) {
CommandTable table = new CommandTable();
String dir = System.getProperty("fizteh.db.dir");
if (dir == null) {
System.err.println("Database directory not set");
System.exit(-1);
}
File workingDir = new File(System.getProperty("fizteh.db.dir"));
if (!workingDir.exists()) {
System.err.println("Database directory not found");
System.exit(-1);
}
MultiFileTableProvider provider = new MultiFileTableProvider(workingDir);
table.appendCommand(new PutCommand(provider));
table.appendCommand(new GetCommand(provider));
table.appendCommand(new RemoveCommand(provider));
table.appendCommand(new CreateCommand(provider));
table.appendCommand(new DropCommand(provider));
table.appendCommand(new UseCommand(provider));
table.appendCommand(new ExitCommand(provider));
ShellUtils shellUtils = new ShellUtils(table);
if (args.length == 0) {
shellUtils.interactiveMode(System.in, System.out, System.err);
} else {
shellUtils.batchMode(args, System.err);
}
}
}
| [
"andrey.saitgalin@gmail.com"
] | andrey.saitgalin@gmail.com |
13c0335ec7e38402bb8eb18192c68f652cae4098 | c4ea15d46f370fc3123bf158d6139f15fea22a5f | /src/main/java/com/hzh/controller/MarriedPersonController.java | 0b0b22b2b08bec80837d0959203b9f4d6ddef146 | [] | no_license | jsontim/tingyu-Springboot | f0588500ce4d23940277e50e8479709b82262821 | 245f55f5808022a309d7a9779865b59888ea617a | refs/heads/master | 2023-01-05T06:10:20.699534 | 2020-10-27T15:11:45 | 2020-10-27T15:11:45 | 307,703,687 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,393 | java | package com.hzh.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hzh.pojo.DataGridPageDate;
import com.hzh.pojo.MarriedPerson;
import com.hzh.pojo.MsgResult;
import com.hzh.service.IMarriedPersonService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.time.LocalDateTime;
import java.util.Date;
/**
* <p>
* 前端控制器
* </p>
*
* @author ${author}
* @since 2020-10-10
*/
@Controller
@RequestMapping("/married")
public class MarriedPersonController {
@Autowired
private IMarriedPersonService marriedPersonService;
@RequestMapping("/marriedManager")
public String marriedManager() {
return "marriedManager";
}
@RequestMapping("/list")
@ResponseBody
public DataGridPageDate getMarriedPage(MarriedPerson marriedPerson, @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer rows) {
QueryWrapper<MarriedPerson> qr = new QueryWrapper<>();
if (StringUtils.isNotBlank(marriedPerson.getPname())) {
qr.like("pname", marriedPerson.getPname());
}
if(StringUtils.isNotBlank(marriedPerson.getPhone())){
qr.like("phone",marriedPerson.getPhone());
}
Page<MarriedPerson> personPage = new Page<>(page, rows);
Page<MarriedPerson> marriedPersonPage = marriedPersonService.page(personPage, qr);
DataGridPageDate dataGridPageDate = new DataGridPageDate();
dataGridPageDate.setTotal(marriedPersonPage.getTotal());
dataGridPageDate.setRows(marriedPersonPage.getRecords());
return dataGridPageDate;
}
@RequestMapping("/register")
@ResponseBody
public MsgResult register(MarriedPerson marriedPerson){
marriedPerson.setRegdate(new Date());
marriedPerson.setStatus("1");
boolean flag = marriedPersonService.save(marriedPerson);
return flag?new MsgResult(200,"注册成功!"):new MsgResult(400,"注册失败!请联系平台管理员");
}
}
| [
"942089787@qq.com"
] | 942089787@qq.com |
fae4a04d340d73d3efa476edd02b3cdce420e109 | 3bc61a47e86e4eec7cdc3aa2b5a7af60a2b3c655 | /eapi-updatecustomer-rest/src/main/java/com/wba/api/updatecustomer/UpdateCustomerApplication.java | ff9c26ede9e46cdf24462d3a5dabfeb1d50c3a18 | [] | no_license | RahulDRaj-UST/JavaProjects | 6a84c1222cbb302df282e1836bcc10669eea044b | 91c59e81d5e8ee84518e712c48aaaf90ee1f31da | refs/heads/main | 2023-03-12T05:39:15.477769 | 2021-03-06T09:56:15 | 2021-03-06T09:56:15 | 344,776,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 445 | java | package com.wba.api.updatecustomer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@EnableAutoConfiguration
@SpringBootApplication
public class UpdateCustomerApplication {
public static void main(String[] args) {
SpringApplication.run(UpdateCustomerApplication.class, args);
}
}
| [
"161126@ust-global.com"
] | 161126@ust-global.com |
92148ad2c2616ab93ab9575e2e084eefeca143bd | 27cd83ac293bb33799452b5aa3182f11bfb89fcf | /src/main/java/com/Library/model/LoginUser.java | 44518275c14de8f77151775c721880973a76a2a3 | [] | no_license | gopichand26/Login-Authentication-LibraryManagementSystem-backend | 0109ed6b876e0f7196baf67fbc37db0cc02e4f55 | 6bc78343c4d2591415f8191b3feb311aef5bb780 | refs/heads/master | 2022-12-27T05:29:40.736645 | 2020-10-15T11:16:34 | 2020-10-15T11:16:34 | 304,301,499 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 422 | java | package com.Library.model;
public class LoginUser {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"gopic@GOPICHAND"
] | gopic@GOPICHAND |
7bdb3ffec64de08ef688dd4e77b7256ec132bde0 | 0c7e5c400b636b060ddbc6bafe63526cd2b48a19 | /src/main/java/com/example/placebo/repository/DosageRepository.java | 9237e62e569711a85ca59c4d6f6dacd7b89f84aa | [] | no_license | mparszewski/placebo-app | 981a6013fdb841d973e9cee336ca00c08d2bbeec | d3f6fac4aa2a297dabf69d0b27665815305da8ef | refs/heads/master | 2020-03-19T04:13:36.164406 | 2018-06-10T21:06:45 | 2018-06-10T21:06:45 | 135,807,603 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package com.example.placebo.repository;
import com.example.placebo.entities.Dosage;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface DosageRepository extends JpaRepository<Dosage, Integer> {
List<Dosage> findByPatient_Id(int patientId);
}
| [
"33162624+mparszewski@users.noreply.github.com"
] | 33162624+mparszewski@users.noreply.github.com |
1a687e905809ccdf9df07a921b4a799382906133 | 1dc75710a815b41df960cda5e4a37e872ac05079 | /backend/ticketBackEnd/ticketBackEnd/src/runtime/userTest.java | eb3ec359acd4957cf4d49d070822188c364037f3 | [] | no_license | Tdfrantz/team-name-working | 84abf923aad0f4223e11778f35d49ee8cf97011c | 95db386cb608f7ef211b930a17c4cd5fc5d7a018 | refs/heads/master | 2021-01-18T06:57:53.323398 | 2015-04-06T01:57:27 | 2015-04-06T01:57:27 | 31,176,490 | 0 | 0 | null | 2015-02-22T19:33:32 | 2015-02-22T19:33:31 | null | UTF-8 | Java | false | false | 1,732 | java | package runtime;
import static org.junit.Assert.*;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
public class userTest {
@Test
public void testUser() throws Exception {
user test = new user("gamma20142", "AA", 999999.99);
assertNotNull(test);
}
@Test
public void testBadUsername() throws Exception{
try{
user testBadUsername = new user("this name has more than fifteen characters","AA", 999999.99);
fail();
}
catch(Exception e){}
}
@Test
public void testBadUserType() throws Exception{
try{
user testBadUserType = new user("gamma20142", "AS", 999999.99);
fail();
}catch(Exception e){}
}
@Test
public void testBadCredit() throws Exception{
try{
user testBadCredit = new user("gamma20142", "AA", 1234567.12);
fail();
}catch(Exception e){}
}
@Test
public void testGetName() throws Exception {
user test= new user("gamma20142","AA",999999.99);
assertEquals("gamma20142",test.getName());
}
@Test
public void testGetType() throws Exception {
user test= new user("gamma20142","AA",999999.99);
assertEquals("AA",test.getType());
}
@Test
public void testGetWallet() throws Exception {
user test= new user("gamma20142","AA",999999.99);
assertEquals(999999.99,test.getWallet(),0.001);
}
@Test
public void testUpdateWallet() throws Exception {
user test= new user("gamma20142","AA",999999.99);
test.updateWallet(12345.6);
assertEquals(12345.6,test.getWallet(),0.001);
}
@Test
public void testUpdateWallet1() throws Exception {
user test= new user("gamma20142","AA",999999.99);
test.updateWallet(1000000);
assertEquals(-1, test.updateWallet(-10));
}
}
| [
"tdfrantz@gmail.com"
] | tdfrantz@gmail.com |
09997e60821c503a140a4366f8d163388e1775d3 | b8e12c1cd75cbac493c34777b7af12a4a46afa4a | /MyThread/src/com/ust/sync/SyncTest.java | 837c0eabeb0779ee4857f3618ae8b24170c7d075 | [] | no_license | utkarshgupta611/Java_Basic_project | e787c40ccdad0494d07af3fb70c912000430f3f7 | 51c8cd01678d8e25671a8051fa8ddae1a82acfa5 | refs/heads/main | 2023-07-03T04:49:36.122585 | 2021-07-31T18:29:59 | 2021-07-31T18:29:59 | 387,862,886 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 267 | java | package com.ust.sync;
public class SyncTest {
public static void main(String[] args) {
SharedInterface so = new SharedObject();
Runnable prod = new Producer(so);
new Thread(prod).start();
Runnable cons = new Consumer(so);
new Thread(cons).start();
}
}
| [
"utkarshgupta7112@gmail.com"
] | utkarshgupta7112@gmail.com |
1b6e1785b2776b6d584d9021a31d77014af8b928 | c50d8f0b8c2b032dee221e408372513f8ade369a | /src/DataStructures/bilibili/TreeOperation.java | baa7a70f5edb89b20c86a8a2a5a3023cd191fd5f | [] | no_license | apaxyx/JavaDSA | 327457d63062b4c73aae36241e73fe7a26addc7b | 564013a472a4555bebbbbd8ed84be1c749aa4ef9 | refs/heads/master | 2023-06-03T09:12:31.017313 | 2021-06-24T00:38:51 | 2021-06-24T00:38:51 | 366,282,308 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,050 | java | package DataStructures.bilibili;
public class TreeOperation {
public static int getTreeDepth(RBTree.RBNode root) {
return root == null ? 0 : (1 + Math.max(getTreeDepth(root.getLeft()), getTreeDepth(root.getRight())));
}
private static void writeArray(RBTree.RBNode currNode, int rowIndex, int columnIndex, String[][] res, int treeDepth) {
// 保证输入的树不为空
if (currNode == null) return;
// 先将当前节点保存到二维数组中
res[rowIndex][columnIndex] = String.valueOf(currNode.getKey()+"-"+(currNode.isColor()? "R":"B")+"");
// 计算当前位于树的第几层
int currLevel = ((rowIndex + 1) / 2);
// 若到了最后一层,则返回
if (currLevel == treeDepth) return;
// 计算当前行到下一行,每个元素之间的间隔(下一行的列索引与当前元素的列索引之间的间隔)
int gap = treeDepth - currLevel - 1;
// 对左儿子进行判断,若有左儿子,则记录相应的"/"与左儿子的值
if (currNode.getLeft() != null) {
res[rowIndex + 1][columnIndex - gap] = "/";
writeArray(currNode.getLeft(), rowIndex + 2, columnIndex - gap * 2, res, treeDepth);
}
// 对右儿子进行判断,若有右儿子,则记录相应的"\"与右儿子的值
if (currNode.getRight() != null) {
res[rowIndex + 1][columnIndex + gap] = "\\";
writeArray(currNode.getRight(), rowIndex + 2, columnIndex + gap * 2, res, treeDepth);
}
}
public static void show(RBTree.RBNode root) {
if (root == null) System.out.println("EMPTY!");
// 得到树的深度
int treeDepth = getTreeDepth(root);
// 最后一行的宽度为2的(n - 1)次方乘3,再加1
// 作为整个二维数组的宽度
int arrayHeight = treeDepth * 2 - 1;
int arrayWidth = (2 << (treeDepth - 2)) * 3 + 1;
// 用一个字符串数组来存储每个位置应显示的元素
String[][] res = new String[arrayHeight][arrayWidth];
// 对数组进行初始化,默认为一个空格
for (int i = 0; i < arrayHeight; i ++) {
for (int j = 0; j < arrayWidth; j ++) {
res[i][j] = " ";
}
}
// 从根节点开始,递归处理整个树
// res[0][(arrayWidth + 1)/ 2] = (char)(root.val + '0');
writeArray(root, 0, arrayWidth/ 2, res, treeDepth);
// 此时,已经将所有需要显示的元素储存到了二维数组中,将其拼接并打印即
for (String[] line: res) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < line.length; i ++) {
sb.append(line[i]);
if (line[i].length() > 1 && i <= line.length - 1) {
i += line[i].length() > 4 ? 2: line[i].length() - 1;
}
}
System.out.println(sb.toString());
}
}
} | [
"593933586@163.com"
] | 593933586@163.com |
f6549316d1f79462528a3529151e7ce86ba8bda1 | dac9209ec61248e94eacce981ab85bc340028d74 | /app/src/main/java/com/example/redwanulsourav/attendance/Teacher.java | 4a0b087ba3a4df5f3ea391005027c4e1f99a7f60 | [] | no_license | redwanulsourav/Attendance-Android | 5a758a56edd6fe2639f1ddb472b7a75e2666dbb9 | 8ddb8a0da97238b9f40bce616ffcedf5de48f649 | refs/heads/master | 2020-04-10T11:49:05.505776 | 2019-01-09T13:49:41 | 2019-01-09T13:49:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package com.example.redwanulsourav.attendance;
public class Teacher extends Person {
public Teacher() {
}
public void takeAttendance(){
}
public void viewData(){
}
}
| [
"redwanul.sourav@gmail.com"
] | redwanul.sourav@gmail.com |
5a33f6ff9240287e7186dac629d5c3b2536bfeaf | eef789f255a549ef15ca155c1820c6a896b7766e | /src/main/java/com/github/maxwell/base/thread/juc/StampedLockDemo.java | 4cbad521abcc429c71e7d16b951086d2c69e5a4a | [] | no_license | maxwell1389/javabase | a208cd0f21955c792070a8b81e1f9fbfee420d42 | f743fcdcc140f09a06db85299e1f2a55bcfc2ea2 | refs/heads/master | 2022-12-24T05:48:36.431396 | 2020-04-09T07:36:55 | 2020-04-09T07:36:55 | 164,127,951 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,821 | java | package com.github.maxwell.base.thread.juc;
import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.locks.StampedLock;
/**
* StampedLock使用例子
*/
@Slf4j
public class StampedLockDemo {
private int balance = 0;
private StampedLock lock = new StampedLock();
public StampedLockDemo() {
this.balance = 0;
}
private void conditionReadWrite(int value) {
long stamp = lock.readLock();
log.info("conditionReadWrite stamp {}", stamp);
while (balance > 0) {
long writeStamp = lock.tryConvertToWriteLock(stamp);
log.info("conditionReadWrite writeStamp {}", stamp);
if (writeStamp != 0) { //成功转换成写锁
stamp = writeStamp;
balance += value;
break;
} else {
//没有转换成写锁,这里需先释放读锁,然后再拿到写
lock.unlock(stamp);
stamp = lock.writeLock();
}
}
lock.unlock(stamp);
}
private void optimisticRead() {
long stammp = lock.tryOptimisticRead();
log.info("optimisticRead stamp {}", stammp);
int c = balance;
//这里可能会出现了写操作,因此要进行判断
if (!lock.validate(stammp)) {
//要重新读取
stammp = lock.readLock();
try {
c = balance;
} finally {
lock.unlock(stammp);
}
}
log.info("optimisticRead {}", c);
}
private void read() {
long stamp = lock.readLock();
log.info("read stamp {}", stamp);
lock.tryOptimisticRead();
int c = balance;
log.info("read {}", c);
lock.unlock(stamp);
}
private void write(int value) {
long stamp = lock.writeLock();
log.info("write stamp {} value {}", stamp, value);
balance += value;
lock.unlock(stamp);
}
public static void main(String[] args) {
StampedLockDemo stampedLockDemo = new StampedLockDemo();
new Thread(() -> {
while (true) {
stampedLockDemo.read();
stampedLockDemo.optimisticRead();
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}).start();
new Thread(() -> {
while (true) {
stampedLockDemo.write(2);
stampedLockDemo.conditionReadWrite(3);
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}).start();
}
}
| [
"maxwell1389@sina.com"
] | maxwell1389@sina.com |
6e3d9a34d0df3424066f5c3b1df077f25b3791ed | 6d586db7b056ce2a8b4c808174e84fc5d95d5ec9 | /executor-monitor/src/main/java/com/linkedpipes/etl/executor/monitor/execution/ExecutionChecker.java | ce2e9e53d1c2d81d907534f0f551d3dd536c1c0e | [
"MIT"
] | permissive | ontology2006/etl | 13ddb0ae5cae1f21935c36cc9d37044691f71685 | 4c8834d13c24b22da91a69e59da0bcbcc48232e8 | refs/heads/master | 2020-03-19T01:45:50.208843 | 2018-05-03T17:37:30 | 2018-05-03T17:37:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,707 | java | package com.linkedpipes.etl.executor.monitor.execution;
import com.linkedpipes.etl.executor.monitor.debug.DebugData;
import com.linkedpipes.etl.executor.monitor.execution.ExecutionFacade.ExecutionMismatch;
import com.linkedpipes.etl.executor.monitor.execution.ExecutionFacade.OperationFailed;
import org.apache.commons.io.FileUtils;
import org.eclipse.rdf4j.OpenRDFException;
import org.eclipse.rdf4j.model.*;
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
import org.eclipse.rdf4j.model.vocabulary.RDF;
import org.eclipse.rdf4j.rio.RDFFormat;
import org.eclipse.rdf4j.rio.RDFParser;
import org.eclipse.rdf4j.rio.Rio;
import org.eclipse.rdf4j.rio.helpers.AbstractRDFHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* This class apply defensive approach ie. if an exception
* is thrown by any operation the given parameter object should
* stay in consistent state.
*/
class ExecutionChecker {
private static final Logger LOG
= LoggerFactory.getLogger(ExecutionChecker.class);
private ExecutionChecker() {
}
/**
* Load execution data into given execution.
*
* @param execution
*/
public static void updateFromDirectory(Execution execution)
throws OperationFailed, ExecutionMismatch {
//
final File definitionFile
= new File(execution.getDirectory(), "execution.jsonld");
if (!definitionFile.exists()) {
// No execution directory, the execution must be queued.
loadQueued(execution);
execution.getOverviewResource().missing(execution);
} else {
try (InputStream input = new FileInputStream(definitionFile)) {
checkExecution(execution, input);
} catch (IOException ex) {
throw new OperationFailed("Can't read definition file.", ex);
}
}
}
/**
* Load execution data into execution from the stream.
*
* @param execution
* @param stream
*/
public static void checkExecution(Execution execution,
InputStream stream) throws OperationFailed, ExecutionMismatch {
final Date startTime = new Date();
final Date checkStart = new Date();
final ValueFactory valueFactory = SimpleValueFactory.getInstance();
final List<Statement> output = new ArrayList<>(8);
Resource startEvent = null;
Resource endEvent = null;
int componentsToExecute = 0;
int componentsFinished = 0;
final List<Statement> executionStatements;
try {
executionStatements = loadStream(stream);
} catch (IOException ex) {
throw new OperationFailed("Can't load statements.", ex);
}
// Search and get execution IRI if it's missing.
String executionIri = null;
final List<Resource> components = new ArrayList<>(32);
for (Statement statement : executionStatements) {
if (RDF.TYPE.equals(statement.getPredicate())) {
if (statement.getObject().stringValue().equals(
"http://etl.linkedpipes.com/ontology/Execution")) {
executionIri = statement.getSubject().stringValue();
} else if (statement.getObject().stringValue().equals(
"http://linkedpipes.com/ontology/Component")) {
components.add(statement.getSubject());
}
}
}
if (execution.getIri() == null) {
execution.setIri(executionIri);
} else if (!execution.getIri().equals(executionIri)) {
throw new ExecutionMismatch("Found: " + executionIri
+ " expected:" + execution.getIri());
}
Date lastChange = null;
final IRI executionResource =
valueFactory.createIRI(execution.getIri());
final IRI graph = createGraph(valueFactory, execution.getIri());
for (Statement statement : executionStatements) {
// Read status.
if (statement.getPredicate().stringValue().equals(
"http://etl.linkedpipes.com/ontology/status")) {
if (statement.getSubject().equals(executionResource)) {
output.add(valueFactory.createStatement(
statement.getSubject(),
statement.getPredicate(),
statement.getObject(),
graph));
continue;
}
if (components.contains(statement.getSubject())) {
switch (statement.getObject().stringValue()) {
case "http://etl.linkedpipes.com/resources/status/mapped":
break;
default:
++componentsToExecute;
break;
}
}
continue;
}
if (RDF.TYPE.equals(statement.getPredicate())) {
final String value = statement.getObject().stringValue();
switch (value) {
case "http://linkedpipes.com/ontology/events/ExecutionBegin":
startEvent = statement.getSubject();
break;
case "http://linkedpipes.com/ontology/events/ExecutionEnd":
endEvent = statement.getSubject();
break;
case "http://linkedpipes.com/ontology/events/ComponentEnd":
case "http://linkedpipes.com/ontology/events/ComponentFailed":
++componentsFinished;
break;
default:
break;
}
} else if (statement.getSubject().equals(executionResource)) {
// For the pipeline itself we store the status and
// reference to the pipeline object.
if (statement.getPredicate().stringValue()
.equals("http://etl.linkedpipes.com/ontology/pipeline")) {
output.add(valueFactory.createStatement(
statement.getSubject(),
statement.getPredicate(),
statement.getObject(),
graph));
} else if (statement.getPredicate().stringValue()
.equals("http://etl.linkedpipes.com/ontology/lastChange")) {
lastChange =
((Literal) statement.getObject()).calendarValue()
.toGregorianCalendar().getTime();
}
}
}
// Check.
if (lastChange != null && execution.getLastChange() != null
&& !lastChange.equals(execution.getLastChange())
&& lastChange.before(execution.getLastChange())) {
// We have newer data already loaded.
return;
}
// Search for events.
Value start = null;
Value end = null;
for (Statement statement : executionStatements) {
if (statement.getSubject().equals(startEvent)) {
if (statement.getPredicate().stringValue()
.equals("http://linkedpipes.com/ontology/events/created")) {
start = statement.getObject();
}
} else if (statement.getSubject().equals(endEvent)) {
if (statement.getPredicate().stringValue()
.equals("http://linkedpipes.com/ontology/events/created")) {
end = statement.getObject();
}
}
}
// Add custom.
output.add(valueFactory.createStatement(
valueFactory.createIRI(execution.getIri()),
RDF.TYPE,
valueFactory.createIRI(
"http://etl.linkedpipes.com/ontology/Execution"),
graph));
if (execution.getDirectory() != null) {
output.add(valueFactory.createStatement(
executionResource,
valueFactory.createIRI(
"http://etl.linkedpipes.com/ontology/execution/size"),
valueFactory.createLiteral(FileUtils
.sizeOfDirectory(execution.getDirectory())),
graph));
}
output.add(valueFactory.createStatement(
executionResource,
valueFactory.createIRI(
"http://etl.linkedpipes.com/ontology/execution/componentCount"),
valueFactory.createLiteral(components.size()),
graph));
output.add(valueFactory.createStatement(
executionResource,
valueFactory.createIRI(
"http://etl.linkedpipes.com/ontology/execution/componentToExecute"),
valueFactory.createLiteral(componentsToExecute),
graph));
output.add(valueFactory.createStatement(
executionResource,
valueFactory.createIRI(
"http://etl.linkedpipes.com/ontology/execution/componentFinished"),
valueFactory.createLiteral(componentsFinished),
graph));
if (start != null) {
output.add(valueFactory.createStatement(
executionResource,
valueFactory.createIRI(
"http://etl.linkedpipes.com/ontology/execution/start"),
start,
graph));
}
if (end != null) {
output.add(valueFactory.createStatement(
executionResource,
valueFactory.createIRI(
"http://etl.linkedpipes.com/ontology/execution/end"),
end,
graph));
}
// Update debug data.
execution.setDebugData(new DebugData(executionStatements, execution));
// Update execution status on discovered information.
if (execution.getStatus() == null) {
// We are loading new execution, so we have to assign a status.
if (startEvent == null) {
execution.setStatus(Execution.StatusType.QUEUED);
} else if (endEvent == null) {
execution.setStatus(Execution.StatusType.RUNNING);
} else {
// We have start and end event.
execution.setStatus(Execution.StatusType.FINISHED);
}
} else if (endEvent == null) {
// Here we can only change from queued to running.
if (execution.getStatus() == Execution.StatusType.QUEUED) {
execution.setStatus(Execution.StatusType.RUNNING);
}
} else {
execution.setStatus(Execution.StatusType.FINISHED);
}
if (execution.getStatus() == Execution.StatusType.RUNNING) {
execution.setExecutionStatementsFull(executionStatements);
} else {
execution.setExecutionStatementsFull(null);
}
LOG.info(" {} : {} ", execution.getId(), execution.getStatus());
// For now set change time to every reload.
execution.setLastChange(checkStart);
execution.setLastCheck(checkStart);
updateGenerated(execution);
execution.setExecutionStatements(output);
long diff = (new Date()).getTime() - startTime.getTime();
if (diff > 500) {
LOG.info("checkExecution takes: {} ms", diff);
}
}
/**
* Create and save the content for deleted executions into the given
* execution.
*
* @param execution
*/
public static void setToDeleted(Execution execution) {
final Date checkStart = new Date();
final ValueFactory valueFactory = SimpleValueFactory.getInstance();
final IRI graph = createGraph(valueFactory, execution.getIri());
final List<Statement> output = new ArrayList<>(1);
execution.setStatus(Execution.StatusType.DELETED);
output.add(valueFactory.createStatement(
valueFactory.createIRI(execution.getIri()),
RDF.TYPE,
valueFactory.createIRI(
"http://etl.linkedpipes.com/ontology/Deleted"),
graph));
// For now set change time to every reload.
execution.setLastChange(checkStart);
execution.setLastCheck(checkStart);
execution.setExecutionStatements(output);
}
/**
* Create and save content for queued execution.
*
* @param execution
*/
private static void loadQueued(Execution execution) {
if (execution.getStatus() == Execution.StatusType.QUEUED) {
return;
}
final Date checkStart = new Date();
final ValueFactory valueFactory = SimpleValueFactory.getInstance();
final IRI graph = createGraph(valueFactory, execution.getIri());
final List<Statement> output = new ArrayList<>(1);
execution.setStatus(Execution.StatusType.QUEUED);
output.add(valueFactory.createStatement(
valueFactory.createIRI(execution.getIri()),
RDF.TYPE,
valueFactory.createIRI(
"http://etl.linkedpipes.com/ontology/Execution"),
graph));
output.add(valueFactory.createStatement(
valueFactory.createIRI(execution.getIri()),
valueFactory.createIRI(
"http://etl.linkedpipes.com/ontology/execution/size"),
valueFactory.createLiteral(
FileUtils.sizeOfDirectory(execution.getDirectory())),
graph));
output.add(valueFactory.createStatement(
valueFactory.createIRI(execution.getIri()),
valueFactory.createIRI(
"http://etl.linkedpipes.com/ontology/status"),
valueFactory.createIRI(
"http://etl.linkedpipes.com/resources/status/queued"),
graph));
updateGenerated(execution);
// For now set change time to every reload.
execution.setLastChange(checkStart);
execution.setLastCheck(checkStart);
execution.setExecutionStatements(output);
}
/**
* Load statements from given stream.
*
* @param stream
* @return
*/
private static List<Statement> loadStream(InputStream stream)
throws IOException, OperationFailed {
final RDFParser reader = Rio.createParser(RDFFormat.JSONLD,
SimpleValueFactory.getInstance());
final List<Statement> statements = new ArrayList<>(64);
//
reader.setRDFHandler(new AbstractRDFHandler() {
@Override
public void handleStatement(Statement statement) {
statements.add(statement);
}
});
//
try {
reader.parse(stream, "http://localhost/base/");
} catch (OpenRDFException ex) {
throw new OperationFailed("Can't read data.", ex);
}
return statements;
}
/**
* @param valueFactory
* @param execution
* @return Graph used to store information about execution.
*/
private static IRI createGraph(ValueFactory valueFactory,
String execution) {
return valueFactory.createIRI(execution + "/list");
}
public static void updateGenerated(Execution execution) {
final ValueFactory valueFactory = SimpleValueFactory.getInstance();
final IRI graph = createGraph(valueFactory, execution.getIri());
final List<Statement> output = new ArrayList<>(1);
final IRI status;
switch (execution.getStatus()) {
case DANGLING:
status = valueFactory.createIRI(
"http://etl.linkedpipes.com/resources/status/dangling");
break;
case FINISHED:
status = valueFactory.createIRI(
"http://etl.linkedpipes.com/resources/status/finished");
break;
case QUEUED:
status = valueFactory.createIRI(
"http://etl.linkedpipes.com/resources/status/queued");
break;
case RUNNING:
status = valueFactory.createIRI(
"http://etl.linkedpipes.com/resources/status/running");
break;
case UNRESPONSIVE:
status = valueFactory.createIRI(
"http://etl.linkedpipes.com/resources/status/unresponsive");
break;
default:
status = valueFactory.createIRI(
"http://etl.linkedpipes.com/resources/status/unknown");
break;
}
output.add(valueFactory.createStatement(
valueFactory.createIRI(execution.getIri()),
valueFactory.createIRI(
"http://etl.linkedpipes.com/ontology/statusMonitor"),
status, graph));
execution.setExecutionStatementsGenerated(output);
}
}
| [
"skodapetr@gmail.com"
] | skodapetr@gmail.com |
2013703ff14a22e5eb071626117b19e7f1303b91 | c0e1bfcd75422b85ede0b6d2d5066f071901bce9 | /YouTubeDownloader/src/com/hexotic/v2/gui/downloadbar/DownloadBarListener.java | 7bb8ea23b885946a61bc656f379e6da9be8009ac | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | bradleyasu/ytdl50 | a0f7767a8efcbc2c9db8441f30d7c7e1f4cc0314 | 4be76f74b5186ae6ede23bd36b71e6e0b2b6440c | refs/heads/master | 2021-06-22T13:00:48.323113 | 2021-01-23T20:33:27 | 2021-01-23T20:33:27 | 15,010,287 | 26 | 10 | null | null | null | null | UTF-8 | Java | false | false | 130 | java | package com.hexotic.v2.gui.downloadbar;
public interface DownloadBarListener {
public void inputEntered(String input);
}
| [
"Bradley@10.0.0.3"
] | Bradley@10.0.0.3 |
ab41a6e8a572f9a613587c313b3d68bbd8ad4857 | e88e20027a6b98b1ed98ff1ca736bde806520502 | /gmall-admin-web/src/main/java/com/atguigu/gmall/admin/GmallAdminWebApplication.java | 409b3fb509e1ff81deb2a7c1f85e3ca5db8242dc | [] | no_license | gaojian666/gmall-parent | e3b4fc809c0e4d1920cee6e8957453fe1f90dd58 | 98e20e0bfe4aac325749daf7568f61028e6a0e00 | refs/heads/master | 2020-04-30T21:25:59.123152 | 2019-03-22T07:34:34 | 2019-03-22T07:35:14 | 177,092,893 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 831 | java | package com.atguigu.gmall.admin;
import com.alibaba.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* 1、dubbo项目默认启动的时候,dubbo会检查自己远程服务是否在线。不在就报错;
* 2、我们可以关闭dubbo的启动检查
*
*
* 分步式 RestAPI与前端对接的问题
* 1)、跨域
* 2)、mp调用的问题
* 1)、每个Service都标两个注解
* 2)、web都是refrence
* 3)、注意不要用复杂类的mp自动生成的方法
*/
@EnableDubbo
@SpringBootApplication
public class GmallAdminWebApplication {
public static void main(String[] args) {
SpringApplication.run(GmallAdminWebApplication.class, args);
}
}
| [
"18204180447@163.com"
] | 18204180447@163.com |
9de3d557a63f61650d48619237e51b5229e696f2 | e26ca0054e95dda4b69681c125b8e6d016959a21 | /topicos-lambda-rekognition-java/src/main/java/com/mymaven/rekognition/lambda/LambdaHandler.java | 5031203ca9ec97d2efda730108029a0536582ed9 | [] | no_license | GabrieldeCarli/LambdaRekognition | e2bbacfdc8cf67ee528981c47889989cbe795c68 | 26b82886e30ddbffd7a190163b84d92ac839986a | refs/heads/master | 2021-07-07T09:20:56.010155 | 2019-07-07T18:40:08 | 2019-07-07T18:40:08 | 195,683,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,310 | java | package com.mymaven.rekognition.lambda;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder;
import com.amazonaws.services.dynamodbv2.model.AttributeValue;
import com.amazonaws.services.dynamodbv2.model.PutItemRequest;
import com.amazonaws.services.dynamodbv2.model.PutItemResult;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import com.amazonaws.services.lambda.runtime.events.S3Event;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.model.GetObjectRequest;
import com.amazonaws.services.s3.model.S3Object;
import com.mymaven.topicos.lambda.model.EnumEventName;
import com.mymaven.topicos.lambda.model.FileData;
import com.amazonaws.services.rekognition.model.DetectLabelsRequest;
import com.amazonaws.services.rekognition.model.DetectLabelsResult;
import com.amazonaws.services.rekognition.model.Label;
import com.amazonaws.services.rekognition.AmazonRekognition;
import com.amazonaws.services.rekognition.AmazonRekognitionClientBuilder;
import com.amazonaws.services.rekognition.model.AmazonRekognitionException;
public class LambdaHandler implements RequestHandler<S3Event, Void> {
private String DYNAMODB_TABLE_NAME = "FileDetails";
private Regions REGION = Regions.EU_WEST_1;
private AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
.withRegion(REGION)
.build();
private AmazonDynamoDB dynamoDb = AmazonDynamoDBClientBuilder.standard()
.withRegion(REGION)
.build();
@Override
public Void handleRequest(S3Event event, Context context) {
context.getLogger().log("Received S3Event: " + event.toJson());
EnumEventName eventName = EnumEventName.valueOf(event.getRecords().get(0).getS3().getConfigurationId());
String bucket = event.getRecords().get(0).getS3().getBucket().getName();
String key = event.getRecords().get(0).getS3().getObject().getKey();
try {
if(eventName.equals(EnumEventName.ItemAddedEvent)){
context.getLogger().log(String.format("Processing ItemAdded Event for bucket[%s] and key[%s]", bucket, key));
handleRekognitionEvent(bucket, key);
}
else{
throw new RuntimeException("Unable to process unexpected event type");
}
} catch (Exception ex) {
context.getLogger().log("Error ocurred processing request");
throw ex;
}
return null;
}
private void handleRekognitionEvent(String bucket, String key){
S3Object s3Object = s3Client.getObject(new GetObjectRequest(bucket, key));
String name = s3Object.getKey();
String contentType = s3Object.getObjectMetadata().getContentType();
String s3Uri = s3Object.getObjectContent().getHttpRequest().getURI().toString();
Long sizeBytes = (Long)s3Object.getObjectMetadata().getRawMetadataValue("Content-Length");
String lastModified = formatDate((Date)s3Object.getObjectMetadata().getRawMetadataValue("Last-Modified"));
FileData fileData = new FileData(bucket, name, contentType, s3Uri, sizeBytes, lastModified);
context.getLogger().log(fileData.toString());
AmazonRekognition rekognitionClient = AmazonRekognitionClientBuilder.defaultClient();
DetectLabelsRequest request = new DetectLabelsRequest()
.withImage(new Image().withS3Object(new S3Object().withName(fileData).withBucket(bucket)))
.withMaxLabels(10).withMinConfidence(75F);
try {
DetectLabelsResult result = rekognitionClient.detectLabels(request);
List<Label> labels = result.getLabels();
context.getLogger().log(String.format("Detected labels for image[%s].", fileData));
for (Label label : labels) {
context.getLogger().log(String.format("Saving labels in database."));
saveItem(label.getName(), label.getConfidence().toString(), fileData.getName());
}
} catch (AmazonRekognitionException e) {
e.printStackTrace();
}
}
private void saveItem(String labelName, String labelConfidence, String fileName){
PutItemRequest putItemRequest = new PutItemRequest();
putItemRequest.setTableName(DYNAMODB_TABLE_NAME);
putItemRequest.addItemEntry("fileName",new AttributeValue(fileData.getName()));
putItemRequest.addItemEntry("labelName",new AttributeValue(labelName));
putItemRequest.addItemEntry("labelConfidence",new AttributeValue(labelConfidence));
PutItemResult putItemResult = dynamoDb.putItem(putItemRequest);
context.getLogger().log(putItemResult.toString());
}
} | [
"noreply@github.com"
] | GabrieldeCarli.noreply@github.com |
461ea32b35b753f1e6544b14a21ed95ee0e57073 | cbc61ffb33570a1bc55bb1e754510192b0366de2 | /ole-app/olefs/src/main/java/org/kuali/ole/pdp/businessobject/DisbursementNumberRange.java | 75132f0b732ddff37aaf5dc47ce8b7b3dc2cc2af | [
"ECL-2.0"
] | permissive | VU-libtech/OLE-INST | 42b3656d145a50deeb22f496f6f430f1d55283cb | 9f5efae4dfaf810fa671c6ac6670a6051303b43d | refs/heads/master | 2021-07-08T11:01:19.692655 | 2015-05-15T14:40:50 | 2015-05-15T14:40:50 | 24,459,494 | 1 | 0 | ECL-2.0 | 2021-04-26T17:01:11 | 2014-09-25T13:40:33 | Java | UTF-8 | Java | false | false | 6,805 | java | /*
* Copyright 2007 The Kuali Foundation
*
* Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Created on Jul 12, 2004
*
*/
package org.kuali.ole.pdp.businessobject;
import java.sql.Date;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.kuali.ole.sys.businessobject.Bank;
import org.kuali.ole.sys.context.SpringContext;
import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
import org.kuali.rice.core.api.util.type.KualiInteger;
import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
import org.kuali.rice.krad.service.KualiModuleService;
import org.kuali.rice.krad.service.ModuleService;
import org.kuali.rice.location.api.LocationConstants;
import org.kuali.rice.location.framework.campus.CampusEbo;
public class DisbursementNumberRange extends PersistableBusinessObjectBase implements MutableInactivatable {
protected String physCampusProcCode;
protected KualiInteger beginDisbursementNbr;
protected KualiInteger lastAssignedDisbNbr;
protected KualiInteger endDisbursementNbr;
protected Date disbNbrRangeStartDt;
protected String bankCode;
protected String disbursementTypeCode;
protected boolean active;
protected CampusEbo campus;
protected Bank bank;
protected DisbursementType disbursementType;
public DisbursementNumberRange() {
super();
}
/**
* @return
*/
public Bank getBank() {
return bank;
}
/**
* Gets the bankCode attribute.
*
* @return Returns the bankCode.
*/
public String getBankCode() {
return bankCode;
}
/**
* Sets the bankCode attribute value.
*
* @param bankCode The bankCode to set.
*/
public void setBankCode(String bankCode) {
this.bankCode = bankCode;
}
/**
* @return
* @hibernate.property column="BEG_DISB_NBR"
*/
public KualiInteger getBeginDisbursementNbr() {
return beginDisbursementNbr;
}
/**
* @return
* @hibernate.property column="END_DISB_NBR"
*/
public KualiInteger getEndDisbursementNbr() {
return endDisbursementNbr;
}
/**
* @return
* @hibernate.property column="LST_ASND_DISB_NBR"
*/
public KualiInteger getLastAssignedDisbNbr() {
return lastAssignedDisbNbr;
}
/**
* @return
* @hibernate.property column="PHYS_CMP_PROC_CD" length="2"
*/
public String getPhysCampusProcCode() {
return physCampusProcCode;
}
/**
* @param Bank
*/
@Deprecated
public void setBank(Bank bank) {
this.bank = bank;
}
/**
* @param integer
*/
public void setBeginDisbursementNbr(KualiInteger integer) {
beginDisbursementNbr = integer;
}
/**
* @param integer
*/
public void setEndDisbursementNbr(KualiInteger integer) {
endDisbursementNbr = integer;
}
/**
* @param integer
*/
public void setLastAssignedDisbNbr(KualiInteger integer) {
lastAssignedDisbNbr = integer;
}
/**
* @param string
*/
public void setPhysCampusProcCode(String string) {
physCampusProcCode = string;
}
/**
* Gets the disbursementTypeCode attribute.
*
* @return Returns the disbursementTypeCode.
*/
public String getDisbursementTypeCode() {
return disbursementTypeCode;
}
/**
* Sets the disbursementTypeCode attribute value.
*
* @param disbursementTypeCode The disbursementTypeCode to set.
*/
public void setDisbursementTypeCode(String disbursementTypeCode) {
this.disbursementTypeCode = disbursementTypeCode;
}
/**
* Gets the disbursementType attribute.
*
* @return Returns the disbursementType.
*/
public DisbursementType getDisbursementType() {
return disbursementType;
}
/**
* Sets the disbursementType attribute value.
*
* @param disbursementType The disbursementType to set.
*/
public void setDisbursementType(DisbursementType disbursementType) {
this.disbursementType = disbursementType;
}
/**
* Gets the campus attribute.
*
* @return Returns the campus.
*/
public CampusEbo getCampus() {
if ( StringUtils.isBlank(physCampusProcCode) ) {
campus = null;
} else {
if ( campus == null || !StringUtils.equals( campus.getCode(),physCampusProcCode) ) {
ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(CampusEbo.class);
if ( moduleService != null ) {
Map<String,Object> keys = new HashMap<String, Object>(1);
keys.put(LocationConstants.PrimaryKeyConstants.CODE, physCampusProcCode);
campus = moduleService.getExternalizableBusinessObject(CampusEbo.class, keys);
} else {
throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class. Unable to proceed." );
}
}
}
return campus;
}
/**
* Sets the campus attribute value.
*
* @param campus The campus to set.
*/
public void setCampus(CampusEbo campus) {
this.campus = campus;
}
/**
* @see org.kuali.rice.core.api.mo.common.active.MutableInactivatable#isActive()
*/
@Override
public boolean isActive() {
return active;
}
/**
* @see org.kuali.rice.core.api.mo.common.active.MutableInactivatable#setActive(boolean)
*/
@Override
public void setActive(boolean active) {
this.active = active;
}
/**
* Gets the disbNbrRangeStartDt attribute.
*
* @return Returns the disbNbrRangeStartDt.
*/
public Date getDisbNbrRangeStartDt() {
return disbNbrRangeStartDt;
}
/**
* Sets the disbNbrRangeStartDt attribute value.
*
* @param disbNbrRangeStartDt The disbNbrRangeStartDt to set.
*/
public void setDisbNbrRangeStartDt(Date disbNbrRangeStartDt) {
this.disbNbrRangeStartDt = disbNbrRangeStartDt;
}
}
| [
"david.lacy@villanova.edu"
] | david.lacy@villanova.edu |
dbe2a8af25b346ae1ff4a7e6f859302ddfa57e94 | d9d15f7d56d4d531b8ed3274a37c20a70d8e7d49 | /src/baidumapsdk/demo/LocationDemo.java | 55cc8bafb5a63295689e873c1ea55159abcb0dc0 | [] | no_license | weixiaokang/BaiduMaps | f54350206331208d8738f83a230daaeeb02f198c | 810e6ce14bc87a19eb0cea5fdc2c3d9186d27112 | refs/heads/master | 2020-06-04T13:00:12.063118 | 2014-08-19T15:27:07 | 2014-08-19T15:27:07 | 23,114,788 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,316 | java | package baidumapsdk.demo;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import com.baidu.location.BDLocation;
import com.baidu.location.BDLocationListener;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.BitmapDescriptor;
import com.baidu.mapapi.map.BitmapDescriptorFactory;
import com.baidu.mapapi.map.MapStatusUpdate;
import com.baidu.mapapi.map.MapStatusUpdateFactory;
import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.map.MyLocationConfigeration;
import com.baidu.mapapi.map.MyLocationConfigeration.LocationMode;
import com.baidu.mapapi.map.MyLocationData;
import com.baidu.mapapi.model.LatLng;
/**
* 此demo用来展示如何结合定位SDK实现定位,并使用MyLocationOverlay绘制定位位置 同时展示如何使用自定义图标绘制并点击时弹出泡泡
*
*/
public class LocationDemo extends Activity {
// 定位相关
LocationClient mLocClient;
public MyLocationListenner myListener = new MyLocationListenner();
private LocationMode mCurrentMode;
BitmapDescriptor mCurrentMarker;
MapView mMapView;
BaiduMap mBaiduMap;
// UI相关
OnCheckedChangeListener radioButtonListener;
Button requestLocButton;
boolean isFirstLoc = true;// 是否首次定位
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_location);
requestLocButton = (Button) findViewById(R.id.button1);
mCurrentMode = LocationMode.NORMAL;
requestLocButton.setText("普通");
OnClickListener btnClickListener = new OnClickListener() {
public void onClick(View v) {
switch (mCurrentMode) {
case NORMAL:
requestLocButton.setText("跟随");
mCurrentMode = LocationMode.FOLLOWING;
mBaiduMap
.setMyLocationConfigeration(new MyLocationConfigeration(
mCurrentMode, true, mCurrentMarker));
break;
case COMPASS:
requestLocButton.setText("普通");
mCurrentMode = LocationMode.NORMAL;
mBaiduMap
.setMyLocationConfigeration(new MyLocationConfigeration(
mCurrentMode, true, mCurrentMarker));
break;
case FOLLOWING:
requestLocButton.setText("罗盘");
mCurrentMode = LocationMode.COMPASS;
mBaiduMap
.setMyLocationConfigeration(new MyLocationConfigeration(
mCurrentMode, true, mCurrentMarker));
break;
}
}
};
requestLocButton.setOnClickListener(btnClickListener);
RadioGroup group = (RadioGroup) this.findViewById(R.id.radioGroup);
radioButtonListener = new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (checkedId == R.id.defaulticon) {
// 传入null则,恢复默认图标
mCurrentMarker = null;
mBaiduMap
.setMyLocationConfigeration(new MyLocationConfigeration(
mCurrentMode, true, null));
}
if (checkedId == R.id.customicon) {
// 修改为自定义marker
mCurrentMarker = BitmapDescriptorFactory
.fromResource(R.drawable.icon_geo);
mBaiduMap
.setMyLocationConfigeration(new MyLocationConfigeration(
mCurrentMode, true, mCurrentMarker));
}
}
};
group.setOnCheckedChangeListener(radioButtonListener);
// 地图初始化
mMapView = (MapView) findViewById(R.id.bmapView);
mBaiduMap = mMapView.getMap();
// 开启定位图层
mBaiduMap.setMyLocationEnabled(true);
// 定位初始化
mLocClient = new LocationClient(this);
mLocClient.registerLocationListener(myListener);
LocationClientOption option = new LocationClientOption();
option.setOpenGps(true);// 打开gps
option.setCoorType("bd09ll"); // 设置坐标类型
option.setScanSpan(1000);
mLocClient.setLocOption(option);
mLocClient.start();
}
/**
* 定位SDK监听函数
*/
public class MyLocationListenner implements BDLocationListener {
@Override
public void onReceiveLocation(BDLocation location) {
// map view 销毁后不在处理新接收的位置
if (location == null || mMapView == null)
return;
MyLocationData locData = new MyLocationData.Builder()
.accuracy(location.getRadius())
// 此处设置开发者获取到的方向信息,顺时针0-360
.direction(100).latitude(location.getLatitude())
.longitude(location.getLongitude()).build();
mBaiduMap.setMyLocationData(locData);
if (isFirstLoc) {
isFirstLoc = false;
LatLng ll = new LatLng(location.getLatitude(),
location.getLongitude());
MapStatusUpdate u = MapStatusUpdateFactory.newLatLng(ll);
mBaiduMap.animateMapStatus(u);
}
}
public void onReceivePoi(BDLocation poiLocation) {
}
}
@Override
protected void onPause() {
mMapView.onPause();
super.onPause();
}
@Override
protected void onResume() {
mMapView.onResume();
super.onResume();
}
@Override
protected void onDestroy() {
// 退出时销毁定位
mLocClient.stop();
// 关闭定位图层
mBaiduMap.setMyLocationEnabled(false);
mMapView.onDestroy();
mMapView = null;
super.onDestroy();
}
}
| [
"kang21472382@qq.com"
] | kang21472382@qq.com |
eeaa0c6787e346f94fbf8d2d7eee4b9798255a15 | e2af21c3d2924b5804edebf3923f18d308ee9d34 | /src/test/java/com/example/slidesoccer/domain/model/move/MovedTest.java | 3917c7fbbf4d0fe654a316ad4c50dd4d7e380e09 | [] | no_license | syukai/SlideSoccer | c4ac6affe612889853e8e6315f856510c8e09366 | edfa5b5bef041f0eb2629bec65cedc1c28097c89 | refs/heads/master | 2020-05-17T21:46:19.346215 | 2019-07-20T08:18:01 | 2019-07-20T08:18:01 | 183,981,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 893 | java | package com.example.slidesoccer.domain.model.move;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
import com.example.slidesoccer.domain.model.panel.SmallPanel;
import com.example.slidesoccer.domain.model.space.Space;
import com.example.slidesoccer.domain.model.space.Spaces;
import com.example.slidesoccer.domain.type.position.Position;
import com.example.slidesoccer.domain.type.position.X;
import com.example.slidesoccer.domain.type.position.Y;
class MovedTest {
@Test
void test() {
Position base = new Position(X.of(1), Y.of(2));
Move move = new Move(new SmallPanel(base)
,base.down());
Spaces spaces = new Spaces(
new Space(base.down())
,new Space(base.right()));
Moved moved = move.move(spaces);
assertTrue(moved.getMovedPanel().isPosition(base.down()));
assertTrue(moved.getSpaces().contains(base));
}
}
| [
"d_hirayama@rapid.ocn.ne.jp"
] | d_hirayama@rapid.ocn.ne.jp |
7c1aa0b472d70d8c6a0ba8d1c7348e4e1b51feb1 | 7201cd48620f8f26a0d05cb507b7d930a38dadbc | /examples/design_patterns/03_FactoryMethod/Java/Aplicativo.java | 5ad1c86b7842e92de7609ebdfd0ac90768b555d7 | [
"MIT"
] | permissive | jucimarjr/ooerlang | f69c17cf3271a89e9b9a0391bf8d86367c75230f | 9c7c08eb05fd811ec5f6c617a5e39f59fb54c24a | refs/heads/master | 2016-09-02T05:16:27.663389 | 2014-07-18T13:12:37 | 2014-07-18T13:12:45 | 9,608,837 | 1 | 2 | null | 2014-05-18T18:14:26 | 2013-04-22T20:59:00 | Erlang | UTF-8 | Java | false | false | 432 | java |
public class Aplicativo {
private CommandFactory commandFactory;
public Aplicativo() {
commandFactory = new CommandFactory();
}
public void buttonEmail_clicked(){
BaseCommand comandoEnviar = commandFactory.create("CommandEmail");
comandoEnviar.executar();
}
public void buttonPDF_clicked(){
BaseCommand comandoEnviar = commandFactory.create("CommandPDF");
comandoEnviar.executar();
}
}
| [
"jucimar.jr@gmail.com"
] | jucimar.jr@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.